Skip to content

Commit 052324f

Browse files
committed
fix: address PR #199 Copilot review comments
- Fix Step 0.2 deferred execution confusion: - Restructured Phase 0 to only include core memory loading - Added Step 0.3 as note about reviewer-specific memories - Created Step 1.2a for loading reviewer-specific memories after enumeration - Fix Phase 8 WONTFIX status counting: - Updated verification to count both COMPLETE and WONTFIX statuses - Both are valid resolutions for comments - Fix Step 9.2 placeholder text: - Replaced generic placeholders with concrete examples - Shows how to update Per-Reviewer Performance table with regex - Shows how to add new Per-PR Breakdown entry Regenerated platform-specific files via build/Generate-Agents.ps1 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 2076bac commit 052324f

File tree

4 files changed

+199
-161
lines changed

4 files changed

+199
-161
lines changed

src/claude/pr-comment-responder.md

Lines changed: 46 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -250,47 +250,28 @@ This memory contains:
250250
- Per-PR breakdown of comment outcomes
251251
- Anti-patterns to avoid
252252

253-
#### Step 0.2: Load Reviewer-Specific Memories (Deferred Until After Step 1.2)
253+
#### Step 0.2: Verify Core Memory Loaded
254254

255-
**Note**: This step is executed AFTER Step 1.2 (reviewer enumeration) completes. It is documented in Phase 0 for logical grouping but executes later in the workflow.
255+
Before proceeding, confirm `pr-comment-responder-skills` is loaded:
256256

257-
After enumerating reviewers in Step 1.2, load memories for each unique reviewer:
257+
- [ ] Memory content appears in context
258+
- [ ] Reviewer signal quality table visible
259+
- [ ] Triage heuristics available
258260

259-
```python
260-
# For each reviewer in the list, check for dedicated memory
261-
reviewers = ["cursor[bot]", "copilot-pull-request-reviewer", "coderabbitai[bot]", ...]
261+
**If memory load fails**: Proceed with default heuristics but flag in session log.
262262

263-
for reviewer in reviewers:
264-
# Check against known reviewer memories (see table below)
265-
# Note: Actual memory names follow project conventions, not algorithmic transformation
266-
# The mapping is maintained manually in the table below
263+
#### Step 0.3: Note on Reviewer-Specific Memories
267264

268-
# Example lookup logic:
269-
if reviewer == "cursor[bot]":
270-
mcp__serena__read_memory(memory_file_name="cursor-bot-review-patterns")
271-
elif reviewer == "copilot-pull-request-reviewer":
272-
mcp__serena__read_memory(memory_file_name="copilot-pr-review-patterns")
273-
# Or use a mapping dict for cleaner code
274-
```
265+
Reviewer-specific memories (e.g., `cursor-bot-review-patterns`) are loaded in **Step 1.2a** after reviewer enumeration completes. Phase 0 focuses only on core skills memory.
275266

276-
**Known Reviewer Memories**:
267+
---
277268

278269
| Reviewer | Memory Name | Content |
279270
|----------|-------------|---------|
280271
| cursor[bot] | `cursor-bot-review-patterns` | Bug detection patterns, 100% signal |
281272
| Copilot | `copilot-pr-review-patterns` | Response behaviors, follow-up PR patterns |
282273
| coderabbitai[bot] | - | (Use pr-comment-responder-skills) |
283274

284-
#### Step 0.3: Verify Memory Loaded
285-
286-
Before proceeding, confirm you have:
287-
288-
- [ ] pr-comment-responder-skills loaded
289-
- [ ] Reviewer signal quality table in context
290-
- [ ] Any reviewer-specific patterns loaded
291-
292-
**If memory load fails**: Proceed with default heuristics but flag in session log.
293-
294275
---
295276

296277
### Phase 1: Context Gathering
@@ -386,6 +367,22 @@ echo "Reviewers: $ALL_REVIEWERS"
386367

387368
</details>
388369

370+
#### Step 1.2a: Load Reviewer-Specific Memories
371+
372+
Now that reviewers are enumerated, load memories for each unique reviewer:
373+
374+
```python
375+
# For each reviewer, check for dedicated memory
376+
for reviewer in ALL_REVIEWERS:
377+
if reviewer == "cursor[bot]":
378+
mcp__serena__read_memory(memory_file_name="cursor-bot-review-patterns")
379+
elif reviewer == "copilot-pull-request-reviewer":
380+
mcp__serena__read_memory(memory_file_name="copilot-pr-review-patterns")
381+
# Other reviewers use pr-comment-responder-skills (already loaded in Phase 0)
382+
```
383+
384+
**Reference**: See Phase 0, Step 0.3 for the reviewer memory mapping table.
385+
389386
#### Step 1.3: Retrieve ALL Comments (with pagination)
390387

391388
```powershell
@@ -1031,27 +1028,38 @@ session_stats = {
10311028
#### Step 9.2: Update pr-comment-responder-skills Memory
10321029

10331030
```python
1034-
# Read current memory
1031+
# Read current memory to get existing statistics
10351032
current = mcp__serena__read_memory(memory_file_name="pr-comment-responder-skills")
10361033

