| name | flywheel-merge-arbiter |
| description | Arbitrate multiple candidate PRs for the same issue and merge exactly one winner. Use when running merge-pr workflow or comparing AUTOFIX candidate PRs. |
| allowed-tools | Read,Grep,Glob,LS,Bash(gh *),Bash(git *) |
Flywheel Merge Arbiter
Goal
Choose and merge exactly one best candidate PR per issue after hard gates pass.
Workflow
- Collect candidate PRs for one issue from title prefix.
- Hard filters first:
- non-draft
- checks green
- merge state not dirty
- Compare eligible candidates on:
- correctness and issue coverage (weight 0.45)
- regression risk (weight 0.30)
- complexity and maintainability (weight 0.15)
- test quality and verification evidence (weight 0.10)
- Compute weighted total score and rank candidates.
- Post machine-readable scorecard before merge:
- Marker line:
<!-- arbiter-scorecard -->
- Next line must be one-line JSON:
{"issue":<id>,"winner_pr":<id>,"scores":[...]}
- Include per-candidate scores for correctness, risk, maintainability, tests, total, verdict, reason.
- Merge exactly one winner (prefer squash).
- Comment and close non-winners.
- If no safe winner, do not merge and comment issue with blockers.
Safety Rules
- Never merge more than one candidate per issue.
- Never bypass failing required checks.
- Never force-merge.
Output Checklist
- Eligible PR list
- Winner PR number + why
- Non-winner closure summary
- Any blockers