Every few weeks another AI code reviewer climbs GitHub trending, and most are the same thing: a prompt wrapped around a general-purpose agent. Open Code Review (OCR) from Alibaba is a different bet. A deterministic pipeline decides what gets reviewed and under which rules, and the LLM agent only handles the part that needs judgment. It has 47,167 GitHub stars (queried on 2026-10-14) and an Apache-2.0 license.
In this guide I cover how it works, what its own benchmark does and does not prove, how to configure it and wire it into CI, what leaves your machine, and when you should skip it. I read the README, the docs and the release notes for this post; I did not run it on a production repo, and I label every number that comes from the project itself.
1. What Is Open Code Review
Open Code Review is a Go CLI (ocr) that reads a Git diff, sends the changed files to a configurable LLM through an agent with tool use, and returns structured review comments anchored to line numbers. According to its README it started as Alibaba Group’s internal AI code review assistant and was open-sourced after about two years of internal use. Beyond diffs, ocr scan reviews whole files for directories that have no meaningful diff.
Repo facts (verified Oct 14, 2026)
- Repository: github.com/alibaba/open-code-review
- Stars: 47,167 (GitHub API, 2026-10-14) · repo created 2026-05-18
- Forks: 3,433
- License: Apache-2.0
- Language: Go
- Latest release: v1.13.0 (2026-10-13), same version on npm
- Requires: Git ≥ 2.41 (README) · Node.js ≥ 18 for the npm install (quickstart doc)
- Origin story: “two years” and “tens of thousands of developers” are the project’s own claims, not independently verified
Stars are attention, not proof. 47K in under five months says the pitch landed; it does not say the review quality holds on your stack. The sections below separate what the docs show from what you should test yourself.
The release cadence is fast
Between 2026-09-28 and 2026-10-13 the project shipped v1.12.10, v1.12.11, v1.12.12, v1.12.13 and v1.13.0. That is healthy maintenance, but flags and defaults move with it. Pin the version in CI (details in section 7).
2. Rule Pipeline + LLM vs. Agentic Review
The common way to build an AI reviewer is to hand a general-purpose coding agent a review skill and let it decide everything: which files to open, what to check, where to anchor each comment. The README names three failure modes it attributes to that approach:
Incomplete coverage
On larger changesets agents tend to cut corners: they review some files and quietly skip others.
Position drift
Reported issues often do not match the real code location; line numbers and file references drift off target.
Unstable quality
Natural-language skills are hard to debug, and review quality fluctuates with small prompt changes.
OCR’s answer is to move the steps that must not go wrong out of the prompt and into code. The comparison below is my summary of the README’s design section:
Prompt-driven agent review
- • The model decides which files get reviewed
- • The model reports line numbers and file paths
- • Rules live as prose inside the prompt
- • One long conversation covers the whole PR
OCR: pipeline + agent
- • Code selects and filters files, so nothing is silently skipped
- • Separate modules resolve line positions and filter weak comments
- • Rules are matched per file by glob, then injected into the prompt
- • Related files are bundled; each bundle runs as its own sub-agent
The trade-off, stated plainly
A pipeline gives you coverage you can audit and cost you can predict. It does not give you more recall: the README itself says OCR’s recall is lower than a general-purpose agent’s and calls that a deliberate trade for fewer false alarms. If you want the reviewer that explores the most, this is not it.
3. The Architecture in 4 Steps
The architecture doc describes a linear pipeline: bootstrap, diff provider, filter and rules, grouping, sub-agents, output. Four ideas carry it:
Step 1 — Deterministic scope
Git produces the diff in one of three modes: workspace (staged, unstaged and untracked), a single commit, or a merge-base range. A chain of gates then drops binaries, secret paths such as .env and SSH keys, your excludes, unsupported extensions and default paths like tests, vendor and generated code. A file whose diff alone exceeds 80% of the prompt limit is skipped as too_large.
Step 2 — Rules and bundles
Each surviving file gets a rule from a four-layer chain: the --rule flag, the project’s .opencodereview/rule.json, your global ~/.opencodereview/rule.json, then the rules embedded in the binary. One small LLM call sees only file metadata, never diff content, and bundles related files into groups of at most 10.
Step 3 — Sub-agents with a small toolset
Each group runs in its own sub-agent, 8 at a time by default. Bigger changes get an optional plan call, then a tool-use loop with code_search, file_read_diff, file_find, file_read, code_comment and task_done. The effort preset sets the review rounds: low is 1, medium (default) is 2, high is 3.
Step 4 — Positioning and reflection
Comments are matched back to the diff with a sliding-window line resolver, with a re-location fallback. A final filter pass drops comments it can show are incorrect. Output is text or a single JSON object, and every run is saved as a local JSONL session you can replay with ocr viewer.
Failure isolation is by design
If one sub-agent fails the run still exits 0 as long as something succeeded; only a fully failed run exits non-zero. In JSON mode, read the warnings array before you trust a clean result.
4. What the Benchmark Says (and Doesn’t)
The README publishes a chart on AACR-Bench: 50 open-source repositories, 200 real pull requests, 10 languages and 1,505 annotated issues, cross-validated by 80+ senior engineers according to the project. The benchmark comes from the same Alibaba organization that built the tool, so read it as a vendor result. These are the two same-model pairs I read from the chart image on 2026-10-14 (OCR v1.3.1 vs. Claude Code v2.1.169):
Self-reported results (README chart)
- Claude-4.6-Opus + OCR: F1 25.10% · precision 33.90% (301/889) · recall 20.00% · 1m23s · 385K tokens
- Claude-4.6-Opus + Claude Code: F1 11.57% · precision 7.23% (435/5,980) · recall 28.90% · 13m6s · 5,664K tokens
- Claude-4.8-Opus + OCR: F1 17.90% · precision 37.80% (176/465) · recall 11.70% · 1m6s · 352K tokens
- Claude-4.8-Opus + Claude Code: F1 14.13% · precision 15.93% (191/1,200) · recall 12.70% · 5m38s · 2,062K tokens
What holds up: in those two pairs precision is 2.4x to 4.7x higher and token use 5.9x to 14.7x lower, and OCR reports far fewer comments (889 against 5,980 in the first pair), which is what “less noise” means in practice. What does not: recall is not better, and in absolute terms every row of the chart finds a minority of the annotated issues (OCR’s best is 20.00%). The chart also uses OCR v1.3.1 while the current release is v1.13.0, and the README text gives no repeat-run variance.
Run your own eval
Benchmarks compare tools in general; only your PRs tell you whether it catches your bugs. Take 20 merged PRs where a defect later shipped, replay each with ocr review --commit <sha>, and count what it finds before you wire it into CI.
5. Quickstart: Your First Review
Prerequisites per the docs: Git 2.41+ and Node.js 18+. The commands below are copied from the README and the quickstart doc, verified against the README on 2026-10-14. I did not execute the installer or any of these commands for this post.
Install (npm)
npm install -g @alibaba-group/open-code-review ocr version
Other install paths exist (Homebrew, a curl install script, release binaries, building from source) and are listed in the installation doc. One detail worth knowing: the npm wrapper checks for new versions in the background and upgrades itself by default, and setting OCR_NO_UPDATE to any non-empty value turns that off.
Configure a model and test it
ocr config provider # Select a built-in provider or add a custom one ocr config model # Pick a model for the active provider ocr llm test
The interactive UI walks you through provider, API key and model, then tests connectivity on its own. Delegation mode (section 9) skips this step entirely.
Review modes
cd your-project # Workspace mode — review all staged, unstaged, and untracked changes ocr review # Branch range — reviews feature-branch's changes since it diverged from main (merge-base mode) ocr review --from main --to feature-branch # Single commit ocr review --commit abc123
Preview what would be reviewed before you spend tokens, and write machine-readable output for scripts:
Preview, JSON output and full-file scan
# What would be reviewed, and why files were kept or dropped (no LLM cost) ocr review --preview # Save results to a file ocr review --format json --output result.json # Full-file scan of a directory instead of a diff ocr scan --path internal/agent
Preview first
ocr review --preview is the cheapest debugging tool: it lists every candidate file and the reason it was kept or dropped (for example user_exclude, unsupported_ext or default_path) with zero LLM cost.
6. Providers and Rules
OCR speaks the Anthropic, OpenAI-compatible and OpenAI Responses protocols, plus AWS Bedrock. The configuration doc lists built-in presets, so most of the time you pick one and paste a key:
- Major APIs: anthropic, openai, openai-responses, openrouter, gemini, xai
- Cloud: bedrock (AWS credential chain, region and profile)
- Sign-in: chatgpt (Sign in with ChatGPT, marked preview in the docs)
- Regional vendors: dashscope, volcengine, deepseek, kimi, z-ai, minimax, baidu-qianfan and more
- Custom: any other name: you supply url and protocol (LiteLLM gateways, local models)
Non-interactive setup with a key fetched from a secret manager
ocr config set provider anthropic ocr config set model claude-opus-4-6 ocr config set providers.anthropic.api_key_cmd "op read op://dev/anthropic/api-key"
Anything not in the preset list is a custom provider, which is how you point OCR at an internal gateway or a local model. This is the docs’ Ollama example:
Custom provider: local Ollama
ocr config set provider ollama ocr config set custom_providers.ollama.url http://127.0.0.1:11434/v1 ocr config set custom_providers.ollama.protocol openai ocr config set custom_providers.ollama.model qwen3:32b ocr config set custom_providers.ollama.api_key ollama
Local models need native tool calling
OCR drives the whole review through tool calls. The FAQ says a model that only narrates tool calls in text (deepseek-r1 is its example) can never work, while models with native tool support such as qwen3 do. Use the FAQ’s curl check before you blame your config.
Rules are where you encode your team’s standards. They are JSON, layered and matched per file by glob; the first matching entry wins. By default a matching entry replaces the built-in language rule for that file, so set merge_system_rule when you want to add to it:
~/.opencodereview/rule.json or <repo>/.opencodereview/rule.json
{
"rules": [
{
"path": "**/*",
"rule": "Security review: flag hardcoded secrets, unvalidated redirects, and missing authz checks.",
"merge_system_rule": true
}
]
}The embedded rules cover Java, Go, TypeScript and JavaScript, Rust, Python, Solidity, Vyper, Terraform, GitHub workflows and more. When a rule never fires, this command prints the layer and pattern that won:
Debug which rule wins
ocr rules check src/main/java/com/example/UserService.java
7. Where It Fits in CI
The repo ships CI examples for GitHub Actions, GitLab CI, Bitbucket Pipelines, GitFlic CI and Gerrit. The GitHub path is a reusable action: it installs OCR, computes the merge base, runs ocr review --from <merge-base> --to <head> --format json, and posts inline comments plus a summary on the PR. Permissions are contents: read and pull-requests: write. The core step from the example README:
GitHub Actions step (example README)
- uses: alibaba/open-code-review@main
with:
llm_url: ${{ secrets.OCR_LLM_URL }}
llm_auth_token: ${{ secrets.OCR_LLM_AUTH_TOKEN }}
llm_model: ${{ vars.OCR_LLM_MODEL }}
llm_use_anthropic: ${{ vars.OCR_LLM_USE_ANTHROPIC }}The example expects OCR_LLM_URL and OCR_LLM_AUTH_TOKEN as secrets, and OCR_LLM_MODEL and OCR_LLM_USE_ANTHROPIC as variables. Three things I would change before copying it:
1. Pin it
The example uses @main and installs the CLI at run time (ocr_version defaults to latest), so pinning only the action does not freeze behavior. The example README recommends pinning the full commit SHA and ocr_version together.
2. Cap the cost
effort (low, medium or high) and max_tokens_budget are action inputs. The budget is checked before every LLM round, and partial results are still published. The values below are mine; the input names come from the docs.
3. Keep it advisory
A partially failed review still exits 0 and model output varies between runs, so use it to comment, not to block merges. Gate merges on your tests and linters.
Pinned action and CLI version
- uses: alibaba/open-code-review@<full-commit-sha> # vX.Y.Z
with:
ocr_version: 'X.Y.Z'
llm_url: ${{ secrets.OCR_LLM_URL }}
llm_auth_token: ${{ secrets.OCR_LLM_AUTH_TOKEN }}
llm_model: ${{ vars.OCR_LLM_MODEL }}
llm_use_anthropic: ${{ vars.OCR_LLM_USE_ANTHROPIC }}Cost guardrails
- uses: alibaba/open-code-review@<full-commit-sha> # vX.Y.Z
with:
ocr_version: 'X.Y.Z'
effort: low
max_tokens_budget: '2000000'Read the pull_request_target threat model
The example triggers on pull_request_target so secrets are available for fork PRs, and argues that is safe because the action only reads the diff. On-demand re-reviews are gated to MEMBER, OWNER and COLLABORATOR comments so strangers cannot burn your LLM quota. Review that model yourself before enabling it on a public repo.
8. Privacy: What Actually Leaves Your Machine
Sending code to a third-party model is the real adoption question. This is what the FAQ and docs state:
- Sent to your LLM endpoint: diffs plus snippets the agent reads with its tools. The agent can read full files, so assume more than the raw diff can leave.
- Stays local: session JSONLs under ~/.opencodereview/sessions, rule files and config. The sessions contain prompts and responses, so they hold your code; delete the folder to wipe them.
- Excluded by default: .env files (not the .env.example templates), SSH keys, .npmrc, .pypirc, .netrc and similar secret paths are never reviewed.
- Not built in: secret redaction. The FAQ lists it as roadmap; until then keep secrets out of diffs and exclude sensitive files.
- Telemetry: off by default; when enabled, the docs say prompt and response content is never exported.
- API keys: prefer api_key_cmd with a secret manager or the OS keyring over a static key in config.json.
For regulated code the config doc gives you levers: Bedrock through the AWS credential chain, a LiteLLM gateway inside your VPC via providers.<name>.url, or a local Ollama model. Some presets point at hosts in cn-beijing (volcengine, dashscope-tokenplan), so check data residency before choosing one.
9. Where It Shines: Use Cases
OCR earns its keep where you want consistent, low-noise review comments on every change:
PR bot on GitHub or GitLab
Automatic inline comments on every PR, plus on-demand re-review by commenting /open-code-review, restricted to collaborators.
Pre-push self review
Run ocr review in workspace mode before you open the PR; it covers staged, unstaged and untracked files.
Auditing an inherited codebase
ocr scan --path <dir> reviews whole files when there is no meaningful diff, for example a repo you just took over.
Team standards as committed rules
Keep .opencodereview/rule.json in the repo with your conventions (transaction handling, SQL binding, authz checks) so every review applies them.
Contracts and infrastructure
Built-in rules include Solidity, Vyper, Rust, Go and Terraform. Test files and lib/**/*.sol are excluded by default, so add include patterns where you want them reviewed.
Reuse your coding-agent subscription
Delegation mode: ocr delegate preview and ocr delegate rule hand file selection and rules to your agent (Claude Code, Codex, Cursor), which reviews with its own model. No OCR API key needed.
The common thread: the pipeline makes the boring parts (what to review, which rules, where to comment) repeatable, and the model is spent only on judgment.
10. When NOT to Use It
I like the engineering, but this is a precision tool, not a safety net. Skip it when:
❌ Skip it when
- • You need maximum recall on security-critical changes. The project admits lower recall than general agents, and the best row in its own chart finds 20% of the annotated issues.
- • Code cannot reach any external endpoint and you have no self-hosted model with native tool calling.
- • You want a merge gate. Partial failures exit 0 and LLM output varies between runs.
- • Your repo is not on Git. The FAQ says other VCS are not supported.
- • Your risk lives in tests or generated code. Tests, snapshots, vendor and generated files are excluded unless you include them.
- • You need frozen behavior. The npm CLI auto-updates by default, the example action tracks @main, and releases land every few days.
✅ Use it when
- • You want fewer, higher-precision comments than a general agent produces.
- • You need predictable token cost per PR (effort presets plus a token budget).
- • You want team rules as committed config instead of prompts.
- • You can pilot it on past PRs and measure before gating anything.
- • You are fine with Apache-2.0 and a fast-moving CLI pinned to a version.
Golden rule
Use OCR as the precise first pass and keep a human, or a higher-recall agent, for the changes that matter most. Precision tools lower the noise; they do not replace review.
Conclusion
Open Code Review is a credible answer to a real problem: agent reviewers that skip files, drift off the right line and cost a fortune in tokens. Putting file selection, rule matching and comment positioning in code is the right instinct, and the docs are unusually candid about the cost: lower recall, no built-in redaction, failures that exit 0.
My advice is simple. Install it, run ocr review --preview on a real branch, replay a few merged PRs, and decide from your own numbers. If it finds the bugs you care about, pin the version and put it in CI as an advisory reviewer.
Sources
- Repository, README and benchmark chart — github.com/alibaba/open-code-review
- Release notes v1.13.0 (2026-10-13) — GitHub Releases
- Configuration doc: providers, api_key_cmd, timeouts — project docs
- Architecture doc: pipeline, grouping, rounds — project docs
- FAQ: privacy, exit codes, local models — project docs
- Review rules doc: rule.json, filters, built-in rules — project docs
- GitHub Actions example — examples/github_actions
- AACR-Bench paper — arxiv.org/abs/2601.19494
- AACR-Bench dataset — huggingface.co



