prizmkit 1.1.105 → 1.1.107

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 (36) hide show
  1. package/bundled/VERSION.json +3 -3
  2. package/bundled/dev-pipeline/prizmkit_runtime/gitops.py +0 -1
  3. package/bundled/dev-pipeline/prizmkit_runtime/runner_bookkeeping.py +83 -12
  4. package/bundled/dev-pipeline/prizmkit_runtime/runner_classification.py +93 -6
  5. package/bundled/dev-pipeline/prizmkit_runtime/runner_models.py +0 -8
  6. package/bundled/dev-pipeline/prizmkit_runtime/runner_recovery.py +9 -1
  7. package/bundled/dev-pipeline/prizmkit_runtime/runners.py +421 -61
  8. package/bundled/dev-pipeline/prizmkit_runtime/sessions.py +102 -17
  9. package/bundled/dev-pipeline/scripts/continuation.py +0 -4
  10. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +7 -39
  11. package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +1 -31
  12. package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +1 -31
  13. package/bundled/dev-pipeline/templates/agent-prompts/reviewer-review.md +5 -6
  14. package/bundled/dev-pipeline/templates/bootstrap-tier1.md +28 -28
  15. package/bundled/dev-pipeline/templates/bootstrap-tier2.md +36 -52
  16. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +34 -54
  17. package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +1 -1
  18. package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +3 -3
  19. package/bundled/dev-pipeline/templates/sections/context-budget-rules.md +2 -3
  20. package/bundled/dev-pipeline/templates/sections/log-size-awareness.md +2 -2
  21. package/bundled/dev-pipeline/templates/sections/phase-implement-agent.md +4 -9
  22. package/bundled/dev-pipeline/templates/sections/phase-implement-full.md +4 -10
  23. package/bundled/dev-pipeline/templates/sections/phase-review-agent.md +3 -3
  24. package/bundled/dev-pipeline/templates/sections/phase-review-full.md +3 -3
  25. package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +49 -2
  26. package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +17 -0
  27. package/bundled/dev-pipeline/tests/test_generate_refactor_prompt.py +50 -1
  28. package/bundled/dev-pipeline/tests/test_python_runner_parity.py +560 -1
  29. package/bundled/dev-pipeline/tests/test_unified_cli.py +208 -0
  30. package/bundled/skills/_metadata.json +1 -1
  31. package/bundled/skills/prizmkit-code-review/SKILL.md +12 -13
  32. package/bundled/skills/prizmkit-code-review/references/reviewer-agent-prompt.md +10 -10
  33. package/package.json +1 -1
  34. package/bundled/dev-pipeline/templates/agent-prompts/dev-fix.md +0 -7
  35. package/bundled/dev-pipeline/templates/agent-prompts/dev-resume.md +0 -5
  36. package/bundled/skills/prizmkit-code-review/references/dev-agent-prompt.md +0 -30
@@ -56,12 +56,11 @@ You are running in **headless non-interactive mode** with a FINITE context windo
56
56
  4. **One task at a time** — In Phase 4 (implement), complete and test one task before starting the next.
57
57
  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
58
  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.
59
+ 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.
60
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 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
 
@@ -102,13 +101,11 @@ If any agent times out:
102
101
 
103
102
  ### Phase 0.5: Detect Test Commands
104
103
 
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`.
104
+ 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`.
105
+
106
+ Do not run tests in this phase. Test execution happens after code review in the scoped PrizmKit Test gate.
110
107
 
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.
108
+ > **Test Output Rule**: When the post-review gate runs, capture test output to a temp file (`tee /tmp/test-out.txt`). Then grep the file instead of re-running the suite.
112
109
 
113
110
  ### Phase 1: Build Context Snapshot (you, the orchestrator)
114
111
 
@@ -280,25 +277,21 @@ grep -c '^\- \[ \]' .prizmkit/specs/{{FEATURE_SLUG}}/plan.md 2>/dev/null || true
280
277
 
281
278
  **Build artifacts rule**: After any build/compile command, ensure output is in `.gitignore`. Never commit binaries/build output.
