prizmkit 1.1.106 → 1.1.108

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 (85) hide show
  1. package/bin/create-prizmkit.js +4 -0
  2. package/bundled/VERSION.json +3 -3
  3. package/bundled/dev-pipeline/prizmkit_runtime/config.py +81 -14
  4. package/bundled/dev-pipeline/prizmkit_runtime/heartbeat.py +19 -8
  5. package/bundled/dev-pipeline/prizmkit_runtime/interoperability.py +0 -1
  6. package/bundled/dev-pipeline/prizmkit_runtime/launch_profiles.py +18 -0
  7. package/bundled/dev-pipeline/prizmkit_runtime/runner_bookkeeping.py +22 -2
  8. package/bundled/dev-pipeline/prizmkit_runtime/runner_classification.py +56 -5
  9. package/bundled/dev-pipeline/prizmkit_runtime/runner_models.py +0 -8
  10. package/bundled/dev-pipeline/prizmkit_runtime/runner_recovery.py +11 -1
  11. package/bundled/dev-pipeline/prizmkit_runtime/runners.py +298 -63
  12. package/bundled/dev-pipeline/prizmkit_runtime/sessions.py +243 -37
  13. package/bundled/dev-pipeline/scripts/continuation.py +0 -5
  14. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +10 -82
  15. package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +7 -64
  16. package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +40 -63
  17. package/bundled/dev-pipeline/scripts/utils.py +123 -0
  18. package/bundled/dev-pipeline/templates/agent-prompts/critic-plan-challenge.md +4 -3
  19. package/bundled/dev-pipeline/templates/agent-prompts/reviewer-review.md +5 -6
  20. package/bundled/dev-pipeline/templates/bootstrap-prompt.md +1 -1
  21. package/bundled/dev-pipeline/templates/bootstrap-tier1.md +36 -35
  22. package/bundled/dev-pipeline/templates/bootstrap-tier2.md +53 -80
  23. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +43 -78
  24. package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +5 -17
  25. package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +6 -18
  26. package/bundled/dev-pipeline/templates/sections/checkpoint-system.md +14 -48
  27. package/bundled/dev-pipeline/templates/sections/context-budget-rules.md +7 -14
  28. package/bundled/dev-pipeline/templates/sections/feature-context.md +0 -4
  29. package/bundled/dev-pipeline/templates/sections/phase-browser-verification-auto.md +0 -7
  30. package/bundled/dev-pipeline/templates/sections/phase-browser-verification-opencli.md +0 -7
  31. package/bundled/dev-pipeline/templates/sections/phase-browser-verification.md +0 -7
  32. package/bundled/dev-pipeline/templates/sections/phase-commit-full.md +0 -14
  33. package/bundled/dev-pipeline/templates/sections/phase-commit.md +0 -14
  34. package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-agent-suffix.md +0 -7
  35. package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-base.md +0 -2
  36. package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-lite-suffix.md +0 -7
  37. package/bundled/dev-pipeline/templates/sections/phase-critic-plan-full.md +6 -8
  38. package/bundled/dev-pipeline/templates/sections/phase-critic-plan.md +3 -7
  39. package/bundled/dev-pipeline/templates/sections/phase-implement-agent.md +4 -16
  40. package/bundled/dev-pipeline/templates/sections/phase-implement-full.md +4 -17
  41. package/bundled/dev-pipeline/templates/sections/phase-implement-lite.md +0 -7
  42. package/bundled/dev-pipeline/templates/sections/phase-plan-agent.md +2 -9
  43. package/bundled/dev-pipeline/templates/sections/phase-plan-lite.md +1 -8
  44. package/bundled/dev-pipeline/templates/sections/phase-prizmkit-test.md +15 -16
  45. package/bundled/dev-pipeline/templates/sections/phase-review-agent.md +3 -10
  46. package/bundled/dev-pipeline/templates/sections/phase-review-full.md +3 -10
  47. package/bundled/dev-pipeline/templates/sections/phase-specify-plan-full.md +2 -9
  48. package/bundled/dev-pipeline/templates/sections/phase0-init.md +0 -7
  49. package/bundled/dev-pipeline/templates/sections/phase0-test-baseline.md +2 -15
  50. package/bundled/dev-pipeline/tests/conftest.py +0 -1
  51. package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +395 -21
  52. package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +50 -14
  53. package/bundled/dev-pipeline/tests/test_generate_refactor_prompt.py +154 -2
  54. package/bundled/dev-pipeline/tests/test_python_runner_parity.py +431 -3
  55. package/bundled/dev-pipeline/tests/test_unified_cli.py +857 -5
  56. package/bundled/skills/_metadata.json +4 -4
  57. package/bundled/skills/app-planner/SKILL.md +1 -1
  58. package/bundled/skills/app-planner/references/architecture-decisions.md +1 -1
  59. package/bundled/skills/bug-fix-workflow/SKILL.md +174 -128
  60. package/bundled/skills/bug-planner/SKILL.md +101 -15
  61. package/bundled/skills/bug-planner/references/severity-rules.md +20 -8
  62. package/bundled/skills/feature-planner/SKILL.md +87 -8
  63. package/bundled/skills/feature-planner/assets/planning-guide.md +34 -10
  64. package/bundled/skills/feature-workflow/SKILL.md +100 -81
  65. package/bundled/skills/{prizm-kit → prizmkit}/SKILL.md +1 -1
  66. package/bundled/skills/prizmkit-code-review/SKILL.md +12 -13
  67. package/bundled/skills/prizmkit-code-review/references/reviewer-agent-prompt.md +10 -10
  68. package/bundled/skills/refactor-planner/SKILL.md +88 -7
  69. package/bundled/skills/refactor-planner/references/fast-path.md +2 -1
  70. package/bundled/skills/refactor-planner/references/planning-phases.md +29 -11
  71. package/bundled/skills/refactor-workflow/SKILL.md +116 -57
  72. package/bundled/templates/project-memory-template.md +1 -1
  73. package/package.json +1 -1
  74. package/src/ai-cli-launch.js +194 -0
  75. package/src/config.js +26 -14
  76. package/src/index.js +11 -44
  77. package/src/platforms.js +10 -3
  78. package/src/prompts.js +60 -2
  79. package/src/scaffold.js +26 -14
  80. package/bundled/dev-pipeline/scripts/prizmkit-test-gate.py +0 -446
  81. package/bundled/dev-pipeline/templates/agent-prompts/dev-fix.md +0 -7
  82. package/bundled/dev-pipeline/templates/agent-prompts/dev-resume.md +0 -5
  83. package/bundled/dev-pipeline/templates/sections/log-size-awareness.md +0 -20
  84. package/bundled/dev-pipeline/tests/test_prizmkit_test_gate.py +0 -107
  85. package/bundled/skills/prizmkit-code-review/references/dev-agent-prompt.md +0 -30
@@ -52,22 +52,18 @@ You are running in **headless non-interactive mode** with a FINITE context windo
52
52
 
