Architecture Decision Records (ADRs)
An ADR is a one-page record of one significant decision (context, decision, consequences) kept in the repo and never edited after acceptance, only superseded, so future engineers know why.
Analogy: A ship's logbook: when the wind changes you don't rewrite yesterday's entry; you add a new one saying what changed and why.
How it works
- Write one for architecturally significant decisions: those that affect structure, quality attributes, dependencies or interfaces.
- State the decision in active voice ("We will…") and list the consequences, good and bad.
- Store it in the repo next to the code and review it in a PR, like code.
- Keep it to 1–2 pages: a design doc explores the options; the ADR records the outcome.
- Name a revisit trigger, such as a data-size or latency limit, so reopening it takes minutes, not a quarter.
Check yourself
Answer to mark it learned; your answers aren't scored.
Your team replaced pgvector with a managed vector DB. A teammate opens a PR that edits accepted ADR-007 ("Use pgvector") so its Decision now says "managed vector DB", to keep the docs accurate. What do you ask for instead?
Go deeper
Full explanation
An Architecture Decision Record is a short text file that captures one architecturally significant decision: one that affects structure, quality attributes, dependencies or interfaces. Michael Nygard proposed the format in 2011 with five parts:
- Title — numbered, short: ADR-007: Use pgvector for retrieval.
- Status — proposed, accepted, deprecated, or superseded by ADR-019.
- Context — the forces at play: constraints, requirements, what was true then.
- Decision — in active voice: "We will…".
- Consequences — everything that follows, good and bad.
Three rules make ADRs work:
- Immutable. Once accepted, the reasoning isn't edited. When the decision changes, write a new ADR and mark the old one superseded. The history of thinking is the point.
- In the repo, next to the code (
docs/adr/), reviewed in a PR like code, so it's versioned and found by whoever touches that code. - Short. One or two pages. A design doc (Design docs & RFCs) explores options; an ADR records the outcome.
Why bother: code shows what was built, never why the alternatives lost. Without ADRs, a new architect either keeps a bad decision out of fear or reverses a good one and relearns the old lesson in production.
Code Nygard-style ADR, filled in: choosing a vector database
# ADR-007: Use pgvector in our existing Postgres for RAG retrieval
Status: Accepted (2026-03-14)
Deciders: platform, search, security · Supersedes: none
## Context
- Support RAG holds ~2M chunks; the plan says < 10M within 18 months.
- We already run managed Postgres: backups, PITR, IAM, on-call.
- Retrieval must filter by tenant_id and document ACLs in one query.
- No capacity this year to operate a new stateful system.
- Options: pgvector (HNSW), a managed vector DB, OpenSearch k-NN.
## Decision
We will store embeddings in Postgres with pgvector and HNSW indexes,
behind our `Retriever` interface. No service queries vectors directly.
## Consequences
+ No new vendor, contract or security review.
+ ACL and tenant filters are plain SQL in the same transaction.
+ Chunks, metadata and embeddings stay consistent.
- Index builds compete with OLTP load: we build on a replica.
- Hybrid search (BM25 + vectors) needs extra work in Postgres.
- Revisit trigger: > 10M chunks or retrieval p95 > 150 ms → new ADR.Real example
Eighteen months after launch, a new architect sees RAG running on Postgres and proposes a dedicated vector DB "because that's the standard". ADR-007 shows the choice was driven by tenant ACL filtering in SQL and no ops capacity, and it names the revisit trigger: more than 10M chunks or retrieval p95 above 150 ms. Neither has fired, so the discussion takes ten minutes instead of a quarter. A year later the trigger does fire; ADR-019 picks a managed vector DB, and ADR-007's status becomes Superseded by ADR-019, its context left intact.
Trade-offs +3 · −3
+ You gain
- Preserves the why, which code and commit messages never capture.
- Cheap: a page per decision, reviewed in the same PR flow as code.
- Speeds onboarding and stops teams relitigating settled decisions.
− You pay
- Only as good as the discipline: teams start strong and quietly stop writing them.
- Becomes bureaucracy if used for trivial, reversible choices.
- Found only if people know to look; link them from code and READMEs.
Use it when
Any decision that's costly to reverse or that a future engineer would question: datastores, model providers, API contracts, tenancy model, data retention, security boundaries.
Avoid it when
Reversible, local choices: a helper library, a prompt wording, an internal refactor. If nobody will ask "why did we do this?" in a year, skip it.
Numbers to know 2
- Nygard (2011): 5 sections — title, status, context, decision, consequences.
- Rule of thumb: 1–2 pages; anything longer is exploration that belongs in a design doc.
Common pitfalls 4
- Editing an accepted ADR to match a new decision: the history is gone. Write a new one and supersede.
- Listing only positive consequences; the negatives are what the next reader needs most.
- Keeping ADRs in a wiki nobody opens instead of the repo they govern.
- Writing them after the fact to justify a decision, with the context reconstructed from memory.
Interview questions 2
Answer out loud first, then reveal.
Why ADRs, rather than just good design docs?Show answer
They solve different problems. A design doc is the exploration: long, debated, and often stale once the system is built. An ADR is the durable outcome: one page, in the repo, immutable once accepted. A year later nobody rereads a twelve-page doc, but they will read "ADR-007: use pgvector" right when they're about to change that code. I keep both: the doc links to the ADR it produced, and the ADR links back for the full reasoning.
A team wants to reverse an old architecture decision. How do you handle it?Show answer
First I read the ADR's context and check whether those forces still hold; that's the reason the record exists. If the context changed, reversing is legitimate: they write a new ADR with the new context, and the old one is marked superseded, not edited. If nothing changed, the burden is on them to show what the original authors missed. Either way the conversation is about evidence, not taste, and the history stays intact for the next person.