@punks/cli 2.1.10 → 2.1.11

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 (40) hide show
  1. package/dist/data/catalog/packs.ts +8 -1
  2. package/dist/data/catalog/skills.ts +8 -0
  3. package/dist/data/scripts/sync-subagents.mjs +34 -1
  4. package/dist/index.js +151 -42
  5. package/dist/skills/agnostic/generic/handoff/SKILL.md +15 -0
  6. package/dist/skills/agnostic/planning/create-plan/SKILL.md +7 -6
  7. package/dist/skills/agnostic/planning/create-plan/references/plan-schema.md +20 -0
  8. package/dist/skills/agnostic/planning/create-plan/references/tdd-phase.md +23 -1
  9. package/dist/skills/agnostic/planning/create-spec/SKILL.md +11 -10
  10. package/dist/skills/agnostic/planning/implement-spec/SKILL.md +2 -2
  11. package/dist/skills/agnostic/planning/implement-spec/references/lifecycle.md +7 -1
  12. package/dist/skills/agnostic/planning/implement-spec/references/parallel-worker-brief.md +15 -8
  13. package/dist/skills/agnostic/planning/implement-spec/references/sequential.md +8 -3
  14. package/dist/skills/agnostic/quality/tdd/SKILL.md +31 -0
  15. package/dist/skills/agnostic/requirements/requirements-grill/SKILL.md +1 -0
  16. package/dist/skills/phases/bug-discovery-phase/REFERENCE.md +30 -0
  17. package/dist/skills/phases/bug-discovery-phase/SKILL.md +8 -1
  18. package/dist/skills/phases/debugging-phase/SKILL.md +1 -0
  19. package/dist/skills/phases/delivery-phase/SKILL.md +33 -70
  20. package/dist/skills/phases/delivery-phase/phases/closeout.md +33 -0
  21. package/dist/skills/phases/delivery-phase/phases/debug.md +30 -0
  22. package/dist/skills/phases/delivery-phase/phases/docs-ingest.md +27 -0
  23. package/dist/skills/phases/delivery-phase/phases/implement.md +30 -0
  24. package/dist/skills/phases/delivery-phase/phases/plan.md +27 -0
  25. package/dist/skills/phases/delivery-phase/phases/review.md +29 -0
  26. package/dist/skills/phases/delivery-phase/phases/router.md +46 -0
  27. package/dist/skills/phases/delivery-phase/phases/spec.md +26 -0
  28. package/dist/skills/phases/delivery-phase/references/artifact-state.md +42 -0
  29. package/dist/skills/phases/delivery-phase/references/phase-handoff.md +25 -0
  30. package/dist/skills/phases/docs-ingest-phase/SKILL.md +28 -78
  31. package/dist/skills/phases/docs-ingest-phase/agents/openai.yaml +2 -2
  32. package/dist/skills/phases/docs-ingest-phase/phases/private-internal.md +57 -0
  33. package/dist/skills/phases/docs-ingest-phase/phases/public-docs.md +52 -0
  34. package/dist/skills/phases/docs-ingest-phase/phases/router.md +42 -0
  35. package/dist/skills/phases/docs-ingest-phase/references/learning-artifacts.md +96 -0
  36. package/dist/skills/phases/docs-ingest-phase/references/public-docs.md +8 -0
  37. package/dist/skills/phases/requirements-phase/SKILL.md +1 -0
  38. package/dist/skills/phases/review-phase/SKILL.md +2 -0
  39. package/package.json +1 -1
  40. package/dist/skills/agnostic/docs/upstream/mattpocock-writing-skills.md +0 -41
@@ -25,7 +25,7 @@ Use `$agent-browser` when any task `review_mode` is `browser` or `mixed`.
25
25
 
26
26
  When `implement-spec` runs in `sequential` mode, it must follow [references/sequential.md](references/sequential.md).
27
27
 
28
- That means `implement-spec` itself owns orchestration and validation, while exactly one implementation worker owns the sequential coding loop. This keeps the parent context small and adds a parent review gate after worker handoff.
28
+ That means `implement-spec` itself owns orchestration and validation, while exactly one implementation worker owns the sequential coding loop. This is a hard gate: do not implement in the parent main thread when worker execution is unavailable. Stop, repair worker routing, or report the blocker.
29
29
 
30
30
  ## Parallel responsibilities
31
31
 
@@ -88,7 +88,7 @@ Choose `parallel` when:
88
88
  - the plan contains independent waves
89
89
  - disjoint write scopes make worker fan-out safe
90
90
 
91
- If the user already chose a mode, honor it. If not, choose `sequential` and state that it uses one implementation worker plus parent validation.
91
+ If the user already chose a mode, honor it. If not, choose `sequential` and state that it spawns exactly one implementation worker plus parent validation.
92
92
 
