Zerostack: The Ultra-Lightweight Rust Coding Agent That Uses Only 8MB RAM
A project hit the Hacker News front page today that's turning heads — Zerostack, a minimal coding agent written in pure Rust. It clocked 73 points within its first hour and is still climbing fast. The pitch is dead simple: an 8.9MB binary that uses ~8MB of RAM and 0% CPU when idle. For comparison, JavaScript-based alternatives like opencode routinely consume 300MB of memory and burn 2% CPU just sitting there.
If you've been looking for a lightweight AI coding agent that won't turn your laptop into a space heater, Zerostack might be exactly what you need. This guide covers everything from installation to advanced usage.
Table of Contents
What Is Zerostack
Zerostack is a terminal-based AI coding agent inspired by pi and opencode. Written in pure Rust with roughly 7,000 lines of code, it packs in the core features you'd expect from a coding assistant:
- Multi-provider AI support (OpenRouter, OpenAI, Anthropic, Gemini, Ollama, custom)
- Full file operation toolkit (read/write files, bash execution, grep search, glob matching)
- crossterm-based terminal UI with Markdown rendering and mouse selection
- Session management: save, load, resume, and auto-compaction
- MCP (Model Context Protocol) support
- Integrated Exa search (WebFetch + WebSearch)
- Git Worktrees integration
- Sandbox support via bubblewrap
In short, it's a "has everything but isn't bloated" AI coding tool.
Why Rust
The benefits of writing this kind of tool in Rust are obvious: native binary, zero runtime overhead. Node.js-based tools (like opencode, parts of Cursor) need the V8 engine, which eats tens of megabytes of memory just to start. A Rust-compiled binary runs directly on the OS — no garbage collector, no JIT compilation.
Zerostack uses crossterm for its terminal UI, which means it doesn't depend on ncurses or other system libraries. It works seamlessly across Windows, macOS, and Linux. Markdown rendering and syntax highlighting happen right in the terminal.
Rust is highly expressive, and its crate ecosystem is excellent (reqwest for HTTP, tokio for async, serde for serialization). Features that take hundreds of lines in JS often take just dozens in Rust. Zerostack proves the "less is more" engineering philosophy.
Performance Benchmarks: Zerostack vs Competitors
Numbers don't lie. Here's how Zerostack stacks up against mainstream AI coding tools:
| Metric | Zerostack | opencode (JS) | Claude Code |
|---|---|---|---|
| Binary Size | 8.9 MB | ~50 MB+ (incl. Node) | ~100 MB+ (incl. runtime) |
| RAM Usage | ~8 MB | ~300 MB | ~200 MB |
| Idle CPU | 0% | ~2% | ~1% |
| Active CPU | ~1.5% | ~20% | ~10% |
| Lines of Code | ~7,000 | ~15,000+ | Not open source |
The memory difference is nearly 37x. CPU usage is 13x lower. For laptop users, that means longer battery life and quieter fans. For server deployments, it means lower cloud bills.
Installation
Installing Zerostack is a single command:
cargo install zerostack
You'll need the Rust toolchain installed first. If you don't have it:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Once installed, the zerostack command is ready to use. The whole process takes under a minute (depending on your network speed and compile time).
cargo install zerostack --features mcp. MCP is an optional compile-time feature — the binary will be even smaller without it.
Quick Start
After installation, just run:
zerostack
You'll see a crossterm-based terminal interface. On first run, Zerostack guides you through configuring an AI provider. The easiest option is OpenRouter:
# Set the environment variable
export OPENROUTER_API_KEY="your-api-key-here"
# Launch zerostack
zerostack
Once inside, you can interact with it using natural language. For example:
Write a Python quicksort implementationRead main.rs in the current directory and explain what it doesSearch the project for all uses of unwrap()
Zerostack automatically calls the right tools (file read, grep search, etc.) to complete your request.
Multi-Provider Support
Zerostack supports nearly every major AI provider, so you're never locked in:
- OpenRouter: One-stop access to almost every model — recommended for beginners
- OpenAI: GPT-4o, o1, o3, and more
- Anthropic: Claude 3.5 Sonnet, Claude 4 series
- Google Gemini: Gemini 2.0, Gemini 2.5 Pro
- Ollama: Locally-run open source models, fully offline
- Custom API: Any OpenAI-compatible API endpoint
This flexibility is perfect for developers who need to switch models by context. Use Claude Sonnet for daily coding (cheap and fast), o3 for complex architecture design (strong reasoning), and Ollama for sensitive code (stays local).
Built-in Tools
Zerostack ships with a complete developer toolkit:
- File Operations: Read, write, and edit files
- Bash Execution: Run shell commands
- Grep Search: Search codebases with text or regex
- Glob Matching: Find files by pattern
- WebFetch: Fetch web page content
- WebSearch: Search the web via integrated Exa search engine
These cover most daily development needs. The WebFetch and WebSearch integration is particularly handy — you can check docs or search Stack Overflow without leaving the terminal.
Prompt System
Zerostack includes a set of purpose-built prompt modes, each optimized for different scenarios:
- code: General coding tasks
- plan: Project planning and architecture design
- review: Code review
- debug: Debugging and error investigation
- ask: Q&A and knowledge queries
- brainstorm: Brainstorming
- frontend-design: Frontend design
- review-security: Security review
- simplify: Code simplification
- write-prompt: Prompt engineering
Select the mode that matches your current task for more targeted AI responses. For example, switching to review-security mode makes the AI focus specifically on potential vulnerabilities and security best practices.
Advanced Features
Session Management
Zerostack supports a full session lifecycle. You can save your current session and resume it later — essential for long-running coding tasks. More importantly, it has auto-compaction: when the conversation context grows too long, older messages are automatically compressed to stay within the model's context window.
Git Worktrees Integration
For developers juggling multiple branches, Zerostack offers native Git Worktrees support:
/worktree— Create a new worktree/wt-merge— Merge worktree changes/wt-exit— Exit and clean up a worktree
Worktrees let you have multiple working directories from the same repo, each on a different branch, without interference.
Loop System
For long-running tasks (large-scale refactoring, batch file processing), Zerostack provides the /loop command. It keeps the AI working until the task is complete, automatically handling intermediate results along the way.
Doom-Loop Detection
This is a clever design choice. When the AI makes the exact same tool call 3+ times in a row, Zerostack triggers a warning — it's probably stuck in a loop. This mechanism effectively prevents the AI from endlessly retrying a failing operation.
Permission System
Security matters in AI coding tools. Zerostack provides 4 permission modes:
- restrictive: Strictest — every operation requires confirmation
- standard: Default mode — dangerous operations need confirmation
- accept-all: Accepts all operations without asking
- yolo: Full send — including arbitrary shell commands
For production environments, stick with restrictive or standard. If you're in a local sandbox, accept-all is fine. yolo mode... only when you're really sure about what you're doing.
Additionally, Zerostack supports sandbox isolation via bubblewrap, further restricting the AI's file system access.
Where It Fits in the AI Coding Landscape
The AI coding tool market is crowded, but Zerostack has carved out a clear niche:
- Claude Code: Anthropic's official tool — most feature-complete, but closed-source, locked to Anthropic models, and resource-heavy
- Cursor: VS Code-based IDE — powerful but requires a GUI, unfriendly for remote development
- opencode: Zerostack's direct inspiration — similar features but written in JavaScript with high resource usage
- Aider: Python-based terminal AI tool — rich ecosystem but slow startup and heavy dependencies
- Zerostack: Rust-powered minimal approach — lowest resource usage, ideal for constrained environments and efficiency-focused developers
Zerostack is especially well-suited for:
- Using AI coding on resource-constrained servers or VPS
- Running an AI assistant long-term without impacting other work
- Pursuing a pure terminal workflow
- Teams that require open source and code auditability
Conclusion
Zerostack is a breath of fresh air in the AI coding tool space. In an era where everyone is piling on features and inflating binary sizes, it proves with 7,000 lines of Rust that a good tool doesn't need to be bloated.
Its core advantages boil down to three things:
- Extreme efficiency: 8.9MB binary, 8MB RAM, 0% idle CPU
- Feature-complete: Multi-provider, full toolkit, session management, permission control — nothing missing
- Open and transparent: Pure Rust implementation, auditable code, community-driven
If you're an efficiency-minded developer, or your development environment has limited resources, Zerostack is absolutely worth trying. One command — cargo install zerostack — is all it takes.
Repository: github.com/gi-dellav/zerostack
Related: Best AI Coding Agents in 2026 | Why Rust Is the Future of Systems Programming