prizmkit 1.1.128 → 1.1.129

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/bundled/VERSION.json +3 -3
  2. package/bundled/dev-pipeline/prizmkit_runtime/gitops.py +88 -58
  3. package/bundled/dev-pipeline/prizmkit_runtime/reset.py +4 -3
  4. package/bundled/dev-pipeline/prizmkit_runtime/runner_bookkeeping.py +53 -1
  5. package/bundled/dev-pipeline/prizmkit_runtime/runners.py +33 -17
  6. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +28 -26
  7. package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +1 -1
  8. package/bundled/dev-pipeline/scripts/generate-recovery-prompt.py +3 -2
  9. package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +1 -1
  10. package/bundled/dev-pipeline/scripts/parse-stream-progress.py +3 -3
  11. package/bundled/dev-pipeline/templates/bootstrap-prompt.md +2 -2
  12. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +20 -19
  13. package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +2 -2
  14. package/bundled/dev-pipeline/templates/sections/bugfix-mission.md +1 -1
  15. package/bundled/dev-pipeline/templates/sections/bugfix-phase-review.md +10 -2
  16. package/bundled/dev-pipeline/templates/sections/context-budget-rules.md +1 -1
  17. package/bundled/dev-pipeline/templates/sections/directory-convention-agent.md +3 -2
  18. package/bundled/dev-pipeline/templates/sections/directory-convention-full.md +3 -2
  19. package/bundled/dev-pipeline/templates/sections/phase-commit-full.md +1 -1
  20. package/bundled/dev-pipeline/templates/sections/phase-commit.md +1 -1
  21. package/bundled/dev-pipeline/templates/sections/phase-implement-agent.md +1 -1
  22. package/bundled/dev-pipeline/templates/sections/phase-implement-full.md +1 -1
  23. package/bundled/dev-pipeline/templates/sections/phase-review-agent.md +11 -3
  24. package/bundled/dev-pipeline/templates/sections/phase-review-full.md +11 -3
  25. package/bundled/dev-pipeline/templates/sections/phase-specify-plan-full.md +1 -1
  26. package/bundled/dev-pipeline/templates/sections/phase0-init.md +1 -1
  27. package/bundled/dev-pipeline/templates/sections/refactor-mission.md +1 -1
  28. package/bundled/dev-pipeline/templates/sections/refactor-phase-review.md +11 -3
  29. package/bundled/dev-pipeline/templates/sections/refactor-reminders.md +1 -1
  30. package/bundled/dev-pipeline/templates/sections/subagent-timeout-recovery.md +6 -4
  31. package/bundled/dev-pipeline/templates/sections/test-failure-recovery-agent.md +1 -1
  32. package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +98 -3
  33. package/bundled/dev-pipeline/tests/test_python_runner_parity.py +139 -11
  34. package/bundled/dev-pipeline/tests/test_unified_cli.py +215 -9
  35. package/bundled/skills/_metadata.json +1 -1
  36. package/bundled/skills/feature-planner/SKILL.md +2 -2
  37. package/bundled/skills/prizmkit/SKILL.md +1 -1
  38. package/bundled/skills/prizmkit-code-review/SKILL.md +10 -1
  39. package/package.json +1 -1
  40. package/src/manifest.js +8 -3
@@ -30,7 +30,7 @@ Infer what needs to be done from the feature context above and follow the standa
30
30
 
31
31
  3. **Implement**: Run `/prizmkit-implement` with `artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/` to execute the plan using TDD (write tests first, then implement).
32
32
 
33
- 4. **Review**: Run `/prizmkit-code-review` with `artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/`. The Main Agent reviews the complete current change for up to ten rounds, directly repairs accepted findings, verifies repairs, and converges when accepted and unresolved findings are both zero. Do not spawn a code-review-specific subagent. Require the last `## Final Result` verdict before continuing.
33
+ 4. **Review**: Run `/prizmkit-code-review` with `artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/`. The current Main Agent is the only Code Review executor. It reviews the complete current change for up to ten rounds, directly repairs accepted findings, verifies repairs, and converges when accepted and unresolved findings are both zero. Do not delegate review directly or indirectly, invoke another review skill/workflow, or relabel delegated work as a finder, verifier, audit, compatibility review, verification, or gap sweep. `review-report.md` is the only persisted review artifact. Require the last `## Final Result` verdict before continuing.
34
34
 
35
35
  5. **Test**: Run `/prizmkit-test scope=this-change artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/` to generate and verify tests only for this feature's changed scope after review. Do not use bugfix/refactor artifact directories for this gate.
36
36
 
@@ -44,7 +44,7 @@ Infer what needs to be done from the feature context above and follow the standa
44
44
  - Do NOT push to remote — the user will push manually.
45
45
  - Write all artifacts to `.prizmkit/specs/{{FEATURE_SLUG}}/`.
46
46
  - If a step fails after 3 attempts, write a status report and stop.
47
- - **Never re-read unmodified files**: once you 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`/`sed -n` for specific lines. Before issuing a Read, ask: "Have I read this file before, and has it changed since?" If no — do NOT read it. Reviewer subagents must rely on context-snapshot.md rather than re-reading files the orchestrator already read.
47
+ - **Never re-read unmodified files**: once you 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`/`sed -n` for specific lines. Before issuing a Read, ask: "Have I read this file before, and has it changed since?" If no — do NOT read it. Normal work delegation outside Code Review must rely on context-snapshot.md rather than re-reading files the Main Agent already read. Code Review runs only in the current Main Agent.
48
48
  - **Read offset safety**: if Read returns "shorter than offset"/"empty" — run `wc -l` then `sed -n`, do NOT retry same offset.
49
49
  - **Hard Round Cap**: after 6 total test-fix rounds, STOP trial-and-error. Switch to read-once-then-rewrite. Do NOT exceed 7 rounds.
50
50
  - **Layered test**: debug with single-file tests, only run full suite as gate when single-file is green.
@@ -1,4 +1,4 @@
1
- # Dev-Pipeline Session Bootstrap — Tier 3 (Orchestrator + Reviewer)
1
+ # Dev-Pipeline Session Bootstrap — Tier 3 (Main-Agent Full Guardrails)
2
2
 
3
3
  ## Session Context
4
4
 
@@ -10,12 +10,12 @@
10
10
 