93
93
  ## Advanced features
94
94
 
@@ -92,8 +92,13 @@ Do not create the file when nothing durable must survive the run.
92
92
  - Mode is manual. The chosen approach decides the execution path.
93
93
  - Do not switch modes mid-run unless the user explicitly redirects.
94
94
  - Default to `sequential` when the user does not choose a mode.
95
- - In `sequential`, keep implementation work inside one worker; the parent coordinates, reviews, validates, and finalizes.
95
+ - In `sequential`, keep implementation work inside exactly one worker; the parent coordinates, reviews, validates, and finalizes.
96
+ - If worker execution is unavailable, stop and repair worker routing or report the blocker. Do not implement in the parent main thread.
96
97
  - Treat every `tdd_target` as required RED-first behavior, never optional guidance.
98
+ - Treat `tdd_status`, `red_command`, `expected_red_failure`, `green_command`, `reason_not_testable`, `red_evidence`, and `green_evidence` as the task completion contract.
99
+ - For behavior-changing tasks, do not mark a task complete until real RED and GREEN evidence is recorded in `PLAN.md`.
100
+ - Accept missing RED/GREEN evidence only when the task has an explicit `reason_not_testable` or `tdd_status: not_applicable`.
101
+ - Do not accept `reason_not_testable` for forgotten RED. If code came first, recover by writing the public-result RED test, recording failure, patching to pass, and marking `tdd_status: recovered`.
97
102
  - Treat every `review_mode` as required validation routing, never optional metadata.
98
103
  - Keep an operator-visible execution board in the conversation so progress is obvious.
99
104
  - Keep scope discipline. Out-of-scope findings that do not affect the current implementation go to `IMPLEMENTATION-NOTES.md`, not silent scope creep.
@@ -110,6 +115,7 @@ After each completed task or wave:
110
115
  - update `PLAN.md` status
111
116
  - append a concise execution log in `PLAN.md`
112
117
  - record touched files in `PLAN.md`
118
+ - fill `red_evidence` and `green_evidence`, or the accepted non-testable reason, before marking behavior-changing work complete
113
119
  - update `IMPLEMENTATION-NOTES.md` with non-obvious decisions, surprises, or deviations
114
120
  - resolve any in-goal debt before advancing
115
121
  - update the spec-linked tech-debt file only for blocked or explicitly parked debt with exact owner/next action
@@ -16,6 +16,11 @@ Every worker brief should include:
16
16
  - acceptance criteria
17
17
  - validation contract
18
18
  - `tdd_target`
19
+ - `tdd_status`
20
+ - `red_command`
21
+ - `expected_red_failure`
22
+ - `green_command`
23
+ - `reason_not_testable`
19
24
  - `review_mode`
20
25
  - relevant risks or constraints from the plan
21
26
 
@@ -27,14 +32,16 @@ Each worker brief should require:
27
32
  2. reading all relevant files first, then doing targeted codebase research before editing
28
33
  3. starting from `tdd_target` and driving the task RED first when it is testable
29
34
  4. capturing failing evidence for the expected behavior gap before implementation
30
- 5. recording an explicit `reason_not_testable` plus exact alternative verification when the task is not a good TDD candidate
31
- 6. treating RED-phase tests or the approved non-testable verification plan as the implementation contract
32
- 7. not weakening or removing tests unless requirements changed
33
- 8. implementing only the assigned task scope and satisfying all acceptance criteria
34
- 9. running the exact task validation evidence before returning, plus extra plan validation when feasible
35
- 10. resolving any in-goal debt immediately instead of leaving TODOs, temporary workarounds, or "later" notes
36
- 11. stopping for parent clarification when a debt item requires a product/scope decision outside the assigned task
37
- 12. updating the plan entry with status, log, touched files, and gotchas before handoff closes
35
+ 5. recording `red_evidence` and `green_evidence` in the plan before marking behavior-changing tasks complete
36
+ 6. recovering code-before-RED by writing the intended public-result RED test and marking `tdd_status: recovered`, not by using `reason_not_testable`
37
+ 7. recording an explicit `reason_not_testable` plus exact alternative verification when the task is not a good TDD candidate
38
+ 8. treating RED-phase tests or the approved non-testable verification plan as the implementation contract
39
+ 9. not weakening or removing tests unless requirements changed
40
+ 10. implementing only the assigned task scope and satisfying all acceptance criteria
41
+ 11. running the exact task validation evidence before returning, plus extra plan validation when feasible
42
+ 12. resolving any in-goal debt immediately instead of leaving TODOs, temporary workarounds, or "later" notes
43
+ 13. stopping for parent clarification when a debt item requires a product/scope decision outside the assigned task
44
+ 14. updating the plan entry with status, log, touched files, and gotchas before handoff closes
38
45
 
