prizmkit 1.1.10 → 1.1.12

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 (47) hide show
  1. package/bundled/VERSION.json +3 -3
  2. package/bundled/dev-pipeline/README.md +10 -46
  3. package/bundled/dev-pipeline/reset-bug.sh +84 -10
  4. package/bundled/dev-pipeline/reset-feature.sh +86 -10
  5. package/bundled/dev-pipeline/reset-refactor.sh +68 -4
  6. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +47 -46
  7. package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +7 -12
  8. package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +124 -20
  9. package/bundled/dev-pipeline/scripts/utils.py +20 -0
  10. package/bundled/dev-pipeline/templates/agent-prompts/dev-implement.md +13 -7
  11. package/bundled/dev-pipeline/templates/bootstrap-tier1.md +62 -66
  12. package/bundled/dev-pipeline/templates/bootstrap-tier2.md +37 -40
  13. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +35 -48
  14. package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +135 -182
  15. package/bundled/dev-pipeline/templates/feature-list-schema.json +6 -21
  16. package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +9 -9
  17. package/bundled/dev-pipeline/templates/sections/context-budget-rules.md +1 -1
  18. package/bundled/dev-pipeline/templates/sections/feature-context.md +4 -0
  19. package/bundled/dev-pipeline/templates/sections/phase-browser-verification.md +41 -24
  20. package/bundled/dev-pipeline/templates/sections/phase-commit-full.md +4 -12
  21. package/bundled/dev-pipeline/templates/sections/phase-deploy-verification.md +9 -17
  22. package/bundled/dev-pipeline/templates/sections/phase-implement-lite.md +1 -1
  23. package/bundled/dev-pipeline/templates/sections/phase-plan-agent.md +3 -2
  24. package/bundled/dev-pipeline/templates/sections/phase-plan-lite.md +4 -2
  25. package/bundled/dev-pipeline/templates/sections/phase-specify-plan-full.md +0 -18
  26. package/bundled/dev-pipeline/templates/sections/session-context.md +1 -2
  27. package/bundled/dev-pipeline/templates/sections/test-failure-recovery-agent.md +75 -0
  28. package/bundled/dev-pipeline/templates/sections/test-failure-recovery-lite.md +66 -0
  29. package/bundled/skills/_metadata.json +1 -1
  30. package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +3 -8
  31. package/bundled/skills/feature-pipeline-launcher/SKILL.md +4 -16
  32. package/bundled/skills/feature-planner/SKILL.md +8 -4
  33. package/bundled/skills/feature-planner/assets/planning-guide.md +16 -11
  34. package/bundled/skills/feature-planner/references/browser-interaction.md +9 -8
  35. package/bundled/skills/feature-planner/references/completeness-review.md +1 -1
  36. package/bundled/skills/feature-planner/references/error-recovery.md +1 -1
  37. package/bundled/skills/feature-planner/references/incremental-feature-planning.md +1 -1
  38. package/bundled/skills/feature-planner/scripts/validate-and-generate.py +10 -7
  39. package/bundled/skills/recovery-workflow/SKILL.md +3 -3
  40. package/bundled/skills/refactor-pipeline-launcher/SKILL.md +4 -15
  41. package/package.json +1 -1
  42. package/bundled/dev-pipeline/retry-bugfix.sh +0 -429
  43. package/bundled/dev-pipeline/retry-feature.sh +0 -445
  44. package/bundled/dev-pipeline/retry-refactor.sh +0 -441
  45. package/bundled/dev-pipeline/templates/sections/failure-log-check.md +0 -9
  46. package/bundled/dev-pipeline/templates/sections/resume-header.md +0 -5
  47. package/bundled/dev-pipeline/templates/sections/test-failure-recovery.md +0 -75
@@ -3,8 +3,7 @@
3
3
  ## Session Context
4
4
 
5
5
  - **Feature ID**: {{FEATURE_ID}} | **Session**: {{SESSION_ID}} | **Run**: {{RUN_ID}}
6
- - **Complexity**: {{COMPLEXITY}} | **Retry**: {{RETRY_COUNT}} / {{MAX_RETRIES}}
7
- - **Previous Status**: {{PREV_SESSION_STATUS}} | **Resume From**: {{RESUME_PHASE}}
6
+ - **Complexity**: {{COMPLEXITY}}
8
7
  - **Init**: {{INIT_DONE}} | Artifacts: spec={{HAS_SPEC}} plan={{HAS_PLAN}}
