@punks/cli 2.1.9 → 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 (63) hide show
  1. package/README.md +1 -1
  2. package/dist/data/catalog/hooks.ts +8 -0
  3. package/dist/data/catalog/packs.ts +11 -3
  4. package/dist/data/catalog/skills.ts +48 -0
  5. package/dist/data/catalog/tools.ts +9 -1
  6. package/dist/data/hooks/scaffold-update-check.mjs +181 -0
  7. package/dist/data/hooks.test.ts +17 -0
  8. package/dist/data/scripts/sync-subagents.mjs +104 -32
  9. package/dist/data/subagents/manifest.mjs +120 -0
  10. package/dist/index.js +600 -85
  11. package/dist/skills/agnostic/cli/dp-cli/SKILL.md +3 -3
  12. package/dist/skills/agnostic/cli/dp-cli/references/commands.md +1 -1
  13. package/dist/skills/agnostic/cli/dp-cli/references/post-command-flow.md +1 -1
  14. package/dist/skills/agnostic/docs/docs-onboarding/SKILL.md +46 -0
  15. package/dist/skills/agnostic/docs/docs-onboarding/agents/openai.yaml +4 -0
  16. package/dist/skills/agnostic/docs/docs-onboarding/references/artifact-contract.md +67 -0
  17. package/dist/skills/agnostic/docs/writing-beats/SKILL.md +69 -0
  18. package/dist/skills/agnostic/docs/writing-fragments/SKILL.md +76 -0
  19. package/dist/skills/agnostic/docs/writing-shape/SKILL.md +75 -0
  20. package/dist/skills/agnostic/generic/handoff/SKILL.md +15 -0
  21. package/dist/skills/agnostic/planning/create-plan/SKILL.md +24 -8
  22. package/dist/skills/agnostic/planning/create-plan/references/plan-schema.md +20 -0
  23. package/dist/skills/agnostic/planning/create-plan/references/planner-phase.md +1 -1
  24. package/dist/skills/agnostic/planning/create-plan/references/tdd-phase.md +23 -1
  25. package/dist/skills/agnostic/planning/create-spec/SKILL.md +63 -17
  26. package/dist/skills/agnostic/planning/create-spec/references/discovery.md +24 -16
  27. package/dist/skills/agnostic/planning/create-spec/references/folder-naming.md +6 -2
  28. package/dist/skills/agnostic/planning/create-spec/references/wiki-bookkeeping.md +29 -5
  29. package/dist/skills/agnostic/planning/implement-spec/SKILL.md +20 -2
  30. package/dist/skills/agnostic/planning/implement-spec/references/lifecycle.md +7 -1
  31. package/dist/skills/agnostic/planning/implement-spec/references/parallel-worker-brief.md +15 -8
  32. package/dist/skills/agnostic/planning/implement-spec/references/sequential.md +8 -3
  33. package/dist/skills/agnostic/planning/stack/SKILL.md +89 -0
  34. package/dist/skills/agnostic/quality/tdd/SKILL.md +31 -0
  35. package/dist/skills/agnostic/requirements/requirements-grill/SKILL.md +1 -0
  36. package/dist/skills/agnostic/requirements/write-backlog/SKILL.md +7 -5
  37. package/dist/skills/frameworks/tanstack-query/tanstack-query/SKILL.md +621 -830
  38. package/dist/skills/frameworks/tanstack-start/tanstack-start/SKILL.md +250 -0
  39. package/dist/skills/phases/bug-discovery-phase/REFERENCE.md +30 -0
  40. package/dist/skills/phases/bug-discovery-phase/SKILL.md +8 -1
  41. package/dist/skills/phases/debugging-phase/SKILL.md +1 -0
  42. package/dist/skills/phases/delivery-phase/SKILL.md +33 -65
  43. package/dist/skills/phases/delivery-phase/phases/closeout.md +33 -0
  44. package/dist/skills/phases/delivery-phase/phases/debug.md +30 -0
  45. package/dist/skills/phases/delivery-phase/phases/docs-ingest.md +27 -0
  46. package/dist/skills/phases/delivery-phase/phases/implement.md +30 -0
  47. package/dist/skills/phases/delivery-phase/phases/plan.md +27 -0
  48. package/dist/skills/phases/delivery-phase/phases/review.md +29 -0
  49. package/dist/skills/phases/delivery-phase/phases/router.md +46 -0
  50. package/dist/skills/phases/delivery-phase/phases/spec.md +26 -0
  51. package/dist/skills/phases/delivery-phase/references/artifact-state.md +42 -0
  52. package/dist/skills/phases/delivery-phase/references/phase-handoff.md +25 -0
  53. package/dist/skills/phases/docs-ingest-phase/SKILL.md +28 -70
  54. package/dist/skills/phases/docs-ingest-phase/agents/openai.yaml +2 -2
  55. package/dist/skills/phases/docs-ingest-phase/phases/private-internal.md +57 -0
  56. package/dist/skills/phases/docs-ingest-phase/phases/public-docs.md +52 -0
  57. package/dist/skills/phases/docs-ingest-phase/phases/router.md +42 -0
  58. package/dist/skills/phases/docs-ingest-phase/references/fumadocs-routing.md +8 -5
  59. package/dist/skills/phases/docs-ingest-phase/references/learning-artifacts.md +96 -0
  60. package/dist/skills/phases/docs-ingest-phase/references/public-docs.md +90 -0
  61. package/dist/skills/phases/requirements-phase/SKILL.md +3 -0
  62. package/dist/skills/phases/review-phase/SKILL.md +5 -0
  63. package/package.json +1 -1