53
53
  1. **context-snapshot.md is your single source of truth** — After Phase 1 builds it, ALWAYS read context-snapshot.md instead of re-reading individual source files
54
54
  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.
55
- 3. **Stay focused** — Do NOT explore code unrelated to this feature. No curiosity-driven reads.
55
+ 3. **Never re-read unmodified files** — Once you have read a file into context, do NOT read it again unless it was modified by an Edit/Write operation after your last read. Use `grep -n '<pattern>' <file>` or `sed -n '<start>,<end>p' <file>` for targeted line lookups instead of full-file Read. Before issuing a Read, ask yourself: "Have I read this file before, and has it changed since?" If the answer is "no, it hasn't changed" — do NOT read it. This applies to all files including those summarized in context-snapshot.md Section 4. Subagents (Critic, Reviewer) must receive context-snapshot.md and rely on it rather than independently re-reading the same files the orchestrator already read.
56
+ 4. **Stay focused** — Do NOT explore code unrelated to this feature. No curiosity-driven reads.
56
57
  4. **One task at a time** — In Phase 4 (implement), complete and test one task before starting the next.
57
58
  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.
58
59
  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`.
59
- 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.
60
- 8. **Scaffold / generated file awareness** — Files created by scaffolding tools are boilerplate. Tag them, record in context-snapshot.md, NEVER re-read. Edit directly without reading first.
60
+ 7. **Capture test output once** — When running test suites, always use `<test-command> 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.
61
61
  9. **Package version verification (BLOCKING)** — Verify dependency versions via registry query before writing them. NEVER guess.
62
62
  10. **Build artifact hygiene** — After build/compile, ensure output is in `.gitignore`.
63
- 11. **Anti re-read hard rule (BLOCKING)** — Once you have read a file into context, do NOT read the full file again. Use `grep -n '<pattern>' <file>` or `sed -n '<start>,<end>p' <file>` for specific lines. **20-step window**: full Read forbidden within 20 tool calls of last read. **3-strike**: 3 full Reads of same file → report BLOCKED. Applies to orchestrator AND subagents subagents re-reading files in context-snapshot.md Section 4 are wasting context.
64
- 12. **Read offset safety (BLOCKING)** — If Read returns "shorter than offset"/"File is empty"/"Wasted call" — do NOT retry same offset. Run `wc -l <file>` to get real line count, then `sed -n` for exact range. 2 consecutive offset errors → STOP Reading that file. Never guess offsets — `grep -n '<anchor>'` first.
63
+ 11. **Read offset safety (BLOCKING)** — If Read returns "shorter than offset"/"File is empty"/"Wasted call" — do NOT retry same offset. Run `wc -l <file>` to get real line count, then `sed -n` for exact range. 2 consecutive offset errors STOP Reading that file. Never guess offsets`grep -n '<anchor>'` first.
65
64
 
66
65
  ---
67
66
 
68
- {{LOG_SIZE_AWARENESS}}
69
- ---
70
-
71
67
  ## PrizmKit Directory Convention
72
68
 
73
69
  ```
@@ -100,15 +96,6 @@ If any agent times out:
100
96
  ### Phase 0: SKIP (already initialized)
101
97
  {{END_IF_INIT_DONE}}
102
98
 
103
- ### Phase 0.5: Detect Test Commands
104
-
105
- 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:
106
- ```bash
107
- ($TEST_CMD) 2>&1 | tee /tmp/test-baseline.txt | tail -20
108
- ```
109
- Save pre-existing failing tests as `BASELINE_FAILURES`.
110
-
111
- > **⚠️ Test Output Rule**: Always capture test output to a temp file (`tee /tmp/test-out.txt`). Then grep the file instead of re-running the suite.
112
99
 
113
100
  ### Phase 1: Build Context Snapshot (you, the orchestrator)
114
101
 
@@ -162,20 +149,20 @@ ls .prizmkit/specs/{{FEATURE_SLUG}}/plan.md 2>/dev/null
162
149
 
163
150
  If either missing, run `/prizmkit-plan` with `artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/` to generate missing files:
164
151
  - `plan.md`: architecture — components, interfaces, data flow, files to create/modify, testing approach, and a Tasks section with `[ ]` checkboxes ordered by dependency
165
- - Resolve any `[NEEDS CLARIFICATION]` markers using the feature description do NOT pause for interactive input.
152
+ - Resolve uncertain requirements from the feature description, existing code, and conservative existing-project patterns.
166
153
 
167
154
  **Database Design Gate** (if feature involves data persistence — new tables, schema changes, new entities):
168
155
  Before proceeding past CP-1, verify:
169
156
  1. Plan.md Data Model section references existing schema/model files (scan for `*.prisma`, `*.sql`, `migrations/`, `models/`, `*.entity.*` files; read them if not already in context-snapshot)
170
157
  2. All new tables/fields follow existing naming conventions, ID strategy, timestamp patterns, and constraint style
171
- 3. No `[NEEDS CLARIFICATION]` remains in Data Model section — resolve by reading existing code and making a conservative choice that matches existing patterns. Document the resolution in plan.md.
158
+ 3. No unresolved data model uncertainty remains in the Data Model section — resolve by reading existing code and making a conservative choice that matches existing patterns. Document the resolution in plan.md.
172
159
  4. If a DB design decision genuinely cannot be resolved from existing code alone, document the assumption made and flag it in the Implementation Log for user review.
173
160
 
174
161
  **CP-1**: plan.md exists with Tasks section.
175
162
 
176
163
  ### Phase 3: Analyze — Reviewer Subagent
177
164
 
178
- Spawn Reviewer agent (Agent tool, subagent_type="prizm-dev-team-reviewer", mode="plan", run_in_background=false).
165
+ Spawn Reviewer agent (Agent tool, subagent_type="prizm-dev-team-reviewer", mode="plan", run_in_background=false, isolation=default/no worktree). Do not request worktree isolation; this prevents AI tool-created `.claude/worktrees/...` subagent worktrees. PrizmKit pipeline-managed linked git worktrees under `.prizmkit/state/worktrees/...` are separate and controlled by `USE_WORKTREE`.
179
166
 
180
167
  Spawn failure cap: for team/config/lock errors, retry at most once for this Reviewer spawn. If the second attempt fails, do not poll for report artifacts; fix/check the plan inline or write `failure-log.md` before stopping for recovery.
181
168
 
@@ -204,7 +191,7 @@ If CRITIC:MISSING — skip Phase 3.5 entirely and proceed to Phase 4. Log: "Crit
204
191
 
205
192
  **If {{CRITIC_COUNT}} = 1 → Single Critic** (skip to CP-2.5 after this):
206
193
 
207
- Spawn Critic agent (Agent tool, subagent_type="prizm-dev-team-critic", mode="plan", run_in_background=false).
194
+ Spawn Critic agent (Agent tool, subagent_type="prizm-dev-team-critic", mode="plan", run_in_background=false, isolation=default/no worktree). Do not request worktree isolation; this prevents AI tool-created `.claude/worktrees/...` subagent worktrees. PrizmKit pipeline-managed linked git worktrees under `.prizmkit/state/worktrees/...` are separate and controlled by `USE_WORKTREE`.
208
195
 
209
196
  Spawn failure cap: for team/config/lock errors, retry at most once for this Critic spawn. If the second attempt fails, do not poll for challenge reports; perform the plan challenge inline and record the fallback.
210
197
 
@@ -212,9 +199,10 @@ Prompt:
212
199
  > "Read {{CRITIC_SUBAGENT_PATH}}. For feature {{FEATURE_ID}} (slug: {{FEATURE_SLUG}}):
213
200
  > **MODE: Plan Challenge**
214
201
  > 1. Read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` FIRST — Section 3 has project context, Section 4 has file manifest.
