The system of record for agent teams
Agents come and go. The record stays.
Anvil is an open-source, local-first ledger for AI coding agents. Requirements, tasks, claims and evidence live in one place on your machine, outside any harness, so Claude Code, Codex, Cursor and a shell loop can work the same plan without overwriting each other.
uv tool install anvil-state
On Claude Code? Install the Claude Code plugin instead.
- MIT licensed
- Python 3.11+
- No account, no hosted backend
Watch one task go from claimed to proven
A real session, replayed. Two agents reach for the same task, approval is refused until there is evidence, and the finished state is rebuilt from the event log.
Recorded from the real CLI by scripts/record-site-demo.sh. Output is unedited apart from shortened paths; the demo keeps its state inside the project folder so you can see the files.
Why a system of record
Chat is not a database
Anvil is for developers who run more than one coding agent, or one agent across many sessions. That work fails in three predictable ways, and a better model does not fix any of them.
-
Two agents, one file
“Assigned” is a label, not a lock. Parallel sessions pick up the same task, or different tasks that touch the same file, and the last write wins.
-
“Done,” with nothing behind it
A checkbox flips. Nobody can say which command ran, what it returned, or who approved the result.
-
The plan dies with the session
Context compacts, the session ends, or you switch tools. The plan lived in the conversation, so it goes too.
Anvil moves the plan, the locks and the evidence out of the conversation and into a ledger every agent shares.
-
01 · Ledger
One record, outside the harness
-
02 · Coordination
One queue, single-winner claims
-
03 · Replay
State rebuilt from the log, safely
-
04 · Proof
Done comes with a receipt
How it works
Plan, claim, execute, prove
The whole loop is four moves. Anvil keeps the record of each one; your harness does the work.
-
Plan
Write a PRD, a product requirements document. Anvil parses it into tasks with dependencies, acceptance criteria and verification commands, and you approve the plan.
-
Claim
An agent asks for the next ready task and takes it under a lease. Until the lease is released or expires, nobody else can.
-
Execute
The agent works from a packet: intent, criteria, scope and non-goals. Where the harness has hooks, the checks it runs are captured as it goes.
-
Prove
Evidence goes to review. Approval marks the task done and writes a signed receipt of what was accepted.
01 · Ledger
A ledger that lives outside the harness
Every accepted change is one line appended to an event log, and a SQLite database is the queryable projection of that log. Together they are the ledger. It sits in a state directory on your machine, outside the repository by default and shared by every git worktree, and every harness reaches it through the same two doors.
-
It survives the session
A crashed session, a compacted context or a different harness opens the same tasks, claims and evidence. Work resumes from the record, not from memory.
-
There is one write path
Take the lock, validate, append the event, update the projection. A rejected request never enters the log.
-
There is nothing to host
No account and nothing to deploy. State is plain files you can inspect, back up and replay.
-
Any harness
- Claude Code
- Codex
- Cursor
- VS Code
- Zed
- OpenClaw
- Pi
- a shell loop
-
Two doors
anvilCLI for shells, loops and peopleanvil-mcpMCP server over stdio, for any MCP client
-
One write path
- lock
- validate
- append
- project
-
One record
- events.jsonlThe authority. One line per accepted change.
- state.dbThe projection. Rebuildable from the log.
02 · Coordination
One queue for every harness
Agents pull work instead of being handed it. A harness asks for the next task it is eligible for, claims it under a lease, does the work and submits evidence. Anvil decides who holds what. The harness decides how the work gets done.
-
Claims have one winner
A claim is a database row with a lease, not a label. The first writer wins and everyone else is refused.
-
Leases expire
Renewal needs observed progress. A lease nobody renews is released the next time anyone asks for or claims work, and the task returns to the queue.
-
The queue knows about conflicts
anvil nextskips tasks with unmet dependencies, active claims or declared files that overlap work in flight. -
A harness sets its own ceiling
anvil next --max-blastand--max-review-risk, both experimental, let a smaller or local model pull only the work it should take. The queue filters by risk; it does not route by model. -
Milestones ship as a bundle
One coordinator claims a set of tasks atomically, delegates in bounded batches and ships a single reviewed delivery.
$ anvil claim T001 --actor agent-a Claimed task 'T001' as 'agent-a'. $ anvil claim T001 --actor agent-b Error: Task 'T001' cannot be claimed: status is 'claimed', expected 'ready'.
Measured: in our coordination benchmark, file collisions fell from 4.0 to 0.0 and duplicate completions from 9.0 to 0.0 against a shared-markdown control. That is one trial with simulated actors, so read it as a mechanism check, not a field result. Read the benchmark results.
One machine or several, stated plainly.
-
Shipped
On one machine, claims are live
Any mix of harnesses, worktrees and unattended loops shares one queue, so when one subscription hits its rate limit another keeps pulling. Claims are enforced in real time by database transactions and a file lock.
-
Opt-in · early
Across machines, the event log rides in git
Keep state in the repository, store the event log in git, and it travels with your commits to a second laptop or a cloud session: hash-derived event ids, union merges and a deterministic replay order. Competing claims resolve at replay, earliest first, and the loser is not notified yet. This is not a live lock service. Convert on macOS or Linux, before the PRD is first reviewed.
-
Shipped
People follow along in GitHub
GitHub Issues sync mirrors task status where stakeholders already look.
anvil backuppushes the event log to an S3 bucket you own, andanvil restorereplays it elsewhere. Neither enforces a lease.
Coordinate a milestone bundle Read the git-backed events proposal Set up GitHub sync
03 · Replay
State replays, and replay is guarded
The event log is the authority, so the database can be rebuilt from it. anvil replay applies every event through the same handlers the live path uses, and on every pull request CI replays a recorded history and checks the rebuilt state against the expected one.
-
Log first, then project
The event is appended before the database changes. If a crash lands between the two, the next open applies the missing tail.
-
One writer at a time
A cross-process lock serializes appends, and event ids are assigned inside it. Concurrent writers cannot collide or drop events.
-
Replay stops on damage
A damaged line stops the replay with an error. Nothing is skipped silently; only a torn final line is tolerated.
-
Unknown events are refused
Live writes reject an event the engine does not understand, and replay aborts on one.
-
Satisfied requests add nothing
A request the state already satisfies, such as releasing a released claim, adds no event. Not every command is idempotent: scoring a task twice records two events.
-
Live state is off limits
Replay builds into a scratch database and refuses to target the live one.
-
Drift is found and repaired
anvil doctorreplays to scratch and compares.anvil repair projectionbacks up, rebuilds, verifies, then publishes. -
Versions are fenced
An older engine refuses before it writes. A newer one upgrades the schema on first open and refuses while a claim is active;
anvil migrate statemakes the upgrade a previewed, backed-up step.
- 12–14 ms
- p95 write inside the engine, 8 concurrent writers
- Engine time, not CLI response time. Inside our 15 ms target, with and without a board reading alongside.
- 8,000 of 8,000
- transitions recorded
- None missing and none duplicated across the contention runs.
- 150 ms
- p95 at 64 writers
- That misses the target. Anvil is measured at eight concurrent writers, not at swarm scale.
What this does not claim. The log is append-only and auditable, not tamper-proof: signatures cover acceptance proofs, not the log itself. Default durability favors speed and can lose the last few events in a hard power cut; set durability: strict to sync every event. The figures above are synthetic and come from the ledger latency validation note.
04 · Proof
Status is downstream of proof
An agent saying “done” changes nothing. A task reaches done only when submitted evidence is approved, and an anvil apply approval leaves a signed receipt of what was accepted.
-
Record
Command proofs
The exact command, its exit code, a SHA-256 of its output and the claim it ran under. Free text cannot stand in for one.
-
Gate
No evidence, no approval
Approval always needs submitted evidence, and the approval is itself recorded. In strict mode it is also refused until every required check has a matching, passing command proof.
-
Receipt
Signed acceptance proofs
An
anvil applyapproval writes an Ed25519-signed receipt that binds the project, task, claim, submitting actor, command results and event range.anvil proof verifychecks it on another machine against a trust list you control.
$ anvil apply T001 --approve --strict --reviewer human Error: strict evidence gate REFUSED approval of task 'T001': required evidence is missing. Task remains in needs_review. - `pytest -q` exits 0 Submit the missing evidence and re-run, or use --no-strict to override for this invocation.
$ anvil apply T001 --approve --reviewer human Task 'T001' approved by 'human' → done. Signed proof: ~/shortener/.anvil/proofs/T001-E000017.json
What the record establishes
- A command was recorded with this exit code and this output hash.
- It is bound to this claim, this actor and this task and PRD revision.
- A key on your trust list signed the acceptance, and the receipt has not been altered since.
- The checks can be frozen at planning with a verification profile, so the files that define them cannot change unnoticed.
What it does not
- It does not prove the code is correct, or that the command really ran. A hook reports the result and Anvil does not re-run it, so an agent that can write the evidence buffer could forge one.
- The gate is advisory by default: it reports what is missing and lets a person approve. Set
strict_evidence: trueto refuse by default. - Anvil runs checks itself only when you ask it to: with
anvil runon Linux, or from a workflow file. - Actor names are attribution, not authentication, and an actor can approve its own submission. The record shows who did.
Where this is going. Re-running recorded commands independently and a gate that is strict by default are open items on the strategic backlog. Until they land, read a proof as a strong record, not a guarantee.
Claim and ship a task How evidence is captured How attempt views work
Also in the box
A plan agents can execute
-
Work packets, not threads
anvil packet T012renders intent, acceptance criteria, scope, non-goals and verification: the contract for one task, sized for a small context. -
Six-dimension scoring
Complexity, parallelizability, context load, blast radius, review risk and agent suitability drive routing, not a single story-point number.
-
Several PRDs, one state
Each PRD is gated and approved separately, like a Terraform workspace. Conflict detection spans all of them.
-
A board for people
A local Kanban view over the same state. It is read-only unless you start it with write access.
Journeys
Pick up where you are
Each guide is a complete path, from a five-minute first project to coordinating a milestone across parallel workers.
Start
-
Run your first project
Init, PRD, plan, claim, evidence, done, in about five minutes.
-
Wire Anvil into your harness
One command for Codex, Cursor, VS Code, Zed and more; a plugin for Claude Code.
-
Execute in your own session
With
llm_provider: harness, your own session does the reasoning and Anvil makes no model calls. -
Author a PRD
The input format, readiness checks and how approval binds a revision.
Ship
-
Claim and ship a task
The whole loop for one task: claim, packet, submit, apply.
-
Drive the loop unattended
Turn a shell loop, a cron job or a Codex automation into a loop that pulls work.
-
Deliver across sessions
Resume long-running work from an attempt view and an evidence preflight.
-
Attest progress from outside
Renew a lease from a writer the hooks cannot see.
Scale
-
Coordinate a milestone bundle
Several tasks, one coordinator, one reviewed delivery.
-
Run tasks concurrently
Authorize a bounded batch, collect proof from each member and continue from the CLI.
-
Watch the board
Repositories, campaigns and tasks on a local Kanban board.
-
Dispatch a task from Anvil
anvil runhands one task to a configured harness, runs the frozen checks and stops at review. Linux only.
Harnesses
Works where your agents work
Anvil is not tied to one harness. Install it once, then wire it into the ones you run. The installer previews every change, backs up each file it touches and can roll back.
Native integration
A plugin or package: skills or commands, hooks and tools
- Claude Code
- Codex
- OpenClaw
- Pi
MCP in one command
anvil install <name> --write
- Cursor
- VS Code (Copilot)
- Windsurf
- Zed
- Amp
- OpenCode
- Roo
MCP by pasted config
anvil mcp-config <name> or a packaged snippet
- Cline
- Continue
- Goose
- Gemini CLI
- OpenHands
Orchestration is the hammer and the agents are the hand. Both keep changing. The anvil is the surface the work is done on.
Scope
What Anvil is not
-
Not a coding agent
It is the layer around your agents: packets in, evidence out.
-
Not an orchestrator
It does not schedule agents or pick the model that does the work. Dispatching a single task with
anvil runis opt-in. -
Not a service
There is no hosted backend, no account and no telemetry. State stays on your machine unless you turn on sync, backup or a hosted model.
-
Not an issue tracker
GitHub Issues is a sync target, not the source of truth.
Status: beta. The core loop is stable and is used to build Anvil itself. Some command surfaces may still change before 1.0. The roadmap says what is shipped and what is planned.
Open source
Built in the open. Come build it.
Anvil is MIT licensed, and its roadmap, backlog and design decisions live in these docs. It is a small project, which means a good pull request changes it.
-
Add a sync provider
GitHub Issues ships today. Linear is open on the roadmap and unclaimed, and there is a step-by-step guide to building a provider.
-
Package a harness
If the harness you use is missing, the installer is a table you can add a row to.
-
Improve the docs
Every page has an edit link. Fixes to guides and examples are welcome.
$ git clone https://github.com/fakoli/anvil.git $ cd anvil $ uv run --project bin anvil --help $ uv run --project bin pytest
One pull request per change. CI and an automated review have to pass before it merges.
Read the contributing guide See the roadmap Browse the backlog Open an issue on GitHub
Give your agents something solid to work on
Install the CLI, then run a complete project, from PRD to signed proof, in about five minutes.
uv tool install anvil-state