@punks/cli 3.2.0 → 3.2.2

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 (87) hide show
  1. package/AGENTS.md +2 -0
  2. package/dist/BASELINE_CHANGELOG.md +47 -1
  3. package/dist/CHANGELOG.md +36 -0
  4. package/dist/baseline/scaffold-baseline/baseline.json +5 -5
  5. package/dist/baseline/scaffold-baseline/data/catalog/lint-assets.json +48 -0
  6. package/dist/baseline/scaffold-baseline/data/catalog/packs.json +2 -1
  7. package/dist/baseline/scaffold-baseline/data/catalog/skills.json +8 -0
  8. package/dist/baseline/scaffold-baseline/skills/agnostic/cli/hi-cli/references/post-command-flow.md +20 -22
  9. package/dist/baseline/scaffold-baseline/skills/agnostic/docs/rule-authoring/SKILL.md +18 -0
  10. package/dist/baseline/scaffold-baseline/skills/agnostic/docs/rule-authoring/references/migration.md +10 -0
  11. package/dist/baseline/scaffold-baseline/skills/agnostic/docs/upstream/mattpocock-writing-skills.md +81 -12
  12. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/create-plan/REFERENCE.md +11 -14
  13. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/create-plan/SKILL.md +17 -14
  14. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/create-plan/references/architecture-convergence.md +99 -0
  15. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/create-plan/references/plan-schema.md +34 -0
  16. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/create-plan/references/planner-task-graph.md +15 -12
  17. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/implement-spec/SKILL.md +6 -5
  18. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/implement-spec/assets/IMPLEMENTATION-NOTES-TEMPLATE.md +10 -0
  19. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/implement-spec/references/architecture-conformance.md +100 -0
  20. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/implement-spec/references/lifecycle.md +25 -2
  21. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/implement-spec/references/parallel-orchestration.md +17 -1
  22. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/implement-spec/references/parallel-worker-brief.md +14 -0
  23. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/implement-spec/references/parallel.md +7 -0
  24. package/dist/baseline/scaffold-baseline/skills/agnostic/quality/tdd/SKILL.md +3 -2
  25. package/dist/baseline/scaffold-baseline/skills/agnostic/quality/tdd/high-signal-tests.md +17 -3
  26. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/domain-modeling/{CONTEXT-FORMAT.md → GLOSSARY-FORMAT.md} +9 -9
  27. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/domain-modeling/SKILL.md +12 -12
  28. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/requirements-grill/SKILL.md +3 -2
  29. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/requirements-grill/references/grilling-flow.md +1 -1
  30. package/dist/baseline/scaffold-baseline/skills/frameworks/effect/effect-service-design/UPSTREAM.md +17 -0
  31. package/dist/baseline/scaffold-baseline/skills/misc/wait-what/SKILL.md +1 -1
  32. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/SKILL.md +5 -7
  33. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/phases/review.md +25 -50
  34. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/phases/router.md +22 -27
  35. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/references/phase-handoff.md +10 -28
  36. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/AUTHORING-HANDOFF.md +11 -14
  37. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/phases/prepare-review.md +1 -1
  38. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/phases/retain-report.md +2 -9
  39. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/phases/return-route.md +8 -6
  40. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/phases/run-review.md +5 -8
  41. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/references/durable-report.md +14 -29
  42. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/references/state-graph.md +32 -45
  43. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/references/targets.md +1 -2
  44. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/scripts/review-contract.mjs +12 -86
  45. package/dist/baseline/scaffold-baseline.json +5 -5
  46. package/dist/baseline/scaffold-baseline.tgz +0 -0
  47. package/dist/data/AGENTS.md +2 -0
  48. package/dist/index.js +15 -15
  49. package/dist/skills/agnostic/cli/hi-cli/references/post-command-flow.md +5 -7
  50. package/dist/skills/agnostic/docs/rule-authoring/SKILL.md +18 -0
  51. package/dist/skills/agnostic/docs/rule-authoring/references/migration.md +10 -0
  52. package/dist/skills/agnostic/docs/upstream/mattpocock-writing-skills.md +81 -12
  53. package/dist/skills/agnostic/planning/create-plan/REFERENCE.md +11 -14
  54. package/dist/skills/agnostic/planning/create-plan/SKILL.md +17 -14
  55. package/dist/skills/agnostic/planning/create-plan/references/architecture-convergence.md +99 -0
  56. package/dist/skills/agnostic/planning/create-plan/references/plan-schema.md +34 -0
  57. package/dist/skills/agnostic/planning/create-plan/references/planner-task-graph.md +15 -12
  58. package/dist/skills/agnostic/planning/implement-spec/SKILL.md +6 -5
  59. package/dist/skills/agnostic/planning/implement-spec/assets/IMPLEMENTATION-NOTES-TEMPLATE.md +10 -0
  60. package/dist/skills/agnostic/planning/implement-spec/references/architecture-conformance.md +100 -0
  61. package/dist/skills/agnostic/planning/implement-spec/references/lifecycle.md +25 -2
  62. package/dist/skills/agnostic/planning/implement-spec/references/parallel-orchestration.md +17 -1
  63. package/dist/skills/agnostic/planning/implement-spec/references/parallel-worker-brief.md +14 -0
  64. package/dist/skills/agnostic/planning/implement-spec/references/parallel.md +7 -0
  65. package/dist/skills/agnostic/quality/tdd/SKILL.md +3 -2
  66. package/dist/skills/agnostic/quality/tdd/high-signal-tests.md +17 -3
  67. package/dist/skills/agnostic/requirements/domain-modeling/{CONTEXT-FORMAT.md → GLOSSARY-FORMAT.md} +9 -9
  68. package/dist/skills/agnostic/requirements/domain-modeling/SKILL.md +12 -12
  69. package/dist/skills/agnostic/requirements/requirements-grill/SKILL.md +3 -2
  70. package/dist/skills/agnostic/requirements/requirements-grill/references/grilling-flow.md +1 -1
  71. package/dist/skills/frameworks/effect/effect-service-design/UPSTREAM.md +17 -0
  72. package/dist/skills/frameworks/nestjs/nestjs-best-practices/.gitignore +29 -0
  73. package/dist/skills/misc/wait-what/SKILL.md +1 -1
  74. package/dist/skills/phases/delivery-phase/SKILL.md +5 -7
  75. package/dist/skills/phases/delivery-phase/phases/review.md +25 -50
  76. package/dist/skills/phases/delivery-phase/phases/router.md +20 -25
  77. package/dist/skills/phases/delivery-phase/references/phase-handoff.md +10 -28
  78. package/dist/skills/phases/review-phase/AUTHORING-HANDOFF.md +11 -14
  79. package/dist/skills/phases/review-phase/phases/prepare-review.md +1 -1
  80. package/dist/skills/phases/review-phase/phases/retain-report.md +2 -9
  81. package/dist/skills/phases/review-phase/phases/return-route.md +8 -6
  82. package/dist/skills/phases/review-phase/phases/run-review.md +5 -8
  83. package/dist/skills/phases/review-phase/references/durable-report.md +14 -29
  84. package/dist/skills/phases/review-phase/references/state-graph.md +6 -19
  85. package/dist/skills/phases/review-phase/references/targets.md +1 -2
  86. package/dist/skills/phases/review-phase/scripts/review-contract.mjs +11 -91
  87. package/package.json +9 -71
