Home / Projects / Orchestrata Ultimate / Decisions / ADR index / ADR-0128

ADR-0128: The tracked codebase maps are regenerated at commit, by per-file delta, through the codetools ast map verb

field value
Status Accepted — Accepted (Mohamed, 2026-10-22: ruling "A", "maps should use delta", "do item 3 in orchestrata")
Date 2026-10-23
Register factory (docs/adr, 4-digit ids)
Source docs/adr/0128-the-tracked-codebase-maps-are-regenerated-at-commit-by-per-file-delta-through-the-codetools-ast-map-verb.md — recorded on branch fix/ship-sanctioned-gate-pytest at 8c7031c9a, not yet on master
Wiki register entry ADR-0128 (wiki status: Accepted)

← ADR-0127 · ADR-0129 →

The record

Status: Accepted (Mohamed, 2026-10-22: ruling "A", "maps should use delta", "do item 3 in orchestrata") · Date: 2026-10-23

Context

RUL-030 (Mohamed, 2026-08-13) keeps docs/CODEBASE_MAP.md and docs/CODEBASE_MAP_FULL.md tracked. Before this ADR, only the SessionStart hook inject-codebase-map.sh refreshed them, from scripts/gen_codebase_map.py. scripts/worktrees.py copied the primary checkout's map into new worktrees. So commits carried maps that described some other tree's state.

Measured on 2026-10-22:

Step Wall time Commit
Full regeneration (deterministic) 13.5 s —
Ten separate symbols CLI calls, each unpickling the 200 MB warm cache 128 s —
One process about 15 s e1f3a5047
Per-file delta cache, no-change run 1.0 s c995f5b88
codetools ast map verb, warm 0.495 s d4ae44819
codetools ast map verb, cold 10.9 s d4ae44819

Decision (Mohamed, verbatim per rule)

  1. "A" (item 2, 2026-10-22). The pre-commit hook regenerates both maps when a .py file is staged, and stages them. worktrees.py stops copying the primary's map. RUL-030 tracking stays.
  2. "maps should use delta". Map regeneration, at pre-commit and at SessionStart, re-parses and re-renders only the changed modules. The output must be byte-identical to a full regeneration, and a test asserts delta == full.
  3. "do item 3 in orchestrata". Regeneration goes through codetools ast map <tree> --with-full, configured by [tool.codetools.map] in pyproject.toml. scripts/gen_codebase_map.py stays as the fallback when codetools is not installed. A run with fewer than 1,000 signatures keeps the existing full map, the rule from the 2026-08-08 incident.

Alternatives rejected

Consequences

Provenance

No other ADR is named in this record.

Rulings cited

Specs cited

None (or no spec page exists for the ones named).