9
8
 
10
9
  ## Your Mission
@@ -47,7 +46,7 @@ You are running in **headless non-interactive mode** with a FINITE context windo
47
46
  2. **Never re-read your own writes** — After you create/modify a file, do NOT read it back to verify. Trust your write was correct.
48
47
  3. **Stay focused** — Do NOT explore code unrelated to this feature. No curiosity-driven reads.
49
48
  4. **One task at a time** — In Phase 3 (implement), complete and test one task before starting the next.
50
- 5. **Minimize tool output** — When running commands, use `| head -20` or `| tail -20` to limit output. Never dump entire test suites or logs.
49
+ 5. **Minimize tool output** — Never load full command output into context. First capture to a temp file (`cmd 2>&1 | tee /tmp/out.txt | tail -20`), then scan the head/tail to identify relevant fields, and use targeted filtering (`grep`, `sed`, `awk`) to extract only the information needed for the current task. Only read the filtered result never the raw full output.
51
50
  6. **No intermediate commits** — Do NOT run `git add`/`git commit` during Phase 1-3. All changes are committed once at the end in Phase 4 via `/prizmkit-committer`.
52
51
  7. **Capture test output once** — When running test suites, always use `$TEST_CMD 2>&1 | tee /tmp/test-out.txt | tail -20`. Then grep `/tmp/test-out.txt` for details. Never re-run the suite just to apply a different filter.
53
52
 
@@ -74,22 +73,8 @@ You are running in **headless non-interactive mode** with a FINITE context windo
74
73
  ### Phase 0: SKIP (already initialized)
75
74
  {{END_IF_INIT_DONE}}
76
75
 
77
- {{IF_RESUME}}
78
- ### Resume from Phase {{RESUME_PHASE}}
79
- Check `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` — if it exists, skip Phase 1 and use it directly.
80
- {{END_IF_RESUME}}
81
-
82
76
  ### Phase 1: Build Context Snapshot
83
77
 
84
- **Check for previous failure log:**
85
- ```bash
86
- cat .prizmkit/specs/{{FEATURE_SLUG}}/failure-log.md 2>/dev/null || echo "NO_PREVIOUS_FAILURE"
87
- ```
88
- If failure-log.md exists:
89
- - Read ROOT_CAUSE and SUGGESTION — adjust your approach accordingly
90
- - Read DISCOVERED_TRAPS — if any are genuine, inject into .prizm-docs/ during Phase 4 retrospective
91
- - Do NOT delete failure-log.md until this session completes all phases and commits successfully
92
-
93
78
  ```bash
94
79
  ls .prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md 2>/dev/null && echo "EXISTS" || echo "MISSING"
95
80
  ```
@@ -118,8 +103,9 @@ If MISSING — build it now:
118
103
  ls .prizmkit/specs/{{FEATURE_SLUG}}/ 2>/dev/null