215
- > 2. Read `.prizmkit/prizm-docs/root.prizm` and relevant L1/L2 docs for affected modules.
216
- > 3. Read existing source files in the modules this plan touches.
217
- > 4. Challenge plan.md against the project's existing architecture, patterns, and style.
202
+ > 2. Use context-snapshot.md as the shared source of truth. Do not create or enter AI tool-created `.claude/worktrees/...` subagent worktrees; use default/no worktree isolation and do not request worktree isolation.
203
+ > 3. PrizmKit pipeline-managed linked git worktrees under `.prizmkit/state/worktrees/...` are a separate runner feature controlled by `USE_WORKTREE`; do not confuse them with AI tool-created `.claude/worktrees/...`.
204
+ > 4. Read additional `.prizmkit/prizm-docs/` or source excerpts only when needed to verify a specific challenge.
205
+ > 5. Challenge plan.md against the project's existing architecture, patterns, and style.
218
206
  > Write `.prizmkit/specs/{{FEATURE_SLUG}}/challenge-report.md` with findings (or 'No significant challenges')."
219
207
 
220
208
  Wait for Critic to return.
@@ -225,15 +213,16 @@ Wait for Critic to return.
225
213
 
226
214
  **IMPORTANT**: Spawn all 3 Critics in PARALLEL (issue all 3 Agent tool calls in the SAME message turn). Do NOT wait for one before spawning the next.
227
215
 
228
- Spawn Critic-A, Critic-B, Critic-C simultaneously (each with mode="plan", run_in_background=false):
216
+ Spawn Critic-A, Critic-B, Critic-C simultaneously (each with mode="plan", run_in_background=false, isolation=default/no worktree). Do not request worktree isolation; this prevents AI tool-created `.claude/worktrees/...` subagent worktrees. PrizmKit pipeline-managed linked git worktrees under `.prizmkit/state/worktrees/...` are separate and controlled by `USE_WORKTREE`:
229
217
 
230
218
  Critic-A prompt:
231
219
  > "Read {{CRITIC_SUBAGENT_PATH}}. For feature {{FEATURE_ID}} (slug: {{FEATURE_SLUG}}):
232
220
  > **MODE: Plan Challenge — Lens: Architecture & Scalability**
233
221
  > Focus on: architectural pattern fit, scalability implications, over-engineering risks, component boundary design.
234
222
  > 1. Read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` FIRST — Section 3 has TRAPS/RULES, Section 4 has file manifest.
235
- > 2. Read `.prizmkit/prizm-docs/root.prizm` and relevant L1/L2 docs for affected modules.
236
- > 3. Read existing source files in the modules this plan touches.
223
+ > 2. Use context-snapshot.md as the shared source of truth. Do not create or enter AI tool-created `.claude/worktrees/...` subagent worktrees; use default/no worktree isolation and do not request worktree isolation.
224
+ > 3. PrizmKit pipeline-managed linked git worktrees under `.prizmkit/state/worktrees/...` are a separate runner feature controlled by `USE_WORKTREE`; do not confuse them with AI tool-created `.claude/worktrees/...`.
225
+ > 4. Read additional `.prizmkit/prizm-docs/` or source excerpts only when needed to verify a specific challenge.
237
226
  > 4. Challenge plan.md through your architecture lens.
238
227
  > Write `.prizmkit/specs/{{FEATURE_SLUG}}/challenge-report-A.md`."
239
228
 
@@ -242,8 +231,9 @@ Critic-B prompt:
242
231
  > **MODE: Plan Challenge — Lens: Data Model & Edge Cases**
243
232
  > Focus on: data model design fit, entity relationships, edge cases in business logic, missing boundary conditions.
244
233
  > 1. Read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` FIRST — Section 3 has TRAPS/RULES, Section 4 has file manifest.
245
- > 2. Read `.prizmkit/prizm-docs/root.prizm` and relevant L1/L2 docs for affected modules.
246
- > 3. Read existing source files in the modules this plan touches.
234
+ > 2. Use context-snapshot.md as the shared source of truth. Do not create or enter AI tool-created `.claude/worktrees/...` subagent worktrees; use default/no worktree isolation and do not request worktree isolation.
235
+ > 3. PrizmKit pipeline-managed linked git worktrees under `.prizmkit/state/worktrees/...` are a separate runner feature controlled by `USE_WORKTREE`; do not confuse them with AI tool-created `.claude/worktrees/...`.
236
+ > 4. Read additional `.prizmkit/prizm-docs/` or source excerpts only when needed to verify a specific challenge.
247
237
  > 4. Challenge plan.md through your data/edge-case lens.
248
238
  > Write `.prizmkit/specs/{{FEATURE_SLUG}}/challenge-report-B.md`."
249
239
 
@@ -252,8 +242,9 @@ Critic-C prompt:
252
242
  > **MODE: Plan Challenge — Lens: Security & Performance**
253
243
  > Focus on: security attack surface, authentication/authorization gaps, performance bottlenecks, resource leaks.
