The 2026-12-01 architecture review walked the post-0.3.0 hot spots — the workflow layer, the workflow-supervisor split (#12), the ultra layer — and surfaced seven candidates for deepening. A two-round grilling session settled every decision; the six accepted deepenings are ticketed as children of this spec. Provenance: research/architecture-review-2026-12-01.html (the review report; evidence, measurements, before/after diagrams). ADR amendments: 0006 (the pull path is bounded for runs too), 0004 (checkpoint granularity). GLOSSARY.md: "Expanded plan" renamed to "Start plan" with the corrected definition.
The six deepenings
File split — workflow-plan.ts / workflow-run.ts / workflow-command.ts; one concern per module; the one-letter lookup trap dies.
The seam — src/job-state.ts owns the shared state types and status predicates; the supervisor owns the run DAG index over shared records; the host interface carries effects only; one cancel policy; limits ride the run spec (no process.env reads — brings the code in line with the standing worker-rules convention).
The run module — the journal becomes a projection of run state; the flat-snapshot reverse-engineering (itemsByStep, the positional fallback) dies.
Step mirrors — WorkflowStep canonical behind a TypeBox schema (replaces STEP_FIELDS); ExpandedWorkflowStep deleted; inputHash hashes whole steps (payload v2); TypeBox schemas own TaskSnapshot, JobSnapshot, and the journal record — validator drift becomes a compile error.
Observation — onJobEvent({jobId, kind}) replaces whole-snapshot callbacks; persistence checkpoints at start + terminal; a lazy snapshot cache; the runner's update carries the message delta; wait on a run returns the consolidated answer (byte-parity with the push notice).
Presentation — present.ts owns one rulebook; render/job-format/dashboard become thin adapters; isFailedResult leaves the TUI renderer; one start formatter.
Shared decisions
Task records are shared by reference: the manager owns the flat collection (the job record), the supervisor owns the DAG index; settleTask settles the shared record once.
Cancel semantics are unchanged, only concentrated (immediate abort; drain the FIFO; settle queued + coordinator rows cancelled; finalize cancelled).
Restore stops fabricating AgentConfig records (rides the seam ticket).
A 256-child scale test guards the O(N²) → O(N) claim (property, not example).
The DAG algorithm is untouched; the TLA+ spec (spec/SubagentJobs.tla) and its modelcheck gate are unchanged.
Waves
Frontier ≤ 2 in flight: W1 file split → W2 the seam → W3 the run module ∥ step mirrors → W4 observation ∥ presentation → then the two-axis review on the integration branch, fix findings in one worker, close tickets, report, retro. The running state log lives in docs/wiki/goal-architecture-deepening.md.
#25 — T5: observation — job events, checkpoint persistence, bounded pull for runs (Wave 4, ∥ #26, blocked by #23)
#26 — T6: one presentation rulebook — present.ts, thin adapters (Wave 4, ∥ #25, blocked by #22)
## Context
The 2026-12-01 architecture review walked the post-0.3.0 hot spots — the workflow layer, the workflow-supervisor split (#12), the ultra layer — and surfaced seven candidates for deepening. A two-round grilling session settled every decision; the six accepted deepenings are ticketed as children of this spec. Provenance: `research/architecture-review-2026-12-01.html` (the review report; evidence, measurements, before/after diagrams). ADR amendments: 0006 (the pull path is bounded for runs too), 0004 (checkpoint granularity). `GLOSSARY.md`: "Expanded plan" renamed to "Start plan" with the corrected definition.
## The six deepenings
1. **File split** — `workflow-plan.ts` / `workflow-run.ts` / `workflow-command.ts`; one concern per module; the one-letter lookup trap dies.
2. **The seam** — `src/job-state.ts` owns the shared state types and status predicates; the supervisor owns the run DAG index over shared records; the host interface carries effects only; one cancel policy; limits ride the run spec (no `process.env` reads — brings the code in line with the standing worker-rules convention).
3. **The run module** — the journal becomes a projection of run state; the flat-snapshot reverse-engineering (`itemsByStep`, the positional fallback) dies.
4. **Step mirrors** — `WorkflowStep` canonical behind a TypeBox schema (replaces `STEP_FIELDS`); `ExpandedWorkflowStep` deleted; `inputHash` hashes whole steps (payload v2); TypeBox schemas own `TaskSnapshot`, `JobSnapshot`, and the journal record — validator drift becomes a compile error.
5. **Observation** — `onJobEvent({jobId, kind})` replaces whole-snapshot callbacks; persistence checkpoints at start + terminal; a lazy snapshot cache; the runner's update carries the message delta; `wait` on a run returns the consolidated answer (byte-parity with the push notice).
6. **Presentation** — `present.ts` owns one rulebook; `render`/`job-format`/`dashboard` become thin adapters; `isFailedResult` leaves the TUI renderer; one start formatter.
## Shared decisions
- Task records are shared by reference: the manager owns the flat collection (the job record), the supervisor owns the DAG index; `settleTask` settles the shared record once.
- Cancel semantics are unchanged, only concentrated (immediate abort; drain the FIFO; settle queued + coordinator rows cancelled; finalize cancelled).
- Restore stops fabricating `AgentConfig` records (rides the seam ticket).
- A 256-child scale test guards the O(N²) → O(N) claim (property, not example).
- The DAG algorithm is untouched; the TLA+ spec (`spec/SubagentJobs.tla`) and its modelcheck gate are unchanged.
## Waves
Frontier ≤ 2 in flight: W1 file split → W2 the seam → W3 the run module ∥ step mirrors → W4 observation ∥ presentation → then the two-axis review on the integration branch, fix findings in one worker, close tickets, report, retro. The running state log lives in `docs/wiki/goal-architecture-deepening.md`.
## Task list
- [x] #21 — T1: split `workflow.ts`/`workflows.ts` by concern; start-plan rename (Wave 1)
- [x] #22 — T2: the seam — `job-state.ts`, run-state ownership, one cancel policy, run-spec limits (Wave 2, blocked by #21)
- [x] #23 — T3: the run module — journal as a projection of run state (Wave 3, ∥ #24, blocked by #22)
- [x] #24 — T4: step mirrors — canonical step schema, whole-plan `inputHash`, TypeBox persisted shapes (Wave 3, ∥ #23, blocked by #22)
- [x] #25 — T5: observation — job events, checkpoint persistence, bounded pull for runs (Wave 4, ∥ #26, blocked by #23)
- [x] #26 — T6: one presentation rulebook — `present.ts`, thin adapters (Wave 4, ∥ #25, blocked by #22)
Pipeline complete on architecture-deepening (tip 5cc0660): all six deepenings landed in four waves, two-axis review run, fix pass merged, all gates green at the tip (DRI own-run tails: typecheck clean, tests 239/239, TLC 142,834 states / no errors, smoke, wikicheck). Task list 6/6 ticked; evidence in each ticket's close comment; running log in docs/wiki/goal-architecture-deepening.md. This spec stays open pending the maintainer merge of architecture-deepening → main (ultra-layer precedent). Nothing pushed.
Pipeline complete on `architecture-deepening` (tip `5cc0660`): all six deepenings landed in four waves, two-axis review run, fix pass merged, all gates green at the tip (DRI own-run tails: typecheck clean, tests 239/239, TLC 142,834 states / no errors, smoke, wikicheck). Task list 6/6 ticked; evidence in each ticket's close comment; running log in docs/wiki/goal-architecture-deepening.md. This spec stays open pending the maintainer merge of `architecture-deepening` → `main` (ultra-layer precedent). Nothing pushed.
Merged architecture-deepening → main as e25f733 (--no-ff; branch tip af420e8; 46 files, +3048/−1433). All five gates re-run green on main by the DRI — own-run tails: typecheck clean, tests 239/239 (11.9s), TLC 142,834 states / no errors (30s), smoke, wikicheck OK. All six deepenings landed in four waves (file split, the seam, journal projection + step mirrors, observation + presentation) with the two-axis review and fix pass complete; every ticket closed with evidence; tests grew 215 → 239 with TLC constant at 142,834 states throughout (the DAG algorithm and spec/ untouched). Full running log: docs/wiki/goal-architecture-deepening.md; retro: docs/wiki/retro-2026-12-01-architecture-deepening.md. Pushed to origin/main. Zero open issues.
Merged `architecture-deepening` → `main` as `e25f733` (--no-ff; branch tip `af420e8`; 46 files, +3048/−1433). All five gates re-run green on main by the DRI — own-run tails: typecheck clean, tests 239/239 (11.9s), TLC 142,834 states / no errors (30s), smoke, wikicheck OK. All six deepenings landed in four waves (file split, the seam, journal projection + step mirrors, observation + presentation) with the two-axis review and fix pass complete; every ticket closed with evidence; tests grew 215 → 239 with TLC constant at 142,834 states throughout (the DAG algorithm and `spec/` untouched). Full running log: docs/wiki/goal-architecture-deepening.md; retro: docs/wiki/retro-2026-12-01-architecture-deepening.md. Pushed to origin/main. Zero open issues.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Context
The 2026-12-01 architecture review walked the post-0.3.0 hot spots — the workflow layer, the workflow-supervisor split (#12), the ultra layer — and surfaced seven candidates for deepening. A two-round grilling session settled every decision; the six accepted deepenings are ticketed as children of this spec. Provenance:
research/architecture-review-2026-12-01.html(the review report; evidence, measurements, before/after diagrams). ADR amendments: 0006 (the pull path is bounded for runs too), 0004 (checkpoint granularity).GLOSSARY.md: "Expanded plan" renamed to "Start plan" with the corrected definition.The six deepenings
workflow-plan.ts/workflow-run.ts/workflow-command.ts; one concern per module; the one-letter lookup trap dies.src/job-state.tsowns the shared state types and status predicates; the supervisor owns the run DAG index over shared records; the host interface carries effects only; one cancel policy; limits ride the run spec (noprocess.envreads — brings the code in line with the standing worker-rules convention).itemsByStep, the positional fallback) dies.WorkflowStepcanonical behind a TypeBox schema (replacesSTEP_FIELDS);ExpandedWorkflowStepdeleted;inputHashhashes whole steps (payload v2); TypeBox schemas ownTaskSnapshot,JobSnapshot, and the journal record — validator drift becomes a compile error.onJobEvent({jobId, kind})replaces whole-snapshot callbacks; persistence checkpoints at start + terminal; a lazy snapshot cache; the runner's update carries the message delta;waiton a run returns the consolidated answer (byte-parity with the push notice).present.tsowns one rulebook;render/job-format/dashboardbecome thin adapters;isFailedResultleaves the TUI renderer; one start formatter.Shared decisions
settleTasksettles the shared record once.AgentConfigrecords (rides the seam ticket).spec/SubagentJobs.tla) and its modelcheck gate are unchanged.Waves
Frontier ≤ 2 in flight: W1 file split → W2 the seam → W3 the run module ∥ step mirrors → W4 observation ∥ presentation → then the two-axis review on the integration branch, fix findings in one worker, close tickets, report, retro. The running state log lives in
docs/wiki/goal-architecture-deepening.md.Task list
workflow.ts/workflows.tsby concern; start-plan rename (Wave 1)job-state.ts, run-state ownership, one cancel policy, run-spec limits (Wave 2, blocked by #21)inputHash, TypeBox persisted shapes (Wave 3, ∥ #23, blocked by #22)present.ts, thin adapters (Wave 4, ∥ #25, blocked by #22)Pipeline complete on
architecture-deepening(tip5cc0660): all six deepenings landed in four waves, two-axis review run, fix pass merged, all gates green at the tip (DRI own-run tails: typecheck clean, tests 239/239, TLC 142,834 states / no errors, smoke, wikicheck). Task list 6/6 ticked; evidence in each ticket's close comment; running log in docs/wiki/goal-architecture-deepening.md. This spec stays open pending the maintainer merge ofarchitecture-deepening→main(ultra-layer precedent). Nothing pushed.Merged
architecture-deepening→mainase25f733(--no-ff; branch tipaf420e8; 46 files, +3048/−1433). All five gates re-run green on main by the DRI — own-run tails: typecheck clean, tests 239/239 (11.9s), TLC 142,834 states / no errors (30s), smoke, wikicheck OK. All six deepenings landed in four waves (file split, the seam, journal projection + step mirrors, observation + presentation) with the two-axis review and fix pass complete; every ticket closed with evidence; tests grew 215 → 239 with TLC constant at 142,834 states throughout (the DAG algorithm andspec/untouched). Full running log: docs/wiki/goal-architecture-deepening.md; retro: docs/wiki/retro-2026-12-01-architecture-deepening.md. Pushed to origin/main. Zero open issues.