# Zerostack--一款采用纯Rust语言编写、受Unix启发的编程代理

- 来源：Hacker News 热门（buzzing.cc 中文翻译）
- 作者：gidellav
- 发布时间：2026-05-17 08:46
- AIHOT 分数：74
- AIHOT 标记：精选
- AIHOT 链接：https://aihot.virxact.com/items/cmp92lm860ngjslnztudqvy21
- 原文链接：https://crates.io/crates/zerostack/1.0.0

## 精选理由

不走 IDE 插件的老路，Zerostack 把编程代理做成命令行管道，Rust 纯血、Unix 哲学，适合喜欢拼接工具的开发者尝鲜。

## AI 摘要

Zerostack是一款采用纯Rust语言编写、受Unix哲学启发的编程代理工具，已正式发布1.0.0版本并在Rust包管理平台crates.io上提供。该发布在技术社区Hacker News上获得115点关注，反映出开发者对其的高度兴趣。Rust语言以内存安全和性能见称，Unix设计强调简洁与模块化，Zerostack结合两者优势，旨在提升编程效率，为代码辅助领域带来新选择。

## 正文

zerostack - crates.io: Rust Package Registry

zerostack v1.0.0

Minimalistic coding agent written in Rust, optimized for memory footprint and performance

#ai

#cli

#dev

zerostack

Minimal coding agent written in Rust, inspired by pi and opencode.

Features

Multi-provider: OpenRouter, OpenAI, Anthropic, Gemini, Ollama, plus custom providers

File tools: read, write, edit (by exact match with diff display), grep, find_files, list_dir

Bash execution: with permission gating, optional sandboxing for isolation, and doom-loop detection

Permission system: four configurable modes with per-tool patterns, session allowlists, and external directory policies

Session management: save/load/resume sessions, auto-compaction to stay within context windows

Terminal UI: crossterm-based, markdown rendering, mouse selection/copy, scrollback, reasoning visibility toggle

Prompts system: switch between system prompt modes at runtime (code, plan, review, debug, etc.) to tailor the agent's behavior to the task without having to manage Skills.

MCP support: connect MCP servers for extended tooling

Integrated Exa search: allows for WebFetch and WebSearch tools

Integrated Ralph Wiggum loops: looping capabilities for long-horizon tasks

Integrated Git Worktrees integration: Use /worktree to move the agent from one worktree to another.

Performance

zerostack is one of the smallest and most performant coding agents on the market.

Lines of code: ~7k LoC

Binary size: 8.9MB

RAM footprint: ~8MB on an empty session, ~12MB when working (vs ~300MB for opencode or other JS-based coding agents)

CPU usage: 0.0% on idle, ~1.5% when using tools (measured on an Intel i5 7th gen, vs ~2% on idle and ~20% when working for opencode)

Installation

In order to install zerostack, you must have Cargo and git installed. Then, run:

cargo install zerostack

You are now ready to work with a lightweight coding agent!

Optional: sandbox mode

Install bubblewrap for --sandbox, which runs every bash command inside an isolated environment to protect your system from accidental or malicious damage:

# Debian/Ubuntu
apt install bubblewrap

# Fedora
dnf install bubblewrap

# Arch
pacman -S bubblewrap

Quick start

# Set your API key (OpenRouter is default)
export OPENROUTER_API_KEY="[api_key]"

# Interactive session (default prompt: code)
zerostack

# One-shot mode
zerostack -p "Explain this project"

# Continue last session
zerostack -c

# Explicit provider/model
zerostack --provider openrouter --model deepseek/deepseek-v4-flash

Prompts system

zerostack includes a set of built-in system prompts that change the agent's behavior and tone.

The idea is to build a complete suite of prompts that can fully substitute skills like superpower or the Claude's official skills.

You can switch between different prompts or list all registered prompts using /prompt.

Built-in prompts:

Prompt Description

code (default) Coding mode with full file and bash tool access, TDD workflow

plan Planning-only mode — explores and produces a plan without writing code

review Code review mode — reviews for correctness, design, testing, and impact

debug Debug mode — finds root cause before proposing fixes

ask Read-only mode — only read/grep/glob permitted, no writes or bash

brainstorm Design-only mode — explores ideas and presents designs without code

frontend-design Frontend design mode — distinctive, production-grade UI

review-security Security review mode — finds exploitable vulnerabilities

simplify Code simplification mode — refines for clarity without changing behavior

