prizmkit 1.1.123 → 1.1.125

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 (26) hide show
  1. package/bundled/VERSION.json +3 -3
  2. package/bundled/adapters/claude/command-adapter.js +75 -0
  3. package/bundled/dev-pipeline/prizmkit_runtime/gitops.py +16 -5
  4. package/bundled/dev-pipeline/prizmkit_runtime/runner_bookkeeping.py +121 -9
  5. package/bundled/dev-pipeline/scripts/generate-recovery-prompt.py +3 -4
  6. package/bundled/dev-pipeline/templates/bootstrap-prompt.md +1 -1
  7. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +4 -3
  8. package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +4 -3
  9. package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +7 -2
  10. package/bundled/dev-pipeline/templates/sections/bugfix-phase-review.md +5 -4
  11. package/bundled/dev-pipeline/templates/sections/phase-review-agent.md +4 -4
  12. package/bundled/dev-pipeline/templates/sections/phase-review-full.md +5 -4
  13. package/bundled/dev-pipeline/templates/sections/refactor-phase-review.md +6 -5
  14. package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +2 -1
  15. package/bundled/dev-pipeline/tests/test_python_runner_parity.py +197 -9
  16. package/bundled/dev-pipeline/tests/test_unified_cli.py +31 -16
  17. package/bundled/skills/_metadata.json +4 -4
  18. package/bundled/skills/prizmkit-code-review/SKILL.md +113 -110
  19. package/bundled/skills/prizmkit-code-review/assets/reviewer-role.json +19 -0
  20. package/bundled/skills/prizmkit-code-review/references/review-report-template.md +24 -21
  21. package/bundled/skills/prizmkit-code-review/references/reviewer-agent-prompt.md +95 -67
  22. package/bundled/skills/prizmkit-code-review/scripts/render_review_report.py +162 -0
  23. package/package.json +1 -1
  24. package/src/scaffold.js +15 -0
  25. package/bundled/skills/prizmkit-code-review/references/reviewer-workspace-protocol.md +0 -90
  26. package/bundled/skills/prizmkit-code-review/scripts/check_loop.py +0 -186
@@ -1,166 +1,169 @@
1
1
  ---
2
2
  name: "prizmkit-code-review"
3
- description: "Iterative independent review-fix loop against spec, plan, workspace changes, and test evidence. Establishes a verified review snapshot using any platform-supported subagent strategy while keeping review judgment separate from Main-Agent filtering and fixes. Use after /prizmkit-implement as a Full path quality gate or when the user asks to review, check code, validate implementation, or decide whether changes are ready to commit. Loops until PASS or max 3 rounds. (project)"
3
+ description: "Run a practical convergence-driven independent code review against the current spec, plan, workspace changes, applicable rules, contracts, and test evidence. Use after /prizmkit-implement, before commit when review is required, or whenever the user asks to review code, validate an implementation, find defects, assess regressions, or decide whether changes are ready. Each completed round launches one fresh read-only non-delegating Reviewer; the Main Agent filters findings, directly repairs accepted issues, and repeats until no accepted finding remains or the ten-round safety fuse stops review. (project)"
4
4
  ---
5
5
 
6
6
  # PrizmKit Code Review
7
7
 
8
- Run an iterative review-fix loop against the current change. Keep review judgment independent from fix application: an independent read-only Reviewer evaluates a verified snapshot, then the Main Agent filters findings and applies accepted fixes.
8
+ Run an independent review-fix loop over the complete current change. A fresh Reviewer discovers candidate defects; the Main Agent adjudicates every finding, directly repairs accepted issues, and owns the final verdict.
9
9
 
10
- Review modes:
11
- - `independent-reviewer-verified-snapshot`: an independent Reviewer verified that its review snapshot is equivalent to the Main Agent's current change.
12
- - `not-run-no-changes`: no workspace changes were detected.
10
+ ## When to Use
13
11
 
14
- The skill defines review invariants rather than platform tool parameters. Choose any platform-supported subagent launch and snapshot transport strategy that satisfies `${SKILL_DIR}/references/reviewer-workspace-protocol.md`.
15
-
16
- If no independent Reviewer can receive and verify an equivalent snapshot, stop normal review and report the workspace verification failure. Do not replace the independent review with Main-Agent self-review because that would remove the separation between judgment and implementation.
17
-
18
- ### When to Use
19
12
  - After `/prizmkit-implement` as the Full path quality gate
20
- - For Fast path when risk, scope, or the user warrants review
21
- - When the user says "review", "check code", "review my implementation", or "is it ready to commit"
22
- - Before `/prizmkit-committer` when the chosen lifecycle path requires review
13
+ - For Fast path when scope, risk, or the user warrants review
14
+ - When the user asks to review code, validate implementation, find defects, check regressions, or assess commit readiness
15
+ - Before `/prizmkit-committer` when the selected lifecycle requires review
16
+
17
+ ## When Not to Use
23
18
 
