@punks/cli 3.2.0 → 3.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/BASELINE_CHANGELOG.md +14 -1
  2. package/dist/CHANGELOG.md +15 -0
  3. package/dist/baseline/scaffold-baseline/baseline.json +5 -5
  4. package/dist/baseline/scaffold-baseline/data/catalog/lint-assets.json +48 -0
  5. package/dist/baseline/scaffold-baseline/skills/agnostic/cli/hi-cli/references/post-command-flow.md +1 -6
  6. package/dist/baseline/scaffold-baseline/skills/agnostic/docs/upstream/mattpocock-writing-skills.md +81 -12
  7. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/create-plan/REFERENCE.md +11 -14
  8. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/create-plan/SKILL.md +17 -14
  9. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/create-plan/references/architecture-convergence.md +98 -0
  10. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/create-plan/references/plan-schema.md +34 -0
  11. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/create-plan/references/planner-task-graph.md +15 -12
  12. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/implement-spec/SKILL.md +6 -5
  13. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/implement-spec/assets/IMPLEMENTATION-NOTES-TEMPLATE.md +10 -0
  14. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/implement-spec/references/architecture-conformance.md +100 -0
  15. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/implement-spec/references/lifecycle.md +25 -2
  16. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/implement-spec/references/parallel-orchestration.md +17 -1
  17. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/implement-spec/references/parallel-worker-brief.md +14 -0
  18. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/implement-spec/references/parallel.md +7 -0
  19. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/requirements-grill/SKILL.md +1 -1
  20. package/dist/baseline/scaffold-baseline/skills/frameworks/effect/effect-service-design/UPSTREAM.md +17 -0
  21. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/phases/review.md +9 -34
  22. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/phases/router.md +10 -16
  23. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/references/phase-handoff.md +1 -19
  24. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/AUTHORING-HANDOFF.md +11 -14
  25. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/phases/retain-report.md +2 -9
  26. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/phases/return-route.md +8 -6
  27. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/phases/run-review.md +5 -8
  28. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/references/durable-report.md +14 -29
  29. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/references/state-graph.md +32 -45
  30. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/references/targets.md +1 -2
  31. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/scripts/review-contract.mjs +12 -86
  32. package/dist/baseline/scaffold-baseline.json +5 -5
  33. package/dist/baseline/scaffold-baseline.tgz +0 -0
  34. package/dist/index.js +5 -5
  35. package/dist/skills/agnostic/cli/hi-cli/references/post-command-flow.md +1 -6
  36. package/dist/skills/agnostic/docs/upstream/mattpocock-writing-skills.md +81 -12
  37. package/dist/skills/agnostic/planning/create-plan/REFERENCE.md +11 -14
  38. package/dist/skills/agnostic/planning/create-plan/SKILL.md +17 -14
  39. package/dist/skills/agnostic/planning/create-plan/references/architecture-convergence.md +98 -0
  40. package/dist/skills/agnostic/planning/create-plan/references/plan-schema.md +34 -0
  41. package/dist/skills/agnostic/planning/create-plan/references/planner-task-graph.md +15 -12
  42. package/dist/skills/agnostic/planning/implement-spec/SKILL.md +6 -5
  43. package/dist/skills/agnostic/planning/implement-spec/assets/IMPLEMENTATION-NOTES-TEMPLATE.md +10 -0
  44. package/dist/skills/agnostic/planning/implement-spec/references/architecture-conformance.md +100 -0
  45. package/dist/skills/agnostic/planning/implement-spec/references/lifecycle.md +25 -2
  46. package/dist/skills/agnostic/planning/implement-spec/references/parallel-orchestration.md +17 -1
  47. package/dist/skills/agnostic/planning/implement-spec/references/parallel-worker-brief.md +14 -0
  48. package/dist/skills/agnostic/planning/implement-spec/references/parallel.md +7 -0
  49. package/dist/skills/agnostic/requirements/requirements-grill/SKILL.md +1 -1
  50. package/dist/skills/frameworks/effect/effect-service-design/UPSTREAM.md +17 -0
  51. package/dist/skills/phases/delivery-phase/phases/review.md +9 -34
  52. package/dist/skills/phases/delivery-phase/phases/router.md +8 -14
  53. package/dist/skills/phases/delivery-phase/references/phase-handoff.md +1 -19
  54. package/dist/skills/phases/review-phase/AUTHORING-HANDOFF.md +11 -14
  55. package/dist/skills/phases/review-phase/phases/retain-report.md +2 -9
  56. package/dist/skills/phases/review-phase/phases/return-route.md +8 -6
  57. package/dist/skills/phases/review-phase/phases/run-review.md +5 -8
  58. package/dist/skills/phases/review-phase/references/durable-report.md +14 -29
  59. package/dist/skills/phases/review-phase/references/state-graph.md +5 -18
  60. package/dist/skills/phases/review-phase/references/targets.md +1 -2
  61. package/dist/skills/phases/review-phase/scripts/review-contract.mjs +11 -91
  62. package/package.json +1 -1
@@ -34,6 +34,16 @@ where the guidance was assessed.
34
34
  | ---- | ----- | ------ | --------- | --------------------------------------------- |
35
35
  | | | | | |
36
36
 