119
104
  ```
120
105
 
121
- If plan.md missing, write it directly:
122
- - `plan.md`: key components, data flow, files to create/modify, and a Tasks section with `[ ]` checkboxes (each task = one implementable unit). Keep under 80 lines.
106
+ If plan.md missing, run `/prizmkit-plan` with `artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/` to generate `plan.md`:
107
+ - The plan.md should include: key components, data flow, files to create/modify, and a Tasks section with `[ ]` checkboxes (each task = one implementable unit). Keep under 80 lines.
108
+ - Resolve any `[NEEDS CLARIFICATION]` markers using the feature description — do NOT pause for interactive input.
123
109
 
124
110
  **Database Design Gate** (if feature involves data persistence — new tables, schema changes, new entities):
125
111
  Before proceeding past CP-1:
@@ -160,31 +146,39 @@ $TEST_CMD 2>&1 | tee /tmp/test-baseline.txt | tail -20
160
146
  1. All tasks in plan.md are `[x]`
161
147
  2. Run the full test suite to ensure nothing is broken
162
148
  3. Verify each acceptance criterion from Section 1 of context-snapshot.md is met — check mentally, do NOT re-read files you already wrote
163
- 4. If any criterion is not met, fix it now (max 2 fix rounds)
149
+ 4. If any criterion is not met, fix it now using the convergence-based recovery loop below
164
150
 
165
151
  **CP-2**: All acceptance criteria met, all tests pass.
166
152
 
167
153
  ### Test Failure Recovery Protocol
168
154
 
169
- When tests fail during Phase 3:
155
+ When tests fail during Phase 3, use **convergence-based recovery** — keep fixing as long as progress is being made.
170
156
 
171
- 1. **Analyze failure output**:
172
- - Identify root cause (code bug vs. test brittleness vs. environment issue)
173
- - Check if baseline already recorded this failure
157
+ **Recovery Loop**:
174
158
 
175
- 2. **Categorize and fix** (max 2 rounds):
176
- - **Pre-existing baseline failure**: Expected, record as acceptable
177
- - **New regression**: Fix the code and re-run tests
178
- - **Brittle test**: Fix the test or environment
179
- - **Environment issue**: Fix setup and re-run
159
+ 1. **Run tests and record results**: count total failures, note which tests failed. Exclude pre-existing baseline failures.
180
160
 
181
- 3. **Recovery limit**:
182
- - Max 2 fix attempts per failing test
183
- - After 2 rounds, if still failing: document in Implementation Log with root cause
184
- - **Do NOT block commit** if unable to resolve
161
+ 2. **Check termination conditions** (evaluate BEFORE each fix attempt):
162
+ - **All tests pass** Done. Exit recovery loop.
163
+ - **Plateau detected** same failure count AND same failing tests for 3 consecutive rounds AI cannot resolve. Document and exit.
164
+ - **Still making progress** failure count decreased vs. previous round → Continue fixing.
165
+ - **First round** — no history yet → Proceed to fix.
185
166
 
186
- 4. **Failure documentation**:
187
- - Test name, root cause, category, fix attempted, final status
167
+ 3. **Fix and iterate**: analyze remaining failures, apply fix, re-run `$TEST_CMD`, go back to step 1.
168
+
169
+ **Convergence tracking example**:
170
+ ```
171
+ Round 1: 5 failures [test_a, test_b, test_c, test_d, test_e]
172
+ Round 2: 3 failures [test_b, test_d, test_e] ← progress, continue
173
+ Round 3: 3 failures [test_b, test_d, test_e] ← plateau 1/3
174
+ Round 4: 3 failures [test_b, test_d, test_e] ← plateau 2/3
175
+ Round 5: 3 failures [test_b, test_d, test_e] ← plateau 3/3 → STOP
176
+ ```
177
+ **Key rule**: If failures decrease (even by 1), the plateau counter resets to 0.
178
+
179
+ **When recovery loop exits with remaining failures**:
180
+ - Document in Implementation Log: test name, root cause, category, rounds attempted, plateau point
181
+ - **Do NOT block commit** — unresolved failures are deferred to next session
188
182
  - If any AC cannot be verified due to test failure: feature is incomplete
189
183
 
190
184
  **Context-Aware Optimization**: If Implementation Log already confirms "all tests passing," skip full suite re-run.
@@ -195,27 +189,43 @@ When tests fail during Phase 3:
195
189
 
196
190
  You MUST execute this phase. Do NOT skip it. Do NOT mark it as completed without actually running playwright-cli.
197
191
 
198
- **Startup**:
199
- 1. Check if port is already in use: `lsof -ti:3001 | xargs kill -9 2>/dev/null || true`
200
- 2. Start dev server: `{{BROWSER_SETUP_COMMAND}}`
201
- 3. Wait for server to be ready: poll `{{BROWSER_URL}}` with `curl -s -o /dev/null -w "%{http_code}"` until it returns 200 or 302 (max 30 seconds, 2s interval)
202
- 4. If the page requires authentication, use playwright-cli to register a test user and log in first
192
+ **Step 1 — Start Dev Server**:
193
+
194
+ You know this project's tech stack. Detect and start the dev server yourself:
203
195
 
204
- **Verification**:
205
- 5. Use `playwright-cli snapshot` on `{{BROWSER_URL}}` to discover actual element refs, then verify these goals:
196
+ 1. Identify the dev server start command from project config (`package.json` scripts, `Makefile`, `docker-compose.yml`, etc.)
197
+ 2. Choose an available port check what the project defaults to, or pick one that is free:
198
+ ```bash
199
+ lsof -ti:<port> 2>/dev/null && echo "PORT_IN_USE" || echo "PORT_FREE"
200
+ ```
201
+ 3. Start the dev server in background, capture PID:
202
+ ```bash
203
+ <start-command> &
204
+ DEV_SERVER_PID=$!
205
+ ```
206
+ 4. Wait for server to be ready: poll the target URL with `curl -s -o /dev/null -w "%{http_code}"` until it returns 200 or 302 (max 30 seconds, 2s interval)
207
+ 5. If the page requires authentication, use playwright-cli to register a test user and log in first
208
+
209
+ **Step 2 — Verification**:
210
+
211
+ Use `playwright-cli snapshot` on the running app to discover actual element refs, then verify these goals:
206
212
  {{BROWSER_VERIFY_STEPS}}
207
213
  Decide the concrete playwright-cli actions (click, fill, assert, etc.) yourself based on the snapshot output and your knowledge of the implemented code. The goals above describe WHAT to verify — you determine HOW.
208
- 6. Take a final screenshot for evidence
209
214
 
210
- **Cleanup (REQUIRED you started it, you stop it)**:
211
- 7. Stop the dev server process you started in step 2 (kill the process)
212
- 8. Verify port is released: `lsof -ti:3001 | xargs kill -9 2>/dev/null || true`
215
+ Take a final screenshot for evidence.
216
+
217
+ **Step 3 Cleanup (REQUIRED you started it, you stop it)**:
213
218
 
214
- **Reporting**:
215
- 9. Append results to `context-snapshot.md`:
219
+ 1. Kill the dev server process: `kill $DEV_SERVER_PID 2>/dev/null || true`
220
+ 2. Verify port is released: `lsof -ti:<port> | xargs kill -9 2>/dev/null || true`
221
+
222
+ **Step 4 — Reporting**:
223
+
224
+ Append results to `context-snapshot.md`:
216
225
  ```