254
244
  > 1. Read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` FIRST — Section 3 has TRAPS/RULES, Section 4 has file manifest.
255
- > 2. Read `.prizmkit/prizm-docs/root.prizm` and relevant L1/L2 docs for affected modules.
256
- > 3. Read existing source files in the modules this plan touches.
245
+ > 2. Use context-snapshot.md as the shared source of truth. Do not create or enter AI tool-created `.claude/worktrees/...` subagent worktrees; use default/no worktree isolation and do not request worktree isolation.
246
+ > 3. PrizmKit pipeline-managed linked git worktrees under `.prizmkit/state/worktrees/...` are a separate runner feature controlled by `USE_WORKTREE`; do not confuse them with AI tool-created `.claude/worktrees/...`.
247
+ > 4. Read additional `.prizmkit/prizm-docs/` or source excerpts only when needed to verify a specific challenge.
257
248
  > 4. Challenge plan.md through your security/performance lens.
258
249
  > Write `.prizmkit/specs/{{FEATURE_SLUG}}/challenge-report-C.md`."
259
250
 
@@ -280,25 +271,21 @@ grep -c '^\- \[ \]' .prizmkit/specs/{{FEATURE_SLUG}}/plan.md 2>/dev/null || true
280
271
 
281
272
  **Build artifacts rule**: After any build/compile command, ensure output is in `.gitignore`. Never commit binaries/build output.
282
273
 
283
- **3a.** Detect test commands and record baseline:
284
- ```bash
285
- ($TEST_CMD) 2>&1 | tee /tmp/test-baseline.txt | tail -20
286
- ```
287
-
288
- **3b.** Run `/prizmkit-implement` directly — you (the orchestrator) execute the full cycle:
274
+ **3a.** Run `/prizmkit-implement` directly you (the orchestrator) execute the full cycle:
289
275
  - Read plan.md Tasks from `.prizmkit/specs/{{FEATURE_SLUG}}/`
290
276
  - Use context-snapshot.md Section 4 File Manifest for targeted reads — do NOT re-read files already summarized there
291
277
  - Implements task-by-task, marking each `[x]` immediately
292
278
  - Creates/updates L2 `.prizm` docs when creating new modules
293
279
  - Defers scoped/full test execution until after the code-review loop completes
280
+ - Preserves Reviewer/Critic behavior; only the top-level implementation Dev handoff is removed
294
281
  - If plan.md has >5 tasks: update checkpoints after every 3 tasks
295
282
 
296
- **3c. Focused checks only (no test gate here)**:
283
+ **3b. Focused checks only (no test gate here)**:
297
284
  - During implementation, do not run mandatory periodic or full-suite tests.
298
285
  - If a tiny targeted check is needed to understand a local failure, run only the smallest relevant command and capture output to `/tmp/test-out.txt`.
299
286
  - The scoped feature test gate runs after code review; do not declare implementation success based on an early full-suite run.
300
287
 
301
- **3d. Verification Gate Self-Check (BLOCKING — before declaring implement done)**:
288
+ **3c. Verification Gate Self-Check (BLOCKING — before declaring implement done)**:
302
289
  For each Verification Gate from the Task Contract, write one evidence line to Implementation Log:
303
290
  ```
304
291
  ### Gate Evidence
@@ -306,7 +293,7 @@ For each Verification Gate from the Task Contract, write one evidence line to Im
306
293
  - [ ] G3: <gate text> — BLOCKED: <reason> ← no evidence = BLOCKED, not success
307
294
  ```
308
295
 
309
- **3e.** Append `## Implementation Log` (with Gate Evidence) to `context-snapshot.md`:
296
+ **3d.** Append `## Implementation Log` (with Gate Evidence) to `context-snapshot.md`:
310
297
  - files changed/created
311
298
  - key decisions
312
299
  - deviations from plan
@@ -316,20 +303,40 @@ For each Verification Gate from the Task Contract, write one evidence line to Im
316
303
 
317
304
  **CP-2**: All tasks `[x]`, Implementation Log written with Gate Evidence, and blocked gates documented in `failure-log.md`. Test execution is deferred until after code review.
318
305
 
319
- **Checkpoint update**:
306
+ ### Review — Code Review
307
+
308
+ Review the completed implementation before the scoped feature test gate runs. Use `artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/` so the code-review skill can read spec, plan, context snapshot, implementation log, and current diff artifacts. Do not require or read a prior `/prizmkit-test` report here; test generation and test-fix looping happen in the next phase.
309
+
310
+ Run `/prizmkit-code-review` with `artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/`.
311
+
312
+ The skill runs an internal review-fix loop (Reviewer Agent → filter → orchestrator fix, max 3 rounds) and writes `review-report.md` to the artifact directory.
313
+
314
+ **Gate Check — Review Report**:
315
+ After `/prizmkit-code-review` returns, verify the review report:
320
316
  ```bash
321
- python3 $PIPELINE_DIR/scripts/update-checkpoint.py \
322
- --checkpoint-path .prizmkit/specs/{{FEATURE_SLUG}}/workflow-checkpoint.json \
323
- --step prizmkit-implement \
324
- --status completed
317
+ grep -q "## Verdict" .prizmkit/specs/{{FEATURE_SLUG}}/review-report.md && echo "GATE:PASS" || echo "GATE:MISSING"
325
318
  ```
319
+ If GATE:MISSING:
320
+ - Do not re-run `/prizmkit-code-review` in an unbounded report-repair loop.
321
+ - Perform one bounded status check; retry at most once: inspect the skill output, `review-report.md` path, and any Reviewer agent spawn messages.
322
+ - If the missing report is caused by Reviewer agent spawn or review skill error, retry `/prizmkit-code-review` at most once only if it appears transient.
323
+ - If the report is still missing after that single check/retry, write `failure-log.md` with the spawn/skill error and last observable state, then either perform a safe inline fallback review (spec/plan/diff/tests → write `review-report.md` with `## Verdict`) or stop with a clear recovery failure.
326
324
 
325
+ Read `review-report.md` and check the Verdict:
326
+ - `PASS` → proceed to next phase
327
+ - `NEEDS_FIXES` → the skill exhausted its max rounds; log the remaining findings and proceed (do not retry externally)
328
+
329
+ **CP-3**: Review complete, report written.
327
330
 
328
331
  ### Scoped Feature Test Gate — PrizmKit Test
329
332
 
330
333
  Run `/prizmkit-test scope=this-change artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/` after review and before commit.
331
334
 
332
- Before invoking the skill, create `.prizmkit/specs/{{FEATURE_SLUG}}/.prizmkit-test-started` so stale reports are ignored.
335
+ Before invoking the skill, create a current-run marker so stale reports are ignored:
336
+ ```bash
337
+ mkdir -p .prizmkit/specs/{{FEATURE_SLUG}}
338
+ touch .prizmkit/specs/{{FEATURE_SLUG}}/.prizmkit-test-started
339
+ ```
333
340
 
334
341
  Gate requirements:
335
342
  - Generate or update tests only for this feature's changed files, changed public interfaces, and acceptance criteria.
@@ -339,40 +346,6 @@ Gate requirements:
339
346
  - Only after a valid `PASS`, write the report path to `.prizmkit/specs/{{FEATURE_SLUG}}/test-report-path.txt` and append a 3-5 bullet `## PrizmKit Test Gate` summary to `context-snapshot.md`.
340
347
  - If the report verdict is `NEEDS_FIXES`, fix in-scope implementation/test issues and rerun `/prizmkit-test`. If the report is `BLOCKED`, missing, stale, or for the wrong scope/artifact dir, write `failure-log.md` and stop for recovery.
341
348
 