37
+ ## Architecture Conformance Evidence
38
+
39
+ Persist the `$show-me` ownership tree, dependency graph, wave delta, or seam
40
+ diff beside each conclusion. Use one row after every architecture wave and one
41
+ for final closure. Local plans remove this section.
42
+
43
+ | Architecture wave id | Target ownership topology and observed state | Declared dependency graph and observed state | Due criterion ids, evidence, and prior-met regression status | Public seam delta | Migration ledger delta, expiry waves, and final empty-ledger status | Validation evidence | Verdict or exact drift |
44
+ | -------------------- | -------------------------------------------- | -------------------------------------------- | ------------------------------------------------------------ | ----------------- | ------------------------------------------------------------------- | ------------------- | ---------------------- |
45
+ | | | | | | | | |
46
+
37
47
  ## UI Evidence Links
38
48
 
39
49
  | Surface | Viewport | Before | After | Notes |
@@ -0,0 +1,100 @@
1
+ # Architecture Conformance
2
+
3
+ Use this contract when `PLAN.md` declares architecture applicability as
4
+ `architecture-bearing`. A `local` plan keeps the normal task design checks and
5
+ does not invent an architecture contract during execution.
6
+
7
+ The plan is authoritative. Execute its **Target Ownership Topology**, **Declared
8
+ Dependency Graph**, **Responsibility Acceptance Criteria**, **Architecture Waves**,
9
+ public seam contract, and migration ledger. Execution may clarify
10
+ evidence. An evidence-only clarification may be recorded locally when it changes
11
+ no owner, edge, criterion, wave, seam, migration, or task contract. Any target
12
+ contract change pauses execution and routes back through `$create-plan` on the
13
+ same spec folder for architecture convergence authoring and plan review. Reload
14
+ the amended plan before dispatching more architecture-bearing work.
15
+
16
+ ## Load the theory
17
+
18
+ Before the first architecture wave, load `$backend-domain-structure` for
19
+ backend scope and `$frontend-domain-structure` for frontend scope. Read their
20
+ required references. Use their responsibility classifiers, public boundaries,
21
+ and dependency direction to interpret the plan against the actual repository.
22
+ Preserve project-native folder names: responsibility is authoritative; an
23
+ example tree is not.
24
+
25
+ When an accepted amendment changes the target contract, re-ground the affected
26
+ scope in `$backend-domain-structure` and `$frontend-domain-structure` as
27
+ applicable, including their required references. Rewrite every affected
28
+ `$show-me` persisted view from the amended authority before execution resumes.
29
+
30
+ Invoke `$show-me` to render each persisted architecture evidence view from the
31
+ authoritative plan and observed code. Persist the smallest useful ownership
32
+ tree, dependency graph, wave delta, or seam diff beside its textual conclusion
33
+ in `IMPLEMENTATION-NOTES.md`. The view preserves plan labels, status,
34
+ uncertainty, and violations; it introduces no architecture decision.
35
+
36
+ ## Before dispatch
37
+
38
+ For each architecture wave:
39
+
40
+ 1. Resolve its required starting topology and dependency state from the prior
41
+ checkpoint.
42
+ 2. Map every task's `architecture_wave`, `behavior_owner`,
43
+ `integration_surface`, `public_seam`, `topology_delta`,
44
+ `forbidden_ownership`, `temporary_seams` including `expiry_wave`, and
45
+ `responsibility_acceptance_criteria` including each `criterion_id` and
46
+ `due_wave` into its worker brief unchanged.
47
+ 3. Verify the tasks collectively advance the declared architecture wave and
48
+ have responsibility acceptance criteria that can be evidenced.
49
+ 4. Block dispatch when a prerequisite checkpoint failed or the wave would
50
+ introduce an undeclared dependency, public seam change, or temporary seam.
51
+
52
+ Dispatch is ready when every architecture-bearing task has an accountable
53
+ owner, expected graph delta, seam contract, and checkable responsibility bound.
54
+
55
+ ## Cumulative conformance checkpoint
56
+
57
+ Run a cumulative conformance checkpoint after every architecture wave, before
58
+ computing the next wave. Inspect the whole affected graph, not only the latest
59
+ diff:
60
+
61
+ - compare actual responsibility placement with the Target Ownership Topology;
62
+ - compare static imports and semantic calls with the Declared Dependency Graph;
63
+ - prove every Responsibility Acceptance Criterion due through the current
64
+ architecture wave, keyed by `criterion_id`, with changed artifacts and focused
65
+ validation;
66
+ - rerun each previously met criterion as a regression check and revoke its met
67
+ status when current evidence fails;
68
+ - reconcile every planned `topology_delta` and `forbidden_ownership` rule;
69
+ - detect public seam additions, removals, signature changes, aliases, and deep
70
+ imports, and reconcile each with the public seam contract;
71
+ - reconcile the migration ledger: introducing task, reason, allowed consumers,
72
+ removal task, expiry wave, current status, and removal proof;
73
+ - reject undeclared temporary seams and migrations due through the current
74
+ architecture wave whose removal proof is absent;
75
+ - run the narrowest available architecture, import-boundary, cycle, type, and
76
+ focused behavior checks.
77
+
78
+ Record the checkpoint in `PLAN.md` and under `## Architecture Conformance
79
+ Evidence` in `IMPLEMENTATION-NOTES.md`. Include expected state, observed state,
80
+ evidence, violations, public seam delta, migration delta, and verdict. A failed
81
+ checkpoint blocks dependent architecture waves. Repair the current wave or
82
+ route a target-contract amendment through `$create-plan`; final closure is not
83
+ the first cleanup pass.
84
+
85
+ ## Final closure
86
+
87
+ After the last architecture wave, rerun the checkpoint across the complete
88
+ affected topology. Closure requires:
89
+
90
+ - zero drift from the Target Ownership Topology and Declared Dependency Graph;
91
+ - every Responsibility Acceptance Criterion met with cited evidence;
92
+ - every public seam change declared and accepted;
93
+ - the entire migration ledger is empty, with removal proof for every retired
94
+ temporary seam;
95
+ - no expired or undeclared temporary seam remains;
96
+ - focused architecture and behavior validation is green.
97
+
98
+ Keep the spec incomplete when closure fails. Record exact drift and the task or
99
+ decision required to remove it; never convert in-goal architecture drift into
100
+ generic tech debt.
@@ -47,6 +47,10 @@ Read, in this order:
47
47
  4. `<resolved-spec-folder>/IMPLEMENTATION-NOTES.md` if present
