prizmkit 1.1.123 → 1.1.124

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.
@@ -0,0 +1,179 @@
1
+ # Reviewer Execution Protocol
2
+
3
+ This protocol is the mandatory execution contract for `/prizmkit-code-review`. It defines semantic guarantees rather than platform tool, agent, workflow, or command names.
4
+
5
+ ## Terms
6
+
7
+ | Term | Meaning |
8
+ |---|---|
9
+ | Orchestrator | The single Main Agent that controls rounds, filters findings, and applies accepted fixes |
10
+ | Reviewer | The single independent read-only review authority for one round |
11
+ | Downstream execution unit | Any separately scheduled or executed worker, reviewer, task, workflow child, team member, remote job, or equivalent delegated execution |
12
+ | Delegation-equivalent capability | Any capability that can create, schedule, resume, continue, request, or coordinate downstream execution |
13
+ | Orchestration re-entry | Entering a process that can delegate, fan out, or become another review orchestrator |
14
+ | Capability attestation | Launch-time evidence that the Reviewer environment satisfies the mandatory capability boundary |
15
+ | Completed round | A round whose Reviewer output passed execution and workspace validation |
16
+ | Convergence | A completed round leaves zero accepted findings |
17
+ | Safety fuse | The internal ten-round automation limit |
18
+
19
+ ## Normative Invariants
20
+
21
+ ```yaml
22
+ reviewer_execution:
23
+ sole_review_authority_per_round: true
24
+ fresh_execution_per_round: true
25
+ observational_workspace_access: true
26
+ mutation_capability: unavailable
27
+ delegation_equivalent_capability: unavailable
28
+ orchestration_reentry_capability: unavailable
29
+ max_reviewers_per_round: 1
30
+ max_descendant_execution_units: 0
31
+ max_delegation_depth: 0
32
+ normal_termination: convergence
33
+ internal_safety_review_limit: 10
34
+ ```
35
+
36
+ Additional invariants:
37
+
38
+ 1. Only the Main Agent starts a Reviewer or the next round.
39
+ 2. A Reviewer cannot create, request, continue, resume, refresh, replace, or coordinate another execution unit.
40
+ 3. A Reviewer cannot invoke an equivalent review orchestrator.
41
+ 4. A Reviewer performs the complete review itself and cannot delegate a subset.
42
+ 5. If the review does not fit its execution context, it returns `REVIEW_INFRASTRUCTURE_BLOCKED` rather than delegating.
43
+ 6. Reviewer output is unusable until execution and workspace validation both pass.
44
+ 7. Every round uses a fresh execution identity. Reviewer sessions are never reused.
45
+ 8. A Reviewer receives no prior findings, verdicts, filtering decisions, repair descriptions, or reasoning.
46
+ 9. The Main Agent applies accepted fixes directly; it does not create a separate Fixer or Dev Agent.
47
+
48
+ ## Capability Attestation
49
+
50
+ Before every launch, establish this claim with platform-native evidence:
51
+
52
+ ```yaml
53
+ capability_attestation:
54
+ mutation_capability: unavailable
55
+ delegation_equivalent_capability: unavailable
56
+ downstream_execution_creation: unavailable
57
+ orchestration_reentry_capability: unavailable
58
+ review_execution: foreground-single-authority
59
+ status: VERIFIED
60
+ ```
61
+
62
+ A prompt promise is not evidence. The selected execution environment must actually remove the prohibited capabilities through a capability-scoped role, restricted tool surface, sandbox policy, launch wrapper, capability token, or equivalent mechanism.
63
+
64
+ If the platform cannot establish the boundary:
65
+
66
+ ```text
67
+ Do not launch Reviewer
68
+ → verdict: NEEDS_FIXES
69
+ → blockerCode: REVIEW_INFRASTRUCTURE_BLOCKED
70
+ ```
71
+
72
+ ## One-Reviewer Topology
73
+
74
+ Required topology:
75
+
76
+ ```text
77
+ Main Agent
78
+ ├── Round 1: one fresh Reviewer, no descendants
79
+ ├── Round 2: one fresh Reviewer, no descendants
80
+ ├── ...
81
+ └── Round N: one fresh Reviewer, no descendants
82
+ ```
83
+
84
+ The Main Agent owns all loop state. No Reviewer may start its successor.
85
+
86
+ ## Execution Validation
87
+
88
+ Validate topology before consuming output:
89
+
90
+ 1. Exactly one fresh Reviewer started in the active round.
91
+ 2. Capability attestation is `VERIFIED`.
92
+ 3. Observed descendant execution units equal zero.
93
+ 4. Observed delegation depth equals zero.
94
+ 5. Orchestration status is `COMPLIANT`.
95
+ 6. Execution evidence is sufficient to support those claims.
96
+
97
+ The Reviewer's own compliance declaration is supplementary. It never replaces launch-time attestation or platform-observed evidence.
98
+
99
+ ## Runtime Violation
100
+
101
+ A violation exists when a Reviewer creates or requests downstream execution, re-enters orchestration, causes more than one Reviewer in a round, exceeds zero delegation depth, or makes compliance unverifiable.
102
+
103
+ On violation:
104
+
105
+ 1. Stop the Reviewer and identifiable descendants on a best-effort basis.
106
+ 2. Discard the complete Reviewer output.
107
+ 3. Do not consume or filter findings.
108
+ 4. Do not count the round as completed.
109
+ 5. Do not retry or start another Reviewer.
110
+ 6. Terminate Code Review.
111
+ 7. Return `NEEDS_FIXES` with `REVIEW_ORCHESTRATION_VIOLATION`.
112
+
113
+ Cleanup success is not required to declare failure.
114
+
115
+ ## Complete Independent Review
116
+
117
+ Every valid round reviews the complete current implementation against the complete applicable specification, plan, rules, contracts, callers, dependents, and test evidence. Later rounds are not finding reconciliation or fix-only verification.
118
+
119
+ A fresh Reviewer may independently rediscover an unresolved defect or find a defect earlier Reviewers missed. Historical findings are intentionally withheld to avoid anchoring.
120
+
121
+ ## Convergence and Safety Fuse
122
+
123
+ Normal completion occurs only when a usable completed round leaves zero accepted findings:
124
+
125
+ - the Reviewer reports no findings; or
126
+ - the Main Agent rejects every finding with concrete evidence.
127
+
128
+ When accepted findings remain, the Main Agent repairs the accepted batch and starts a fresh complete round.
129
+
130
+ The internal limit is ten Reviewer executions. Rounds one through ten may return `PASS` when they converge. If round ten leaves accepted findings:
131
+
132
+ ```text
133
+ Do not apply another automatic repair
134
+ Do not start round 11
135
+ → verdict: NEEDS_FIXES
136
+ → blockerCode: REVIEW_SAFETY_LIMIT_REACHED
137
+ ```
138
+
139
+ ## External Verdicts and Blockers
140
+
141
+ External verdicts:
142
+
143
+ ```text
144
+ PASS
145
+ NEEDS_FIXES
146
+ ```
147
+
148
+ Diagnostic blocker codes:
149
+
150
+ ```text
151
+ REVIEW_INFRASTRUCTURE_BLOCKED
152
+ REVIEW_ORCHESTRATION_VIOLATION
153
+ WORKSPACE_MISMATCH
154
+ REVIEW_SAFETY_LIMIT_REACHED
155
+ INVALID_REVIEW_RESULT
156
+ ```
157
+
158
+ A blocker code is metadata, not a third verdict.
159
+
160
+ ## Non-Normative Recognition Examples
161
+
162
+ These examples help identify prohibited semantics but do not define compliance:
163
+
164
+ - starting another Agent to inspect a subsystem;
165
+ - invoking a Workflow that fans out workers;
166
+ - entering another code-review Skill;
167
+ - asking a task runner or Main Agent to create a helper on the Reviewer's behalf;
168
+ - creating a remote review job;
169
+ - resuming a stopped helper or successor execution.
170
+
171
+ A future capability with a different name remains prohibited when it creates or coordinates downstream execution.
172
+
173
+ ## Platform Mapping
174
+
175
+ A platform mapping is valid only when its actual launch configuration proves all normative capabilities.
176
+
177
+ For a current platform that supports project-defined subagent roles and a strict capability allowlist, a role containing only observational file-inspection capabilities can satisfy the launch boundary. Omitting downstream-execution and skill-orchestration capabilities is required; a deny instruction in prose is insufficient.
178
+
179
+ Platforms without an equivalent enforceable role or launch restriction are unsupported for independent Reviewer execution and fail closed. Platform support may be added later through canonical adapters or runtime launchers without changing this protocol.
@@ -1,90 +1,118 @@
1
1
  # Reviewer Workspace Protocol