39
46
  ## Worker output contract
40
47
 
@@ -8,6 +8,8 @@ Use this approach when execution should stay serial while avoiding main-context
8
8
  - **Worker policy:** spawn exactly one implementation worker
9
9
  - **Execution board:** completed, in progress, next, blocked
10
10
 
11
+ Hard gate: sequential implementation never runs in the parent main thread. If the worker cannot be spawned or routed, stop and repair the worker guard or report the blocker.
12
+
11
13
  ## Quick start
12
14
 
13
15
  1. Load the shared lifecycle from `lifecycle.md`.
@@ -23,9 +25,12 @@ Use this approach when execution should stay serial while avoiding main-context
23
25
  The worker owns this loop for every task:
24
26
 
25
27
  1. start from `tdd_target`
26
- 2. validate through the task's public interface
27
- 3. run the task-level validation gate before marking it done
28
- 4. update the execution board before advancing
28
+ 2. classify `tdd_status` and honor the task's RED/GREEN contract
29
+ 3. for behavior-changing work, run `red_command`, verify `expected_red_failure`, and record `red_evidence` before production edits
30
+ 4. patch only enough production code to pass the public behavior
31
+ 5. run `green_command`, record `green_evidence`, and only then mark the task done
32
+ 6. for non-testable or non-applicable tasks, record `reason_not_testable` plus the exact alternative verification
33
+ 7. update the execution board before advancing
29
34
 
30
35
  The parent owns:
31
36
 
@@ -7,6 +7,33 @@ description: Test-driven development with red-green-refactor loop. Use when user
7
7
 
8
8
  ## Philosophy
9
9
 
10
+ ## Hard Law
11
+
12
+ **No production code before RED.** For behavior-changing work, write a failing test through a public interface before editing production code.
13
+
14
+ This applies to features, bugfixes, risky refactors, and any production-code edit that changes observable behavior.
15
+
16
+ Allowed escapes:
17
+
18
+ - docs-only changes
19
+ - formatting-only changes
20
+ - generated-code-only changes
21
+ - config-only changes where no runtime behavior is asserted
22
+ - scaffold/bookkeeping-only changes
23
+ - truly non-testable work with an explicit `reason_not_testable`
24
+
25
+ `reason_not_testable` cannot cover forgotten RED.
26
+
27
+ If production code was written first:
28
+
29
+ 1. Stop advancing the slice.
30
+ 2. Write the RED test that proves the actual intended public result.
31
+ 3. Run it and record real failure evidence.
32
+ 4. Patch production code only enough to make that test pass.
33
+ 5. Record the task as `tdd_status: recovered`.
34
+
35
+ If the current code already passes the new test, do not fake RED. Isolate the pre-fix state or revert enough of the slice to observe the failure. If true RED cannot be reconstructed, record the deviation explicitly; do not call the task normally RED/GREEN compliant.
36
+
10
37
  **Core principle**: Tests should verify behavior through public interfaces, not implementation details. Code can change entirely; tests shouldn't.
11
38
 
12
39
  **Good tests** are integration-style: they exercise real code paths through public APIs. They describe _what_ the system does, not _how_ it does it. A good test reads like a specification - "user can checkout with valid cart" tells you exactly what capability exists. These tests survive refactors because they don't care about internal structure.
@@ -46,12 +73,14 @@ RIGHT (vertical):
46
73
 
47
74
  Before writing any code:
48
75
 
76
+ - [ ] Decide whether the work is behavior-changing and therefore `tdd_status: required`
49
77
  - [ ] Confirm with user what interface changes are needed
50
78
  - [ ] Confirm with user which behaviors to test (prioritize)
51
79
  - [ ] Identify opportunities for [deep modules](deep-modules.md) (small interface, deep implementation)
52
80
  - [ ] Design interfaces for [testability](interface-design.md)
53
81
  - [ ] List the behaviors to test (not implementation steps)
54
82
  - [ ] Get user approval on the plan
83
+ - [ ] Record `red_command`, `expected_red_failure`, and `green_command` in the plan before implementation starts
55
84
 
56
85
  Ask: "What should the public interface look like? Which behaviors are most important to test?"
57
86
 
@@ -80,9 +109,11 @@ GREEN: Minimal code to pass → passes
80
109
  Rules:
81
110
 
82
111
  - One test at a time
112
+ - Run and read RED before production code
83
113
  - Only enough code to pass current test
84
114
  - Don't anticipate future tests
85
115
  - Keep tests focused on observable behavior
116
+ - Record `red_evidence` and `green_evidence` before claiming completion
86
117
 
87
118
  ### 4. Refactor
88
119
 