282
279
 
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:
280
+ **3a.** Run `/prizmkit-implement` directly you (the orchestrator) execute the full cycle:
289
281
  - Read plan.md Tasks from `.prizmkit/specs/{{FEATURE_SLUG}}/`
290
282
  - Use context-snapshot.md Section 4 File Manifest for targeted reads — do NOT re-read files already summarized there
291
283
  - Implements task-by-task, marking each `[x]` immediately
292
284
  - Creates/updates L2 `.prizm` docs when creating new modules
293
285
  - Defers scoped/full test execution until after the code-review loop completes
286
+ - Preserves Reviewer/Critic behavior; only the top-level implementation Dev handoff is removed
294
287
  - If plan.md has >5 tasks: update checkpoints after every 3 tasks
295
288
 
296
- **3c. Focused checks only (no test gate here)**:
289
+ **3b. Focused checks only (no test gate here)**:
297
290
  - During implementation, do not run mandatory periodic or full-suite tests.
298
291
  - 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
292
  - The scoped feature test gate runs after code review; do not declare implementation success based on an early full-suite run.
300
293
 
301
- **3d. Verification Gate Self-Check (BLOCKING — before declaring implement done)**:
294
+ **3c. Verification Gate Self-Check (BLOCKING — before declaring implement done)**:
302
295
  For each Verification Gate from the Task Contract, write one evidence line to Implementation Log:
303
296
  ```
304
297
  ### Gate Evidence
@@ -306,7 +299,7 @@ For each Verification Gate from the Task Contract, write one evidence line to Im
306
299
  - [ ] G3: <gate text> — BLOCKED: <reason> ← no evidence = BLOCKED, not success
307
300
  ```
308
301
 
309
- **3e.** Append `## Implementation Log` (with Gate Evidence) to `context-snapshot.md`:
302
+ **3d.** Append `## Implementation Log` (with Gate Evidence) to `context-snapshot.md`:
310
303
  - files changed/created
311
304
  - key decisions
312
305
  - deviations from plan
