@punks/cli 3.3.3 → 3.3.4

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 (75) hide show
  1. package/AGENTS.md +1 -0
  2. package/dist/BASELINE_CHANGELOG.md +3 -1
  3. package/dist/CHANGELOG.md +7 -1
  4. package/dist/baseline/scaffold-baseline/baseline.json +5 -5
  5. package/dist/baseline/scaffold-baseline/data/catalog/packs.json +2 -1
  6. package/dist/baseline/scaffold-baseline/data/catalog/skills.json +16 -0
  7. package/dist/baseline/scaffold-baseline/skills/agnostic/docs/write-graph-based-skills/AUTHORING-HANDOFF.md +12 -0
  8. package/dist/baseline/scaffold-baseline/skills/agnostic/docs/write-graph-based-skills/SKILL.md +84 -0
  9. package/dist/baseline/scaffold-baseline/skills/agnostic/docs/write-graph-based-skills/agents/openai.yaml +4 -0
  10. package/dist/baseline/scaffold-baseline/skills/agnostic/docs/write-graph-based-skills/phases/audit.md +33 -0
  11. package/dist/baseline/scaffold-baseline/skills/agnostic/docs/write-graph-based-skills/phases/define-authority.md +26 -0
  12. package/dist/baseline/scaffold-baseline/skills/agnostic/docs/write-graph-based-skills/phases/define-handoffs.md +34 -0
  13. package/dist/baseline/scaffold-baseline/skills/agnostic/docs/write-graph-based-skills/phases/model-state.md +30 -0
  14. package/dist/baseline/scaffold-baseline/skills/agnostic/docs/write-graph-based-skills/phases/qualify.md +27 -0
  15. package/dist/baseline/scaffold-baseline/skills/agnostic/docs/write-graph-based-skills/phases/router.md +36 -0
  16. package/dist/baseline/scaffold-baseline/skills/agnostic/docs/write-graph-based-skills/phases/test-routes.md +33 -0
  17. package/dist/baseline/scaffold-baseline/skills/agnostic/docs/write-graph-based-skills/phases/verify-disclosure.md +28 -0
  18. package/dist/baseline/scaffold-baseline/skills/agnostic/docs/write-graph-based-skills/phases/write-phases.md +33 -0
  19. package/dist/baseline/scaffold-baseline/skills/agnostic/docs/write-graph-based-skills/phases/write-router.md +30 -0
  20. package/dist/baseline/scaffold-baseline/skills/agnostic/docs/write-graph-based-skills/references/authoring-contract.md +226 -0
  21. package/dist/baseline/scaffold-baseline/skills/agnostic/generic/handback/SKILL.md +27 -0
  22. package/dist/baseline/scaffold-baseline/skills/agnostic/quality/autoreview/SKILL.md +9 -4
  23. package/dist/baseline/scaffold-baseline/skills/phases/debugging-phase/SKILL.md +6 -5
  24. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/SKILL.md +5 -1
  25. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/phases/debug.md +2 -2
  26. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/phases/handback.md +23 -0
  27. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/phases/implement.md +2 -0
  28. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/phases/review.md +6 -4
  29. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/phases/router.md +25 -19
  30. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/references/phase-handoff.md +6 -2
  31. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/phases/return-route.md +14 -9
  32. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/phases/router.md +15 -13
  33. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/phases/run-review.md +3 -2
  34. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/references/durable-report.md +15 -12
  35. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/references/runtime-handoff.md +2 -2
  36. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/references/state-graph.md +5 -1
  37. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/scripts/review-contract.mjs +15 -4
  38. package/dist/baseline/scaffold-baseline.json +5 -5
  39. package/dist/baseline/scaffold-baseline.tgz +0 -0
  40. package/dist/data/AGENTS.md +1 -0
  41. package/dist/data/shared-agents.md +113 -0
  42. package/dist/index.js +15 -9
  43. package/dist/skills/agnostic/docs/write-graph-based-skills/AUTHORING-HANDOFF.md +12 -0
  44. package/dist/skills/agnostic/docs/write-graph-based-skills/SKILL.md +84 -0
  45. package/dist/skills/agnostic/docs/write-graph-based-skills/agents/openai.yaml +4 -0
  46. package/dist/skills/agnostic/docs/write-graph-based-skills/phases/audit.md +33 -0
  47. package/dist/skills/agnostic/docs/write-graph-based-skills/phases/define-authority.md +26 -0
  48. package/dist/skills/agnostic/docs/write-graph-based-skills/phases/define-handoffs.md +34 -0
  49. package/dist/skills/agnostic/docs/write-graph-based-skills/phases/model-state.md +30 -0
  50. package/dist/skills/agnostic/docs/write-graph-based-skills/phases/qualify.md +27 -0
  51. package/dist/skills/agnostic/docs/write-graph-based-skills/phases/router.md +36 -0
  52. package/dist/skills/agnostic/docs/write-graph-based-skills/phases/test-routes.md +33 -0
  53. package/dist/skills/agnostic/docs/write-graph-based-skills/phases/verify-disclosure.md +28 -0
  54. package/dist/skills/agnostic/docs/write-graph-based-skills/phases/write-phases.md +33 -0
  55. package/dist/skills/agnostic/docs/write-graph-based-skills/phases/write-router.md +30 -0
  56. package/dist/skills/agnostic/docs/write-graph-based-skills/references/authoring-contract.md +211 -0
  57. package/dist/skills/agnostic/generic/handback/SKILL.md +27 -0
  58. package/dist/skills/agnostic/quality/autoreview/SKILL.md +9 -4
  59. package/dist/skills/frameworks/nestjs/nestjs-best-practices/.gitignore +29 -0
  60. package/dist/skills/phases/debugging-phase/SKILL.md +6 -5
  61. package/dist/skills/phases/delivery-phase/SKILL.md +5 -1
  62. package/dist/skills/phases/delivery-phase/phases/debug.md +2 -2
  63. package/dist/skills/phases/delivery-phase/phases/handback.md +23 -0
  64. package/dist/skills/phases/delivery-phase/phases/implement.md +2 -0
  65. package/dist/skills/phases/delivery-phase/phases/review.md +6 -4
  66. package/dist/skills/phases/delivery-phase/phases/router.md +23 -17
  67. package/dist/skills/phases/delivery-phase/references/phase-handoff.md +6 -2
  68. package/dist/skills/phases/review-phase/phases/return-route.md +14 -9
  69. package/dist/skills/phases/review-phase/phases/router.md +15 -13
  70. package/dist/skills/phases/review-phase/phases/run-review.md +3 -2
  71. package/dist/skills/phases/review-phase/references/durable-report.md +10 -8
  72. package/dist/skills/phases/review-phase/references/runtime-handoff.md +2 -2
  73. package/dist/skills/phases/review-phase/references/state-graph.md +5 -1
  74. package/dist/skills/phases/review-phase/scripts/review-contract.mjs +2 -0
  75. package/package.json +9 -52
