@punks/cli 4.0.3 → 5.0.0

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 (116) hide show
  1. package/dist/BASELINE_CHANGELOG.md +25 -1
  2. package/dist/CHANGELOG.md +41 -0
  3. package/dist/baseline/scaffold-baseline/baseline.json +563 -5
  4. package/dist/baseline/scaffold-baseline/data/scripts/harness-projection/authoring.d.mts +23 -0
  5. package/dist/baseline/scaffold-baseline/data/scripts/harness-projection/authoring.mjs +84 -0
  6. package/dist/baseline/scaffold-baseline/data/scripts/harness-projection/authoring.test.ts +79 -0
  7. package/dist/baseline/scaffold-baseline/data/scripts/harness-projection/lint-feedback.test.ts +60 -28
  8. package/dist/baseline/scaffold-baseline/data/scripts/sync-subagents-validator.test.ts +59 -0
  9. package/dist/baseline/scaffold-baseline/data/scripts/sync-subagents.d.mts +1 -0
  10. package/dist/baseline/scaffold-baseline/data/scripts/sync-subagents.mjs +192 -16
  11. package/dist/baseline/scaffold-baseline/data/shared-agents.md +55 -0
  12. package/dist/baseline/scaffold-baseline/skills/agnostic/cli/hi-cli/references/post-command-flow.md +12 -0
  13. package/dist/baseline/scaffold-baseline/skills/agnostic/generic/handoff/SKILL.md +18 -5
  14. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/create-plan/SKILL.md +10 -2
  15. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/create-plan/references/plan-schema.md +28 -8
  16. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/create-plan/references/planner-task-graph.md +7 -3
  17. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/create-verification-skill/SKILL.md +66 -0
  18. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/create-verification-skill/references/upstream.md +20 -0
  19. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/implement-spec/SKILL.md +16 -41
  20. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/implement-spec/assets/IMPLEMENTATION-NOTES-TEMPLATE.md +14 -0
  21. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/implement-spec/references/architecture-conformance.md +10 -6
  22. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/implement-spec/references/lifecycle.md +47 -7
  23. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/implement-spec/references/parallel-orchestration.md +102 -134
  24. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/implement-spec/references/parallel-worker-brief.md +77 -67
  25. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/implement-spec/references/parallel.md +19 -39
  26. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/implement-spec/references/runtime-product-validation.md +27 -0
  27. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/swarm-planner/SKILL.md +27 -2
  28. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/update-verification-skill/SKILL.md +81 -0
  29. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/verify-behavior/SKILL.md +105 -65
  30. package/dist/baseline/scaffold-baseline/skills/agnostic/quality/autoreview/SKILL.md +17 -4
  31. package/dist/baseline/scaffold-baseline/skills/agnostic/quality/autoreview/scripts/autoreview +102 -5
  32. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/brainstorm/SKILL.md +11 -5
  33. package/dist/baseline/scaffold-baseline/skills/agnostic/subagents/swarm-planner/SKILL.md +27 -2
  34. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/SKILL.md +12 -14
  35. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/phases/backlog.md +4 -0
  36. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/phases/closeout.md +12 -4
  37. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/phases/debug.md +11 -5
  38. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/phases/docs-ingest.md +4 -0
  39. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/phases/handback.md +6 -2
  40. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/phases/implement.md +12 -7
  41. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/phases/plan.md +7 -1
  42. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/phases/review.md +61 -22
  43. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/phases/router.md +45 -91
  44. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/phases/spec.md +4 -0
  45. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/references/artifact-state.md +21 -9
  46. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/references/context-continuity.md +109 -0
  47. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/references/failure-continuity.md +27 -0
  48. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/references/phase-handoff.md +32 -20
  49. package/dist/baseline/scaffold-baseline/skills/phases/docs-ingest-phase/SKILL.md +4 -0
  50. package/dist/baseline/scaffold-baseline/skills/phases/docs-ingest-phase/references/wiki-ingest.md +4 -0
  51. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/phases/prepare-review.md +41 -8
  52. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/phases/retain-report.md +13 -4
  53. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/phases/router.md +1 -1
  54. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/phases/run-review.md +24 -18
  55. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/references/durable-report.md +40 -6
  56. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/references/review-packet.md +72 -0
  57. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/references/runtime-handoff.md +3 -0
  58. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/references/state-graph.md +51 -42
  59. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/scripts/review-contract.mjs +239 -4
  60. package/dist/baseline/scaffold-baseline.json +5 -5
  61. package/dist/baseline/scaffold-baseline.tgz +0 -0
  62. package/dist/data/scripts/harness-projection/authoring.d.mts +23 -0
  63. package/dist/data/scripts/harness-projection/authoring.mjs +84 -0
  64. package/dist/data/scripts/sync-subagents.d.mts +1 -0
  65. package/dist/data/scripts/sync-subagents.mjs +158 -15
  66. package/dist/data/shared-agents.md +2 -60
  67. package/dist/index.js +1417 -1407
  68. package/dist/skills/agnostic/cli/hi-cli/references/post-command-flow.md +12 -0
  69. package/dist/skills/agnostic/generic/handoff/SKILL.md +18 -5
  70. package/dist/skills/agnostic/planning/create-plan/SKILL.md +10 -2
  71. package/dist/skills/agnostic/planning/create-plan/references/plan-schema.md +28 -8
  72. package/dist/skills/agnostic/planning/create-plan/references/planner-task-graph.md +7 -3
  73. package/dist/skills/agnostic/planning/create-verification-skill/SKILL.md +66 -0
  74. package/dist/skills/agnostic/planning/create-verification-skill/references/upstream.md +20 -0
  75. package/dist/skills/agnostic/planning/implement-spec/SKILL.md +16 -41
  76. package/dist/skills/agnostic/planning/implement-spec/assets/IMPLEMENTATION-NOTES-TEMPLATE.md +14 -0
  77. package/dist/skills/agnostic/planning/implement-spec/references/architecture-conformance.md +10 -6
  78. package/dist/skills/agnostic/planning/implement-spec/references/lifecycle.md +47 -7
  79. package/dist/skills/agnostic/planning/implement-spec/references/parallel-orchestration.md +102 -134
  80. package/dist/skills/agnostic/planning/implement-spec/references/parallel-worker-brief.md +77 -67
  81. package/dist/skills/agnostic/planning/implement-spec/references/parallel.md +19 -39
  82. package/dist/skills/agnostic/planning/implement-spec/references/runtime-product-validation.md +27 -0
  83. package/dist/skills/agnostic/planning/swarm-planner/SKILL.md +27 -2
  84. package/dist/skills/agnostic/planning/update-verification-skill/SKILL.md +81 -0
  85. package/dist/skills/agnostic/planning/verify-behavior/SKILL.md +105 -65
  86. package/dist/skills/agnostic/quality/autoreview/SKILL.md +17 -4
  87. package/dist/skills/agnostic/quality/autoreview/scripts/autoreview +102 -5
  88. package/dist/skills/agnostic/requirements/brainstorm/SKILL.md +11 -5
  89. package/dist/skills/agnostic/subagents/swarm-planner/SKILL.md +27 -2
  90. package/dist/skills/phases/delivery-phase/SKILL.md +12 -14
  91. package/dist/skills/phases/delivery-phase/phases/backlog.md +4 -0
  92. package/dist/skills/phases/delivery-phase/phases/closeout.md +12 -4
  93. package/dist/skills/phases/delivery-phase/phases/debug.md +11 -5
  94. package/dist/skills/phases/delivery-phase/phases/docs-ingest.md +4 -0
  95. package/dist/skills/phases/delivery-phase/phases/handback.md +6 -2
  96. package/dist/skills/phases/delivery-phase/phases/implement.md +12 -7
  97. package/dist/skills/phases/delivery-phase/phases/plan.md +7 -1
  98. package/dist/skills/phases/delivery-phase/phases/review.md +61 -22
  99. package/dist/skills/phases/delivery-phase/phases/router.md +45 -91
  100. package/dist/skills/phases/delivery-phase/phases/spec.md +4 -0
  101. package/dist/skills/phases/delivery-phase/references/artifact-state.md +21 -9
  102. package/dist/skills/phases/delivery-phase/references/context-continuity.md +109 -0
  103. package/dist/skills/phases/delivery-phase/references/failure-continuity.md +27 -0
  104. package/dist/skills/phases/delivery-phase/references/phase-handoff.md +32 -20
  105. package/dist/skills/phases/docs-ingest-phase/SKILL.md +4 -0
  106. package/dist/skills/phases/docs-ingest-phase/references/wiki-ingest.md +4 -0
  107. package/dist/skills/phases/review-phase/phases/prepare-review.md +40 -8
  108. package/dist/skills/phases/review-phase/phases/retain-report.md +13 -4
  109. package/dist/skills/phases/review-phase/phases/router.md +1 -1
  110. package/dist/skills/phases/review-phase/phases/run-review.md +24 -18
  111. package/dist/skills/phases/review-phase/references/durable-report.md +40 -6
  112. package/dist/skills/phases/review-phase/references/review-packet.md +72 -0
  113. package/dist/skills/phases/review-phase/references/runtime-handoff.md +3 -0
  114. package/dist/skills/phases/review-phase/references/state-graph.md +21 -12
  115. package/dist/skills/phases/review-phase/scripts/review-contract.mjs +137 -4
  116. package/package.json +4 -1