1037-
# Update statistics sections:
1038-
# 1. Per-Reviewer Performance (Cumulative) table
1039-
# 2. Per-PR Breakdown section (add new PR entry)
1040-
# 3. Metrics section (update totals)
1034+
# Calculate new cumulative totals from session_stats
1035+
# Example: If cursor[bot] had 9 comments (100%) and this PR adds 2 more (100%)
1036+
# New totals: 11 comments, 11 actionable, 100%
10411037

1042-
# Use edit_memory to update specific sections
1038+
# Update Per-Reviewer Performance table with new totals
1039+
# Find the row for each reviewer and update their cumulative stats
10431040
mcp__serena__edit_memory(
10441041
memory_file_name="pr-comment-responder-skills",
1045-
needle="### Per-Reviewer Performance \\(Cumulative\\)",
1046-
repl="[Updated section with new PR data]",
1042+
needle=r"\| cursor\[bot\] \| \d+ \| \d+ \| \*\*\d+%\*\* \|",
1043+
repl=f"| cursor[bot] | {new_total_comments} | {new_actionable} | **{new_rate}%** |",
10471044
mode="regex"
10481045
)
10491046

1050-
# Add new Per-PR Breakdown entry
1047+
# Add new Per-PR Breakdown entry (prepend to existing entries)
1048+
new_pr_section = f"""### Per-PR Breakdown
1049+
1050+
#### PR #{PR_NUMBER} ({date})
1051+
1052+
| Reviewer | Comments | Actionable | Rate |
1053+
|----------|----------|------------|------|
1054+
| cursor[bot] | {cursor_comments} | {cursor_actionable} | {cursor_rate}% |
1055+
| copilot-pull-request-reviewer | {copilot_comments} | {copilot_actionable} | {copilot_rate}% |
1056+
1057+
"""
1058+
10511059
mcp__serena__edit_memory(
10521060
memory_file_name="pr-comment-responder-skills",
10531061
needle="### Per-PR Breakdown",
1054-
repl="### Per-PR Breakdown\n\n#### PR #[NEW] (YYYY-MM-DD)\n\n[New PR stats table]\n\n",
1062+
repl=new_pr_section,
10551063
mode="literal"
10561064
)
10571065
```

src/copilot-cli/pr-comment-responder.agent.md

Lines changed: 51 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -341,47 +341,28 @@ This memory contains:
341341
- Per-PR breakdown of comment outcomes
342342
- Anti-patterns to avoid
343343

344-
#### Step 0.2: Load Reviewer-Specific Memories (Deferred Until After Step 1.2)
344+
#### Step 0.2: Verify Core Memory Loaded
345345

346-
**Note**: This step is executed AFTER Step 1.2 (reviewer enumeration) completes. It is documented in Phase 0 for logical grouping but executes later in the workflow.
346+
Before proceeding, confirm `pr-comment-responder-skills` is loaded:
347347

348-
After enumerating reviewers in Step 1.2, load memories for each unique reviewer:
348+
- [ ] Memory content appears in context
349+
- [ ] Reviewer signal quality table visible
350+
- [ ] Triage heuristics available
349351

350-
```python
351-
# For each reviewer in the list, check for dedicated memory
352-
reviewers = ["cursor[bot]", "copilot-pull-request-reviewer", "coderabbitai[bot]", ...]
352+
**If memory load fails**: Proceed with default heuristics but flag in session log.
353353

354-
for reviewer in reviewers:
355-
# Check against known reviewer memories (see table below)
356-
# Note: Actual memory names follow project conventions, not algorithmic transformation
357-
# The mapping is maintained manually in the table below
354+
#### Step 0.3: Note on Reviewer-Specific Memories
358355

359-
# Example lookup logic:
360-
if reviewer == "cursor[bot]":
361-
mcp__serena__read_memory(memory_file_name="cursor-bot-review-patterns")
362-
elif reviewer == "copilot-pull-request-reviewer":
363-
mcp__serena__read_memory(memory_file_name="copilot-pr-review-patterns")
364-
# Or use a mapping dict for cleaner code
365-
```
356+
Reviewer-specific memories (e.g., `cursor-bot-review-patterns`) are loaded in **Step 1.2a** after reviewer enumeration completes. Phase 0 focuses only on core skills memory.
366357

367-
**Known Reviewer Memories**:
358+
---
368359

369360
| Reviewer | Memory Name | Content |
370361
|----------|-------------|---------|
371362
| cursor[bot] | `cursor-bot-review-patterns` | Bug detection patterns, 100% signal |
372363
| Copilot | `copilot-pr-review-patterns` | Response behaviors, follow-up PR patterns |
373364
| coderabbitai[bot] | - | (Use pr-comment-responder-skills) |
374365

375-
#### Step 0.3: Verify Memory Loaded
376-
377-
Before proceeding, confirm you have:
378-
379-
- [ ] pr-comment-responder-skills loaded
380-
- [ ] Reviewer signal quality table in context
381-
- [ ] Any reviewer-specific patterns loaded
382-
383-
**If memory load fails**: Proceed with default heuristics but flag in session log.
384-
385366
---
386367

387368
### Phase 1: Context Gathering
@@ -452,6 +433,22 @@ ALL_REVIEWERS=$(echo "$REVIEWERS $ISSUE_REVIEWERS" | jq -s 'add | unique')
452433
echo "Reviewers: $ALL_REVIEWERS"
453434
```
454435