@@ -22,9 +22,12 @@ Use when:
22
22
  - Read dependency docs/source/types when the finding depends on external behavior.
23
23
  - Reject unrealistic edge cases, speculative risks, broad rewrites, and fixes that over-complicate the codebase.
24
24
  - Prefer small fixes at the right ownership boundary; no refactor unless it clearly improves the bug class.
25
- - Outside `review-phase`, keep going until structured review returns no
26
- accepted/actionable findings. If a review-triggered fix changes code, rerun
27
- focused tests and the structured review helper.
25
+ - Outside `review-phase`, run the structured review helper exactly once. Verify
26
+ candidates, fix only accepted findings inside the accepted goal, and run
27
+ focused tests for changed code. End this invocation without rerunning the
28
+ helper. A further direct pass requires formal `$review-phase` or a new
29
+ explicit user instruction after this result.
30
+ - When a finding triggers `$handback`, invoke it before any expanded repair.
28
31
  - For security-audit suppression changes, verify accepted findings remain auditable: suppressed findings stay in structured output, active output keeps an unsuppressible suppression notice, and aggregate findings cannot hide unrelated active risk.
29
32
  - Never switch or override the requested review engine/model. If the review hits model capacity, retry the same command a few times with the same engine/model.
30
33
  - Be patient with large bundles. Structured review can take up to 30 minutes while the model call is active, especially with Codex tools or web search.
@@ -109,7 +112,9 @@ Format first if formatting can change line locations. Then it is OK to run tests
109
112
  scripts/autoreview --parallel-tests "<focused test command>"