48
48
  5. `docs/reference/tech-debt/<domain>/<spec>.md` if present
49
49
 
50
+ When `PLAN.md` declares architecture applicability as `architecture-bearing`,
51
+ also read [architecture-conformance.md](architecture-conformance.md) before
52
+ dispatching the first wave.
53
+
50
54
  If package or framework behavior matters, inspect source with `opensrc --modify false` before guessing.
51
55
 
52
56
  ## 4. Prepare execution notes
@@ -60,6 +64,9 @@ Use [../assets/IMPLEMENTATION-NOTES-TEMPLATE.md](../assets/IMPLEMENTATION-NOTES-
60
64
  - For tasks with `runtime_validation: required`, load [runtime-product-validation.md](runtime-product-validation.md) and keep `## Runtime Validation Evidence` current.
61
65
  - For visibly exercisable acceptance criteria, keep `## Behavior Verification
62
66
  Evidence` current using the template contract.
67
+ - For architecture-bearing plans, seed `## Architecture Conformance Evidence`
68
+ from the persisted architecture contract and keep one cumulative checkpoint
69
+ per architecture wave plus final closure.
63
70
  - Seed `## Skill Application Evidence` from every task's
64
71
  `implementation_skill_guidance`. Preserve each guidance item unchanged and
65
72
  create exactly one evidence row for it.
@@ -136,6 +143,9 @@ After each completed wave:
136
143
  status, and how/where pointer against changed artifacts; for
137
144
  `not_applicable`, verify why and where the guidance was assessed
138
145
  - update `IMPLEMENTATION-NOTES.md` with non-obvious decisions, surprises, or deviations
146
+ - for architecture-bearing plans, run the cumulative conformance checkpoint
147
+ after every architecture wave; persist the `$show-me` view, textual conclusion,
148
+ graph and ownership evidence, public-seam delta, migration-ledger delta, and verdict
139
149
  - for UI implementation changes, record durable before/after screenshot asset links in `IMPLEMENTATION-NOTES.md`
140
150
  - for required runtime validation, record the scenario, public action, correlation or provenance ids, observed result, durable evidence, cleanup, and status or exact blocker in `IMPLEMENTATION-NOTES.md`
141
151
  - persist each `$verify-behavior` result under `## Behavior Verification
@@ -183,6 +193,11 @@ Re-read `SPEC.md` acceptance criteria and mark each one:
183
193
 
184
194
  Record a reason for every unmet or blocked item in `IMPLEMENTATION-NOTES.md`.
185
195
 
196
+ For architecture-bearing plans, acceptance also audits every Responsibility
197
+ Acceptance Criterion against the cumulative evidence. A failed topology,
198
+ dependency, public-seam, or migration-ledger checkpoint keeps affected criteria
199
+ unmet or blocked.
200
+
186
201
  Acceptance that depends on required runtime validation is `met` only when its recorded evidence is conclusive. An exact blocker makes it `blocked`.
187
202
 
188
203
  Visibly exercisable acceptance is `met` only when its Behavior Verification
@@ -223,11 +238,19 @@ Before reporting back:
223
238
  - ensure **Skill Application Evidence** has exact one-to-one cardinality with
224
239
  plan guidance; allowed statuses are `loaded`, `applied`, and
225
240
  `not_applicable`
241
+ - ensure **Architecture Conformance Evidence**, when applicable, contains every
242
+ wave checkpoint and final closure; closure proves zero drift and an empty
243
+ migration ledger
226
244
  - ensure **Remaining work** matches any unmet or blocked criteria
227
245
  - ensure no in-goal debt remains as TODO, follow-up cleanup, or vague later-work text
228
246
  - ensure every tech-debt ledger entry has exact blocker/decision/owner/next action
229
- - set `SPEC.md` frontmatter `status: implemented`
230
- - set `PLAN.md` `**Status:** Complete` when that line exists
247
+ - set `SPEC.md` frontmatter `status: implemented` and `PLAN.md` `**Status:**
248
+ Complete` only when every acceptance criterion is met, every reachable task is
249
+ complete, and any architecture-bearing plan has successful final architecture
250
+ closure
251
+ - preserve the current blocked or incomplete `SPEC.md` and `PLAN.md` statuses
252
+ when any acceptance item, task, checkpoint, or final architecture closure is
253
+ unmet or blocked
231
254
  - ensure the PR body, PR comment, or PR-ready handoff snippet includes the same UI evidence links when UI changed
232
255
 
233
256
  ## 13. Final report shape
@@ -30,6 +30,16 @@ For each task, extract:
30
30
  - acceptance criteria
31
31
  - validation
32
32
  - `tdd_target`
33
+ - `architecture_wave`
34
+ - `behavior_owner`
35
+ - `integration_surface`
36
+ - `public_seam`
37
+ - `topology_delta`
38
+ - `forbidden_ownership`
39
+ - `temporary_seams`
40
+ - each temporary seam's `expiry_wave`
41
+ - `responsibility_acceptance_criteria`
42
+ - each criterion's `criterion_id` and `due_wave`
33
43
  - `assigned_skills`
34
44
  - `implementation_skill_guidance`
35
45
  - `review_mode`
@@ -81,7 +91,10 @@ After the workers return:
81
91
  entry and no unmatched record
82
92
  5. verify each record against the worker result and changed artifacts
83
93
  6. ensure non-obvious deviations or surprises were written into `IMPLEMENTATION-NOTES.md`
84
- 7. retry or escalate failed work instead of quietly advancing
94
+ 7. for an architecture wave, run the cumulative conformance checkpoint in
95
+ [architecture-conformance.md](architecture-conformance.md), render and persist
96
+ its `$show-me` evidence, and block dependent waves on any violation
97
+ 8. retry or escalate failed work instead of quietly advancing
85
98
 
86
99
  Move to the next wave only after the current wave is validated and logged.
87
100
 
@@ -108,6 +121,9 @@ A task is complete only when all of the following are true:
108
121
  - any non-obvious deviations are reflected in `IMPLEMENTATION-NOTES.md`
109
122
  - skill-application evidence has exact one-to-one cardinality with forwarded
110
123
  guidance
124
+ - architecture-bearing tasks satisfy their responsibility acceptance criteria,
125
+ declared topology delta, dependency constraints, public seam contract, and
126
+ migration-ledger obligations at the cumulative checkpoint
111
127
 
112
128
  If any of these are missing, the task is not done yet.
113
129
 
@@ -20,6 +20,16 @@ Every worker brief should include:
20
20
  - `tdd_target`
21
21
  - `tdd_status`
22
22
  - `codebase_design_notes`
23
+ - `architecture_wave`
24
+ - `behavior_owner`
25
+ - `integration_surface`
26
+ - `public_seam`
27
+ - `topology_delta`
28
+ - `forbidden_ownership`
29
+ - `temporary_seams`
30
+ - each temporary seam's `expiry_wave`
31
+ - `responsibility_acceptance_criteria`
32
+ - each criterion's `criterion_id` and `due_wave`
23
33
  - `red_command`
24
34
  - `expected_red_failure`
25
35
  - `green_command`
@@ -61,6 +71,7 @@ Each worker brief should require:
61
71
  `loaded`, `applied`, or `not_applicable` status, and a how/where pointer;
62
72
  `not_applicable` also states why and where it was assessed
63
73
  19. refusing completion for required runtime validation without conclusive recorded evidence; returning an exact blocker leaves the task blocked
74
+ 20. for an architecture-bearing task, implementing toward the declared ownership topology and dependency graph, proving each due `responsibility_acceptance_criteria` item by `criterion_id`, and reporting every public-seam and migration-ledger delta with its architecture wave
64
75
 
65
76
  ## Worker output contract
66
77
 
@@ -77,6 +88,9 @@ Require the worker to return:
77
88
  - one skill-application evidence record for every forwarded guidance item,
78
89
  preserving the exact skill identity
79
90
  - anything blocked or risky, with exact reason and required decision
91
+ - architecture evidence: observed ownership and dependency delta,
92
+ responsibility-acceptance proof keyed by `criterion_id`, public-seam delta,
93
+ and temporary-seam status including `expiry_wave`
80
94
 
81
95
  ## Scope rule
82
96
 
@@ -21,6 +21,9 @@ unblocked. Keep the wave boundary and parent validation.
21
21
  - unchanged guidance forwarding and exactly one verified skill-application
22
22
  evidence record per guidance entry
23
23
  - clear reporting of retries, issues, or blockers
24
+ - for architecture-bearing plans, cumulative ownership, dependency,
25
+ responsibility-acceptance, public-seam, and migration-ledger evidence after
26
+ every architecture wave
24
27
 
25
28
  ## Loop rule
26
29
 
@@ -30,3 +33,7 @@ Keep iterating wave by wave until:
30
33
  - or a real blocker remains and is reported honestly
31
34
 
32
35
  Retry failed work or report the exact blocker before advancing.
36
+
37
+ An architecture wave advances only after its cumulative conformance checkpoint
38
+ passes. Final closure confirms zero drift and an empty migration ledger; it is
39
+ never the first consolidation pass.
@@ -37,7 +37,7 @@ Both workflows can happen in one long session, but keep the responsibilities dis
37
37
  - If the user authorizes auto-pinning defaults, record obvious remaining defaults without needless extra questions.
38
38
  - Treat parked branches as preserved knowledge, not deleted scope.
39
39
  - Apply the round persistence contract in `artifact-output` alongside `$grilling`.
40
- - After the frontier is empty and the durable artifacts are current, invoke
40
+ - After `$grilling` completes and the durable artifacts are current, invoke
41
41
  `$show-me` to present the persisted shared understanding before requesting
42
42
  approval. Treat the presentation as a derived view: persist any correction
43
43
  through `artifact-output`, then present the corrected state again. Approval
@@ -0,0 +1,17 @@
1
+ # Upstream provenance
2
+
3
+ Adapted from Dillon Mulroy's [`dmmulroy/skills`](https://github.com/dmmulroy/skills/tree/8603380821fee6a77c82639f364ce8fe4f5a92be/effect-service-design) at commit:
4
+
5
+ ```text
6
+ 8603380821fee6a77c82639f364ce8fe4f5a92be
7
+ ```
8
+
9
+ That source repository retains [Matt Pocock's MIT license](https://github.com/mattpocock/skills/blob/84fdeffd12f2ee307994d1eb6feb48173b6e0502/LICENSE)
10
+ for the underlying skill material. The adjacent `LICENSE` is byte-identical to
11
+ that upstream license and preserves Matt's copyright and attribution. This skill
12
+ is an indirect derivative, not a skill published in Matt's current curated
13
+ `mattpocock/skills` catalog.
14
+
15
+ Devpunks keeps the service-or-value test, design/audit branches, service and
16
+ Layer inventory, and honest test-substitute guidance, then adapts the
17
+ architecture boundaries to the local Effect skill family.
@@ -30,42 +30,17 @@ lenses.
30
30
 
31
31
  After the retained report establishes the completed ordinal:
32
32
 
33
- 1. Recompute aggregate routing from every finding's validated `return_route`
34
- with the review contract helper. Reject a mismatch with the retained routing
35
- object.
36
- 2. When `secondary_architecture_follow_up` is true, enter `debt_follow_up`
37
- first and persist the primary `debugging` or `implementation` route as
38
- `post_debt_route`.
39
- 3. Without secondary debt, `debugging` opens debugging and `implementation`
40
- opens implementation.
41
- 4. Primary `debt_follow_up` enters debt capture with `post_debt_route` set to
42
- `docs_ingest` when documentation remains, otherwise `closeout`.
43
- 5. `docs_ingest` enters docs ingest. `closeout` enters closeout.
33
+ 1. Runtime evidence routes primarily to debugging.
34
+ 2. Otherwise, an in-scope non-runtime blocker routes primarily to implementation.
35
+ 3. Otherwise, broad architecture debt routes to debt follow-up.
36
+ 4. Otherwise, route to docs ingest or closeout by documentation completeness.
44
37
 
45
38
  Architecture debt may remain a secondary follow-up beside debugging or
46
- implementation. Open its repair only after debt capture. Opening either repair
47
- route is one atomic durable handoff write of active state, route,
48
- `repair_count = review_count`, and idempotency `review_run_id`. Reject a
49
- mismatched or already-consumed repair ordinal. Complete the transition only
50
- after that write. Resume an already-recorded run directly without another
51
- increment.
52
-
53
- ## Capture Debt Follow-Up
54
-
55
- For each primary or secondary debt finding, enter `debt_follow_up` and upsert a
56
- goal/spec-linked debt artifact exactly once. Key each entry by retained report
57
- commit, retained report path, and stable finding ID. Persist the artifact path,
58
- keys, captured finding IDs, and `post_debt_route` in the review handoff before
59
- leaving this state. Set `post_debt_route` to the higher-priority `debugging` or
60
- `implementation` route for secondary debt. For primary debt, set it to
61
- `docs_ingest` when required documentation remains, otherwise `closeout`. On
62
- resume, reuse matching keys, add only missing entries, and follow the recorded
63
- route after every key is present.
64
-
65
- Debt capture records unaccepted work; it does not implement the debt or open an
66
- implementation task. Primary capture resumes `docs_ingest` or `closeout`;
67
- secondary capture resumes its recorded repair. Capture happens once before that
68
- route.
39
+ implementation. Opening either repair route is one atomic durable handoff write
40
+ of active state, route, `repair_count = review_count`, and idempotency
41
+ `review_run_id`. Reject a mismatched or already-consumed repair ordinal.
42
+ Complete the transition only after that write. Resume an already-recorded run
43
+ directly without another increment.
69
44
 
70
45
  ## Completion
71
46
 
@@ -33,30 +33,24 @@ state take precedence over inferred artifact order.
33
33
  6. Resume an atomic handoff already in `debug_active` through [debug.md](debug.md)
34
34
  or `repair_active` through [implement.md](implement.md). A recorded
35
35
  `review_run_id` cannot increment `repair_count` again.
36
- 7. Resume `debt_follow_up` through [review.md](review.md). Its handler reuses or
37
- records the goal/spec-linked debt artifact, then follows durable
38
- `post_debt_route`: `debugging` or `implementation` for secondary debt;
39
- `docs_ingest` or `closeout` for primary debt. It never implements the debt.
40
- 8. Route `focused_validation` to its recorded implementation or debugging owner.
36
+ 7. Route `focused_validation` to its recorded implementation or debugging owner.
41
37
  Passing becomes `clean_handoff`; failure remains repair epoch 3.
42
- 9. Route `clean_handoff` to [docs-ingest.md](docs-ingest.md) when docs remain,
38
+ 8. Route `clean_handoff` to [docs-ingest.md](docs-ingest.md) when docs remain,
43
39
  otherwise [closeout.md](closeout.md).
44
- 10. For durable `docs_ingest`, load [docs-ingest.md](docs-ingest.md).
45
- 11. For durable `closeout`, load [closeout.md](closeout.md).
46
- 12. If no matching agent-ready `SPEC.md` exists, it is stale, contradictory, or
47
- incomplete, or its remote retention or stable blob URL is missing or
48
- unverified, load [spec.md](spec.md).
49
- 13. If the verified post-spec backlog projection is missing or stale, load
40
+ 9. If no matching agent-ready `SPEC.md` exists, it is stale, contradictory, or
41
+ incomplete, or its remote retention or stable blob URL is missing or
42
+ unverified, load [spec.md](spec.md).
43
+ 10. If the verified post-spec backlog projection is missing or stale, load
50
44
  [backlog.md](backlog.md).
51
- 14. If no execution-ready matching plan exists, or it lacks dependencies, owned
45
+ 11. If no execution-ready matching plan exists, or it lacks dependencies, owned
52
46
  paths, validation gates, or wave boundaries, load [plan.md](plan.md).
53
- 15. If accepted plan work is incomplete, load [implement.md](implement.md).
54
- 16. If implementation exists and its retained review is missing or stale, load
47
+ 12. If accepted plan work is incomplete, load [implement.md](implement.md).
48
+ 13. If implementation exists and its retained review is missing or stale, load
55
49
  [review.md](review.md). That phase validates accepted bounds and normalizes a
56
50
  supported target before any delivery-budget evaluation, then returns either
57
51
  `review_failed`, `review_budget_exhausted`, or the exact explicit
58
52
  `$review-phase` invocation context and stops.
59
- 17. Route remaining docs-affecting work to [docs-ingest.md](docs-ingest.md),
53
+ 14. Route remaining docs-affecting work to [docs-ingest.md](docs-ingest.md),
60
54
  otherwise [closeout.md](closeout.md).
61
55
 
62
56
  Only an explicitly new delivery goal with materially changed accepted bounds
@@ -30,19 +30,14 @@ accepted_bounds_identity:
30
30
  accepted_bounds_hash:
31
31
  review_lineage_id:
32
32
  review_run_id:
33
- state: review_due | review_running | report_retention_pending | review_routed | debt_follow_up | debug_active | repair_active | focused_validation | docs_ingest | closeout | clean_handoff
33
+ state: review_due | review_running | report_retention_pending | review_routed | debug_active | repair_active | focused_validation | clean_handoff
34
34
  primary_route:
35
- secondary_architecture_follow_up:
36
- post_debt_route:
37
35
  review_count:
38
36
  repair_count:
39
37
  authoritative_report_path:
40
38
  authoritative_report_commit:
41
39
  verified_retained_ref:
42
40
  stable_finding_ids:
43
- debt_follow_up_artifact:
44
- debt_follow_up_keys:
45
- captured_debt_finding_ids:
46
41
  ```
47
42
 
48
43
  `review_count` is a projection of the highest valid retained report ordinal for
@@ -51,19 +46,6 @@ writes active state, primary route, `repair_count = review_count`, and
51
46
  idempotency `review_run_id`; complete the transition only after the write. A
52
47
  recorded run id resumes its state without increment or guard fallthrough.
53
48
 
54
- Each debt follow-up key is the tuple of authoritative report commit,
55
- authoritative report path, and stable finding ID. The debt artifact links the
56
- delivery goal and accepted Spec, records those keys, and lives outside the
57
- immutable report. Replaying a recorded key reuses the existing entry. It never
58
- opens implementation work for unaccepted debt.
59
-
60
- `post_debt_route` is durable before debt capture starts. It is `debugging` or
61
- `implementation` for secondary debt, and `docs_ingest` or `closeout` for
62
- primary debt after capture. Resume follows this field after every debt key is
63
- present. For primary debt, the successful capture transition atomically records
64
- every debt key and sets state = `post_debt_route`. Resume continues from the
65
- recorded `docs_ingest` or `closeout` state without repeating capture.
66
-
67
49
  ## Explicit Review Invocation Context
68
50
 
69
51
  Delivery persists this block for `review_due` and returns it unchanged before
@@ -3,10 +3,6 @@
3
3
  This is the graph-authoring record. It is separate from review runtime
4
4
  handoffs, retained reports, and delivery handoffs.
5
5
 
6
- Test references below are source-repository provenance. The installed package
7
- omits the source repository test files; reproduce a claim from the immutable
8
- source commit with its named command and contract seam.
9
-
10
6
  ## Router Selection
11
7
 
12
8
  Phase: router
@@ -366,8 +362,8 @@ Artifacts:
366
362
  Validation:
367
363
 
368
364
  - Disclosure completion was durable.
369
- - The focused route contract was observed RED against deleted or relocated
370
- authority.
365
+ - The focused route contract was observed RED at 16/23: seven assertions still
366
+ addressed deleted or relocated authority.
371
367
  - The nine authoring route predictions and runtime storage/no-write cases were
372
368
  not yet executable or recorded, so `test-routes.md` was the single route.
373
369
 
@@ -414,8 +410,8 @@ Validation:
414
410
  - All nine predictions matched derivation; no runtime contract mismatch required
415
411
  repair.
416
412
  - Stale, out-of-scope, and invalid artifact subcases resolve separately.
417
- - The focused source contract moved from observed RED to GREEN after replacing
418
- deleted-root assertions and adding runtime graph contracts.
413
+ - The focused suite moved from observed RED 16/23 to GREEN 25/25 after replacing
414
+ deleted-root assertions and adding two runtime graph contracts.
419
415
  - Router priorities 1-12 cover terminal, checkpoint, blocked, and all four gate
420
416
  outputs. Delivery and standalone storage, conflict, and every declared
421
417
  authoritative no-write class are executable assertions.
@@ -445,7 +441,7 @@ storage modes, no-write outcomes, conflicts, and router classes were tested.
445
441
 
446
442
  Artifacts:
447
443
 
448
- - The canonical source review-graph contract and its named Node command.
444
+ - `tests/review-phase-graph.contract.test.mjs`: 25 focused graph contracts.
449
445
  - `Test Routes Outcome`: nine frozen predictions with nine matching derived
450
446
  routes and zero graph repairs.
451
447
 
@@ -478,7 +474,8 @@ Artifacts:
478
474
 
479
475
  - `SKILL.md`, `agents/openai.yaml`, `phases/router.md`, four flat gate files,
480
476
  four references, and `scripts/review-contract.mjs`.
481
- - The canonical source review-graph contract and shared source contract command.
477
+ - `tests/review-phase-graph.contract.test.mjs` and all eight shared
478
+ `tests/*.test.mjs` files.
482
479
 
483
480
  Validation:
484
481
 
@@ -501,7 +498,7 @@ Validation:
501
498
  - The no-op test required zero deletions: each remaining instruction changes
502
499
  invocation, routing, evidence, validation, persistence, or stop behavior.
503
500
  - `SKILL.md` and `agents/openai.yaml` consistently disable implicit invocation.
504
- - The focused and shared source contract commands pass. Both Node
501
+ - Focused tests pass 25/25; all eight shared test files pass 94/94. Both Node
505
502
  files pass syntax checks, and the scoped diff passes `git diff --check`.
506
503
  - The requested literal `python` command is unavailable. The same validator
507
504
  executed through `uv run --with pyyaml python` and failed because
@@ -585,8 +582,8 @@ Artifacts:
585
582
 
586
583
  - `SKILL.md`, `agents/openai.yaml`, `phases/router.md`, four flat gate files,
587
584
  four references, and `scripts/review-contract.mjs`.
588
- - The canonical source review-graph and shared contract commands, plus the
589
- applicable `skills` packaging validator output.
585
+ - `tests/review-phase-graph.contract.test.mjs`, all eight shared test files,
586
+ and the applicable `skills` packaging validator output.
590
587
 
591
588
  Validation:
592
589
 
@@ -604,7 +601,7 @@ Validation:
604
601
  form the progressive-disclosure trace.
605
602
  - The no-op test required zero deletions. Root frontmatter and
606
603
  `agents/openai.yaml` consistently enforce explicit-only invocation.
607
- - The focused and shared source contract commands pass. Both Node
604
+ - Focused tests pass 25/25; all eight shared test files pass 94/94. Both Node
608
605
  files pass syntax checks, and the scoped diff passes `git diff --check`.
609
606
  - The applicable packaging validator exits zero, validates the local path,
610
607
  discovers 106 skills, and lists `review-phase` with the exact source
@@ -11,8 +11,6 @@ returns the zero-write `review_budget_exhausted` terminal.
11
11
  ## Inputs
12
12
 
13
13
  - exact local report path and bytes
14
- - exact bytes resolved from `reportCommitSha:reportPath` for every retained
15
- candidate, supplied to the validator as `resolvedReportBytes`
16
14
  - primitive accepted-bounds, normalized-target, and governing-source evidence
17
15
  - review mode, lineage, run ID, and delivery ordinal when applicable
18
16
  - expected report SHA-256 and allowed navigation/wiki-log envelope paths
@@ -53,11 +51,8 @@ review_run_id)` independently. Reuse one unique valid candidate, including
53
51
  the report and allowed envelope, then push or use the approved ref. Preserve
54
52
  the report bytes exactly.
55
53
  6. Verify that the retained ref contains the exact report commit and that the
56
- commit changed only approved envelope paths. Resolve
57
- `reportCommitSha:reportPath` from that commit, pass those exact committed
58
- bytes to the retained-pass validator, and require exact equality with the
59
- local report bytes. A local digest or caller assertion cannot replace this
60
- commit-tree read.
54
+ commit changed only approved envelope paths. Run the complete retained-pass
55
+ validator again against the retained blob and current primitive evidence.
61
56
  7. Only a unique valid retained delivery report establishes its ordinal.
62
57
  Reconcile the delivery `review_count` projection from the highest unique
63
58
  valid retained ordinal. Standalone retention changes no delivery counter.
@@ -86,8 +81,6 @@ review_run_id)` independently. Reuse one unique valid candidate, including
86
81
  - same-run candidate inventory and uniqueness decision