@@ -30,6 +30,7 @@ Both workflows can happen in one long session, but keep the responsibilities dis
30
30
  - Ask one question at a time by default.
31
31
  - For every question, provide a recommended answer and the reason for it.
32
32
  - Inspect code/docs first when the answer can be found locally.
33
+ - Inspect relevant routed learning artifacts before grilling requirements that depend on known behavior, prior bugs, project conventions, or domain facts.
33
34
  - Challenge conflicting glossary, vague terms, and hidden tradeoffs immediately.
34
35
  - Pin canonical terms, rejected aliases, relationships, and domain axioms as decisions crystallize.
35
36
  - Prefer conservative defaults once enough context exists.
@@ -107,6 +107,35 @@ branch relevance, runtime-debugging need, false-positive candidacy, resolution
107
107
  candidacy, deferral, or blockers. Use ClawPatch statuses only where they match
108
108
  the tool's supported values. Do not claim runtime truth from ClawPatch alone.
109
109
 
110
+ ## Scoring And Routing
111
+
112
+ Before recommending the next action, rank every important finding with a `0-10`
113
+ score, higher first. Use the score to explain priority, not to imply runtime
114
+ proof.
115
+
116
+ Include this rationale for each scored finding:
117
+
118
+ - severity and confidence from ClawPatch, if available
119
+ - whether `clawpatch next` selected or deprioritized it
120
+ - branch relevance to the current checkout, diff, release, PR, or user goal
121
+ - evidence freshness: current report, stale ledger, revalidated, or user-provided
122
+ - current user pain: active runtime symptom, broken workflow, CI failure, or none
123
+ - evidence type: static-only, runtime-suspected, or runtime-proven by external
124
+ evidence
125
+ - recommended route: `$bug-resolution-phase`, `$debugging-phase`, docs/debt
126
+ handling, false-positive triage/revalidation, or stop
127
+
128
+ Suggested policy:
129
+
130
+ - `8-10`: branch-relevant, high severity/confidence, fresh evidence, or matches
131
+ current user pain. Route to `$bug-resolution-phase` if the fix target is clear;
132
+ route to `$debugging-phase` if runtime proof is missing but needed.
133
+ - `5-7`: plausible and relevant, but confidence, freshness, or impact is mixed.
134
+ Inspect more, revalidate, or defer to docs/debt handling when it is not a bug
135
+ to fix now.
136
+ - `0-4`: stale, low-confidence, not branch-relevant, duplicate, or likely false
137
+ positive. Triage/revalidate if useful; otherwise stop.
138
+
110
139
  ## No-Mutation Boundary
111
140
 
112
141
  Never run these by default in `bug-discovery-phase`:
@@ -131,6 +160,7 @@ The final report must include:
131
160
  - provider, model, scope, `--limit`, `--jobs`, report path, and dirty posture
132
161
  - command list and whether each command completed
133
162
  - relevant finding IDs, status, severity if available, and why they matter
163
+ - score/rationale for each important finding before the recommended next action
134
164
  - explicit statement: ClawPatch findings are static-review candidates, not
135
165
  proven runtime root causes
136
166
  - next recommended phase for each important finding:
@@ -61,7 +61,13 @@ and the full output checklist.
61
61
  Markdown reports; for JSON, run `clawpatch report --json > <path>` because
62
62
  `--output` writes Markdown. Use `show`, `next`, `triage`, `status`, or
63
63
  `revalidate` only for inspection and classification.
64
- 7. **Stop before mutation.** Do not run `fix --finding` or `open-pr` unless the
64
+ 7. **Score before recommending.** After report, `next`, and finding inspection,
65
+ assign each important finding a `0-10` rank score with rationale. Weigh
66
+ severity, confidence, `clawpatch next` priority, branch relevance, evidence
67
+ freshness, current user pain or runtime symptoms, and whether evidence is
68
+ static-only or runtime-proven. Then route to `$bug-resolution-phase`,
69
+ `$debugging-phase`, docs/debt handling, false-positive triage, or stop.
70
+ 8. **Stop before mutation.** Do not run `fix --finding` or `open-pr` unless the
65
71
  user gives a new explicit resolution request.
66
72
 
67
73
  ## Output Contract
@@ -72,6 +78,7 @@ Return:
72
78
  - report path and durable ClawPatch ledger/state path
73
79
  - commands run and validation status
74
80
  - relevant finding IDs, statuses, and branch relevance
81
+ - finding rank score and rationale before the recommended next action
75
82
  - warning that findings are static-review candidates, not proven runtime root
76
83
  causes
77
84
  - next action: inspect selected finding, enter `$bug-resolution-phase`, enter
@@ -38,6 +38,7 @@ description: >-
38
38
  1. **Classify entry.**