217
226
  ## Browser Verification
218
- URL: {{BROWSER_URL}}
227
+ URL: <actual URL used>
228
+ Dev Server Command: <actual command used>
219
229
  Steps executed: [list]
220
230
  Screenshot: [path]
221
231
  Result: PASS / FAIL (reason)
@@ -234,23 +244,7 @@ You just implemented this feature — you know the project's tech stack and buil
234
244
  3. **Assess and record** — append to context-snapshot.md:
235
245
  - **ALL builds pass** → `## Deploy Verification: PASS` — proceed to commit
236
246
  - **Some builds fail with fixable errors** → fix and re-verify (already handled in step 2)
237
- - **Cannot build locally** (missing system-level deps you cannot install) → Generate `.prizmkit/deploy.md` with:
238
- ```
239
- # Local Development Setup
240
-
241
- ## Prerequisites
242
- - [tool]: [install instruction]
243
-
244
- ## Build Steps
245
- 1. [exact command]
246
-
247
- ## Run / Dev Mode
248
- [exact command to start the app locally]
249
-
250
- ## Verify
251
- [how to confirm the app is running correctly]
252
- ```
253
- Record: `## Deploy Verification: PARTIAL — see .prizmkit/deploy.md for missing prerequisites`
247
+ - **Cannot build locally** (missing system-level deps you cannot install) → Record: `## Deploy Verification: PARTIAL — missing system deps (see below)`
254
248
 
255
249
  Deploy verification does NOT block the commit, but you MUST attempt it.
256
250
 
@@ -262,6 +256,8 @@ Deploy verification does NOT block the commit, but you MUST attempt it.
262
256
 
263
257
  If the project cannot be started locally (e.g., requires external services, databases, credentials), skip the smoke test and note why.
264
258
 
259
+ **Deploy documentation update** — Run `/prizmkit-deploy` ONLY if this feature introduced new infrastructure or deployment-affecting changes (new database, cache, message queue, new env vars, new build steps, changed ports/protocols). If none apply, skip `/prizmkit-deploy`.
260
+
265
261
  ### Phase 4: Architecture Sync & Commit (SINGLE COMMIT)
266
262
 
267
263
  **4a.** Run `/prizmkit-retrospective` — maintains `.prizm-docs/` (architecture index):
@@ -3,8 +3,7 @@
3
3
  ## Session Context
4
4
 
5
5
  - **Feature ID**: {{FEATURE_ID}} | **Session**: {{SESSION_ID}} | **Run**: {{RUN_ID}}
6
- - **Complexity**: {{COMPLEXITY}} | **Retry**: {{RETRY_COUNT}} / {{MAX_RETRIES}}
7
- - **Previous Status**: {{PREV_SESSION_STATUS}} | **Resume From**: {{RESUME_PHASE}}
6
+ - **Complexity**: {{COMPLEXITY}}
8
7
  - **Init**: {{INIT_DONE}} | Artifacts: spec={{HAS_SPEC}} plan={{HAS_PLAN}}