11
11
  You are the **session orchestrator**. Implement Feature {{FEATURE_ID}}: "{{FEATURE_TITLE}}".
12
12
 
13
- **CRITICAL**: You MUST NOT exit until ALL work is complete and committed. When you spawn Reviewer agents, wait for each to finish (run_in_background=false). Do NOT spawn agents in background and exit — that kills the session.
13
+ **CRITICAL**: You MUST NOT exit until ALL work is complete and committed. Normal work delegation outside Code Review must finish before exit (`run_in_background=false`). Code Review never uses direct or indirect delegation.
14
14
 
15
- **Tier 3 — Orchestrator + Reviewer**: For complex features, the main orchestrator handles context, planning, and implementation directly. Do not spawn top-level Dev or Reviewer subagents; code review runs later through `/prizmkit-code-review`.
15
+ **Tier 3 — Main-Agent Full Guardrails**: For complex features, the Main Agent handles context, planning, implementation, and Code Review directly. Do not spawn a top-level Dev implementation subagent. Code Review runs through `/prizmkit-code-review` without direct or indirect delegation.
16
16
 
17
17
  **Agent spawn failure policy (all Agent tool calls)**:
18
- - If spawning Reviewer fails with team/config/lock errors, retry at most once.
18
+ - Code Review must not invoke another review skill/workflow or relabel delegated work as a finder, verifier, audit, compatibility review, verification, or gap sweep.
19
19
  - If the second attempt fails, do not keep spawning variants and do not enter artifact polling for Implementation Log, challenge report, or review report markers.
20
20
  - Use the documented inline/recovery fallback for that phase: write the required report yourself where possible, complete remaining work directly in the orchestrator when safe, or write `failure-log.md` with the spawn error and last observable state before stopping for recovery.
21
21
  - Apply the same cap to any re-spawn for report repair or resume prompts; do not burn multiple minutes on identical team/config/lock failures.
@@ -52,7 +52,7 @@ 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 makes it available, use it instead of re-reading individual source files. If you just created or updated it in this session, continue from the in-context content; read it only when resuming/continuing, after context compaction/loss, or when handing work to a subagent.
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. **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 platform file/search tools for targeted lookup; when shell-free helper lookup is needed, run `{{RUNTIME_HELPER_CMD}} text search <file> --pattern "<pattern>" --json`, then read only the smallest bounded range with the platform file-reading tool 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. Reviewer subagents must receive context-snapshot.md and rely on it rather than independently re-reading the same files the orchestrator already read.
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 platform file/search tools for targeted lookup; when shell-free helper lookup is needed, run `{{RUNTIME_HELPER_CMD}} text search <file> --pattern "<pattern>" --json`, then read only the smallest bounded range with the platform file-reading tool 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. Normal work delegation outside Code Review must receive context-snapshot.md and rely on it rather than independently re-reading files the Main Agent already read. Code Review runs only in the current Main Agent.
56
56
  4. **Stay focused** — Do NOT explore code unrelated to this feature. No curiosity-driven reads.
57
57
  4. **One task at a time** — In Phase 4 (implement), complete and test one task before starting the next.
58
58
  5. **Minimize tool output** — Never load full command output into context. First capture command output to a temp file using the command/tool output option or the host-appropriate redirection, then inspect only the final relevant lines and use targeted search helpers to extract the information needed for the current task. Only read the filtered result — never the raw full output.
@@ -67,12 +67,12 @@ You are running in **headless non-interactive mode** with a FINITE context windo
67
67
  ## PrizmKit Directory Convention
68
68
 
69
69
  ```
70
- .prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md ← orchestrator writes Sections 1-4 + Implementation Log; Reviewer appends Review Notes
70
+ .prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md ← Main Agent writes Sections 1-4 + Implementation Log
71
71
  .prizmkit/specs/{{FEATURE_SLUG}}/spec.md
72
72
  .prizmkit/specs/{{FEATURE_SLUG}}/plan.md ← includes Tasks section
73
73
  ```
74
74
 
75
- **`context-snapshot.md`** is the shared knowledge base. Orchestrator writes Sections 1-4 and the Implementation Log; Reviewer appends Review Notes. This eliminates redundant I/O across review and orchestration phases.
75
+ **`context-snapshot.md`** is the implementation knowledge base. The Main Agent writes Sections 1-4 and the Implementation Log. Code Review writes only `review-report.md` and never appends separate Review Notes.
76
76
 
77
77
  ---
78
78
 
@@ -80,7 +80,7 @@ You are running in **headless non-interactive mode** with a FINITE context windo
80
80
 
81
81
  If any agent times out:
82
82
  1. `{{RUNTIME_HELPER_CMD}} artifact list .prizmkit/specs/{{FEATURE_SLUG}}` — check what exists
83
- 2. If `context-snapshot.md` exists: open recovery prompt with `"Read .prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md for project context and any Implementation Log/Review Notes from previous agents. Run git diff HEAD to see actual code changes already made. Do NOT re-read individual source files unless the File Manifest directs you to."` + only remaining steps + `model: "lite"`
83
+ 2. If `context-snapshot.md` exists: open recovery prompt with `"Read .prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md for project context and the Implementation Log from previous normal work execution. Run git diff HEAD to see actual code changes already made. Do NOT re-read individual source files unless the File Manifest directs you to."` + only remaining steps + `model: "lite"`
84
84
  3. Max 2 retries per phase. After 2 failures, orchestrator completes the work directly and appends a Recovery Note to context-snapshot.md.
85
85
 
86
86
  ---
@@ -90,22 +90,21 @@ If any agent times out:
90
90
  {{IF_INIT_NEEDED}}
91
91
  ### Phase 0: Project Bootstrap
92
92
  - Run `/prizmkit-init` (invoke the prizmkit-init skill)
93
- - Run `{{PYTHON_CMD}} {{INIT_SCRIPT_PATH}} --project-root {{PROJECT_ROOT}} --feature-id {{FEATURE_ID}} --feature-slug {{FEATURE_SLUG}}`
93
+ - Run `{{PYTHON_CMD}} .prizmkit/dev-pipeline/scripts/init-change-artifact.py --project-root {{PROJECT_ROOT}} --feature-id {{FEATURE_ID}} --feature-slug {{FEATURE_SLUG}}`
94
94
  - **CP-0**: Verify `.prizmkit/prizm-docs/root.prizm`, `.prizmkit/config.json` exist