436+
#### Step 1.2a: Load Reviewer-Specific Memories
437+
438+
Now that reviewers are enumerated, load memories for each unique reviewer:
439+
440+
```python
441+
# For each reviewer, check for dedicated memory
442+
for reviewer in ALL_REVIEWERS:
443+
if reviewer == "cursor[bot]":
444+
mcp__serena__read_memory(memory_file_name="cursor-bot-review-patterns")
445+
elif reviewer == "copilot-pull-request-reviewer":
446+
mcp__serena__read_memory(memory_file_name="copilot-pr-review-patterns")
447+
# Other reviewers use pr-comment-responder-skills (already loaded in Phase 0)
448+
```
449+
450+
**Reference**: See Phase 0, Step 0.3 for the reviewer memory mapping table.
451+
455452
#### Step 1.3: Retrieve ALL Comments (with pagination)
456453

457454
```bash
@@ -952,11 +949,13 @@ gh pr edit [number] --body "[updated body]"
952949
**MANDATORY**: Verify all comments addressed before claiming completion.
953950

954951
```bash
955-
# Count addressed vs total
956-
ADDRESSED=$(grep -c "Status: \[COMPLETE\]" .agents/pr-comments/PR-[number]/comments.md)
952+
# Count addressed vs total (both COMPLETE and WONTFIX are valid resolutions)
953+
COMPLETE=$(grep -c "Status: \[COMPLETE\]" .agents/pr-comments/PR-[number]/comments.md || echo 0)
954+
WONTFIX=$(grep -c "Status: \[WONTFIX\]" .agents/pr-comments/PR-[number]/comments.md || echo 0)
955+
ADDRESSED=$((COMPLETE + WONTFIX))
957956
TOTAL=$TOTAL_COMMENTS
958957

959-
echo "Verification: $ADDRESSED / $TOTAL comments addressed"
958+
echo "Verification: $ADDRESSED / $TOTAL comments addressed (COMPLETE: $COMPLETE, WONTFIX: $WONTFIX)"
960959

961960
if [ "$ADDRESSED" -lt "$TOTAL" ]; then
962961
echo "[WARNING] INCOMPLETE: $((TOTAL - ADDRESSED)) comments remaining"
@@ -988,27 +987,38 @@ session_stats = {
988987
#### Step 9.2: Update pr-comment-responder-skills Memory
989988

990989
```python
991-
# Read current memory
990+
# Read current memory to get existing statistics
992991
current = mcp__serena__read_memory(memory_file_name="pr-comment-responder-skills")
993992

994-
# Update statistics sections:
995-
# 1. Per-Reviewer Performance (Cumulative) table
996-
# 2. Per-PR Breakdown section (add new PR entry)
997-
# 3. Metrics section (update totals)
993+
# Calculate new cumulative totals from session_stats
994+
# Example: If cursor[bot] had 9 comments (100%) and this PR adds 2 more (100%)
995+
# New totals: 11 comments, 11 actionable, 100%
998996

999-
# Use edit_memory to update specific sections
997+
# Update Per-Reviewer Performance table with new totals
998+
# Find the row for each reviewer and update their cumulative stats
1000999
mcp__serena__edit_memory(
10011000
memory_file_name="pr-comment-responder-skills",
1002-
needle="### Per-Reviewer Performance \\(Cumulative\\)",
1003-
repl="[Updated section with new PR data]",
1001+
needle=r"\| cursor\[bot\] \| \d+ \| \d+ \| \*\*\d+%\*\* \|",
1002+
repl=f"| cursor[bot] | {new_total_comments} | {new_actionable} | **{new_rate}%** |",
10041003
mode="regex"
10051004
)
10061005

1007-
# Add new Per-PR Breakdown entry
1006+
# Add new Per-PR Breakdown entry (prepend to existing entries)
1007+
new_pr_section = f"""### Per-PR Breakdown
1008+
1009+
#### PR #{PR_NUMBER} ({date})
1010+
1011+
| Reviewer | Comments | Actionable | Rate |
1012+
|----------|----------|------------|------|
1013+
| cursor[bot] | {cursor_comments} | {cursor_actionable} | {cursor_rate}% |
1014+
| copilot-pull-request-reviewer | {copilot_comments} | {copilot_actionable} | {copilot_rate}% |
1015+
1016+
"""
1017+
10081018
mcp__serena__edit_memory(
10091019
memory_file_name="pr-comment-responder-skills",
10101020
needle="### Per-PR Breakdown",
1011-
repl="### Per-PR Breakdown\n\n#### PR #[NEW] (YYYY-MM-DD)\n\n[New PR stats table]\n\n",
1021+
repl=new_pr_section,
10121022
mode="literal"
10131023
)
10141024
```

0 commit comments

Comments
 (0)