9
8
 
10
9
  ## Your Mission
@@ -47,7 +46,7 @@ You are running in **headless non-interactive mode** with a FINITE context windo
47
46
  2. **Never re-read your own writes** — After you create/modify a file, do NOT read it back to verify. Trust your write was correct.
48
47
  3. **Stay focused** — Do NOT explore code unrelated to this feature. No curiosity-driven reads.
49
48
  4. **One task at a time** — In Phase 4 (implement), complete and test one task before starting the next.
50
- 5. **Minimize tool output** — When running commands, use `| head -20` or `| tail -20` to limit output. Never dump entire test suites or logs.
49
+ 5. **Minimize tool output** — Never load full command output into context. First capture to a temp file (`cmd 2>&1 | tee /tmp/out.txt | tail -20`), then scan the head/tail to identify relevant fields, and use targeted filtering (`grep`, `sed`, `awk`) to extract only the information needed for the current task. Only read the filtered result never the raw full output.
51
50
  6. **No intermediate commits** — Do NOT run `git add`/`git commit` during Phase 1-5. All changes are committed once at the end in Phase 6 via `/prizmkit-committer`.
52
51
  7. **Capture test output once** — When running test suites, always use `$TEST_CMD 2>&1 | tee /tmp/test-out.txt | tail -20`. Then grep `/tmp/test-out.txt` for details. Never re-run the suite just to apply a different filter.
53
52
 
@@ -85,11 +84,6 @@ If any agent times out:
85
84
  ### Phase 0: SKIP (already initialized)
86
85
  {{END_IF_INIT_DONE}}
87
86
 
88
- {{IF_RESUME}}
89
- ### Resume from Phase {{RESUME_PHASE}}
90
- Check `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` — if exists, skip Phase 1 and proceed to Phase {{RESUME_PHASE}}.
91
- {{END_IF_RESUME}}
92
-
93
87
  ### Phase 0.5: Detect Test Commands
94
88
 
95
89
  You know this project's tech stack. Identify ALL test commands that apply (e.g., `go test ./...`, `npm test`, `cargo test`, `pytest`, `make test`, etc.). Record them as `TEST_CMDS`. Then record baseline:
@@ -150,8 +144,9 @@ If MISSING — build it now:
150
144
  ls .prizmkit/specs/{{FEATURE_SLUG}}/plan.md 2>/dev/null
151
145
  ```
152
146
 
153
- If either missing, write them yourself:
147
+ If either missing, run `/prizmkit-plan` with `artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/` to generate missing files:
154
148
  - `plan.md`: architecture — components, interfaces, data flow, files to create/modify, testing approach, and a Tasks section with `[ ]` checkboxes ordered by dependency
149
+ - Resolve any `[NEEDS CLARIFICATION]` markers using the feature description — do NOT pause for interactive input.
155
150
 
156
151
  **Database Design Gate** (if feature involves data persistence — new tables, schema changes, new entities):
157
152
  Before proceeding past CP-1, verify:
@@ -292,27 +287,43 @@ If GATE:MISSING — send message to Reviewer (re-spawn if needed): "Write review
292
287
 
293
288
  You MUST execute this phase. Do NOT skip it. Do NOT mark it as completed without actually running playwright-cli.
294
289
 
295
- **Startup**:
296
- 1. Check if port is already in use: `lsof -ti:3001 | xargs kill -9 2>/dev/null || true`
297
- 2. Start dev server: `{{BROWSER_SETUP_COMMAND}}`
298
- 3. Wait for server to be ready: poll `{{BROWSER_URL}}` with `curl -s -o /dev/null -w "%{http_code}"` until it returns 200 or 302 (max 30 seconds, 2s interval)
299
- 4. If the page requires authentication, use playwright-cli to register a test user and log in first
290
+ **Step 1 — Start Dev Server**:
291
+
292
+ You know this project's tech stack. Detect and start the dev server yourself:
300
293
 
301
- **Verification**:
302
- 5. Use `playwright-cli snapshot` on `{{BROWSER_URL}}` to discover actual element refs, then verify these goals:
294
+ 1. Identify the dev server start command from project config (`package.json` scripts, `Makefile`, `docker-compose.yml`, etc.)
295
+ 2. Choose an available port check what the project defaults to, or pick one that is free:
296
+ ```bash
297
+ lsof -ti:<port> 2>/dev/null && echo "PORT_IN_USE" || echo "PORT_FREE"
298
+ ```
299
+ 3. Start the dev server in background, capture PID:
300
+ ```bash
301
+ <start-command> &
302
+ DEV_SERVER_PID=$!
303
+ ```
304
+ 4. Wait for server to be ready: poll the target URL with `curl -s -o /dev/null -w "%{http_code}"` until it returns 200 or 302 (max 30 seconds, 2s interval)
305
+ 5. If the page requires authentication, use playwright-cli to register a test user and log in first
306
+
307
+ **Step 2 — Verification**:
308
+
309
+ Use `playwright-cli snapshot` on the running app to discover actual element refs, then verify these goals:
303
310
  {{BROWSER_VERIFY_STEPS}}
304
311
  Decide the concrete playwright-cli actions (click, fill, assert, etc.) yourself based on the snapshot output and your knowledge of the implemented code. The goals above describe WHAT to verify — you determine HOW.
305
- 6. Take a final screenshot for evidence
306
312
 
307
- **Cleanup (REQUIRED you started it, you stop it)**:
308
- 7. Stop the dev server process you started in step 2 (kill the process)
309
- 8. Verify port is released: `lsof -ti:3001 | xargs kill -9 2>/dev/null || true`
313
+ Take a final screenshot for evidence.
314
+
315
+ **Step 3 Cleanup (REQUIRED you started it, you stop it)**:
310
316
 
311
- **Reporting**:
312
- 9. Append results to `context-snapshot.md`:
317
+ 1. Kill the dev server process: `kill $DEV_SERVER_PID 2>/dev/null || true`
318
+ 2. Verify port is released: `lsof -ti:<port> | xargs kill -9 2>/dev/null || true`
319
+
320
+ **Step 4 — Reporting**:
321
+
322
+ Append results to `context-snapshot.md`:
313
323
  ```