24
- ### When NOT to Use
25
- - Direct edit or low-risk Fast path where review is not required
26
- - No `spec.md` or `plan.md` exists and there is no clear task goal to review against
27
- - Trivial typo, formatting, or config-only changes that the user wants committed directly
19
+ - Direct edit or low-risk Fast path where review is intentionally skipped
20
+ - No task goal, specification, plan, or other review contract can be identified
21
+ - Trivial changes the user explicitly wants committed without review
28
22
 
29
23
  ## Input
30
24
 
31
25
  | Parameter | Required | Description |
32
- |-----------|----------|-------------|
33
- | `artifact_dir` | No | Directory containing `spec.md` and `plan.md`. If omitted, scan `.prizmkit/` subdirectories for the most recently modified directory with a completed `plan.md`. When invoked as a handoff step, reuse the caller's `artifact_dir` rather than re-detecting. |
26
+ |---|---|---|
27
+ | `artifact_dir` | No | Directory containing `spec.md` and `plan.md`. Reuse a caller-provided directory. Otherwise locate the most recently modified completed change artifact under `.prizmkit/`. |
34
28
 
35
- ## Phase 0: Context and Snapshot
29
+ ## Required Assets
36
30
 
37
- 1. Read `spec.md` from the artifact directory and extract goals plus acceptance criteria.
38
- 2. Read `plan.md` from the artifact directory and extract architecture decisions plus completed tasks.
39
- 3. Read a scoped `/prizmkit-test` report when present:
40
- - If `{artifact_dir}/test-report-path.txt` exists, read the pointed report.
41
- - Extract Scope, Generated / Updated Tests, In-Scope Failures, Baseline Failures, Out of Scope Gaps, Boundary Matrix / Boundary Completion Gate, and Verdict when present.
42
- - If no report exists, pass `No scoped /prizmkit-test report found` as informational context. Treat missing tests as a finding only when the lifecycle path required testing before review.
43
- 4. Read dev rules when configured: load `.prizmkit/prizm-docs/root.prizm`, then referenced `.prizmkit/rules/<layer>-rules.md` files if any exist.
44
- 5. Capture the current workspace manifest and review payload according to `${SKILL_DIR}/references/reviewer-workspace-protocol.md`. Include:
45
- - baseline repository and revision identity
46
- - `git status`, `git diff`, and `git diff --cached` evidence
47
- - staged, unstaged, untracked, deleted, and renamed path inventory
48
- - changed content and stable content identities sufficient to detect missing, stale, or mixed snapshots
49
- - relevant root Prizm rules and plan decisions
50
- 6. If no changes are detected, skip Phase 1 and write `review-report.md` with verdict PASS, rounds 0, review mode `not-run-no-changes`, and snapshot verification `NOT_APPLICABLE`.
31
+ Read before starting the loop:
51
32
 
52
- ## Phase 1: Review-Fix Loop
33
+ - `${SKILL_DIR}/references/reviewer-agent-prompt.md`: complete Reviewer input and output contract
34
+ - `${SKILL_DIR}/references/review-report-template.md`: final report contract
35
+ - `${SKILL_DIR}/assets/reviewer-role.json`: semantic read-only and non-delegating Reviewer boundary used by platform adapters
53
36
 
54
- ### Gate Mode Detection
37
+ The contract defines semantic capabilities rather than depending on a platform-specific tool or Agent name.
55
38
 
56
- Check Python availability:
39
+ ## Phase 0: Collect Review Context
57
40
 
58
- ```bash
59
- python3 --version 2>/dev/null && echo "SCRIPT_MODE" || echo "TEXT_MODE"
60
- ```
41
+ 1. Read `spec.md` and extract goals plus acceptance criteria when it exists.
42
+ 2. Read `plan.md` and extract architecture decisions plus completed tasks when it exists.
43
+ 3. Read scoped `/prizmkit-test` evidence when `{artifact_dir}/test-report-path.txt` exists. Preserve its verdict, in-scope failures, baseline failures, gaps, and boundary evidence.
44
+ 4. Read `.prizmkit/prizm-docs/root.prizm`, applicable progressive docs, and project rules.
45
+ 5. Inspect and capture the complete current Git change:
46
+ - staged and unstaged tracked changes;
47
+ - untracked files;
48
+ - deleted and renamed files;
49
+ - the base revision and relevant unchanged callers, dependents, contracts, and tests.
50
+ 6. Prepare the Reviewer input with staged and unstaged Git diffs plus the full content of every untracked file. Include deleted and renamed states explicitly. The Reviewer role may have file-reading capabilities without shell or Git execution, so a changed-path inventory alone is insufficient.
51
+ 7. If no changes exist, skip Reviewer launch, write a zero-round `PASS` report, and finish.
61
52
 