@@ -0,0 +1,250 @@
1
+ ---
2
+ name: tanstack-start
3
+ description: Full-stack React framework powered by TanStack Router with SSR, streaming, server functions, and deployment to any hosting provider.
4
+ ---
5
+
6
+ # TanStack Start Skills
7
+
8
+ ## Overview
9
+
10
+ TanStack Start is a full-stack React framework built on TanStack Router, powered by Vite and Nitro (via Vinxi). It provides server-side rendering, streaming, server functions (RPC), middleware, API routes, and deploys to any platform via Nitro presets.
11
+
12
+ **Package:** `@tanstack/react-start`
13
+ **Router Plugin:** `@tanstack/router-plugin`
14
+ **Build Tool:** Vinxi (Vite + Nitro)
15
+ **Status:** RC (Release Candidate)
16
+ **RSC Support:** React Server Components support is in active development and will land as a non-breaking v1.x addition
17
+
18
+ ## Installation & Project Setup
19
+
20
+ ```bash
21
+ npx @tanstack/cli create my-app
22
+ # Or manually:
23
+ npm install @tanstack/react-start @tanstack/react-router react react-dom
24
+ npm install -D @tanstack/router-plugin typescript vite vite-tsconfig-paths
25
+ ```
26
+
27
+ ### Project Structure
28
+
29
+ ```
30
+ my-app/
31
+ app/
32
+ routes/
33
+ __root.tsx # Root layout
34
+ index.tsx # / route
35
+ posts.$postId.tsx # /posts/:postId
36
+ api/
37
+ users.ts # /api/users API route
38
+ client.tsx # Client entry
39
+ router.tsx # Router creation
40
+ ssr.tsx # SSR entry
41
+ routeTree.gen.ts # Auto-generated route tree
42
+ app.config.ts # TanStack Start config
43
+ tsconfig.json
44
+ package.json
45
+ ```
46
+
47
+ ### Configuration (`app.config.ts`)
48
+
49
+ ```typescript
50
+ import { defineConfig } from '@tanstack/react-start/config'
51
+ import viteTsConfigPaths from 'vite-tsconfig-paths'
52
+
53
+ export default defineConfig({
54
+ vite: {
55
+ plugins: [
56
+ viteTsConfigPaths({ projects: ['./tsconfig.json'] }),
57
+ ],
58
+ },
59
+ server: {
60
+ preset: 'node-server', // 'vercel' | 'netlify' | 'cloudflare-pages' | etc.
61
+ },
62
+ tsr: {
63
+ appDirectory: './app',
64
+ routesDirectory: './app/routes',
65
+ generatedRouteTree: './app/routeTree.gen.ts',
66
+ },
67
+ })
68
+ ```
69
+
70
+ ## Server Functions (`createServerFn`)
71
+
72
+ Server functions provide type-safe RPC calls between client and server.
73
+
74
+ ### Basic Server Functions
75
+
76
+ ```typescript
77
+ import { createServerFn } from '@tanstack/react-start'
78
+
79
+ // GET (data fetching, cacheable)
80
+ const getUsers = createServerFn()
81
+ .handler(async () => {
82
+ const users = await db.query.users.findMany()
83
+ return users
84
+ })
85
+
86
+ // POST (mutations, side effects)
87
+ const createUser = createServerFn({ method: 'POST' })
88
+ .validator((data: { name: string; email: string }) => data)
89
+ .handler(async ({ data }) => {
90
+ const user = await db.insert(users).values(data).returning()
91
+ return user
92
+ })
93
+ ```
94
+
95
+ ### With Zod Validation
96
+
97
+ ```typescript
98
+ import { z } from 'zod'
99
+
100
+ const updateUser = createServerFn({ method: 'POST' })
101
+ .validator(
102
+ z.object({
103
+ id: z.string(),
104
+ name: z.string().min(1),
105
+ email: z.string().email(),
106
+ })
107
+ )
108
+ .handler(async ({ data }) => {
109
+ // data is fully typed: { id: string; name: string; email: string }
110
+ return await db.update(users).set(data).where(eq(users.id, data.id))
111
+ })
112
+ ```
113
+
114
+ ## Middleware
115
+
116
+ ### Creating Middleware
117
+
118
+ ```typescript
119
+ import { createMiddleware } from '@tanstack/react-start'
120
+
121
+ const loggingMiddleware = createMiddleware().handler(async ({ next }) => {
122
+ console.log('Request started')
123
+ const result = await next()
124
+ console.log('Request completed')
125
+ return result
126
+ })
127
+ ```
128
+
129
+ ### Auth Middleware with Context
130
+
131
+ ```typescript
132
+ const authMiddleware = createMiddleware().handler(async ({ next }) => {
133
+ const request = getWebRequest()
134
+ const session = await getSession(request)
135
+
136
+ if (!session?.user) {
137
+ throw redirect({ to: '/login' })
138
+ }
139
+
140
+ // Pass typed context to handler
141
+ return next({ context: { user: session.user } })
142
+ })
143
+ ```
144
+
145
+ ### Chaining Middleware
146
+
147
+ ```typescript
148
+ const adminMiddleware = createMiddleware()
149
+ .middleware([authMiddleware])
150
+ .handler(async ({ next, context }) => {
151
+ // context.user is typed from authMiddleware
152
+ if (context.user.role !== 'admin') {
153
+ throw redirect({ to: '/unauthorized' })
154
+ }
155
+ return next({ context: { isAdmin: true } })
156
+ })
157
+
158
+ // Usage
159
+ const adminAction = createServerFn({ method: 'POST' })
160
+ .middleware([adminMiddleware])
161
+ .handler(async ({ context }) => {
162
+ // context: { user: User; isAdmin: boolean }
163
+ return { success: true }
164
+ })
165
+ ```
166
+
167
+ ## API Routes (Server Routes)
168
+
169
+ ```typescript
170
+ // app/routes/api/users.ts
171
+ import { createAPIFileRoute } from '@tanstack/react-start/api'
172
+
173
+ export const APIRoute = createAPIFileRoute('/api/users')({
174
+ GET: async ({ request }) => {
175
+ const users = await db.query.users.findMany()
176
+ return Response.json(users)
177
+ },
178
+ POST: async ({ request }) => {
179
+ const body = await request.json()
180
+ const user = await db.insert(users).values(body).returning()
181
+ return new Response(JSON.stringify(user), { status: 201 })
182
+ },
183
+ })
184
+ ```
185
+
186
+ ## SSR Strategies
187
+
188
+ ### Streaming SSR (Default)
189
+
190
+ ```typescript
191
+ export const Route = createFileRoute('/dashboard')({
192
+ loader: async () => ({
193
+ criticalData: await fetchCriticalData(),
194
+ deferredData: defer(fetchSlowData()),
195
+ }),
196
+ component: Dashboard,
197
+ })
198
+
199
+ function Dashboard() {
200
+ const { criticalData, deferredData } = Route.useLoaderData()
201
+ return (
202
+ <div>
203
+ <CriticalSection data={criticalData} />
204
+ <Suspense fallback={<Loading />}>
205
+ <Await promise={deferredData}>
206
+ {(data) => <SlowSection data={data} />}
207
+ </Await>
208
+ </Suspense>
209
+ </div>
210
+ )
211
+ }
212
+ ```
213
+
214
+ ## Deployment
215
+
216
+ ### Supported Platforms (Nitro Presets)
217
+
218
+ ```typescript
219
+ // app.config.ts
220
+ export default defineConfig({
221
+ server: {
222
+ preset: 'node-server', // Self-hosted Node.js
223
+ // preset: 'vercel', // Vercel
224
+ // preset: 'netlify', // Netlify
225
+ // preset: 'cloudflare-pages', // Cloudflare Pages
226
+ // preset: 'aws-lambda', // AWS Lambda
227
+ // preset: 'deno-server', // Deno Deploy
228
+ // preset: 'bun', // Bun
229
+ },
230
+ })
231
+ ```
232
+
233
+ ## Best Practices
234
+
235
+ 1. **Use validators for all server function inputs** - runtime safety and TypeScript inference
236
+ 2. **Compose middleware** for cross-cutting concerns (auth, logging, rate limiting)
237
+ 3. **Use `createServerFn` GET** for data fetching (cacheable, preloadable)
238
+ 4. **Use `createServerFn` POST** for mutations and side effects
239
+ 5. **Use `beforeLoad`** for route-level auth guards
240
+ 6. **Use `defer()`** for non-critical data to improve TTFB
241
+ 7. **Set `defaultPreload: 'intent'`** on the router for instant navigation
242
+ 8. **Co-locate server functions** with the routes that use them
243
+
244
+ ## Common Pitfalls
245
+
246
+ - Server functions cannot close over client-side variables (they're extracted to separate bundles)
247
+ - Data returned from server functions must be serializable
248
+ - Forgetting `await` in loaders leads to streaming issues
249
+ - Importing server-only code in client bundles causes build errors
250
+ - Missing `declare module '@tanstack/react-router'` loses all type safety
@@ -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,82 +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. **Close out.**
59
- - Report implementation, review result, validation, docs ingest outcome, debt captured, and remaining blockers.
37
+ ## Router Rules
60
38
 
61
- ## 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).
62
44
 
63
- - Preserve `parallel: true|false` through `$implement-spec`.
64
- - If the user chose a mode, honor it.
65
- - If not, choose the smallest safe mode:
66
- - `parallel: false` for tightly coupled work, unclear ownership, or small changes.
67
- - `parallel: true` only when the plan has independent waves and disjoint write scopes.
68
- - Do not let parallel workers expand the delivery scope.
69
- - Optional `$debugging-phase` may use parallel readonly hypothesis research, but speculative parallel fixes are not allowed.
45
+ ## Stop Conditions
70
46
 
71
- ## Output Contract
72
-
73
- Return a concise delivery report with:
74
-
75
- - **Goal:** scoped outcome delivered or blocker encountered
76
- - **Mode:** `parallel: true|false` and why
77
- - **Artifacts:** spec, plan, implementation notes, debt, docs, or tracker links touched
78
- - **Review:** mandatory `$review-phase` result and remaining findings
79
- - **Debugging:** skipped with reason, or `$debugging-phase` evidence and result
80
- - **Validation:** commands, browser checks, smoke tests, or manual scenarios run
81
- - **Docs ingest:** `$docs-ingest-phase` run, or explicit no-op reason
82
- - **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