110
113
  ```
111
114
 
112
- Tradeoff: tests may force code changes that stale the review. If tests or review lead to code edits, rerun the affected tests and rerun review until no accepted/actionable findings remain. Once that rerun exits cleanly, stop; do not spend another long review cycle on redundant confirmation.
115
+ Tradeoff: tests may force code changes that stale the review. If tests or review
116
+ lead to code edits, rerun the affected tests, then apply the direct-call
117
+ contract above.
113
118
 
114
119
  ## Review Panels
115
120
 
@@ -0,0 +1,29 @@
1
+ # Dependencies
2
+ node_modules/
3
+
4
+ # Website (lives on docs branch)
5
+ website/
6
+
7
+ # Build outputs
8
+ dist/
9
+ *.js
10
+ *.d.ts
11
+ *.js.map
12
+
13
+ # IDE
14
+ .idea/
15
+ .vscode/
16
+ *.swp
17
+ *.swo
18
+
19
+ # OS
20
+ .DS_Store
21
+ Thumbs.db
22
+
23
+ # Logs
24
+ *.log
25
+ npm-debug.log*
26
+
27
+ # Environment
28
+ .env
29
+ .env.local
@@ -17,7 +17,7 @@ description: >-
17
17
  - **Delivery-internal inputs:** `implement-spec` validation failure or `review-phase` runtime failure
18
18
  - **Wraps:** `$verify-behavior`, `$debug-agent`, optional readonly `$parallel-research`, bounded fixes, focused tests or scenario reruns, review
19
19
  - **Owns:** evidence matrices, cited log references, hypothesis status, fix verification
20
- - **Exit conditions:** bug fixed, concrete blocker proven, or scope proven to require a spec/delivery goal
20
+ - **Exit conditions:** bug fixed, concrete blocker proven, or `human_steering_required`
21
21
 
22
22
  ## Use When
23
23
 
@@ -30,7 +30,7 @@ description: >-
30
30
 
31
31
  - The work is pure planning, requirements discovery, or design.
32
32
  - The failure is already proven and only needs implementation inside an active spec plan.
33
- - The fix would require broad product scope, architecture, or acceptance changes; exit to `create-spec`, `create-plan`, or a delivery goal instead.
33
+ - The next action triggers `$handback`; return human steering instead.
34
34
  - The request is only static code review with no runtime symptom.
35
35
 
36
36
  ## Workflow
@@ -42,7 +42,7 @@ description: >-
42
42
  2. **Set bounds.**
43
43
  - Define owned files, systems, and scenarios.
44
44
  - For delivery-internal debugging, patch only inside the active delivery scope.
45
- - If the evidence points outside that scope, record debt or open a separate debugging/debt goal.
45
+ - When the next action triggers `$handback`, invoke it and stop.
46
46
  3. **Reproduce visible behavior.**
47
47
  - Before forming hypotheses or starting fix work, run `$verify-behavior` in
48
48
  `reproduce` mode when the reported behavior is visibly exercisable.
@@ -71,7 +71,7 @@ description: >-
71
71
  8. **Exit.**
72
72
  - Fixed: report cause, patch, verification, and residual risk.
73
73
  - Blocked: report the concrete blocker and the missing artifact/access/action.
74
- - Out of scope: report why this needs a spec/delivery goal or debt issue.
74
+ - Human steering: return the durable `$handback` outcome and stop.
75
75
 
76
76
  ## Parallel Rules
77
77
 
@@ -83,6 +83,7 @@ description: >-
83
83
  - Never let parallel workers make speculative fixes against unproven hypotheses.
84
84
  - Merge worker findings into one evidence matrix before deciding on a patch.
85
85
  - In delivery-internal mode, parallel workers must stay inside the delivery scope unless assigned readonly investigation.
86
+ - A `$handback` trigger ends fix delegation.
86
87
 
87
88
  ## Output Contract
88
89
 
@@ -94,4 +95,4 @@ Return a concise debugging report with:
94
95
  - **Root cause:** confirmed cause or why none is proven
95
96
  - **Changes:** bounded patch summary, or none if blocked/out of scope
96
97
  - **Verification:** commands/scenarios rerun and result
97
- - **Exit:** fixed, blocked, or escalated to spec/delivery/debt
98
+ - **Exit:** fixed, blocked, or `human_steering_required`
@@ -17,7 +17,7 @@ disable-model-invocation: true
17
17
  4. Load exactly one phase file from `phases/`.
18
18
  5. Complete that phase and write its outcome. Full delivery re-enters routing immediately; other modes stop at their selected boundary.
19
19
 
20
- Full delivery grants its selected inner steps the authority needed to reach closeout. Progressive loading still exposes one phase at a time.
20
+ Within accepted bounds, full delivery grants its selected inner steps the authority needed to reach closeout. Progressive loading still exposes one phase at a time.
21
21
 
22
22
  ## Entry Modes
23
23
 
@@ -36,6 +36,7 @@ Full delivery grants its selected inner steps the authority needed to reach clos
36
36
  - [phases/review.md](phases/review.md): prepare the explicit review handoff or
37
37
  classify findings from a retained report.
38
38
  - [phases/debug.md](phases/debug.md): investigate runtime-evidence failures.
39
+ - [phases/handback.md](phases/handback.md): return a scope or authority boundary for human steering.
39
40
  - [phases/docs-ingest.md](phases/docs-ingest.md): ingest docs-affecting changes or record a no-op.
40
41
  - [phases/closeout.md](phases/closeout.md): finish tracker, PR, validation, and final report state.
41
42
 
@@ -52,9 +53,12 @@ Full delivery grants its selected inner steps the authority needed to reach clos
52
53
  - After a phase completes, write enough state for future resume. Review-triggered
53
54
  repair uses the idempotent fields in
54
55
  [references/phase-handoff.md](references/phase-handoff.md).
56
+ - Boundary evidence selects [handback.md](phases/handback.md). Persistence
57
+ remains autonomous only inside accepted bounds.
55
58
 
56
59
  ## Stop Conditions
57
60
 
58
61
  - User explicitly requested a HITL checkpoint or one-phase mode and its resumable state was written.
59
62
  - Router reaches closeout and final evidence is reported.
60
63
  - Scope is ambiguous, stale, contradictory, or blocked by missing access.
64
+ - `human_steering_required` is durable while the `$handback` authority guard fails.
@@ -14,8 +14,8 @@ Load `debugging-phase` only after this phase is selected.
14
14
  trace, reproduction, or review finding.
15
15
  - Readonly parallel hypothesis research is allowed.
16
16
  - Speculative parallel fixes are not allowed.
17
- - If the bug is broader than delivery scope, capture debt or open a separate
18
- debugging goal.
17
+ - When current evidence triggers `$handback`, return it to the router without
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
21
  - After an ordinary fix with `review_count < 3`, stale the preceding report and
@@ -0,0 +1,23 @@
1
+ # Handback Phase
2
+
3
+ ## Guard
4
+
5
+ The router selected current evidence that triggers `$handback`.
6
+
7
+ ## Bounded Action
8
+
9
+ 1. Invoke `$handback` with the active delivery evidence.
10
+ 2. Persist its complete outcome as `human_steering_required` in the delivery
11
+ handoff.
12
+ 3. Stop.
13
+
14
+ ## Completion Evidence
15
+
16
+ - the durable `$handback` outcome
17
+ - unchanged accepted bounds and in-bounds artifacts
18
+ - no expanded design, implementation, delegation, or review
19
+
20
+ ## Exit
21
+
22
+ Return terminal `human_steering_required`. Resume routing only after the
23
+ `$handback` authority guard passes.
@@ -15,6 +15,8 @@ Load `implement-spec` only after this phase is selected.
15
15
  - Use a one-worker wave only when dependencies or ownership leave one task
16
16
  unblocked.
17
17
  - Keep changes inside the active delivery scope.
18
+ - When current evidence triggers `$handback`, return it to the router without
19
+ expanding worker ownership.
18
20
  - Parent orchestration owns shared notes and final validation evidence.
19
21
  - For UI work, require `implement-spec` to carry durable before/after links through `UI Evidence Links`; use `repo-asset-management` only through that evidence contract.
20
22
  - If runtime evidence appears during validation, finish the phase handoff and route to debug.
@@ -33,14 +33,16 @@ After the retained report establishes the completed ordinal:
33
33
  1. Recompute aggregate routing from every finding's validated `return_route`
34
34
  with the review contract helper. Reject a mismatch with the retained routing
35
35
  object.
36
- 2. When `secondary_architecture_follow_up` is true, enter `debt_follow_up`
36
+ 2. For primary `human_steering_required`, preserve the returned `$handback`
37
+ outcome and stop. It never opens a repair state.
38
+ 3. When `secondary_architecture_follow_up` is true, enter `debt_follow_up`
37
39
  first and persist the primary `debugging` or `implementation` route as
38
40
  `post_debt_route`.
39
- 3. Without secondary debt, `debugging` opens debugging and `implementation`
41
+ 4. Without secondary debt, `debugging` opens debugging and `implementation`
40
42
  opens implementation.
41
- 4. Primary `debt_follow_up` enters debt capture with `post_debt_route` set to
43
+ 5. Primary `debt_follow_up` enters debt capture with `post_debt_route` set to
42
44
  `docs_ingest` when documentation remains, otherwise `closeout`.
43
- 5. `docs_ingest` enters docs ingest. `closeout` enters closeout.
45
+ 6. `docs_ingest` enters docs ingest. `closeout` enters closeout.
44
46
 
45
47
  Architecture debt may remain a secondary follow-up beside debugging or
46
48
  implementation. Open its repair only after debt capture. Opening either repair
@@ -13,51 +13,54 @@ state take precedence over inferred artifact order.
13
13
 
14
14
  ## Route
15
15
 
16
- 1. Stop on unclear goal bounds and ask one concrete question.
17
- 2. For durable `review_due`, load [review.md](review.md). It first validates
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
18
21
  accepted bounds and normalizes a supported target. A rejection enters
19
22
  `review_failed` even when a persisted counter is 3. Only after those checks
20
23
  may it recover `review_count` and evaluate the budget in memory. Exhaustion
21
24
  returns `review_budget_exhausted` with zero handoff or status writes. A count
22
25
  below 3 persists `review_due`. Full delivery activates `$review-phase` with
23
26
  that context; other modes return the exact explicit invocation context and stop.
24
- 3. For `report_retention_pending`, load [review.md](review.md) to resume
27
+ 5. For `report_retention_pending`, load [review.md](review.md) to resume
25
28
  `$review-phase` in full delivery or return its exact resume context in other
26
29
  modes. A fresh local report resumes without rerunning lenses. Stop on terminal
27
30
  `review_failed` with its exact evidence.
28
- 4. Otherwise recover review state by `review_lineage_id`: read the highest valid
31
+ 6. Otherwise recover review state by `review_lineage_id`: read the highest valid
29
32
  retained ordinal, reconcile the handoff `review_count` projection, then assess
30
33
  target and source freshness separately.
31
- 5. Route a fresh retained `review_routed` report through [review.md](review.md)
34
+ 7. Route a fresh retained `review_routed` report through [review.md](review.md)
32
35
  when no durable route handoff exists yet.
33
- 6. Resume an atomic handoff already in `debug_active` through [debug.md](debug.md)
36
+ 8. Resume an atomic handoff already in `debug_active` through [debug.md](debug.md)
34
37
  or `repair_active` through [implement.md](implement.md). A recorded
35
38
  `review_run_id` cannot increment `repair_count` again.
36
- 7. Resume `debt_follow_up` through [review.md](review.md). Its handler reuses or
39
+ 9. Resume `debt_follow_up` through [review.md](review.md). Its handler reuses or
37
40
  records the goal/spec-linked debt artifact, then follows durable
38
41
  `post_debt_route`: `debugging` or `implementation` for secondary debt;
39
42
  `docs_ingest` or `closeout` for primary debt. It never implements the debt.
40
- 8. Route `focused_validation` to its recorded implementation or debugging owner.
43
+ 10. Route `focused_validation` to its recorded implementation or debugging owner.
41
44
  Passing becomes `clean_handoff`; failure remains repair epoch 3.
42
- 9. Route `clean_handoff` to [docs-ingest.md](docs-ingest.md) when docs remain,
45
+ 11. Route `clean_handoff` to [docs-ingest.md](docs-ingest.md) when docs remain,
43
46
  otherwise [closeout.md](closeout.md).
44
- 10. For durable `docs_ingest`, load [docs-ingest.md](docs-ingest.md).
45
- 11. For durable `closeout`, load [closeout.md](closeout.md).
46
- 12. If no matching agent-ready `SPEC.md` exists, it is stale, contradictory, or
47
+ 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, it is stale, contradictory, or
47
50
  incomplete, or its remote retention or stable blob URL is missing or
48
51
  unverified, load [spec.md](spec.md).
49
- 13. If the verified post-spec backlog projection is missing or stale, load
52
+ 15. If the verified post-spec backlog projection is missing or stale, load
50
53
  [backlog.md](backlog.md).
51
- 14. If no execution-ready matching plan exists, or it lacks dependencies, owned
54
+ 16. If no execution-ready matching plan exists, or it lacks dependencies, owned
52
55
  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
56
+ 17. If accepted plan work is incomplete, load [implement.md](implement.md).
57
+ 18. If implementation exists and its retained review is missing or stale, load
55
58
  [review.md](review.md). That phase validates accepted bounds and normalizes a
56
59
  supported target before any delivery-budget evaluation, then returns either
57
60
  `review_failed`, `review_budget_exhausted`, or a valid `$review-phase`
58
61
  context. Full delivery consumes that context immediately; other modes
59
62
  return the exact explicit invocation context and stop.
60
- 17. Route remaining docs-affecting work to [docs-ingest.md](docs-ingest.md),
63
+ 19. Route remaining docs-affecting work to [docs-ingest.md](docs-ingest.md),
61
64
  otherwise [closeout.md](closeout.md).
62
65
 
63
66
  Only an explicitly new delivery goal with materially changed accepted bounds
@@ -71,6 +74,9 @@ delivery otherwise continues across ordinary in-bounds operations without
71
74
  confirmation. Earlier phases may have completed through direct skills; reuse
72
75
  fresh matching artifacts rather than rerunning them.
73
76
 
77
+ `human_steering_required` is a terminal boundary, not an optional HITL
78
+ checkpoint.
79
+
74
80
  ## Output
75
81
 
76
82
  Report the selected state and phase, the durable evidence that selected it, the
@@ -6,7 +6,7 @@ Each phase leaves enough durable state for resume without guessing.
6
6
 
7
7
  ```text
8
8
  Phase:
9
- Status: complete | blocked | skipped
9
+ Status: complete | blocked | skipped | human_steering_required
10
10
  Scope:
11
11
  Artifacts:
12
12
  Validation:
@@ -30,7 +30,7 @@ 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 | debt_follow_up | debug_active | repair_active | focused_validation | docs_ingest | closeout | clean_handoff | human_steering_required
34
34
  primary_route:
35
35
  secondary_architecture_follow_up:
36
36
  post_debt_route:
@@ -93,3 +93,7 @@ other modes return the context for explicit retry without rerunning lenses.
93
93
 
94
94
  After fix 3, `clean_handoff` is final authority. Link immutable review 3, final
95
95
  changes, the same passing focused validation, and clean status.
96
+
97
+ For `human_steering_required`, store the complete `$handback` outcome under
98
+ `Blockers`. Keep the state terminal until the `$handback` authority guard
99
+ passes.
@@ -33,27 +33,30 @@ debug, debt, documentation, or closeout work.
33
33
  immutable authority block inside those retained bytes.
34
34
  2. Pass the complete retained finding set to the public `deriveReviewRouting`
35
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`.
36
+ The helper applies `human_steering_required` > `debugging` >
37
+ `implementation` > `debt_follow_up` > `docs_ingest`; an empty set returns
38
+ `closeout`.
38
39
  3. Accept `secondary_architecture_follow_up` only when a `debt_follow_up`
39
40
  finding accompanies a higher-priority debugging or implementation route.
40
41
  4. Require the derived result to equal the retained report's `routing` object.
41
42
  A mismatch is invalid retained routing evidence and routes to
42
43
  `review_failed`.
43
- 5. Write returned routing evidence containing the immutable report identity,
44
- stable finding IDs, primary route, optional architecture follow-up, and
45
- validation summary. Delivery returns `review_routed`; standalone returns
44
+ 5. If the primary route is `human_steering_required`, invoke `$handback`, write
45
+ its durable outcome, and stop.
46
+ 6. Otherwise write returned routing evidence containing the immutable report
47
+ identity, stable finding IDs, primary route, optional architecture follow-up,
48
+ and validation summary. Delivery returns `review_routed`; standalone returns
46
49
  `review_complete`.
47
50
 
48
51
  ## Invariants
49
52
 
50
53
  - Findings and routing come strictly from the retained report. Current delivery
51
54
  state, caller preference, and later unreviewed changes cannot rerank them.
52
- - Runtime outranks implementation, which outranks debt, which outranks
53
- documentation or closeout.
55
+ - Human steering outranks runtime, implementation, debt, documentation, and
56
+ closeout.
54
57
  - The retained report and reviewed target remain readonly.
55
- - This gate writes routing evidence only. Delivery owns any later route
56
- mutation and every repair counter or active repair state.
58
+ - This gate writes routing or `$handback` evidence only. Delivery owns any later
59
+ route mutation and every repair counter or active repair state.
57
60
  - One return does not invoke review again, run validation again, create review
58
61
  4, or enter repair.
59
62
 
@@ -71,6 +74,8 @@ debug, debt, documentation, or closeout work.
71
74
  explicit delivery resume.
72
75
  - `review_complete`: standalone routing evidence is durable and review is
73
76
  complete.
77
+ - `human_steering_required`: the `$handback` outcome is durable and expanded
78
+ repair awaits that skill's authority guard.
74
79
  - `report_retention_pending`: retained containment or blob evidence became
75
80
  temporarily unverifiable; retry retention without rerunning lenses.
76
81
  - `review_due`: target, bounds, or governing sources are no longer fresh for
@@ -43,18 +43,19 @@ output.
43
43
 
44
44
  | Priority | Current evidence | Output |
45
45
  | --- | --- | --- |
46
- | 1 | Unsupported target, invalid accepted bounds, non-retryable contract or infrastructure failure, malformed active retention candidate, or `same_run_conflict` | terminal `review_failed` |
47
- | 2 | Delivery entry is otherwise valid, recovered `review_count >= 3`, and no already-started run has valid predecessor evidence | terminal `review_budget_exhausted` |
48
- | 3 | A repository-approved retained ref is required but cannot be derived and requires an operator decision | checkpoint `retained_ref_approval_required` |
49
- | 4 | Same-authority admissible evidence conflicts and no declared tie-break resolves it | blocked `review_state_conflict` |
50
- | 5 | Required explicit invocation context, accepted bounds, target evidence, or reconstructible lineage inputs are missing | blocked `review_context_blocked` |
51
- | 6 | The caller is in delivery-owned `debug_active`, `repair_active`, `debt_follow_up`, `docs_ingest`, `closeout`, `focused_validation`, or `clean_handoff` without fresh `review_due` evidence | blocked `review_not_due` |
52
- | 7 | A valid retained standalone report and durable returned routing output exist | terminal `review_complete` |
53
- | 8 | A valid retained delivery report and durable returned routing output exist | terminal `review_routed` |
54
- | 9 | Retention is verified and fresh, but its returned routing output is absent | [`return-route.md`](return-route.md) |
55
- | 10 | A complete fresh local report exists without unique verified retention, including a retryable retention failure | [`retain-report.md`](retain-report.md) |
56
- | 11 | Fresh `review_running` predecessor evidence exists without a complete local report | [`run-review.md`](run-review.md) |
57
- | 12 | Fresh `review_due` evidence exists, or mutation, partial-run, retryable failure, or stale target/source evidence invalidated later work | [`prepare-review.md`](prepare-review.md) |
46
+ | 1 | Durable `human_steering_required` while the `$handback` authority guard fails | terminal `human_steering_required` |
47
+ | 2 | Unsupported target, invalid accepted bounds, non-retryable contract or infrastructure failure, malformed active retention candidate, or `same_run_conflict` | terminal `review_failed` |
48
+ | 3 | Delivery entry is otherwise valid, recovered `review_count >= 3`, and no already-started run has valid predecessor evidence | terminal `review_budget_exhausted` |
49
+ | 4 | A repository-approved retained ref is required but cannot be derived and requires an operator decision | checkpoint `retained_ref_approval_required` |
50
+ | 5 | Same-authority admissible evidence conflicts and no declared tie-break resolves it | blocked `review_state_conflict` |
51
+ | 6 | Required explicit invocation context, accepted bounds, target evidence, or reconstructible lineage inputs are missing | blocked `review_context_blocked` |
52
+ | 7 | The caller is in delivery-owned `debug_active`, `repair_active`, `debt_follow_up`, `docs_ingest`, `closeout`, `focused_validation`, or `clean_handoff` without fresh `review_due` evidence | blocked `review_not_due` |
53
+ | 8 | A valid retained standalone report and durable returned routing output exist | terminal `review_complete` |
54
+ | 9 | A valid retained delivery report and durable returned routing output exist | terminal `review_routed` |
55
+ | 10 | Retention is verified and fresh, but its returned routing output is absent | [`return-route.md`](return-route.md) |
56
+ | 11 | A complete fresh local report exists without unique verified retention, including a retryable retention failure | [`retain-report.md`](retain-report.md) |
57
+ | 12 | Fresh `review_running` predecessor evidence exists without a complete local report | [`run-review.md`](run-review.md) |
58
+ | 13 | Fresh `review_due` evidence exists, or mutation, partial-run, retryable failure, or stale target/source evidence invalidated later work | [`prepare-review.md`](prepare-review.md) |
58
59
 
59
60
  ## State Coverage
60
61
 
@@ -67,7 +68,8 @@ output.
67
68
  - `review_routed` selects `return-route.md` until durable return evidence exists,
68
69
  then terminates as `review_complete` for standalone or `review_routed` for
69
70
  delivery.
70
- - `review_failed` and `review_budget_exhausted` are terminal router outcomes.
71
+ - `human_steering_required`, `review_failed`, and `review_budget_exhausted` are
72
+ terminal router outcomes.
71
73
  - Review-owned mutation or retryable partial-run evidence projects back to
72
74
  `review_due`; retryable fresh retention evidence remains
73
75
  `report_retention_pending`.
@@ -51,8 +51,9 @@ 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, action, and one explicit `return_route`: `human_steering_required`,
55
+ `debugging`, `implementation`, `debt_follow_up`, or `docs_ingest`. Use
56
+ `human_steering_required` when the repair triggers `$handback`.
56
57
  7. Run only the smallest safe readonly validation needed to verify candidates or
57
58
  governing acceptance evidence. Broader checks require explicit accepted spec
58
59
  or plan authority. Record missing required RED/GREEN evidence as a finding;
@@ -78,16 +78,18 @@ as null or not applicable.
78
78
  exactly the fields `id`, `lens`, `severity`, `location`, `impact`, `evidence`,
79
79
  `action`, and `return_route`. Finding IDs are unique, severity is `critical`,
80
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`.
81
+ has a finding. Each finding's `return_route` is exactly
82
+ `human_steering_required`, `debugging`, `implementation`, `debt_follow_up`, or
83
+ `docs_ingest`.
83
84
 
84
85
  `routing` has exactly `primary` and `secondary_architecture_follow_up`.
85
- `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
86
+ `primary` is `human_steering_required`, `debugging`, `implementation`,
87
+ `debt_follow_up`, `docs_ingest`, or `closeout`; the secondary flag is boolean.
88
+ Aggregate routing is derived by the public `deriveReviewRouting` helper from
89
+ the complete finding set. Precedence is
90
+ `human_steering_required` > `debugging` > `implementation` > `debt_follow_up`
91
+ > `docs_ingest`; an empty set derives `closeout`, and debt is secondary only
92
+ beside debugging or implementation. A supplied aggregate mismatch is invalid. `validation` is an
91
93
  array of records with exactly command, isolation mode, before/after frozen
92
94
  hashes, outcome, and evidence. Isolation is proven no-write, disposable
93
95
  checkout, or disposable snapshot. Retained validation records require equal
@@ -69,8 +69,8 @@ Resume identity:
69
69
 
70
70
  `Review state` is exactly one of `review_due`, `review_running`,
71
71
  `report_retention_pending`, `retained_ref_approval_required`,
72
- `review_context_blocked`, `review_routed`, `review_complete`, or
73
- `review_failed`. `Next suggested route` is optional advice represented by
72
+ `review_context_blocked`, `review_routed`, `review_complete`,
73
+ `human_steering_required`, or `review_failed`. `Next suggested route` is optional advice represented by
74
74
  `none` when absent and is always lowest authority. `attempt` starts at 1 for a
75
75
  run and increases by one for each new stateful record. Persist locators and
76
76
  hashes, not reconstructible raw target, source, report, validation, or finding
@@ -24,7 +24,8 @@ and clean handoff.
24
24
  | `report_retention_pending` | Retryable retention failure | Hashes fresh | Report writer | `report_retention_pending` | None | Exact retryable evidence; no authoritative pass |
25
25
  | `report_retention_pending` | Non-retryable retention failure | Retry cannot succeed | Report writer | `review_failed` | None | Exact terminal evidence; no authoritative pass |
26
26
  | `report_retention_pending` | Freshness changed | Target or source hash changed | `review-phase` | `review_due` | None | Stale local report; unchanged counters |
27
- | `review_routed` | Readonly return | Standalone | Standalone caller | `review_complete` | None | Retained report output and route |
27
+ | `review_routed` | Human steering route | Derived primary route is `human_steering_required` | `review-phase` | `human_steering_required` | None | Retained report plus durable `$handback` outcome |
28
+ | `review_routed` | Readonly return | Standalone; primary route is not `human_steering_required` | Standalone caller | `review_complete` | None | Retained report output and route |
28
29
  | `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