@@ -325,53 +318,44 @@ python3 $PIPELINE_DIR/scripts/update-checkpoint.py \
325
318
  ```
326
319
 
327
320
 
328
- ### Scoped Feature Test Gate PrizmKit Test
329
-
330
- Run `/prizmkit-test scope=this-change artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/` after review and before commit.
331
-
332
- Before invoking the skill, create `.prizmkit/specs/{{FEATURE_SLUG}}/.prizmkit-test-started` so stale reports are ignored.
333
-
334
- Gate requirements:
335
- - Generate or update tests only for this feature's changed files, changed public interfaces, and acceptance criteria.
336
- - Do NOT use `.prizmkit/bugfix/` or `.prizmkit/refactor/` artifact directories.
337
- - Record unrelated historical gaps under `Out of Scope Gaps`; do not generate tests for them and do not fail this feature because of them.
338
- - Accept only a current-run `.prizmkit/test/*/test-report.md` whose `Scope` mode is `this-change`, whose `Artifact Dir` matches `.prizmkit/specs/{{FEATURE_SLUG}}/`, whose `Verdict` is `PASS`, whose `Boundary Completion Gate` reports `Completion gate passed: yes` with zero `Boundary-missing` and zero `Happy-path-only`, and whose `Boundary Validation` result is `passed`.
339
- - 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
- - 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
-
342
- ### Phase 5: Review — Reviewer Subagent
343
-
344
- Spawn Reviewer subagent (Agent tool, subagent_type="prizm-dev-team-reviewer", run_in_background=false).
321
+ ### ReviewCode Review
345
322
 
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.
323
+ 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.
347
324
 
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."
325
+ Run `/prizmkit-code-review` with `artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/`.
356
326
 
357
- Wait for Reviewer to return.
327
+ 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.
358
328
 
359
329
  **Gate Check — Review Report**:
360
- After Reviewer agent returns, verify the review report was written:
330
+ After `/prizmkit-code-review` returns, verify the review report:
361
331
  ```bash
362
332
  grep -q "## Verdict" .prizmkit/specs/{{FEATURE_SLUG}}/review-report.md && echo "GATE:PASS" || echo "GATE:MISSING"
363
333
  ```
364
334
  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.
335
+ - Do not re-run `/prizmkit-code-review` in an unbounded report-repair loop.
336
+ - Perform one bounded status check; retry at most once: inspect the skill output, `review-report.md` path, and any Reviewer agent spawn messages.
337
+ - 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.
338
+ - 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.
369
339
 
370
340
  Read `review-report.md` and check the Verdict:
371
341
  - `PASS` → proceed to next phase
372
- - `NEEDS_FIXES` → the skill exhausted its max rounds; log the remaining findings and proceed
342
+ - `NEEDS_FIXES` → the skill exhausted its max rounds; log the remaining findings and proceed (do not retry externally)
343
+
344
+ **CP-3**: Review complete, report written.
345
+
346
+ ### Scoped Feature Test Gate — PrizmKit Test
347
+
348
+ Run `/prizmkit-test scope=this-change artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/` after review and before commit.
373
349
 
374
- **CP-3**: Review complete.
350
+ Before invoking the skill, create `.prizmkit/specs/{{FEATURE_SLUG}}/.prizmkit-test-started` so stale reports are ignored.
351
+
352
+ Gate requirements:
353
+ - Generate or update tests only for this feature's changed files, changed public interfaces, and acceptance criteria.
354
+ - Do NOT use `.prizmkit/bugfix/` or `.prizmkit/refactor/` artifact directories.
355
+ - Record unrelated historical gaps under `Out of Scope Gaps`; do not generate tests for them and do not fail this feature because of them.
356
+ - Accept only a current-run `.prizmkit/test/*/test-report.md` whose `Scope` mode is `this-change`, whose `Artifact Dir` matches `.prizmkit/specs/{{FEATURE_SLUG}}/`, whose `Verdict` is `PASS`, whose `Boundary Completion Gate` reports `Completion gate passed: yes` with zero `Boundary-missing` and zero `Happy-path-only`, and whose `Boundary Validation` result is `passed`.
357
+ - 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`.
358
+ - 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.
375
359
 
376
360
  {{IF_BROWSER_INTERACTION}}
377
361
  ### Phase 5.5: Browser Verification — MANDATORY
@@ -60,8 +60,7 @@ You are running in **headless non-interactive mode** with a FINITE context windo
60
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
 
@@ -98,18 +97,13 @@ If any agent times out:
98
97
  - **CP-0**: Verify `.prizmkit/prizm-docs/root.prizm`, `.prizmkit/config.json` exist
99
98
  {{END_IF_INIT_NEEDED}}
100
99
  {{IF_INIT_DONE}}
101
- ### Phase 0: Record Test Baseline & Detect Test Commands
100
+ ### Phase 0: Detect Test Commands
102
101
 
103
102
  **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
103
 
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.
104
+ **Step 2 — Do not run tests yet**: This phase only records the commands that will be used by the post-review PrizmKit Test gate. Test execution happens after code review.
111
105
 
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.
106
+ > **Test Output Rule**: When the post-review gate runs, capture test output to a temp file (`tee /tmp/test-out.txt`). Then grep the file instead of re-running the suite.
113
107
  {{END_IF_INIT_DONE}}
114
108
 
115
109
  ### Step 1: Initialize
@@ -281,26 +275,21 @@ grep -c '^\- \[ \]' .prizmkit/specs/{{FEATURE_SLUG}}/plan.md 2>/dev/null || true
281
275
 
282
276
  **Build artifacts rule**: After any build/compile command, ensure output is in `.gitignore`. Never commit binaries/build output.
283
277
 
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:
278
+ **3a.** Run `/prizmkit-implement` directly you (the orchestrator) execute the full cycle:
291
279
  - Read plan.md Tasks from `.prizmkit/specs/{{FEATURE_SLUG}}/`
