Grade fix quality after /pr-swarm — cross-reference findings against diff, produce letter-grade report card.
Audit fix commits against review findings and produce a graded report card. Use after /pr-swarm fix pass to QA the fixes.
/pr-swarm-grade — detect PR from current branch
/pr-swarm-grade 19 — grade fixes for PR #19
PR_NUMBER.gh pr view --json number --jq '.number'./pr-swarm-grade [PR_NUMBER]"REVIEW_DIR="docs/reviews/PR-${PR_NUMBER}"
${REVIEW_DIR}/_state.json → extract pr_number, head_sha, pr_title, agents, compiled._state.json doesn't exist → STOP: "No review found for PR #${PR_NUMBER}. Run /pr-swarm first."compiled is false → STOP: "Review for PR #${PR_NUMBER} hasn't been compiled yet."${REVIEW_DIR}/compiled-report.md.Must Fix, Suggestions, or Nitpicks — from section headerHEAD_SHA=<head_sha from _state.json>
git log ${HEAD_SHA}...HEAD --oneline
git diff ${HEAD_SHA}...HEAD
HEAD_SHA is reachable. If not, try merge commit.gh pr view ${PR_NUMBER} --json comments --jq '.comments[].body'
## Review Fixes Applied.For each finding from the compiled report, determine a verdict:
| Verdict | Criteria |
|---|---|
| PASS | Diff clearly addresses the finding. Code change matches the recommended fix. |
| PARTIAL | Diff touches relevant code but doesn't fully address the finding. |
| MISS | Finding not addressed in diff at all. |
| REGRESSION | Diff introduces a new issue in the area the finding referenced. |
| SKIP-OK | Finding explicitly skipped with reasonable justification. |
| SKIP-BAD | Finding skipped but justification is weak or finding was a Must Fix. |
For each finding:
| Tag | Meaning |
|---|---|
| Excellent | Ideal fix — correct approach, clean implementation, handles edge cases. |
| Good | Solid fix — correct and reasonable. Default for clean PASS. |
| Adequate | Gets the job done but could be better. |
| Minimal | Bare minimum — technically addresses finding but cuts corners. |
| Over-engineered | Correct but unnecessarily complex for what was needed. |
| Verdict | Base Score |
|---|---|
| PASS | 100 |
| PARTIAL | 60 |
| SKIP-OK | 50 |
| MISS | 0 |
| SKIP-BAD | 0 |
| REGRESSION | -50 |
| Category | Weight |
|---|---|
| Must Fix | 3x |
| Suggestions | 1x |
| Nitpicks | 0.5x |
weighted_score = sum(finding_score * category_weight) for each finding
max_possible = sum(100 * category_weight) for each finding
raw_percentage = (weighted_score / max_possible) * 100
| Modifier | Points | Condition |
|---|---|---|
| Proactive fixes | +5 (cap +10) | Each fix beyond what was flagged |
| Regression | -10 | Each REGRESSION verdict (stacks) |
| Dishonest claim | -5 | Each dishonest claim (stacks) |
| Grade | Range |
|---|---|
| A+ | 97-100 |
| A | 93-96 |
| A- | 90-92 |
| B+ | 87-89 |
| B | 83-86 |
| B- | 80-82 |
| C+ | 77-79 |
| C | 73-76 |
| C- | 70-72 |
| D | 60-69 |
| F | Below 60 |
Final score clamped to 0-100 after modifiers.
Write to ${REVIEW_DIR}/grade-report.md and present in conversation. Do NOT post to PR.
## Grade Report — PR #${PR_NUMBER}: ${PR_TITLE}
**Overall: ${LETTER_GRADE} (${SCORE}/100)**
| Category | Addressed | Total | Score |
|--------------|-----------|-------|-------|
| Must Fix | X/Y | Y | Z% |
| Suggestions | X/Y | Y | Z% |
| Nitpicks | X/Y | Y | Z% |
### Must Fix
1. **${VERDICT}** · ${QUALITY} — `${location}` — ${title}
_What changed:_ ${factual description}
_Feedback:_ ${opinionated quality assessment}
### Suggestions
...
### Nitpicks
...
### Flags
- **Dishonest claim**: Finding #${N} claimed fixed but diff shows ${what}.
- **Proactive fix**: ${description}.
- **Undocumented skip**: Finding #${N} not addressed and not mentioned.
(Omit Flags section if none.)
### Summary
${2-3 sentence assessment: quality, strengths, gaps, recommendation}
_What changed:_ — factual, 1 sentence._Feedback:_ — opinionated, 1-2 sentences. Judgment, not description._Feedback:_ must express judgment. Bad: "Used a typed setter map." Good: "Clean approach — eliminates unsafe cast without over-engineering."| Situation | Behavior |
|---|---|
| No review directory | STOP: "No review found for PR #X" |
| Review not compiled | STOP: "Review not compiled yet" |
| No fix commits | Grade from fixes comment skips; all findings MISS unless justified |
| No fixes comment | Warn, grade from diff only, skip dishonesty checks |
| PR already merged | Warn, use merge commit range |
| Squash-merged PR | The HEAD_SHA...HEAD range may collapse to nothing. Check the PR merge commit instead: gh pr view --json mergeCommit |
| Empty compiled report | STOP: "No findings to grade" |