write-prompt Prompt writing mode — creates and optimizes agent prompts

You can also create custom prompts by placing markdown files in $XDG_CONFIG_HOME/zerostack/prompts/ and referencing them by name.

Additionally, the agent automatically loads AGENTS.md or CLAUDE.md from the project root or any ancestor directory, injecting their contents into the system prompt. Use -n / --no-context-files to disable this.

Permission system

zerostack has four permission modes, from safest to most permissive:

restrictive (-R): every tool action prompts for approval unless explicitly allowed in config

standard (default): safe commands (ls, cd, git log, cargo check) are auto-approved; writes and destructive operations ask

accept-all (--accept-all): auto-approves all operations inside the working directory; external paths prompt for confirmation

yolo (--yolo): auto-approves everything without prompting

Permissions can be configured per-tool with granular glob patterns in the config file. For example, you can allow write **.rs automatically while always asking before writing to other files.

A session allowlist persists approved decisions for the duration of the session, so you don't have to repeatedly confirm the same operation.

Doom-loop detection: identical tool calls repeated 3+ times trigger a warning prompt (or denial depending on your config), preventing runaway agents from spamming destructive operations.

Slash commands

This is a list of the most important slash commands:

/model — Switch model

/thinking — Set thinking level

/clear — Clear conversation

/session — List/save/load sessions

/loop — Schedule recurring prompts

/prompt — List or change the agent's prompt

/mode — Set the permission system's mode

To see all of the commands, use /help.

Session management

Sessions are saved to $XDG_DATA_HOME/zerostack/sessions/. Use -c to resume the most recent session, -r to browse and select one, or --session <id> to load a specific session.

Loop system

zerostack includes an iterative coding loop for long-horizon tasks. The agent repeatedly reads the task, picks an item from the plan, works on it, runs tests, updates the plan, and loops until the task is complete or the iteration limit is reached.

NOTE The loop system is an experimental feature.

Loop usage

/loop Implement the user authentication system
/loop stop
/loop status

/loop <prompt> — Start a loop with the given prompt

/loop stop — Stop the active loop

/loop status — Show current loop state

Each iteration includes the original task, the evolving LOOP_PLAN.md, a summary of the previous iteration, and any validation output. Non-slash input is blocked while a loop is active.

Headless loops via CLI

zerostack --loop --loop-prompt "Refactor the API" --loop-max 10 --loop-run "cargo test"

Flag Description

--loop Enable headless loop mode

--loop-prompt <text> Prompt for each iteration

--loop-plan <path> Custom plan file path (default: LOOP_PLAN.md)

--loop-max <N> Maximum iterations (default: unlimited)

--loop-run <cmd> Validation command to run after each iteration

Git worktrees integration

zerostack provides a branch-per-task workflow using git worktrees. You can create, work in, merge, and exit worktrees entirely from the chat UI.

NOTE The git worktrees integration is an experimental feature.

Git worktree usage

The worktrees integrations offers 3 slash commands:

Command Description

/worktree <name> Create a git worktree on branch <name> and move into it (skips creating it if it already exists)

/wt-merge [branch] Merge the worktree branch into [branch] (default: main/master), push, clean up, and return to the main repo

/wt-exit Return to the main repo without merging

Example workflow for git worktrees

Create — /worktree feature-x creates a new branch and worktree directory and moves you there.

Work — Use zerostack normally; changes stay on the feature branch.

Merge — /wt-merge tells the agent to merge the branch, push, clean up, and return to the main repo.

Exit — /wt-exit immediately returns to the main repo without merging.

Supported providers

OpenRouter (default)

OpenAI-compatible (vLLM, LiteLLM, etc.)

Anthropic

Gemini

Ollama

Custom providers can be configured with any base URL and API key environment variable in $XDG_CONFIG_HOME/zerostack/config.json.

License

GPL-3.0-only

Metadata

Release date:30 days ago

2024 edition

License:GPL-3.0-only

6.7K SLoC

Size:115 KiB

Package URL:pkg:cargo/zerostack@1.0.0

Install

cargo install zerostack@1.0.0 Running the above command will globally install the zerostack binary.

Browse source

docs.rs/crate/zerostack/1.0.0/source

Repository

github.com/gi-dellav/zerostack

Owners

Report crate

Stats Overview for 1.0.0 (see all)

116 Downloads all time

30 Versions published

Downloads over the last 90 days

Display as

Stacked