342
- ### Phase 5: Review — Reviewer Subagent
343
-
344
- Spawn Reviewer subagent (Agent tool, subagent_type="prizm-dev-team-reviewer", run_in_background=false).
345
-
346
- Spawn failure cap: for team/config/lock errors, retry at most once for this Reviewer spawn. If the second attempt fails, do not poll for `review-report.md`; write `failure-log.md` with the spawn error and last observable state before stopping or performing an inline fallback.
347
-
348
- Prompt:
349
- > "Read {{REVIEWER_SUBAGENT_PATH}}. For feature {{FEATURE_ID}} (slug: {{FEATURE_SLUG}}):
350
- > 1. Read `.prizmkit/specs/{{FEATURE_SLUG}}/spec.md` for goals and acceptance criteria
351
- > 2. Read `.prizmkit/specs/{{FEATURE_SLUG}}/plan.md` for architecture decisions and completed tasks
352
- > 3. Read `.prizmkit/specs/{{FEATURE_SLUG}}/test-report-path.txt`, then read the referenced `/prizmkit-test` report. Review generated/updated tests, `In-Scope Failures`, `Baseline Failures`, `Out of Scope Gaps`, boundary coverage if present, and the report verdict.
353
- > 4. Run /prizmkit-code-review with artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/. The skill runs an internal review-fix loop (Reviewer → filter → Dev fix, max 3 rounds) and writes review-report.md.
354
- > 5. Do NOT run test suites — the Orchestrator already ran prizmkit-test. Focus on code review and fix strategy.
355
- > Report: verdict (PASS/NEEDS_FIXES), number of rounds, findings fixed/rejected."
356
-
357
- Wait for Reviewer to return.
358
-
359
- **Gate Check — Review Report**:
360
- After Reviewer agent returns, verify the review report was written:
361
- ```bash
362
- grep -q "## Verdict" .prizmkit/specs/{{FEATURE_SLUG}}/review-report.md && echo "GATE:PASS" || echo "GATE:MISSING"
363
- ```
364
- If GATE:MISSING:
365
- - Do not re-spawn Reviewer or re-run `/prizmkit-code-review` in an unbounded report-repair loop.
366
- - Perform one bounded status check; retry at most once: inspect Reviewer output, code-review skill output, `review-report.md` path, and any Reviewer/Dev spawn messages.
367
- - If the missing report is caused by team/config/lock errors from Reviewer or the internal code-review loop, write `failure-log.md` with the spawn/skill error and last observable state.
368
- - If the report is still missing after that single check/retry, either perform a safe inline fallback review and write `review-report.md` with `## Verdict`, or stop with a clear recovery failure.
369
-
370
- Read `review-report.md` and check the Verdict:
371
- - `PASS` → proceed to next phase
372
- - `NEEDS_FIXES` → the skill exhausted its max rounds; log the remaining findings and proceed
373
-
374
- **CP-3**: Review complete.
375
-
376
349
  {{IF_BROWSER_INTERACTION}}
377
350
  ### Phase 5.5: Browser Verification — MANDATORY
378
351
 
@@ -52,22 +52,18 @@ You are running in **headless non-interactive mode** with a FINITE context windo
52
52
 
53
53
  1. **context-snapshot.md is your single source of truth** — After Phase 1-2 builds it, ALWAYS read context-snapshot.md instead of re-reading individual source files
54
54
  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.
55
- 3. **Stay focused** — Do NOT explore code unrelated to this feature. No curiosity-driven reads.
55
+ 3. **Never re-read unmodified files** — Once you have read a file into context, do NOT read it again unless it was modified by an Edit/Write operation after your last read. Use `grep -n '<pattern>' <file>` or `sed -n '<start>,<end>p' <file>` for targeted line lookups instead of full-file Read. Before issuing a Read, ask yourself: "Have I read this file before, and has it changed since?" If the answer is "no, it hasn't changed" — do NOT read it. This applies to all files including those summarized in context-snapshot.md Section 4. Subagents (Critic, Reviewer) must receive context-snapshot.md and rely on it rather than independently re-reading the same files the orchestrator already read.
56
+ 4. **Stay focused** — Do NOT explore code unrelated to this feature. No curiosity-driven reads.
56
57
  4. **One task at a time** — In Phase 4 (implement), complete and test one task before starting the next.
57
58
  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.
58
59
  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`.
59
60
  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.
60
- 8. **Scaffold / generated file awareness** — Files created by scaffolding tools are boilerplate. Tag them, record in context-snapshot.md, NEVER re-read. Edit directly without reading first.
61
61
  9. **Package version verification (BLOCKING)** — Verify dependency versions via registry query before writing them. NEVER guess.
62
62
  10. **Build artifact hygiene** — After build/compile, ensure output is in `.gitignore`.
63
- 11. **Anti re-read hard rule (BLOCKING)** — Once you have read a file into context, do NOT read the full file again. Use `grep -n '<pattern>' <file>` or `sed -n '<start>,<end>p' <file>` for specific lines. **20-step window**: full Read forbidden within 20 tool calls of last read. **3-strike**: 3 full Reads of same file → report BLOCKED. Applies to orchestrator AND subagents.
64
- 12. **Read offset safety (BLOCKING)** — If Read returns "shorter than offset"/"File is empty"/"Wasted call" — do NOT retry same offset. Run `wc -l <file>` to get real line count, then `sed -n` for exact range. 2 consecutive offset errors → STOP Reading that file. Never guess offsets — `grep -n '<anchor>'` first.
63
+ 11. **Read offset safety (BLOCKING)** — If Read returns "shorter than offset"/"File is empty"/"Wasted call" — do NOT retry same offset. Run `wc -l <file>` to get real line count, then `sed -n` for exact range. 2 consecutive offset errors STOP Reading that file. Never guess offsets `grep -n '<anchor>'` first.
65
64
 
66
65
  ---
67
66
 
68
- {{LOG_SIZE_AWARENESS}}
69
- ---
70
-
71
67
  ## PrizmKit Directory Convention
72
68
 
73
69
  ```
@@ -98,19 +94,6 @@ If any agent times out:
98
94
  - **CP-0**: Verify `.prizmkit/prizm-docs/root.prizm`, `.prizmkit/config.json` exist
99
95
  {{END_IF_INIT_NEEDED}}
100
96
  {{IF_INIT_DONE}}
101
- ### Phase 0: Record Test Baseline & Detect Test Commands
102
-
103
- **Step 1 — Detect test commands**: 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`.
104
-
105
- **Step 2 — Record pre-existing failure baseline**:
106
- ```bash
107
- # Run each test command, capture output
108
- ($TEST_CMD) 2>&1 | tee /tmp/test-baseline.txt | tail -20
109
- ```
110
- Save the list of **pre-existing failing tests** (if any) as `BASELINE_FAILURES`. These are known failures that existed before this session — Dev must NOT be blamed for them, but must list them in COMPLETION_SIGNAL.
111
-
112
- > **⚠️ Test Output Rule**: Always capture test output to a temp file (`tee /tmp/test-out.txt`). Then grep the file instead of re-running the suite.
113
- {{END_IF_INIT_DONE}}
114
97
 
115
98
  ### Step 1: Initialize
116
99
 
@@ -182,7 +165,7 @@ If `EXISTING_CODE` is non-empty: your spec/plan/tasks must reflect this existing
182
165
  ls .prizmkit/specs/{{FEATURE_SLUG}}/spec.md .prizmkit/specs/{{FEATURE_SLUG}}/plan.md 2>/dev/null
183
166
  ```