2
2
 
3
- Use this protocol whenever `/prizmkit-code-review` delegates review to an independent Reviewer. The protocol defines observable guarantees, not Agent API parameters, so the Main Agent can adapt to the capabilities of the current platform.
3
+ Use this protocol for every `/prizmkit-code-review` round. Workspace equivalence and execution compliance are independent requirements; both must pass before Reviewer output is usable.
4
4
 
5
- ## Protocol Invariants
5
+ ## Invariants
6
6
 
7
- 1. **Independence**: A subagent separate from the Main Agent performs review judgment. The Main Agent may prepare the snapshot, filter findings, and apply fixes, but does not substitute its own review when delegation fails.
8
- 2. **Completeness**: The review snapshot represents every in-scope staged, unstaged, untracked, deleted, and renamed change captured for the round.
9
- 3. **Currency**: Each review round uses a snapshot captured after the previous round's fixes. Never reuse a prior-round snapshot as evidence of current state.
10
- 4. **Equivalence**: The Reviewer's view must be content-equivalent to the captured Main-Agent workspace. Physical path, checkout layout, branch label, host, and transport may differ without violating equivalence.
11
- 5. **Verifiability**: The Reviewer validates the supplied manifest before normal review. Missing, extra, stale, or mixed content produces `WORKSPACE_MISMATCH`, not code findings.
12
- 6. **Read-only review**: The Reviewer does not modify files or apply fixes. This keeps review evidence stable and preserves clear fix ownership.
7
+ 1. **Complete logical view**: represent staged, unstaged, untracked, deleted, and renamed changes plus required unchanged callers and dependents.
8
+ 2. **Currency**: capture a new snapshot after every accepted repair batch.
9
+ 3. **Equivalence**: the Reviewer's logical view matches the captured Main-Agent workspace even when physical location or transport differs.
10
+ 4. **Determinism**: the same repository state and inputs produce the same manifest identity.
11
+ 5. **Verifiability**: missing, extra, stale, mixed, or unverifiable content produces `WORKSPACE_MISMATCH`.
12
+ 6. **Execution separation**: a matched workspace does not prove the non-delegating execution boundary, and execution compliance does not prove workspace equivalence.
13
+ 7. **Main-Agent ownership**: only the Main Agent refreshes snapshots or launches successor Reviewers.
13
14
 