62
- - Script mode: use `${SKILL_DIR}/scripts/check_loop.py` for round tracking, max-round enforcement, and divergence detection.
63
- - Text mode: follow §Text Fallback Constraints manually with identical behavior.
53
+ ### Checkout Access
64
54
 
65
- ### Step 0: Initialize Loop State
55
+ Prefer a Reviewer that can read the active checkout directly. Give it the repository path, staged and unstaged Git diffs, the full content of every untracked file, and the changed-path inventory. Direct checkout access lets the Reviewer perform targeted surrounding-context reads without requiring shell or Git execution.
66
56
 
67
- - `round = 1`
68
- - `max_rounds = 3`
69
- - `findings_history = []`
70
- - `review_mode = independent-reviewer-verified-snapshot` after snapshot verification succeeds
57
+ If the platform forces an isolated worktree:
71
58
 
72
- ### Step 1: Establish Independent Review
59
+ 1. provide the same staged and unstaged diffs, untracked file contents, and changed-path states used for active-checkout review;
60
+ 2. tell the Reviewer to use the worktree only for baseline and surrounding-context reads;
61
+ 3. clearly label supplied changed content separately from unchanged context;
62
+ 4. do not require the Reviewer to prove that the two physical checkouts are identical.
73
63
 
74
- Use the skill-owned review contract:
64
+ If required changed content is missing, supply it before consuming the review. If essential context cannot be made available, return `BLOCKED` with a concise infrastructure reason.
65
+
66
+ ## Phase 1: Convergence Loop
67
+
68
+ Track only:
75
69
 
76
70
  ```yaml
77
- prompt_reference: ${SKILL_DIR}/references/reviewer-agent-prompt.md
78
- workspace_protocol: ${SKILL_DIR}/references/reviewer-workspace-protocol.md
79
- reviewer_contract: independent, read-only, workspace-equivalent
71
+ round: 1
72
+ completed_rounds: 0
73
+ final_verdict: null
74
+ findings: []
80
75
  ```
81
76
 
82
- 1. Read both references and fill the Reviewer prompt with Phase 0 context plus the workspace manifest and payload.
83
- 2. Choose a subagent launch and snapshot transport strategy supported by the current platform. Strategy choice belongs to the Main Agent because platforms expose different capabilities; do not treat a particular tool parameter, checkout layout, branch name, or transport as part of the skill contract.
84
- 3. Require the Reviewer to verify snapshot equivalence before reviewing. Different physical paths or execution environments are acceptable when the verified review view is content-equivalent to the captured Main-Agent workspace.
85
- 4. If the Reviewer returns `WORKSPACE_MISMATCH`, repair or replace the strategy only when equivalence can be established safely. Otherwise write a `NEEDS_FIXES` report with the verification failure unresolved and stop; do not perform Main-Agent self-review.
86
- 5. After the Main Agent applies fixes, capture and verify a fresh snapshot for the next round because the previous snapshot is stale by definition.
77
+ The safety fuse is fixed at ten completed rounds. It is not caller-configurable and never converts unresolved defects into `PASS`.
87
78
 
88
- ### Step 2: Run Review
79
+ ### Step 1: Launch One Fresh Reviewer
89
80
 
90
- Round context:
91
- - Round 1: examine all current changes comprehensively.
92
- - Round 2+: verify prior fixes, look for regressions introduced by the fixes, and identify accepted findings that remain.
81
+ 1. Select an execution mechanism that actually limits the Reviewer to read-only inspection and prevents workspace mutation, downstream execution creation, delegation, orchestration re-entry, and skill invocation.
82
+ 2. Launch exactly one fresh foreground Reviewer for this round.
83
+ 3. Provide the complete current review input using `${SKILL_DIR}/references/reviewer-agent-prompt.md`.
84
+ 4. Do not provide previous-round findings, verdicts, filtering decisions, rejection reasons, or repair explanations.
93
85
 
94
- Review result:
95
- - `PASS`: no findings.
96
- - `NEEDS_FIXES`: one or more findings with severity, dimension, location, problem, and suggested fix.
97
- - `WORKSPACE_MISMATCH`: snapshot equivalence was not established; this is a review transport failure, not a code verdict.
86
+ Do not substitute Main-Agent self-review. If the Reviewer cannot start or exits abnormally, return `BLOCKED`. This does not consume a completed round.
98
87
 
99
- ### Step 3: Loop Exit Gate
88
+ ### Step 2: Complete Independent Review
100
89
 