@@ -13,7 +13,7 @@ docs ingest or no-op, and validation are complete.
13
13
  the final commit. A failed or unavailable required proof blocks closeout.
14
14
  - After exact-tree proof passes, route final directly observed delivery facts
15
15
  through `write-backlog`'s
16
- [delivery-status branch](../../write-backlog/references/delivery-status.md).
16
+ [delivery-status branch](../../../agnostic/requirements/write-backlog/references/delivery-status.md).
17
17
  Close provider work and the
18
18
  goal only when their acceptance conditions pass. Fog completion additionally
19
19
  requires production evidence for every accepted resulting Story and Task.
@@ -21,13 +21,17 @@ docs ingest or no-op, and validation are complete.
21
21
  - Report phase path actually taken; do not imply skipped phases ran.
22
22
  - Report validation commands, browser checks, smoke tests, or manual scenarios.
23
23
  - Report review result and whether findings remain.
24
- - When fix 3 occurred, require `clean_handoff` linking immutable review-3 report,
25
- final changes, passing focused validation, and clean status. Do not require a
26
- fourth review.
27
24
  - Report debugging result or explicit skip reason.
28
25
  - Report docs ingest result or explicit no-op reason.
29
26
  - For UI changes, verify the PR body, PR comment, or PR-ready handoff includes durable before/after `UI Evidence` links.
30
27
 
