Headless CLI
zagens is Zagens’ headless command-line interface — the same agent runtime as the desktop app (the desktop embeds zagens-runtime; HTTP contract matches). Use it for scripts, CI, remote servers, and as the primary entry on macOS / Linux where no desktop installer ships yet.
Install steps: CLI install section on the public install guide.
vs desktop
| Desktop (Tauri) | CLI zagens |
|
|---|---|---|
| UI | WebView, sidebar, diff, replay | Terminal output |
| Platform | Windows 10/11 x64 | Windows / macOS / Linux |
| Config | ~/.zagens/config.toml |
Same |
| Engine | Local sidecar | In-process runtime |
You can use both: desktop for daily work, CLI for automation.
Install and verify
# crates.io (Rust stable required)
cargo install zagens-cli --bin zagens --locked
# Or prebuilt from GitHub Releases
# https://github.com/didclawapp-ai/zagens/releases
# Windows: zagens-x86_64-pc-windows-msvc.exe
zagens --version
zagens doctor
API key
Any one of:
zagens login # writes ~/.zagens/config.toml
export DEEPSEEK_API_KEY=sk-... # env var for the session
Set api_key, base_url, default_text_model, etc. in ~/.zagens/config.toml — see product repo config.example.toml.
Project overlay: .zagens/config.toml in the workspace (skip with --no-project-config).
Quick start
cd /path/to/your-repo
# Q&A without tools
zagens exec "Summarize README.md in three bullets"
# Agent mode: tools + shell (auto-approve — trusted CI only)
zagens exec "Run cargo test -p mycrate" --auto
# Machine-readable output
zagens exec "List main modules under src/" --json
# Explicit workspace (default: cwd)
zagens -w /path/to/repo exec "…"
Common global flags:
| Flag | Role |
|---|---|
-w, --workspace |
Workspace root |
--config |
Config file path |
--profile |
Named config profile |
-v, --verbose |
Verbose logging |
--enable / --disable |
Toggle feature flags for one run |
Command overview
| Command | Purpose |
|---|---|
zagens doctor |
Environment and config diagnostics (--json skips live API probe) |
zagens login / logout |
Save / remove API key |
zagens models |
List models from configured endpoint (--json) |
zagens exec |
One-shot non-interactive prompt (--auto for tools) |
zagens review |
Code review over git diff (--staged / --base) |
zagens apply |
Apply a patch file or stdin |
zagens setup |
Bootstrap MCP / skills / tools templates |
zagens mcp … |
Manage MCP config (list, tools, add, …) |
zagens serve --http |
Local HTTP/SSE runtime API |
zagens sandbox … |
Windows: sandbox setup / teardown / add-read-dir |
zagens sessions |
List saved sessions |
zagens resume / fork |
Resume or fork a session (--last) |
zagens completions |
Shell completions |
zagens features list |
Feature flag state |
zagens eval |
Offline eval harness (no network) |
Run zagens --help and zagens <cmd> --help for the exact build you installed.
zagens exec
zagens exec "Refactor auth and add tests" --auto
zagens exec "Explain config.rs" --model deepseek-v4-flash
zagens exec "Summarize changes" --json > out.json
| Flag | Meaning |
|---|---|
--auto |
Agent mode: tools + shell with auto-approval (same tool surface as global --yolo) |
--json |
Structured JSON for CI parsers |
--model |
Override text model for this run |
Safety: --auto may run shell and writes when policy allows. On Windows, complete Windows sandbox setup first; tighten sandbox_mode in CI — see Execution policy.
zagens review and zagens apply
zagens review --base origin/main
zagens review --staged
zagens apply fix.patch
review uses the same routing as desktop; cap diff size with --max-chars.
zagens serve --http
Exposes the same HTTP/SSE runtime API as the desktop sidecar (default 127.0.0.1:7878):
zagens serve --http --port 7878 --auth-token "$DEEPSEEK_RUNTIME_TOKEN"
| Note | Detail |
|---|---|
| Current release | Only --http is supported (--mcp / --acp exit with an error) |
| Bind address | Defaults to localhost; use --auth-token if binding beyond loopback |
| Ready signal | Prints DS_PICK_READY JSON with port for probes |
For local integration tests or custom orchestrators calling /v1/threads. Contract: product repo docs/tech/API_DESIGN.md.
zagens setup and MCP
zagens setup --all
zagens setup --mcp
zagens setup --skills
zagens setup --status
zagens mcp list
zagens mcp tools
zagens mcp validate
Desktop Settings → MCP shares ~/.zagens/mcp.json. See MCP servers.
Windows: zagens sandbox
Windows only — pairs with Windows sandbox:
zagens sandbox setup
zagens sandbox teardown
zagens sandbox add-read-dir D:\extra\read\path
zagens sandbox poc deny-read
zagens sandbox run … is not available in headless CLI yet; agent shell goes through runtime sandboxing on exec --auto.
Sessions
zagens sessions --limit 10
zagens resume <session-id>
zagens resume --last
zagens fork --last
Shares storage layout with desktop threads (DEEPSEEK_RUNTIME_DIR / default under ~/.zagens). Desktop session restore maps to resume / fork on CLI.
Environment variables
| Variable | Role |
|---|---|
DEEPSEEK_API_KEY |
Provider API key |
DEEPSEEK_RUNTIME_TOKEN |
Auth for serve --http |
DEEPSEEK_CONFIG_PATH |
Override config path |
DEEPSEEK_RUNTIME_DIR |
Runtime data directory |
CLI vs desktop
| Scenario | Prefer |
|---|---|
| Daily coding, diff, replay, approval UI | Desktop |
| CI review or one-shot automation | zagens exec / review |
| Headless Linux server | CLI + optional serve --http |
| Office deliverables | Desktop Office mode |
| Schedules | Desktop Scheduled tasks or external cron + HTTP API |
Limits
- Desktop installer is Windows-only today; CLI covers all three OSes.
zagens serve: only--httpin this release.- Full-screen TUI (
zagens-tui) is in development — out of scope here. - Subcommands evolve per release — trust
zagens --helpon your binary.
Related: Install guide · Windows sandbox · Execution policy · MCP · In-app updates