184
167
 
185
- - spec.md missing: Run `/prizmkit-plan` → generate spec.md. Resolve any `[NEEDS CLARIFICATION]` markers using the feature description do NOT pause for interactive input.
168
+ - spec.md missing: Run `/prizmkit-plan` → generate spec.md. Resolve uncertain requirements from the feature description, existing code, and conservative existing-project patterns.
186
169
  - plan.md missing: Run `/prizmkit-plan` → generate plan.md (architecture, components, interface design, data model, testing strategy, risk assessment, and Tasks section with `[ ]` checkboxes)
187
170
 
188
171
  > All files go under `.prizmkit/specs/{{FEATURE_SLUG}}/`. Confirm each with `ls` after writing.
@@ -191,14 +174,14 @@ ls .prizmkit/specs/{{FEATURE_SLUG}}/spec.md .prizmkit/specs/{{FEATURE_SLUG}}/pla
191
174
  Before proceeding past CP-1, verify:
192
175
  1. Plan.md Data Model section references existing schema/model files (scan for `*.prisma`, `*.sql`, `migrations/`, `models/`, `*.entity.*` files; read them if not already in context-snapshot)
193
176
  2. All new tables/fields follow existing naming conventions, ID strategy, timestamp patterns, and constraint style
194
- 3. No `[NEEDS CLARIFICATION]` remains in Data Model section — resolve by reading existing code and making a conservative choice that matches existing patterns. Document the resolution in plan.md.
177
+ 3. No unresolved data model uncertainty remains in the Data Model section — resolve by reading existing code and making a conservative choice that matches existing patterns. Document the resolution in plan.md.
195
178
  4. If a DB design decision genuinely cannot be resolved from existing code alone, document the assumption made and flag it in the Implementation Log for user review.
196
179
 
197
180
  **CP-1**: Both spec.md and plan.md exist.
198
181
 
199
182
  ### Phase 3: Analyze — Reviewer Agent
200
183
 
201
- Spawn Reviewer agent (Agent tool, subagent_type="prizm-dev-team-reviewer", mode="plan", run_in_background=false).
184
+ Spawn Reviewer agent (Agent tool, subagent_type="prizm-dev-team-reviewer", mode="plan", run_in_background=false, isolation=default/no worktree). Do not request worktree isolation; this prevents AI tool-created `.claude/worktrees/...` subagent worktrees. PrizmKit pipeline-managed linked git worktrees under `.prizmkit/state/worktrees/...` are separate and controlled by `USE_WORKTREE`.
202
185
 
203
186
  Spawn failure cap: for team/config/lock errors, retry at most once for this Reviewer spawn. If the second attempt fails, do not poll for report artifacts; fix/check the plan inline or write `failure-log.md` before stopping for recovery.
204
187
 
@@ -227,7 +210,7 @@ If CRITIC:MISSING — skip Phase 3.5 entirely and proceed to Phase 4. Log: "Crit
227
210
 
228
211
  **If {{CRITIC_COUNT}} = 1 → Single Critic** (skip to CP-2.5 after this):
229
212
 
230
- Spawn Critic agent (Agent tool, subagent_type="prizm-dev-team-critic", mode="plan", run_in_background=false).
213
+ Spawn Critic agent (Agent tool, subagent_type="prizm-dev-team-critic", mode="plan", run_in_background=false, isolation=default/no worktree). Do not request worktree isolation; this prevents AI tool-created `.claude/worktrees/...` subagent worktrees. PrizmKit pipeline-managed linked git worktrees under `.prizmkit/state/worktrees/...` are separate and controlled by `USE_WORKTREE`.
231
214
 
232
215
  Spawn failure cap: for team/config/lock errors, retry at most once for this Critic spawn. If the second attempt fails, do not poll for challenge reports; perform the plan challenge inline and record the fallback.
233
216
 
@@ -235,16 +218,17 @@ Prompt:
235
218
  > "Read {{CRITIC_SUBAGENT_PATH}}. For feature {{FEATURE_ID}} (slug: {{FEATURE_SLUG}}):
236
219
  > **MODE: Plan Challenge**
237
220
  > 1. Read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` FIRST — Section 3 has TRAPS/RULES, Section 4 has file manifest.
238
- > 2. Read `.prizmkit/prizm-docs/root.prizm` and relevant L1/L2 docs for affected modules.
239
- > 3. Read existing source files in the modules this plan touches.
240
- > 4. Challenge plan.md against the project's existing architecture, patterns, and style.
221
+ > 2. Use context-snapshot.md as the shared source of truth. Do not create or enter AI tool-created `.claude/worktrees/...` subagent worktrees; use default/no worktree isolation and do not request worktree isolation.
222
+ > 3. PrizmKit pipeline-managed linked git worktrees under `.prizmkit/state/worktrees/...` are a separate runner feature controlled by `USE_WORKTREE`; do not confuse them with AI tool-created `.claude/worktrees/...`.
223
+ > 4. Read additional `.prizmkit/prizm-docs/` or source excerpts only when needed to verify a specific challenge.
224
+ > 5. Challenge plan.md against the project's existing architecture, patterns, and style.
241
225
  > Write `.prizmkit/specs/{{FEATURE_SLUG}}/challenge-report.md` with findings (or 'No significant challenges')."
242
226
 
243
227
  **If {{CRITIC_COUNT}} = 3 → Multi-Critic Voting** (skip Single Critic above):
244
228
 
245
229
  **IMPORTANT**: Spawn all 3 Critics in PARALLEL (issue all 3 Agent tool calls in the SAME message turn). Do NOT wait for one before spawning the next.
246
230
 
247
- Spawn Critic-A, Critic-B, Critic-C simultaneously (each with mode="plan", run_in_background=false):
231
+ Spawn Critic-A, Critic-B, Critic-C simultaneously (each with mode="plan", run_in_background=false, isolation=default/no worktree). Do not request worktree isolation; this prevents AI tool-created `.claude/worktrees/...` subagent worktrees. PrizmKit pipeline-managed linked git worktrees under `.prizmkit/state/worktrees/...` are separate and controlled by `USE_WORKTREE`:
248
232
 
249
233
  Critic-A prompt (append to base prompt above):
250
234
  > "**Focus Lens: Architecture & Scalability.** Prioritize: architectural pattern fit, scalability implications, over-engineering risks, component boundary design.
@@ -281,26 +265,21 @@ grep -c '^\- \[ \]' .prizmkit/specs/{{FEATURE_SLUG}}/plan.md 2>/dev/null || true
281
265
 
282
266
  **Build artifacts rule**: After any build/compile command, ensure output is in `.gitignore`. Never commit binaries/build output.
283
267
 
284
- **3a.** Detect test commands and record baseline:
285
- ```bash
286
- ($TEST_CMD) 2>&1 | tee /tmp/test-baseline.txt | tail -20
287
- ```
288
- Save pre-existing failing tests as `BASELINE_FAILURES`.
289
-
290
- **3b.** Run `/prizmkit-implement` directly — you (the orchestrator) execute the full cycle:
268
+ **3a.** Run `/prizmkit-implement` directly you (the orchestrator) execute the full cycle:
291
269
  - Read plan.md Tasks from `.prizmkit/specs/{{FEATURE_SLUG}}/`
292
270
  - Use context-snapshot.md Section 4 File Manifest for targeted reads — do NOT re-read files already summarized there
293
271
  - Implements task-by-task, marking each `[x]` immediately
294
272
  - Creates/updates L2 `.prizm` docs when creating new modules
295
273
  - Defers scoped/full test execution until after the code-review loop completes
274
+ - Preserves Reviewer/Critic behavior; only the top-level implementation Dev handoff is removed
296
275
  - If plan.md has >5 tasks: update checkpoints after every 3 tasks
297
276
 
298
- **3c. Focused checks only (no test gate here)**:
277
+ **3b. Focused checks only (no test gate here)**:
299
278
  - During implementation, do not run mandatory periodic or full-suite tests.
300
279
  - If a tiny targeted check is needed to understand a local failure, run only the smallest relevant command and capture output to `/tmp/test-out.txt`.
301
280
  - The scoped feature test gate runs after code review; do not declare implementation success based on an early full-suite run.
302
281
 
303
- **3d. Verification Gate Self-Check (BLOCKING — before declaring implement done)**:
282
+ **3c. Verification Gate Self-Check (BLOCKING — before declaring implement done)**:
304
283
  For each Verification Gate from the Task Contract, write one evidence line to Implementation Log:
305
284
  ```
