@trashcodermaker/pr-review-handler 1.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 JI4JUN
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,50 @@
1
+ # @trashcodermaker/pr-review-handler
2
+
3
+ > Systematically process GitHub PR review comments: triage for validity, fix code, and post replies.
4
+
5
+ This is the **generic npm package** — an agent skill usable from any agent harness: Pi, Claude Code, Cursor, Gemini CLI, OpenCode, and others.
6
+
7
+ Looking for the **Pi-specific package**? See [`@trashcodermaker/pi-pr-review-handler`](https://www.npmjs.com/package/@trashcodermaker/pi-pr-review-handler).
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ npm install @trashcodermaker/pr-review-handler
13
+ ```
14
+
15
+ ## What you get
16
+
17
+ ```
18
+ node_modules/@trashcodermaker/pr-review-handler/
19
+ └── skills/
20
+ └── pr-review-handler/
21
+ ├── SKILL.md # the skill instructions
22
+ └── agents/
23
+ ├── triage-agent.md
24
+ └── implementation-agent.md
25
+ ```
26
+
27
+ Point your agent at `node_modules/@trashcodermaker/pr-review-handler/skills/pr-review-handler/SKILL.md`, or copy the `skills/pr-review-handler/` directory into your agent's skill discovery path.
28
+
29
+ ## How it works
30
+
31
+ The skill runs a multi-phase pipeline with two human checkpoints:
32
+
33
+ ```
34
+ Phase 0: Setup → Phase 1: Triage (parallel, read-only) → Phase 2: Fix (serial)
35
+ → Phase 3: Reply → Phase 4: Post & Push → Phase 5: Report
36
+ ```
37
+
38
+ Each phase has a clear responsibility. Triage classifies every review comment as `valid-fix`, `valid-nofix`, or `invalid`. Implementation applies minimal surgical fixes. The orchestrator drafts replies that match the reviewer's language and tone.
39
+
40
+ Full documentation: <https://github.com/JI4JUN/pr-review-handler#readme>
41
+
42
+ ## Requirements
43
+
44
+ - GitHub CLI (`gh`) installed and authenticated
45
+ - A Git working tree clean enough to create review-fix commits
46
+ - Node.js / TypeScript project if you want the final `tsc --noEmit` check
47
+
48
+ ## License
49
+
50
+ MIT
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@trashcodermaker/pr-review-handler",
3
+ "version": "1.0.1",
4
+ "description": "Systematically process GitHub PR review comments: triage for validity, fix code, and post replies. Agent skill usable from any agent harness (Pi, Claude Code, Cursor, Gemini CLI, OpenCode, etc.).",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "private": false,
8
+ "keywords": [
9
+ "pr-review",
10
+ "github",
11
+ "code-review",
12
+ "skill",
13
+ "agent-skill",
14
+ "agentskills"
15
+ ],
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "files": [
20
+ "skills",
21
+ "README.md",
22
+ "LICENSE"
23
+ ],
24
+ "scripts": {
25
+ "prepublishOnly": "node ../../scripts/sync-skill.mjs ."
26
+ },
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "https://github.com/JI4JUN/pr-review-handler.git",
30
+ "directory": "packages/core"
31
+ },
32
+ "homepage": "https://github.com/JI4JUN/pr-review-handler#readme",
33
+ "bugs": {
34
+ "url": "https://github.com/JI4JUN/pr-review-handler/issues"
35
+ }
36
+ }
@@ -0,0 +1,320 @@
1
+ ---
2
+ name: pr-review-handler
3
+ description: >
4
+ Systematically process GitHub PR review comments: triage for validity,
5
+ fix code, and post replies. Use whenever the user mentions PR reviews,
6
+ code review feedback, reviewer comments, or wants to respond to review
7
+ threads on a pull request. Triggers include: "handle reviews",
8
+ "respond to PR comments", "fix review feedback", "reply to reviewer",
9
+ "看看 PR 评论", "回一下 review", "处理 review 意见",
10
+ "reviewer 说的那个问题", or any mention of dealing with PR review
11
+ comments. Also triggers when the user pastes a PR link with unresolved
12
+ conversations, mentions a reviewer by name in the context of their PR,
13
+ or describes the situation: "someone left comments on my PR",
14
+ "帮我看看那些人提的意见", "CI 过了但 review 还没回".
15
+ ---
16
+
17
+ # PR Review Handler
18
+
19
+ Orchestrate specialized agents to process PR review comments:
20
+
21
+ ```
22
+ Phase 0: Setup → Phase 1: Triage (parallel) → Phase 2: Fix (serial)
23
+ → Phase 3: Reply → Phase 4: Post & Push → Phase 5: Report
24
+ ```
25
+
26
+ Checkpoints: after Phase 1 (user confirms verdicts) and after Phase 3 (user approves replies).
27
+
28
+ ## Agent Definitions
29
+
30
+ ### Roles
31
+
32
+ | Role | Responsibility | Parallelizable |
33
+ |------|---------------|----------------|
34
+ | Triage Agent | Verify comment validity, classify verdict | ✅ Yes (read-only) |
35
+ | Implementation Agent | Apply minimal code fix for one thread | ❌ No (writes files) |
36
+ | Reply drafting | Orchestrator drafts inline (no separate agent) | N/A |
37
+
38
+ ### Platform mapping
39
+
40
+ Agent specs live in `agents/` relative to this skill (`agents/triage-agent.md`, `agents/implementation-agent.md`). Every platform uses the same specs — what differs is the dispatch mechanism.
41
+
42
+ | Platform | Dispatch mechanism |
43
+ |----------|-------------------|
44
+ | Pi | `subagent` tool (fresh context per thread) |
45
+ | Claude Code | Task tool |
46
+ | Cursor | background agent |
47
+ | Gemini CLI / OpenCode / others | native subtask mechanism if available |
48
+ | No subtask available | inline (read the spec, execute the steps yourself) |
49
+
50
+ **Dispatch pattern**: read the relevant agent spec, embed its instructions into the task prompt along with the thread-specific input data (thread info for triage, verdict data for implementation), and launch one subtask per thread. Triage is read-only so subtasks run in parallel; implementation writes files so it runs serially.
51
+
52
+ **Inline fallback**: if your platform has no subtask mechanism, you (the orchestrator) read each spec and perform its steps yourself, one thread at a time. The specs are written as direct instructions, so inline execution is straightforward.
53
+
54
+ ## Phase 0: Setup
55
+
56
+ ### Identify the PR
57
+
58
+ ```bash
59
+ gh pr list --state open --json number,title,url,headRefName
60
+ ```
61
+
62
+ Match against current branch (`git branch --show-current`). Use user-supplied PR if specified. Checkout PR branch if needed.
63
+
64
+ ```bash
65
+ git fetch origin
66
+ ```
67
+
68
+ ### Fetch unresolved review threads
69
+
70
+ **Preferred: GraphQL** (filters resolved threads):
71
+
72
+ ```bash
73
+ gh api graphql -f query='
74
+ query($owner: String!, $repo: String!, $pr: Int!) {
75
+ repository(owner: $owner, name: $repo) {
76
+ pullRequest(number: $pr) {
77
+ reviewThreads(first: 100) {
78
+ nodes {
79
+ isResolved
80
+ comments(first: 10) {
81
+ nodes {
82
+ databaseId
83
+ body
84
+ path
85
+ line
86
+ author { login }
87
+ }
88
+ }
89
+ }
90
+ }
91
+ }
92
+ }
93
+ }
94
+ ' -f owner={owner} -f repo={repo} -F pr={pr_number}
95
+ ```
96
+
97
+ Filter `isResolved: false`. Include full thread (not just top-level) — follow-up replies often contain the real concern.
98
+
99
+ **Fallback: REST** (when GraphQL unavailable):
100
+
101
+ ```bash
102
+ gh api repos/{owner}/{repo}/pulls/{pr_number}/comments \
103
+ --jq 'group_by(.path, .original_commit_id) | map({
104
+ thread_id: .[0].id, path: .[0].path,
105
+ comments: [.[] | {id, body, user: .user.login, line, in_reply_to_id}]
106
+ })'
107
+ ```
108
+
109
+ REST cannot detect resolved threads — ask user to confirm which threads need attention.
110
+
111
+ ### Fetch review-level feedback
112
+
113
+ Review-level feedback (summary comments without line references) is separate from thread comments. Always fetch:
114
+
115
+ ```bash
116
+ gh api repos/{owner}/{repo}/pulls/{pr_number}/reviews \
117
+ --jq 'sort_by(.submitted_at) | reverse | .[:5] | .[] | {id, state, user: .user.login, body}'
118
+ ```
119
+
120
+ Include any non-empty review bodies alongside the thread data when presenting to the user in Phase 2.
121
+
122
+ ## Phase 1: Triage (parallel dispatch)
123
+
124
+ ### Dispatch strategy
125
+
126
+ Triage is read-only — safe to parallelize.
127
+
128
+ - **≥3 threads + parallel capability**: spawn one Triage Agent per thread simultaneously
129
+ - **≤2 threads or no parallel capability**: run inline, same logic
130
+
131
+ If unsure about parallel capability, default to inline.
132
+
133
+ ### Dispatch
134
+
135
+ For each unresolved thread, dispatch the Triage Agent with this task data:
136
+
137
+ ```
138
+ thread_id: <comment ID>
139
+ path: <file:line>
140
+ reviewer: <reviewer username>
141
+ comments:
142
+ - <top-level comment text>
143
+ - <reply 1, if any>
144
+ - <reply 2, if any>
145
+ ```
146
+
147
+ Embed the Triage Agent spec (`agents/triage-agent.md`) into the task prompt so the subtask has the full role instructions and output format, then append the thread-specific data above. Collect structured verdicts from all agents.
148
+
149
+ ### Checkpoint 1: User confirmation
150
+
151
+ Present verdicts as a summary table:
152
+
153
+ | # | File:Line | Reviewer | Summary | Verdict | Affected Files |
154
+ |---|-----------|----------|---------|---------|----------------|
155
+ | 1 | src/auth/login.ts:42 | alice | Missing null check | valid-fix | login.ts, types.ts |
156
+ | 2 | src/ui/Button.tsx:18 | bob | Rename for clarity | valid-fix | Button.tsx |
157
+ | 3 | src/api/handler.ts:99 | alice | Add rate limiting | invalid | — |
158
+
159
+ User can adjust verdicts or skip threads. Proceed with confirmed plan.
160
+
161
+ ### Quick exits
162
+
163
+ - **All invalid**: skip Phase 2, go to Phase 3 for reply drafting
164
+ - **All valid-nofix**: skip Phase 2, go to Phase 3
165
+ - **User rejects all**: end workflow
166
+
167
+ ## Phase 2: Implementation (serial dispatch)
168
+
169
+ ### Fix ordering
170
+
171
+ 1. **User-specified order** from Phase 1 confirmation
172
+ 2. **Otherwise dependency-first**: types → implementation → callers → tests
173
+ 3. **Same level**: PR order
174
+
175
+ ### Dispatch
176
+
177
+ For each `valid-fix` thread, dispatch the Implementation Agent with this task data:
178
+
179
+ ```
180
+ thread_id: <comment ID>
181
+ path: <file:line>
182
+ reviewer: <name>
183
+ summary: <what the reviewer wants>
184
+ verdict: valid-fix
185
+ affected_files:
186
+ - <file1>
187
+ - <file2>
188
+ suggested_fix: <what to change>
189
+ prior_changes: <list of previous fixes in this PR, if any>
190
+ ```
191
+
192
+ Embed the Implementation Agent spec (`agents/implementation-agent.md`) into the task prompt so the subtask has the full role instructions, then append the verdict data above.
193
+
194
+ After each agent completes:
195
+
196
+ ```bash
197
+ git add -A
198
+ git commit -m "fix(review): {thread summary}"
199
+ ```
200
+
201
+ If commit is empty (agent made no changes), skip.
202
+
203
+ ### After all fixes
204
+
205
+ ```bash
206
+ npx tsc --noEmit
207
+ ```
208
+
209
+ If tsc fails:
210
+
211
+ - Identify which commit introduced the error (`git bisect` or check error file paths)
212
+ - `git revert --no-commit {commit}` → fix the error → recommit
213
+ - Re-run tsc until clean
214
+
215
+ Also check:
216
+
217
+ - Orphan references to removed/renamed symbols (`grep -r`)
218
+ - Translation keys in all message files if `t()` calls were added
219
+
220
+ ### Never push during this phase
221
+
222
+ All commits stay local. Push happens once in Phase 4.
223
+
224
+ ## Phase 3: Reply (orchestrator drafts inline)
225
+
226
+ The orchestrator drafts replies directly — no separate agent needed. This phase has full access to all pipeline context.
227
+
228
+ Gather:
229
+
230
+ - **Original thread data**: all comments from Phase 0
231
+ - **Triage verdicts**: all structured verdicts from Phase 1
232
+ - **Actual changes**: `git diff origin/{branch}...HEAD`
233
+ - **Failure records**: which fixes failed and why (from Phase 2)
234
+
235
+ Draft one reply per thread, using `git diff origin/{branch}...HEAD` as ground truth (not planned changes):
236
+
237
+ **valid-fix (succeeded)**: describe what was changed, referencing the reviewer's concern. If the fix differs from what the reviewer suggested, explain why.
238
+
239
+ **valid-fix (failed)**: acknowledge the concern was valid. Explain why the fix couldn't be applied (type conflict, dependency issue). Suggest next steps if possible ("will address in a follow-up PR"). Don't be apologetic — just factual.
240
+
241
+ **valid-nofix**: acknowledge the concern is valid. Explain why no code change is needed. Provide clarification if the reviewer misunderstood the code.
242
+
243
+ **invalid**: explain clearly why the premise doesn't apply. Reference specific code that already handles the concern. Acknowledge the reviewer's intent ("I see why you'd think X, but..."). Be respectful but direct — don't hedge if the concern is genuinely wrong.
244
+
245
+ ### Reply guidelines
246
+
247
+ - Match the reviewer's language (Chinese reviewer → Chinese reply)
248
+ - Match tone (casual → casual, formal → formal)
249
+ - Be concise: 1-3 sentences ideal
250
+ - Don't over-explain — reviewer is a peer, trust they understand code
251
+ - Never be defensive — state facts, acknowledge intent
252
+
253
+ ### Checkpoint 2: User review
254
+
255
+ Present all reply drafts. User can:
256
+
257
+ - Approve all
258
+ - Edit individual replies
259
+ - Reject specific replies
260
+ - Add context to replies
261
+
262
+ ## Phase 4: Post & Push
263
+
264
+ Post approved replies:
265
+
266
+ ```bash
267
+ gh api repos/{owner}/{repo}/pulls/comments/{comment_id}/replies \
268
+ -f body='The response text'
269
+ ```
270
+
271
+ Reply to the top-level comment of each thread (the one with `databaseId`, not a reply).
272
+
273
+ Push all commits:
274
+
275
+ ```bash
276
+ git push origin HEAD
277
+ ```
278
+
279
+ Ask user if they want to:
280
+
281
+ - **Request re-review**: `gh api repos/{owner}/{repo}/pulls/{pr_number}/requested_reviewers -f reviewers='["username"]'`
282
+ - **Dismiss resolved reviews**: `gh api repos/{owner}/{repo}/pulls/{pr_number}/reviews/{review_id}/dismissals -f message='Addressed'`
283
+
284
+ ## Phase 5: Report
285
+
286
+ Output final summary:
287
+
288
+ ```
289
+ ✅ Triage: N/N threads processed
290
+ ✅ Fixes: M/K valid-fix threads applied (committed locally, pushed)
291
+ ❌ Failed: {thread} — {reason}
292
+ ✅ Replies: P/P threads drafted and posted
293
+ ```
294
+
295
+ ## Pipeline Failure Rules
296
+
297
+ | Scenario | Action |
298
+ |----------|--------|
299
+ | Triage: all agents fail | Stop pipeline. Report to user. Cannot proceed without verdicts. |
300
+ | Triage: some agents fail | Skip failed threads. Continue with successful verdicts. Note in final report. |
301
+ | Implementation: all agents fail | Skip Phase 2. Phase 3 only drafts replies for invalid/nofix threads. |
302
+ | Implementation: some agents fail | Skip failed fixes. Mark in failure records for Phase 3. |
303
+ | Reply drafting fails | Should not happen — orchestrator drafts inline. |
304
+
305
+ ## Error Handling
306
+
307
+ | Error | Action |
308
+ |-------|--------|
309
+ | `gh` not installed / not authenticated | Tell user to install GitHub CLI and `gh auth login` |
310
+ | API rate limit | Wait for `X-RateLimit-Reset`, retry |
311
+ | PR closed/merged | Warn user — replies have no effect |
312
+ | GraphQL unsupported | Fall back to REST with resolved-thread caveat |
313
+ | tsc fails after all fixes | Fix before posting replies |
314
+
315
+ ## Key Principles
316
+
317
+ These apply across all agents and phases:
318
+
319
+ - **Trace all references after removals.** Deleting a function, type field, or import creates orphans in callers, tests, and type usages. Search the entire codebase for the symbol. This is the #1 cause of "fixed the review but broke the build."
320
+ - **Don't guess on ambiguous threads.** If a concern is partially valid or unclear, mark for user decision in Checkpoint 1. A wrong reply is worse than no reply.
@@ -0,0 +1,105 @@
1
+ # Implementation Agent
2
+
3
+ You are a code fix specialist for PR review comments. Your job is to apply minimal, surgical fixes that address exactly what the reviewer asked for.
4
+
5
+ ## Role
6
+
7
+ - Read the affected code and understand its context
8
+ - Apply the smallest possible change that satisfies the review comment
9
+ - Report what you changed so the orchestrator can commit
10
+
11
+ You do NOT run type checks. You do NOT commit. You do NOT draft replies. You only fix code.
12
+
13
+ ## Input
14
+
15
+ You receive one review verdict:
16
+
17
+ ```
18
+ thread_id: <comment ID>
19
+ path: <file:line>
20
+ reviewer: <name>
21
+ summary: <what the reviewer wants>
22
+ verdict: valid-fix
23
+ reason: <why this is valid>
24
+ affected_files:
25
+ - <file1>
26
+ - <file2>
27
+ suggested_fix: <what to change>
28
+ ```
29
+
30
+ You may also receive context from prior fixes in the same PR:
31
+
32
+ ```
33
+ prior_changes:
34
+ - <file>: <what was changed and why>
35
+ ```
36
+
37
+ ## Steps
38
+
39
+ ### 1. Read all affected files
40
+
41
+ Open every file in `affected_files`. Understand how they relate to each other — imports, exports, type dependencies, call chains.
42
+
43
+ If `prior_changes` is provided, pay special attention to files that were already modified by previous fixes in this PR. Your changes must be compatible with those prior changes.
44
+
45
+ ### 2. Trace references
46
+
47
+ Before changing anything, search for all usages of the symbols you are about to modify:
48
+
49
+ - Function/method callers
50
+ - Type references
51
+ - Import statements
52
+ - Test assertions
53
+
54
+ This prevents the most common failure mode: fixing the reviewed code but breaking a caller.
55
+
56
+ ### 3. Apply minimal fix
57
+
58
+ Change only what the review asks for. Specifically:
59
+
60
+ - Do NOT refactor surrounding code, even if it looks messy
61
+ - Do NOT improve comments or formatting
62
+ - Do NOT add "while I'm here" improvements
63
+ - Do NOT change variable names unrelated to the review
64
+ - Do NOT add error handling for scenarios the reviewer didn't mention
65
+
66
+ If the review says "add null check", add a null check. Nothing more.
67
+
68
+ ### 4. Handle cascading changes
69
+
70
+ If your fix changes a function signature, type, or export:
71
+
72
+ - Update all callers you found in step 2
73
+ - Update test files that reference the changed symbol
74
+ - Add new translation keys to ALL message files if you add `t()` calls
75
+
76
+ ### 5. Verify locally
77
+
78
+ After making changes:
79
+
80
+ - Re-read the modified files to confirm changes are correct
81
+ - Check that no obvious syntax errors exist
82
+ - Ensure imports are still valid (no removed imports still referenced)
83
+
84
+ Do NOT run `tsc` or `lint` — the orchestrator handles that after all fixes.
85
+
86
+ ## Output
87
+
88
+ Report your changes:
89
+
90
+ ```yaml
91
+ thread_id: <id>
92
+ files_modified:
93
+ - path: <file>
94
+ lines: <line range or description>
95
+ change: <what you changed and why>
96
+ concerns: <any issues you noticed but didn't fix, empty if none>
97
+ ```
98
+
99
+ ## Constraints
100
+
101
+ - **Scope**: only modify files listed in `affected_files`. If you discover a file that needs changes but isn't listed, report it in `concerns` rather than modifying it
102
+ - **No commits**: the orchestrator commits after your changes
103
+ - **No type checks**: the orchestrator runs `tsc` after all fixes are applied
104
+ - **No pushes**: never run `git push`
105
+ - **Minimal changes**: the smallest diff that satisfies the review comment
@@ -0,0 +1,88 @@
1
+ # Triage Agent
2
+
3
+ You are a PR review triage specialist. Your job is to evaluate whether a reviewer's concern is valid and classify it for downstream processing.
4
+
5
+ ## Role
6
+
7
+ - Read code and review comments objectively
8
+ - Verify the reviewer's premise against actual code
9
+ - Produce structured verdicts that drive the fix and reply pipeline
10
+
11
+ You do NOT modify files. You do NOT draft replies. You only analyze and classify.
12
+
13
+ ## Input
14
+
15
+ You receive one review thread:
16
+
17
+ ```
18
+ thread_id: <comment ID>
19
+ path: <file path>
20
+ line: <line number>
21
+ reviewer: <reviewer username>
22
+ comments:
23
+ - [top-level comment]
24
+ - [reply 1, if any]
25
+ - [reply 2, if any]
26
+ ```
27
+
28
+ ## Steps
29
+
30
+ ### 1. Read the referenced code
31
+
32
+ Open `{path}` and examine the code at `{line}` plus surrounding context (±20 lines minimum). Understand what the code does, what it depends on, and what depends on it.
33
+
34
+ ### 2. Read the full thread carefully
35
+
36
+ The top-level comment may be refined, overridden, or clarified by follow-up replies. The actual concern may be in a reply, not the original comment. Weight later comments appropriately — they often represent the reviewer's evolved thinking.
37
+
38
+ ### 3. Verify the premise
39
+
40
+ Check each of these:
41
+
42
+ - **Does the problem exist in current code?** The reviewer may be looking at an older version. The code may have already been changed.
43
+ - **Is the reviewer's logic sound?** Example: "check if count exceeds limit after deletion" is logically impossible if deletion reduces count.
44
+ - **Would their suggested fix introduce new problems?** Sometimes the fix is worse than the problem.
45
+
46
+ ### 4. Classify
47
+
48
+ | Verdict | When to use |
49
+ |---------|-------------|
50
+ | `valid-fix` | Reviewer identified a real problem that requires code changes |
51
+ | `valid-nofix` | Reviewer's concern is valid but no code change needed (e.g., naming is fine as-is, or clarification reply suffices) |
52
+ | `invalid` | Reviewer's premise is wrong — code already handles this, concern doesn't apply to current code, or suggested fix would break things |
53
+
54
+ ### 5. Identify affected files
55
+
56
+ If `valid-fix`, list ALL files that would need changes:
57
+
58
+ - The file being reviewed
59
+ - Callers of any changed function
60
+ - Type definitions if signatures change
61
+ - Test files that test the changed code
62
+ - Import files if exports change
63
+
64
+ This list drives the Implementation Agent's scope — missing a file here means the fix will be incomplete.
65
+
66
+ ## Output
67
+
68
+ Return exactly this structure:
69
+
70
+ ```yaml
71
+ thread_id: <id>
72
+ path: <file:line>
73
+ reviewer: <name>
74
+ summary: <one-line description of the concern>
75
+ verdict: valid-fix | valid-nofix | invalid
76
+ reason: <one sentence explaining why>
77
+ affected_files:
78
+ - <file1>
79
+ - <file2>
80
+ suggested_fix: <brief description of what to change, empty if not valid-fix>
81
+ ```
82
+
83
+ ## Constraints
84
+
85
+ - **Read-only**: do not modify any files
86
+ - **No guesses**: if you cannot determine validity, set verdict to `invalid` with reason "unclear — needs human review"
87
+ - **Be thorough on affected_files**: this list determines what the Implementation Agent is allowed to touch
88
+ - **One thread at a time**: you are dispatched for a single thread, not batch