95
95
  {{END_IF_INIT_NEEDED}}
96
- {{IF_INIT_DONE}}
97
96
 
98
97
  ### Step 1: Initialize
99
98
 
100
99
  1. Run init script:
101
- `{{PYTHON_CMD}} {{INIT_SCRIPT_PATH}} --project-root {{PROJECT_ROOT}} --feature-id {{FEATURE_ID}} --feature-slug {{FEATURE_SLUG}}`
100
+ `{{PYTHON_CMD}} .prizmkit/dev-pipeline/scripts/init-change-artifact.py --project-root {{PROJECT_ROOT}} --feature-id {{FEATURE_ID}} --feature-slug {{FEATURE_SLUG}}`
102
101
 
103
102
  2. Check for existing artifacts:
104
103
  `{{RUNTIME_HELPER_CMD}} artifact exists .prizmkit/specs/{{FEATURE_SLUG}}`
105
104
 
106
105
  {{IF_FRESH_START}}
107
106
  ```bash
108
- {{PYTHON_CMD}} {{INIT_SCRIPT_PATH}} --project-root {{PROJECT_ROOT}} --feature-id {{FEATURE_ID}} --feature-slug {{FEATURE_SLUG}}
107
+ {{PYTHON_CMD}} .prizmkit/dev-pipeline/scripts/init-change-artifact.py --project-root {{PROJECT_ROOT}} --feature-id {{FEATURE_ID}} --feature-slug {{FEATURE_SLUG}}
109
108
  ```
110
109
  {{END_IF_FRESH_START}}
111
110
 
@@ -182,7 +181,7 @@ Before proceeding past CP-1, verify:
182
181
 
183
182
  ### Phase 3: Plan Self-Check — Orchestrator Direct
184
183
 
185
- Do not spawn a top-level Reviewer subagent for planning analysis. Perform a bounded self-check before implementation:
184
+ Do not delegate planning analysis. The current Main Agent performs a bounded self-check before implementation:
186
185
 
187
186
  1. Re-read only `context-snapshot.md`, `spec.md`, and `plan.md`.
188
187
  2. Cross-check spec.md and plan.md Tasks against the feature description and acceptance criteria.
@@ -208,7 +207,7 @@ Before starting, check plan.md Tasks:
208
207
  **3a.** Run `/prizmkit-implement` directly:
209
208
  - Continue from the `spec.md` / `plan.md` / `context-snapshot.md` content you created in Phase 1-2; do not re-read self-authored artifacts just because implementation starts
210
209
  - Re-read `plan.md` or `context-snapshot.md` only when resuming/continuing, when current context was compacted or lost, or when task checkbox state may have changed outside this session
211
- - If implementation is delegated to a Dev subagent, the subagent must read `spec.md` if the artifact exists, plus `plan.md` and `context-snapshot.md`, before editing
210
+ - Implementation remains in the current Main Agent; do not delegate it to a Dev subagent
212
211
  - Use context-snapshot.md Section 4 File Manifest for targeted source reads; avoid re-reading source files already summarized there unless they changed after the snapshot
213
212
  - Implements task-by-task, marking each `[x]` immediately
214
213
  - Remeber to update checkpoints after finishing a series of tasks
@@ -238,9 +237,11 @@ For each Verification Gate from the Task Contract, write one evidence line to Im
238
237
 
239
238
  ### Review — Code Review
240
239
 
241
- 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.
240
+ Review the completed implementation before the scoped feature test gate runs. Use `artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/` so `/prizmkit-code-review` can read the spec, plan, context snapshot, implementation log, and current diff. Do not require or read a prior `/prizmkit-test` report here; test generation and test-fix looping happen in the next phase.
242
241
 
243
- Run `/prizmkit-code-review` with `artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/`. The skill runs a Main-Agent review loop for up to ten completed rounds, directly repairs accepted findings, verifies repairs, and converges when accepted and unresolved findings are both zero. Do not spawn a code-review-specific subagent. Missing required evidence, unsafe repair, failed verification, or round-ten non-convergence produces `NEEDS_FIXES`. The skill owns append-only report progress.
242
+ Run `/prizmkit-code-review` with `artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/`. The skill runs a Main-Agent review loop for up to ten completed rounds. The current Main Agent is the only Code Review executor: it directly reviews, repairs accepted findings, verifies repairs, and converges when accepted and unresolved findings are both zero.
243
+
244
+ The Code Review execution boundary is absolute: do not delegate review directly or indirectly. Do not invoke another review skill or review workflow. Do not relabel delegated work as a finder, verifier, audit, compatibility review, verification, or gap sweep. Direct reading, searching, editing, and testing by the current Main Agent remain allowed. `review-report.md` is the only persisted review artifact. Missing required evidence, unsafe repair, failed verification, or round-ten non-convergence produces `NEEDS_FIXES`.
244
245
 
245
246
  **Gate Check — Final Review Result**:
246
247
  ```bash
@@ -518,9 +519,9 @@ If you encounter an unrecoverable error, context overflow, or are about to exit
518
519
  ## Reminders
519
520
 
520
521
  - Tier 3: orchestrator implements directly; `/prizmkit-code-review` handles review later
521
- - context-snapshot.md is append-only: orchestrator writes Sections 1-4 + Implementation Log, Reviewer appends Review Notes
522
- - Gate checks enforce Implementation Log and Review Notes are written before proceeding
523
- - Do NOT use `run_in_background=true` when spawning Reviewer agents
522
+ - context-snapshot.md contains Main-Agent implementation context; Code Review writes only review-report.md
523
+ - Gate checks require the Implementation Log and a valid review-report.md Final Result before proceeding
524
+ - Code Review never uses direct or indirect delegation; normal work delegation outside review must not use `run_in_background=true`
524
525
  - Commit phase must use `/prizmkit-committer`; do NOT replace with manual git commit commands
525
526
  - **NEVER delete, modify, or touch any file under `.prizmkit/state/`** — those are pipeline runtime files managed by the runner
526
527
  - NEVER run `rm -rf`, `git clean`, or any destructive filesystem operations
@@ -17,7 +17,7 @@ You are the **refactor session orchestrator**. Execute Refactor {{REFACTOR_ID}}:
17
17
 
18
18
  **NON-INTERACTIVE MODE**: You are running in headless non-interactive mode. There is NO human on the other end. NEVER ask for user confirmation, NEVER wait for user input, and NEVER use interactive prompts. Resolve uncertainty from existing code, project docs, and conservative behavior-preserving defaults.
19
19
 
20
- **ORCHESTRATOR-DIRECT RULE**: Do not spawn top-level Dev or Reviewer subagents. The main orchestrator plans, implements via `/prizmkit-implement`, and runs `/prizmkit-code-review` directly.
20
+ **MAIN-AGENT-DIRECT RULE**: Do not spawn a top-level Dev implementation subagent. The Main Agent plans, implements via `/prizmkit-implement`, and runs `/prizmkit-code-review` directly without direct or indirect review delegation.
21
21
 
22
22
  **REFACTOR DOCUMENTATION POLICY**:
23
23
  - Default: run `/prizmkit-retrospective` with full sync because refactoring changes structure and interfaces.
@@ -249,7 +249,7 @@ Before exiting, write `{{SESSION_STATUS_PATH}}`:
249
249
  ## Reminders
250
250
 
251
251
  - Use L1 skills: `/prizmkit-plan`, `/prizmkit-implement`, `/prizmkit-code-review`, `/prizmkit-retrospective`, `/prizmkit-committer`.
252
- - Do not spawn top-level Dev or Reviewer subagents.
252
+ - Do not spawn a top-level Dev implementation subagent; Code Review runs only in the current Main Agent without delegation.
253
253
  - Behavior preservation is the first priority.
254
254
  - Browser verification is a mandatory attempt by default; it blocks only when explicitly required.
255
255
  - If `DEV_PORT` is unknown, discover it from project config; do not guess port 3000.
@@ -6,4 +6,4 @@ You are the **bug fix session orchestrator**. Fix Bug {{BUG_ID}}: "{{BUG_TITLE}}
6
6
 
7
7
  **NON-INTERACTIVE MODE**: There is NO human on the other end. NEVER ask for user confirmation, NEVER wait for user input. Make decisions autonomously from the bug report, existing code, tests, and conservative project patterns.
8
8
 
9
- **Execution model**: You implement directly in the current checkout. Do not spawn a top-level Dev subagent. `/prizmkit-code-review` owns its internal Reviewer Agent filter orchestrator fix loop.
9
+ **Execution model**: You implement directly in the current checkout. Do not spawn a top-level Dev subagent. The current Main Agent runs `/prizmkit-code-review` directly and owns its complete review, repair, verification, and reporting loop without direct or indirect review delegation.
@@ -12,9 +12,17 @@ If `FAST_PATH=true`, skip this phase intentionally:
12
12
 
13
13
  Then continue to the next checkpoint step.
14
14
 
15
- Otherwise, run `/prizmkit-code-review` with `artifact_dir=.prizmkit/bugfix/{{BUG_ID}}/`. The skill runs a Main-Agent review loop for up to ten completed rounds. The Main Agent reviews the complete current change, rejects unsupported candidate findings, directly repairs accepted findings, verifies repairs, and repeats until `accepted = 0` with no unresolved findings.
15
+ Otherwise, run `/prizmkit-code-review` with `artifact_dir=.prizmkit/bugfix/{{BUG_ID}}/`. The skill runs a Main-Agent review loop for up to ten completed rounds. The current Main Agent is the only Code Review executor: it reviews the complete current change, rejects unsupported candidate findings, directly repairs accepted findings, verifies repairs, and repeats until `accepted = 0` with no unresolved findings.
16
16
 
17
- The skill owns the full loop and append-only progress in `review-report.md`. Do not spawn a top-level or code-review-specific subagent. Missing required evidence, an unsafe repair, a failed verification, or failure to converge by round ten produces `NEEDS_FIXES`.
17
+ The Code Review execution boundary is absolute for this phase:
18
+
19
+ - Do not delegate any review work directly or indirectly.
20
+ - Do not invoke another review skill or review workflow.
21
+ - Do not use a general-purpose execution unit for review or relabel delegated work as a finder, verifier, audit, compatibility review, verification, or gap sweep.
22
+ - Direct reading, searching, editing, and testing by the current Main Agent remain allowed.
23
+ - `review-report.md` is the only persisted review artifact; do not append separate Review Notes to another artifact.
24
+
25
+ Missing required evidence, an unsafe repair, a failed verification, or failure to converge by round ten produces `NEEDS_FIXES`.
18
26
 
19
27
  **Gate Check — Final Review Result**:
20
28
 
@@ -6,7 +6,7 @@ You are running in **headless non-interactive mode** with a FINITE context windo
6
6
 
7
7
  1. **context-snapshot.md is your single source of truth** — After it is available, use it instead of re-reading individual source files. If you just created or updated it in this session, continue from the in-context content; read it only when resuming/continuing, after context compaction/loss, or when handing work to a subagent.
8
8
  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.
9
- 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 platform file/search tools for targeted lookup; when shell-free helper lookup is needed, run `{{RUNTIME_HELPER_CMD}} text search <file> --pattern "<pattern>" --json`, then read only the smallest bounded range with the platform file-reading tool 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. Reviewer subagents must receive context-snapshot.md and rely on it rather than independently re-reading the same files the orchestrator already read.
9
+ 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 platform file/search tools for targeted lookup; when shell-free helper lookup is needed, run `{{RUNTIME_HELPER_CMD}} text search <file> --pattern "<pattern>" --json`, then read only the smallest bounded range with the platform file-reading tool 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 summarized in context-snapshot.md Section 4. Normal work delegation outside Code Review must receive context-snapshot.md and rely on it rather than independently re-reading files the Main Agent already read. Code Review is excluded from normal work delegation and runs only in the current Main Agent.
10
10
  4. **Stay focused** — Do NOT explore code unrelated to this feature. No curiosity-driven reads.
11
11
  5. **One task at a time** — Complete and test one task before starting the next.
12
12
  6. **Minimize tool output** — Never load full command output into context. First capture command output to a temp file using the command/tool output option or the host-appropriate redirection, then inspect only the final relevant lines and use targeted search helpers to extract the information needed for the current task. Only read the filtered result — never the raw full output.
@@ -1,8 +1,9 @@
1
1
  ## PrizmKit Directory Convention
2
2
 
3
3
  ```