87
82
  - report commit SHA and its exact changed-path set
88
83
  - approved retained ref and proof that it contains the report commit
89
- - exact `reportCommitSha:reportPath` resolution and committed/local byte
90
- equality
91
84
  - delivery ordinal and reconciled counter projection, or standalone mode
92
85
 
93
86
  ## Declared Exits
@@ -31,11 +31,13 @@ debug, debt, documentation, or closeout work.
31
31
  1. Revalidate the retained blob, canonical identities, approved commit paths,
32
32
  same-run uniqueness, ref containment, and current freshness. Reuse only the
33
33
  immutable authority block inside those retained bytes.
34
- 2. Pass the complete retained finding set to the public `deriveReviewRouting`
35
- helper. Each non-empty finding already carries one validated `return_route`.
36
- The helper applies `debugging` > `implementation` > `debt_follow_up` >
37
- `docs_ingest`; an empty set returns `closeout`.
38
- 3. Accept `secondary_architecture_follow_up` only when a `debt_follow_up`
34
+ 2. Derive the primary route from retained findings in this order:
35
+ - any finding with runtime-failure evidence -> `debugging`
36
+ - otherwise, any in-scope non-runtime blocking finding -> `implementation`
37
+ - otherwise, any broad architecture-debt finding -> `debt_follow_up`
38
+ - otherwise, incomplete required documentation -> `docs_ingest`
39
+ - otherwise -> `closeout`
40
+ 3. Set `secondary_architecture_follow_up` only when a broad architecture-debt
39
41
  finding accompanies a higher-priority debugging or implementation route.
