Agentic Pattern Libraryby Vikas Goyal
← All patterns
72

Decision Records for Agents

Also known as: ADRs for agents, architecture decision records, why-files

Keep short decision records in the repo so agents know why the code is built the way it is.

TrackAI-native software delivery FamilyKnowledge layer Maturity Established ChangesContext
01

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

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.

03

Diagram

Memory filepoints to records docs/decisions/007 · 011 · 012 Agent planreads relevant records No conflictcites record in PR Conflictstop and ask New recordsupersedes old Proceedwith change agreed record kept, never edited

Code tells the agent what the system does; decision records tell it which parts are deliberate.

04

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
05

Trade-offs

Latency Read only when an area is changed
Cost A page per decision
Complexity A folder, a template and one rule in the memory file
Reliability Fewer agents undoing deliberate choices

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
06

Worked example

Scenario
The Linkwatch repo keeps decision records in `docs/decisions/`.
  1. Record 007“Use SQLite until we have more than one tenant.” Revisit when: a second tenant signs, or the database exceeds 10 GB.
  2. 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.
  3. 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.
  4. LaterThe first multi-tenant customer signs. Record 012 supersedes 007, and the agent cites 012 in its migration plan.
07

Failure modes

FailureSymptomMitigation
Records nobody readsAgents still undo recorded decisionsPoint to records from the memory file; require citations in plans
Edited historyOld reasoning silently rewrittenNever edit accepted records; supersede them
EssaysMulti-page records nobody finishesOne page maximum, in a fixed template
DogmaDecisions kept long after the reasons changedEvery record states the conditions that would change it