# How to Build Your Own AI Code Review Bot

> Source: <https://www.omnara.com/guides/build-ai-code-review-bot>
> Published: 2026-10-14 00:00:00+00:00

**Key takeaway:** Running four cheap reviewers from different providers and having a stronger model verify only the lines each finding points to keeps the expensive model's share of the bill small, with each reviewer costing a tenth or less of the main agent per input token.

[All guides](https://www.omnara.com/guides)

# How to Build Your Own AI Code Review Bot

Cheap models from different providers read the pull request, a stronger model checks what they found, and one review gets posted

## On this page

Hosted AI review bots are easy to turn on, but you get their model, their price, and mostly just the comments they post. A pull request reviewer is an agent with a good prompt, a copy of the code, and a way to post a review, so you can build one in an [agent harness](https://www.omnara.com/guides/agent-framework-vs-harness-vs-runtime#agent-harnesses) you already use and own all of it.

In the setup I use, four cheap models from different providers each review the pull request, and one stronger model checks what they found before anything gets posted. The video above builds it in Omnara in under five minutes.

## The Short Version

## Why Build Your Own

- You pick the models. When a cheaper model comes out, you switch to it. You can also point a reviewer at your own fine-tuned or self-hosted model.
- You add the tools. Give the reviewer an MCP server for your issue tracker or internal docs, and it can check a change against them.
- You see everything it did. The whole trace is yours: every file it read and every command it ran. You can message the same session to dig into a finding.
- You own the whole prompt. Hosted bots let you add rules on top of theirs. Here you decide what it looks for and what it ignores.
- You pay per token. There's no review product to pay for on top of the models.

Hosted review bots still make sense if you don't want to maintain prompts at all. They handle setup and code indexing for you, and most learn from which comments your team acts on. In exchange, you work within their model and their price, and you add rules on top of their prompt instead of owning it.

## How an AI Code Review Bot Works

Most of what you pay for in an AI review is a model reading code: the diff and the files around it. So the cheap models do that reading. Each one reviews the whole pull request with the same prompt and sends back a short list of findings.

I use four reviewers from four different providers. In my experience, mixing providers catches more than running the same model a few times, because each has different strengths and blind spots. I go into why in [How to Build Subagent Systems](https://www.omnara.com/guides/build-subagent-systems#why-models-from-different-labs-catch-different-things).

Several reviewers find more problems, but they also produce more false alarms and duplicates. The main agent fixes that. It merges findings that describe the same problem, notes how many reviewers flagged each one, and checks every finding against the code before keeping it. It only reads the lines each finding points to, which keeps the expensive model's share of the bill small.

Cloudflare describes the same shape for [its internal reviewer](https://blog.cloudflare.com/ai-code-review/): up to seven specialized reviewers, and a coordinator on a top-tier model that "deduplicates their findings, judges the actual severity of the issues, and posts a single structured review comment."

Three choices in the prompts matter most:

- Say what not to report. Style nits, anything a linter or type checker would catch, and problems that were already there. Cloudflare's team found that "telling an LLM what not to do is where the actual prompt engineering value resides." Without it, you get a pile of comments that's a slog to read.
- Ask about the design, not just bugs. A bug or messy code is often a sign that something deeper needs a refactor. The reviewers can suggest a better approach the pull request didn't consider, and the main agent keeps at most two of these, in the review summary.
- Run only when tagged. If the bot reviews every push, every push is another review you pay for.

## The Models

At standard rates, each reviewer costs a tenth or less of the main agent per input token. Any four cheap models from different providers will do, and you can change them whenever prices move. I run the main agent at medium reasoning effort, since checking findings doesn't need the highest setting, and the reviewers at medium too.

## The Prompts

### Reviewer

The same prompt goes to all four reviewers; only the model changes.

### Main agent

This version uses the tool names from Omnara's GitHub integration. In another harness, swap in its tools or the `gh` CLI for reading the pull request and posting the review.

## Building It in Omnara

[Omnara](https://github.com/omnara-ai/omnara) is an open-source agent platform with a [GitHub integration](https://docs.omnara.com/integrations/github) that registers a GitHub App, starts the agent from pull request events, sets up Git credentials for cloning, and gives the agent tools to post reviews.

1. Make four reviewer profiles. Under Agents → New agent, create `haiku-review` ,`luna-review` ,`deepseek-review` and`gemini-review` , each with its model, the reviewer prompt, medium reasoning effort, and`default-pool` under Machine sources. A reviewer runs on the main agent's machine, so it sees the repo the main agent cloned; the machine source is what gives it the tools to run commands. Nothing else goes under Tools.
2. Make the main agent. Create `GitHub PR Reviewer` on Claude Opus 5.5 at medium reasoning effort, with the main agent prompt and`default-pool` with working directory`/workspace` .
3. Add the reviewers as subagents. Under Subagents, add each reviewer profile as an Agent profile with the key the prompt uses (`haiku` ,`luna` ,`deepseek` ,`gemini` ) and Max instances 1, and set Max active subagents to 4. The[configuration docs](https://docs.omnara.com/agents/configuration) cover the other subagent settings.
4. Connect GitHub. Under Integrations → GitHub PR review, name the integration `github-bot` so its tool names match the prompt, create the GitHub App, choose the repositories, and connect. In Pull requests, pick`GitHub PR Reviewer` , tick only Bot mentioned, and select Save changes.
5. Try it. From a GitHub account with write access to the repo, comment `@<your-app-name> review` on a pull request. The run appears under Agents → Instances, with the four reviewers working in parallel, and its Usage panel shows the cost, including the subagents.

Any model you've connected works, including OpenRouter, Anthropic, OpenAI, Amazon Bedrock, or a [custom endpoint](https://docs.omnara.com/organization/model-providers) for a model you host yourself. To have it check your issue tracker or docs, add an [MCP server](https://docs.omnara.com/tools/mcp) to the main agent or the reviewer profiles, and set its tools to always allow. MCP tools ask for approval by default, and nobody is there to approve them. For a simpler starting point with a single reviewer, see the [PR review agent example](https://github.com/omnara-ai/omnara/tree/main/examples/pr-review-agent).

## Building It with Claude Code, Codex, and Other Harnesses

The pattern needs three things from a harness: a way to run on a pull request, subagents that run in parallel, and a model setting for each subagent. Claude Code, Codex, OpenCode and Goose all document parallel subagents. Where they differ is whether each reviewer can use a different provider.

In most of these, the main agent posts the review with its own `gh api` call. Claude Code's Action is the exception: it has a built-in tool that posts inline comments, one at a time. Either way, let only the main agent post. For workflows triggered by `pull_request`, GitHub withholds secrets on PRs from forks, so the review won't run on them; comment-triggered workflows do get secrets, so limit who can trigger them.

OpenCode's GitHub Action is the quickest way to try this pattern inside GitHub Actions. It mixes providers and runs from `/oc` comments. In exchange, you adapt the main agent's prompt to its tools or `gh`, keep each provider's key in GitHub secrets, and maintain the workflow yourself. Claude Code fits only if every reviewer can be a Claude model, and Codex needs a router such as OpenRouter to mix providers.

For a reviewer your whole team relies on, Omnara is the better home. The GitHub App, the pull request triggers, and Git credentials are already set up, and the main agent's prompt above already uses its tool names. Each reviewer can use any model from OpenAI, Anthropic, OpenRouter, or a compatible endpoint on your own keys. The platform itself is free, so you pay for the models and machines you use, nothing extra when they're your own keys and machines, and you can self-host all of it, transcripts included.

## What AI Code Review Costs

You pay for model tokens and the time the machine runs. The cheap reviewers do most of the reading, but the main agent's tokens cost the most, so keep its share small. Four things keep the bill down:

- Run only on mentions. A message the bot ignores, like a new push, costs one short model turn instead of a review.
- Keep the main agent from re-reading the diff. It should read the reviewers' findings and the lines they cite, not do its own full review.
- Use medium reasoning effort on the main agent. Reasoning tokens are billed as output, the most expensive part.
- Keep reviewers focused. Haiku 5.5 charges five times as much for any single request over 100,000 tokens, which a reviewer reading the whole repo can hit.

For a sense of scale, Cloudflare reports a median of [$0.98 per review](https://blog.cloudflare.com/ai-code-review/) for its reviewer, which uses mid-tier models for the reviewers. The Usage panel shows what yours costs.

## FAQ

### Can the bot fix the problems it finds?

Yes, if you let it push. Turn on Let agents push code in the GitHub integration. Apps registered through Omnara already have Contents: Read & write; if yours only has read access, grant write access in the app's GitHub settings. Then ask the same agent, in the same session, to fix what it found and push a commit.

### How do I stop it from leaving too many comments?

Tell the reviewers what not to report, cap the number of findings, and have the main agent check each finding against the code before posting. If it's still noisy, look at which comments people ignore and add those to the "do not report" list.

### What's the best AI model for code review?

Use two kinds: cheap models from different providers for the reading, so their blind spots differ, and the strongest model you can afford for the main agent, since it decides what gets posted. Swap the cheap ones as prices change.

### Can Claude Code or Codex review pull requests?

Yes. Claude Code's GitHub Action reviews a pull request when someone mentions `@claude`, and Codex has a GitHub Action and `codex exec` for workflows. Both can run reviewer subagents, but Claude Code only uses Claude models, and Codex keeps every subagent on the session's provider. To mix reviewers from different labs without a router, use OpenCode, Goose, or Omnara.

### Do I need four reviewers?

No. One cheap reviewer and a checker already works. In my experience, more reviewers from different providers catch more, and each extra cheap reviewer adds little to the cost.