40
42
  4. Require the derived result to equal the retained report's `routing` object.
41
43
  A mismatch is invalid retained routing evidence and routes to
@@ -61,7 +63,7 @@ debug, debt, documentation, or closeout work.
61
63
 
62
64
  - valid retained-pass result and final freshness result
63
65
  - retained report path, SHA-256, commit, and containing ref
64
- - stable finding IDs and their explicit `return_route` classifications
66
+ - stable finding IDs used by each route class
65
67
  - deterministic precedence result and exact match to report `routing`
66
68
  - returned mode-specific state and routing-evidence artifact
67
69
 
@@ -51,8 +51,7 @@ scope; the parent rejects stale, expanded, duplicated, or unverified output.
51
51
  6. Parent-verify every advisory and lens candidate against the frozen target and
52
52
  adjacent evidence. Only verified candidates become findings. Give each
53
53
  accepted finding a stable identifier, lens, severity, location, impact,
54
- evidence, action, and one explicit `return_route`: `debugging`,
55
- `implementation`, `debt_follow_up`, or `docs_ingest`.
54
+ evidence, and action.
56
55
  7. Run only the smallest safe readonly validation needed to verify candidates or
57
56
  governing acceptance evidence. Broader checks require explicit accepted spec
58
57
  or plan authority. Record missing required RED/GREEN evidence as a finding;
