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

At a glance

How it runs
CLIMCP server
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
Rust toolchain with cargo (source builds)C compiler and libclang for the default Janet plugin featureModel provider API key (e.g. OPENROUTER_API_KEY)bubblewrap (only for --sandbox mode)Shell / CLINetwork accessLocal filesystemMCP Server
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.

  1. Refactoring a large Rust or Python repository in a long terminal session where you need to resume after compaction instead of starting over.
  2. Running the main loop on a cheap model (DeepSeek, GLM, Cerebras) while review and escalation go to a stronger one to hold costs down.
  3. Teams that must audit why the agent was granted a tool call, using /why to print the full policy trace.
  4. Registering dirge as an MCP server so a planner such as Claude Code can delegate implementation work on a persistent per-project session.
  5. Asking quick questions from a zsh prompt with the :<prompt> prefix and sharing one session across shell commands.
  6. 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-agent
  • brew install dirge-code/dirge/dirge
  • cargo install dirge-agent --no-default-features --features no-plugin
  • nix run . -- --version
Environment variables
OPENROUTER_API_KEY DEEPSEEK_API_KEY ZHIPU_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-agent

On macOS and Linux, Homebrew also works and makes upgrades a one-liner:

brew install dirge-code/dirge/dirge

The 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-plugin

Build with Nix instead:

nix build
nix run . -- --version
nix develop

For --sandbox, which runs every bash command in an isolated environment, install bubblewrap:

sudo apt install bubblewrap

How 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-refactor

Pick 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 deepseek

Expose dirge as an MCP server so another agent can delegate to it:

dirge mcp
claude mcp add dirge -- dirge mcp

Role 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)

Local shell command execution

Can run terminal commands; pair with approval gates or container/OS sandboxing.

Local filesystem read/write

Modifies local files; work on a clean Git branch or dedicated worktree.

Outbound network access

Makes outbound requests; verify telemetry settings and model data routing on private repos.

External MCP tool bridge

Inherits capabilities of connected MCP servers; audit third-party servers before enabling.

FARS trust-control audit

Verified present in source (3/3)
  • least-privilege scoping
  • data-flow disclosure
  • sensitive-data handling
  • dependency security

What are this agent's strengths and limitations?

Pros
  • 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.
Limitations
  • 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?

FollowAgents source review · FARS-2.1
Good
81/ 100 5-point scale 4.1 / 5
Trust 24/29
Reliability 11/14
Adaptability 15/18
Convention 16/18
Effectiveness 10/13
Verifiability 5/8
Why each dimension lost points
Trust24 / 29 · 4.1/5

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).

Reliability11 / 14 · 3.9/5

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).

Adaptability15 / 18 · 4.2/5

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).

Convention16 / 18 · 4.4/5

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.

Effectiveness10 / 13 · 3.8/5

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).

Verifiability5 / 8 · 3.1/5

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).

Risks and how to mitigate them
  • 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.
Evidence confidence: Low Reviewed Sep 10, 2026 Reviewed revision 317941f1a4c0
See the full review method →
Maintain this project? Add the FARS badge to your README

The badge shows the current review score and verdict and links back to this page. It refreshes about once an hour after a re-review.

FARS

[![FARS review](https://followagents.com/badge/dirge.svg)](https://followagents.com/en/agents/dirge)
<a href="https://followagents.com/en/agents/dirge"><img src="https://followagents.com/badge/dirge.svg" alt="FARS review"></a>

FAQ

Can it use local models?
Yes. Point a provider alias whose provider_type is openai at a local base_url, such as Ollama on http://127.0.0.1:11434/v1; for local vision models there is a per-provider multimodal override.
Why is there no vector index?
Dirge deliberately ships none. Code search is inline grep and cross-session memory search is SQLite FTS5, while structural code questions go to tree-sitter semantic tools and LSP; the README cites an empirical study of agentic search to justify the defaults.
What happens when a cheap model emits a malformed tool call?
A repair layer fixes malformed tool input first, every write is validated by tree-sitter before touching disk, repeated failure escalates to a stronger model, and a non-progressing loop hits a circuit breaker instead of spinning.
Does a long session forget earlier work when context folds?
The working context is budgeted at 250k tokens by default (min of model window and context_target). On folding, dirge writes a resumable checkpoint and persists facts and pitfalls into project memory, so specifics are recovered on demand rather than billed every turn.
Can another agent delegate work to dirge?
Yes — run dirge mcp to expose it as an MCP server, register it with claude mcp add dirge -- dirge mcp, and a planner hands you implementation tasks on a persistent per-project session, receiving a summary and the changed files back.
Was this page helpful?
View on GitHub ↗ Install ↓

Compare agents like this one

The same FARS review applied across the shortlist this agent qualifies for.

Related concepts