Reviewing pull requests written by AI agents
Last updated .
How do I review pull requests written by AI coding agents?
Install MergeSafe on the repository, include the agent’s account in the authors it reviews, and every push the agent makes gets a review whose findings come with a prompt you can hand straight back to the agent.
Coding agents such as Claude Code, Cursor and Copilot’s coding agent open more pull requests, and bigger ones, than people do. MergeSafe reviews them the same way it reviews anyone’s, with a few features that matter more when the author is an agent.
What helps with agent-written code
- The same rules your agent follows. Your repository’s
AGENTS.mdand.cursor/rules/files are applied as review rules, read from the base branch, so a pull request can’t loosen them by editing them. A pull request that changes those files gets extra scrutiny. - Fixes as prompts. Every inline finding includes a prompt for AI agents, and every recommendation a prompt to make the change.
- Every push checked. By default each new commit is reviewed again, and open findings are re-checked, so you can see whether the agent’s fix worked. Small follow-up changes are reviewed at half price.
- A gate, not just comments. The
mergesafe-reviewcheck fails while a P0 or P1 finding is open; make it required and nothing blocking merges unseen. - No shallow pass on huge diffs. Over 2,000 hand-written lines MergeSafe asks first; over 5,000 lines or more than 60 files it replies with a ready-made prompt to split the pull request. See Large pull requests.
Fix the findings from your editor
Connect your own coding agent to MergeSafe. It reads each finding and its fix prompt, fixes it in your checkout, runs your tests, replies on the thread and asks for a re-review, without leaving Claude Code or Cursor. Your code stays on your machine by default: MergeSafe’s API returns the findings, not your code. Only request_review_with_context, for an organization that has turned it on, sends test excerpts. See Fix findings from your editor.
Keeping a busy agent affordable
- At most 6 reviews per pull request per hour by default, so an agent pushing in a loop can’t run up reviews.
- An optional limit of 1 to 50 reviewed commits per pull request.
- Daily and monthly spending limits, $20 and $300 by default, and a prepaid balance.
Setting it up
- Install the GitHub App on the repositories the agent works in.
- If an agent opens pull requests under its own bot account, select that account in whose pull requests are reviewed: bots are left out unless you select them.
- Make
mergesafe-reviewa required check in branch protection.
Related: How a review works, Replying to a finding.