292
280
  - Use context-snapshot.md Section 4 File Manifest for targeted reads — do NOT re-read files already summarized there
293
281
  - Implements task-by-task, marking each `[x]` immediately
294
282
  - Creates/updates L2 `.prizm` docs when creating new modules
295
283
  - Defers scoped/full test execution until after the code-review loop completes
284
+ - Preserves Reviewer/Critic behavior; only the top-level implementation Dev handoff is removed
296
285
  - If plan.md has >5 tasks: update checkpoints after every 3 tasks
297
286
 
298
- **3c. Focused checks only (no test gate here)**:
287
+ **3b. Focused checks only (no test gate here)**:
299
288
  - During implementation, do not run mandatory periodic or full-suite tests.
300
289
  - 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
290
  - The scoped feature test gate runs after code review; do not declare implementation success based on an early full-suite run.
302
291
 
303
- **3d. Verification Gate Self-Check (BLOCKING — before declaring implement done)**:
292
+ **3c. Verification Gate Self-Check (BLOCKING — before declaring implement done)**:
304
293
  For each Verification Gate from the Task Contract, write one evidence line to Implementation Log:
305
294
  ```
306
295
  ### Gate Evidence
@@ -308,7 +297,7 @@ For each Verification Gate from the Task Contract, write one evidence line to Im
308
297
  - [ ] G3: <gate text> — BLOCKED: <reason> ← no evidence = BLOCKED, not success
309
298
  ```
310
299
 
311
- **3e.** Append `## Implementation Log` (with Gate Evidence) to `context-snapshot.md`:
300
+ **3d.** Append `## Implementation Log` (with Gate Evidence) to `context-snapshot.md`:
312
301
  - files changed/created
313
302
  - key decisions
314
303
  - deviations from plan
@@ -327,53 +316,44 @@ python3 $PIPELINE_DIR/scripts/update-checkpoint.py \
327
316
  ```
328
317
 
329
318
 
330
- ### Scoped Feature Test Gate PrizmKit Test
319
+ ### ReviewCode Review
331
320
 
332
- Run `/prizmkit-test scope=this-change artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/` after review and before commit.
321
+ 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.
333
322
 
334
- Before invoking the skill, create `.prizmkit/specs/{{FEATURE_SLUG}}/.prizmkit-test-started` so stale reports are ignored.
323
+ Run `/prizmkit-code-review` with `artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/`.
335
324
 
336
- Gate requirements:
337
- - Generate or update tests only for this feature's changed files, changed public interfaces, and acceptance criteria.
338
- - Do NOT use `.prizmkit/bugfix/` or `.prizmkit/refactor/` artifact directories.
339
- - Record unrelated historical gaps under `Out of Scope Gaps`; do not generate tests for them and do not fail this feature because of them.
340
- - Accept only a current-run `.prizmkit/test/*/test-report.md` whose `Scope` mode is `this-change`, whose `Artifact Dir` matches `.prizmkit/specs/{{FEATURE_SLUG}}/`, whose `Verdict` is `PASS`, whose `Boundary Completion Gate` reports `Completion gate passed: yes` with zero `Boundary-missing` and zero `Happy-path-only`, and whose `Boundary Validation` result is `passed`.
341
- - 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
- - 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
-
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.
325
+ 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.
360
326
 
361
327
  **Gate Check — Review Report**:
362
- After Reviewer agent returns, verify the review report was written:
328
+ After `/prizmkit-code-review` returns, verify the review report:
363
329
  ```bash
364
330
  grep -q "## Verdict" .prizmkit/specs/{{FEATURE_SLUG}}/review-report.md && echo "GATE:PASS" || echo "GATE:MISSING"
365
331
  ```
366
332
  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.
333
+ - Do not re-run `/prizmkit-code-review` in an unbounded report-repair loop.
334
+ - Perform one bounded status check; retry at most once: inspect the skill output, `review-report.md` path, and any Reviewer agent spawn messages.
335
+ - 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.
336
+ - 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.
371
337
 
372
338
  Read `review-report.md` and check the Verdict:
373
339
  - `PASS` → proceed to next phase
374
- - `NEEDS_FIXES` → the skill exhausted its max rounds; log the remaining findings and proceed
340
+ - `NEEDS_FIXES` → the skill exhausted its max rounds; log the remaining findings and proceed (do not retry externally)
341
+
342
+ **CP-3**: Review complete, report written.
343
+
344
+ ### Scoped Feature Test Gate — PrizmKit Test
345
+
346
+ Run `/prizmkit-test scope=this-change artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/` after review and before commit.
375
347
 
376
- **CP-3**: Review complete.
348
+ Before invoking the skill, create `.prizmkit/specs/{{FEATURE_SLUG}}/.prizmkit-test-started` so stale reports are ignored.
349
+
350
+ Gate requirements:
351
+ - Generate or update tests only for this feature's changed files, changed public interfaces, and acceptance criteria.
352
+ - Do NOT use `.prizmkit/bugfix/` or `.prizmkit/refactor/` artifact directories.
353
+ - Record unrelated historical gaps under `Out of Scope Gaps`; do not generate tests for them and do not fail this feature because of them.
354
+ - Accept only a current-run `.prizmkit/test/*/test-report.md` whose `Scope` mode is `this-change`, whose `Artifact Dir` matches `.prizmkit/specs/{{FEATURE_SLUG}}/`, whose `Verdict` is `PASS`, whose `Boundary Completion Gate` reports `Completion gate passed: yes` with zero `Boundary-missing` and zero `Happy-path-only`, and whose `Boundary Validation` result is `passed`.
355
+ - 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`.
356
+ - 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.
377
357
 