4
- .prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md ← orchestrator writes Sections 1-4 + Implementation Log; Reviewer appends Review Notes
4
+ .prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md ← Main Agent writes Sections 1-4 + Implementation Log
5
5
  .prizmkit/specs/{{FEATURE_SLUG}}/plan.md ← includes Tasks section
6
+ .prizmkit/specs/{{FEATURE_SLUG}}/review-report.md ← Main Agent writes Code Review progress and Final Result
6
7
  ```
7
8
 
8
- **`context-snapshot.md`** is the shared knowledge base. Orchestrator writes Sections 1-4 and the Implementation Log; Reviewer appends Review Notes. Append-only after initial creation.
9
+ **`context-snapshot.md`** is the implementation knowledge base and remains append-only after initial creation. Code Review writes only `review-report.md`; it does not append separate Review Notes to the context snapshot.
@@ -1,9 +1,10 @@
1
1
  ## PrizmKit Directory Convention
2
2
 
3
3
  ```
4
- .prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md ← orchestrator writes Sections 1-4 + Implementation Log; Reviewer appends Review Notes
4
+ .prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md ← Main Agent writes Sections 1-4 + Implementation Log
5
5
  .prizmkit/specs/{{FEATURE_SLUG}}/spec.md
6
6
  .prizmkit/specs/{{FEATURE_SLUG}}/plan.md ← includes Tasks section