14
- ## Strategy Selection
15
+ ## Deterministic Manifest
15
16
 
16
- Choose a platform-supported strategy that can satisfy all protocol invariants. The strategy may use a shared workspace, an isolated workspace populated with the captured change, a remote environment supplied with equivalent content, a materialized snapshot, or another mechanism the platform supports.
17
+ Prefer `${SKILL_DIR}/scripts/workspace_snapshot.py` when Python and Git are available.
17
18
 
18
- Do not encode a particular Agent type, model, isolation value, branch convention, directory prefix, or transport command into the skill contract. Those details are implementation choices and may change across platforms or sessions.
19
+ The manifest contains:
19
20
 
20
- Prefer the least elaborate strategy that can prove equivalence. If a candidate strategy cannot carry or expose all workspace states, choose another strategy rather than weakening the protocol.
21
+ ```text
22
+ protocol version
23
+ repository identity
24
+ baseline identity
25
+ snapshot identity
26
+ path inventory
27
+ change type
28
+ staged and unstaged composition
29
+ rename and delete state
30
+ content identity for available blobs
31
+ supporting-context identity
32
+ ```
21
33
 
22
- ## Workspace Manifest
34
+ Use path-safe Git output so spaces, Unicode, quoting, renames, and deletions remain unambiguous. A prose summary is not a deterministic manifest.
23
35
 
24
- Create a manifest for each round containing enough information to detect an incomplete or stale review view:
36
+ ## Review Payload
25
37
 
26
- - repository identity and baseline revision
27
- - round number or equivalent monotonic round identity
28
- - changed path inventory and each path's status
29
- - staged and unstaged composition when both exist for a path
30
- - untracked file content required for review
31
- - deleted-path markers
32
- - rename source and destination pairs
33
- - stable content identities for changed content and any review-critical context
34
- - relevant spec, plan, dev-rule, and scoped-test evidence identities or embedded content
38
+ Provide both:
35
39
 
36
- The exact encoding is implementation-defined. Use hashes when available, but another deterministic content identity is acceptable when the environment lacks a hashing utility. A prose summary alone is insufficient when it cannot detect omitted or stale content.
40
+ 1. the complete manifest used for verification;
41
+ 2. a reviewable representation of every manifest entry.
37
42
 
38
- ## Review Payload
43
+ A representation may be workspace files, complete content, patches plus required base content, or equivalent materialization. Diff summaries alone are insufficient for new files or findings that depend on surrounding code.
39
44
 
40
- Provide the Reviewer with both:
45
+ Supporting unchanged context must be clearly distinguished from changed content.
41
46
 
42
- 1. The manifest used for verification.
43
- 2. A reviewable representation of every manifest entry.
47
+ ## Content-Addressed Reuse
44
48
 
45
- A reviewable representation may be workspace files, complete file content, patches plus required base content, or an equivalent materialization. Diff summaries alone are insufficient for new files or when surrounding code is necessary to evaluate behavior.
49
+ Round one establishes the complete logical snapshot. Later rounds may transfer only changed blobs while referring to unchanged content by stable identity:
46
50
 
