OpenCodeReview: Alibaba's Open-Source AI Reviewer That Doubles F1 and Slashes Token Costs
Hello everyone, I'm Kuang Shi.
The way we write code has changed a lot in the past two years. Many people use AI to write code daily: you throw a requirement description at it, and a few minutes later a piece of code comes out. Output is faster, but a new problem follows: how do you guarantee quality? You can't see the flaws in code you wrote yourself, and even less so with AI-written code. You glance at the diff, think it runs, and commit; the problem often hides in that glance. Having a teammate review is fine, but small teams can't spare someone, and in large teams review often becomes a few minutes of going through the motions.
Today I want to share an AI code review tool: OpenCodeReview.
What is OpenCodeReview?
For this project, you only need to remember a few key facts.
- It comes from Alibaba Group, formerly the official internal AI code review assistant. It was open-sourced in May this year under the Apache-2.0 license.
- 52,000 stars on GitHub, accumulated in half a year, and a new version was released on November 15.
- Officially, it ran internally for two years, served tens of thousands of developers, and identified millions of code defects. That number can't be verified, so take it as publicity.
- It runs on Windows, macOS, and Linux; the installed command is
ocr.

It does one simple thing: it reads your code changes, automatically finds problems, and each comment points to a specific line. Configure one model endpoint and you're ready.
It reads the Git diff and hands the changed files to an Agent with tool-calling ability. This Agent can read full file contents, search the codebase, and check other changed files for context, then give structured review comments with filenames and line-number ranges. You just follow them.

Three chronic problems with general Agents reviewing code
If you've used general Agents like Claude Code to review code, you've likely seen these problems.
When changes get large, the Agent cuts corners. For a big changeset, it only looks at a few files and dismisses the rest in one sentence. You don't even know what it missed.
The second is position drift — the reported problem doesn't match the line number, so you have to hunt around to find which line it actually means.
Third is quality instability — rephrasing the prompt changes the review quality, and when something breaks, it's hard to debug.
The official analysis: the root of these issues is pure language-driven design. The whole review flow relies on prompt constraints, with no hard engineering constraints. When the model is in a good state, it reviews carefully; when not, it slops through.
Hybrid architecture: engineering manages the process, model manages semantics
The core design of OpenCodeReview splits the work into two tracks.
Parts that must not fail go to deterministic engineering. Which files to review and which to filter are fixed by engineering logic. Related files are grouped into a review unit — for example, English and Chinese config files are reviewed together. Each unit gets its own sub-Agent, so contexts don't interfere, large changesets stay stable, and it can run concurrently. Review rules are matched by file characteristics before being fed to the model. Line-number anchoring is handled by a separate positioning module that uses a three-level progressive strategy to pin each comment to a specific line. There's also a reflection module that intercepts hallucinations and knowledge drift early, catching model misstatements.
Dynamic parts go to the Agent. Risk identification, context exploration, and problem classification — these semantic tasks are done by the model, with prompts and tool sets tuned for code review.
Built-in review rules cover 40+ languages and file types, including Java, TypeScript, Go, Python, Kotlin, Rust, C/C++, and Swift, plus less common ones like Verilog and Solidity. Checks cover high-frequency defect types such as NPE, thread safety, XSS, and SQL injection.
Old projects can be reviewed too: whole-file read
Beyond diff review, ocr scan takes a different route. It doesn't read the diff; it reads the whole file directly, and doesn't even need git history.
That suits two scenarios. First, taking over an unfamiliar codebase — tens of thousands of lines of legacy code with no diff to speak of; scan the whole repo to get a feel. Second, a long-lived old project where historical commits are meaningless; the file itself is what needs reviewing. If the scan is interrupted, don't panic: ocr session list shows sessions, add --resume to continue.
Same model, double F1, token cost a fraction
The official benchmark is AACR-Bench, with 200 real PRs picked from 50 popular open-source repos, covering 10 languages. 80+ senior engineers cross-annotated 1,505 issues as ground truth. The dataset is on HuggingFace.
The most telling result is the same-model comparison. Claude Opus 4.6 with OpenCodeReview scores 25.1% F1, 33.9% precision, an average of 385,000 tokens per review, finishing in 1 minute 23 seconds. The same model running bare via Claude Code drops to 11.6% F1 and burns 5.66 million tokens, taking 13 minutes. Score doubles, cost is a fraction.
Two caveats. This leaderboard is the official one, but the dataset and methodology are public, so you can verify it yourself. Also, recall is deliberately lower than a general Agent — that's an explicit trade-off: precision first. Better to report fewer findings than to generate a pile of false positives for people to sift through.
One command to install, one command to review
The only environment requirement is Git 2.41+. Pick your install method.
npm install -g @alibaba-group/open-code-review
# or macOS / Linux with Homebrew
brew install open-code-review
# verify
ocr version
After install, configure the model. ocr config provider opens an interactive menu with Anthropic, OpenAI, DashScope, DeepSeek, and Z.AI preset. Pick one, fill in the key, or use a custom endpoint for private deployment. ocr config model picks the specific model and runs a connectivity test automatically.
ocr config provider
ocr config model
Then review. In the project directory, run ocr review — it reviews all staged, unstaged, and untracked changes. To review changes on a branch, use --from main --to feature-branch. For a single commit, add --commit. For whole-file reading, use ocr scan as described above.
ocr review
ocr review --from main --to feature-branch
ocr review --commit abc123
ocr scan
The two things to learn are the ocr command and the provider/model config concepts. For advanced use, there are existing plugins for Claude Code, Codex, Cursor, and Kimi Code. Delegation mode lets the host Agent provide the model while OCR handles file selection and rule parsing, so you don't need to configure a separate key. In CI, there are ready integrations for GitHub Actions, GitLab CI, and Gerrit.
The shortest path is the steps above. Wrap it, fill in the key, enter your project directory, run ocr review, and the first line-level review comment appears.
Points to watch
Understand the absolute precision. 33.9% precision means for every three comments it makes, about one is real. It works as a pre-commit filter to catch obvious problems; the final review still needs a human.
Weigh the cost. A single review starts at tens of thousands of tokens; with a model like Opus, API charges are not cheap. There are low, medium, and high effort levels. Use low for daily changes and high for core modules to save a lot.
In closing
The tool itself is optional. If your team has a healthy review culture and enough people, you may not need it. But three things in this design are worth borrowing.
First, the division between deterministic engineering and Agent work. Process tasks — file selection, line-number anchoring, rule routing — are hard-coded in engineering code; the model only does semantic judgment. For any high-frequency repetitive Agent task, this split works.
Second, a dedicated interception module for hallucinations. Line-number anchoring and comment reflection are separate modules, far more reliable than begging the model in the prompt to report accurately.
Third, the token-saving idea. For the same review task, the dedicated Agent spends 385,000 tokens; the general Agent spends 5.66 million. The difference is all in process engineering. The bulk of cost in Agent projects lives right there.

GitHub Project Address:
https://github.com/alibaba/open-code-review