314
324
  ## Browser Verification
315
- URL: {{BROWSER_URL}}
325
+ URL: <actual URL used>
326
+ Dev Server Command: <actual command used>
316
327
  Steps executed: [list]
317
328
  Screenshot: [path]
318
329
  Result: PASS / FAIL (reason)
@@ -331,23 +342,7 @@ You just implemented this feature — you know the project's tech stack and buil
331
342
  3. **Assess and record** — append to context-snapshot.md:
332
343
  - **ALL builds pass** → `## Deploy Verification: PASS` — proceed to commit
333
344
  - **Some builds fail with fixable errors** → fix and re-verify (already handled in step 2)
334
- - **Cannot build locally** (missing system-level deps you cannot install) → Generate `.prizmkit/deploy.md` with:
335
- ```
336
- # Local Development Setup
337
-
338
- ## Prerequisites
339
- - [tool]: [install instruction]
340
-
341
- ## Build Steps
342
- 1. [exact command]
343
-
344
- ## Run / Dev Mode
345
- [exact command to start the app locally]
346
-
347
- ## Verify
348
- [how to confirm the app is running correctly]
349
- ```
350
- Record: `## Deploy Verification: PARTIAL — see .prizmkit/deploy.md for missing prerequisites`
345
+ - **Cannot build locally** (missing system-level deps you cannot install) → Record: `## Deploy Verification: PARTIAL — missing system deps (see below)`
351
346
 
352
347
  Deploy verification does NOT block the commit, but you MUST attempt it.
353
348
 
@@ -359,6 +354,8 @@ Deploy verification does NOT block the commit, but you MUST attempt it.
359
354
 
360
355
  If the project cannot be started locally (e.g., requires external services, databases, credentials), skip the smoke test and note why.
361
356
 
357
+ **Deploy documentation update** — Run `/prizmkit-deploy` ONLY if this feature introduced new infrastructure or deployment-affecting changes (new database, cache, message queue, new env vars, new build steps, changed ports/protocols). If none apply, skip `/prizmkit-deploy`.
358
+
362
359
  ### Phase 6: Architecture Sync & Commit (SINGLE COMMIT)
363
360
 
364
361
  **6a.** Run `/prizmkit-retrospective` — maintains `.prizm-docs/` (architecture index):
@@ -3,8 +3,7 @@
3
3
  ## Session Context
4
4
 
5
5
  - **Feature ID**: {{FEATURE_ID}} | **Session**: {{SESSION_ID}} | **Run**: {{RUN_ID}}