47
- Supply targeted dependency or caller context when required to verify impact. Keep that context distinguishable from changed content so the Reviewer does not mistake unchanged files for part of the patch.
51
+ ```text
52
+ current logical workspace
53
+ = unchanged content-addressed blobs
54
+ + current-round changed blobs
55
+ + current complete manifest
56
+ ```
57
+
58
+ Reuse optimizes transport, never review scope. Every Reviewer remains responsible for the complete current change.
48
59
 
49
60
  ## Reviewer Verification
50
61
 
51
- Before normal review, the Reviewer checks:
62
+ Before normal review, verify:
52
63
 
53
- 1. Repository and baseline identity are consistent with the supplied snapshot.
54
- 2. Every changed path in the manifest is available in the review payload.
55
- 3. No unexplained changed path appears outside the manifest.
56
- 4. Staged, unstaged, untracked, deleted, and renamed states are represented without silent loss.
57
- 5. Content identities match the manifest.
58
- 6. The snapshot belongs to the current review round.
64
+ 1. repository and baseline identity;
65
+ 2. every path and state in the manifest is represented;
66
+ 3. no unexplained changed path exists outside the manifest;
67
+ 4. staged, unstaged, untracked, deleted, and renamed states are preserved;
68
+ 5. content identities match;
69
+ 6. supporting-context identities match;
70
+ 7. the snapshot belongs to the active round.
59
71
 
60
- When all checks pass, report snapshot verification as `VERIFIED` and proceed with review.
72
+ On success, return `Snapshot Verification: VERIFIED` and proceed.
61
73
 
62
- When a check cannot be completed or fails, stop normal review and return:
74
+ On failure:
63
75
 
64
76
  ```text
65
77
  ### Result: WORKSPACE_MISMATCH
66
78
 
67
79
  ### Snapshot Verification
68
80
  - Status: FAILED
69
- - Mismatch: <missing, extra, stale, or unverifiable manifest entries>
70
- - Required action: <what the Main Agent must re-capture, transport, or verify>
81
+ - Identity: <expected and observed identity>
82
+ - Mismatch: <missing, extra, stale, mixed, or unverifiable entries>
83
+ - Required action: <what snapshot preparation failed>
71
84
  ```
72
85
 
73
- Do not emit ordinary code findings after `WORKSPACE_MISMATCH`, because findings from an unverified snapshot could misrepresent the current change.
86
+ Do not emit ordinary findings after a mismatch.
74
87
 
75
- ## Round Refresh
88
+ ## Transport Preparation and Failure Boundary
76
89
 
77
- After accepted fixes are applied:
90
+ Before launch, snapshot transport may use:
78
91
 
79
- 1. Discard the previous manifest as current evidence.
80
- 2. Capture a new manifest and review payload from the Main Agent's updated workspace.
81
- 3. Establish a fresh independent Reviewer view using any valid strategy.
82
- 4. Repeat Reviewer verification before the next review.
92
+ 1. the preferred strategy;
93
+ 2. at most one alternate strategy.
83
94
 
84
- A platform may reuse an existing Reviewer session only when the refreshed payload replaces stale state and equivalence is verified again.
95
+ Both attempts occur before a Reviewer starts. Do not spend the one-Reviewer budget on transport discovery.
96
+
97
+ After launch, any mismatch makes the Reviewer output unusable and terminates Code Review:
98
+
99
+ ```text
100
+ Discard output
101
+ Do not launch a replacement Reviewer
102
+ → verdict: NEEDS_FIXES
103
+ → blockerCode: WORKSPACE_MISMATCH
104
+ ```
105
+
106
+ This prevents workspace repair from becoming another unbounded Reviewer loop.
107
+
108
+ ## Round Refresh
85
109
 
86
- ## Failure Boundary
110
+ After the Main Agent applies accepted fixes:
87
111
 
88
- Retry or change strategy when the mismatch is repairable. Stop when the platform cannot provide an independent Reviewer with a verifiable equivalent snapshot.
112
+ 1. retain prior identities only as internal report evidence;
113
+ 2. capture a new complete manifest and payload;
114
+ 3. reuse unchanged blobs by content identity where supported;
115
+ 4. create a fresh Reviewer execution identity;
116
+ 5. repeat workspace verification.
89
117
 
90
- Record the failure as an unresolved review blocker with verdict `NEEDS_FIXES`, snapshot verification `FAILED`, and the mismatch evidence. Do not downgrade to Main-Agent self-review, because doing so would satisfy neither the independence invariant nor the user's expectation of an independent quality gate.
118
+ Never reuse a Reviewer session or send historical findings to the fresh Reviewer.