@@ -3,7 +3,7 @@
3
3
  Use after implementation or whenever delivery has `review_due` for a stale or
4
4
  missing retained review.
5
5
 
6
- ## Prepare Explicit Review
6
+ ## Prepare Review
7
7
 
8
8
  1. Validate accepted bounds and normalize a supported Git/diff target without
9
9
  mutating it. Unsupported targets or invalid bounds enter `review_failed`
@@ -14,64 +14,39 @@ missing retained review.
14
14
  current-route evidence. This is a zero-write no-op: do not persist
15
15
  `review_due` or mutate any handoff, counter, or delivery status.
16
16
  4. Only when recovered `review_count < 3`, persist `review_due` with the valid
17
- normalized target and exact explicit `$review-phase` invocation
18
- context defined in the phase-handoff reference. Do not preallocate an ordinal
19
- or derive `review_run_id` yet.
20
- 5. Return that invocation context and stop. Only an explicit operator invocation
21
- of `$review-phase` consumes it, preallocates ordinal `review_count + 1`, fixes
22
- `review_run_id`, and enters `review_running`.
23
-
24
- For `report_retention_pending`, return an explicit `$review-phase` resume context
25
- with the existing run id, local report identity, and fresh target/source hashes,
26
- then stop. The explicit review invocation resumes retention without rerunning
27
- lenses.
17
+ normalized target and `$review-phase` invocation context defined in the
18
+ phase-handoff reference. Do not preallocate an ordinal or derive
19
+ `review_run_id` yet.
20
+ 5. Full delivery invokes `$review-phase` with that context immediately. Other
21
+ modes return it and stop. Invocation preallocates ordinal `review_count + 1`,
22
+ fixes `review_run_id`, and enters `review_running`.
23
+
24
+ For `report_retention_pending`, use a `$review-phase` resume context with the
25
+ existing run id, local report identity, and fresh target/source hashes. Full
26
+ delivery resumes it immediately; other modes return it and stop. Retention
27
+ resumes without rerunning lenses.
28
28
 