378
358
  {{IF_BROWSER_INTERACTION}}
379
359
  ### Phase 5.5: Browser Verification — MANDATORY
@@ -192,7 +192,7 @@ After implement completes, verify:
192
192
  If `FAST_PATH=true` (≤ 2 tasks, obvious root cause), skip this phase entirely.
193
193
 
194
194
  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`
195
+ - The skill runs an internal review-fix loop (Reviewer → filter → orchestrator fix, max 3 rounds) and writes `review-report.md`
196
196
  - `review-report.md` must contain `## Verdict`
197
197
 
198
198
  **Gate Check — Review Report**:
@@ -204,7 +204,7 @@ Evidence must cover affected UI render, primary user interactions, behavior-sens
204
204
  Prompt: "Read {{REVIEWER_SUBAGENT_PATH}}. For refactor {{REFACTOR_ID}}:
205
205
  1. Read `.prizmkit/refactor/{{REFACTOR_ID}}/spec.md` for goals and behavior preservation contracts
206
206
  2. Read `.prizmkit/refactor/{{REFACTOR_ID}}/plan.md` for architecture decisions and completed tasks
207
- 3. Run `/prizmkit-code-review` with artifact_dir=.prizmkit/refactor/{{REFACTOR_ID}}/. The skill runs an internal review-fix loop (Reviewer → filter → Dev fix, max 3 rounds) and writes review-report.md.
207
+ 3. Run `/prizmkit-code-review` with artifact_dir=.prizmkit/refactor/{{REFACTOR_ID}}/. The skill runs an internal review-fix loop (Reviewer → filter → orchestrator fix, max 3 rounds) and writes review-report.md.
208
208
  4. Run full test suite and verify ALL tests pass
209
209
 
210
210
  {{IF_BROWSER_INTERACTION}}
@@ -224,8 +224,8 @@ Evidence must cover affected UI render, primary user interactions, behavior-sens
224
224
  ```
225
225
  If GATE:MISSING:
226
226
  - Do not enter an unbounded report-repair loop and do not repeatedly re-spawn Reviewer.
227
- - Perform one bounded status check; retry at most once: inspect the Reviewer output, `review-report.md` path, and any internal Reviewer/Dev spawn messages from `/prizmkit-code-review`.
228
- - If the missing report is caused by team/config/lock errors from the Reviewer or internal Reviewer/Dev agent spawn, retry the Reviewer agent at most once only if it appears transient.
227
+ - Perform one bounded status check; retry at most once: inspect the Reviewer output, `review-report.md` path, and any internal Reviewer agent spawn messages from `/prizmkit-code-review`.
228
+ - If the missing report is caused by team/config/lock errors from the Reviewer or internal Reviewer agent spawn, retry the Reviewer agent at most once only if it appears transient.
229
229
  - If the report is still missing after that single check/retry, write `.prizmkit/refactor/{{REFACTOR_ID}}/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.
