Decision Records for Agents
Keep short decision records in the repo so agents know why the code is built the way it is.
Problem
Agents can read code and explain what it does, but not why it was built that way. So they “improve” deliberate choices: swapping a database chosen for simplicity, removing a retry that guards a flaky vendor, undoing a shortcut taken for speed. The reasons live in old chats and in people’s heads, and people move on.
- Code shows what, not why.
- The memory file must stay short.
- Long design documents go stale and aren’t read.
- A decision that is never revisited becomes dogma.
Solution
Record each significant decision as a short numbered file in docs/decisions/: title, date, status, context, the decision, its consequences, and the conditions that would change it, all in under a page. The memory file points to the folder and tells agents to read the relevant records before changing an area, and to cite record numbers in plans and pull requests. When an agent’s plan conflicts with a record, it stops and asks, or proposes a new record that supersedes the old one. Accepted records are never edited, only superseded.
Diagram
Code tells the agent what the system does; decision records tell it which parts are deliberate.
When to use
Use it when
- Codebases with deliberate, non-obvious choices
- Agents doing larger changes or refactors
- Teams with turnover or many contributors
- After design spikes, to record what was chosen and why
Avoid it when
- Trivial choices nobody would question
- Local quirks better explained by a code comment
- Teams that won't keep record status current
Trade-offs
Gains
- Agents respect deliberate choices instead of undoing them
- Decisions can be challenged on their stated conditions
- New people and agents learn the why in minutes
Costs
- Discipline to write a record when deciding
- Superseded records pile up without an index
- Records only help if agents are told to read them
Worked example
The Linkwatch repo keeps decision records in `docs/decisions/`.
- Record 007“Use SQLite until we have more than one tenant.” Revisit when: a second tenant signs, or the database exceeds 10 GB.
- Agent planDuring a performance task the agent’s first idea is moving to Postgres. Reading record 007, it flags the conflict and asks instead of proceeding.
- DecisionThe developer confirms there is still one tenant. The agent finds a missing index instead: 95th-percentile query time drops from 420 ms to 60 ms.
- LaterThe first multi-tenant customer signs. Record 012 supersedes 007, and the agent cites 012 in its migration plan.
Failure modes
| Failure | Symptom | Mitigation |
|---|---|---|
| Records nobody reads | Agents still undo recorded decisions | Point to records from the memory file; require citations in plans |
| Edited history | Old reasoning silently rewritten | Never edit accepted records; supersede them |
| Essays | Multi-page records nobody finishes | One page maximum, in a fixed template |
| Dogma | Decisions kept long after the reasons changed | Every record states the conditions that would change it |