29
29
  ## Route Retained Findings
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
 
72
- Before review, completion is a durable `review_due` handoff plus exact explicit
73
- invocation context and a stop. After review returns `review_routed`, completion
47
+ Before review, completion is a durable `review_due` handoff plus an invocation
48
+ context; full delivery consumes it immediately. After review returns `review_routed`, completion
74
49
  records report path, report SHA-256, report commit SHA, verified retained ref,
75
50
  lineage, run id, recovered/projected counts, stable finding ids, primary route,
76
- secondary debt route when present, and resulting state. Then stop or re-enter
77
- delivery routing.
51
+ secondary debt route when present, and resulting state. Full delivery re-enters
52
+ routing; other modes stop at their boundary.
@@ -19,12 +19,12 @@ state take precedence over inferred artifact order.
19
19
  `review_failed` even when a persisted counter is 3. Only after those checks
20
20
  may it recover `review_count` and evaluate the budget in memory. Exhaustion
21
21
  returns `review_budget_exhausted` with zero handoff or status writes. A count
22
- below 3 persists `review_due` and returns the exact explicit `$review-phase`
23
- invocation context. Then stop. Delivery never enters `review_running` itself.
24
- 3. For `report_retention_pending`, load [review.md](review.md) only to return the
25
- exact explicit `$review-phase` resume context, then stop. A fresh local report
26
- resumes without rerunning lenses. Stop on terminal `review_failed` with its
27
- exact evidence.
22
+ below 3 persists `review_due`. Full delivery activates `$review-phase` with
23
+ that context; other modes return the exact explicit invocation context and stop.
24
+ 3. For `report_retention_pending`, load [review.md](review.md) to resume
25
+ `$review-phase` in full delivery or return its exact resume context in other
26
+ modes. A fresh local report resumes without rerunning lenses. Stop on terminal
27
+ `review_failed` with its exact evidence.
28
28
  4. Otherwise recover review state by `review_lineage_id`: read the highest valid
29
29
  retained ordinal, reconcile the handoff `review_count` projection, then assess
30
30
  target and source freshness separately.
@@ -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
40
+ 9. If no matching agent-ready `SPEC.md` exists, it is stale, contradictory, or
47
41
  incomplete, or its remote retention or stable blob URL is missing or
48
42
  unverified, load [spec.md](spec.md).
49
- 13. If the verified post-spec backlog projection is missing or stale, load
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
- `review_failed`, `review_budget_exhausted`, or the exact explicit
58
- `$review-phase` invocation context and stops.
59
- 17. Route remaining docs-affecting work to [docs-ingest.md](docs-ingest.md),
51
+ `review_failed`, `review_budget_exhausted`, or a valid `$review-phase`
52
+ context. Full delivery consumes that context immediately; other modes stop.
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
@@ -65,9 +59,10 @@ revision, resume, rebase, commit, retry, and handoff preserve them.
65
59
 
