Open Code Review: Alibaba's Hybrid AI Reviewer vs Claude Code, Codex and Any Model (2026)
- Explain what open-code-review does differently from asking Claude Code or Codex to "review my PR": which steps are code, which are model
- Read its benchmark honestly — the 4.7x precision headline, the 20% recall ceiling, and why a newer Claude model scored lower
- Run a first review with any provider (Claude, GPT, Gemini, Qwen, DeepSeek, a local Ollama model) and preview the file filter without spending a token
- Choose between OCR-managed reviews and delegation mode, where your Claude Code or Codex subscription does the thinking
- Wire it into CI without walking into the pull_request_target and false-positive traps
Every team that turned on coding agents in 2026 hit the same wall: the code arrives faster than anyone can read it. "Just ask the agent to review it too" is the obvious answer, and it mostly produces a wall of comments nobody trusts. open-code-review (the ocr CLI) is Alibaba's answer, open-sourced on May 18, 2026 after roughly two years inside the company, and it is back on GitHub Trending this week with 27.5k stars and a release on September 15.
It is worth a page because its core idea transfers to anything you build with Claude, GPT or an open model: take the steps that must not go wrong away from the model, and hand the model only the judgement calls.
The idea: code for the rails, a model for the judgement
The maintainers name three failure modes they saw when general-purpose agents review code with a skill or prompt, and they map almost one-to-one to what Claude Code users complain about:
| Failure in a pure-agent review | What OCR does in code instead |
|---|---|
| Incomplete coverage — on big diffs the agent quietly reviews some files and skips others | A deterministic five-gate file filter decides exactly which files are reviewed, and each one is dispatched; the model cannot "forget" a file |
| Position drift — the comment points at the wrong line or file | A separate positioning module anchors each comment by matching the code snippet the model quotes against the diff, then the whole file, and only then asks the model to relocate it |
| Unstable quality — small prompt changes swing the result | Rules are matched to files by glob patterns, not chosen by the model; related files (for example message_en.properties and message_zh.properties) are bundled and each bundle runs as an isolated sub-agent |
The model keeps the parts it is actually good at: deciding what to look at next and pulling in context. It gets a small, purpose-built toolset — read a file range, read another file's diff, grep the repo, find a file by name, emit a comment, finish — which the team says they distilled from tool-call traces in production. A final reflection/filter pass throws out weak comments before you see them.
- Workspace (staged, unstaged and untracked), a branch range computed from the merge-base, a single commit, or `ocr scan` for whole files with no diff. Git 2.41+ is required.
- Five gates in order: binary, your exclude list (always wins), your include list (bypasses the rest), extension allowlist, built-in test-file patterns. `vendor/`, `node_modules/` and similar are dropped before the gates and can never be included.
- Each file gets its rule from a priority chain (CLI `--rule`, then project `.opencodereview/rule.json`, then your user file, then the built-in rules). Related files are grouped; groups run in parallel, 8 at a time by default.
- A read-only plan call runs only for big changes (one file with 50+ changed lines, or 2+ files totalling 100+). Then the main tool loop runs 1, 2 or 3 rounds depending on `--effort`; later rounds see earlier findings and skip the plan, which the docs say otherwise acts as a coverage ceiling.
- Comments are anchored to lines, weak ones are filtered, and results go to text, JSON or SARIF — or back to your PR through a CI recipe.
The benchmark, read carefully
Alibaba publishes results on AACR-Bench, its own dataset on Hugging Face: 50 open-source repositories, 200 real pull requests, 10 languages, and 1,505 issues annotated and cross-checked by 80+ senior engineers. Selected rows from the leaderboard in the README:
| Reviewer | Model | F1 | Precision | Recall | Tokens / review | Time |
|---|---|---|---|---|---|---|
| OCR v1.3.1 | Claude Opus 4.6 | 25.1% | 33.9% (301 of 889) | 20.0% | 385K | 1m23s |
| OCR v1.8.7 | Qwen3.8-Max | 23.0% | 33.9% | 17.4% | 334K | 5m14s |
| OCR v1.3.1 | GPT-5.5 | 21.0% | 32.1% | 15.5% | 422K | 2m51s |
| OCR v1.3.1 | Claude Opus 4.8 | 17.9% | 37.8% | 11.7% | 352K | 1m06s |
| Claude Code v2.1.169 | Claude Opus 4.8 | 14.1% | 15.9% | 12.7% | 2,062K | 5m38s |
| Claude Code v2.1.169 | Claude Opus 4.6 | 11.6% | 7.2% (435 of 5,980) | 28.9% | 5,664K | 13m06s |
| Codex v0.140.0 | GPT-5.5 | 8.4% | 27.8% | 4.9% | 525K | 2m58s |
Three things in that table are more interesting than the headline.
1. The precision gap is really a comment-volume gap. With Opus 4.6, Claude Code posted 5,980 comments across 200 PRs — about 30 per PR — and 7% of them matched a real annotated issue. OCR posted 889 (about 4.4 per PR) and 34% matched. Claude Code actually found more real issues (435 vs 301, the higher recall). The difference is noise, and noise is what gets an AI reviewer switched off: one Hacker News commenter put it as "if 7/8 flagged items are fine, people will ignore warnings."
2. The best reviewer on the board finds one real issue in five. The top recall anywhere is Claude Code's 28.9%, and OCR's best is 20%. Even allowing for a strict, opinionated ground truth (a point raised on HN), no configuration here is a merge gate. Treat any AI reviewer as a filter that catches some bugs cheaply, not as the thing that says a PR is safe. That fits a wider pattern AILmanac covers in the verification bottleneck.
3. A newer model scored lower, and the headline ratios shrink with it. Inside OCR, Opus 4.8 had the best precision on the board (37.8%) but lower recall (11.7%) than Opus 4.6, so its F1 dropped from 25.1% to 17.9%. Stronger models were more conservative — the same thing an HN tester reported with GPT-5.x. Against Claude Code on Opus 4.8, OCR's edge is about 2.4x precision and about 6x fewer tokens, not the 4.7x and ~1/15 you get from the Opus 4.6 rows (the README rounds its overall claim to "~1/9"). And the Claude Code and Codex rows are several versions old.
Also keep in mind that this is the vendor's benchmark, built by the team that builds the tool. An early independent test on HN (10 PRs from a different benchmark) measured roughly 12% precision; the maintainers traced it to a broken tool call and said it was fixed. Run it on your own recent PRs before you believe any row.
Run a first review with any model
ocr is a Go binary shipped through npm. It speaks the Anthropic, OpenAI Chat Completions, OpenAI Responses and Bedrock protocols, and ships presets for Anthropic, OpenAI, Gemini, DeepSeek, Kimi, Z.ai, MiniMax, xAI, DashScope (Qwen) and more; anything else is a custom provider with a URL and a protocol.
Install, configure, and dry-run the filter
npm install -g @alibaba-group/open-code-review # Interactive: pick a provider, paste a key, pick a model; it runs a connectivity test ocr config provider ocr config model ocr llm test cd your-repo # See exactly which files would be reviewed, and why others are excluded — no LLM call ocr review --preview # Review your branch against main, with context the model can't infer ocr review --from main --to my-branch --background "Adds rate limiting to the public API"
Things the docs spell out that save you an afternoon:
- Already using Claude Code? If no config file or
OCR_LLM_*variables are set,ocrfalls back toANTHROPIC_BASE_URL,ANTHROPIC_AUTH_TOKENandANTHROPIC_MODEL. It takes the first complete URL-token-model triple it finds, so a stale config file silently beats your environment variables. - Local models need native tool calling. OCR drives the whole review through tool calls. A model that only writes tool calls as text (the FAQ names
deepseek-r1) loops on "No tool calls parsed" and returns zero comments. Pick an Ollama model tagged for tools, such asqwen3; see running models locally. --effortis the quality/cost dial.lowis 1 review round,medium(default) 2,high3; the per-group timeout scales with it.--max-tokens-budgetputs a hard cap on total tokens and still publishes partial results.--backgroundmatters. The CLI reference calls it one of the highest-leverage flags: the model only sees the diff and what it chooses to read, not your ticket.- A comment at
start_line: 0is real but couldn't be anchored — usually the model paraphrased the code instead of quoting it, or the diff has CRLF or mixed indentation.
Custom rules
Rules are plain JSON, matched by glob. The project file is .opencodereview/rule.json; each entry has a path pattern, the rule text, and merge_system_rule to keep the built-in rules for that file as well. The first matching pattern wins, so put specific paths before general ones, and ocr rules check <file> prints which layer and pattern matched. The repository's own rule file is a good template: it tells the reviewer to enforce field order, keep four translated docs in sync with a code table, and require a named test for every new provider — house rules no general model would guess.
Built-in coverage leans toward Alibaba's stack (Java null-pointer and thread-safety checks, XSS in JS/TS, SQL injection in mapper XML files); community PRs have since added Python, Rust, Kotlin, C/C++, Terraform and others.
OCR-managed or delegation mode
There are two ways to run it from inside a coding agent, and they differ in who pays for the thinking.
| OCR-managed (plugin, skill, CLI) | Delegation mode | |
|---|---|---|
| Who calls the model | ocr, with its own API key | Your host agent (Claude Code, Codex, Cursor, OpenCode…) |
| What OCR does | The whole pipeline above | Only file selection and rule resolution |
| Cost | Metered API tokens | Your agent subscription's quota |
| Keeps the benchmark's guarantees | Yes — anchoring, rounds, reflection filter | Partly — coverage and rules, but the review itself is whatever your agent does |
In Claude Code, /plugin marketplace add alibaba/open-code-review then /plugin install open-code-review@open-code-review gives you /open-code-review:review (OCR-managed, with an auto-fix step) and /open-code-review:delegate-review. Codex installs the same repo as a plugin marketplace.
Delegation mode by hand (what the skill automates)
# 1. Which files, in which mode, and why others were excluded ocr delegate preview --from main --to my-branch # 2. The rule checklist for those files, grouped so shared rules appear once ocr delegate rule src/api/handler.go src/api/limits.go # 3. Your agent then reads each diff with git (git diff <merge_base>..<to> -- <path>), # reviews each file against its rule group, and reports # Critical/High always, Medium with context, Low only if clearly valuable.
Delegation is a nice pattern even if you never install OCR: a tiny deterministic helper that tells the agent exactly which files to cover and which checklist applies turns "review this" from a hope into a loop the agent cannot cut short.
CI: two traps
The shipped GitHub workflow runs on pull_request_target and on /open-code-review comments, installs ocr, reviews the range as JSON (--format json --audience agent), and posts inline comments, folding line-less findings into a summary. There is also a composite action.yml with inputs like llm_model and llm_reasoning_effort. Two things to decide before you copy it:
pull_request_targetgives fork PRs access to your secrets. The docs chose it so reviews work on forks, and they note OCR only reads the diff and never runs PR code. But the diff is untrusted text going straight into a model that holds a posting token. Inference, not a documented incident: a malicious PR can try to prompt-inject the reviewer into staying quiet or posting misleading comments. Keep the job's permissions to what posting needs, never let the AI review be what approves a merge, and read how a GitHub issue became a CI secret leak.- Budget for noise before you roll it out. The Action's default request body turns off model "thinking" for compatibility, which changes how a reasoning model behaves compared to your local runs. Pin the
ocrversion (the input defaults tolatest), start with a comment-only trigger on a few repos, and count how many comments your team actually acts on.
Check yourself
0/6Sources & further reading
- alibaba/open-code-review on GitHub — README (design rationale, benchmark table), Apache-2.0
- AACR-Bench dataset on Hugging Face — the 200-PR benchmark behind the numbers
- Architecture doc — the five-gate filter, plan thresholds, review rounds, memory compression
- Configuration and FAQ — providers, fallback order, local-model tool-calling, anchoring failures
- Delegation mode and CI/CD
- Coding-agent plugins (Claude Code, Codex, Cursor)
- Maintainers' two-month retrospective (July 29, 2026) — internal usage figures and how they review their own AI-written code
- Hacker News discussion — independent test results, the precision-vs-recall argument
Next
- Coding agent CLIs compared — the agents OCR plugs into and benchmarks against
- Evaluating agents — test a reviewer on your own PRs instead of trusting a leaderboard
- Hooks in Claude Code — run
ocr reviewautomatically before a commit, the way OCR's own team does