A concise, high-performance terminal AI coding agent written in safe Rust, powered by the DeepSeek API.
zero-code-cli brings an agentic coding workflow to your terminal: it can explore your codebase, plan a design, and write code on your behalf — all through a streaming TUI. It uses a Plan → Build dual-mode workflow so you can separate thinking from implementation, and ships with filesystem + shell tools the agent can call autonomously via a ReAct loop.
unsafe code (#![forbid(unsafe_code)])#![forbid(unsafe_code)] means no unsafe blocks, anywhere.~/.zero-code-cli/, and past sessions are distilled into a topic-based long-term memory that is recalled on demand.Tab.~/.zero-code-cli/memory/. List and switch sessions with /sessions./summary condenses all past sessions for a project into a topic-based memory.md via the API; relevant topic blocks are keyword-scored and injected as context on each new message. Sessions older than 7 days are auto-summarized.max_iterations turns (default 50) per message.retry_count times with configurable delay.read_file, write_file (both with partial read/write via line ranges), bash (with timeout enforcement), grep, ls — all defined with JSON Schema and accessible to the model.reasoning_content tokens from DeepSeek reasoning models (e.g. deepseek-reasoner).~/.zero-code-cli/config.toml.DEBUG=true for detailed logs to ~/.zero-code-cli/debug.log.rg) must be installed and on your PATH. The grep tool uses rg on Windows (Unix uses the system grep).
winget install BurntSushi.ripgrep.MSVC, scoop install ripgrep, or choco install ripgreprg --versiongit clone https://github.com/gaoze1998/zero-code-cli.git
cd zero-code-cli
cargo build --release
The binary will be at target/release/zero-code-cli (or target\release\zero-code-cli.exe on Windows).
# 1. Configure your API key
mkdir -p ~/.zero-code-cli
cat > ~/.zero-code-cli/config.toml <<'EOF'
api_url = "https://api.deepseek.com"
api_key = "sk-your-key-here"
model = "deepseek-v4-flash"
max_tokens = 4096
temperature = 0.7
max_iterations = 50
EOF
# 2. Run it from any project directory
cd your-project
zero-code-cli
On Windows PowerShell:
New-Item -ItemType Directory -Force "$env:USERPROFILE\.zero-code-cli"
@'
api_url = "https://api.deepseek.com"
api_key = "sk-your-key-here"
model = "deepseek-v4-flash"
max_tokens = 4096
temperature = 0.7
max_iterations = 50
'@ | Set-Content "$env:USERPROFILE\.zero-code-cli\config.toml"
Create ~/.zero-code-cli/config.toml:
api_url = "https://api.deepseek.com"
api_key = "sk-your-key-here"
model = "deepseek-v4-flash"
max_tokens = 4096
temperature = 0.7
retry_count = 2
retry_delay_secs = 2
max_iterations = 50
system_prompt = "You are a helpful coding assistant."
Environment variable overrides:
| Variable | Config key |
|---|---|
DEEPSEEK_API_KEY | api_key |
DEEPSEEK_API_URL | api_url |
DEEPSEEK_MODEL | model |
Tip: Because the client speaks the OpenAI-compatible chat completions format, you can point
api_urlat any compatible endpoint (e.g. a local proxy or other DeepSeek-compatible provider).
cargo run
# or with debug logging
DEBUG=true cargo run
| Key | Action |
|---|---|
Enter | Send message (or handle slash command) |
Tab | Switch Plan ↔ Build mode |
Ctrl+C / Ctrl+D | Quit |
Ctrl+W | Delete previous word |
Home / End | Move to line start/end |
Up / Down | Scroll conversation (1 line) |
PageUp / PageDown | Scroll conversation (5 lines) |
| Command | Action |
|---|---|
/new | Reset both Plan and Build conversations (auto-saves current session) |
/summary | Summarize all sessions into long-term memory (memory.md), then delete session files |
/plan | Switch to Plan mode |
/build | Switch to Build mode (captures plan artifact) |
/sessions | List all saved sessions for the current project |
/sessions <n> | Switch to session number n (auto-saves current session first) |
Sessions are automatically saved per-project to ~/.zero-code-cli/memory/<project>/sessions/. Each session file stores both Plan and Build conversation histories, the plan artifact, and the current mode.
Ctrl+C/Ctrl+D), on /new, and before switching to another session./sessions to see all saved sessions (most recent first), then /sessions 1 to load session #1.Past sessions are distilled into a topic-based knowledge file at ~/.zero-code-cli/memory/<project>/memory.md:
/summary sends all session transcripts to the API, which produces structured ## Topic: blocks and writes them to memory.md, then deletes the raw session files.memory.md is capped at 10 MB; when exceeded, the oldest topic blocks are pruned automatically./plan) — Ask the agent to research, explore, and design a solution. The system prompt guides it toward analysis and design, not code writing.Tab) — All agent messages from Plan are captured into a plan artifact./build) — On your first message, the plan artifact is injected as context. The Build system prompt focuses the agent on implementation.The agent can call these tools on your filesystem:
read_file — Read file contents, supports partial reads via start_line/end_line (1 MB limit)write_file — Write or overwrite a file, supports targeted edits via start_line/end_line (path traversal guarded)bash — Execute shell commands with configurable timeout (default 30s, max 120s)grep — Search files by regex (output truncated to 100 KB)ls — List directory contentsSee the examples/ directory for projects built with zero-code-cli:
src/
├── main.rs Entry point, terminal setup, event loop, agent_loop(), key handling
├── app.rs App state, dual message histories, plan artifact, slash commands
├── api.rs DeepSeek API client, SSE streaming, tool-call parsing
├── ui.rs Ratatui rendering: tabs, conversation, input, status bar
├── tools.rs 5 built-in tools with JSON Schema definitions
├── config.rs Config loading from TOML + env var overrides
├── session.rs Session persistence: save, load, list (JSON files per project)
├── memory.rs Long-term memory: topic-block search, summarization, expiry, size limits
└── logger.rs Debug logging to file
Data flow: user types → Enter spawns agent_loop() as a tokio task → api::stream_chat() POSTs to the API → SSE tokens stream through an mpsc channel → main event loop drains them into App → ui::draw() re-renders at ~60fps. When the model responds with tool calls, agent_loop() executes them, feeds results back, and loops (max max_iterations iterations, default 50). On every user message, memory::search_memory() keyword-scores topic blocks from memory.md and injects the relevant ones as system context; /summary (or sessions older than 7 days) triggers memory::run_summarization(), consolidating all sessions into memory.md and deleting the originals.
┌─────────────┐ Enter ┌──────────────┐ SSE stream ┌─────────────┐
│ Input box │ ─────────► │ agent_loop │ ◄────────────► │ DeepSeek API│
└─────────────┘ └──────┬───────┘ └─────────────┘
▲ │ tool calls
│ render ▼
┌───────┴───────┐ ┌──────────────┐
│ ui::draw() │ ◄───────── │ tools.rs │ read/write/bash/grep/ls
└───────────────┘ events └──────────────┘
Contributions are welcome! This project is intentionally small — please keep new code unsafe-free and within the existing module layout. Open an issue first to discuss larger changes.
MIT — see LICENSE.
No reviews yet. Be the first to rate this tool.
Sign in to leave a review.