66
60
  ## HITL And Resume
67
61
 
68
- A HITL checkpoint is explicit user control. Run only the requested phase and
69
- stop after its handoff. Earlier phases may have completed through direct skills;
70
- reuse fresh matching artifacts rather than rerunning them.
62
+ A HITL checkpoint exists only when the user explicitly requests it. Full
63
+ delivery otherwise continues across ordinary in-bounds operations without
64
+ confirmation. Earlier phases may have completed through direct skills; reuse
65
+ fresh matching artifacts rather than rerunning them.
71
66
 
72
67
  ## Output
73
68
 
@@ -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,26 +46,12 @@ 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.
49
+ ## Review Invocation Context
59
50
 
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
- ## Explicit Review Invocation Context
68
-
69
- Delivery persists this block for `review_due` and returns it unchanged before
70
- stopping:
51
+ Delivery persists this block for `review_due`:
71
52
 
72
53
  ```text
73
- explicit_operator_invocation_required: true
54
+ review_invocation_authority: full_delivery | explicit_operator
74
55
  review_invocation_skill: $review-phase
75
56
  review_invocation_mode: delivery
76
57
  delivery_goal_identity:
@@ -82,14 +63,15 @@ current_route:
82
63
  normalized_target:
83
64
  ```
84
65
 
85
- The `review_due` handoff leaves `review_run_id` unset. Only the explicit operator
86
- invocation consumes this context, preallocates the next ordinal, fixes the run
87
- id, and enters `review_running`.
66
+ The `review_due` handoff leaves `review_run_id` unset. Full delivery consumes the
67
+ context immediately; other modes return it for explicit operator invocation.
68
+ Consumption preallocates the next ordinal, fixes the run id, and enters
69
+ `review_running`.
88
70
 
89
71
  For `report_retention_pending`, the explicit resume context additionally carries
90
72
  the existing `review_run_id`, ordinal, local report path and SHA-256, target hash,
91
- source hashes, and intended retained ref. Delivery returns it and stops; the
92
- operator invokes `$review-phase` to retry retention without rerunning lenses.
73
+ source hashes, and intended retained ref. Full delivery resumes `$review-phase`;
74
+ other modes return the context for explicit retry without rerunning lenses.
93
75
 
94
76
  After fix 3, `clean_handoff` is final authority. Link immutable review 3, final
95
77
  changes, the same passing focused validation, and clean status.
@@ -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
@@ -3,7 +3,7 @@
3
3
  ## Entry Guard
4
4
 
5
5
  The router selected this gate from fresh `review_due` evidence supplied by an
6
- explicit operator invocation. The review mode is `delivery` or `standalone`,
6
+ authorized full-delivery or explicit-operator invocation. The review mode is `delivery` or `standalone`,
7
7
  and no valid later-state evidence already owns the run.
8
8
 
9
9
  ## Inputs
@@ -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 @@ accepting an exit.
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 @@ accepting an exit.
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
@@ -45,14 +45,9 @@ the fixed wiki values are `review-report`, `project`, and `internal`. Its title
45
45
  uses the derived filename slug; created and updated equal the date in
46
46
  `reviewed_at`. Its lineage, run, mode, timestamp, accepted-bounds identity/hash,
47
47
  and snapshot hash must agree with the JSON authority and recomputed evidence.
48
- Prototype-sensitive frontmatter keys are malformed and are rejected before any
49
- assignment. `reviewed_at` must name a real UTC calendar instant. Delivery
50
- normalization requires a non-empty inclusive scope and delivery-goal identity;
51
- governing-source normalization requires a non-empty source set.
52
48
 
53
49
  The parsed JSON object is report authority. Detached objects, sidecars, and
54
- caller-supplied derived identities are never trusted. It contains exactly these
55
- fields:
50
+ caller-supplied derived identities are never trusted. It contains exactly these fields:
56
51
 
57
52
  - `review_lineage_id`