101
- Call the gate only when:
90
+ The Reviewer evaluates the complete current change, not only the latest repair. It checks requirements, implementation completeness, concrete failure scenarios, error handling, security, data integrity, concurrency, contracts, compatibility, tests, and project rules.
102
91
 
103
- 1. Review returned `PASS`.
104
- 2. The Main Agent has filtered `NEEDS_FIXES` findings.
92
+ It may inspect unchanged callers, dependents, shared patterns, and tests when needed to establish a concrete issue. Prefer targeted read-only inspection over broad repository scans or redundant verification.
105
93
 
106
- Do not call the gate for `NEEDS_FIXES` before filtering because `accepted_count` is not known. Handle `WORKSPACE_MISMATCH` through Step 1 rather than passing it to the code-verdict gate.
94
+ A usable result is either:
107
95
 
108
- Script mode invocation:
96
+ - `PASS`: no concrete finding;
97
+ - `FINDINGS`: one or more structured candidate defects.
109
98
 
110
- ```bash
111
- echo '{"reviewer_result":"NEEDS_FIXES","accepted_count":2,"findings_count":3,"round":1,"findings_history":[],"max_rounds":3,"filtering_done":true}' | python3 ${SKILL_DIR}/scripts/check_loop.py
99
+ If output is partial, malformed, or cannot be understood safely, return `BLOCKED`. This does not consume a completed round.
100
+
101
+ ### Step 3: Main Agent Filters Findings
102
+
103
+ A usable Reviewer result completes the current round. Increment `completed_rounds` before adjudication.
104
+
105
+ For every finding, classify it as:
106
+
107
+ - `accepted`: current code and governing evidence support the concrete failure scenario;
108
+ - `rejected`: code, requirements, contracts, or tests concretely disprove it, or show that it is outside scope with no regression path.
109
+
110
+ Record a concise evidence-based reason for every rejected finding. Do not reject a finding because it is inconvenient, uncertain, low severity, or expensive to repair. When a potentially real defect cannot be refuted, accept it or leave it unresolved.
111
+
112
+ Apply these rules exactly:
113
+
114
+ ```text
115
+ Reviewer returns PASS -> PASS
116
+ Reviewer returns findings and accepted = 0 -> PASS
117
+ Reviewer returns findings and accepted > 0 -> repair or stop
112
118
  ```
113
119
 
114
- The gate output determines whether to end the loop. If `divergenceWarning` is true, warn the user that the loop may not be converging.
120
+ When all findings are rejected, `accepted = 0`; the review is `PASS` because the Reviewer found no valid defect. Do not launch another Reviewer merely because the raw Reviewer result contained findings.
115
121
 
116
- ### Text Fallback Constraints
122
+ ### Step 4: Repair or Stop
117
123
 
118
- When Python is unavailable, apply these rules manually:
124
+ When `accepted > 0`:
119
125
 
120
- 1. `PASS` exits with verdict PASS.
121
- 2. `NEEDS_FIXES` continues to filtering before any all-rejected or max-round exit.
122
- 3. If all findings are rejected after filtering, exit with verdict PASS.
123
- 4. If `round >= 3` after filtering and accepted findings remain, exit with verdict NEEDS_FIXES.
124
- 5. If findings count strictly increases for 3 consecutive recorded rounds, warn about possible divergence.
125
- 6. Record `findings_history` once per round and increment `round` after a complete review/filter/fix cycle.
126
+ 1. If `completed_rounds` is ten, return `NEEDS_FIXES` and record the accepted findings as unresolved.
127
+ 2. Otherwise the Main Agent directly repairs every accepted finding that can be fixed safely within scope. Do not launch a Fixer or implementation subagent.
128
+ 3. Run the narrowest meaningful verification for the repair.
129
+ 4. If a finding cannot be repaired safely, return `NEEDS_FIXES` and record why it remains unresolved.
130
+ 5. Recollect the complete current change, increment `round`, and launch a fresh Reviewer with no previous-round findings or repair history.
126
131
 
127
- ### Step 4: Main Agent Filters Findings
132
+ ## Phase 2: Persist Final Report
128
133
 
129
- For each finding, decide whether it is reasonable:
134
+ Write exactly one required review artifact:
130
135
 
131
- - Is the finding relevant to the current changes?
132
- - Is it a real problem rather than a subjective style preference?
133
- - Would the fix improve the code without broad out-of-scope refactoring?
134
- - Does the finding conflict with the spec, plan, dev rules, or current test evidence?
136
+ ```text
137
+ {artifact_dir}/review-report.md
138
+ ```
135
139
 
136
- Output per finding:
137
- - Accepted: queue for direct Main Agent fix work.
138
- - Rejected: record a short reason such as out of scope, not a defect, or too risky for the current task.
140
+ Use `${SKILL_DIR}/references/review-report-template.md`. The report records:
139
141
 
140
- After filtering, call the Loop Exit Gate. If `endLoop=true`, proceed to Phase 2.
142
+ - `PASS`, `NEEDS_FIXES`, or `BLOCKED`;
143
+ - completed round count;
144
+ - findings and their `fixed`, `rejected`, or `unresolved` disposition;
145
+ - a concise final summary;
146
+ - an infrastructure reason when blocked.
141
147
 
142
- ### Step 5: Main Agent Applies Accepted Fixes
148
+ Do not create a separate persisted review state file. Raw Reviewer output remains in the session log.
143
149
 
144
- The Main Agent applies accepted findings directly in its current workspace. Keeping fix ownership with the Main Agent prevents the read-only Reviewer from becoming a second, conflicting implementation authority.
150
+ The report may be rendered directly or with the optional helper by sending minimal JSON on standard input:
145
151
 
146
- If an accepted finding cannot be fixed safely within scope, record the reason and carry the finding into `review-report.md` as unresolved.
152
+ ```bash
153
+ python3 ${SKILL_DIR}/scripts/render_review_report.py \
154
+ {artifact_dir}/review-report.md < review-report-input.json
155
+ ```
147
156
 
148
- After fixes are complete, record results, increment the round, capture a fresh workspace snapshot, and return to Step 1.
157
+ The input may be transient; it is not a required artifact.
149
158
 
150
- ## Phase 2: Output
159
+ ## Final Outcomes
151
160
 
152
- Write `review-report.md` to the artifact directory, including no-change PASS and workspace-verification failure results. Read `${SKILL_DIR}/references/review-report-template.md` for the full output format.
161
+ - `PASS`: no changes existed, the Reviewer returned `PASS`, or a completed round left `accepted = 0`, including when all findings are rejected.
162
+ - `NEEDS_FIXES`: accepted findings remain unresolved or the tenth completed round still has accepted findings.
163
+ - `BLOCKED`: Reviewer execution or essential review input failed before a usable result was obtained.
153
164
 
154
- Required report fields:
155
- - Verdict: `PASS` or `NEEDS_FIXES`
156
- - Review Mode: `independent-reviewer-verified-snapshot` or `not-run-no-changes`
157
- - Reviewer Strategy: concise strategy summary without relying on platform-specific parameter names
158
- - Snapshot Verification: `VERIFIED`, `FAILED`, or `NOT_APPLICABLE`
159
- - Snapshot Identity: manifest identity or failure reason
160
- - Rounds and total findings
161
- - Fixed, rejected, and unresolved findings
162
- - Final summary
165
+ Completion handoff:
163
166
 
164
- Completion summary:
165
- - `PASS`: hand off to `/prizmkit-retrospective` when docs or durable knowledge changed, otherwise `/prizmkit-committer`.
166
- - `NEEDS_FIXES`: inform the caller of unresolved code findings or snapshot-verification blockers.
167
+ - `PASS`: run `/prizmkit-retrospective` when structural docs or durable knowledge changed; otherwise proceed to `/prizmkit-committer`.
168
+ - `NEEDS_FIXES`: report unresolved code findings and stop.
169
+ - `BLOCKED`: report the infrastructure reason and allow retry without consuming the code-convergence budget.
@@ -0,0 +1,19 @@
1
+ {
2
+ "protocol_version": 2,
3
+ "role_name": "prizmkit-code-reviewer",
4
+ "description": "Use only as the one fresh independent read-only Reviewer for a completed /prizmkit-code-review round.",
5
+ "observational_capabilities": [
6
+ "read-files",
7
+ "search-content",
8
+ "search-paths"
9
+ ],
10
+ "unavailable_capabilities": [
11
+ "workspace-mutation",
12
+ "shell-execution",
13
+ "downstream-execution-creation",
14
+ "delegation-equivalent-behavior",
15
+ "orchestration-reentry",
16
+ "skill-invocation"
17
+ ],
18
+ "execution_mode": "foreground-independent-review"
19
+ }
@@ -1,37 +1,40 @@
1
1
  # Review Report Output Template
2
2
 
3
- Used in Phase 2 of `/prizmkit-code-review`. Write `review-report.md` to the artifact directory using this format.
3
+ Write the final result to `{artifact_dir}/review-report.md`. This is the only required persisted review artifact.
4
4
 
5
5
  ```markdown
