Anvil ships features end-to-end — clarify, plan, build, review, PR —
across every repo in your project, on whatever model is cheapest for each stage.
No vendor lock-in. No markup. No hosted plan.
Anvil is an open-source, self-hosted AI coding agent — an end-to-end LLM pipeline (clarify → plan → build → review → PR) that runs on Claude, GPT, Gemini, and OpenRouter, or fully local via Ollama & OpenCode. It speaks the Model Context Protocol (MCP) and uses your own API keys. Written in TypeScript.
| #### Mix providers within a single pipeline Routing is per-stage, not per-run. A single feature can flow through three different providers without you lifting a finger. The pipeline doesn't care which one ran which step. | #### Cheap by design Routing-by-stage means premium models only show up where premium models actually matter. Read-only research and tight fix loops stay on the free tier — *always*. Live cost ledger per call. |
| #### No vendor SDK lock-in Every HTTP adapter is hand-rolled `fetch()`. No `@anthropic-ai/sdk`, no `openai` package, no LangChain, no Vercel AI SDK. Drop a model — your code keeps compiling. | #### Bring your own keys, or don't Ollama works fully offline. OpenCode's $10/mo Zen subscription replaces the entire local tier — no GPU required. Cloud is for the few stages that warrant it. |
| ### Pipeline Nine-stage feature pipeline — clarify, plan, build, test, validate, ship — fanned out across every repo in your project. Per-stage tool permissions, validate-fix retry loops, chain-fallback across models when a provider 429s. | ### Plan Generates a structured markdown plan before any code is written. Files touched, contracts crossed, risks flagged, cost estimated. Plan validators catch missing tests, missing rollback strategies, wrong stage routing. The agent can't skip planning. | ### PR Review Multi-pass automated review with evidence gates, incident binding, KB context, scope matching, dismissal filtering, and a verifier that runs the produced tests. Posts inline comments + a summary to GitHub. |
| ### Memory Long-term project memory with five types — working, episodic, semantic, procedural, profile. Auto-learners propose; a sleeptime ratifier decides. Code-fact drift detection keeps memories honest when the underlying file changes. **📊 83.4% on LoCoMo** (full 1,540-question set, vectorize-io's [Agent Memory Benchmark](packages/memory-core/benchmark)) — hybrid BM25 + vector + graph retrieval, runs fully local. | ### Project Multi-repo first. One `factory.yaml` describes your repos, languages, build commands, and cross-repo connections. Ships with templates for TypeScript, Go, Python, Rust, monorepos, and Django + Celery. | ### Knowledge Base AST-aware chunking via tree-sitter, hybrid retrieval (vector + BM25 + graph + rerank), project graph with 14 cross-repo edge strategies. Same engine the dashboard uses also exposed as an MCP server for any client. |
| ### Settings Provider keys, model registry, stage policy, OTel endpoint — all editable in the dashboard UI. Writes to `~/.anvil/.env` with a strict allowlist; no env-var injection. | ### Convention Extracts your codebase's real conventions — naming, imports, tests, error handling — formats them as living docs, and promotes recurring violations into hard rules. The agent stops making the same mistake twice. | ### History Every run, replayable. Diffs, PR URLs, reviewer verdicts, cost breakdown, model fallbacks taken. Resume any failed run from the failed stage; rollback any shipped run with one click. |
| ### Research Read-only investigation — *"what does this service do?"* or *"why does this fail?"* — that never escalates to premium models. Stays free-tier no matter what, because read-only shouldn't cost more. | ### Bug Fix Targeted fix workflow with a tight retry loop. Locked to local + cheap tier so a failing test doesn't burn premium tokens trying the same thing five times. | ### Observability OpenTelemetry spans with GenAI semantic conventions. Plug in Langfuse, Tempo, Honeycomb, or anything OTLP-compatible. Off by default. Privacy-safe prompt redaction. Real per-call cost ledger. |
| ### Auto-failover Provider goes down, hits a quota wall, or fails its liveness probe? The chain-walker burns the model for the rest of the run and walks to the next entry in the same tier — proactive (liveness probe at run start) plus reactive (`UpstreamError` duck-typing on every call). No paused runs, no double charges. | ### Resume + rollback Every run is checkpointed per stage. Resume from the failing stage without re-running the cheap stages before it. Roll back any shipped run with one click — branch + PR delete, restored workspace, audit log preserved. | ### MCP server Anvil's knowledge-base retriever ships as a standalone MCP server. Use it from Claude Code, Claude Desktop, Cursor, or any MCP client — same hybrid retrieval (vector + BM25 + graph + rerank), same project graph, no dashboard required. |
| ### Durable execution new in 0.3.0 Pattern-2 durable execution. Every step and every side effect is recorded to a SQLite event log at `~/.anvil/durable.db`. Kill the dashboard mid-run, relaunch, and the run picks up exactly where it left off — recorded effects return their cached result, no double spawns, no re-asking the user the same question. `ctx.effect()`, `ctx.waitForSignal()`, deterministic clock and uuid. | ### Race arbitration new in 0.3.0 Multi-process lease arbitration. Each run holds a TTL'd lease in the durable store; the live process heartbeats it. Crash mid-run and a sibling process auto-takes-over on boot — orphan scan finds expired leases, claims them, and the auto-resume queue replays the workflow from the durable cursor. No manual intervention; no duplicated work. | ### Policy gates new in 0.3.0 Policy editor lives at `/policy` in the dashboard. Toggle pause gates per stage (plan, implement, test, ship), set auto-approve thresholds on risk + confidence, cap per-run and per-day cost, configure Q&A budgets. Paused runs surface an in-app banner + modal — approve, reject, modify the artifact, iterate with a note, or rerun from a target stage. |
| **MVP 2 — Active** The dashboard is the canonical interface. The CLI ships `init`, `doctor`, `dashboard` today; more direct-scripting commands are on deck. | **Stable** Pipeline orchestration · multi-provider routing · knowledge indexing · memory ratification · convention extraction · PR review · OpenTelemetry · dashboard UI · **durable execution (Pattern-2, v0.3.0)** · **multi-process race arbitration (v0.3.0)** · **policy editor (v0.3.0)**. |