6
- - **Complexity**: {{COMPLEXITY}} | **Retry**: {{RETRY_COUNT}} / {{MAX_RETRIES}}
7
- - **Previous Status**: {{PREV_SESSION_STATUS}} | **Resume From**: {{RESUME_PHASE}}
6
+ - **Complexity**: {{COMPLEXITY}}
8
7
  - **Init**: {{INIT_DONE}} | Artifacts: spec={{HAS_SPEC}} plan={{HAS_PLAN}}
9
8
 
10
9
  ## Your Mission
@@ -47,7 +46,7 @@ You are running in **headless non-interactive mode** with a FINITE context windo
47
46
  2. **Never re-read your own writes** — After you create/modify a file, do NOT read it back to verify. Trust your write was correct.
48
47
  3. **Stay focused** — Do NOT explore code unrelated to this feature. No curiosity-driven reads.
49
48
  4. **One task at a time** — In Phase 4 (implement), complete and test one task before starting the next.
50
- 5. **Minimize tool output** — When running commands, use `| head -20` or `| tail -20` to limit output. Never dump entire test suites or logs.
49
+ 5. **Minimize tool output** — Never load full command output into context. First capture to a temp file (`cmd 2>&1 | tee /tmp/out.txt | tail -20`), then scan the head/tail to identify relevant fields, and use targeted filtering (`grep`, `sed`, `awk`) to extract only the information needed for the current task. Only read the filtered result never the raw full output.
51
50
  6. **No intermediate commits** — Do NOT run `git add`/`git commit` during Phase 1-5. All changes are committed once at the end in Phase 6 via `/prizmkit-committer`.
52
51
  7. **Batch independent operations** — Issue multiple independent `Write`/`Read` calls in a single message turn when they have no dependencies. Combine multiple `mkdir -p` into one command. Never run `npm test` twice just to apply a different grep filter — capture output to `/tmp/test-out.txt` once and grep the file.
53
52
 
