Skip to content
refs
History
5.2 KBRaw

Decision records

A decision record is a short block in a commit message. It tells a person about a choice that they must judge. This document is the reference for when to write a record, its format, and how the origin checks it.

When to write a record

Write a record only when all three statements are true:

  1. You made the choice. The request, AGENTS.md and the earlier decisions did not make it for you.
  2. A reasonable person could make a different choice.
  3. A later change is expensive. It changes one of these:
    • What users or other agents can do.
    • The stored data.
    • A public interface.
    • Security, privacy or cost.
    • A part of the system that is hard to replace, for example a hosted service or the place where the product keeps data.

A choice that goes against the request, AGENTS.md or an earlier decision is always a decision.

The type of the commit does not change the test. A refactor or a fix that changes what users can do has a decision.

What not to record

Item Where it goes
What you built The commit subject and body.
How the code works The code, or a test.
A number or a limit that one edit can change A named constant in the code.
A choice that the person already made Nowhere. It is in the request.
A decision that is already recorded Nowhere. Do not repeat it.

Most commits have no decision. Most pull requests have zero to three.

Format

Put one fenced decision block at the end of the commit message for each decision:

Move session storage to Durable Objects

Session writes raced under concurrent logins.

```decision
decision: refs keeps each person's sign-in in one place. Two sign-ins at the same time cannot overwrite each other.
reason:
  - When a person signed in on two devices at the same moment, one sign-in erased the other.
to_reverse: Every person must sign in again, because the sign-ins must move to the new place.
alternatives_considered:
  - The main database (D1)
  - A shared cache (KV)
rejected:
  D1: Its copies can be old, so a sign-in check could get old data.
  KV: Changes take time to reach every copy.
affected_components:
  - SessionStore
evidence:
  - src/auth/session.ts
```

Fields

Field Required Value
decision Yes One or two short sentences, with no code names.
reason Yes A list. Each item is one full sentence.
to_reverse Yes, in an agent push What people must do if the decision changes later, and who pays.
alternatives_considered No A list.
rejected No A map of name: reason lines.
assumptions No A list.
affected_components No A list of code names.
evidence No A list of files, links or results.
supersedes No A list of earlier decisions, each as a DEC- ID or <full commit hash>#<block number>. Blocks count from 1.

Syntax

The block uses a strict subset of YAML:

  • key: value
  • key: followed by - item lines
  • key: followed by name: value lines

Use spaces, not tabs. A commit has at most 32 blocks.

Write for a person who does not code

  • Say who does what. Name the person or the thing first.
  • Give the real case: "a password or an API key", not "sensitive data".
  • Use the words of the product, not the words of the code.
  • Keep each sentence to 20 words or fewer. Use the active voice and the present tense.
  • Put code and file names only in affected_components and evidence.

Compare two versions of the same decision:

Decision Reason To reverse
Hard to read Uploads capped per plan tier. Storage cost control. Users build workflows on this limit.
Easy to read A person on the free plan can upload files of 100 MB or less. One large file costs more to store than a free account pays for. Tell each free user about the new limit, and decide what happens to the files that are over it.

How the origin checks a push

When an agent session pushes its branch, the origin checks the records before the branch moves:

  1. It stores the pushed commits under a hidden ref, refs/quarantine/<uuid>.
  2. It reads the new commits, up to 200. Merge commits are not checked.
  3. It checks each record. A commit without a record passes. A record fails when it is malformed, has no to_reverse, uses an ID again, or supersedes an unknown decision.
  4. If all records pass, the branch moves to the new commit, and the push output lists the IDs of the records.
  5. If a record fails, the branch does not move. Git shows ! [remote rejected] <branch> (<first problem>), and the remote: lines list each problem.

To fix a refused push, change the last commit and push again:

git commit --amend
git push origin HEAD:<branch>

The origin does not check pushes from people.

Fields that the origin adds

Field Value
decision_id DEC-, then the first 125 bits of the commit hash in Crockford base32, then the position of the block from 0.
commit The commit that has the record.
actor The session that pushed it.
status active, or superseded when a later record lists it in supersedes.

Because agents cannot force-push, a pushed commit never changes, and its IDs stay the same. Anyone with a clone can compute them.