306
285
  ### Gate Evidence
@@ -308,7 +287,7 @@ For each Verification Gate from the Task Contract, write one evidence line to Im
308
287
  - [ ] G3: <gate text> — BLOCKED: <reason> ← no evidence = BLOCKED, not success
309
288
  ```
310
289
 
311
- **3e.** Append `## Implementation Log` (with Gate Evidence) to `context-snapshot.md`:
290
+ **3d.** Append `## Implementation Log` (with Gate Evidence) to `context-snapshot.md`:
312
291
  - files changed/created
313
292
  - key decisions
314
293
  - deviations from plan
@@ -318,20 +297,40 @@ For each Verification Gate from the Task Contract, write one evidence line to Im
318
297
 
319
298
  **CP-2**: All tasks `[x]`, Implementation Log written with Gate Evidence, and blocked gates documented in `failure-log.md`. Test execution is deferred until after code review.
320
299
 
321
- **Checkpoint update**:
300
+ ### Review — Code Review
301
+
302
+ Review the completed implementation before the scoped feature test gate runs. Use `artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/` so the code-review skill can read spec, plan, context snapshot, implementation log, and current diff artifacts. Do not require or read a prior `/prizmkit-test` report here; test generation and test-fix looping happen in the next phase.
303
+
304
+ Run `/prizmkit-code-review` with `artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/`.
305
+
306
+ The skill runs an internal review-fix loop (Reviewer Agent → filter → orchestrator fix, max 3 rounds) and writes `review-report.md` to the artifact directory.
307
+
308
+ **Gate Check — Review Report**:
309
+ After `/prizmkit-code-review` returns, verify the review report:
322
310
  ```bash
323
- python3 $PIPELINE_DIR/scripts/update-checkpoint.py \
324
- --checkpoint-path .prizmkit/specs/{{FEATURE_SLUG}}/workflow-checkpoint.json \
325
- --step prizmkit-implement \
326
- --status completed
311
+ grep -q "## Verdict" .prizmkit/specs/{{FEATURE_SLUG}}/review-report.md && echo "GATE:PASS" || echo "GATE:MISSING"
327
312
  ```
313
+ If GATE:MISSING:
314
+ - Do not re-run `/prizmkit-code-review` in an unbounded report-repair loop.
315
+ - Perform one bounded status check; retry at most once: inspect the skill output, `review-report.md` path, and any Reviewer agent spawn messages.
316
+ - If the missing report is caused by Reviewer agent spawn or review skill error, retry `/prizmkit-code-review` at most once only if it appears transient.
317
+ - If the report is still missing after that single check/retry, write `failure-log.md` with the spawn/skill error and last observable state, then either perform a safe inline fallback review (spec/plan/diff/tests → write `review-report.md` with `## Verdict`) or stop with a clear recovery failure.
318
+
319
+ Read `review-report.md` and check the Verdict:
320
+ - `PASS` → proceed to next phase
321
+ - `NEEDS_FIXES` → the skill exhausted its max rounds; log the remaining findings and proceed (do not retry externally)
328
322
 
323
+ **CP-3**: Review complete, report written.
329
324
 
330
325
  ### Scoped Feature Test Gate — PrizmKit Test
331
326
 
332
327
  Run `/prizmkit-test scope=this-change artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/` after review and before commit.
333
328
 
334
- Before invoking the skill, create `.prizmkit/specs/{{FEATURE_SLUG}}/.prizmkit-test-started` so stale reports are ignored.
329
+ Before invoking the skill, create a current-run marker so stale reports are ignored:
330
+ ```bash
331
+ mkdir -p .prizmkit/specs/{{FEATURE_SLUG}}
332
+ touch .prizmkit/specs/{{FEATURE_SLUG}}/.prizmkit-test-started
333
+ ```
335
334
 
336
335
  Gate requirements:
337
336
  - Generate or update tests only for this feature's changed files, changed public interfaces, and acceptance criteria.
@@ -341,40 +340,6 @@ Gate requirements:
341
340
  - Only after a valid `PASS`, write the report path to `.prizmkit/specs/{{FEATURE_SLUG}}/test-report-path.txt` and append a 3-5 bullet `## PrizmKit Test Gate` summary to `context-snapshot.md`.
342
341
  - If the report verdict is `NEEDS_FIXES`, fix in-scope implementation/test issues and rerun `/prizmkit-test`. If the report is `BLOCKED`, missing, stale, or for the wrong scope/artifact dir, write `failure-log.md` and stop for recovery.
343
342
 
