prizmkit 1.1.130 → 1.1.134
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.
- package/bundled/VERSION.json +3 -3
- package/bundled/adapters/claude/command-adapter.js +0 -2
- package/bundled/dev-pipeline/.env.example +1 -1
- package/bundled/dev-pipeline/assets/skill-subagent-integration.md +11 -6
- package/bundled/dev-pipeline/prizmkit_runtime/checkpoint_state.py +445 -8
- package/bundled/dev-pipeline/prizmkit_runtime/gitops.py +2 -9
- package/bundled/dev-pipeline/prizmkit_runtime/processes.py +21 -1
- package/bundled/dev-pipeline/prizmkit_runtime/runner_classification.py +87 -66
- package/bundled/dev-pipeline/prizmkit_runtime/runner_models.py +53 -3
- package/bundled/dev-pipeline/prizmkit_runtime/runner_recovery.py +55 -25
- package/bundled/dev-pipeline/prizmkit_runtime/runner_status.py +4 -0
- package/bundled/dev-pipeline/prizmkit_runtime/runners.py +119 -18
- package/bundled/dev-pipeline/prizmkit_runtime/sessions.py +3 -2
- package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +411 -17
- package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +57 -14
- package/bundled/dev-pipeline/scripts/generate-recovery-prompt.py +5 -4
- package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +55 -2
- package/bundled/dev-pipeline/scripts/prompt_framework.py +152 -1
- package/bundled/dev-pipeline/scripts/update-bug-status.py +53 -0
- package/bundled/dev-pipeline/scripts/update-checkpoint.py +294 -69
- package/bundled/dev-pipeline/scripts/update-feature-status.py +57 -0
- package/bundled/dev-pipeline/scripts/update-refactor-status.py +53 -0
- package/bundled/dev-pipeline/templates/bootstrap-prompt.md +5 -5
- package/bundled/dev-pipeline/templates/bootstrap-tier3.md +28 -22
- package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +24 -10
- package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +20 -2
- package/bundled/dev-pipeline/templates/sections/bugfix-phase-commit-report.md +2 -2
- package/bundled/dev-pipeline/templates/sections/bugfix-phase-diagnose-plan.md +1 -1
- package/bundled/dev-pipeline/templates/sections/bugfix-phase-manual-verification.md +5 -10
- package/bundled/dev-pipeline/templates/sections/bugfix-phase-review.md +9 -19
- package/bundled/dev-pipeline/templates/sections/bugfix-phase-test.md +21 -0
- package/bundled/dev-pipeline/templates/sections/bugfix-session-status.md +1 -1
- package/bundled/dev-pipeline/templates/sections/checkpoint-system.md +10 -10
- package/bundled/dev-pipeline/templates/sections/context-budget-rules.md +1 -1
- package/bundled/dev-pipeline/templates/sections/headless-commit-authorization.md +15 -0
- package/bundled/dev-pipeline/templates/sections/phase-commit-full.md +2 -2
- package/bundled/dev-pipeline/templates/sections/phase-commit.md +2 -2
- package/bundled/dev-pipeline/templates/sections/phase-prizmkit-test.md +26 -23
- package/bundled/dev-pipeline/templates/sections/phase-review-agent.md +5 -5
- package/bundled/dev-pipeline/templates/sections/phase-review-full.md +15 -11
- package/bundled/dev-pipeline/templates/sections/refactor-phase-commit-report.md +1 -1
- package/bundled/dev-pipeline/templates/sections/refactor-phase-review.md +6 -6
- package/bundled/dev-pipeline/templates/sections/refactor-phase-test.md +21 -0
- package/bundled/dev-pipeline/templates/sections/refactor-reminders.md +1 -1
- package/bundled/dev-pipeline/templates/sections/subagent-timeout-recovery.md +1 -1
- package/bundled/dev-pipeline/templates/sections/task-contract.md +4 -0
- package/bundled/dev-pipeline/tests/test_checkpoint_state.py +362 -3
- package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +349 -48
- package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +129 -0
- package/bundled/dev-pipeline/tests/test_generate_refactor_prompt.py +91 -0
- package/bundled/dev-pipeline/tests/test_python_runner_parity.py +567 -23
- package/bundled/dev-pipeline/tests/test_unified_cli.py +37 -10
- package/bundled/skills/_metadata.json +63 -26
- package/bundled/skills/app-planner/SKILL.md +4 -3
- package/bundled/skills/bug-fix-workflow/SKILL.md +89 -180
- package/bundled/skills/bug-planner/SKILL.md +12 -27
- package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +131 -220
- package/bundled/skills/bugfix-pipeline-launcher/references/configuration.md +36 -90
- package/bundled/skills/feature-pipeline-launcher/SKILL.md +129 -271
- package/bundled/skills/feature-pipeline-launcher/references/configuration.md +35 -76
- package/bundled/skills/feature-planner/SKILL.md +27 -22
- package/bundled/skills/feature-planner/assets/planning-guide.md +4 -4
- package/bundled/skills/feature-workflow/SKILL.md +94 -121
- package/bundled/skills/prizmkit/SKILL.md +130 -94
- package/bundled/skills/prizmkit/references/workflow-state-protocol.md +181 -0
- package/bundled/skills/prizmkit-code-review/SKILL.md +132 -86
- package/bundled/skills/prizmkit-code-review/references/independent-code-review.md +243 -0
- package/bundled/skills/prizmkit-code-review/references/review-report-template.md +42 -1
- package/bundled/skills/prizmkit-code-review/references/workflow-state-protocol.md +181 -0
- package/bundled/skills/prizmkit-code-review/scripts/render_review_report.py +93 -1
- package/bundled/skills/prizmkit-committer/SKILL.md +125 -48
- package/bundled/skills/prizmkit-committer/references/workflow-state-protocol.md +181 -0
- package/bundled/skills/prizmkit-implement/SKILL.md +99 -73
- package/bundled/skills/prizmkit-implement/references/implementation-subagent-procedure.md +1 -1
- package/bundled/skills/prizmkit-implement/references/workflow-state-protocol.md +181 -0
- package/bundled/skills/prizmkit-init/SKILL.md +5 -5
- package/bundled/skills/prizmkit-plan/SKILL.md +146 -105
- package/bundled/skills/prizmkit-plan/assets/plan-template.md +18 -0
- package/bundled/skills/prizmkit-plan/references/independent-plan-review.md +242 -0
- package/bundled/skills/prizmkit-plan/references/review-plan-spec-loop.md +4 -4
- package/bundled/skills/prizmkit-plan/references/workflow-state-protocol.md +181 -0
- package/bundled/skills/prizmkit-retrospective/SKILL.md +111 -53
- package/bundled/skills/prizmkit-retrospective/references/knowledge-injection-steps.md +7 -6
- package/bundled/skills/prizmkit-retrospective/references/structural-sync-steps.md +5 -4
- package/bundled/skills/prizmkit-retrospective/references/workflow-state-protocol.md +181 -0
- package/bundled/skills/prizmkit-test/SKILL.md +52 -6
- package/bundled/skills/prizmkit-test/assets/authoritative-records.schema.json +63 -12
- package/bundled/skills/prizmkit-test/assets/evidence-manifest.schema.json +1 -1
- package/bundled/skills/prizmkit-test/assets/evidence-package-template.json +13 -0
- package/bundled/skills/prizmkit-test/references/evidence-protocol.md +6 -1
- package/bundled/skills/prizmkit-test/references/evidence-request-protocol.md +8 -1
- package/bundled/skills/prizmkit-test/references/examples.md +1 -1
- package/bundled/skills/prizmkit-test/references/test-generation-steps.md +4 -1
- package/bundled/skills/prizmkit-test/references/test-report-template.md +1 -1
- package/bundled/skills/prizmkit-test/references/trusted-evidence-execution.md +15 -0
- package/bundled/skills/prizmkit-test/references/workflow-state-protocol.md +181 -0
- package/bundled/skills/prizmkit-test/scripts/build_test_evidence.py +744 -23
- package/bundled/skills/prizmkit-test/scripts/validate_test_evidence.py +194 -15
- package/bundled/skills/prizmkit-workflow/SKILL.md +266 -0
- package/bundled/skills/prizmkit-workflow/references/workflow-state-protocol.md +181 -0
- package/bundled/skills/recovery-workflow/SKILL.md +62 -241
- package/bundled/skills/recovery-workflow/evals/evals.json +17 -33
- package/bundled/skills/recovery-workflow/references/detection.md +28 -52
- package/bundled/skills/recovery-workflow/scripts/detect-recovery-state.py +105 -439
- package/bundled/skills/refactor-pipeline-launcher/SKILL.md +136 -275
- package/bundled/skills/refactor-pipeline-launcher/references/configuration.md +53 -88
- package/bundled/skills/refactor-planner/SKILL.md +12 -57
- package/bundled/skills/refactor-planner/references/behavior-preservation.md +111 -230
- package/bundled/skills/refactor-planner/references/error-recovery.md +37 -0
- package/bundled/skills/refactor-planner/references/planning-phases.md +11 -17
- package/bundled/skills/refactor-planner/scripts/validate-and-generate-refactor.py +1 -1
- package/bundled/skills/refactor-workflow/SKILL.md +98 -139
- package/bundled/templates/project-memory-template.md +4 -4
- package/package.json +1 -1
- package/src/index.js +4 -0
- package/src/prompts.js +10 -3
- package/src/scaffold.js +1 -1
- package/bundled/dev-pipeline/tests/test-deploy-safety.sh +0 -223
- package/bundled/skills/feature-pipeline-launcher/scripts/preflight-check.py +0 -462
|
@@ -1,55 +1,66 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: "prizmkit-code-review"
|
|
3
|
-
description: "Review the complete current change
|
|
3
|
+
description: "Review the complete current change for a formal PrizmKit requirement with a mandatory bounded Main-Agent loop and optional capability-gated independent correctness review. Directly repair accepted corrections, verify repairs, converge to PASS or stop with NEEDS_FIXES, and hand off to prizmkit-test. (project)"
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# PrizmKit Code Review
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
`/prizmkit-code-review` is the mandatory review stage after implementation and before the full test stage. The current Main Agent owns the complete baseline review loop: it discovers findings, adjudicates them, directly repairs accepted findings, verifies repairs, and continues until the review converges or stops safely. After convergence, one strictly capability-gated independent Reviewer may objectively check the complete current implementation without taking mutation or final-decision authority.
|
|
9
9
|
|
|
10
10
|
## Execution Boundary
|
|
11
11
|
|
|
12
|
-
-
|
|
12
|
+
- Main-Agent review remains mandatory and must not be delegated directly or indirectly.
|
|
13
|
+
- After Main-Agent convergence only, this skill may create the single independent Reviewer defined by `${SKILL_DIR}/references/independent-code-review.md` when every structural capability in that reference is proven.
|
|
13
14
|
- Do not invoke another review skill or review workflow from inside this skill.
|
|
14
|
-
- Do not launch review work through a general-purpose execution unit or relabel it as a finder, verifier, audit, compatibility review, verification, or gap sweep.
|
|
15
|
-
-
|
|
16
|
-
- The Main Agent may directly
|
|
17
|
-
-
|
|
15
|
+
- Do not launch any additional review work through a general-purpose execution unit or relabel it as a finder, verifier, audit, compatibility review, verification, or gap sweep.
|
|
16
|
+
- The independent Reviewer cannot mutate, execute arbitrary commands, or create downstream execution units; prompt instructions never substitute for these structural guarantees.
|
|
17
|
+
- The Main Agent may directly read, search, edit, and run targeted verification in the active workspace.
|
|
18
|
+
- Review repairs occur before the full `/prizmkit-test` stage so final test evidence represents the final reviewed workspace.
|
|
19
|
+
- `{artifact_dir}/review-report.md` is the only persisted review artifact for this execution.
|
|
20
|
+
|
|
21
|
+
## Atomic Stage Boundary
|
|
22
|
+
|
|
23
|
+
`prizmkit-code-review` owns the complete mandatory Main-Agent review, the optional independent correctness review, accepted-correction repairs, and review verification. It writes its truthful terminal result and `next_stage`, then returns control. It must not invoke `prizmkit-test` or `prizmkit-implement` itself; the active orchestrator owns outer repair routing and the next-stage invocation.
|
|
18
24
|
|
|
19
25
|
## When to Use
|
|
20
26
|
|
|
21
|
-
- After `/prizmkit-implement`
|
|
22
|
-
-
|
|
23
|
-
- When
|
|
27
|
+
- After `/prizmkit-implement` reports `IMPLEMENTED`.
|
|
28
|
+
- After implementation repairs that changed production code, runtime configuration, schema, dependencies, or public interfaces.
|
|
29
|
+
- When workflow state routes a formal requirement back to review after `TEST_FAIL`.
|
|
30
|
+
- When the user asks for a complete review or commit readiness decision.
|
|
31
|
+
|
|
32
|
+
## When NOT to Use
|
|
24
33
|
|
|
25
|
-
|
|
34
|
+
- No valid `spec.md` and `plan.md` exist for the active requirement.
|
|
35
|
+
- Implementation tasks or required repair work remain incomplete.
|
|
36
|
+
- A test-stage environment stop is caused by availability rather than a review concern; resume from test when the environment is available.
|
|
37
|
+
- The request is a direct low-risk edit outside the formal requirement lifecycle.
|
|
38
|
+
|
|
39
|
+
## Input and State
|
|
26
40
|
|
|
27
41
|
| Parameter | Required | Description |
|
|
28
42
|
|---|---|---|
|
|
29
|
-
| `artifact_dir` | No | Directory containing `spec.md` and `plan.md`. Reuse
|
|
30
|
-
|
|
31
|
-
## Required Asset
|
|
43
|
+
| `artifact_dir` | No | Directory containing `spec.md` and `plan.md`. Reuse the caller's directory or workflow-state value. |
|
|
44
|
+
| `review_scope` | No | `full` for the initial review; `delta` for a production-affecting repair after a prior review pass. |
|
|
32
45
|
|
|
33
|
-
|
|
46
|
+
Every invocation must reuse the same `artifact_dir`. If workflow state is missing, reconstruct it from `spec.md`, `plan.md`, `review-report.md`, the current diff, and any test evidence, and report the reconstruction.
|
|
34
47
|
|
|
35
|
-
## Phase 0: Initialize Report and
|
|
48
|
+
## Phase 0: Initialize Report and Reuse Current Context
|
|
36
49
|
|
|
37
|
-
1. Resolve `{artifact_dir}` and `{artifact_dir}/review-report.md
|
|
38
|
-
2. At the start of
|
|
39
|
-
3.
|
|
40
|
-
4.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
5. Review in the active workspace so dirty and untracked content is authoritative.
|
|
46
|
-
6. If no changes exist, append final verification and exactly one final result with `PASS`, then finish.
|
|
50
|
+
1. Resolve `{artifact_dir}` and `{artifact_dir}/review-report.md` from the active requirement context.
|
|
51
|
+
2. At the start of each execution, replace any prior report with a new execution header using `${SKILL_DIR}/references/review-report-template.md`.
|
|
52
|
+
3. Within that execution, append progress after every review round, repair batch, final verification, and exactly one `## Final Result`.
|
|
53
|
+
4. Start from the Main Agent's current requirement context and inspect the complete workspace change first: `git status --short`, the staged diff, and the unstaged diff. Include untracked, deleted, and renamed files in the review scope.
|
|
54
|
+
5. Do not reread `spec.md`, `plan.md`, project rules, progressive docs, or unchanged source merely to recreate context the Main Agent already holds. Load only the missing or potentially stale material required to resolve a concrete ambiguity, verify an acceptance criterion, understand a changed contract, or reconstruct missing workflow state.
|
|
55
|
+
6. Inspect unchanged callers, dependents, contracts, or tests only when the diff changes or may violate an interface, shared behavior, or regression boundary. Do not perform an unconditional repository-wide dependency sweep.
|
|
56
|
+
7. For `review_scope=delta`, focus on files and behavior affected since the prior review pass and expand only across contracts implicated by that delta.
|
|
57
|
+
8. If no changes exist, record final verification and `PASS` only when the current requirement context and prior implementation state prove there is nothing left to review.
|
|
47
58
|
|
|
48
59
|
## Phase 1: Main-Agent Review Loop
|
|
49
60
|
|
|
50
|
-
The Main Agent reviews
|
|
61
|
+
The Main Agent reviews the complete current change, using the active requirement context and expanding beyond the diff only when a concrete acceptance criterion, contract, dependency, or regression risk requires it.
|
|
51
62
|
|
|
52
|
-
|
|
63
|
+
Use at most ten completed review rounds per execution. Track:
|
|
53
64
|
|
|
54
65
|
```yaml
|
|
55
66
|
main_review_rounds: 0
|
|
@@ -59,85 +70,120 @@ rejected_findings: 0
|
|
|
59
70
|
unresolved_findings: 0
|
|
60
71
|
```
|
|
61
72
|
|
|
62
|
-
|
|
73
|
+
For every candidate finding:
|
|
63
74
|
|
|
64
|
-
|
|
75
|
+
1. Describe a reproducible failure scenario, affected behavior, and evidence.
|
|
76
|
+
2. Classify exactly one of:
|
|
77
|
+
- `accepted`: evidence proves an in-scope repair is needed;
|
|
78
|
+
- `rejected`: evidence disproves the failure scenario;
|
|
79
|
+
- `unresolved`: correctness or safe repair cannot be established.
|
|
80
|
+
3. Treat Missing tools, permissions, environment, or required evidence as an unresolved finding when they prevent review verification.
|
|
81
|
+
4. If a repair cannot be completed safely, record an unresolved finding and return `NEEDS_FIXES`.
|
|
82
|
+
5. Append the review round to `review-report.md`.
|
|
65
83
|
|
|
66
|
-
|
|
67
|
-
2. Classify each candidate as exactly one of:
|
|
68
|
-
- `accepted`: concrete evidence supports the failure scenario and an in-scope repair is required;
|
|
69
|
-
- `rejected`: code, tests, contracts, or governing evidence disproves the failure scenario;
|
|
70
|
-
- `unresolved`: correctness cannot be established or repaired safely with the available evidence or environment.
|
|
71
|
-
3. Treat Missing tools, permissions, environment, or required evidence as an unresolved finding when they prevent required verification. Do not treat missing evidence as success.
|
|
72
|
-
4. Append `## Main Review Round N` with findings, accepted, rejected, unresolved, and the next action.
|
|
73
|
-
5. Apply these rules:
|
|
84
|
+
Round behavior:
|
|
74
85
|
|
|
75
86
|
```text
|
|
76
|
-
accepted = 0 and unresolved = 0
|
|
77
|
-
|
|
78
|
-
accepted
|
|
79
|
-
unresolved > 0 -> NEEDS_FIXES
|
|
80
|
-
repair cannot be completed safely -> unresolved finding -> NEEDS_FIXES
|
|
81
|
-
required verification fails or cannot be performed -> unresolved finding -> NEEDS_FIXES
|
|
82
|
-
```
|
|
87
|
+
accepted = 0 and unresolved = 0
|
|
88
|
+
→ review converged
|
|
89
|
+
→ when all candidate findings are rejected, accepted remains 0 and the review converges
|
|
83
90
|
|
|
84
|
-
|
|
91
|
+
accepted > 0 and rounds remain
|
|
92
|
+
→ Main Agent directly repairs accepted findings
|
|
93
|
+
→ targeted verification
|
|
94
|
+
→ next complete review round
|
|
85
95
|
|
|
86
|
-
|
|
96
|
+
unresolved > 0 or safe repair impossible
|
|
97
|
+
→ NEEDS_FIXES
|
|
98
|
+
|
|
99
|
+
maximum ten completed rounds reached with accepted findings
|
|
100
|
+
→ NEEDS_FIXES
|
|
101
|
+
```
|
|
87
102
|
|
|
88
|
-
|
|
103
|
+
## Phase 2: Repair and Verification
|
|
89
104
|
|
|
90
|
-
|
|
91
|
-
2. Run targeted tests, static checks, or other verification appropriate to each repaired behavior.
|
|
92
|
-
3. Inspect resulting changes and ensure the repair did not introduce a new regression.
|
|
93
|
-
4. Append `## Repair Verification` with fixed findings, verification evidence, and the next round.
|
|
94
|
-
5. Start the next complete review round.
|
|
105
|
+
For accepted findings while the round limit remains:
|
|
95
106
|
|
|
96
|
-
|
|
107
|
+
1. Repair directly in the active workspace.
|
|
108
|
+
2. Run targeted tests, static checks, or other verification appropriate to each repair.
|
|
109
|
+
3. Inspect the complete resulting diff for unrelated changes and regressions.
|
|
110
|
+
4. Append repair verification and continue the review loop.
|
|
97
111
|
|
|
98
|
-
|
|
112
|
+
Do not run the full auditable testing protocol as a substitute for this review stage. The full testing stage follows only after review `PASS`.
|
|
99
113
|
|
|
100
|
-
|
|
114
|
+
If a repair is unsafe, incomplete, or unverifiable, record an unresolved finding and finish with `NEEDS_FIXES`.
|
|
101
115
|
|
|
102
|
-
|
|
116
|
+
## Phase 3: Independent Code Review
|
|
103
117
|
|
|
104
|
-
-
|
|
105
|
-
- every repair and verification batch;
|
|
106
|
-
- final verification;
|
|
107
|
-
- the final result.
|
|
118
|
+
Run only after the Main-Agent review and repair loop converges with no unresolved finding. Main-Agent review remains mandatory on every host; this optional check never replaces or weakens it.
|
|
108
119
|
|
|
109
|
-
|
|
120
|
+
1. Read `${SKILL_DIR}/references/independent-code-review.md` and follow its complete contract.
|
|
121
|
+
2. Apply its all-or-nothing semantic Host Capability Gate. If any required structural capability is unavailable or unproven, create no Reviewer, append `independent-review-downgrade`, and preserve the valid completed Main-Agent review.
|
|
122
|
+
3. When the gate passes, capture bounded immutable input for the complete current change and create exactly one Code Reviewer with the reference's Initial Reviewer Prompt.
|
|
123
|
+
4. Use maximum five Reviewer responses. Append `independent-review-round` and `independent-adjudication` events. The Main Agent adjudicates every correction as `accepted`, `rejected`, or `unresolved` and retains all mutation authority.
|
|
124
|
+
5. For accepted corrections, repair directly in the active checkout, run targeted verification, and inspect the complete resulting change.
|
|
125
|
+
6. When responses remain, capture the complete fresh state and natively resume the exact same Reviewer. Never create a replacement Reviewer or simulate continuation with a fresh Reviewer plus summary.
|
|
126
|
+
7. If native resume fails after repair, append downgrade and rerun the Main-Agent review over that repair within the existing ten-round safety fuse.
|
|
127
|
+
8. If the fifth response causes a repair, run targeted verification, inspect the complete final change, record `Final State Independently Rechecked: no`, and do not send a sixth response.
|
|
128
|
+
9. `NO_CORRECTION_NEEDED` or all corrections rejected with evidence converges independent review. Any unresolved correction produces `NEEDS_FIXES`.
|
|
110
129
|
|
|
111
|
-
## Phase 4: Final
|
|
130
|
+
## Phase 4: Final Result
|
|
112
131
|
|
|
113
132
|
Before completing:
|
|
114
133
|
|
|
115
|
-
1. Confirm the final workspace
|
|
116
|
-
2. Confirm
|
|
117
|
-
3.
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
134
|
+
1. Confirm the final workspace is the complete reviewed change.
|
|
135
|
+
2. Confirm all accepted findings are fixed and no unresolved finding remains for `PASS`.
|
|
136
|
+
3. Append final verification and exactly one final result.
|
|
137
|
+
|
|
138
|
+
Valid results:
|
|
139
|
+
|
|
140
|
+
```text
|
|
141
|
+
PASS | NEEDS_FIXES
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
`PASS` requires review convergence, no unresolved findings, and credible targeted verification. `NEEDS_FIXES` means an outer implementation repair is required or completion must stop safely.
|
|
145
|
+
|
|
146
|
+
## Workflow State and Outer Repair Routing
|
|
147
|
+
|
|
148
|
+
Before reading or updating workflow state, read `${SKILL_DIR}/references/workflow-state-protocol.md`.
|
|
149
|
+
|
|
150
|
+
On `PASS`, update workflow state:
|
|
151
|
+
|
|
152
|
+
```json
|
|
153
|
+
{
|
|
154
|
+
"stage": "code-review",
|
|
155
|
+
"status": "REVIEW_PASS",
|
|
156
|
+
"stage_result": "PASS",
|
|
157
|
+
"completed_stages": ["plan", "implement", "code-review"],
|
|
158
|
+
"next_stage": "test",
|
|
159
|
+
"resume_from": "prizmkit-test"
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
On `NEEDS_FIXES` caused by code findings, update workflow state:
|
|
164
|
+
|
|
165
|
+
```json
|
|
166
|
+
{
|
|
167
|
+
"stage": "code-review",
|
|
168
|
+
"status": "REVIEW_NEEDS_FIXES",
|
|
169
|
+
"stage_result": "NEEDS_FIXES",
|
|
170
|
+
"repair_scope": "production",
|
|
171
|
+
"next_stage": "implement",
|
|
172
|
+
"resume_from": "prizmkit-implement"
|
|
173
|
+
}
|
|
131
174
|
```
|
|
132
175
|
|
|
133
|
-
|
|
176
|
+
Increment the outer `repair_round` only when returning to implementation; the review-internal ten-round loop never increments it. The outer workflow permits at most three repair rounds and must return a truthful unresolved `NEEDS_FIXES` result instead of beginning a fourth.
|
|
134
177
|
|
|
135
|
-
|
|
136
|
-
- `NEEDS_FIXES`: round ten still has accepted findings, any finding remains unresolved, a repair cannot be completed safely, or required verification is unavailable or failed.
|
|
178
|
+
## Handoff
|
|
137
179
|
|
|
138
|
-
|
|
180
|
+
After `PASS`:
|
|
181
|
+
|
|
182
|
+
```text
|
|
183
|
+
REVIEW_PASS
|
|
184
|
+
→ /prizmkit-test
|
|
185
|
+
```
|
|
139
186
|
|
|
140
|
-
|
|
187
|
+
If workflow state names an active `orchestrator`, return `REVIEW_PASS`, the report/state paths, and `next_stage=test` to it; do not invoke test independently. For direct stage use, report the exact `/prizmkit-test` invocation and same `artifact_dir`; a host may perform that semantic handoff on the user's behalf.
|
|
141
188
|
|
|
142
|
-
|
|
143
|
-
- `NEEDS_FIXES`: report unresolved findings and stop.
|
|
189
|
+
After `NEEDS_FIXES`, stop and hand off to `/prizmkit-implement`; do not test or commit the unrepaired production change.
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
# Independent Code Review
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Run one optional independent correctness review after the mandatory Main-Agent review and repair loop has converged. The Reviewer determines whether the complete current implementation correctly satisfies the requirement and plan. It is not required to disagree and must return `NO_CORRECTION_NEEDED` when no correction is justified.
|
|
6
|
+
|
|
7
|
+
This reference is complete within `prizmkit-code-review`. Do not depend on another skill's prompt or a platform-generated Reviewer role.
|
|
8
|
+
|
|
9
|
+
## Required Ordering and Budget
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
Implementation complete
|
|
13
|
+
→ mandatory Main-Agent review and repair loop: maximum ten rounds
|
|
14
|
+
→ optional independent Code Reviewer: maximum five responses
|
|
15
|
+
→ PASS or NEEDS_FIXES
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
The independent budget does not replace, reduce, or extend the Main-Agent loop. Create at most one Reviewer for this Code Review stage. Never reuse it in another stage.
|
|
19
|
+
|
|
20
|
+
## Host Capability Gate
|
|
21
|
+
|
|
22
|
+
The gate is all-or-nothing. Before creating a Reviewer, the host must prove this semantic execution contract:
|
|
23
|
+
|
|
24
|
+
```yaml
|
|
25
|
+
execution_unit:
|
|
26
|
+
count: 1
|
|
27
|
+
access: read-only
|
|
28
|
+
mutation: unavailable
|
|
29
|
+
arbitrary_command_execution: unavailable
|
|
30
|
+
downstream_execution: structurally-unavailable
|
|
31
|
+
context_continuation: same-unit-native-resume
|
|
32
|
+
workspace_observation: bounded-active-checkout-input
|
|
33
|
+
model_configuration: inherit-current-session
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Rules:
|
|
37
|
+
|
|
38
|
+
- Prompt instructions cannot satisfy a missing structural capability.
|
|
39
|
+
- The decision must not branch on platform identity, tool name, execution-unit type name, adapter output, or a platform allowlist.
|
|
40
|
+
- If any capability is missing or cannot be proven, do not create a Reviewer. Use Strict Downgrade.
|
|
41
|
+
- A general execution unit with a prompt saying "do not mutate or delegate" is not eligible when those capabilities remain available.
|
|
42
|
+
- The Reviewer inherits the current session's model configuration. Do not add a separate model-selection contract.
|
|
43
|
+
|
|
44
|
+
## Review Input
|
|
45
|
+
|
|
46
|
+
Before each response, the Main Agent captures one bounded review input that is immutable for one response:
|
|
47
|
+
|
|
48
|
+
```text
|
|
49
|
+
review-input
|
|
50
|
+
├── manifest: input identity, response number, exact changed paths, states, and consistency markers
|
|
51
|
+
├── context: requirement, plan decisions, applicable rules, and prior adjudication on resume
|
|
52
|
+
└── payload: complete captured current change plus targeted supporting material
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The Code payload contains a logical representation of:
|
|
56
|
+
|
|
57
|
+
- staged tracked changes;
|
|
58
|
+
- unstaged tracked changes;
|
|
59
|
+
- untracked files;
|
|
60
|
+
- deleted and renamed files;
|
|
61
|
+
- the exact changed-file manifest;
|
|
62
|
+
- requirement goals and acceptance criteria;
|
|
63
|
+
- relevant plan decisions;
|
|
64
|
+
- applicable project rules and Prizm traps;
|
|
65
|
+
- targeted unchanged callers, dependents, contracts, schemas, or tests implicated by changed interfaces.
|
|
66
|
+
|
|
67
|
+
The Main Agent captures authoritative workspace state. The Reviewer does not run Git commands. Do not provide broad repository access as a substitute for complete current-change capture. The representation may use host-native immutable content or a read-only temporary payload outside the project change set; the protocol does not require a particular temporary path or command.
|
|
68
|
+
|
|
69
|
+
Before ordinary review, the Reviewer verifies that manifest, context, and payload agree. Missing paths, unexplained changed files, stale content, or mixed-round input produces `REVIEW_BLOCKED`, never partial success.
|
|
70
|
+
|
|
71
|
+
## Initial Reviewer Prompt
|
|
72
|
+
|
|
73
|
+
Instantiate the bracketed fields and retain every boundary below.
|
|
74
|
+
|
|
75
|
+
```text
|
|
76
|
+
You are the sole independent Code Reviewer for this PrizmKit Code Review stage.
|
|
77
|
+
|
|
78
|
+
Purpose:
|
|
79
|
+
Objectively determine whether the Main Agent's complete current implementation correctly satisfies the confirmed requirement and plan. You are not an adversary and are not required to disagree. Return NO_CORRECTION_NEEDED when the current implementation is correct.
|
|
80
|
+
|
|
81
|
+
Response:
|
|
82
|
+
This is response [RESPONSE_NUMBER] of a maximum five responses.
|
|
83
|
+
Review-input identity: [INPUT_ID]
|
|
84
|
+
Manifest: [MANIFEST]
|
|
85
|
+
Context: [CONTEXT]
|
|
86
|
+
Payload: [PAYLOAD]
|
|
87
|
+
Permitted targeted paths, if represented separately: [TARGETED_PATHS_OR_NONE]
|
|
88
|
+
|
|
89
|
+
Execution boundaries:
|
|
90
|
+
- Complete this review personally.
|
|
91
|
+
- Do not create, schedule, resume, continue, request, or coordinate another execution unit.
|
|
92
|
+
- Do not ask the Main Agent to create a helper.
|
|
93
|
+
- Do not re-enter orchestration, delegation, another review workflow, or an equivalent process.
|
|
94
|
+
- Do not modify, create, delete, rename, stage, commit, or otherwise mutate files.
|
|
95
|
+
- Do not execute commands, tests, builds, network calls, or any operation that can change state.
|
|
96
|
+
- Read only the bounded review input and explicitly permitted targeted paths.
|
|
97
|
+
- Do not perform broad repository discovery or a full repository scan.
|
|
98
|
+
- Report only corrections supported by a concrete target and evidence.
|
|
99
|
+
- Do not invent an issue merely to return feedback.
|
|
100
|
+
- Return REVIEW_BLOCKED rather than delegate or provide an incomplete success result.
|
|
101
|
+
- Do not expose private reasoning traces. Return only the required output.
|
|
102
|
+
|
|
103
|
+
First validate input consistency. Then review requirement and acceptance-criteria alignment, implementation completeness, concrete failure scenarios, error handling, security, authorization, data integrity, transaction/concurrency/state-transition behavior, public and internal contracts, compatibility and regression risk, test-boundary or evidence defects that can conceal incorrect behavior, and applicable project-rule compliance.
|
|
104
|
+
|
|
105
|
+
Do not rewrite the plan, modify code, execute tests, or perform broad exploratory repository discovery.
|
|
106
|
+
|
|
107
|
+
Return exactly one result using the Reviewer Output Protocol.
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Resume Prompt
|
|
111
|
+
|
|
112
|
+
Resume the exact same Reviewer; do not create a new Reviewer with this text. Instantiate the bracketed fields.
|
|
113
|
+
|
|
114
|
+
```text
|
|
115
|
+
Continue as the same independent Code Reviewer.
|
|
116
|
+
|
|
117
|
+
Response:
|
|
118
|
+
This is response [RESPONSE_NUMBER] of a maximum five responses.
|
|
119
|
+
New review-input identity: [INPUT_ID]
|
|
120
|
+
New manifest: [MANIFEST]
|
|
121
|
+
Current context: [CONTEXT]
|
|
122
|
+
Current payload: [PAYLOAD]
|
|
123
|
+
Previously accepted corrections: [ACCEPTED_CORRECTIONS_OR_NONE]
|
|
124
|
+
Repairs actually made: [REPAIRS_OR_NONE]
|
|
125
|
+
Main-Agent targeted verification: [VERIFICATION]
|
|
126
|
+
Previously rejected corrections and rejection evidence: [REJECTIONS_OR_NONE]
|
|
127
|
+
Unresolved items: [UNRESOLVED_OR_NONE]
|
|
128
|
+
|
|
129
|
+
All initial execution boundaries and the Reviewer Output Protocol remain mandatory. Review the complete current state, not only the repair and not the superseded payload. Do not repeat a rejected correction unless the new state invalidates the recorded rejection evidence. Validate the new input before ordinary review and return exactly one result.
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Reviewer Output Protocol
|
|
133
|
+
|
|
134
|
+
Return exactly one of these forms. Do not add severity, confidence, dimension, workflow impact, or acceptance fields.
|
|
135
|
+
|
|
136
|
+
### No Correction Needed
|
|
137
|
+
|
|
138
|
+
```markdown
|
|
139
|
+
### Result: NO_CORRECTION_NEEDED
|
|
140
|
+
|
|
141
|
+
### Corrections
|
|
142
|
+
None.
|
|
143
|
+
|
|
144
|
+
### Summary
|
|
145
|
+
<one or two sentences confirming what was reviewed>
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Correction Needed
|
|
149
|
+
|
|
150
|
+
```markdown
|
|
151
|
+
### Result: CORRECTION_NEEDED
|
|
152
|
+
|
|
153
|
+
### Corrections
|
|
154
|
+
|
|
155
|
+
#### Correction 1
|
|
156
|
+
- Target: <file and location, contract, or behavior>
|
|
157
|
+
- Problem: <what is currently incorrect>
|
|
158
|
+
- Evidence: <concrete basis or reproducible scenario>
|
|
159
|
+
- Correction: <recommended correction>
|
|
160
|
+
|
|
161
|
+
### Summary
|
|
162
|
+
<one or two sentences describing the current state>
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Every correction contains only `Target`, `Problem`, `Evidence`, and `Correction`.
|
|
166
|
+
|
|
167
|
+
### Review Blocked
|
|
168
|
+
|
|
169
|
+
```markdown
|
|
170
|
+
### Result: REVIEW_BLOCKED
|
|
171
|
+
|
|
172
|
+
### Blocker
|
|
173
|
+
- Target: <missing or inconsistent review input>
|
|
174
|
+
- Problem: <why a complete review cannot be performed>
|
|
175
|
+
- Evidence: <concrete mismatch or capability failure>
|
|
176
|
+
- Correction: <what input or host condition would unblock review>
|
|
177
|
+
|
|
178
|
+
### Summary
|
|
179
|
+
No review verdict was produced.
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
`REVIEW_BLOCKED` is an internal independent-review result, not a lifecycle verdict.
|
|
183
|
+
|
|
184
|
+
## Main-Agent Adjudication
|
|
185
|
+
|
|
186
|
+
The Main Agent verifies each proposed correction and records exactly one decision:
|
|
187
|
+
|
|
188
|
+
| Decision | Meaning | Action |
|
|
189
|
+
|---|---|---|
|
|
190
|
+
| `accepted` | Evidence proves an in-scope implementation correction is needed. | Main Agent repairs the current implementation and performs targeted verification. |
|
|
191
|
+
| `rejected` | Current code, contracts, tests, artifacts, or rules disprove the proposed problem. | Record concrete rejection evidence and make no change for it. |
|
|
192
|
+
| `unresolved` | Correctness or a safe repair cannot be established. | Record the item and return `NEEDS_FIXES`. |
|
|
193
|
+
|
|
194
|
+
The Reviewer never modifies files and cannot overrule adjudication.
|
|
195
|
+
|
|
196
|
+
Independent review converges normally when:
|
|
197
|
+
|
|
198
|
+
1. the Reviewer returns `NO_CORRECTION_NEEDED`; or
|
|
199
|
+
2. every correction in the current response is rejected with concrete evidence and no unresolved item remains.
|
|
200
|
+
|
|
201
|
+
## Response Algorithm
|
|
202
|
+
|
|
203
|
+
1. Run only after the Main-Agent review and repair loop converges with no unresolved finding.
|
|
204
|
+
2. Apply the Host Capability Gate.
|
|
205
|
+
3. If eligible, capture response 1 input and create exactly one Reviewer with the Initial Reviewer Prompt.
|
|
206
|
+
4. Validate the result against the Reviewer Output Protocol and append an independent-review round event.
|
|
207
|
+
5. Adjudicate every correction and append independent-adjudication events. Any unresolved item returns `NEEDS_FIXES`.
|
|
208
|
+
6. For accepted corrections, the Main Agent repairs the active checkout, runs targeted verification, and inspects the complete resulting change.
|
|
209
|
+
7. If one or more responses remain, capture the complete fresh current change and resume the exact same Reviewer with the Resume Prompt. Do not restart the complete ten-round Main-Agent loop after every ordinary independent correction.
|
|
210
|
+
8. If the fifth response causes a repair, no sixth response is allowed. Run targeted verification, inspect the complete final change, record final-budget handling and `Final State Independently Rechecked: no`, and do not exceed the response budget.
|
|
211
|
+
9. End the Reviewer when review converges, reaches the response limit, fails irrecoverably, or the stage becomes blocked. Explicitly terminate it when the host safely supports that operation; otherwise stop sending messages.
|
|
212
|
+
10. Complete the existing final verification and append exactly one `## Final Result` with `PASS` or `NEEDS_FIXES`.
|
|
213
|
+
|
|
214
|
+
## Strict Downgrade
|
|
215
|
+
|
|
216
|
+
Use strict downgrade in any of these cases:
|
|
217
|
+
|
|
218
|
+
- a required capability is unavailable or unproven before creation;
|
|
219
|
+
- Reviewer creation fails;
|
|
220
|
+
- the exact same Reviewer cannot be resumed or resume fails;
|
|
221
|
+
- execution-unit integrity becomes uncertain.
|
|
222
|
+
|
|
223
|
+
Behavior:
|
|
224
|
+
|
|
225
|
+
1. Never create a weaker or replacement Reviewer.
|
|
226
|
+
2. Never create a fresh Reviewer with a summary of the prior conversation; a summary is context, not native continuation.
|
|
227
|
+
3. When no Reviewer is created, record the downgrade and continue from the completed Main-Agent review if it remains valid.
|
|
228
|
+
4. When creation fails before any response, record the failure and preserve the completed Main-Agent review.
|
|
229
|
+
5. When resume fails after an accepted repair, Never create a replacement Reviewer; rerun the Main-Agent review over the repair, within the existing ten-round safety fuse, record the downgrade and fallback, and return `NEEDS_FIXES` if review cannot establish convergence.
|
|
230
|
+
6. Reviewer input problems may be corrected and sent to the same Reviewer only while response budget and native continuation remain available. Otherwise downgrade.
|
|
231
|
+
7. Report temporary input-cleanup failures honestly; cleanup failure does not change an otherwise verified review result.
|
|
232
|
+
|
|
233
|
+
Strict downgrade is visible reduced assurance, not a new lifecycle verdict and not permission to weaken the gate.
|
|
234
|
+
|
|
235
|
+
## Report Recording
|
|
236
|
+
|
|
237
|
+
Use the existing append-only `review-report.md` lifecycle and renderer events:
|
|
238
|
+
|
|
239
|
+
- `independent-review-round`: response number `1..5`, result, correction count, adjudication counts, and next action;
|
|
240
|
+
- `independent-adjudication`: correction summary, `accepted | rejected | unresolved`, evidence, and actual modification;
|
|
241
|
+
- `independent-review-downgrade`: reason, Main-Agent fallback, and whether the final state was independently rechecked.
|
|
242
|
+
|
|
243
|
+
The report remains the only persisted Code Review artifact. It ends with exactly one `## Final Result`; valid final verdicts remain `PASS | NEEDS_FIXES`.
|
|
@@ -39,6 +39,44 @@ Within that execution, append sections only. Never edit or replace an earlier pr
|
|
|
39
39
|
- Next: <next action>
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
+
### Independent Review Round
|
|
43
|
+
|
|
44
|
+
```markdown
|
|
45
|
+
## Independent Review Round <N>
|
|
46
|
+
|
|
47
|
+
- Result: <NO_CORRECTION_NEEDED | CORRECTION_NEEDED | REVIEW_BLOCKED>
|
|
48
|
+
- Corrections: <count>
|
|
49
|
+
- Accepted: <count>
|
|
50
|
+
- Rejected: <count>
|
|
51
|
+
- Unresolved: <count>
|
|
52
|
+
- Next: <next action>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Independent Adjudication
|
|
56
|
+
|
|
57
|
+
```markdown
|
|
58
|
+
## Independent Adjudication
|
|
59
|
+
|
|
60
|
+
- Correction: <summary>
|
|
61
|
+
- Decision: <accepted | rejected | unresolved>
|
|
62
|
+
- Evidence: <evidence>
|
|
63
|
+
- Modification: <actual change or none>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Repeat this section once per proposed correction.
|
|
67
|
+
|
|
68
|
+
### Independent Review Downgrade
|
|
69
|
+
|
|
70
|
+
```markdown
|
|
71
|
+
## Independent Review Downgrade
|
|
72
|
+
|
|
73
|
+
- Reason: <missing capability, creation failure, or native-resume failure>
|
|
74
|
+
- Fallback: <completed Main-Agent review or Main-Agent re-review of repair>
|
|
75
|
+
- Final State Independently Rechecked: <yes | no | not applicable>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Use this section for strict downgrade, including final-budget handling when the final allowed response causes a repair that cannot receive another independent response.
|
|
79
|
+
|
|
42
80
|
### Final Verification
|
|
43
81
|
|
|
44
82
|
```markdown
|
|
@@ -68,10 +106,13 @@ Exactly one Final Result terminates a completed execution:
|
|
|
68
106
|
|
|
69
107
|
- Start of a new execution removes stale progress and terminal results from prior executions.
|
|
70
108
|
- A phase appends its result before the next phase starts.
|
|
109
|
+
- Main-Agent round numbers are from `1` through `10`; independent Reviewer response numbers are from `1` through `5`.
|
|
110
|
+
- Independent Reviewer results are `NO_CORRECTION_NEEDED`, `CORRECTION_NEEDED`, or `REVIEW_BLOCKED`; they never replace the terminal lifecycle verdict.
|
|
111
|
+
- For an independent round, `accepted + rejected + unresolved = corrections`; `NO_CORRECTION_NEEDED` requires zero corrections.
|
|
71
112
|
- Finding counts satisfy `accepted + rejected + unresolved = findings`.
|
|
72
113
|
- `PASS` requires every accepted finding fixed and zero unresolved findings.
|
|
73
114
|
- `NEEDS_FIXES` requires at least one unfixed accepted or unresolved finding.
|
|
74
115
|
- An IN_PROGRESS report without Final Result is incomplete.
|
|
75
116
|
- Generic or incidental verdict text outside the last Final Result does not prove completion.
|
|
76
117
|
- Do not append any section after Final Result.
|
|
77
|
-
-
|
|
118
|
+
- A separate review-state JSON file is not required; the shared workflow state under `.prizmkit/state/workflows/` may record lifecycle handoff and recovery metadata.
|