230
230
 
231
231
  Read `review-report.md` and check the Verdict:
@@ -10,7 +10,7 @@ You are running in **headless non-interactive mode** with a FINITE context windo
10
10
  4. **One task at a time** — Complete and test one task before starting the next.
11
11
  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.
12
12
  6. **No intermediate commits** — Do NOT run `git add`/`git commit` during implementation phases. All changes are committed once at the end via `/prizmkit-committer`.
13
- 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.
13
+ 7. **Capture test output once** — When running test suites during the post-review gate, capture with `<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.
14
14
  8. **Scaffold / generated file awareness (CRITICAL)** — When you run a scaffolding tool or package manager init command (`npm init`, `npx create-*`, `vite create`, `cargo init`, `go mod init`, `rails new`, `django-admin startproject`, `npx shadcn-ui init`, etc.), the output files are **generated boilerplate**. You MUST:
15
15
  - Identify and mentally tag all files created by the tool as "scaffold files"
16
16
  - Record the list of scaffold-generated files in context-snapshot.md under a `### Scaffold Files (do not re-read)` section
@@ -32,5 +32,4 @@ You are running in **headless non-interactive mode** with a FINITE context windo
32
32
  - **This is a BLOCKING gate**: do NOT run `npm install` / `pip install` / `cargo build` / `go mod tidy` until ALL versions in the manifest have been verified or use open constraints
33
33
  - Batch version lookups: query multiple packages in parallel to save time (e.g., run multiple `npm view` commands concurrently)
34
34
  10. **Build artifact hygiene** — After any build/compile command (`go build`, `npm run build`, `tsc`, etc.), ensure the output binary, build directory, generated bundle, or cache directory is ignored by git before the commit phase. Never commit compiled binaries, build output, or generated artifacts.
35
- 11. **Anti re-read hard rule (BLOCKING)** — Re-reading the same file is the #1 context burner in long sessions. Once you have read a file into context (directly or via context-snapshot.md Section 4), do NOT read the full file again. Instead 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. Never full-file Read a file already summarized in context-snapshot.md Section 4.
36
- 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.
35
+ 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.
@@ -1,12 +1,12 @@
1
- ## Session Log Budget Awareness (CHECKPOINT GUIDANCE)
1
+ ## Session Checkpoint Awareness (CHECKPOINT GUIDANCE)
2
2
 
3
3
  This section provides passive checkpoint guidance for checkpoint/continuation only. Context-saving rules (anti re-read, output filtering) live in Context Budget Rules above — do not duplicate.
4
4
 
5
5
  ### Checkpoint Before Large Work Batches
6
6
 
7
- - `MAX_LOG_SIZE` controls whether this advisory section is included.
8
7
  - Before major phases or large task batches, update durable artifacts: plan/task checkboxes, context snapshots, implementation/review notes, workflow checkpoints, session status, test reports.
9
8
  - Checkpoint often so automatic continuation can resume from durable state.
9
+ - Capture targeted output summaries instead of pasting large raw logs into the conversation.
10
10
 
11
11
  ### Headless Recovery Source of Truth
12
12
 
@@ -11,12 +11,7 @@ grep -c '^\- \[ \]' .prizmkit/specs/{{FEATURE_SLUG}}/plan.md 2>/dev/null || true
11
11
 
12
12
  **Build artifacts rule**: After any build/compile command, ensure output is in `.gitignore`. Never commit binaries/build output.
13
13
 
