Skip to content
mentoor

Topic 3 of 5 · 4 min read

Decision records that agents can follow

Goal: Write an architecture decision record with context, decision and consequences that an agent and a new teammate can follow.

An architecture decision record (ADR) is a one-page note that says what you decided, why, and what it costs, so nobody has to guess or re-argue it.

Check yourself · 1 of 3

Which three parts make up the core of an architecture decision record?

Choose one answer

Why it matters

A decision that lives in someone's head is lost within a year. A new teammate repeats the old debate. An agent cannot read heads at all: it only knows what is in the repository and the prompt. If your team chose PostgreSQL over MongoDB, or "no direct database calls from routes", and nothing is written down, an agent will make the opposite choice whenever it is easier. A short ADR, linked from the file the agent reads first, fixes that.

The parts of a useful ADR

  1. Title and status. A number and a verb phrase: "0007: Use the outbox pattern for events". Status is proposed, accepted or superseded by 0012.
  2. Context. The situation and the forces: what problem, what constraints, what was tried. Two to five sentences.
  3. Decision. One clear sentence in the active voice: "We will write events to an outbox table in the same transaction as the change."
  4. Consequences. What gets easier, what gets harder, and what you now must do. Include the bad side. This is the part people skip, and the part that makes the record honest.
  5. Rules an agent can follow. Two or three imperative lines: "Never publish to the queue from a request handler. Call outbox.add()."

Keep it to one screen. Store it in the repo, for example in docs/adr/, so it is versioned with the code. Then link it: add a line in AGENTS.md or CLAUDE.md such as "Architecture decisions are in docs/adr/. Read the ones that touch your task before editing."

Before and after

Weak: "We use the outbox pattern because it is better."

Better: "Context: publishing to the queue after commit lost events when the process crashed in between (two incidents). Decision: write events to an outbox table inside the same transaction; a worker publishes them. Consequences: no lost events; events can arrive twice, so consumers must be idempotent; one more table and worker to run."

The second version tells a reader when to apply it, what it costs, and what to check.

What goes wrong

  • Writing an essay. Nobody, human or agent, follows a ten-page document.
  • Hiding the downside. A record that lists only benefits cannot help someone decide whether it still applies.
  • Never updating status. An old accepted record that no longer holds makes agents follow dead rules. Mark it superseded.

Examples

A record an agent can obey

# 0012: Services own all database access
Status: accepted

Context: Routes ran SQL directly in 14 places; a column rename broke 9 of them.

Decision: Only files in `src/services/` import the database client.

Consequences: Routes become thin and easy to test. One more function per query.

Rules for agents:
- Never import `db/client` outside `src/services/`.
- If a route needs data, add or reuse a service function.

The last two lines are what the agent acts on; the rest tells a teammate why.

The pointer in AGENTS.md

## Architecture
Decisions are in `docs/adr/`. Before changing event publishing, auth or
database access, read the matching record and follow its Rules section.
If your change needs to break a rule, stop and ask.

The closing line matters: it turns a silent violation into a question you can answer.

Key points

  • An ADR records one decision with its context, the decision itself and its consequences, in about one screen of text.
  • Agents only know what is in the repo and the prompt, so a decision that is not written down will be reversed whenever the shortcut is easier.
  • The consequences section must include the costs; a record with only benefits cannot be re-evaluated later.
  • Link the ADR folder from AGENTS.md or CLAUDE.md and add two or three imperative rules the agent can follow directly.
  • Change the status to superseded when a decision is replaced, so stale rules do not mislead agents or people.

Common mistakes

  • Writing a long design essay instead of a one-screen record.
  • Leaving the consequences empty or listing only benefits.
  • Storing ADRs in a wiki that the agent never sees.
  • Forgetting to mark an old record as superseded when the decision changes.

Check yourself · 2 of 3

Why should an ADR be linked from AGENTS.md or CLAUDE.md?

Choose one answer

Check yourself · 3 of 3

A record says: "We use the outbox pattern because it is better." What is the most useful fix?

Choose one answer

Practice items, not counted towards your mastery.

Start here

More for this topic