28
+ ## Accepted Repair Continuity
29
+
30
+ Follow [review.md](review.md) for Focused Repair Validation, affected Verification
31
+ reruns and risk-triggered second-pass eligibility. Preserve lineage, retained
32
+ ordinals and consumed repair run IDs. On failure, use
33
+ [bounded diagnosis and scope custody](../references/failure-continuity.md).
34
+
31
35
  ## Output
32
36
 
33
37
  Return a concise delivery report with:
@@ -42,3 +46,7 @@ Return a concise delivery report with:
42
46
  - tracker or PR state
43
47
  - UI Evidence state when user-visible UI changed
44
48
  - exit: done, blocked, or split into follow-up
49
+
50
+ Emit the [common Phase Result](../references/context-continuity.md#common-phase-result)
51
+ with pointers to this completion evidence. Continue only in Full Delivery;
52
+ otherwise stop at the requested boundary.
@@ -18,11 +18,13 @@ Load `debugging-phase` only after this phase is selected.
18
18
  opening another goal.
19
19
  - Preserve review lineage, `review_count`, `repair_count`, and the opening
20
20
  `review_run_id` through the repair.
21
- - After an ordinary fix with `review_count < 3`, stale the preceding report and
22
- enter `review_due`.
23
- - After debug fix 3 (`review_count = 3`, `repair_count = 3`), enter
24
- `focused_validation`. Failure resumes `debug_active` in epoch 3 without a
25
- counter change; passing records `clean_handoff`. Fix 3 never opens review 4.
21
+
22
+ ## Accepted Repair Continuity
23
+
24
+ Follow [review.md](review.md) for Focused Repair Validation, affected Verification
25
+ reruns and risk-triggered second-pass eligibility. Preserve lineage, retained
26
+ ordinals and consumed repair run IDs. On failure, use
27
+ [bounded diagnosis and scope custody](../references/failure-continuity.md).
26
28
 
27
29
  ## Completion State
28
30
 
@@ -35,3 +37,7 @@ Write or verify:
35
37
  - resulting state and preserved counter evidence
36
38
 
37
39
  Then stop or re-enter `delivery-phase` for routing.
40
+
41
+ Emit the [common Phase Result](../references/context-continuity.md#common-phase-result)
42
+ with pointers to this completion evidence. Continue only in Full Delivery;
43
+ otherwise stop at the requested boundary.
@@ -25,3 +25,7 @@ Write or verify:
25
25
  - any follow-up docs debt
26
26
 
27
27
  Then stop or re-enter `delivery-phase` for routing.
28
+
29
+ Emit the [common Phase Result](../references/context-continuity.md#common-phase-result)
30
+ with pointers to this completion evidence. Continue only in Full Delivery;
31
+ otherwise stop at the requested boundary.
@@ -7,8 +7,8 @@ The router selected current evidence that triggers `$handback`.
7
7
  ## Bounded Action
8
8
 
9
9
  1. Invoke `$handback` with the active delivery evidence.
10
- 2. Persist its complete outcome as `human_steering_required` in the delivery
11
- handoff.
10
+ 2. Retain its complete outcome in the durable state artifact; put its Context
11
+ Pointer and exact blocker in the compact Delivery Handoff.
12
12
  3. Stop.
13
13
 
14
14
  ## Completion Evidence
@@ -21,3 +21,7 @@ The router selected current evidence that triggers `$handback`.
21
21
 
22
22
  Return terminal `human_steering_required`. Resume routing only after the
23
23
  `$handback` authority guard passes.
24
+
25
+ Emit the [common Phase Result](../references/context-continuity.md#common-phase-result)
26
+ with pointers to this completion evidence. Stop in every mode until the
27
+ `$handback` authority guard passes.
@@ -22,7 +22,7 @@ silently renaming them.
22
22
  - For provider-task work, immediately route each directly observed work start,
23
23
  blocker, pull request, merge, staging deployment, or production deployment
24
24
  through `write-backlog`'s
25
- [delivery-status.md](../../write-backlog/references/delivery-status.md) branch.
25
+ [delivery-status.md](../../../agnostic/requirements/write-backlog/references/delivery-status.md) branch.
26
26
  Require exact readback before advancing the Task. Planning-only work emits no
27
27
  provider lifecycle mutation or readback claim.
28
28
  - Merge is never deployment evidence. Merge, staging, and production remain
@@ -41,12 +41,13 @@ silently renaming them.
41
41
  - If runtime evidence appears during validation, finish the phase handoff and route to debug.
42
42
  - Preserve review lineage, `review_count`, `repair_count`, and the opening
43
43
  `review_run_id` through the repair.
44
- - After an ordinary repair with `review_count < 3`, stale the preceding report
45
- and enter `review_due` with the changed target identity.
46
- - After fix 3 (`review_count = 3`, `repair_count = 3`), enter
47
- `focused_validation`. Run only the focused validation required by accepted
48
- evidence. Failure remains `repair_active` in epoch 3; passing records
49
- `clean_handoff`. Fix 3 never opens review 4.
44
+
45
+ ## Accepted Repair Continuity
46
+
47
+ Follow [review.md](review.md) for Focused Repair Validation, affected Verification
48
+ reruns and risk-triggered second-pass eligibility. Preserve lineage, retained
49
+ ordinals and consumed repair run IDs. On failure, use
50
+ [bounded diagnosis and scope custody](../references/failure-continuity.md).
50
51
 
51
52
  ## Completion State
52
53
 
@@ -63,3 +64,7 @@ Write or verify:
63
64
  `clean_handoff`, or blocked
64
65
 
65
66
  Then stop or re-enter `delivery-phase` for routing.
67
+
68
+ Emit the [common Phase Result](../references/context-continuity.md#common-phase-result)
69
+ with pointers to this completion evidence. Continue only in Full Delivery;
70
+ otherwise stop at the requested boundary.
@@ -11,7 +11,9 @@ Load `create-plan` only after this phase is selected.
11
11
 
12
12
  - Verify the spec still matches the requested goal.
13
13
  - Preserve tracker hierarchy and every child-story or sub-issue requirement.
14
- - Require dependencies, owned paths, validation gates, review routing, and explicit wave boundaries.
14
+ - Require dependencies, Active Write Scopes, Read Dependencies, Shared Runtime
15
+ Resources, Relevant Input Set identities, validation gates, review routing and
16
+ explicit wave boundaries through `create-plan` and its `swarm-planner` primitive.
15
17
  - Group independent tasks with disjoint write scopes into the same wave.
16
18
  - Put every currently unblocked task with a disjoint write scope in the same
17
19
  wave. Use a one-task wave only when dependencies or ownership leave one task
@@ -27,3 +29,7 @@ Write or verify:
27
29
  - planned review and docs-ingest expectations
28
30
 
29
31
  Then stop or re-enter `delivery-phase` for routing.
32
+
33
+ Emit the [common Phase Result](../references/context-continuity.md#common-phase-result)
34
+ with pointers to this completion evidence. Continue only in Full Delivery;
35
+ otherwise stop at the requested boundary.
@@ -1,30 +1,69 @@
1
1
  # Review Phase
2
2
 
3
- Use after implementation or whenever delivery has `review_due` for a stale or
4
- missing retained review.
3
+ Use after `implement-spec` returns complete implementation evidence. For a stale
4
+ or missing retained review, first recheck the same completion gates against the
5
+ current snapshot.
5
6
 
6
7
  ## Prepare Review
7
8
 
8
- 1. Validate accepted bounds and normalize a supported Git/diff target without
9
- mutating it. Unsupported targets or invalid bounds enter `review_failed`
10
- with exact evidence, no report, and no counter change.
11
- 2. Keep that result in memory and recover `review_count` from unique valid retained passes for the
12
- delivery lineage and reconcile the handoff projection.
13
- 3. If recovered `review_count >= 3`, return `review_budget_exhausted` with exact
14
- current-route evidence. This is a zero-write no-op: do not persist
15
- `review_due` or mutate any handoff, counter, or delivery status.
16
- 4. Only when recovered `review_count < 3`, persist `review_due` with the valid
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.
9
+ 1. Require implementation, applicable task checks and Task Gates, Verification,
10
+ parent shared-summary reconciliation, Architecture Checkpoints and final
11
+ acceptance evidence. Missing or stale proof returns the exact owning gate;
12
+ it cannot enter Code Review. Review consumes Verification evidence while
13
+ implementation owns verifier execution and maintenance.
14
+ 2. Validate accepted bounds and normalize the supported Git/diff target without
15
+ mutation. Invalid bounds or unsupported targets return `review_failed` with
16
+ exact evidence, no report and no completed-count change.
17
+ 3. Recover completed Full Code Review Passes from valid retained evidence for
18
+ this delivery lineage and reconcile `review_count`. Interrupted, incomplete
19
+ or invalidated attempts are neither clean nor completed; preserve their
20
+ attempt identity and missing coverage without consuming completed allowance.
21
+ 4. Default to one Full Code Review Pass over the frozen implemented change.
22
+ After a completed pass, apply the repair rules below before opening another.
23
+ At two completed passes, return `review_budget_exhausted` unless explicit
24
+ human direction authorizes another. Record the exhausted route evidence;
25
+ preserve retained reports, counts and pending work.
26
+ 5. For an eligible pass, persist `review_due`, the normalized target and
27
+ `$review-phase` invocation context from the phase-handoff reference. Full
28
+ delivery invokes it immediately; other modes return that context and stop.
29
+ Invocation fixes the attempt identity and proposed next completed ordinal;
30
+ only complete coverage plus valid retained evidence establishes completion.
31
+
32
+ The review owner prepares one frozen Review Packet for the comprehensive primary
33
+ reviewer and mandatory independent risk-focused challenger. Completion requires
34
+ explicit primary outcomes for Standards, skill adherence, architecture, simplify
35
+ and Spec, plus complete challenger coverage for its bounded independent risk
36
+ area. The parent adjudicates findings and owns the report. Reach
37
+ [review-phase](../../review-phase/SKILL.md) for that protocol.
38
+
39
+ A semantic input change during an active attempt invalidates it. Record the
40
+ changed input, preserve the incomplete attempt evidence and start a fresh attempt
41
+ over the new frozen target after rechecking affected implementation gates. This
42
+ is distinct from accepted repair after a completed pass.
43
+
44
+ For `report_retention_pending`, recheck target/source freshness and resume the
45
+ existing run and local report identity without rerunning reviewers. Semantic
46
+ change instead invalidates the attempt. A retention retry alone grants neither
47
+ a new pass nor a second completed ordinal.
48
+
49
+ ## Validate Accepted Repair
50
+
51
+ Ordinary accepted repair runs Focused Repair Validation and reruns only
52
+ Verification scenarios whose evidence it invalidated. Keep matching unaffected
53
+ proof with its identity and freshness. Passing focused checks resumes delivery
54
+ routing without automatically opening a second Full Code Review Pass.
55
+
56
+ One second completed pass is eligible only when accepted repair changes
57
+ architecture, security or authorization, a public contract, runtime or deployment
58
+ topology, or accepted scope. Record the changed risk category and accepted repair
59
+ evidence before requesting it; changed accepted scope must already have explicit
60
+ authority. Recheck implementation completion and freeze the repaired target.
61
+ The two-completed-pass ceiling still applies.
62
+
63
+ Continue a repair only when new evidence advances diagnosis or validation, or a
64
+ remaining discriminating diagnostic can resolve the failure. Record that evidence
65
+ or diagnostic before retrying. A stagnant loop returns an exact blocker and
66
+ remaining work; it never counts as progress or expands the review allowance.
28
67
 
29
68
  ## Route Retained Findings
30
69
 
@@ -1,93 +1,47 @@
1
1
  # Router Phase
2
2
 
3
- Choose one next phase from durable artifacts. Review counters and active repair
4
- state take precedence over inferred artifact order.
5
-
6
- ## Inputs
7
-
8
- - entry intent and accepted goal bounds
9
- - matching spec, backlog projection, plan, implementation notes, and validation
10
- - retained review reports plus durable phase handoff
11
- - current diff/target and governing source hashes
12
- - docs, stack, tracker, and PR state when relevant
13
-
14
- ## Route
15
-
16
- 1. For durable `human_steering_required`, stop until the `$handback` authority
17
- guard passes.
18
- 2. When current evidence triggers `$handback`, load [handback.md](handback.md).
19
- 3. Stop on unclear goal bounds and ask one concrete question.
20
- 4. For durable `review_due`, load [review.md](review.md). It first validates
21
- accepted bounds and normalizes a supported target. A rejection enters
22
- `review_failed` even when a persisted counter is 3. Only after those checks
23
- may it recover `review_count` and evaluate the budget in memory. Exhaustion
24
- returns `review_budget_exhausted` with zero handoff or status writes. A count
25
- below 3 persists `review_due`. Full delivery activates `$review-phase` with
26
- that context; other modes return the exact explicit invocation context and stop.
27
- 5. For `report_retention_pending`, load [review.md](review.md) to resume
28
- `$review-phase` in full delivery or return its exact resume context in other
29
- modes. A fresh local report resumes without rerunning lenses. Stop on terminal
30
- `review_failed` with its exact evidence.
31
- 6. Otherwise recover review state by `review_lineage_id`: read the highest valid
32
- retained ordinal, reconcile the handoff `review_count` projection, then assess
33
- target and source freshness separately.
34
- 7. Route a fresh retained `review_routed` report through [review.md](review.md)
35
- when no durable route handoff exists yet.
36
- 8. Resume an atomic handoff already in `debug_active` through [debug.md](debug.md)
37
- or `repair_active` through [implement.md](implement.md). A recorded
38
- `review_run_id` cannot increment `repair_count` again.
39
- 9. Resume `debt_follow_up` through [review.md](review.md). Its handler reuses or
40
- records the goal/spec-linked debt artifact, then follows durable
41
- `post_debt_route`: `debugging` or `implementation` for secondary debt;
42
- `docs_ingest` or `closeout` for primary debt. It never implements the debt.
43
- 10. Route `focused_validation` to its recorded implementation or debugging owner.
44
- Passing becomes `clean_handoff`; failure remains repair epoch 3.
45
- 11. Route `clean_handoff` to [docs-ingest.md](docs-ingest.md) when docs remain,
46
- otherwise [closeout.md](closeout.md).
47
- 12. For durable `docs_ingest`, load [docs-ingest.md](docs-ingest.md).
48
- 13. For durable `closeout`, load [closeout.md](closeout.md).
49
- 14. If no matching agent-ready `SPEC.md` exists for bounded requirements, or the
50
- specification is stale, contradictory, incomplete, or lacks verified remote
51
- retention, route them to Requirements Phase. Requirements Phase owns the
52
- Requirements Grill, Create Spec, and Write Backlog sequence.
53
- 15. If a verified specification lacks its current Write Backlog result, route
54
- the retained specification authority to Requirements Phase for
55
- delivery-depth projection and exact readback.
56
- 16. If no execution-ready matching plan exists, or it lacks dependencies, owned
57
- paths, validation gates, or wave boundaries, load [plan.md](plan.md).
58
- 17. If accepted plan work is incomplete, load [implement.md](implement.md).
59
- 18. If implementation exists and its retained review is missing or stale, load
60
- [review.md](review.md). That phase validates accepted bounds and normalizes a
61
- supported target before any delivery-budget evaluation, then returns either
62
- `review_failed`, `review_budget_exhausted`, or a valid `$review-phase`
63
- context. Full delivery consumes that context immediately; other modes
64
- return the exact explicit invocation context and stop.
65
- 19. Route remaining docs-affecting work to [docs-ingest.md](docs-ingest.md),
66
- otherwise [closeout.md](closeout.md).
67
-
68
- Finder context is optional. Route direct bounded input to Requirements Phase
69
- without creating a Finder artifact. When the caller supplies Finder context,
70
- pass only its exact handle for Requirements Phase to resolve.
71
-
72
- When a linked provider Task has a newly observed work start, blocker, pull
73
- request, merge, staging deployment, or production deployment without exact
74
- readback, route to [implement.md](implement.md) before any later phase.
75
-
76
- Only an explicitly new delivery goal with materially changed accepted bounds
77
- creates a new lineage and resets review/repair counters. Same-goal bounds
78
- revision, resume, rebase, commit, retry, and handoff preserve them.
79
-
80
- ## HITL And Resume
81
-
82
- A HITL checkpoint exists only when the user explicitly requests it. Full
83
- delivery otherwise continues across ordinary in-bounds operations without
84
- confirmation. Earlier phases may have completed through direct skills; reuse
85
- fresh matching artifacts rather than rerunning them.
86
-
87
- `human_steering_required` is a terminal boundary, not an optional HITL
88
- checkpoint.
89
-
90
- ## Output
91
-
92
- Report the selected state and phase, the durable evidence that selected it, the
93
- next file or child skill, and any exact blocker.
3
+ Choose one next phase from current durable authority.
4
+
5
+ 1. Apply [context continuity](../references/context-continuity.md): select
6
+ trigger-specific instructions, validate required pointers and warm/cold mode.
7
+ A failed resolution emits the common Phase Result and blocks its action.
8
+ 2. Preserve terminal `human_steering_required` until `$handback`'s authority guard
9
+ passes. New boundary evidence selects [handback.md](handback.md).
10
+ 3. For failed tasks or repair evidence, apply
11
+ [failure continuity](../references/failure-continuity.md). Independent eligible
12
+ work continues through the implementation owner's gates.
13
+ 4. Recover review lineage, valid completed ordinals and durable active repair
14
+ state separately from current evidence freshness. Review due, retention pending,
15
+ unrouted findings, or budget decisions select [review.md](review.md), the sole
16
+ delivery review-transition authority. It validates bounds and target before
17
+ budget evaluation and distinguishes incomplete attempts from completed passes.
18
+ Resume `debug_active` through [debug.md](debug.md), `repair_active` through
19
+ [implement.md](implement.md), and debt capture through [review.md](review.md).
20
+ Route legacy `focused_validation` to its recorded implementation/debugging
21
+ owner and `clean_handoff` to remaining docs or closeout after checking proof.
22
+ Reuse recorded run IDs and debt keys; a resume cannot consume them twice.
23
+ 5. Before planning, require a matching agent-ready `SPEC.md` with verified remote
24
+ retention and its current Write Backlog result through the
25
+ [Spec Complete and Backlog Projection Complete gates](../references/artifact-state.md).
26
+ Missing, stale or contradictory required proof routes the exact gap to
27
+ Requirements Phase before planning. It owns Requirements Grill, Create Spec
28
+ and Write Backlog. Valid current proof proceeds without a new approval gate;
29
+ optional Finder context is passed only when supplied, never manufactured.
30
+ 6. A missing or stale execution plan selects [plan.md](plan.md). Incomplete plan
31
+ work, invalidated implementation evidence or an observed provider lifecycle
32
+ fact lacking exact readback selects [implement.md](implement.md).
33
+ 7. Completed implementation needing Code Review selects [review.md](review.md).
34
+ Accepted repair follows that same transition authority's Focused Repair
35
+ Validation and risk-triggered second-pass rules. Passing ordinary focused
36
+ checks proceed without automatically reopening Code Review.
37
+ 8. Remaining docs-affecting work selects [docs-ingest.md](docs-ingest.md), otherwise
38
+ [closeout.md](closeout.md). A fresh completed closeout needs no repeated mutation.
39
+
40
+ Read only the selected phase. Each exit emits the common Phase Result. Full
41
+ Delivery re-enters here; other modes stop at the requested boundary. An unclear
42
+ goal blocks with the exact missing authority rather than inferred scope.
43
+
44
+ Same-goal revision, resume, rebase, commit, retry and handoff preserve review
45
+ lineage and historical counts. Only an explicitly new delivery goal with new
46
+ accepted bounds establishes a new lineage; read-time legacy normalization never
47
+ resets valid report identities or ordinals.
@@ -30,3 +30,7 @@ Then stop or re-enter `delivery-phase` for routing.
30
30
 
31
31
  This completion state satisfies the downstream spec gate. Do not add a spec
32
32
  review or approval stop unless the user explicitly requested a HITL checkpoint.
33
+
34
+ Emit the [common Phase Result](../references/context-continuity.md#common-phase-result)
35
+ with pointers to this completion evidence. Continue only in Full Delivery;
36
+ otherwise stop at the requested boundary.
@@ -4,10 +4,16 @@ Use this reference when deciding whether a phase is complete enough to skip.
4
4
 
5
5
  ## Spec Complete
6
6
 
7
- - `SPEC.md` exists and matches the requested goal.
7
+ - A matching agent-ready `SPEC.md` has `readiness: agent-ready`; its scope is
8
+ current, complete and consistent with the requested goal.
9
+ - Verified remote retention proves the retained ref contains the exact spec commit
10
+ and the verified immutable blob URL resolves that commit/path with bytes matching
11
+ the current SPEC identity. A stored URL or local file alone is insufficient.
8
12
  - Scope includes required tracker children, acceptance criteria, constraints,
9
13
  and non-goals.
10
- - Open questions are parked, resolved, or explicitly blocking.
14
+ - Required unresolved questions or missing, stale or contradictory authority
15
+ prevent completion. Agent-ready compiler output needs no additional spec
16
+ approval or review gate.
11
17
 
12
18
  ## Plan Complete
13
19
 
@@ -18,16 +24,19 @@ Use this reference when deciding whether a phase is complete enough to skip.
18
24
  each `Tn` is the execution identity, provider identity slots are `not_applicable`,
19
25
  relation mode is `unprojected`, a nonempty sync-skip reason is present, and
20
26
  `depends_on` names plan `Tn` identities.
21
- - Tasks have owned paths, validation gates, and wave boundaries.
27
+ - Tasks have Active Write Scopes, Read Dependencies, Shared Runtime Resources,
28
+ Relevant Input Set identities, validation gates and wave boundaries.
22
29
  - Each wave contains every currently unblocked task with a disjoint write scope;
23
30
  one-task waves are justified by dependencies or ownership.
24
31
 
25
32
  ## Backlog Projection Complete
26
33
 
27
- - Projection evidence names the immutable spec URL, provider destination, exact
34
+ - The current Write Backlog result names the verified immutable spec URL and
35
+ identity, provider destination, exact
28
36
  Epic and Story identities, provider Task IDs and URLs, same `V*`, native
29
37
  blocker edges, and verified observed state.
30
- - Evidence matches the current spec; otherwise the projection is stale.
38
+ - Exact provider readback and projection evidence match the current retained
39
+ specification identity and provider state; otherwise the projection is stale.
31
40
 
32
41
  ## Implementation Complete
33
42
 
@@ -42,14 +51,17 @@ Use this reference when deciding whether a phase is complete enough to skip.
42
51
 
43
52
  ## Review Complete
44
53
 
45
- - A fresh immutable report matches the delivery lineage, accepted bounds,
46
- normalized target, governing source hashes, and latest implementation state.
54
+ - An immutable report matches the delivery lineage, accepted bounds and frozen
55
+ reviewed target/source identities. Unchanged implementation retains fresh proof;
56
+ subsequent accepted repair requires the evidence specified by the review
57
+ transition below rather than an automatic replacement report.
47
58
  - Its commit exists on a verified retained ref; a local report alone is pending.
48
59
  - The highest valid retained ordinal is authoritative and the handoff
49
60
  `review_count` is its reconciled projection.
50
61
  - Findings are routed by stable ids. Review itself entered no repair state.
51
- - After fix 3, `clean_handoff` supersedes the normal fresh-review requirement
52
- and links report 3, final changes, focused validation, and clean status.
62
+ - Accepted repair follows [review transition](../phases/review.md): retain Focused
63
+ Repair Validation and affected Verification evidence; preserve historical report
64
+ identities and ordinals during read-time normalization.
53
65
 
54
66
  ## Debug Complete
55
67
 
@@ -0,0 +1,109 @@
1
+ # Delivery Context Continuity
2
+
3
+ Use this contract at delivery entry and after each Phase Result. Durable sources
4
+ remain authoritative; routing is native-harness reasoning, not a runtime service.
5
+
6
+ ## Select instructions and validate pointers
7
+
8
+ 1. Keep project facts and hard ownership/authority boundaries always loaded.
9
+ 2. Load the selected workflow contract required by the current action. Load an
10
+ optional technique only when its named trigger applies; retain its pointer
11
+ until then. Record selected instruction-surface Context Pointers, identities
12
+ and freshness in the packet's `context_pointers` and `evidence_freshness`.
13
+ Do not assemble all skills or phase bodies at entry.
14
+ 3. Resolve only the Context Pointers needed for that action. Each pointer has
15
+ `authority_kind`, `locator`, optional `selector`, `identity` (content digest,
16
+ revision or observed state identity), and `freshness_rule` checked by its
17
+ consumer. A timestamp alone is not semantic freshness.
18
+ 4. A missing, stale, malformed or ambiguous pointer stops its dependent action.
19
+ The parent may perform exactly one bounded refresh of the named authority
20
+ for that resolution episode. Continue only after proving exactly one current
21
+ identity. Otherwise emit `blocked`, naming the exact pointer and missing
22
+ proof. Never choose a near match, infer missing content or copy a broad
23
+ authority set. A retry with unchanged evidence cannot restart the refresh
24
+ allowance; a new authoritative observation defines a new resolution episode.
25
+
26
+ Completion: every required pointer resolves uniquely and its consumer checked
27
+ freshness, or the dependent action is blocked with retained resolution evidence.
28
+
29
+ ## Warm or cold route
30
+
31
+ Only Full Delivery carries a continuing Delivery Context Packet in memory.
32
+ Warm routing requires the same native task, delivery goal, accepted bounds,
33
+ next-action authority, branch/base/target and fresh required evidence. Compare
34
+ identities before action, including each affected Relevant Input Set: declared
35
+ Read Dependencies and Shared Runtime Resources as well as Active Write Scopes.
36
+
37
+ A new task, Delivery Handoff, changed bounds or required authority, inconsistent
38
+ Git target, stale evidence or unresolved contradiction cold-routes before further
39
+ action. Discard the packet and resolve current named authorities from durable
40
+ pointers. Invalidate only affected evidence and eligibility; independent work
41
+ with matching inputs remains eligible. Route affected task proof back to the
42
+ parent's [execution gates](../../../agnostic/planning/implement-spec/references/parallel-orchestration.md)
43
+ before dependent release or finalization. This adds no lock or execution engine.
44
+
45
+ On cold resume, read durable mutation receipts and provider readback before any
46
+ retry. Reuse matching complete proof; perform only the unproven remainder.
47
+ Never duplicate a repository or provider mutation already proven complete.
48
+
49
+ Completion: record `warm` or `cold`, the identity comparison and exact invalidated
50
+ proof behind an evidence pointer; the next action has current authority.
51
+
52
+ ## Disposable Delivery Context Packet
53
+
54
+ Carry only `delivery_goal_identity`, `accepted_bounds_identity`, authoritative
55
+ `context_pointers`, `git_identity` (branch/base/target), `phase`, `next_action`,
56
+ `active_identity` (Task or review), `evidence_freshness`, `blocker` and
57
+ `stop_condition`. Explicit `none` is valid for an absent active identity or
58
+ blocker. Create it from resolved authority; update it only through Phase Results.
59
+
60
+ Each optional Derived Context Excerpt contains only bounded action-relevant
61
+ content or rationale, with a source Context Pointer, source identity, freshness
62
+ rule and explicit `non_authoritative: true`. Its source always wins. Full
63
+ artifact/report/skill bodies, command logs, unsourced excerpts and unbounded
64
+ narrative fail contract validation. A missing required identity, pointer,
65
+ freshness, blocker or stop field also fails closed before action.
66
+
67
+ The packet is disposable: never write it into a Delivery Handoff or other durable
68
+ artifact. A packet is not a receipt, plan, report or acceptance record.
69
+
70
+ ## Common Phase Result
71
+
72
+ Every phase emits this compact envelope, including failure, no-op and human stops:
73
+
74
+ ```text
75
+ phase:
76
+ outcome: complete | blocked | failed | skipped | human_steering_required
77
+ authority_or_evidence_created: Context Pointer[]
78
+ changed_facts: bounded delta (explicit none when unchanged)
79
+ invalidated_evidence: Context Pointer[] (explicit none when unchanged)
80
+ next_eligible_phase: phase or none
81
+ blocker_or_stop_reason: exact reason or explicit none
82
+ context_pointers: only those needed next
83
+ ```
84
+
85
+ Validate all fields before consuming the result. Pointer entries obey the
86
+ pointer contract above; required delta and stop fields cannot be omitted.
87
+ Keep phase-specific state, logs and detailed rationale in pointed durable
88
+ artifacts. `failed` records an attempted action's observed failure; `blocked`
89
+ records unavailable required proof or prerequisite. `skipped` requires an exact
90
+ no-op reason. `human_steering_required` points to the retained handback outcome.
91
+ A Phase Result neither accepts a Task nor replaces its Task Gate.
92
+
93
+ Full Delivery updates its packet and re-enters the router. Direct phase, explicit
94
+ HITL checkpoint, standalone review, narrow resume and closeout invocations emit
95
+ one Phase Result and stop at the requested boundary. Resume intent alone does
96
+ not grant Full Delivery continuation.
97
+
98
+ ## Legacy cold reconstruction
99
+
100
+ For a legacy plan, notes, handoff or retained report, derive the current compact
101
+ projection at read time. Preserve every historical byte, valid report identity
102
+ and ordinal. Resolve goal/bounds, Git target, next action and evidence from the
103
+ legacy artifact's named durable authorities, not absent guessed fields. Keep
104
+ unknowns explicit. Unreconstructable required authority returns `blocked` with
105
+ the exact artifact pointer and missing proof. Only new writes use the compact
106
+ contracts; normalization never bulk-migrates history or resets review lineage.
107
+
108
+ Completion: before/after legacy digests match, recovered report identities and
109
+ ordinals match, and all required projected authority is proven or exactly blocked.
@@ -0,0 +1,27 @@
1
+ # Failure and Repair Continuity
2
+
3
+ Use when a Task fails, a Task Gate requests repair, diagnosis advances, or work
4
+ crosses accepted bounds. The parent consumes the authoritative
5
+ [Task Result](../../../agnostic/planning/implement-spec/references/parallel-worker-brief.md)
6
+ and [Task Gate / Execution Frontier](../../../agnostic/planning/implement-spec/references/parallel-orchestration.md)
7
+ contracts; these remain the sole owners of worker returns and gate outcomes.
8
+
9
+ 1. Retain the failed Task identity, latest result/gate evidence and dependent
10
+ chain. Block only that chain; recompute independent eligibility through the
11
+ execution owner. Preserve failed or repair-required Active Write Scope until
12
+ the parent proves the old worker stopped and cleanup completed, or transfers
13
+ it to exactly one scoped repair worker. An unproven transfer blocks reuse.
14
+ 2. Before another scoped repair, identify new actionable evidence from the latest
15
+ Task Result or Task Gate and the exact change it justifies. Bounded authorized
16
+ diagnosis may continue while it can distinguish named hypotheses and produce
17
+ Diagnostic Evidence. Record the observation and discriminating result before
18
+ retrying; repeating the same repair is not new evidence.
19
+ 3. Stagnant repair, required scope redesign, weaker gates, changed requirements,
20
+ missing access or a human decision routes to [handback](../phases/handback.md).
21
+ Keep accepted bounds and scope custody intact while steering is required.
22
+ 4. Retain the resulting phase-specific state behind a pointer and emit the common
23
+ [Phase Result](context-continuity.md#common-phase-result). Resume checks current
24
+ authority and mutation proof before doing any remaining work.
25
+
26
+ Completion: dependent blocking, independent progress, scope custody, new evidence
27
+ or exact human boundary and next action are recoverable from durable pointers.