39
39
  - Standalone: record the broken behavior, artifact links/paths, reproduction command or manual scenario, expected behavior, and observed behavior.
40
40
  - Delivery-internal: cite the validation or review failure that triggered debugging and the delivery scope it belongs to.
41
+ - Scan relevant routed learning artifacts for prior bugs, known edge cases, prevention notes, or domain behavior before forming hypotheses.
41
42
  2. **Set bounds.**
42
43
  - Define owned files, systems, and scenarios.
43
44
  - For delivery-internal debugging, patch only inside the active delivery scope.
@@ -1,87 +1,50 @@
1
1
  ---
2
2
  name: delivery-phase
3
- description: Goal-compatible workhorse wrapper for scoped execution from specification through delivery closeout. Use when a user asks to deliver a scoped goal end to end, especially when work should flow through create-spec, create-plan, implement-spec, review, optional debugging, and docs-ingest-phase.
3
+ description: Routes a scoped delivery goal to the next lifecycle phase from current artifacts and evidence. Use when delivering, resuming, or closing a goal that may pass through spec, plan, implementation, review, debugging, docs ingest, and closeout.
4
4
  ---
5
5
 
6
6
  # Delivery Phase
7
7
 
8
- `delivery-phase` owns scoped execution until the goal is either done or honestly
9
- blocked. It preserves the workflow chain instead of compressing implementation
10
- into a single coding pass.
8
+ ## Quick Start
11
9
 
12
- ## Use When
10
+ `delivery-phase` is a reusable phase router.
13
11
 
14
- - The user asks to deliver, execute, finish, close, or carry a scoped goal end to end.
15
- - A goal needs spec, plan, implementation, review, validation, and docs handling in one wrapper.
16
- - Existing `SPEC.md` or `PLAN.md` artifacts may be reused, but delivery still needs closeout.
17
- - The user chooses `parallel: true` or `parallel: false` for implementation mode.
12
+ 1. Read [phases/router.md](phases/router.md).
13
+ 2. Inspect only enough issue, spec, plan, notes, diff, review, validation, and docs state to choose the current gate.
14
+ 3. Load exactly one phase file from `phases/`.
15
+ 4. Complete that phase, write the phase outcome, then stop or re-enter `delivery-phase` to route again.
18
16
 
19
- ## Do Not Use When
17
+ Completion of one phase does not imply loading the rest of the chain.
20
18
 
21
- - The request is only requirements discovery, planning, review, debugging, or docs ingest.
22
- - The scope is too vague to name a goal, issue, spec folder, or bounded change.
23
- - The user explicitly asks not to code or wants a plan/spec only.
24
- - Runtime evidence points to a broad bug outside the active delivery scope; create a separate debugging or debt goal.
19
+ ## Entry Modes
25
20
 
26
- ## Contract
21
+ - **Full delivery:** user asks to deliver a bounded goal end to end.
22
+ - **Resume:** user returns after manual spec, plan, implementation, review, debugging, or docs work.
23
+ - **HITL checkpoint:** user wants one phase handled, then a stop for discussion or approval.
24
+ - **Closeout:** user asks to finish evidence, docs, stack, tracker, or PR state after the work is already done.
27
25
 
28
- - **Role:** public scoped-delivery orchestrator
29
- - **Wraps:** `$create-spec` -> `$create-plan` -> `$implement-spec` -> `$review-phase` -> optional `$debugging-phase` -> `$docs-ingest-phase`
30
- - **Owns:** goal bounds, mode choice, validation, review follow-through, docs ingest outcome, debt capture, blocker reporting
31
- - **Stop condition:** implemented, reviewed, validated, docs ingest handled, debt captured, or concrete blocker reported
26
+ ## Phase Files
32
27
 
33
- ## Workflow
28
+ - [phases/router.md](phases/router.md): choose the next phase from artifacts and evidence.
29
+ - [phases/spec.md](phases/spec.md): create or repair the reviewed spec.
30
+ - [phases/plan.md](phases/plan.md): create or repair the execution-ready plan.
31
+ - [phases/implement.md](phases/implement.md): execute the accepted plan.
32
+ - [phases/review.md](phases/review.md): run mandatory review and classify findings.
33
+ - [phases/debug.md](phases/debug.md): investigate runtime-evidence failures.
34
+ - [phases/docs-ingest.md](phases/docs-ingest.md): ingest docs-affecting changes or record a no-op.
35
+ - [phases/closeout.md](phases/closeout.md): finish stack, tracker, PR, validation, and final report state.
34
36
 