30
  | `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
31
  | `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 |
@@ -69,6 +70,9 @@ Review 1 may open fix 1, review 2 fix 2, and review 3 fix 3. Fix 3 never opens
69
70
  review 4. A failed focused validation stays in repair epoch 3 until that same
70
71
  validation passes.
71
72
 
73
+ `human_steering_required` opens no repair. It remains terminal until the
74
+ `$handback` authority guard passes.
75
+
72
76
  Same-goal bounds revisions preserve delivery lineage and counters. Resume,
73
77
  rebase, new commit, process retry, and handoff preserve them. Only an explicitly
74
78
  new delivery goal with materially changed accepted bounds creates a new lineage
@@ -187,6 +187,7 @@ const LENS_KEYS = [
187
187
  ];
188
188
  const PROTOTYPE_KEYS = new Set(["__proto__", "constructor", "prototype"]);
189
189
  const FINDING_ROUTES = [
190
+ "human_steering_required",
190
191
  "debugging",
191
192
  "implementation",
192
193
  "debt_follow_up",
@@ -571,6 +572,7 @@ const validateReportSemantics = (report, errors) => {
571
572
  if (
572
573
  !exactKeys(report.routing, ["primary", "secondary_architecture_follow_up"]) ||
573
574
  ![
575
+ "human_steering_required",
574
576
  "debugging",
575
577
  "implementation",
576
578
  "debt_follow_up",
package/package.json CHANGED
@@ -1,65 +1,22 @@
1
1
  {
2
2
  "name": "@punks/cli",
3
- "version": "3.3.3",
3
+ "version": "3.3.4",
4
4
  "description": "Harness Intelligence scaffolding CLI",
5
- "homepage": "https://github.com/wearedevpunks/harness-intelligence/tree/main/apps/cli#readme",
6
- "bugs": {
7
- "url": "https://github.com/wearedevpunks/harness-intelligence/issues"
5
+ "bin": {
6
+ "hi": "dist/index.js",
7
+ "hint": "dist/index.js"
8
8
  },
9
+ "type": "module",
10
+ "homepage": "https://github.com/wearedevpunks/harness-intelligence/tree/main/apps/cli#readme",
9
11
  "repository": {
10
12
  "type": "git",
11
13
  "url": "git+https://github.com/wearedevpunks/harness-intelligence.git",
12
14
  "directory": "apps/cli"
13
15
  },
14
- "bin": {
15
- "hi": "dist/index.js",
16
- "hint": "dist/index.js"
17
- },
18
- "files": [
19
- "dist",
20
- "README.md",
21
- "AGENTS.md"
22
- ],
23
- "type": "module",
24
- "scripts": {
25
- "build": "\"${HI_TEST_NODE_PATH:-node}\" ./scripts/build-dist.mjs",
26
- "baseline:build": "bun ./scripts/build-baseline.mjs",
27
- "baseline:publish": "node ./scripts/publish-baseline.mjs",
28
- "baseline:rollback": "node ./scripts/rollback-baseline.mjs",
29
- "check-types": "\"${HI_TEST_NODE_PATH:-node}\" --input-type=module -e \"await import(new URL('./bin/tsc', import.meta.resolve('@typescript/native/package.json')))\" -- tsc --noEmit",
30
- "dev": "bun run ./src/index.ts scaffold",
31
- "entrypoints": "bun ./scripts/print-entrypoints.mjs",
32
- "local": "bun run build && bun run ./dist/index.js",
33
- "release:authority": "cd ../.. && node ./apps/cli/scripts/run-release-authority.mjs",
34
- "release:candidate": "cd ../.. && node ./apps/cli/scripts/run-release-candidate.mjs",
35
- "release:classify": "cd ../.. && node ./apps/cli/scripts/classify-release-impact.mjs",
36
- "release:publish": "node ./scripts/release-dispatcher.mjs",
37
- "release:publish:beta": "NPM_TAG=beta node ./scripts/release-dispatcher.mjs",
38
- "release:publication": "cd ../.. && node ./apps/cli/scripts/run-release-publication.mjs",
39
- "sync:skills": "node ./scripts/sync-skills-repo.mjs",
40
- "test": "vitest run --config vitest.config.ts",
41
- "test:parallel": "vitest run --config vitest.config.ts --fileParallelism --maxWorkers=2",
42
- "ui:catalog": "bun ./scripts/run-renderer-catalog.mjs",
43
- "lint": "oxlint src scripts",
44
- "check": "bun run lint && oxfmt --check src scripts package.json tsconfig.json vitest.config.ts"
16
+ "bugs": {
17
+ "url": "https://github.com/wearedevpunks/harness-intelligence/issues"
45
18
  },
46
19
  "dependencies": {
47
20
  "react-devtools-core": "^6.1.5"
48
- },
49
- "devDependencies": {
50
- "@effect/eslint-plugin": "latest",
51
- "@effect/platform-bun": "catalog:",
52
- "@effect/vitest": "catalog:",
53
- "@oxlint/plugins": "latest",
54
- "@punks/contract": "workspace:*",
55
- "@punks/env": "workspace:*",
56
- "@punks/scaffold": "workspace:*",
57
- "@types/node": "catalog:",
58
- "effect": "catalog:",
59
- "oxlint": "latest",
60
- "typescript": "catalog:",
61
- "ultracite": "latest",
62
- "vitest": "catalog:"
63
- },
64
- "packageManager": "bun@1.3.5"
21
+ }
65
22
  }