CodeRabbit Triage & Fix
Two-phase workflow: triage open findings, then fix accepted ones in parallel worktrees.
The CLI script is at .claude/skills/coderabbit/coderabbit-report.ts. All commands are run with bun.
Phase 1: Triage
Step 1 — Extract open findings
bun .claude/skills/coderabbit/coderabbit-report.ts extract
If the output is [], tell the user "No open CodeRabbit findings for this repository." and stop.
Step 2 — Triage each finding
For each finding in the JSON array, read the referenced source file at the specified lines. Determine one of three actions:
- •outdated — The code at the referenced location has changed or the issue has been fixed.
- •rejected — The finding is incorrect, not applicable, or is an acceptable trade-off. Briefly explain why.
- •accepted — The finding is valid and should be fixed.
Set action and reason on each finding object.
Step 3 — Ask the user for confirmation
Use AskUserQuestion to confirm each finding's triage action. Batch minor/info findings together. Ask individually for critical/major findings.
Options per finding: Accept / Reject / Outdated
Update action and reason based on user responses.
Step 4 — Dismiss outdated and rejected findings
For each finding where action is "outdated" or "rejected":
bun .claude/skills/coderabbit/coderabbit-report.ts dismiss <commentId>
Step 5 — Generate the report
Write the triaged findings JSON to /tmp/claude/coderabbit-triaged.json, then pipe to the report command:
bun .claude/skills/coderabbit/coderabbit-report.ts report < /tmp/claude/coderabbit-triaged.json
Step 6 — Open the report
bun .claude/skills/coderabbit/coderabbit-report.ts open .tmp/coderabbit.md
Step 7 — Ask to proceed
Use AskUserQuestion:
- •Proceed with fixes — Continue to Phase 2
- •Re-triage — Go back to Step 2
- •Done — Stop here
Phase 2: Fix
Only reached when the user chooses "Proceed with fixes".
Step 8 — QA discovery
bun .claude/skills/coderabbit/coderabbit-report.ts qa-discovery
Save the output — it contains the quality/test/lint/security commands for the repo.
Step 9 — Group findings
bun .claude/skills/coderabbit/coderabbit-report.ts group < /tmp/claude/coderabbit-triaged.json
This outputs a JSON array of { groupId, files, findings }[]. Each file appears in exactly one group (no merge conflicts).
Step 10 — Fix each group in parallel
For each group (up to 5 parallel):
- •
Write the group JSON to
/tmp/claude/coderabbit-group-N.json - •
Create a worktree:
bashbun .claude/skills/coderabbit/coderabbit-report.ts worktree create fix/coderabbit-N --context /tmp/claude/coderabbit-group-N.json
- •
Launch a Task subagent (model: sonnet, subagent_type: typescript-agent) with this prompt:
Working directory:
<worktree path>Read
.tmp/coderabbit-fix-context.jsonfor the findings to fix. ReadAGENTS.mdfirst and follow all rules.For each finding:
- •Apply the fix per
codegenInstructionsor the comment description - •Run the QA command after each fix:
<qualityCommand from step 8> - •Commit with
fix(<scope>): <description>format
If
bunis not found:curl -fsSL https://bun.sh/install | bash - •Apply the fix per
Step 11 — Review each worktree
For each completed worktree:
git -C <worktree-path> diff <base>..HEAD
Check for: security issues, scope creep, style violations.
If the diff has problems, provide feedback and relaunch the subagent. Use Opus model on repeated failure.
Step 12 — Merge
For each approved worktree branch:
git merge fix/coderabbit-N --no-ff
Step 13 — Cleanup
For each worktree:
bun .claude/skills/coderabbit/coderabbit-report.ts worktree remove fix/coderabbit-N
Step 14 — Resolve fixed findings
For each finding that was successfully fixed:
bun .claude/skills/coderabbit/coderabbit-report.ts resolve <commentId>
Step 15 — Final QA
Run the full quality command in the main repo:
<qualityCommand from step 8>
Step 16 — Summary
Tell the user:
- •How many findings were fixed
- •How many failed (if any)
- •QA pass/fail status
- •List of branches merged