14
- **3a.** Detect test commands and record baseline:
15
- ```bash
16
- ($TEST_CMD) 2>&1 | tee /tmp/test-baseline.txt | tail -20
17
- ```
18
-
19
- **3b.** Run `/prizmkit-implement` directly — you (the orchestrator) execute the full cycle:
14
+ **3a.** Run `/prizmkit-implement` directly you (the orchestrator) execute the full cycle:
20
15
  - Read plan.md Tasks from `.prizmkit/specs/{{FEATURE_SLUG}}/`
21
16
  - Use context-snapshot.md Section 4 File Manifest for targeted reads — do NOT re-read files already summarized there
22
17
  - Implements task-by-task, marking each `[x]` immediately
@@ -25,12 +20,12 @@ grep -c '^\- \[ \]' .prizmkit/specs/{{FEATURE_SLUG}}/plan.md 2>/dev/null || true
25
20
  - Preserves Reviewer/Critic behavior; only the top-level implementation Dev handoff is removed
26
21
  - If plan.md has >5 tasks: update checkpoints after every 3 tasks
27
22
 
28
- **3c. Focused checks only (no test gate here)**:
23
+ **3b. Focused checks only (no test gate here)**:
29
24
  - During implementation, do not run mandatory periodic or full-suite tests.
30
25
  - 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`.
31
26
  - The scoped feature test gate runs after code review; do not declare implementation success based on an early full-suite run.
32
27
 
33
- **3d. Verification Gate Self-Check (BLOCKING — before declaring implement done)**:
28
+ **3c. Verification Gate Self-Check (BLOCKING — before declaring implement done)**:
34
29
  For each Verification Gate from the Task Contract, write one evidence line to Implementation Log:
35
30
  ```
36
31
  ### Gate Evidence
@@ -38,7 +33,7 @@ For each Verification Gate from the Task Contract, write one evidence line to Im
38
33
  - [ ] G3: <gate text> — BLOCKED: <reason> ← no evidence = BLOCKED, not success
39
34
  ```
40
35
 
41
- **3e.** Append `## Implementation Log` (with Gate Evidence) to `context-snapshot.md`:
36
+ **3d.** Append `## Implementation Log` (with Gate Evidence) to `context-snapshot.md`:
42
37
  - files changed/created
43
38
  - key decisions
44
39
  - deviations from plan
@@ -11,13 +11,7 @@ grep -c '^\- \[ \]' .prizmkit/specs/{{FEATURE_SLUG}}/plan.md 2>/dev/null || true
11
11
 
12
12
  **Build artifacts rule**: After any build/compile command, ensure output is in `.gitignore`. Never commit binaries/build output.
13
13
 
14
- **3a.** Detect test commands and record baseline:
15
- ```bash
16
- ($TEST_CMD) 2>&1 | tee /tmp/test-baseline.txt | tail -20
17
- ```
18
- Save pre-existing failing tests as `BASELINE_FAILURES`.
19
-
20
- **3b.** Run `/prizmkit-implement` directly — you (the orchestrator) execute the full cycle:
14
+ **3a.** Run `/prizmkit-implement` directly you (the orchestrator) execute the full cycle:
21
15
  - Read plan.md Tasks from `.prizmkit/specs/{{FEATURE_SLUG}}/`
22
16
  - Use context-snapshot.md Section 4 File Manifest for targeted reads — do NOT re-read files already summarized there
23
17
  - Implements task-by-task, marking each `[x]` immediately
@@ -26,12 +20,12 @@ Save pre-existing failing tests as `BASELINE_FAILURES`.
26
20
  - Preserves Reviewer/Critic behavior; only the top-level implementation Dev handoff is removed
27
21
  - If plan.md has >5 tasks: update checkpoints after every 3 tasks
28
22
 
29
- **3c. Focused checks only (no test gate here)**:
23
+ **3b. Focused checks only (no test gate here)**:
30
24
  - During implementation, do not run mandatory periodic or full-suite tests.