6
6
  # Review Report
7
7
 
8
- ## Verdict: <PASS|NEEDS_FIXES>
9
- ## Review Mode: <independent-reviewer-verified-snapshot|not-run-no-changes>
10
- ## Reviewer Strategy: <platform-selected strategy summary|not-applicable>
11
- ## Snapshot Verification: <VERIFIED|FAILED|NOT_APPLICABLE>
12
- ## Snapshot Identity: <manifest identity or failure reason>
13
- ## Rounds: <number of completed review rounds; use 0 for no-change PASS or pre-review snapshot failure>
14
- ## Total findings: <total> → Fixed: <fixed>, Rejected: <rejected>, Unresolved: <unresolved>
8
+ ## Verdict: <PASS|NEEDS_FIXES|BLOCKED>
9
+ ## Rounds Completed: <number>
10
+ ## Total Findings: <total> Fixed: <fixed>, Rejected: <rejected>, Unresolved: <unresolved>
15
11
 
16
- ## Round <N>
17
- Findings: <count> | Accepted: <count>, Rejected: <count>
12
+ ## Findings
18
13
 
19
14
  ### Finding <N>: <short title>
15
+
20
16
  - Severity: <high|medium|low>
21
- - Dimension: <goal-alignment|defect|completeness|consistency|security|test-quality|rules-compliance>
22
- - Location: <filepath:line or project-level>
17
+ - Location: <filepath:line|project-level>
23
18
  - Problem: <what was wrong and why it mattered>