7
+ .prizmkit/specs/{{FEATURE_SLUG}}/review-report.md ← Main Agent writes Code Review progress and Final Result
7
8
  ```
8
9
 
9
- **`context-snapshot.md`** is the shared knowledge base. Orchestrator writes Sections 1-4 and the Implementation Log; Reviewer appends Review Notes. This eliminates redundant I/O across review and orchestration phases.
10
+ **`context-snapshot.md`** is the implementation knowledge base. The Main Agent writes Sections 1-4 and the Implementation Log. Code Review writes only `review-report.md`; it does not append separate Review Notes to the context snapshot.
@@ -72,4 +72,4 @@ After all of the following are true, the session is **TERMINAL**:
72
72
  - `.prizmkit/specs/{{FEATURE_SLUG}}/completion-summary.json` is written
73
73
  - the `prizmkit-committer` checkpoint is marked `completed`
74
74
 
75
- At that point, stop immediately. Do **not** process delayed teammate/reviewer findings, do **not** edit files, do **not** amend the commit, and do **not** start any new tool calls. Any findings that arrive after S09 is completed are follow-up work for a later session, not part of this feature commit.
75
+ At that point, stop immediately. Do **not** process delayed normal-work results, edit files, amend the commit, or start any new tool calls. Code Review cannot have delayed delegated findings because it runs only in the current Main Agent. Any normal-work result that arrives after S09 is completed is follow-up work for a later session, not part of this feature commit.
@@ -58,4 +58,4 @@ After all of the following are true, the session is **TERMINAL**:
58
58
  - `.prizmkit/specs/{{FEATURE_SLUG}}/completion-summary.json` is written
59
59
  - the `prizmkit-committer` checkpoint is marked `completed`
60
60
 
61
- At that point, stop immediately. Do **not** process delayed teammate/reviewer findings, do **not** edit files, do **not** amend the commit, and do **not** start any new tool calls. Any findings that arrive after S09 is completed are follow-up work for a later session, not part of this feature commit.
61
+ At that point, stop immediately. Do **not** process delayed normal-work results, edit files, amend the commit, or start any new tool calls. Code Review cannot have delayed delegated findings because it runs only in the current Main Agent. Any normal-work result that arrives after S09 is completed is follow-up work for a later session, not part of this feature commit.
@@ -14,7 +14,7 @@ Before starting, check plan.md Tasks:
14
14
  **3a.** Run `/prizmkit-implement` directly:
15
15
  - Continue from the `spec.md` / `plan.md` / `context-snapshot.md` content you created in Phase 1-2; do not re-read self-authored artifacts just because implementation starts
16
16
  - Re-read `plan.md` or `context-snapshot.md` only when resuming/continuing, when current context was compacted or lost, or when task checkbox state may have changed outside this session
17
- - If implementation is delegated to a Dev subagent, the subagent must read `spec.md` if the artifact exists, plus `plan.md` and `context-snapshot.md`, before editing
17
+ - Implementation remains in the current Main Agent; do not delegate it to a Dev subagent
18
18
  - Use context-snapshot.md Section 4 File Manifest for targeted source reads; avoid re-reading source files already summarized there unless they changed after the snapshot
19
19
  - Implements task-by-task, marking each `[x]` immediately
20
20
  - Remeber to update checkpoints after finishing a series of tasks
@@ -14,7 +14,7 @@ Before starting, check plan.md Tasks:
14
14
  **3a.** Run `/prizmkit-implement` directly:
15
15
  - Continue from the `spec.md` / `plan.md` / `context-snapshot.md` content you created in Phase 1-2; do not re-read self-authored artifacts just because implementation starts
16
16
  - Re-read `plan.md` or `context-snapshot.md` only when resuming/continuing, when current context was compacted or lost, or when task checkbox state may have changed outside this session
17
- - If implementation is delegated to a Dev subagent, the subagent must read `spec.md` if the artifact exists, plus `plan.md` and `context-snapshot.md`, before editing
17
+ - Implementation remains in the current Main Agent; do not delegate it to a Dev subagent
18
18
  - Use context-snapshot.md Section 4 File Manifest for targeted source reads; avoid re-reading source files already summarized there unless they changed after the snapshot
19
19
  - Implements task-by-task, marking each `[x]` immediately
20
20
  - Remeber to update checkpoints after finishing a series of tasks
@@ -1,10 +1,18 @@
1
1
  ### Review — Code Review
2
2
 
3
- 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 a prior `/prizmkit-test` report here; the next phase owns the formal test gate.
3
+ Review the completed implementation before the scoped feature test gate runs. Use `artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/` so `/prizmkit-code-review` can read the spec, plan, context snapshot, implementation log, and current diff. Do not require a prior `/prizmkit-test` report here; the next phase owns the formal test gate.
4
4
 
5
- Run `/prizmkit-code-review` with `artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/`. The skill runs a Main-Agent review loop for up to ten completed rounds. The Main Agent reviews the complete current change, rejects unsupported candidate findings, directly repairs accepted findings, verifies repairs, and repeats until `accepted = 0` with no unresolved findings.
5
+ Run `/prizmkit-code-review` with `artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/`. The skill runs a Main-Agent review loop for up to ten completed rounds. The current Main Agent is the only Code Review executor: it reviews the complete current change, rejects unsupported candidate findings, directly repairs accepted findings, verifies repairs, and repeats until `accepted = 0` with no unresolved findings.
6
6
 
7
- The skill owns the full loop and append-only progress in `review-report.md`. Do not spawn a top-level or code-review-specific subagent. Missing required evidence, an unsafe repair, a failed verification, or failure to converge by round ten produces `NEEDS_FIXES`.
7
+ The Code Review execution boundary is absolute for this phase:
8
+
9
+ - Do not delegate any review work directly or indirectly.
10
+ - Do not invoke another review skill or review workflow.
11
+ - Do not use a general-purpose execution unit for review or relabel delegated work as a finder, verifier, audit, compatibility review, verification, or gap sweep.
12
+ - Direct reading, searching, editing, and testing by the current Main Agent remain allowed.
13
+ - `review-report.md` is the only persisted review artifact; do not append separate Review Notes to `context-snapshot.md`.
14
+
15
+ Missing required evidence, an unsafe repair, a failed verification, or failure to converge by round ten produces `NEEDS_FIXES`.
8
16
 
9
17
  **Gate Check — Final Review Result**:
10
18
 
@@ -1,10 +1,18 @@
1
1
  ### Review — Code Review
2
2
 
3
- 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 a prior `/prizmkit-test` report here; the next phase owns the formal test gate.
3
+ Review the completed implementation before the scoped feature test gate runs. Use `artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/` so `/prizmkit-code-review` can read the spec, plan, context snapshot, implementation log, and current diff. Do not require a prior `/prizmkit-test` report here; the next phase owns the formal test gate.
4
4
 
5
- Run `/prizmkit-code-review` with `artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/`. The skill runs a Main-Agent review loop for up to ten completed rounds. The Main Agent reviews the complete current change, rejects unsupported candidate findings, directly repairs accepted findings, verifies repairs, and repeats until `accepted = 0` with no unresolved findings.
5
+ Run `/prizmkit-code-review` with `artifact_dir=.prizmkit/specs/{{FEATURE_SLUG}}/`. The skill runs a Main-Agent review loop for up to ten completed rounds. The current Main Agent is the only Code Review executor: it reviews the complete current change, rejects unsupported candidate findings, directly repairs accepted findings, verifies repairs, and repeats until `accepted = 0` with no unresolved findings.
6
6
 
7
- The skill owns the full loop and append-only progress in `review-report.md`. Do not spawn a top-level or code-review-specific subagent. Missing required evidence, an unsafe repair, a failed verification, or failure to converge by round ten produces `NEEDS_FIXES`.
7
+ The Code Review execution boundary is absolute for this phase:
8
+
9
+ - Do not delegate any review work directly or indirectly.
10
+ - Do not invoke another review skill or review workflow.
11
+ - Do not use a general-purpose execution unit for review or relabel delegated work as a finder, verifier, audit, compatibility review, verification, or gap sweep.
12
+ - Direct reading, searching, editing, and testing by the current Main Agent remain allowed.
13
+ - `review-report.md` is the only persisted review artifact; do not append separate Review Notes to `context-snapshot.md`.
14
+
15
+ Missing required evidence, an unsafe repair, a failed verification, or failure to converge by round ten produces `NEEDS_FIXES`.
8
16
 
9
17
  **Gate Check — Final Review Result**:
10
18
 
@@ -71,7 +71,7 @@ Before proceeding past CP-1, verify:
71
71
 
72
72
  ### Plan Self-Check — Orchestrator Direct
73
73
 
74
- Do not spawn a top-level Reviewer subagent for planning analysis. Perform a bounded self-check before implementation:
74
+ Do not delegate planning analysis. The current Main Agent performs a bounded self-check before implementation:
75
75
 
76
76
  1. Re-read only `context-snapshot.md`, `spec.md`, and `plan.md`.
77
77
  2. Cross-check spec.md and plan.md Tasks against the feature description and Verification Gates in the Task Contract.
@@ -1,6 +1,6 @@
1
1
  ### Phase 0: Project Bootstrap
2
2
  - Run `/prizmkit-init` (invoke the prizmkit-init skill)
3
- - Run `{{PYTHON_CMD}} {{INIT_SCRIPT_PATH}} --project-root {{PROJECT_ROOT}} --feature-id {{FEATURE_ID}} --feature-slug {{FEATURE_SLUG}}`
3
+ - Run `{{PYTHON_CMD}} .prizmkit/dev-pipeline/scripts/init-change-artifact.py --project-root {{PROJECT_ROOT}} --feature-id {{FEATURE_ID}} --feature-slug {{FEATURE_SLUG}}`
4
4
  - **CP-0**: Verify `.prizmkit/prizm-docs/root.prizm`, `.prizmkit/config.json` exist
5
5
 
6
6
 
@@ -4,6 +4,6 @@ You are the **refactor session orchestrator**. Execute Refactor {{REFACTOR_ID}}:
4
4
 
5
5
  **CRITICAL**: Preserve observable behavior. Do not change product behavior unless the refactor contract explicitly requires it.
6
6
 
7
- **Execution model**: You implement directly in the current checkout. Do not spawn a top-level Dev subagent. Do not spawn a top-level Reviewer subagent. `/prizmkit-code-review` owns its internal Reviewer Agent filter orchestrator fix loop.
7
+ **Execution model**: You implement directly in the current checkout. Do not spawn a top-level Dev subagent. The current Main Agent runs `/prizmkit-code-review` directly and owns its complete review, repair, verification, and reporting loop without direct or indirect review delegation.
8
8
 
9
9
  **NON-INTERACTIVE MODE**: There is NO human on the other end. Resolve uncertainty from existing code and conservative project patterns.
@@ -1,8 +1,16 @@
1
1
  ### Phase 3: Review — Code Review & Behavior Verification
2
2
 
3
- Run `/prizmkit-code-review` directly with `artifact_dir=.prizmkit/refactor/{{REFACTOR_ID}}/`. The skill runs a Main-Agent review loop for up to ten completed rounds. The Main Agent reviews the complete current change, rejects unsupported candidate findings, directly repairs accepted findings, verifies repairs, and repeats until `accepted = 0` with no unresolved findings.
3
+ Run `/prizmkit-code-review` directly with `artifact_dir=.prizmkit/refactor/{{REFACTOR_ID}}/`. The skill runs a Main-Agent review loop for up to ten completed rounds. The current Main Agent is the only Code Review executor: it reviews the complete current change, rejects unsupported candidate findings, directly repairs accepted findings, verifies repairs, and repeats until `accepted = 0` with no unresolved findings.
4
4
 
5
- Do not spawn a top-level or code-review-specific subagent. The code-review skill owns the complete loop and append-only report progress. Missing required evidence, an unsafe repair, a failed verification, or failure to converge by round ten produces `NEEDS_FIXES`.
5
+ The Code Review execution boundary is absolute for this phase:
6
+
7
+ - Do not delegate any review work directly or indirectly.
8
+ - Do not invoke another review skill or review workflow.
9
+ - Do not use a general-purpose execution unit for review or relabel delegated work as a finder, verifier, audit, compatibility review, verification, or gap sweep.
10
+ - Direct reading, searching, editing, and testing by the current Main Agent remain allowed.
11
+ - `review-report.md` is the only persisted review artifact; do not append separate Review Notes to another artifact.
12
+
13
+ Missing required evidence, an unsafe repair, a failed verification, or failure to converge by round ten produces `NEEDS_FIXES`.
6
14
 
7
15
  **Gate Check — Final Review Result**:
8
16
 
@@ -14,6 +22,6 @@ Do not spawn a top-level or code-review-specific subagent. The code-review skill
14
22
  - `REVIEW_NEEDS_FIXES` → log unresolved findings and proceed only when they do not block behavior preservation under explicit task policy.
15
23
  - `REVIEW_INCOMPLETE` or `REVIEW_INVALID` → inspect progress once, write `failure-log.md`, and stop. Do not accept stale verdict text or synthesize a passing result outside the skill.
16
24
 
17
- Verify the review explicitly checks behavior preservation, public API compatibility, imports, tests, and rollback assumptions.
25
+ Verify directly that the review checks behavior preservation, public API compatibility, imports, tests, and rollback assumptions.
18
26
 
19
27
  **Checkpoint update**: Set step `prizmkit-code-review` to `completed` only for an accepted valid Final Result. Do not complete the checkpoint for incomplete or invalid reports.
@@ -3,7 +3,7 @@
3
3
  - Use L1 skills: `/prizmkit-plan`, `/prizmkit-implement`, `/prizmkit-code-review`, `/prizmkit-retrospective`, `/prizmkit-committer`.
4
4
  - All refactor skills use `artifact_dir=.prizmkit/refactor/{{REFACTOR_ID}}/`.
5
5
  - Behavior preservation is the first priority.
6
- - Do not spawn top-level Dev or Reviewer subagents.
6
+ - Do not spawn a top-level Dev implementation subagent; Code Review runs only in the current Main Agent without delegation.
7
7
  - Main orchestrator runs `/prizmkit-code-review` directly.
8
8
  - Commit with `refactor(<scope>):`, not `feat:` or `fix:`.
9
9
  - Checkpoint state is the recovery truth; skipped steps must be marked `skipped`.
@@ -1,6 +1,8 @@
1
- ## Subagent Timeout Recovery
1
+ ## Normal Work Delegation Timeout Recovery
2
2
 
3
- If any agent times out:
3
+ This recovery path applies only to normal work delegated outside Code Review. Code Review never uses delegated execution or this retry procedure.
4
+
5
+ If a normal work execution unit times out:
4
6
  1. `{{RUNTIME_HELPER_CMD}} artifact list .prizmkit/specs/{{FEATURE_SLUG}}` — check what exists
5
- 2. If `context-snapshot.md` exists: open recovery prompt with `"Read .prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md for project context and any Implementation Log/Review Notes from previous agents. Run git diff HEAD to see actual code changes already made. Do NOT re-read individual source files unless the File Manifest directs you to."` + only remaining steps + `model: "lite"`
6
- 3. Max 2 retries per phase. After 2 failures, orchestrator completes the work directly and appends a Recovery Note to context-snapshot.md.
7
+ 2. If `context-snapshot.md` exists: open a recovery prompt with `"Read .prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md for project context and the Implementation Log. Run git diff HEAD to see actual code changes already made. Do NOT re-read individual source files unless the File Manifest directs you to."` + only remaining steps + `model: "lite"`
8
+ 3. Max 2 retries per phase. After 2 failures, the Main Agent completes the work directly and appends a Recovery Note to context-snapshot.md.
@@ -6,7 +6,7 @@ Use this protocol whenever the post-review PrizmKit Test gate fails. Its purpose
6
6
 
7
7
  | Class | Meaning | Required Action | May Continue? |
8
8
  |-------|---------|-----------------|---------------|
9
- | Baseline failure | Existed before this session | Document in Implementation Log or review notes | Yes |
9
+ | Baseline failure | Existed before this session | Document in the Implementation Log or `failure-log.md` | Yes |
10
10
  | New regression | Introduced by this session | Fix before reporting success | No |
11
11
  | Brittle test | Test expectation/setup is wrong for the intended behavior | Fix the test or environment setup, then rerun | Only after fixed or documented as blocked |
12
12
  | Environment/tooling failure | External tool, network, install, or local environment prevents verification | Document in `failure-log.md` with impact on gates | Only if no Verification Gate is blocked |
@@ -1,6 +1,7 @@
1
1
  """Tests for generate-bootstrap-prompt.py core functions."""
2
2
 
3
3
  import json
4
+ import importlib.util
4
5
  import os
5
6
  import re
6
7
  import time
@@ -25,6 +26,7 @@ from generate_bootstrap_prompt import (
25
26
  generate_checkpoint_definition,
26
27
  merge_checkpoint_state,
27
28
  load_active_agent_prompts,
29
+ validate_rendered,
28
30
  main as generate_bootstrap_main,
29
31
  )
30
32
  from continuation import append_continuation_handoff, checkpoint_cursor
@@ -44,6 +46,69 @@ FORBIDDEN_TEST_CMD_PLACEHOLDER = "(" + "$TEST_CMD" + ")"
44
46
  FORBIDDEN_THREE_STRIKE = "3-" + "strike"
45
47
  FORBIDDEN_TWENTY_STEP = "20-" + "step window"
46
48
 
49
+ REVIEW_PROMPT_REQUIRED = (
50
+ "The current Main Agent is the only Code Review executor",
51
+ "Do not invoke another review skill or review workflow",
52
+ "finder, verifier, audit, compatibility review, verification, or gap sweep",
53
+ "`review-report.md` is the only persisted review artifact",
54
+ )
55
+
56
+ REVIEW_PROMPT_FORBIDDEN = (
57
+ "Orchestrator + Reviewer",
58
+ "Reviewer reviews",
59
+ "Reviewer subagents",
60
+ "Reviewer appends Review Notes",
61
+ "Implementation Log/Review Notes",
62
+ "internal Reviewer Agent",
63
+ "spawning Reviewer",
64
+ "delayed teammate/reviewer findings",
65
+ "Gate checks enforce Implementation Log and Review Notes",
66
+ )
67
+
68
+
69
+ def assert_unambiguous_main_agent_review(prompt):
70
+ for required in REVIEW_PROMPT_REQUIRED:
71
+ assert required in prompt
72
+ for forbidden in REVIEW_PROMPT_FORBIDDEN:
73
+ assert forbidden not in prompt
74
+
75
+
76
+ PROMPT_RENDERING_FORBIDDEN = (
77
+ "If implementation is delegated to a Dev subagent",
78
+ "Document in Implementation Log or review notes",
79
+ "{{INIT_SCRIPT_PATH}}",
80
+ )
81
+
82
+
83
+ def assert_complete_prompt_rendering(prompt):
84
+ assert_unambiguous_main_agent_review(prompt)
85
+ for forbidden in PROMPT_RENDERING_FORBIDDEN:
86
+ assert forbidden not in prompt
87
+ assert re.findall(r"\{\{[A-Z][A-Z_0-9]+\}\}", prompt) == []
88
+
89
+
90
+ def _load_recovery_prompt_module():
91
+ path = Path("dev-pipeline/scripts/generate-recovery-prompt.py")
92
+ spec = importlib.util.spec_from_file_location("generate_recovery_prompt", path)
93
+ module = importlib.util.module_from_spec(spec)
94
+ spec.loader.exec_module(module)
95
+ return module
96
+
97
+
98
+ def test_rendered_prompt_validation_rejects_unresolved_control_placeholders():
99
+ content = (
100
+ "## Your Mission\n"
101
+ "## Execution\n"
102
+ "Run {{INIT_SCRIPT_PATH}}\n"
103
+ "## Failure Capture\n"
104
+ )
105
+
106
+ is_valid, warnings, errors = validate_rendered(content)
107
+
108
+ assert is_valid is False
109
+ assert warnings == []
110
+ assert errors == ["Unreplaced placeholders: {{INIT_SCRIPT_PATH}}"]
111
+
47
112
 
48
113
  def scoped_report_text(verdict="PASS", boundary_missing=0,
49
114
  happy_path_only=0, completion_gate="yes",
@@ -884,10 +949,38 @@ class TestDirectOrchestratorImplementationPrompts:
884
949
  assert FORBIDDEN_TWENTY_STEP not in rendered
885
950
  assert "Main-Agent review loop" in rendered
886
951
  assert "up to ten completed rounds" in rendered
887
- assert "code-review-specific subagent" in rendered
952
+ assert "The current Main Agent is the only Code Review executor" in rendered
953
+ assert "Do not invoke another review skill or review workflow" in rendered
888
954
  assert "low=0" not in rendered
889
955
  assert "Reviewer 3" not in rendered
890
956
 
957
+ def test_all_rendered_pipeline_prompts_have_one_main_agent_review_model(self, tmp_path):
958
+ recovery = _load_recovery_prompt_module()
959
+ prompts = [
960
+ _render_feature_prompt(tmp_path / "feature-lite", mode="lite"),
961
+ _render_feature_prompt(tmp_path / "feature-standard", mode="standard"),
962
+ _render_feature_prompt(tmp_path / "feature-full", mode="full"),
963
+ _render_feature_prompt(
964
+ tmp_path / "feature-tier3",
965
+ mode="full",
966
+ template="bootstrap-tier3.md",
967
+ ),
968
+ _render_bugfix_prompt(tmp_path / "bugfix"),
969
+ _render_refactor_prompt(tmp_path / "refactor"),
970
+ recovery.build_bugfix_prompt(
971
+ {
972
+ "workflow_type": "bug-fix-workflow",
973
+ "phase": 5,
974
+ "phase_name": "Review",
975
+ "workflow_data": {"bug_id": "B-001"},
976
+ },
977
+ str(tmp_path),
978
+ ),
979
+ ]
980
+
981
+ for prompt in prompts:
982
+ assert_complete_prompt_rendering(prompt)
983
+
891
984
  def test_retained_tier3_fallback_template_uses_direct_orchestrator_implementation(self):
892
985
  rendered = Path("dev-pipeline/templates/bootstrap-tier3.md").read_text(encoding="utf-8")
893
986
 
@@ -1446,7 +1539,8 @@ class TestHeadlessPromptCleanupF033:
1446
1539
 
1447
1540
  assert "{{" + "REVIEWER_" + "SUBAGENT_PATH" + "}}" not in replacements
1448
1541
  assert "Main-Agent review loop" in refactor_prompt
1449
- assert "code-review-specific subagent" in refactor_prompt
1542
+ assert "The current Main Agent is the only Code Review executor" in refactor_prompt
1543
+ assert "Do not invoke another review skill or review workflow" in refactor_prompt
1450
1544
  assert "Reviewer 3" not in refactor_prompt
1451
1545
 
1452
1546
  def test_bugfix_refactor_explicit_codex_override(self, tmp_path, monkeypatch):
@@ -1469,7 +1563,8 @@ class TestHeadlessPromptCleanupF033:
1469
1563
 
1470
1564
  assert "{{" + "REVIEWER_" + "SUBAGENT_PATH" + "}}" not in replacements
1471
1565
  assert "Main-Agent review loop" in refactor_prompt
1472
- assert "code-review-specific subagent" in refactor_prompt
1566
+ assert "The current Main Agent is the only Code Review executor" in refactor_prompt
1567
+ assert "Do not invoke another review skill or review workflow" in refactor_prompt
1473
1568
  assert "Reviewer 3" not in refactor_prompt
1474
1569
 
1475
1570