35
- 1. **Frame the delivery goal.**
36
- - Identify the bounded goal, issue, spec folder, branch, and ownership constraints.
37
- - State assumptions, known artifacts, and the validation surface.
38
- - If scope is ambiguous, ask before entering the chain.
39
- 2. **Create or reuse the spec.**
40
- - If no reviewed `SPEC.md` exists, run `$create-spec`.
41
- - If a spec exists, verify it matches the requested scope before continuing.
42
- 3. **Create or reuse the plan.**
43
- - If no execution-ready `PLAN.md` exists, run `$create-plan`.
44
- - If a plan exists, verify dependencies, validation gates, assigned skills, and review mode.
45
- 4. **Implement the plan.**
46
- - Run `$implement-spec` with the selected `parallel: true|false` mode.
47
- - Keep implementation inside the delivery scope and update required notes/debt artifacts.
48
- 5. **Review every coding run.**
49
- - Run `$review-phase` after `implement-spec` even when tests pass.
50
- - Fix in-scope blocking findings before final closeout.
51
- 6. **Debug only runtime-evidence failures.**
52
- - Run `$debugging-phase` only when validation or review produces runtime evidence of a bug.
53
- - Patch only inside delivery scope.
54
- - If the bug is broader, capture tech debt or open a separate debugging/debt goal.
55
- 7. **Run docs ingest.**
56
- - Run `$docs-ingest-phase` when implementation changed product behavior, architecture, setup, operator workflow, docs contracts, or spec domain knowledge.
57
- - If docs ingest is not needed, record the explicit no-op reason in the final report or delivery notes.
58
- 8. **Check stack cleanliness.**
59
- - Whenever a PR exists, run `stack status` and `stack sync --dry-run`.
60
- - If the PR is stack-dependent and dry-run reports pending changes, run `stack sync` before closeout.
61
- - Missing `stack` blocks stack-dependent closeout, but not independent trunk-based work.
62
- 9. **Close out.**
63
- - Report implementation, review result, validation, docs ingest outcome, debt captured, and remaining blockers.
37
+ ## Router Rules
64
38
 
65
- ## Mode And Parallel Rules
39
+ - Do not read phase files other than `router.md` until the router selects them.
40
+ - Do not activate child skills at delivery start.
41
+ - Reuse fresh matching artifacts before loading creation skills.
42
+ - A phase may delegate to `create-spec`, `create-plan`, `implement-spec`, `review-phase`, `debugging-phase`, `docs-ingest-phase`, or `stack` only from its own phase file.
43
+ - After a phase completes, write enough state for future resume. See [references/phase-handoff.md](references/phase-handoff.md).
66
44
 
67
- - Preserve `parallel: true|false` through `$implement-spec`.
68
- - If the user chose a mode, honor it.
69
- - If not, choose the smallest safe mode:
70
- - `parallel: false` for tightly coupled work, unclear ownership, or small changes.
71
- - `parallel: true` only when the plan has independent waves and disjoint write scopes.
72
- - Do not let parallel workers expand the delivery scope.
73
- - Optional `$debugging-phase` may use parallel readonly hypothesis research, but speculative parallel fixes are not allowed.
45
+ ## Stop Conditions
74
46
 