344
- ### Phase 5: Review — Reviewer Agent
345
-
346
- Spawn Reviewer agent (Agent tool, subagent_type="prizm-dev-team-reviewer", run_in_background=false).
347
-
348
- Spawn failure cap: for team/config/lock errors, retry at most once for this Reviewer spawn. If the second attempt fails, do not poll for `review-report.md`; write `failure-log.md` with the spawn error and last observable state before stopping or performing an inline fallback.
349
-
350
- Prompt:
351
- > "Read {{REVIEWER_SUBAGENT_PATH}}. For feature {{FEATURE_ID}} (slug: {{FEATURE_SLUG}}):
352
- > 1. Read `.prizmkit/specs/{{FEATURE_SLUG}}/spec.md` for goals and acceptance criteria
353
- > 2. Read `.prizmkit/specs/{{FEATURE_SLUG}}/plan.md` for architecture decisions and completed tasks
354
- > 3. Read `.prizmkit/specs/{{FEATURE_SLUG}}/test-report-path.txt`, then read the referenced `/prizmkit-test` report. Review generated/updated tests, `In-Scope Failures`, `Baseline Failures`, `Out of Scope Gaps`, boundary coverage if present, and the report verdict.
355
- > 4. Run /prizmkit-code-review with artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/. The skill runs an internal review-fix loop (Reviewer → filter → Dev fix, max 3 rounds) and writes review-report.md.
356
- > 5. Do NOT run test suites — the Orchestrator already ran prizmkit-test. Focus on code review and fix strategy.
357
- > Report: verdict (PASS/NEEDS_FIXES), number of rounds, findings fixed/rejected."
358
-
359
- Wait for Reviewer to return.
360
-
361
- **Gate Check — Review Report**:
362
- After Reviewer agent returns, verify the review report was written:
363
- ```bash
364
- grep -q "## Verdict" .prizmkit/specs/{{FEATURE_SLUG}}/review-report.md && echo "GATE:PASS" || echo "GATE:MISSING"
365
- ```
366
- If GATE:MISSING:
367
- - Do not re-spawn Reviewer or re-run `/prizmkit-code-review` in an unbounded report-repair loop.
368
- - Perform one bounded status check; retry at most once: inspect Reviewer output, code-review skill output, `review-report.md` path, and any Reviewer/Dev spawn messages.
369
- - If the missing report is caused by team/config/lock errors from Reviewer or the internal code-review loop, write `failure-log.md` with the spawn/skill error and last observable state.
370
- - If the report is still missing after that single check/retry, either perform a safe inline fallback review and write `review-report.md` with `## Verdict`, or stop with a clear recovery failure.
371
-
372
- Read `review-report.md` and check the Verdict:
373
- - `PASS` → proceed to next phase
374
- - `NEEDS_FIXES` → the skill exhausted its max rounds; log the remaining findings and proceed
375
-
376
- **CP-3**: Review complete.
377
-
378
343
  {{IF_BROWSER_INTERACTION}}
379
344
  ### Phase 5.5: Browser Verification — MANDATORY
380
345
 
@@ -40,20 +40,17 @@ You are the **bug fix session agent**. Fix Bug {{BUG_ID}}: "{{BUG_TITLE}}".
40
40
 
41
41
  {{GLOBAL_CONTEXT}}
42
42
 
43
- ### Project Conventions
44
-
45
- > Read {{PLATFORM_CONVENTIONS}} for project-level coding standards, architecture decisions, and development rules.
46
43
 
47
44
  ## ⚠️ Context Budget Rules (CRITICAL)
48
45
 
49
46
  0. **NON-INTERACTIVE MODE** — NEVER ask for confirmation. Proceed autonomously.
50
47
  1. **context-snapshot.md is your single source of truth** — After it is built, read context-snapshot.md instead of re-reading individual source files.
51
48
  2. **Never re-read your own writes** — Trust your write was correct.
52
- 3. **Stay focused** — Do NOT explore code unrelated to this bug.
49
+ 3. **Never re-read unmodified files** — Once you have read a file into context, do NOT read it again unless it was modified by an Edit/Write after your last read. Use `grep -n` or `sed -n` for targeted lookups instead of full-file Read. Before issuing a Read, ask: "Have I read this file before, and has it changed since?" If no — do NOT read it. Subagents must rely on context-snapshot.md rather than re-reading files the orchestrator already read.
50
+ 4. **Stay focused** — Do NOT explore code unrelated to this bug.
53
51
  4. **Minimize tool output** — Capture to temp file, scan head/tail, filter with grep/sed/awk. Never load full output.
54
52
  5. **No intermediate commits** — All changes committed once at the end via `/prizmkit-committer`.
55
53
 
56
- {{LOG_SIZE_AWARENESS}}
57
54
  ## Bug Fix Artifacts Directory
58
55
 
59
56
  ```
@@ -64,16 +61,7 @@ You are the **bug fix session agent**. Fix Bug {{BUG_ID}}: "{{BUG_TITLE}}".
64
61
  └── fix-report.md ← Final bug resolution report
65
62
  ```
66
63
 
67
- ## Workflow Checkpoint System
68
-
69
- **Path**: `{{CHECKPOINT_PATH}}`
70
-
71
- **Rules**:
72
- 1. **Before each step**: Read `workflow-checkpoint.json`, verify the previous step is `"completed"`. If not, complete it first.
73
- 2. **Starting a step**: Update to `status: "in_progress"`.
74
- 3. **After step completes**: Update to `status: "completed"`.
75
- 4. **On failure**: Set to `status: "failed"` and continue if possible.
76
- 5. **On resume**: Skip `"completed"` steps. Start from first `"pending"` or `"in_progress"` step.
64
+ {{CHECKPOINT_SYSTEM}}
77
65
 
78
66
  ---
79
67
 
@@ -138,7 +126,7 @@ Run `/prizmkit-plan` with `artifact_dir=.prizmkit/bugfix/{{BUG_ID}}/`:
138
126
  - The spec.md should capture: root cause, impact scope, behavior that must be preserved
139
127
  - The plan.md Tasks section **MUST start with a reproduction test task** — a test that FAILS with current code (RED state), proving the bug exists
140
128
  - Subsequent tasks implement the minimal fix to make the test pass (GREEN state)
141
- - Resolve any `[NEEDS CLARIFICATION]` markers autonomously do NOT pause
129
+ - Resolve uncertain fix details autonomously from the bug report, failing behavior, existing code, and conservative existing-project patterns.
142
130
 
143
131
  {{IF_BROWSER_INTERACTION}}
144
132
  - **Browser Verification**: If the bug is UI-reproducible, plan.md should reference the Browser Verification Protocol above instead of redefining browser steps.
@@ -192,7 +180,7 @@ After implement completes, verify:
192
180
  If `FAST_PATH=true` (≤ 2 tasks, obvious root cause), skip this phase entirely.
193
181
 
194
182
  Run `/prizmkit-code-review` with `artifact_dir=.prizmkit/bugfix/{{BUG_ID}}/`:
195
- - The skill runs an internal review-fix loop (Reviewer → filter → Dev fix, max 3 rounds) and writes `review-report.md`
183
+ - The skill runs an internal review-fix loop (Reviewer → filter → orchestrator fix, max 3 rounds) and writes `review-report.md`
196
184
  - `review-report.md` must contain `## Verdict`
197
185
 
198
186
  **Gate Check — Review Report**: