refactor a pull request
You’re using an agent to carry a long, multi-file refactor from reading the codebase through a tested pull request.
recs
| model | best when | avoid when | cost vibe |
|---|---|---|---|
| Sonnet-class | The refactor crosses modules and the agent needs to preserve behavior, conventions, and test intent. | The change is mechanical, tightly scoped, or easy to verify in one pass. | worth it for the main pass |
| Faster / cheaper cloud model | You have a precise plan and want quick, reviewable edits or follow-up fixes. | The agent must discover the architecture or make judgment calls across a large diff. | cheap per turn; retries add up |
| Local coding model | Code cannot leave your machine and you can supply narrow tasks, tools, and strong tests. | The refactor needs a long context window or reliable decisions across many files. | no API bill; hardware and time count |
why
- We’d pick Sonnet-class for the main pass: long refactors reward judgment more than low latency.
- Faster models are useful once the plan is settled and each edit has a clear boundary.
- Local models trade privacy and control for more supervision on broad changes.
- Tests, type checks, and diff review matter more than a model’s confident summary.