75
- ## Output Contract
76
-
77
- Return a concise delivery report with:
78
-
79
- - **Goal:** scoped outcome delivered or blocker encountered
80
- - **Mode:** `parallel: true|false` and why
81
- - **Artifacts:** spec, plan, implementation notes, debt, docs, or tracker links touched
82
- - **Review:** mandatory `$review-phase` result and remaining findings
83
- - **Debugging:** skipped with reason, or `$debugging-phase` evidence and result
84
- - **Validation:** commands, browser checks, smoke tests, or manual scenarios run
85
- - **Stack:** `stack status` / `stack sync --dry-run` result when a PR exists, plus whether `stack sync` ran
86
- - **Docs ingest:** `$docs-ingest-phase` run, or explicit no-op reason
87
- - **Exit:** done, blocked, or split into follow-up debt/debugging goal
47
+ - Selected phase completed and resumable state was written.
48
+ - User requested a HITL checkpoint before the next phase.
49
+ - Router reaches closeout and final evidence is reported.
50
+ - Scope is ambiguous, stale, contradictory, or blocked by missing access.
@@ -0,0 +1,33 @@
1
+ # Closeout Phase
2
+
3
+ Use this phase when spec, plan, implementation, review, debugging if needed,
4
+ docs ingest or no-op, and validation are complete.
5
+
6
+ ## Checks
7
+
8
+ - Summarize goal outcome and remaining blockers.
9
+ - Report phase path actually taken; do not imply skipped phases ran.
10
+ - Report validation commands, browser checks, smoke tests, or manual scenarios.
11
+ - Report review result and whether findings remain.
12
+ - Report debugging result or explicit skip reason.
13
+ - Report docs ingest result or explicit no-op reason.
14
+ - When a PR exists, run `stack status` and `stack sync --dry-run`.
15
+ - If the PR is stack-dependent and dry-run reports pending changes, run
16
+ `stack sync` before closeout.
17
+ - Missing `stack` blocks stack-dependent closeout, but not independent
18
+ trunk-based work.
19
+
20
+ ## Output
21
+
22
+ Return a concise delivery report with:
23
+
24
+ - goal
25
+ - current phase state
26
+ - artifacts touched
27
+ - validation
28
+ - review
29
+ - debugging
30
+ - docs ingest
31
+ - stack
32
+ - tracker or PR state
33
+ - exit: done, blocked, or split into follow-up
@@ -0,0 +1,30 @@
1
+ # Debug Phase
2
+
3
+ Use this phase only when validation or review produced runtime evidence of a
4
+ bug inside the active delivery scope.
5
+
6
+ ## Delegate
7
+
8
+ Load `debugging-phase` only after this phase is selected.
9
+
10
+ ## Rules
11
+
12
+ - Do not use debugging as a normal delivery-start dependency.
13
+ - Start from concrete runtime evidence: failing command, log, browser state,
14
+ trace, reproduction, or review finding.
15
+ - Readonly parallel hypothesis research is allowed.
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.
19
+
20
+ ## Completion State
21
+
22
+ Write or verify:
23
+
24
+ - runtime evidence
25
+ - root cause or narrowed hypothesis
26
+ - fix or explicit blocker
27
+ - rerun validation
28
+ - whether another review is required
29
+
30
+ Then stop or re-enter `delivery-phase` for routing.
@@ -0,0 +1,27 @@
1
+ # Docs Ingest Phase
2
+
3
+ Use this phase when the delivered change affects product behavior,
4
+ architecture, setup, operator workflow, docs contracts, or spec domain
5
+ knowledge.
6
+
7
+ ## Delegate
8
+
9
+ Load `docs-ingest-phase` only after this phase is selected.
10
+
11
+ ## Checks Before Delegating
12
+
13
+ - Verify implementation and review are complete enough to document current truth.
14
+ - Classify docs target: public docs, private/project docs, root docs, runbook,
15
+ wiki navigation, or explicit no-op.
16
+ - Do not document speculative future behavior as current truth.
17
+
18
+ ## Completion State
19
+
20
+ Write or verify:
21
+
22
+ - docs pages, metadata, runbooks, or explicit no-op reason
23
+ - validation commands for docs changes
24
+ - source spec/change referenced by docs
25
+ - any follow-up docs debt
26
+
27
+ Then stop or re-enter `delivery-phase` for routing.
@@ -0,0 +1,30 @@
1
+ # Implement Phase
2
+
3
+ Use this phase when an accepted plan exists and implementation work remains, or
4
+ when review returned in-scope non-runtime blockers.
5
+
6
+ ## Delegate
7
+
8
+ Load `implement-spec` only after this phase is selected.
9
+
10
+ ## Rules
11
+
12
+ - Preserve the plan's `parallel: true` or `parallel: false` mode.
13
+ - If no mode exists, choose the smallest safe mode:
14
+ - `parallel: false` for coupled or small changes.
15
+ - `parallel: true` only for independent waves with disjoint write scopes.
16
+ - Keep changes inside the active delivery scope.
17
+ - Parent orchestration owns shared notes and final validation evidence.
18
+ - If runtime evidence appears during validation, finish the phase handoff and route to debug.
19
+
20
+ ## Completion State
21
+
22
+ Write or verify:
23
+
24
+ - implementation notes or equivalent evidence
25
+ - files changed and plan tasks completed
26
+ - validation commands and results
27
+ - remaining blockers or follow-up debt
28
+ - whether mandatory review is now needed
29
+
30
+ Then stop or re-enter `delivery-phase` for routing.
@@ -0,0 +1,27 @@
1
+ # Plan Phase
2
+
3
+ Use this phase when a matching spec exists but no execution-ready `PLAN.md`
4
+ exists, or the plan is stale, vague, or missing validation gates.
5
+
6
+ ## Delegate
7
+
8
+ Load `create-plan` only after this phase is selected.
9
+
10
+ ## Checks Before Delegating
11
+
12
+ - Verify the spec still matches the requested goal.
13
+ - Preserve tracker hierarchy and every child-story or sub-issue requirement.
14
+ - Require owned paths, dependencies, execution order, validation gates, and review mode.
15
+ - Choose sequential or parallel implementation mode from the plan shape.
16
+
17
+ ## Completion State
18
+
19
+ Write or verify:
20
+
21
+ - execution-ready `PLAN.md`
22
+ - phase/wave boundaries
23
+ - validation commands or manual scenarios
24
+ - mode choice: `parallel: true` or `parallel: false`
25
+ - planned review and docs-ingest expectations
26
+
27
+ Then stop or re-enter `delivery-phase` for routing.
@@ -0,0 +1,29 @@
1
+ # Review Phase
2
+
3
+ Use this phase after implementation or when delivery resumes with an unreviewed
4
+ diff, branch, PR, or implementation artifact.
5
+
6
+ ## Delegate
7
+
8
+ Load `review-phase` only after this phase is selected.
9
+
10
+ ## Rules
11
+
12
+ - Review is mandatory even when tests pass.
13
+ - Review remains findings-first and readonly unless the called review skill says otherwise.
14
+ - Classify findings before routing:
15
+ - No blocking findings: route to docs ingest or closeout.
16
+ - In-scope non-runtime blockers: route back to implement.
17
+ - Runtime evidence: route to debug.
18
+ - Broad scope or architecture debt: capture follow-up debt instead of expanding delivery.
19
+
20
+ ## Completion State
21
+
22
+ Write or verify:
23
+
24
+ - review command or process used
25
+ - findings and severity
26
+ - accepted no-op reason if no findings
27
+ - next route decision and why
28
+
29
+ Then stop or re-enter `delivery-phase` for routing.
@@ -0,0 +1,46 @@
1
+ # Router Phase
2
+
3
+ Use this file to choose the next delivery phase. Do not read other phase files
4
+ until this router selects one.
5
+
6
+ ## Inputs To Inspect
7
+
8
+ - User request and explicit mode: full delivery, resume, HITL checkpoint, or closeout.
9
+ - Tracker item, issue, PR, branch, or spec folder named by the user.
10
+ - Existing `SPEC.md`, `PLAN.md`, implementation notes, review output, debug evidence, docs ingest notes, stack state, and validation evidence.
11
+ - Relevant repo guidance only when needed to identify ownership or validation surface.
12
+
13
+ ## Routing Order
14
+
15
+ 1. If goal bounds are unclear, stop and ask one concrete question.
16
+ 2. If no reviewed matching spec exists, load [spec.md](spec.md).
17
+ 3. If the spec exists but is stale, contradictory, or missing required child-story scope, load [spec.md](spec.md).
18
+ 4. If no execution-ready matching plan exists, load [plan.md](plan.md).
19
+ 5. If the plan exists but lacks dependencies, validation gates, owned paths, or mode choice, load [plan.md](plan.md).
20
+ 6. If accepted plan work is incomplete, load [implement.md](implement.md).
21
+ 7. If implementation exists but mandatory review is missing or stale, load [review.md](review.md).
22
+ 8. If review found in-scope non-runtime blockers, route back to [implement.md](implement.md).
23
+ 9. If validation or review produced runtime evidence, load [debug.md](debug.md).
24
+ 10. If docs-affecting changes exist and ingest is missing, load [docs-ingest.md](docs-ingest.md).
25
+ 11. Otherwise load [closeout.md](closeout.md).
26
+
27
+ ## HITL Behavior
28
+
29
+ When the user asks for manual control, route only the requested phase and stop
30
+ after writing its phase handoff. Do not continue to the next phase in the same
31
+ turn unless the user explicitly asks.
32
+
33
+ ## Resume Behavior
34
+
35
+ Assume earlier phases may have been completed manually through their direct
36
+ skills. Verify artifact freshness; do not re-run a phase only because
37
+ `delivery-phase` did not run it.
38
+
39
+ ## Output
40
+
41
+ Report:
42
+
43
+ - selected phase
44
+ - evidence that selected it
45
+ - child skill or phase file to load next
46
+ - blocker question if no phase can be selected safely
@@ -0,0 +1,26 @@
1
+ # Spec Phase
2
+
3
+ Use this phase when no reviewed matching `SPEC.md` exists, or the current spec is
4
+ stale, contradictory, or missing required scope.
5
+
6
+ ## Delegate
7
+
8
+ Load `create-spec` only after this phase is selected.
9
+
10
+ ## Checks Before Delegating
11
+
12
+ - Confirm the bounded goal, issue, tracker item, or requested capability.
13
+ - Reuse existing spec artifacts when they match the requested scope.
14
+ - Treat child stories, sub-issues, acceptance criteria, constraints, and non-goals as required input, not loose references.
15
+ - If requirements are still unsettled, stop and route to requirements work instead of inventing scope.
16
+
17
+ ## Completion State
18
+
19
+ Write or verify:
20
+
21
+ - matching `SPEC.md`
22
+ - review status or explicit human approval state
23
+ - unresolved questions, if any
24
+ - source issue/tracker/spec folder
25
+
26
+ Then stop or re-enter `delivery-phase` for routing.