Recipes / Guides / AI code review agents

9 setups · GitHub Actions, overnight PRs, cross-review

AI code review agents: how to set up AI PR review, with 9 setups

Last updated · by Thomas, editor · How we verify

An AI code review agent reads each pull request and leaves comments, and a person merges. Below: how to set up a PR review bot, then nine setups people and teams run: a bot on every PR, a night shift that turns labeled bugs into draft PRs, scheduled routines whose fixes merge only on proof, a fault-test loop that turns each failure into a failing test and a fix, and the rule that whoever wrote the code doesn't review it.

What they share is permissions: reviewers comment, humans merge, and the limits are enforced by GitHub settings, not just by the prompt.

How to set one up

  1. Add your Anthropic or OpenAI API key as a repository secret. (recipe)
  2. Install the official workflow: the Claude action's quick start, or the review example in the Codex README. (recipe)
  3. Keep it read-only: contents: read, and only the comment step can write. (recipe)
  4. Add a review prompt (starter below) and ask for real problems only, ranked by risk. (recipe)
  5. Open a test PR and check the comments. On a busy repo, trigger on an @claude mention or a label instead of every PR. (recipe)
  6. Protect the default branch and require CI, so humans merge even if a bot ignores its prompt. (recipe)

Starter prompt: from OpenAI's codex-action README example

This is PR #${{ github.event.pull_request.number }} for ${{ github.repository }}. Review ONLY the changes introduced by the PR, so consider: git log --oneline ${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }} Suggest any improvements, potential bugs, or issues. Be concise and specific in your feedback. Pull request title and body: ---- ${{ github.event.pull_request.title }} ${{ github.event.pull_request.body }}

Step-by-step guide: how to set up AI PR review on GitHub →

What does an AI code review agent actually do?

It reads the diff on a pull request and posts comments. Anthropic's official action runs Claude Code on your own GitHub runner to review PRs and answer @claude questions (recipe). OpenAI's codex-action runs Codex CLI in a workflow with locked-down privileges, and its README example posts a review comment on each new PR (recipe).

Can AI review every pull request automatically?

Yes, but you choose the trigger. Running on every new PR suits a quiet repo; on a busy one, the Claude action's failure list warns that costs grow, so teams trigger on an @claude mention or a label instead. recipe

Can an AI agent fix bugs and open PRs while I sleep?

Two setups here do. A Grok Bot night shift turns labeled GitHub bugs into reproduced, fixed and independently reviewed draft PRs, with a morning report that separates done from attempted (recipe). In OpenAI's guide, an engineer points Codex at low-coverage modules overnight and reviews runnable test PRs in the morning (recipe). In both, a person merges.

Why have a different AI review the code?

Because a reviewer that didn't write the code catches different mistakes. One fleet rule: whichever model wrote a piece of work never reviews it, a different vendor's agents review every lane, and repeated failure forces a redesign (recipe). The simplest version is Claude Code building and Codex reviewing the same branch (recipe); more splits are in Claude Code vs Codex.

Which one fits your repo

Where each reviewer runs, what starts it, and how much it may change.

Details come from each recipe's source. Setup time is shown only where the recipe states it.

Review bots on every PR

Official GitHub Actions you install in your repo.

Agents that open PRs for you

Work happens overnight; you review in the morning.

CodexRoutine

Overnight test coverage PRs with Codex

OpenAI's internal guide lists seven Codex use cases; one engineer points it at low-coverage modules overnight and reviews runnable test PRs in the morning.

20 minvia Company
Multi-agentFull setup

Night shift: labeled GitHub bugs → reviewed draft PRs by morning

A Chief bot and four specialists turn labeled GitHub bugs into reproduced, fixed, independently reviewed draft PRs overnight, with a morning report that separates done from attempted.

Half a day to set upvia X
Claude CodeFull setup

Split a big task into a DAG of small subagents

A Claude Code plugin that breaks work into atomic tasks with dependencies and gives each subagent only the context it needs, in parallel worktrees.

20 minvia GitHub
Claude CodeFull setup

Claude Code fault-test loop found 55 Ceph bugs

Alex Ainscow, who works on Ceph's erasure coding, let Claude Code run a loop on upstream Ceph: inject faults into a one-machine test cluster, catch what breaks, work out why, write a unit test that fails, fix it, rebuild and go again. Across his runs it found 55 real defects, 32 of them in code already on main, for about $840 of API time on the first two sessions.

His first two long sessions were 87 hours of Claude Code work (one overnight, one over a weekend); later runs ran overnightvia Ceph.io
Claude CodeRoutine set

7 Claude Code routines that look after a solo app

Julien Renaux builds EVPick, a free assistant for choosing an electric car, on his own. Seven scheduled Claude Code routines now watch its search traffic, security, bugs and car data, turn problems into pull requests and check a week later that each fix held. In the week he measured, 46% of their PRs merged on automated checks alone; the rest took him three to four hours.

About 3 to 4 hours of his time in the week he measured, more than half of it on car-data questionsvia X

Review by a different agent

A second model that didn't write the code.

How to choose

Common questions

What is an AI code review agent?

A bot that runs on each pull request, reads the changes and posts review comments. Anthropic's claude-code-action and OpenAI's codex-action both do this inside a GitHub Actions workflow, with your own API key.

Should an AI agent be allowed to merge PRs?

None of these setups allow it. They comment or open draft PRs, and a person merges; the night-shift setup enforces that with branch protection.

Claude or Codex for PR review?

Both have official GitHub Actions, and both are listed here with their permission setups. Several recipes deliberately use a different model to review than the one that wrote the code.

Is it safe to give an AI reviewer access to my repo?

Keep it read-only. In these setups prompt injection from PR or issue text is the first listed failure, so the Codex workflow gets contents: read with only the comment step allowed to write, the Claude action has its tools limited so it comments instead of pushing, and branch protection blocks merges even if a bot ignores its prompt.

Get the next money recipe. Free.

New recipes every week, plus the top 10 agent setups pack. One email, no spam.

Unsubscribe anytime. Privacy

More guides: Make money with AI agents · AI voice agent business · AI agent agency ideas · Claude Code use cases · Grok Bot use cases · Claude Code vs Codex · AI agents for small business · AI email agents · Parallel coding agents · AI agents that save you money · AI refund agents · Autonomous agents that made money · AI agents for content creators · AI research agents