Open Code Review: How Alibaba Open-Sourced an AI Code Reviewer That Cuts Token Costs by 90% Alibaba has open-sourced Open Code Review (ocr), an AI code review tool it says has been battle-tested internally for two years across tens of thousands of developers. The tool pairs a deterministic engineering engine for file selection, bundling, and rule matching with isolated LLM sub-agents for semantic review, which the project claims cuts token costs by 90% versus general-purpose coding agents. Alibaba evaluated it on AACR-Bench, a benchmark built from 200 real pull requests across 50 open-source repositories and 1,505 verified defects, reporting higher precision and F1 scores than generic agents like Claude Code. Code review is one of the highest-leverage practices in modern software engineering, yet it remains one of the biggest bottlenecks. In high-velocity teams, pull requests sit idle waiting for senior developers to triage them, while junior reviews often get caught up in formatting nitpicks rather than deep architectural bugs. When general-purpose AI coding agents such as Claude Code or Cursor entered the scene, many teams rushed to wire them into their pull request workflows. But teams quickly ran into three pervasive pain points: To solve this, Alibaba has open-sourced Open Code Review ocr —the exact tool battle-tested inside Alibaba Group over the past two years, serving tens of thousands of developers and detecting millions of real code defects. Here is a technical deep dive into how Open Code Review works, why its hybrid architecture outperforms raw LLM prompts, and how you can integrate it into your terminal and CI pipelines. The fundamental mistake most AI review integrations make is treating code review as a pure text-generation problem. When you pass a massive git diff into an LLM with a prompt like "Review this code for bugs," the model has to juggle three completely different cognitive burdens simultaneously: LLMs are extraordinary at semantic reasoning, but notoriously flaky at deterministic bookkeeping and spatial tracking. When context windows get full, they drop files and hallucinate line locations. Open Code Review takes a pragmatic architectural approach: let deterministic code handle what must not fail, and let the LLM handle semantic reasoning. ┌─────────────────────────────────────────────────────────────┐ │ Git Diff / Commit │ └──────────────────────────────┬──────────────────────────────┘ │ Deterministic Engineering Engine ┌────────────────────┴────────────────────┐ ▼ ▼ Precise File Selection Smart File Bundling Filters out vendor/lockfiles Groups related modules │ │ └────────────────────┬────────────────────┘ ▼ Fine-Grained Rule Matching Injects domain-specific checks │ ▼ LLM Semantic Review Agents Isolated sub-agent per bundle │ ▼ Comment Positioning & Reflection Validates coordinates & removes noise │ ▼ Accurate, Line-Level PR Comments UserService.java and UserDTO.java , or multilingual property files . Each bundle runs in an isolated sub-agent context, enabling massive concurrency and rock-solid stability on large changesets. Instead of giving the LLM unrestricted bash access that burns tokens on trial-and-error searches, OCR provides a curated, scenario-tuned toolset distilled from millions of production review traces. The agent can read full file contents, inspect callers, and trace dependencies—retrieving only the exact context required to verify a bug. To objectively test Open Code Review against general-purpose agents, the project evaluated performance on AACR-Bench —a real-world code review benchmark created from 50 popular open-source repositories, 200 real pull requests across 10 programming languages, and 1,505 ground-truth defects verified by over 80 senior software engineers. | Metric | Claude Code Generic Agent | Open Code Review ocr | Advantage | |---|---|---|---| | Precision | Lower frequent false alarms | Significantly Higher | Much lower triage overhead | | F1 Score | Baseline | Higher | Better overall review quality | | Average Token Usage | ~9x baseline consumption | ~1/9th tokens | ~89% API cost reduction | | Review Speed | Slower unconstrained calls | Fast & Concurrent | Minimal CI pipeline latency | Note on Trade-offs: OCR deliberately prioritizes precision over raw recall. In an engineering workflow, a review tool that produces 5 high-confidence, actionable bugs is vastly superior to a noisy tool that flags 20 false positives. Open Code Review is packaged as a cross-platform CLI tool with zero complex dependencies. You can install the CLI globally via npm: npm install -g @alibaba-group/open-code-review Verify your installation: ocr --version OCR supports any OpenAI-compatible or Anthropic endpoint, as well as self-hosted local models Ollama, vLLM : ocr config provider Select provider OpenAI, Anthropic, DeepSeek, Custom ocr config model Select active model The CLI provides an interactive wizard that verifies API key connectivity automatically. Review current working changes staged & unstaged : cd your-project ocr review Review a feature branch against main merge-base mode : ocr review --from main --to feature-branch Review a specific commit: ocr review --commit 4a8f9b2 Full codebase / directory audit no git diff needed : ocr scan --path src/auth Output machine-readable JSON for CI/CD pipelines: ocr review --format json --output review-results.json One of the most developer-friendly features of Open Code Review is Delegation Mode . If you are already running an AI coding tool like Claude Code , Codex , or Cursor , you don't need to configure another API key or pay for an extra LLM endpoint. In Delegation Mode, OCR runs its deterministic file selection, bundle slicing, and rule matching locally, and then outputs structured review tasks for your host agent to execute: Preview the deterministic review plan ocr delegate preview Pass matched rules directly to your active agent ocr delegate rule src/main.go src/handler.go This allows developers to leverage OCR's battle-tested orchestration logic completely free on top of their existing IDE and agent subscriptions. Open Code Review is proof that as AI tooling matures, the winners won't be raw prompt wrappers—they will be systems that combine rigorous deterministic engineering with targeted AI reasoning . By offloading file bundling, rule matching, and line coordinates to deterministic code, OCR turns what used to be a noisy, expensive experiment into an enterprise-grade developer assistant.