@@ -111,22 +110,8 @@ python3 {{INIT_SCRIPT_PATH}} --project-root {{PROJECT_ROOT}} --feature-id {{FEAT
111
110
  ```
112
111
  {{END_IF_FRESH_START}}
113
112
 
114
- {{IF_RESUME}}
115
- ### Resume from Phase {{RESUME_PHASE}}
116
- After team setup: check `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` — if exists, all agents MUST use it. Read existing artifacts and resume from Phase {{RESUME_PHASE}}.
117
- {{END_IF_RESUME}}
118
-
119
113
  ### Phase 1-2: Specify + Plan — Orchestrator (you)
120
114
 
121
- **Check for previous failure log:**
122
- ```bash
123
- cat .prizmkit/specs/{{FEATURE_SLUG}}/failure-log.md 2>/dev/null || echo "NO_PREVIOUS_FAILURE"
124
- ```
125
- If failure-log.md exists:
126
- - Read ROOT_CAUSE and SUGGESTION — adjust your approach accordingly
127
- - Read DISCOVERED_TRAPS — if any are genuine, inject into .prizm-docs/ during Phase 6 retrospective
128
- - Do NOT delete failure-log.md until this session completes all phases and commits successfully
129
-
130
115
  Check existing artifacts first:
131
116
  ```bash
132
117
  ls .prizmkit/specs/{{FEATURE_SLUG}}/ 2>/dev/null
@@ -374,27 +359,43 @@ If GATE:MISSING — send message to Reviewer (re-spawn if needed): "Write review
374
359
 
375
360
  You MUST execute this phase. Do NOT skip it. Do NOT mark it as completed without actually running playwright-cli.
376
361
 
377
- **Startup**:
378
- 1. Check if port is already in use: `lsof -ti:3001 | xargs kill -9 2>/dev/null || true`
379
- 2. Start dev server: `{{BROWSER_SETUP_COMMAND}}`
380
- 3. Wait for server to be ready: poll `{{BROWSER_URL}}` with `curl -s -o /dev/null -w "%{http_code}"` until it returns 200 or 302 (max 30 seconds, 2s interval)
381
- 4. If the page requires authentication, use playwright-cli to register a test user and log in first
362
+ **Step 1 — Start Dev Server**:
363
+
364
+ You know this project's tech stack. Detect and start the dev server yourself:
365
+
366
+ 1. Identify the dev server start command from project config (`package.json` scripts, `Makefile`, `docker-compose.yml`, etc.)
367
+ 2. Choose an available port — check what the project defaults to, or pick one that is free:
368
+ ```bash
369
+ lsof -ti:<port> 2>/dev/null && echo "PORT_IN_USE" || echo "PORT_FREE"
370
+ ```
371
+ 3. Start the dev server in background, capture PID:
372
+ ```bash
373
+ <start-command> &
374
+ DEV_SERVER_PID=$!
375
+ ```
376
+ 4. Wait for server to be ready: poll the target URL with `curl -s -o /dev/null -w "%{http_code}"` until it returns 200 or 302 (max 30 seconds, 2s interval)
377
+ 5. If the page requires authentication, use playwright-cli to register a test user and log in first
378
+
379
+ **Step 2 — Verification**:
382
380
 
383
- **Verification**:
384
- 5. Use `playwright-cli snapshot` on `{{BROWSER_URL}}` to discover actual element refs, then verify these goals:
381
+ Use `playwright-cli snapshot` on the running app to discover actual element refs, then verify these goals:
385
382
  {{BROWSER_VERIFY_STEPS}}
386
383
  Decide the concrete playwright-cli actions (click, fill, assert, etc.) yourself based on the snapshot output and your knowledge of the implemented code. The goals above describe WHAT to verify — you determine HOW.
387
- 6. Take a final screenshot for evidence
388
384
 
389
- **Cleanup (REQUIRED you started it, you stop it)**:
390
- 7. Stop the dev server process you started in step 2 (kill the process)
391
- 8. Verify port is released: `lsof -ti:3001 | xargs kill -9 2>/dev/null || true`
385
+ Take a final screenshot for evidence.
392
386
 
393
- **Reporting**:
394
- 9. Append results to `context-snapshot.md`:
387
+ **Step 3 — Cleanup (REQUIRED — you started it, you stop it)**:
388
+
389
+ 1. Kill the dev server process: `kill $DEV_SERVER_PID 2>/dev/null || true`
390
+ 2. Verify port is released: `lsof -ti:<port> | xargs kill -9 2>/dev/null || true`
391
+
392
+ **Step 4 — Reporting**:
393
+
394
+ Append results to `context-snapshot.md`:
395
395
  ```
396
396
  ## Browser Verification
397
- URL: {{BROWSER_URL}}
397
+ URL: <actual URL used>
398
+ Dev Server Command: <actual command used>
398
399
  Steps executed: [list]
399
400
  Screenshot: [path]
400
401
  Result: PASS / FAIL (reason)
@@ -413,23 +414,7 @@ You just implemented this feature — you know the project's tech stack and buil
413
414
  3. **Assess and record** — append to context-snapshot.md:
414
415
  - **ALL builds pass** → `## Deploy Verification: PASS` — proceed to commit
415
416
  - **Some builds fail with fixable errors** → fix and re-verify (already handled in step 2)
416
- - **Cannot build locally** (missing system-level deps you cannot install) → Generate `.prizmkit/deploy.md` with:
417
- ```
418
- # Local Development Setup
419
-
420
- ## Prerequisites
421
- - [tool]: [install instruction]
422
-
423
- ## Build Steps
424
- 1. [exact command]
425
-
426
- ## Run / Dev Mode
427
- [exact command to start the app locally]
428
-
429
- ## Verify
430
- [how to confirm the app is running correctly]
431
- ```
432
- Record: `## Deploy Verification: PARTIAL — see .prizmkit/deploy.md for missing prerequisites`
417
+ - **Cannot build locally** (missing system-level deps you cannot install) → Record: `## Deploy Verification: PARTIAL — missing system deps (see below)`
433
418
 
434
419
  Deploy verification does NOT block the commit, but you MUST attempt it.
435
420
 
@@ -441,6 +426,8 @@ Deploy verification does NOT block the commit, but you MUST attempt it.
441
426
 
442
427
  If the project cannot be started locally (e.g., requires external services, databases, credentials), skip the smoke test and note why.
443
428
 
429
+ **Deploy documentation update** — Run `/prizmkit-deploy` ONLY if this feature introduced new infrastructure or deployment-affecting changes (new database, cache, message queue, new env vars, new build steps, changed ports/protocols). If none apply, skip `/prizmkit-deploy`.
430
+
444
431
  ### Phase 6: Retrospective & Commit (SINGLE COMMIT) — DO NOT SKIP
445
432
 
446
433
  **Bug Fix Documentation Policy**: