Dirge
A tiny Rust coding agent that carries memory across sessions, keeps cheap models on the rails, and routes each role to its own model.
- Source repo
- dirge-code/dirge
- Stars
- ★ 344
- Last updated
- 3mo ago
- FARS reviewed
- Sep 10, 2026
- License
- GPL-3.0
- Primary language
- Rust
- FA score
- 81/100 · Good
At a glance
- How it runs
- Works with
- Universal · cross-platformClaude Code · OpenAI API · Claude APIChatGPT · Codex (Partial support)
- Cost
- Free software; you pay for model usage
- Setup effort
- Low · running in minutes
- You'll need
- Typical use
- Refactoring a large Rust or Python repository in a long terminal session where you need to resume after compaction instead of starting over.
- Not a fit if
- Teams that need an IDE-embedded agent rather than a terminal TUI
- Projects that require vector-embedding code search
- Users who cannot supply any model API key or run a local model
- Maintenance
- Commits in the last 6 monthslast commit 2026-09-02
- Source review
- 81/100 · Good
What does this agent do, and when should you use it?
Dirge is a terminal coding agent written in Rust that the README measures at roughly 8 MB idle, 15 MB working and a 36 MB release binary; it was forked from zerostack and cites pi, opencode and maki as inspirations. Its centerpiece is a robust agent loop that repairs malformed tool calls, validates every write through tree-sitter before it touches disk, escalates to a stronger model after repeated failures, and trips circuit breakers on non-progressing loops. All authorization flows through one policy decision point with four security modes, op-based rules and a session allowlist, and a /why command can replay exactly which policy decided. Roles — main loop, review, escalation, summarization, subagent — are pointed at separate models, so OpenRouter, OpenAI, Anthropic, Gemini, DeepSeek, GLM, Cerebras, Ollama or any OpenAI-compatible endpoint can be mixed in a single session. Persistence lives in a local session database: two-tier per-project and global memory, a built-in issue board, durable resumable checkpoints, and a post-session orchestrator that extracts learnings into memory and skills. The same binary can expose itself as an MCP server via dirge mcp so a planner agent can hand implementation tasks to it.
You start an interactive session with the default code prompt or run one-shot with dirge -p "…"; the agent reads repository files, runs bash commands, calls tree-sitter semantic tools and LSP diagnostics, edits code, and can isolate work in a git worktree branch. Every write is validated by tree-sitter before it reaches disk, malformed tool input first passes a repair layer, and each authorization request is resolved by the single policy engine (four modes, op-based rules, session allowlist) with /why available to trace the decision. When the context folds at context_target (250k tokens by default) it writes a resumable checkpoint and forms project memory: salient entries stay inline, the rest demote to a one-line index that the agent dereferences or searches with SQLite FTS5. The session database also holds a native kanban issue board whose top open issues are surfaced at the start of every turn; the agent manages it with the issue tool and /issues views it. Role-assignment keys (provider, review_provider, escalation_provider, summarization_provider, subagent_provider) dispatch side jobs to different models, Janet plugins hook the full lifecycle, and Claude-compatible skills load instructions on demand. Running dirge mcp flips it into an MCP server that a planner agent drives on a persistent per-project session and receives a summary plus changed files from.
- Refactoring a large Rust or Python repository in a long terminal session where you need to resume after compaction instead of starting over.
- Running the main loop on a cheap model (DeepSeek, GLM, Cerebras) while review and escalation go to a stronger one to hold costs down.
- Teams that must audit why the agent was granted a tool call, using /why to print the full policy trace.
- Registering dirge as an MCP server so a planner such as Claude Code can delegate implementation work on a persistent per-project session.
- Asking quick questions from a zsh prompt with the :<prompt> prefix and sharing one session across shell commands.
- Air-gapped or self-hosted setups that point a provider alias at a local Ollama or any OpenAI-compatible base_url.
Key setup facts
Pulled from the install and usage notes below. The project README has the current values.
- Install / run
cargo install dirge-agentbrew install dirge-code/dirge/dirgecargo install dirge-agent --no-default-features --features no-pluginnix run . -- --version
- Environment variables
OPENROUTER_API_KEYDEEPSEEK_API_KEYZHIPU_API_KEY- Config files
~/.config/dirge/config.json.dirge/config.json- Install notes cover
- macOS · Linux
How do you install or deploy this agent?
Install the published crate (it ships as dirge-agent on crates.io; the installed command is still dirge):
cargo install dirge-agentOn macOS and Linux, Homebrew also works and makes upgrades a one-liner:
brew install dirge-code/dirge/dirgeThe default feature set builds the Janet plugin runtime, which needs a C compiler and libclang; skip it with the no-plugin set if you do not want those:
sudo apt install build-essential clang libclang-dev
cargo install dirge-agent --no-default-features --features no-pluginBuild with Nix instead:
nix build
nix run . -- --version
nix developFor --sandbox, which runs every bash command in an isolated environment, install bubblewrap:
sudo apt install bubblewrapHow do you use this agent?
Export a provider key and start the agent — OpenRouter is the default:
export OPENROUTER_API_KEY="sk-..."
dirge
dirge -p "Explain this project"
dirge -c
dirge --session my-refactorPick a provider and model explicitly, or use a first-class provider:
dirge --provider openrouter --model openai/gpt-4o
export DEEPSEEK_API_KEY="sk-..."
dirge --provider deepseekExpose dirge as an MCP server so another agent can delegate to it:
dirge mcp
claude mcp add dirge -- dirge mcpRole routing and permission rules live in ~/.config/dirge/config.json (a .dirge/config.json in the repo root overrides it per project):
{
"provider": "glm",
"critic_provider": "deepseek",
"summarization_provider": "deepseek-flash",
"providers": {
"deepseek": { "model": "deepseek-v4-pro" },
"deepseek-flash": {
"provider_type": "deepseek",
"model": "deepseek-v4-flash",
"api_key": "${DEEPSEEK_API_KEY}"
},
"glm": {
"provider_type": "glm",
"api_key": "${ZHIPU_API_KEY}",
"model": "glm-5.2"
},
"ollama": {
"provider_type": "openai",
"base_url": "http://127.0.0.1:11434/v1"
}
},
"permission": {
"rules": [
{ "op": "mcp", "match": "mcp_tool:lattice:*", "effect": "allow" }
]
}
}Inside a session, slash commands handle switching and inspection: /agent for profiles, /mode for the security mode, /issues for the board, /compress to force a compaction pass, /why to dry-run a permission decision.
Safety boundaries, hardening & integrations
Operational blast radius, source-verified safety controls, and first-run hardening steps before connecting this agent to real workspaces.
Declared capability surface (blast radius)
Can run terminal commands; pair with approval gates or container/OS sandboxing.
Modifies local files; work on a clean Git branch or dedicated worktree.
Makes outbound requests; verify telemetry settings and model data routing on private repos.
Inherits capabilities of connected MCP servers; audit third-party servers before enabling.
FARS trust-control audit
- least-privilege scoping
- data-flow disclosure
- sensitive-data handling
- dependency security
What are this agent's strengths and limitations?
- Very small footprint: the README measures ~8 MB idle, ~15 MB working and a ~36 MB binary on a Linux release build, native Rust with no runtime.
- The loop is engineered for weaker models: tool-call repair, tree-sitter validation before writes, escalation on repeated failure, circuit breakers on stalled loops.
- One explainable permission engine — a single decision point, four modes, op-based rules, session allowlists, and a /why command that prints the full trace.
- Per-role multi-provider routing lets the main loop, review, escalation, summarization and subagents run on different models and OpenAI-compatible endpoints.
- Context folding writes resumable checkpoints and two-tier project memory (inline entries plus an FTS5-searchable breadcrumb index), so long sessions survive a bounded window.
- Extensible at runtime through Janet plugins and Claude-compatible skills, and consumable by other agents because it can run as an MCP server.
- The default feature set compiles the Janet plugin runtime, so source builds need a C compiler and libclang or fail inside janetrs/evil_janet.
- Terminal TUI only, plus a zsh shell plugin — there is no VS Code or JetBrains extension.
- Vector embeddings are deliberately absent, so teams that want semantic code search over an index will not find it here.
- The configuration surface is broad (provider aliases, role routing, permission rules, context_target, MCP/LSP/plugin wiring) and needs tuning to pay off.
- GPL-3.0-only licensing has copyleft implications for embedding it in a closed product.
- Sessions, memory and the issue board live in a local SQLite database with no documented cross-machine sync.
How does this agent compare with similar options?
The README names opencode, maki and pi as design inspirations, states that dirge was forked from zerostack, and credits vix and MiMo-Code for ported mechanisms. Against JS-based agents — which the README puts around 300 MB — the differentiator is native Rust footprint plus a loop built to keep weak models working. Against IDE-embedded agents it works as a terminal TUI and an MCP server, and it documents a pairing with Claude Code where the planner delegates implementation to dirge.
Key facts side by side with the most closely related agents.
| Agent | Source review | Form / cost | Stars | Updated | Language | Full support on |
|---|---|---|---|---|---|---|
| Dirge This agent | 81 · Good | CLIFree + model costs | ★ 344 | 3mo ago | Rust | Claude Code · OpenAI API · Claude API |
| Pi Agent Rust | 70 · Some gaps | — | ★ 2k | today | Rust | OpenAI API · Claude API |
| Graphicle | 84 · Good | CLIFree + model costs | ★ 634 | today | Rust | Codex · Claude Code |
| opencode-rust | 50 · Major gaps | — | ★ 18 | 1mo ago | Rust | OpenAI API · Claude API |
How does FollowAgents rate this agent?
Why each dimension lost points
Evidence shows a centralized permission engine (single Policy Decision Point, four modes, session allowlists, /why traceable decisions), bubblewrap/microVM sandboxing, secrets kept out of config (${VAR} interpolation, --api-key-file/stdin with explicit warning about --api-key), and a documented CVE-2026 dependency audit that disables rig default features and eliminates all 6 cargo-audit findings — justifying full marks for least_privilege, data_flow_transparency, sensitive_data_handling, dependency_security. Deductions: accept/yolo confirmation boundaries and autonomous --goal external-effect controls are described only briefly (user_confirmation 2, external_effects 2); /undo and checkpoint rollback scope for on-disk writes is unstated (rollback 2); attribution is a single author email with unclear contributor provenance (source_attribution 2).
High self-consistency: README, Cargo.toml, and CI mutually corroborate (dirge-agent vs dirge binary rename explained identically in both; feature matrix matches install docs); CI covers four platforms/feature combos with -D warnings. Deductions: degradation behavior when external MCP/LSP/debugger dependencies are unavailable is only partly described (dependency_availability 2); troubleshooting exists for device-code auth but many failure paths are unshown (failure_messages 2).
Audience and scenarios are well covered (weak-model positioning, cost budgets, multi-provider, local Ollama, Nix/Windows/macOS/Linux, shell plugin, MCP delegation) — full marks. Deductions: trigger precision (tool-call repair, circuit-breaker conditions) is narrative only (2); 'keeps weaker models on the rails' is not statically verifiable (capability_boundaries 2).
Excellent information architecture (docs/ catalog, config schema, slash-command table); installation notes cover cargo/brew/Nix/prebuilt binaries with build-failure workarounds — full marks. Candid known limitations (Windows test gaps, Janet-on-MSVC impossibility, Unix-assuming test suite) score 3. Deductions: inherent crate-name/command-name fork despite explanation (naming_stability 2); no CHANGELOG file, only version 0.25.4 and release workflow (versioning_changelog 2); single-maintainer project with responsibility inferred from CI (maintenance_responsibility 2). License full marks: full LICENSE text matching 'GPL-3.0-only' in Cargo.toml.
Clear marginal value: memory footprint, role-based model routing, FTS5 memory, built-in issue board are identifiable differentiators (marginal_value 3). Deductions: output usability is asserted via feature lists, not statically verifiable (2); cost-benefit arguments (250k budget, escalation) are reasoned but rest on unexecuted runtime data (2).
Good claim traceability: dense doc links and CI issue IDs (dirge-4xgd, #712); scored 2 because most link targets are outside the reviewed file set. Performance figures (8/15/36 MB) are labeled approximate without methodology (corroboration 2). Research citations are carefully scoped ('covers conversational memory, not code semantics') but benchmark/comparison claims are self-reported (fact_inference_separation 2).
- accept/yolo modes and --goal autonomous runs bypass human confirmation; use restrictive mode and audit session logs in production.
- Docs cite several facts unverifiable in static review (2026 CVE IDs, models like deepseek-v4/glm-5.2, a 2026 arXiv paper); verify independently before adoption.
- Performance/memory figures are self-reported approximations; the cited comparison study does not cover code-semantic retrieval.
- Windows is build-only in CI and the test suite assumes Unix semantics; Windows users bear additional risk.
- Publisher is unverified and identity unknown; single-maintainer project with low bus factor.
- Crate name is dirge-agent but the command is dirge — distinguish this in scripts and docs.
FAQ
Can it use local models?
Why is there no vector index?
What happens when a cheap model emits a malformed tool call?
Does a long session forget earlier work when context folds?
Can another agent delegate work to dirge?
Thanks — we use this to improve the page.
Subscribe to the FollowAgents RSS feed, or save this agent to your browser shortlist to compare on your next visit.