@@ -62,11 +61,10 @@ scope; the parent rejects stale, expanded, duplicated, or unverified output.
62
61
  caches, generated files, snapshots, lockfiles, or state run in a disposable
63
62
  checkout or snapshot rooted at the frozen revision. Reconcile exact commands,
64
63
  isolation mode, hashes, output, skipped checks, and residual risk.
65
- 9. Pass the complete verified finding set to `deriveReviewRouting` in
66
- [`review-contract.mjs`](../scripts/review-contract.mjs). Store its result
67
- unchanged. The helper uses only `return_route`, applies canonical precedence,
68
- and preserves debt as a secondary follow-up beside debugging or
69
- implementation. Finding prose never selects or reranks a route.
64
+ 9. Derive the report route from verified findings: runtime evidence first,
65
+ otherwise an in-scope non-runtime blocker, otherwise broad architecture debt,
66
+ otherwise documentation ingest or closeout by documentation completeness.
67
+ Architecture debt may remain a secondary follow-up.
70
68
  10. Assemble exactly one complete local report using
71
69
  [`../references/durable-report.md`](../references/durable-report.md). Record
72
70
  an explicit outcome for every lens. After its final bytes are written, treat
@@ -97,7 +95,6 @@ The run is complete only when one local report contains:
97
95
  and mode-specific delivery identities
98
96
  - explicit Standards, skill-adherence, architecture, simplify, and Spec outcomes
99
97
  - every verified stable finding and no unverified advisory candidate
100
- - one validated `return_route` on each accepted finding
101
98
  - evidence-cardinality results for all applicable skill guidance and notes
102
99
  - exact validation commands, isolation, before/after hashes, outcomes, skipped
103
100
  checks, and residual risk