24
- - Status: <fixed (round N)|rejected — reason|unresolved — reason>
19
+ - Failure Scenario: <concrete input or state>
20
+ - Disposition: <fixed in round N|rejected — concrete evidence|unresolved — reason>
25
21
 
26
- ## Final Summary
27
- <One to three sentences summarizing the review outcome, snapshot verification, and any remaining blocker.>
28
- ```
22
+ ## Blocker
29
23
 
30
- For `PASS` with no findings, write `Total findings: 0 Fixed: 0, Rejected: 0, Unresolved: 0` and either `## Round 0: PASS — no workspace changes to review` or `## Round N: PASS — no issues found`.
24
+ <Include only for BLOCKED: concise infrastructure failure and required action.>
31
25
 
32
- For snapshot verification failure, use verdict `NEEDS_FIXES`, snapshot verification `FAILED`, and record the mismatch as an unresolved review blocker rather than an ordinary code finding.
26
+ ## Summary
27
+
28
+ <One to three sentences covering the final outcome. Do not expose private reasoning traces.>
29
+ ```
33
30
 
34
- ## Verdict Rules
31
+ ## Report Rules
35
32
 
36
- - `PASS`: Reviewer returned no findings from a verified snapshot, no workspace changes existed, or all findings from a verified snapshot were rejected as unreasonable.
37
- - `NEEDS_FIXES`: Max rounds completed with accepted findings unresolved, or no independent Reviewer could verify an equivalent current snapshot.
33
+ - A no-change review uses zero completed rounds and returns `PASS`.
34
+ - A usable Reviewer result counts as one completed round.
35
+ - Reviewer launch failure, abnormal exit, or unusable output returns `BLOCKED` and does not add a completed round.
36
+ - `PASS` requires no accepted or unresolved finding. This includes a Reviewer `PASS` and a findings result where the Main Agent rejects every finding with concrete evidence.
37
+ - The tenth completed round with accepted findings returns `NEEDS_FIXES`.
38
+ - `BLOCKED` describes review infrastructure or missing essential context, not a code defect.
39
+ - Overwrite the same report on each execution; keep raw round output only in the session log.
40
+ - Do not persist a separate review state file.
@@ -1,92 +1,120 @@
1
- # Reviewer Subagent Prompt Template
1
+ # Reviewer Prompt Contract
2
2
 
3
- Used in Phase 1 Step 1 of `/prizmkit-code-review`. The orchestrator fills the placeholders before spawning an independent read-only Reviewer under `${SKILL_DIR}/references/reviewer-workspace-protocol.md`.
3
+ Use this complete template for every Reviewer execution. Fill the documented placeholders with current-round context. Do not include previous-round findings, verdicts, filtering decisions, rejection reasons, or repair explanations.
4
4
 
5
- ```
6
- You are the independent read-only Reviewer for `/prizmkit-code-review`. Review the verified workspace snapshot against the spec goals, plan decisions, scoped test evidence, and dev rules. Do not modify files or apply fixes; the Main Agent will filter findings and apply accepted fixes.
5
+ ```text
6
+ You are the sole independent read-only Reviewer for this round of `/prizmkit-code-review`.
7
7
 
8
- ## Spec Goals
9
- {goals and acceptance criteria from spec.md}
8
+ ## Execution Boundary
10
9
 
11
- ## Plan Decisions
12
- {architecture decisions and task list from plan.md}
10
+ Perform the complete review yourself.
13
11
 
14
- ## Scoped Test Report
15
- {summary from artifact_dir/test-report-path.txt and test-report.md, including Scope, Generated / Updated Tests, In-Scope Failures, Baseline Failures, Out of Scope Gaps, Boundary Matrix / Boundary Completion Gate if present, and Verdict. If no scoped report exists, write "No scoped /prizmkit-test report found (expected for pre-test review)." Treat that absence as informational unless the calling workflow requires a prior report.}
12
+ Do not create, schedule, resume, continue, request, or coordinate any separate downstream execution unit. Do not re-enter orchestration, invoke a skill, delegate review work, or ask the Main Agent to create a helper.
16
13
 
17
- ## Workspace Manifest
18
- {repository and baseline identity, review-round identity, changed path inventory and statuses, staged/unstaged composition, untracked content entries, delete markers, rename pairs, and stable content identities captured by the Main Agent}
14
+ Do not modify, create, delete, rename, stage, or commit workspace files. Use only read-only inspection capabilities.
19
15
 
20
- ## Review Payload
21
- {the reviewable representation of every manifest entry, plus clearly identified unchanged context needed to evaluate callers, dependents, or shared patterns}
16
+ If you cannot complete the review in this execution context, return `BLOCKED` with the missing capability or context. Do not delegate and do not return a partial `PASS`.
22
17
 
23
- ## Reviewer Strategy
24
- {concise description of how the current platform made the snapshot available. This is diagnostic context, not a required parameter contract.}
18
+ ## Independent Input Boundary
25
19
 
26
- ## Workspace Equivalence Guard
27
- Validate the supplied manifest and payload according to the Reviewer Workspace Protocol before normal review:
28
- - Every manifest path and state must be represented.
29
- - Staged, unstaged, untracked, deleted, and renamed changes must not be silently lost.
30
- - Changed content identities and review-round identity must match.
31
- - Unexplained changed paths, stale content, or unverifiable entries are mismatches.
20
+ Review only the current state supplied below. No previous-round findings, verdicts, filtering decisions, rejection reasons, repair descriptions, or Reviewer reasoning are part of your input.
32
21
 
33
- Do not reject a snapshot merely because its physical path, checkout layout, branch label, host, or transport differs from the Main Agent's environment. Content equivalence is the invariant.
22
+ ## Goals and Acceptance Criteria
34
23
 
35
- If equivalence cannot be proven:
36
- - Stop before normal review.
37
- - Do not produce ordinary findings.
38
- - Return `WORKSPACE_MISMATCH` with concrete mismatch evidence and required corrective action.
24
+ {goals and acceptance criteria from spec.md, or "No spec artifact found; infer the requested behavior from the user goal and current change."}
39
25
 
40
- ## Dev Rules
41
- {rules from .prizmkit/rules/<layer>-rules.md, or "No custom dev rules configured — use general best practices."}
26
+ ## Plan and Intended Change
42
27
 
43
- ## Review Round
44
- Round {N}. {round_context}
28
+ {relevant architecture decisions and completed tasks from plan.md, or a concise current task description}
45
29
 
46
- ## What to Review
47
- Use the verified workspace snapshot as the primary review scope:
48
- - Read the full content of new files.
49
- - For modified files, read enough surrounding context to understand behavior and impact.
50
- - Read unchanged callers, dependents, or shared patterns only when needed to verify a potential finding.
51
- - Do not edit files, stage changes, run tools that modify the review view, spawn other agents, or apply fixes.
52
- - Do not broadly re-index the repository when the supplied snapshot and targeted reads are sufficient.
30
+ ## Applicable Rules and Contracts
53
31
 
54
- ## Review Dimensions
55
- Evaluate the relevant dimensions:
32
+ {relevant Prizm docs, project rules, public and internal contracts, or "No additional project rules identified."}
56
33
 
57
- 1. **Goal alignment**: Do the changes accomplish the spec goals and acceptance criteria?
58
- 2. **Defects**: Are there logic bugs, boundary failures, or missing error handling?
59
- 3. **Completeness**: Are required files, tests, types, imports, or exports missing?
60
- 4. **Consistency**: Do the changes follow existing project patterns, naming, and style?
61
- 5. **Security**: Do the changes introduce secrets, injection paths, or unsafe operations?
62
- 6. **Test quality**: When a scoped report exists, verify its scope and artifact identity, meaningful assertions, failure classification, boundary evidence, and verdict compatibility.
63
- 7. **Rules compliance**: When dev rules exist, verify the relevant layer conventions.
34
+ ## Test Evidence
64
35
 
65
- ## Output Format
66
- Respond with exactly this structure:
36
+ {current scoped test evidence, or "No scoped test report found."}
37
+
38
+ ## Current Change
39
+
40
+ - Repository and Reviewer-visible checkout: {path or platform-visible location}
41
+ - Base revision: {base revision when known}
42
+ - Changed paths and states: {staged, unstaged, untracked, deleted, and renamed inventory}
43
+ - Review access: {active checkout, or forced worktree used only for baseline and surrounding context}
44
+
45
+ ## Supplied Git Diff
46
+
47
+ ### Staged
48
+
49
+ {complete staged diff, or "No staged changes."}
50
+
51
+ ### Unstaged
52
+
53
+ {complete unstaged diff, or "No unstaged tracked changes."}
54
+
55
+ ## Supplied Untracked Files
56
+
57
+ {path and full content of every untracked file, or "No untracked files."}
58
+
59
+ Treat the supplied diffs, path states, and untracked file contents as the authoritative current change. Use read-only file inspection for targeted surrounding context, callers, dependents, contracts, and tests. Do not depend on shell or Git execution being available.
60
+
61
+ If a platform-forced worktree does not contain the active checkout's dirty or untracked changes, use the worktree only for baseline and surrounding-context reads. You are not required to calculate hashes or prove equivalence between physical checkouts. If an essential changed file or diff is missing from the supplied input, return `BLOCKED` and identify exactly what is missing.
62
+
63
+ ## Complete Current-Change Review
64
+
65
+ Review the complete current change independently. Do not limit inspection to one file or one suspected issue.
66
+
67
+ Evaluate applicable dimensions:
67
68
 
68
- ### Result: PASS | NEEDS_FIXES | WORKSPACE_MISMATCH
69
+ 1. Requirement and acceptance-criteria alignment
70
+ 2. Implementation completeness
71
+ 3. Correctness and concrete failure scenarios
72
+ 4. Error handling
73
+ 5. Security and authorization
74
+ 6. Data integrity
75
+ 7. Transaction and concurrency behavior
76
+ 8. Public and internal contracts
77
+ 9. Backward compatibility and regression risks
78
+ 10. Test adequacy and evidence compatibility
79
+ 11. Project-rule compliance
69
80
 
70
- ### Snapshot Verification
71
- - Status: VERIFIED | FAILED
72
- - Identity: <manifest identity or mismatch summary>
81
+ Use both directions in this review:
82
+
83
+ - Code-forward: changed code affected symbols → callers and dependents → concrete failure scenarios
84
+ - Requirement-backward: requirements and contracts → required behavior → implementation path → side effects → test evidence
85
+
86
+ Read unchanged callers, dependents, shared patterns, or tests when needed. Prefer targeted read-only inspection. Do not perform a broad repository scan without a concrete cross-cutting reason.
87
+
88
+ ## Finding Standard
89
+
90
+ Report every concrete defect you find, including low-severity issues. Exclude pure style preferences and speculative concerns that lack a concrete wrong behavior, contract violation, regression path, security weakness, data-integrity risk, or misleading test result.
91
+
92
+ ## Output Contract
93
+
94
+ Respond with exactly this structure:
95
+
96
+ ### Result: PASS | FINDINGS | BLOCKED
73
97
 
74
98
  ### Findings
75
- (If PASS, write "No issues found." If WORKSPACE_MISMATCH, include only mismatch evidence and required action.)
76
99
 
77
- #### Finding N
78
- - **Severity**: high | medium | low
79
- - **Dimension**: goal-alignment | defect | completeness | consistency | security | test-quality | rules-compliance
80
- - **Location**: filepath:line (or "project-level")
81
- - **Problem**: What is wrong and why it matters
82
- - **Suggestion**: Recommended fix approach
83
- - **Verification**: How to confirm the fix is correct
100
+ If the result is `PASS`, write:
84
101
 
85
- ### Summary
86
- One to two sentences about the snapshot and overall state of the changes.
87
- ```
102
+ No issues found.
103
+
104
+ If the result is `BLOCKED`, write only the missing capability or essential context and the required action.
105
+
106
+ If the result is `FINDINGS`, repeat this block for every concrete issue:
88
107
 
89
- ## Round Context
108
+ #### Finding N: <short title>
109
+ - Severity: high | medium | low
110
+ - Location: filepath:line (or "project-level")
111
+ - Problem: concrete wrong behavior and why it matters
112
+ - Failure scenario: inputs or state that produce the wrong result
113
+ - Reasoning: concise evidence connecting the current code to the failure
114
+ - Suggested repair: smallest safe repair approach
115
+ - Verification: how to prove the repair
90
116
 
91
- - Round 1: "This is the first review. Examine all changes comprehensively."
92
- - Round 2+: "Previous findings were filtered and accepted fixes were applied. Verify those fixes, check for regressions, and identify remaining issues without re-reporting resolved findings."
117
+ ### Summary
118
+
119
+ One or two sentences describing the current change and result. Do not expose private reasoning traces.
120
+ ```