@juicesharp/rpiv-pi 0.7.0 → 0.8.1
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/package.json
CHANGED
|
@@ -1,184 +1,403 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: code-review
|
|
3
|
-
description:
|
|
3
|
+
description: Three-pass parallel reviewer (quality, security, dependencies) with conditional advisor adjudication. Produces review documents in thoughts/shared/reviews/. Use when changes are ready for review.
|
|
4
4
|
argument-hint: [scope]
|
|
5
|
-
allowed-tools: Read, Bash(git *), Glob, Grep, Agent
|
|
6
5
|
---
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
## Scope Source
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
If the user has not specified what to review, ask them before proceeding. Scope is one of: `commit` (latest commit), `staged`, `working`, a commit hash or `A..B` range, or a PR branch name. Their input will appear as a follow-up paragraph after this skill body.
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
# Code Review
|
|
12
|
+
|
|
13
|
+
You are tasked with reviewing changes across three parallel lenses — **Quality**, **Security**, **Dependencies** — and synthesising their findings with optional stronger-model adjudication into an actionable `thoughts/shared/reviews/` artifact.
|
|
14
|
+
|
|
15
|
+
**How it works**:
|
|
16
|
+
- Resolve scope and assemble the diff (Step 1)
|
|
17
|
+
- Phase-1 Discovery Map (Step 2 — one agent + orchestrator-side git work)
|
|
18
|
+
- Phase-2 three-lens review + precedents + conditional CVE lookup (Step 3 — parallel agents)
|
|
19
|
+
- Reconcile findings via advisor (if present) or inline dimension-sweep (Step 4)
|
|
20
|
+
- Grounded-questions developer checkpoint (Step 5)
|
|
21
|
+
- Write the review artifact (Step 6)
|
|
22
|
+
- Present and handle follow-ups (Steps 7–8)
|
|
23
|
+
|
|
24
|
+
## Step 1: Resolve Scope and Assemble the Diff
|
|
25
|
+
|
|
26
|
+
1. **Parse the scope argument** (follow-up paragraph or the skill's argument):
|
|
27
|
+
- `commit` → `git diff HEAD~1 HEAD`
|
|
28
|
+
- `staged` → `git diff --cached`
|
|
29
|
+
- `working` → `git diff`
|
|
30
|
+
- Commit hash `abc1234` → `git show abc1234`
|
|
31
|
+
- Range `A..B` → `git diff A..B`
|
|
32
|
+
- PR branch name → `git diff $(git merge-base main HEAD)..HEAD` (or the branch vs its base)
|
|
33
|
+
|
|
34
|
+
2. **Read the full diff FIRST** (orchestrator-side, before any agent dispatch):
|
|
35
|
+
- `git diff --name-only [scope]` → `ChangedFiles` list
|
|
36
|
+
- `git diff --stat [scope]` → size summary
|
|
37
|
+
- `git diff -U0 [scope]` → hunk ranges for Phase-2 prompts (inline, don't dump to user)
|
|
38
|
+
- `git log -1 --format="%s%n%n%b" [scope-ref]` → commit-message context when applicable
|
|
39
|
+
|
|
40
|
+
3. **Bail-out**: if `ChangedFiles` is empty, print `No changes in scope [scope]. Exiting.` and STOP. Do not write an artifact.
|
|
41
|
+
|
|
42
|
+
4. **Derive flags** (orchestrator-side, used in later steps):
|
|
43
|
+
- `ManifestChanged` = ChangedFiles intersects {`package.json`, `package-lock.json`, `pnpm-lock.yaml`, `yarn.lock`} OR a `peerDependencies` field was touched.
|
|
44
|
+
- `LockstepSelfReview` = repository root contains `scripts/sync-versions.js` AND every `packages/*/package.json` shares the same `version:` AND the diff touches `packages/*/package.json`.
|
|
45
|
+
- `ReviewType` = one of `commit | pr | staged | working`.
|
|
46
|
+
|
|
47
|
+
## Step 2: Phase-1 Discovery Map (parallel agents)
|
|
48
|
+
|
|
49
|
+
Spawn ONE agent in parallel with orchestrator-side work:
|
|
50
|
+
|
|
51
|
+
**Agent — Integration map:**
|
|
52
|
+
- subagent_type: `integration-scanner`
|
|
53
|
+
- Prompt: "Map inbound references, outbound dependencies, and infrastructure wiring for the following changed files: [ChangedFiles, one per line]. Flag any auth-boundary crossings (middleware, guards, interceptors, authorize-style decorators) and config/DI/event registration touching these paths. Do NOT analyse code quality — connections only, in your standard output format."
|
|
54
|
+
|
|
55
|
+
While the agent runs, the orchestrator produces the rest of the Discovery Map inline from Step 1's data:
|
|
56
|
+
- `ChangedFiles`, `ManifestChanged`, `LockstepSelfReview`, `ReviewType`
|
|
57
|
+
- Hunk ranges per file (from `git diff -U0`)
|
|
58
|
+
- Commit-message context (if applicable)
|
|
59
|
+
|
|
60
|
+
**Wait for ALL agents to complete** before proceeding.
|
|
61
|
+
|
|
62
|
+
**Synthesize the Discovery Map** — a compact text block that Phase-2 agents receive verbatim as `Known Context`:
|
|
13
63
|
|
|
14
|
-
When this command is invoked, respond with:
|
|
15
64
|
```
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
65
|
+
## Discovery Map
|
|
66
|
+
|
|
67
|
+
Review type: [ReviewType]
|
|
68
|
+
Scope: [scope argument]
|
|
69
|
+
Commit/range: [git ref]
|
|
70
|
+
Changed files ([N]):
|
|
71
|
+
path/a.ts (+A -B)
|
|
72
|
+
path/b.ts (+A -B)
|
|
73
|
+
Hunks:
|
|
74
|
+
path/a.ts: L10-23, L45-60
|
|
75
|
+
path/b.ts: L5-8
|
|
76
|
+
Manifest changed: [yes|no]
|
|
77
|
+
Lockstep self-review: [yes|no]
|
|
78
|
+
Auth-boundary crossings: [from integration-scanner output, file:line]
|
|
79
|
+
Inbound refs: [from integration-scanner output]
|
|
80
|
+
Outbound deps: [from integration-scanner output]
|
|
81
|
+
Wiring/config: [from integration-scanner output]
|
|
24
82
|
```
|
|
25
83
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
-
|
|
148
|
-
-
|
|
149
|
-
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
-
|
|
154
|
-
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
84
|
+
## Step 3: Phase-2 Three-Lens Review (parallel agents)
|
|
85
|
+
|
|
86
|
+
Spawn these agents in parallel using the Agent tool. Each receives the `## Discovery Map` block inline as `Known Context` above its task.
|
|
87
|
+
|
|
88
|
+
**Always spawn:**
|
|
89
|
+
|
|
90
|
+
**Quality lens:**
|
|
91
|
+
- subagent_type: `codebase-analyzer`
|
|
92
|
+
- Prompt:
|
|
93
|
+
```
|
|
94
|
+
Known Context:
|
|
95
|
+
[paste Discovery Map verbatim]
|
|
96
|
+
|
|
97
|
+
Task: Trace data flow through each changed hunk. For every hunk, enumerate `file:line` observations in these buckets — do NOT classify severity, the orchestrator does:
|
|
98
|
+
1. Logic-bug risks: missing validation, dropped error paths, off-by-one, null/undefined misses, incorrect branch ordering, forgotten return/await, state mutations without guards.
|
|
99
|
+
2. Pattern divergence: where the hunk deviates from the surrounding file's existing style/structure (cite the nearby line the hunk broke from).
|
|
100
|
+
3. Blast radius: any inbound reference in the Discovery Map that the hunk's behavior change could affect (`consumer.ext:line` + what changes for it).
|
|
101
|
+
4. Test coverage gaps: any risk-bearing behavior the hunk introduces that has no adjacent test reference.
|
|
102
|
+
|
|
103
|
+
Return evidence only. No recommendations.
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**Security lens:**
|
|
107
|
+
- subagent_type: `codebase-analyzer`
|
|
108
|
+
- Prompt:
|
|
109
|
+
```
|
|
110
|
+
Known Context:
|
|
111
|
+
[paste Discovery Map verbatim]
|
|
112
|
+
|
|
113
|
+
Task: Grep each changed hunk for the following sink patterns and list every match with `file:line` + surrounding 3 lines. Cross-reference the Discovery Map's Auth-boundary crossings.
|
|
114
|
+
For each hit, additionally return `confidence: N/10` reflecting how certain you are that a user-controlled input can reach this sink under current deployment. Do NOT report hits with confidence < 8.
|
|
115
|
+
- Command execution: `exec(`, `execSync(`, `execFile(`, `child_process`, `spawn(`
|
|
116
|
+
- Dynamic evaluation: `eval(`, `new Function(`
|
|
117
|
+
- SQL template-interpolation: multi-line `` `SELECT ... ${ ``, `` `INSERT ... ${ ``, `` `UPDATE ... ${ ``, `` `DELETE ... ${ ``
|
|
118
|
+
- XSS sinks: `innerHTML =`, `dangerouslySetInnerHTML`, `document.write(`
|
|
119
|
+
- Path traversal: string concatenation into `fs.readFile`, `fs.writeFile`, `path.join` with user input
|
|
120
|
+
- SSRF: `fetch(`, `http.request(`, `axios(`, `got(` where HOST or PROTOCOL (not just path) is user-controlled
|
|
121
|
+
- Secrets in diff: `api_key`, `secret`, `password`, `BEGIN PRIVATE KEY`, `.env` content literal
|
|
122
|
+
- Missing auth guard: auth-boundary crossings (from Discovery Map) reaching a traced sink without an upstream guard
|
|
123
|
+
|
|
124
|
+
Hard exclusions — do NOT report:
|
|
125
|
+
- DOS / resource exhaustion / rate limiting / memory or CPU exhaustion
|
|
126
|
+
- Missing hardening in isolation (no traced sink), lack of audit logs
|
|
127
|
+
- Theoretical race conditions / timing attacks without a concrete reproducer
|
|
128
|
+
- Log spoofing, prototype pollution, tabnabbing, open redirects, XS-Leaks, regex DOS, regex injection
|
|
129
|
+
- Client-side-only authn/authz gaps (server is the authority)
|
|
130
|
+
- XSS in React/Angular/tsx files unless via `dangerouslySetInnerHTML`, `bypassSecurityTrustHtml`, or equivalent
|
|
131
|
+
- Findings whose sole source is an environment variable, CLI flag, or UUID (trusted in our threat model)
|
|
132
|
+
- Findings in test-only files or `.ipynb` notebooks without a concrete untrusted-input path
|
|
133
|
+
- Outdated-dependency CVEs (handled by the dependencies/CVE lens)
|
|
134
|
+
|
|
135
|
+
For each hit, name the pattern and quote the line. Return evidence only. No CVE lookups — that is a separate agent.
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**Dependencies lens:**
|
|
139
|
+
- subagent_type: `codebase-analyzer`
|
|
140
|
+
- Prompt (only when `ManifestChanged` is true; otherwise SKIP and set `dependency_issues: 0`, `passes: [quality, security]`):
|
|
141
|
+
```
|
|
142
|
+
Known Context:
|
|
143
|
+
[paste Discovery Map verbatim]
|
|
144
|
+
Lockstep self-review: [LockstepSelfReview yes|no]
|
|
145
|
+
|
|
146
|
+
Task: Parse the diff of `package.json` / `package-lock.json` / `pnpm-lock.yaml` / `yarn.lock`. List:
|
|
147
|
+
1. Added dependencies: `name@version` with `file:line`.
|
|
148
|
+
2. Bumped dependencies: `name: old -> new` with `file:line`.
|
|
149
|
+
3. Removed dependencies.
|
|
150
|
+
4. `peerDependencies` changes.
|
|
151
|
+
5. License field changes or additions in the lockfile.
|
|
152
|
+
6. When Lockstep self-review is `yes`: flag only intra-monorepo version drift where a sibling pin diverges from the lockstep `version:` in `packages/*/package.json`. Treat `"*"` peer pins as intentional.
|
|
153
|
+
7. When Lockstep self-review is `no`: flag any version-conflict between direct dep and lockfile resolution.
|
|
154
|
+
|
|
155
|
+
Return evidence only. No CVE lookups — that is a separate agent.
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
**Precedents lens:**
|
|
159
|
+
- subagent_type: `precedent-locator`
|
|
160
|
+
- Prompt:
|
|
161
|
+
```
|
|
162
|
+
Planned change: code review of [scope]. Changed files: [ChangedFiles].
|
|
163
|
+
Find the most similar past changes that touched these files or files nearby. For each precedent, report the commit hash, blast radius, any follow-up fixes within 30 days, and the one-sentence takeaway. Distil composite lessons across all precedents.
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**Conditional spawn** (only when `ManifestChanged` is true):
|
|
167
|
+
|
|
168
|
+
**CVE/advisory lens:**
|
|
169
|
+
- subagent_type: `web-search-researcher`
|
|
170
|
+
- Prompt:
|
|
171
|
+
```
|
|
172
|
+
For each of the following dependency changes, look up known CVEs / GitHub Advisories / OSS Index entries in the target version. Return LINKS alongside findings. If a vulnerability exists, summarize severity (Critical / High / Moderate / Low), affected version range, and whether the bumped-to version is fixed.
|
|
173
|
+
|
|
174
|
+
Dependencies to check:
|
|
175
|
+
[name@version, one per line — extracted by orchestrator from the diff]
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**Wait for ALL agents to complete** before proceeding.
|
|
179
|
+
|
|
180
|
+
## Step 4: Reconcile Findings
|
|
181
|
+
|
|
182
|
+
1. **Compile evidence** from every lens:
|
|
183
|
+
- Quality evidence → classify each `file:line` observation into severity:
|
|
184
|
+
- 🔴 Critical: traced flow contradiction (dropped error path, missing validation on a known sink, null-deref).
|
|
185
|
+
- 🟡 Important: blast-radius × complexity-delta (hot path + new allocation, visible ABI change without migration).
|
|
186
|
+
- 🔵 Suggestion: pattern divergence with a concrete nearby template.
|
|
187
|
+
- 💭 Discussion: composite-lesson architecture concerns.
|
|
188
|
+
- Security evidence → classify:
|
|
189
|
+
- 🔴 sink hit with a CONCRETE user-reachable source→sink path traced through Discovery Map auth-boundary crossings. Reject any hit lacking an explicit trace.
|
|
190
|
+
- 🟡 crypto-only concrete issues: weak hash in an auth/integrity role (MD5/SHA1), non-constant-time compare on secrets, hardcoded key material in diff. Do NOT use 🟡 for "missing hardening".
|
|
191
|
+
- 🔵 pattern divergence from a secure example in the SAME file (cite the nearby secure `file:line`).
|
|
192
|
+
- 💭 architectural question.
|
|
193
|
+
- Dependencies evidence → classify:
|
|
194
|
+
- 🔴 Known-exploitable CVE in a touched dep (Critical/High per advisory DB) OR lockstep-contract violation (would trip `scripts/sync-versions.js`).
|
|
195
|
+
- 🟡 Moderate CVE, outdated major with a migration path, license incompatibility with the project license.
|
|
196
|
+
- 🔵 Minor/transitive drift.
|
|
197
|
+
- 💭 Architectural dep question.
|
|
198
|
+
- Precedents → compile into a separate `## Precedents & Lessons` section orthogonal to per-lens findings. Composite lessons go at the bottom of that section.
|
|
199
|
+
|
|
200
|
+
2. **Probe advisor availability** — attempt a probe by checking whether `advisor` is in the active tool set (main-thread visibility). If yes, proceed to advisor path; otherwise take the inline path.
|
|
201
|
+
|
|
202
|
+
3. **Advisor path** (when advisor is active):
|
|
203
|
+
- Print a main-thread `## Pre-Adjudication Findings` block containing the compiled evidence and tentative severity map. This ensures the findings are persisted into `getBranch()` before the advisor call.
|
|
204
|
+
- Call `advisor()` (zero-param). Wait for the response.
|
|
205
|
+
- On success: paste the advisor's prose verbatim into the artifact's `## Advisor Adjudication` section (Step 6) and note `advisor_used: true` + `advisor_model: [model-id]` in frontmatter.
|
|
206
|
+
- On `"aborted"` or empty text: set `advisor_used: false`, skip the adjudication section, fall through to the inline path.
|
|
207
|
+
- On `"error"`: note the error inline in the adjudication section as `advisor error: <message>`; continue with inline reconciliation alongside.
|
|
208
|
+
|
|
209
|
+
4. **Inline path** (advisor unavailable or errored):
|
|
210
|
+
- Run a dimension-sweep modeled on `skills/design/SKILL.md:83-116`: Data model / API surface / Integration / Scope / Verification / Performance.
|
|
211
|
+
- For every finding, ask: does another finding contradict this severity given the Discovery Map? If yes, note the tension.
|
|
212
|
+
- Produce a short `## Reconciliation Notes` block inside the artifact capturing any severity moves and the rationale.
|
|
213
|
+
|
|
214
|
+
5. **Emit the reconciled severity map** — authoritative severity per finding, carrying the advisor's guidance when present. Keep the per-pass grouping (do NOT tag each finding with its originating lens in prose; the H2 it sits under is the tag).
|
|
215
|
+
|
|
216
|
+
## Step 5: Developer Checkpoint
|
|
217
|
+
|
|
218
|
+
Use the grounded-questions-one-at-a-time pattern. Every question must reference real findings with `file:line` evidence and pull a DECISION from the developer.
|
|
219
|
+
|
|
220
|
+
**Present a compiled scan first** (under 20 lines):
|
|
221
|
+
|
|
222
|
+
```
|
|
223
|
+
Review: [scope]
|
|
224
|
+
Files: [N]
|
|
225
|
+
Quality: [C🔴/I🟡/S🔵/D💭]
|
|
226
|
+
Security: [C/I/S/D]
|
|
227
|
+
Dependencies: [C/I/S/D | not-applicable]
|
|
228
|
+
Precedents: [N composite lessons, top: "[one-line]"]
|
|
229
|
+
Advisor: [used (model) | unavailable]
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
Wait for the developer's response. Then ask **one question at a time**, waiting for each answer.
|
|
233
|
+
|
|
234
|
+
**Question patterns:**
|
|
235
|
+
|
|
236
|
+
- **Severity dispute**: Only ask when the advisor re-ranked a finding or when inline reconciliation surfaced a contradiction. Use `ask_user_question` — Options: "Keep [original severity] (Recommended)" / "Downgrade" / "Escalate" — with `file:line` evidence in the description.
|
|
237
|
+
- **Scope ambiguity**: "❓ Question: finding at `file:line` lies in a test helper — does the team count test-only issues? Include in artifact or not?"
|
|
238
|
+
- **False-positive confirmation**: Only ask when a security/dep finding hinges on context the orchestrator cannot see (e.g., `exec()` with a variable that the developer might know is constant).
|
|
239
|
+
|
|
240
|
+
**Critical rules:**
|
|
241
|
+
- Ask ONE question at a time. Wait before asking the next.
|
|
242
|
+
- Lead with the most load-bearing finding.
|
|
243
|
+
- Skip the checkpoint entirely if no disputes surfaced and the developer set `status: approved` in the scan response.
|
|
244
|
+
|
|
245
|
+
## Step 6: Write the Review Document
|
|
246
|
+
|
|
247
|
+
1. **Determine metadata**:
|
|
248
|
+
- Filename: `thoughts/shared/reviews/YYYY-MM-DD_HH-MM-SS_[scope-kebab].md`
|
|
249
|
+
- Repository: git root basename (fallback: cwd basename).
|
|
250
|
+
- Branch + commit: from git-context injected at session start, or `git branch --show-current` / `git rev-parse --short HEAD` (fallback: `no-branch` / `no-commit`).
|
|
251
|
+
- Reviewer: user from injected git-context (fallback: `unknown`).
|
|
252
|
+
|
|
253
|
+
2. **Write the artifact** using the Write tool (no Edit — this skill writes once per run):
|
|
254
|
+
|
|
255
|
+
```markdown
|
|
256
|
+
---
|
|
257
|
+
date: [ISO 8601 with timezone]
|
|
258
|
+
reviewer: [User]
|
|
259
|
+
repository: [Repo name]
|
|
260
|
+
branch: [Branch]
|
|
261
|
+
commit: [Short hash]
|
|
262
|
+
review_type: [commit|pr|staged|working]
|
|
263
|
+
scope: "[What was reviewed]"
|
|
264
|
+
files_changed: [N]
|
|
265
|
+
critical_issues: [Count across all lenses]
|
|
266
|
+
important_issues: [Count]
|
|
267
|
+
suggestions: [Count]
|
|
268
|
+
quality_issues: [Count]
|
|
269
|
+
security_issues: [Count]
|
|
270
|
+
dependency_issues: [Count | 0 when not-applicable]
|
|
271
|
+
passes: [quality, security, dependencies] # omit dependencies when not-applicable
|
|
272
|
+
advisor_used: [true|false]
|
|
273
|
+
advisor_model: [provider:id] # only when advisor_used is true
|
|
274
|
+
status: [approved|needs_changes|requesting_changes]
|
|
275
|
+
tags: [code-review, relevant-components]
|
|
276
|
+
last_updated: [YYYY-MM-DD]
|
|
277
|
+
last_updated_by: [User]
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
# Code Review: [Scope Description]
|
|
281
|
+
|
|
282
|
+
**Date**: [full ISO date]
|
|
283
|
+
**Reviewer**: [User]
|
|
284
|
+
**Repository**: [Repo]
|
|
285
|
+
**Branch**: [Branch]
|
|
286
|
+
**Commit**: [Short hash]
|
|
287
|
+
|
|
288
|
+
## Review Summary
|
|
289
|
+
[3–5 sentences: overall verdict, highest-severity finding per lens, advisor outcome.]
|
|
290
|
+
|
|
291
|
+
## Issues Found
|
|
292
|
+
|
|
293
|
+
### Quality
|
|
294
|
+
#### 🔴 Critical
|
|
295
|
+
- `file:line` — [evidence + one-sentence fix pointer]
|
|
296
|
+
#### 🟡 Important
|
|
297
|
+
- `file:line` — [evidence + fix pointer]
|
|
298
|
+
#### 🔵 Suggestions
|
|
299
|
+
- `file:line` — [nearby template reference + suggested alignment]
|
|
300
|
+
#### 💭 Discussion
|
|
301
|
+
- `file:line` — [open question or trade-off]
|
|
302
|
+
|
|
303
|
+
### Security
|
|
304
|
+
#### 🔴 Critical
|
|
305
|
+
- `file:line` — [sink quoted + exploitability rationale referencing auth-boundary from Discovery Map]
|
|
306
|
+
#### 🟡 Important
|
|
307
|
+
- `file:line` — [missing hardening + secure precedent]
|
|
308
|
+
#### 🔵 Suggestions
|
|
309
|
+
- `file:line` — [pattern divergence from secure example]
|
|
310
|
+
#### 💭 Discussion
|
|
311
|
+
- `file:line` — [architectural question]
|
|
312
|
+
|
|
313
|
+
### Dependencies
|
|
314
|
+
(Omit this H3 block entirely when `passes` excludes `dependencies`.)
|
|
315
|
+
#### 🔴 Critical
|
|
316
|
+
- `dep@ver` (`package.json:line`) — [CVE id + link + affected-range + fix version]
|
|
317
|
+
#### 🟡 Important
|
|
318
|
+
- `dep@ver` — [moderate CVE / license / lockstep note with link]
|
|
319
|
+
#### 🔵 Suggestions
|
|
320
|
+
- `dep@ver` — [minor/transitive drift]
|
|
321
|
+
#### 💭 Discussion
|
|
322
|
+
- `dep@ver` — [architectural dep question]
|
|
323
|
+
|
|
324
|
+
## Precedents & Lessons
|
|
325
|
+
- `commit hash` — [precedent + one-sentence takeaway]
|
|
326
|
+
- Composite lessons (most-recurring first):
|
|
327
|
+
1. [lesson 1]
|
|
328
|
+
2. [lesson 2]
|
|
329
|
+
|
|
330
|
+
## Pattern Analysis
|
|
331
|
+
[How changes align with or diverge from existing patterns in the changed files. Cite `file:line` of the nearest established pattern.]
|
|
332
|
+
|
|
333
|
+
## Impact Assessment
|
|
334
|
+
[Files and inbound refs affected per the Discovery Map. Enumerate each affected consumer with `file:line` and what changes for it.]
|
|
335
|
+
|
|
336
|
+
## Historical Context
|
|
337
|
+
[Links to thoughts/ docs referenced by precedent-locator; one line each, no summaries.]
|
|
338
|
+
|
|
339
|
+
## Advisor Adjudication
|
|
340
|
+
(Omit when `advisor_used: false`.)
|
|
341
|
+
[Advisor model prose pasted VERBATIM. Do not edit or paraphrase. If `advisor error:` prefix is present, leave it as-is.]
|
|
342
|
+
|
|
343
|
+
## Reconciliation Notes
|
|
344
|
+
(Include only when the inline path ran, OR when developer dispute in Step 5 moved a severity.)
|
|
345
|
+
[Short prose: which findings shifted severity and why.]
|
|
346
|
+
|
|
347
|
+
## Recommendation
|
|
348
|
+
[Clear verdict: Approved / Needs Changes / Requesting Changes. Cite the top 1–3 items that drove the verdict with `file:line`.]
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
## Step 7: Present and Chain
|
|
352
|
+
|
|
353
|
+
```
|
|
354
|
+
Review written to:
|
|
355
|
+
`thoughts/shared/reviews/[filename].md`
|
|
356
|
+
|
|
357
|
+
[C] critical, [I] important, [S] suggestions across [Q] quality, [Se] security, [D] dependency issues.
|
|
358
|
+
Advisor: [used (model) | unavailable]
|
|
359
|
+
Status: [verdict]
|
|
360
|
+
|
|
361
|
+
Top items:
|
|
362
|
+
1. `file:line` — [headline]
|
|
363
|
+
2. `file:line` — [headline]
|
|
364
|
+
3. `file:line` — [headline]
|
|
365
|
+
|
|
366
|
+
Ask follow-ups, or run `/skill:revise` to address the findings.
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
## Step 8: Handle Follow-ups
|
|
370
|
+
|
|
371
|
+
- If the user asks for deeper analysis of a specific finding, spawn a targeted `codebase-analyzer` on that area (1 agent max) and append a `## Follow-up [timestamp]` section using the Edit tool.
|
|
372
|
+
- Update frontmatter: `last_updated`, `last_updated_by`, and `last_updated_note: "Appended follow-up on [area]"`.
|
|
373
|
+
- Never rewrite prior findings; only append.
|
|
374
|
+
|
|
375
|
+
## Important Notes
|
|
376
|
+
|
|
377
|
+
- **No tool-permission widening**: `allowed-tools` is intentionally omitted — the skill inherits `Agent`, `ask_user_question`, `advisor`, `Write`, `web_search`, `todo` per `.rpiv/guidance/skills/architecture.md:40`. Do NOT re-add the line.
|
|
378
|
+
- **Always use parallel Agent tool calls** in Phase-2 to maximise efficiency.
|
|
379
|
+
- **Always read the full diff FIRST** (Step 1) before spawning any Phase-1 or Phase-2 agent.
|
|
380
|
+
- **Always pass the Discovery Map inline** as `Known Context` to every Phase-2 agent — agents are `isolated: true` and cannot see sibling transcripts.
|
|
381
|
+
- **Security-lens precision stance**: prefer false negatives over false positives. Security evidence must carry `confidence ≥ 8` and 🔴 requires an explicit source→sink trace. Missing hardening without a traced sink is NOT a finding. Keep the Security-lens exclusion list in sync with the reference FP-filter precedents.
|
|
382
|
+
- **Critical ordering**: Follow the numbered steps exactly.
|
|
383
|
+
- ALWAYS resolve scope and bail on empty diff (Step 1) before Phase-1.
|
|
384
|
+
- ALWAYS wait for Phase-1 completion before Phase-2 dispatch.
|
|
385
|
+
- ALWAYS wait for ALL Phase-2 agents to complete before reconciliation (Step 4).
|
|
386
|
+
- ALWAYS probe advisor availability before calling `advisor()` (strip-when-unconfigured at `packages/rpiv-advisor/advisor.ts:463-472`).
|
|
387
|
+
- ALWAYS emit the `## Pre-Adjudication Findings` block to the main branch BEFORE calling `advisor()` — the advisor reads `getBranch()` (main-thread-only at `packages/rpiv-advisor/advisor.ts:336`) and will not see evidence you did not flush.
|
|
388
|
+
- ALWAYS preserve the severity taxonomy emoji + naming (🔴 Critical / 🟡 Important / 🔵 Suggestions / 💭 Discussion) and the existing frontmatter keys verbatim — discovery agents `thoughts-locator` and `thoughts-analyzer` grep these.
|
|
389
|
+
- NEVER call `advisor()` from inside a sub-agent — its branch is invisible to the advisor.
|
|
390
|
+
- NEVER parse advisor prose mechanically — paste verbatim into `## Advisor Adjudication`.
|
|
391
|
+
- NEVER add a new bundled agent to support this skill — zero-new-agents contract per `packages/rpiv-pi/extensions/rpiv-core/agents.ts:148-268` sync cost.
|
|
180
392
|
- **Severity classification**:
|
|
181
|
-
-
|
|
182
|
-
-
|
|
183
|
-
-
|
|
184
|
-
-
|
|
393
|
+
- Evidence from agents justifies each issue's severity.
|
|
394
|
+
- Every finding carries a `file:line`.
|
|
395
|
+
- Correct-pattern examples cited where available.
|
|
396
|
+
- Fixes are concrete (pointer, not vague).
|
|
397
|
+
- **Agent roles (for this skill)**:
|
|
398
|
+
- `integration-scanner` (Phase-1): inbound refs, outbound deps, auth-boundary crossings.
|
|
399
|
+
- `codebase-analyzer` × 3 (Phase-2): one per lens — evidence-only, no recommendations (honors the guardrail at `packages/rpiv-pi/agents/codebase-analyzer.md:113-119`).
|
|
400
|
+
- `precedent-locator` (Phase-2, always): git history + thoughts/ for lessons.
|
|
401
|
+
- `web-search-researcher` (Phase-2, conditional on `ManifestChanged`): CVE / GitHub Advisory / OSS Index lookups with LINKS.
|
|
402
|
+
- **File reading**: read the diff FULLY (no limit/offset) via `git` commands before spawning agents. Let agents read their scoped targets; the orchestrator does not need to read source files for non-risk findings.
|
|
403
|
+
- CC auto-loads CLAUDE.md files when agents read files in a directory — no need to scan for them explicitly.
|