58
53
  - `review_run_id`
@@ -65,8 +60,8 @@ fields:
65
60
  - canonical `source_set_hash`
66
61
  - an explicit outcome for Standards, skill adherence and scoped skills,
67
62
  architecture, simplify, and Spec
68
- - stable finding identifiers with severity, location, impact, evidence,
69
- action, and one `return_route`
63
+ - stable finding identifiers with severity, location, impact, evidence, and
64
+ action
70
65
  - routing and validation
71
66
 
72
67
  Delivery mode also records delivery-goal identity, review ordinal, and preceding
@@ -75,23 +70,16 @@ as null or not applicable.
75
70
 
76
71
  `lens_outcomes` has exactly `standards`, `skill_adherence`, `architecture`,
77
72
  `simplify`, and `spec`; each value is `clean` or `findings`. Every finding has
78
- exactly the fields `id`, `lens`, `severity`, `location`, `impact`, `evidence`,
79
- `action`, and `return_route`. Finding IDs are unique, severity is `critical`,
80
- `high`, `medium`, or `low`, and each lens outcome agrees with whether that lens
81
- has a finding. Each finding's `return_route` is exactly `debugging`,
82
- `implementation`, `debt_follow_up`, or `docs_ingest`.
73
+ exactly stable `id`, `lens`, `severity`, `location`, `impact`, `evidence`, and
74
+ `action`. Finding IDs are unique, severity is `critical`, `high`, `medium`, or
75
+ `low`, and each lens outcome agrees with whether that lens has a finding.
83
76
 
84
77
  `routing` has exactly `primary` and `secondary_architecture_follow_up`.
85
78
  `primary` is `debugging`, `implementation`, `debt_follow_up`, `docs_ingest`, or
86
- `closeout`; the secondary flag is boolean. Aggregate routing is derived by the
87
- public `deriveReviewRouting` helper from the complete finding set. Precedence is
88
- `debugging` > `implementation` > `debt_follow_up` > `docs_ingest`; an empty set
89
- derives `closeout`, and debt is secondary only beside debugging or
90
- implementation. A supplied aggregate mismatch is invalid. `validation` is an
91
- array of records with exactly command, isolation mode, before/after frozen
92
- hashes, outcome, and evidence. Isolation is proven no-write, disposable
93
- checkout, or disposable snapshot. Retained validation records require equal
94
- before/after hashes.
79
+ `closeout`; the secondary flag is boolean. `validation` is an array of records
80
+ with exactly command, isolation mode, before/after frozen hashes, outcome, and
81
+ evidence. Isolation is proven no-write, disposable checkout, or disposable
82
+ snapshot. Retained validation records require equal before/after hashes.
95
83
 
96
84
  Delivery ordinals are 1 through 3. Review 1 has null preceding-repair ordinal;
97
85
  review 2 or 3 records respectively 1 or 2. Standalone delivery-goal identity,
@@ -129,15 +117,12 @@ evidence. A candidate is a valid retained pass only when every predicate holds:
129
117
  snapshot hash, source-set hash, and deterministic report path equal values
130
118
  recomputed from the canonical identity algorithm;
131
119
  3. the outside-envelope report SHA-256 equals the exact retained report blob;
132
- 4. bytes resolved from `reportCommitSha:reportPath` are exactly equal to the
133
- local report bytes; the caller supplies them as `resolvedReportBytes`;
134
- 5. current accepted-bounds, normalized-target, and governing-source hashes still
120
+ 4. current accepted-bounds, normalized-target, and governing-source hashes still
135
121
  equal the report values;
136
- 6. the report commit changed the report path and only repository-approved
122
+ 5. the report commit changed the report path and only repository-approved
137
123
  report, navigation, and wiki-log envelope paths;
138
- 7. the approved retained ref contains that exact report commit with boolean
139
- `true` containment evidence;
140
- 8. delivery ordinal is an integer from 1 through 3; standalone delivery-only
124
+ 6. the approved retained ref contains that exact report commit;
125
+ 7. delivery ordinal is an integer from 1 through 3; standalone delivery-only
141
126
  fields are null.
142
127
 
143
128
  A malformed report, wrong lineage or run id, wrong blob or freshness hash,
@@ -8,7 +8,7 @@ and clean handoff.
8
8
  | --- | --- | --- | --- | --- | --- | --- |
9
9
  | Current delivery state | Review considered | Unsupported target | Delivery caller | Return `review_failed` | None; zero handoff or status writes | Exact target failure; no report |
10
10
  | Current delivery state | Review considered | Invalid accepted bounds | Delivery caller | Return `review_failed` | None; zero handoff or status writes | Exact bounds failure; no report |
11
- | `review_due` | Explicit review invocation | Delivery; accepted bounds and target valid; recovered `review_count < 3` | Delivery caller | `review_running` | Preallocate ordinal `review_count + 1`; no completed-pass change | Lineage, run id, ordinal, bounds identity/hash, normalized target |
11
+ | `review_due` | Authorized review invocation | Delivery; accepted bounds and target valid; recovered `review_count < 3` | Delivery caller | `review_running` | Preallocate ordinal `review_count + 1`; no completed-pass change | Lineage, run id, ordinal, bounds identity/hash, normalized target |
12
12
  | `review_due` | Explicit review invocation | Standalone; accepted bounds and target valid | Standalone caller | `review_running` | None | Lineage, run id, bounds identity/hash, normalized target |
13
13
  | Current delivery state | Review considered | Delivery; in-memory accepted bounds and target valid; recovered `review_count >= 3` | Delivery caller | Return `review_budget_exhausted` | None; zero handoff or status writes | Exact current route, lineage, counters; no report or status mutation |
14
14
  | `review_running` | All lenses and parent verification complete | One frozen snapshot; complete local report exists | `review-phase` | `report_retention_pending` | None; no completed-pass change | Complete report and fresh target/source hashes |
@@ -27,17 +27,11 @@ and clean handoff.
27
27
  | `review_routed` | Readonly return | Standalone | Standalone caller | `review_complete` | None | Retained report output and route |
28
28
  | `review_routed` | Resume debug route | Handoff already records run id, debug route, and `debug_active` | `delivery-phase` | `debug_active` | None | Existing atomic handoff; no guard fallthrough |
29
29
  | `review_routed` | Resume implementation route | Handoff already records run id, implementation route, and `repair_active` | `delivery-phase` | `repair_active` | None | Existing atomic handoff; no guard fallthrough |
30
- | `review_routed` | Resume debt follow-up | Handoff already records run id, retained report, stable finding IDs, and `debt_follow_up` | Delivery review handoff | `debt_follow_up` | None | Existing debt keys and artifact; no duplicate capture |
31
- | `review_routed` | Mixed finding route | Runtime evidence exists; derived primary route is `debugging`; secondary architecture follow-up is true; run id unrecorded | `delivery-phase` | `debt_follow_up` | None | Explicit finding routes, stable findings, post-debt route `debugging` |
32
- | `review_routed` | Mixed finding route | No runtime evidence; derived primary route is `implementation`; secondary architecture follow-up is true; run id unrecorded | `delivery-phase` | `debt_follow_up` | None | Explicit finding routes, stable findings, post-debt route `implementation` |
33
- | `review_routed` | Single repair route | Runtime evidence exists; derived primary route is `debugging`; no debt follow-up; run id unrecorded | `delivery-phase` | `debug_active` | Atomic handoff opens corresponding repair | Explicit finding routes, stable findings, atomic handoff |
34
- | `review_routed` | Single repair route | No runtime evidence; in-scope non-runtime blocker exists; derived primary route is `implementation`; no debt follow-up; run id unrecorded | `delivery-phase` | `repair_active` | Atomic handoff opens corresponding repair | Explicit finding routes, stable findings, atomic handoff |
35
- | `review_routed` | Finding route | Derived primary route is `debt_follow_up` | `delivery-phase` | `debt_follow_up` | None | Explicit debt routes, stable findings, post-debt route `docs_ingest` or `closeout` |
36
- | `debt_follow_up` | Debt captured | Every debt key is present; `post_debt_route` is `debugging` | Delivery review handoff | `debug_active` | Open repair after capture exactly once | Retained report commit/path, stable finding IDs, artifact path, captured keys |
37
- | `debt_follow_up` | Debt captured | Every debt key is present; `post_debt_route` is `implementation` | Delivery review handoff | `repair_active` | Open repair after capture exactly once | Retained report commit/path, stable finding IDs, artifact path, captured keys |
38
- | `debt_follow_up` | Debt captured | Every debt key is present; `post_debt_route` is `docs_ingest` or `closeout` | Delivery review handoff | `docs_ingest` or `closeout` | None | Retained report commit/path, stable finding IDs, artifact path, captured keys |
39
- | `review_routed` | Documentation-only findings | Derived primary route is `docs_ingest` | `delivery-phase` | `docs_ingest` | None | Explicit docs routes and stable findings |
40
- | `review_routed` | Finding-free route | Finding set is empty | `delivery-phase` | `closeout` | None | Report and derived closeout route |
30
+ | `review_routed` | Mixed or single finding route | Runtime evidence exists; run id unrecorded | `delivery-phase` | `debug_active` | Atomic handoff opens corresponding repair | Primary debug route, stable findings, atomic handoff, optional architecture follow-up |
31
+ | `review_routed` | Mixed or single finding route | No runtime evidence; in-scope non-runtime blocker exists; run id unrecorded | `delivery-phase` | `repair_active` | Atomic handoff opens corresponding repair | Primary implementation route, stable findings, atomic handoff, optional architecture follow-up |
32
+ | `review_routed` | Finding route | No higher blocker; broad architecture debt exists | `delivery-phase` | `debt_follow_up` | None | Debt route and stable findings |
33
+ | `review_routed` | No-blocker route | Required documentation remains | `delivery-phase` | `docs_ingest` | None | Report and docs route |
34
+ | `review_routed` | No-blocker route | Documentation complete | `delivery-phase` | `closeout` | None | Report and closeout route |
41
35
  | `repair_active` or `debug_active` | Ordinary repair completes | `review_count < 3` | `delivery-phase` | `review_due` | None | Stale prior report, changed target identity, preserved counters |
42
36
  | `repair_active` or `debug_active` | Fix 3 completes | `review_count = 3` and `repair_count = 3` | `delivery-phase` | `focused_validation` | None | Fix-3 changes and required focused validation |
43
37
  | `focused_validation` | Focused validation fails | Repair epoch 3 remains open | `delivery-phase` | `repair_active` or `debug_active` | None; unchanged counters | Failed validation and recorded owning route |
@@ -58,13 +52,6 @@ already-consumed ordinals. Complete the transition only after the write. An
58
52
  already recorded run ID resumes its active state without another increment and
59
53
  cannot fall through to an unrecorded guard.
60
54
 
61
- Debt capture is also idempotent. The retained report commit, report path, and
62
- stable finding ID form one key in the goal/spec-linked debt artifact. Resume
63
- reuses recorded keys, adds only missing keys, and follows durable
64
- `post_debt_route` without implementing unaccepted debt. Secondary debt records
65
- `debugging` or `implementation`; primary debt records `docs_ingest` or
66
- `closeout`. Capture completes before the recorded route opens.
67
-
68
55
  Review 1 may open fix 1, review 2 fix 2, and review 3 fix 3. Fix 3 never opens
69
56
  review 4. A failed focused validation stays in repair epoch 3 until that same
70
57
  validation passes.
@@ -6,8 +6,7 @@ composition, report, routing, and freshness contracts.
6
6
 
7
7
  ## Scope
8
8
 
9
- Record a non-empty, smallest certain inclusive scope in every review mode. A
10
- zero-artifact bundle is not a review target. Full-repository expansion requires
9
+ Record the smallest certain inclusive scope. Full-repository expansion requires
11
10
  an explicit caller request. Unsupported targets or invalid accepted bounds enter
12
11
  `review_failed` with exact evidence, no report, and no counter change, including
13
12
  when a delivery counter is already 3.