@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
@@ -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
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
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 @@ 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,
@@ -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.