akm docs

Architecture decision records

This directory holds the design history that used to live as long comment blocks inside the modules the 0.9.2 task/workflow refactor touched. Brief §9 named the problem directly: "Historical essays inside large modules | Keep invariant comments locally; move design history to ADRs | Reduce cognitive load without deleting important reasoning." These records are that move.

Format

What moves here and what stays in the code

Per the brief's own framing (§15, quoted in docs/plans/specs/p4-deletions-closeout.md §1.5): a code comment that explains why mutation is delayed, why a hash includes a field, why a transaction boundary exists, why a source is revalidated, why a child invocation is idempotent — a short, load-bearing invariant a maintainer needs sitting right next to the code — stays in the code. A comment block that is historical narrative — peer-review findings, an earlier draft, a superseded alternative, a phase-by-phase chronology of how a design arrived where it is — moves here instead, replaced in the source by a one-line invariant summary plus a relative link back to the ADR that carries the full reasoning.

Binding rule carried from the spec: no ADR may delete reasoning. An essay's text moves; it is not summarized away. Where an essay describes behavior a later phase deleted, the ADR records the behavior and its removal date, rather than being quietly rewritten as if the behavior never existed.

Index

ADR Title Source essay Extracted
0001 No interpolation — data reaches units as attached structured context src/workflows/exec/native-executor.ts module header (data flow / reference scope / peer-review-R1 narrative) P4
0002 Unit reuse and the input-hash scope src/workflows/exec/step-work.ts (module purity contract; computeUnitInputHash's doc comment) P4
0003 The exec unit's child-environment allowlist and provenance src/workflows/exec/exec-unit.ts (module header; the default-allowlist rationale; capture/overflow semantics; childEnv's layering) P4
0004 The shared input contract, generalized from workflow params src/execution/input-contract.ts module header P4
0005 The D8 result-vocabulary re-code and its legacy read mapping src/tasks/run/task-result.ts + src/tasks/run/task-history.ts headers (the mapping's own one-line invariant stays in task-history.ts) P4
0006 Task source version routing, from three generations to one src/tasks/source/parse-task-source.ts routing-table header P4
0007 Recursive child-workflow composition bounds src/workflows/resource-limits.ts (the composition-depth and aggregate-plan-bytes section) P4
0008 Task input binding normalization and re-binding across a composition src/workflows/freeze/task-bindings.ts (module header; rebindTaskInputBindings's doc comment) P4
0009 Child-run publication's hand-duplicated INSERT column list New content — the R11/R-R3 disposition (docs/plans/specs/p4-deletions-closeout.md §8), not a moved essay P4
0010 The external driver protocol (workflow brief/workflow report/--settle) was cut Stub pointing at docs/architecture/specs/driver-protocol-keep-or-cut.md, which stays the normative decision record P4
0011 The engine run loop's invariants: gate spine, frozen plan, run lease, process lifecycle src/workflows/exec/run-workflow.ts module header P4