31
25
  - 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`.
32
26
  - The scoped feature test gate runs after code review; do not declare implementation success based on an early full-suite run.
33
27
 
34
- **3d. Verification Gate Self-Check (BLOCKING — before declaring implement done)**:
28
+ **3c. Verification Gate Self-Check (BLOCKING — before declaring implement done)**:
35
29
  For each Verification Gate from the Task Contract, write one evidence line to Implementation Log:
36
30
  ```
37
31
  ### Gate Evidence
@@ -39,7 +33,7 @@ For each Verification Gate from the Task Contract, write one evidence line to Im
39
33
  - [ ] G3: <gate text> — BLOCKED: <reason> ← no evidence = BLOCKED, not success
40
34
  ```
41
35
 
42
- **3e.** Append `## Implementation Log` (with Gate Evidence) to `context-snapshot.md`:
36
+ **3d.** Append `## Implementation Log` (with Gate Evidence) to `context-snapshot.md`:
43
37
  - files changed/created
44
38
  - key decisions
45
39
  - deviations from plan
@@ -4,7 +4,7 @@ Review the completed implementation before the scoped feature test gate runs. Us
4
4
 
5
5
  Run `/prizmkit-code-review` with `artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/`.
6
6
 
7
- The skill runs an internal review-fix loop (Reviewer Agent → filter → Dev Agent fix, max 3 rounds) and writes `review-report.md` to the artifact directory.
7
+ 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.
8
8
 
9
9
  **Gate Check — Review Report**:
10
10
  After `/prizmkit-code-review` returns, verify the review report:
@@ -13,8 +13,8 @@ grep -q "## Verdict" .prizmkit/specs/{{FEATURE_SLUG}}/review-report.md && echo "
13
13
  ```
14
14
  If GATE:MISSING:
15
15
  - Do not re-run `/prizmkit-code-review` in an unbounded report-repair loop.
16
- - Perform one bounded status check; retry at most once: inspect the skill output, `review-report.md` path, and any Reviewer/Dev spawn messages.
17
- - If the missing report is caused by team/config/lock errors from the internal Reviewer/Dev agent spawn, retry `/prizmkit-code-review` at most once only if it appears transient.
16
+ - Perform one bounded status check; retry at most once: inspect the skill output, `review-report.md` path, and any Reviewer agent spawn messages.
17
+ - If the missing report is caused by team/config/lock errors from the Reviewer agent spawn or review skill error, retry `/prizmkit-code-review` at most once only if it appears transient.
18
18
  - 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.
19
19
 
20
20
  Read `review-report.md` and check the Verdict:
@@ -4,7 +4,7 @@ Review the completed implementation before the scoped feature test gate runs. Us
4
4
 
5
5
  Run `/prizmkit-code-review` with `artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/`.
6
6
 
7
- The skill runs an internal review-fix loop (Reviewer Agent → filter → Dev Agent fix, max 3 rounds) and writes `review-report.md` to the artifact directory.
7
+ 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.
8
8
 
9
9
  **Gate Check — Review Report**:
10
10
  After `/prizmkit-code-review` returns, verify the review report:
@@ -13,8 +13,8 @@ grep -q "## Verdict" .prizmkit/specs/{{FEATURE_SLUG}}/review-report.md && echo "
13
13
  ```
14
14
  If GATE:MISSING:
15
15
  - Do not re-run `/prizmkit-code-review` in an unbounded report-repair loop.
16
- - Perform one bounded status check; retry at most once: inspect the skill output, `review-report.md` path, and any Reviewer/Dev spawn messages.
17
- - If the missing report is caused by team/config/lock errors from the internal Reviewer/Dev agent spawn, retry `/prizmkit-code-review` at most once only if it appears transient.
16
+ - Perform one bounded status check; retry at most once: inspect the skill output, `review-report.md` path, and any Reviewer agent spawn messages.
17
+ - If the missing report is caused by team/config/lock errors from the Reviewer agent spawn or review skill error, retry `/prizmkit-code-review` at most once only if it appears transient.
18
18
  - 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.
19
19
 
20
20
  Read `review-report.md` and check the Verdict: