Fourteen hard-to-reverse decisions and fifteen statements that must hold at all times. This is the answer to «why this way and not otherwise» — and the only place it is written down: the code merely carries the decisions out.
You may depart from them, but deliberately: first the decision is amended, then the code — never silently the other way round. An invariant is not amended at all; it either holds or is broken, and each one names the price of breaking it.
A decision lands on this list when undoing it costs more than making it: it changes the shape of the log, of access rights, or of delivery. Each one lives in its own file together with the rejected alternatives — here you get only the decision itself.
Eight of them (0004…0010) were written after the first live runs: the decisions already existed in the code as comments, but not as decisions, and there is no arguing with a comment.
~/firm2 $ ls docs/adr/
0005: «merged» used to be established by a role's word, and a false «merged» made the next run skip the task as done.An invariant is a statement about the route, numbered so that code and defect write-ups can refer to it. They turned out to be needed not for rigour: three defects in a single day were mistakes in the language, not in the code — «merged», «abandoned» and «event time» did not mean what the code thought they meant. Until the words were defined, there was nothing to argue about in the implementation.
They are held by tests and preflight steps, and six of them are checked against live data as well — doctor looks for violations in a project's log.
~/firm2 $ grep -n 'I-' docs/domain-model.md
| № | Statement | What holds it | Price of breaking it |
|---|---|---|---|
| I-1 | A task's status is derived from events only; the front matter is a cache | statusFromEvents, ADR-0001 | two sources of truth drift apart, the board lies |
| I-2 | The log is append-only | ADR-0006, the --corrects flag | history is rewritten, and the defect write-up rests on fiction |
| I-3 | One event, one file | ADR-0003 | a merge conflict on every parallel commit |
| I-4 | A task merge is confirmed by a merge commit whose second parent is the tip of the task branch; unconfirmed means no event | reconcileMerges, ADR-0005 | a false «merged»: the next run skips the task as done |
| I-5 | An event's time is the time of what happened, not of when it was written | writeEvent, the --ts flag | delivery timing stretches over hours of waiting |
| I-6 | All times are UTC with a Z | writeEvent | event order breaks, intervals turn negative |
| I-7 | An event with no ticket binding is a gap, not a norm | the prompt marker, ADR-0004 | the stage is invisible to the board, to timing and to doctor |
| I-8 | A slot is held by a task, not by an agent | computeBoard | the parallelism ceiling stops limiting anything |
| I-9 | A stage writes only into its own worktree | write-guard.mjs | edits from two tasks get mixed together in the main tree |
| I-9a | A merge or release event belongs to the branch, not to the tree: it is written where that branch is checked out | journalRootFor | records go to a branch they do not belong to and arrive nowhere — that is how 35 release events once went to an already dead delivery branch |
| I-10 | An archived spec snapshot never changes | tasksDir | a closed delivery loses its history |
| I-11 | The engine does not close someone else's stage and does not spend someone else's time; but any recorded outcome closes an interval in the timing | ADR-0009, timing | an invented «finished» damages the timing more than an open interval does |
| I-12 | Uncertainty stops the action and demands a question: the unproven is neither done nor logged, but it is always named to the human | ADR-0007 | either the engine confidently does the wrong thing, or it freezes in silence — and silence is indistinguishable from work |
| I-13 | A verdict certifies content: the acceptance event carries the tree fingerprint, and only an accepted tree may be merged | ADR-0013, review-receipt.mjs | code the review never saw ships into the delivery — and counts as accepted |
| I-14 | Sending outside leaves a receipt, and one task's receipts are chained by hashes — as a tree, not a line: one receipt may have several successors | ADR-0014, egress.mjs | the question «what left the project, and when» has no answer, and a deleted receipt is indistinguishable from a send that never happened |