跪拜 Guibai
← All articles
Open Source · Artificial Intelligence · Full Stack

OpenCodeReview: Alibaba's Open-Source AI Reviewer That Doubles F1 and Slashes Token Costs

By 狂师 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Code review is the bottleneck that AI-generated code makes worse. OpenCodeReview shows a tested architecture for making review agents reliable enough to run in CI, with precision-first output and token costs a fraction of a general-agent pass.

Summary

OpenCodeReview, born from Alibaba's internal AI code review assistant and open-sourced in May, reads Git diffs and hands changed files to a tool-calling agent. The agent can read full files, search the codebase, and pull context from other changed files before producing structured comments with file names and line ranges. On the official AACR-Bench, Claude Opus 4.6 with OpenCodeReview hit 25.1% F1 and 33.9% precision at 385K tokens per review; the same model run bare through Claude Code got 11.6% F1 and burned 5.66M tokens.

The architecture splits responsibilities: deterministic engineering handles file selection, rule routing, line-number anchoring, and a reflection module that intercepts hallucinations; the agent owns risk identification, context exploration, and classification. It covers 40+ languages, supports whole-file scanning for legacy codebases, and integrates with GitHub Actions, GitLab CI, and Gerrit. A single `ocr` CLI command installs globally, and config presets for Anthropic, OpenAI, DashScope, DeepSeek, and Z.AI get you started. Recall is deliberately low by design to keep precision high.

Takeaways
— OpenCodeReview is Apache-2.0, open-sourced in May from Alibaba's internal tool, with 52K+ GitHub stars.
— The CLI is `ocr`, available via npm or Homebrew, requiring Git 2.41+.
— It reads Git diffs and runs a tool-calling agent that can access full files, search the codebase, and read other changed files.
— The hybrid architecture puts file selection, line anchoring, and rule matching in deterministic engineering; the model handles semantic judgment.
— A reflection module explicitly intercepts hallucination and knowledge drift.
— Built-in rules cover 40+ languages and file types (Java, TypeScript, Go, Python, Kotlin, Rust, C/C++, Swift, Verilog, Solidity) and check NPE, thread safety, XSS, SQL injection.
— `ocr scan` reviews whole files without git history, for legacy codebases, with `--resume` to continue interrupted scans.
— On AACR-Bench, Claude Opus 4.6 with OpenCodeReview achieved 25.1% F1 and 33.9% precision using 385K tokens (1m23s), versus 11.6% F1 and 5.66M tokens (13 min) for bare Claude Code.
— The benchmark uses 200 real PRs from 50 repos, 10 languages, and 1,505 issues annotated by 80+ senior engineers; the dataset is on HuggingFace.
— Precision of 33.9% means roughly one in three findings is real; recall is deliberately suppressed to avoid false positives.
Conclusions

The 94% token reduction comes from process engineering, not model choice; the same model scores double the F1 when the pipeline constrains what it does.

A 33.9% precision means the tool remains a pre-filter that needs a human final reviewer; the official trade-off of lower recall for fewer false positives is pragmatic for CI.

The hybrid split between deterministic plumbing and agent semantics is a reusable pattern for any high-frequency agent task, not just code review.

Concepts & terms
AACR-Bench
A code review benchmark built from 200 real PRs across 50 open-source repositories, covering 10 languages, with 1,505 issues cross-annotated by 80+ senior engineers. It was created by Alibaba for evaluating AI code reviewers, with the dataset publicly available on HuggingFace.
Delegation mode
In OpenCodeReview, a mode where the host agent (such as Claude Code, Cursor, or Kimi Code) supplies the model, while OCR handles file selection and rule parsing. This avoids configuring a separate API key for the review tool.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