
Open Code Review
CLI阿里开源的 AI 代码评审命令行 ocr:先用确定性流程筛选文件、分组并匹配规则,再由 agent 读取上下文生成行级评审意见,也可用 ocr scan 全量扫描目录。需配置大模型接口,或用委托模式交给当前 coding agent 执行。
English | 简体中文 | 日本語 | 한국어 | Русский | Türkçe | Français | Tiếng Việt
What is Open Code Review?
Open Code Review is an AI-powered code review CLI tool. It originated as Alibaba Group's internal official AI code review assistant — over the past two years, it has served tens of thousands of developers and identified millions of code defects. After thorough validation at massive scale, we incubated it into an open source project for the community. Simply configure a model endpoint to get started.
It reads Git diffs, sends changed files to a configurable LLM via an agent with tool-use capabilities, and generates structured review comments with line-level precision. The agent can read full file contents, search the codebase, inspect other changed files for context, and produce deep reviews — not just surface-level diff feedback. Beyond diff review, ocr scan reviews entire files for auditing unfamiliar codebases or directories that have no meaningful diff.
Visit the official website for more details.

Benchmark
Compared to general-purpose agents (Claude Code), Open Code Review achieves significantly higher Precision and F1 with the same underlying model, while consuming only ~1/9 of the tokens and completing reviews faster. Note that its Recall is lower than general-purpose agents — a deliberate trade-off favoring precision over noise.
A real-world code review benchmark built from 50 popular open-source repositories, 200 real Pull Requests, and 10 programming languages — cross-validated by 80+ senior engineers (1,505 annotated ground-truth issues).
Explore the AACR-Bench dataset on Hugging Face.
| Metric | What it measures | Why it matters |
|---|---|---|
| F1 | Harmonic mean of precision and recall | Best single number for overall review quality |
| Precision | Proportion of reported issues that are real defects | Higher = fewer false alarms to triage |
| Recall | Proportion of real defects that are found | Higher = fewer issues slip through review |
| Avg Time | Wall-clock time per review | Matters for CI pipeline latency |
| Avg Token | Total tokens consumed per review | Directly impacts API cost |

Why Open Code Review?
The Problem with General-Purpose Agents
If you've used general-purpose agents like Claude Code with Skills for code review, you've likely encountered these pain points:
- Incomplete coverage — On larger changesets, agents tend to "cut corners," selectively reviewing only some files and missing others.
- Position drift — Reported issues frequently don't match the actual code location, with line numbers or file references drifting off target.
- Unstable quality — Natural-language-driven Skills are hard to debug, and review quality fluctuates significantly with minor prompt variations.
The root cause: a purely language-driven architecture lacks hard constraints on the review process.
Core Design: Deterministic Engineering × Agent Hybrid
Open Code Review's core philosophy is to combine deterministic engineering with an agent, each handling what it does best.
Deterministic Engineering — Hard Constraints
For review steps that must not go wrong, engineering logic — not the language model — guarantees correctness:
- Precise file selection — Determines exactly which files need review and which should be filtered, ensuring no important change is missed.
- Smart file bundling — Groups related files into a single review unit (e.g.,
message_en.propertiesandmessage_zh.propertiesare bundled together). Each bundle runs as a sub-agent with isolated context — a divide-and-conquer strategy that stays stable on very large changesets and naturally supports concurrent review. - Fine-grained rule matching — Matches review rules to each file's characteristics, keeping the model's attention sharply focused and eliminating information noise at the source. Compared to purely language-driven rule guidance, template-engine-based rule matching is more stable and predictable.
- External positioning and reflection modules — Independent comment-positioning and comment-reflection modules systematically improve both the location accuracy and content accuracy of AI feedback.
Agent — Dynamic Decision-Making
The agent's strengths are concentrated where they matter most — dynamic decisions and dynamic context retrieval:
- Scenario-tuned prompts — Prompt templates deeply optimized for code review, improving effectiveness while reducing token consumption.
- Scenario-tuned toolset — Distilled from deep analysis of tool-call traces in large-scale production data — including call frequency distributions, per-tool repetition rates, and the impact of new tools on the overall call chain — resulting in a purpose-built toolset that is more stable and predictable for code review than a generic agent toolkit.
How to Use
Prerequisites
- Operating system: Windows, macOS, or Linux.
- Git >= 2.41 — Open Code Review relies on Git for diff generation, code search, and repository operations.
Agent Skills
Use the skills in Claude Code, Codex, Cursor, Kimi Code, or another agent that supports Agent Skills and can run local commands. Both modes require Git >= 2.41 and the ocr CLI; only native mode requires an OCR model provider.
1. Install the Skills
Run in the project you want to review, then select the skills you need and your agent in the installer:
npx skills add alibaba/open-code-review
The skills guide your agent to install ocr if it is missing, subject to your environment's permissions. You can also install it ahead of time with npm install -g @alibaba-group/open-code-review. Prefer a plugin or manual installation? See the agent-specific setup guide, or copy the desired folders from skills/ into your agent's skill directory.
2. Choose a Review Mode
| Native mode | Delegation mode | |
|---|---|---|
| Skill | open-code-review | open-code-review-delegate |
| Who reviews? | OCR's specialized review agent and pipeline | Your current coding agent, following OCR's review pipeline and guardrails |
| Model and authentication | OCR's own provider configuration | Your host agent's existing model and authentication |
| Choose it when | You have a model endpoint for OCR and want its full review pipeline | You have no separate API key, or want to use your existing agent subscription/setup |
No separate key? Start with delegation mode. It skips OCR provider setup, not the host agent's own authentication, usage limits, or costs. A host-agent subscription is not automatically an API credential for native mode. In delegation mode, OCR's CLI and skill together provide the review pipeline and guardrails: file selection, rule resolution, coverage requirements, and structured reporting. The host agent performs analysis, positioning, and reporting within that workflow; it does not run OCR's full native pipeline.
For native mode, configure a provider once with ocr config provider and ocr config model. Authentication depends on the provider; see Configuration.
CLI
Install
npm install -g @alibaba-group/open-code-review
After installation, the ocr command is available globally.
For other installation methods (install script, GitHub Release binary, from source), see Installation.
Quick Start
1. Configure LLM
You must configure an LLM before reviewing code, unless you use Delegation Mode.
- OCR calls the model:
ocr review, the/open-code-review:reviewcommand, and theopen-code-reviewskill use OCR's own provider configuration, not your Claude Code Team/Pro subscription login. Authentication requirements depend on the provider; see Configuration. - The host agent calls the model: the
/open-code-review:delegate-reviewcommand and theopen-code-review-delegateskill use the host agent's configured model and authentication. No separate LLM configuration or credentials are needed in OCR. See the Claude Code install steps.
ocr config provider # Select a built-in provider or add a custom one
ocr config model # Pick a model for the active provider

The interactive UI guides you through provider selection, API key entry, and model configuration, then automatically tests connectivity.
For CLI setup, environment variables, custom providers, and other advanced configuration, see Configuration.
2. Review
cd your-project
# Workspace mode — review all staged, unstaged, and untracked changes
ocr review
# Current branch — review changes since it diverged from main (--to defaults to HEAD)
ocr review --from main
# 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
# Resume an interrupted range or commit review
ocr session list
ocr review --from main --to feature-branch --resume <session-id>
# Full-file scan — review whole files instead of a diff (no git history needed)
ocr scan # scan the entire repository
ocr scan --path internal/agent # scan a directory or specific files
ocr scan --resume <session-id> # resume an interrupted full-file scan
# Save results to a file (recommended for AI host agents)
ocr review --format json --output result.json
# Delegation mode — let your AI coding agent perform the review itself
# OCR handles file selection and rule resolution; no LLM configuration needed
ocr delegate preview
ocr delegate rule src/main.go src/handler.go
Documentation
Full documentation lives at open-codereview.ai/docs:
- Quickstart — install and run your first review
- Installation — all platforms and package managers
- CLI Reference — every command and flag
- Review Rules — customize review rules with path filtering and targeting
- Configuration — config keys and environment variables
- MCP Server — extend the review agent with external tools
- Coding Agent Integrations — choose the platform you use
- Claude Code — install a plugin with review slash commands
- Codex — install a plugin with callable review skills
- Cursor — install a plugin with portable review skills
- Kimi Code — install a plugin with review slash commands and skills
- OpenCode — install native review tools and slash commands
- QCA Forward — run delegation mode with the QCA host model and a ready-to-publish template
- Skill-compatible agents — install the portable agent skill
- Review Execution Modes — after integration, choose which LLM performs the review
- Default (OCR-managed) — OCR runs the review using its configured LLM
- Delegation Mode — your coding agent runs the review using its own LLM; no OCR API key required
- CI/CD Integration — GitHub Actions, GitLab CI, GitFlic CI, and Gerrit integration
- Session Viewer — browse and replay review sessions in browser, mark comments as fixed or ignored and hide them while you work through the findings
- Telemetry — OpenTelemetry integration for observability
- FAQ — common questions and troubleshooting
Contributing
This project exists thanks to all the people who contribute. See CONTRIBUTING.md for development setup, coding guidelines, and how to submit pull requests.
License
Apache-2.0 — Copyright 2026 Alibaba
相关资源

Open Code Review
Plugin阿里巴巴开源的 AI 代码评审工具:读取 Git diff,把改动文件分组交给子代理并发评审,给出行级评审意见;插件提供评审与委托评审命令。需先安装 ocr CLI 并配置模型,委托模式可不配 API Key。
alibaba/open-code-review57.5k
Open Code Review
Skill驱动阿里开源的 ocr CLI 评审 Git 变更(工作区、单个提交或分支对比),按严重级别汇总逐行评审意见,用户要求时自动修复。需先配置 LLM 接口(Anthropic、OpenAI 等协议),缺少 CLI 时会自动安装。阿里巴巴官方维护。
alibaba/open-code-review57.5k
Qwen Code
CLI阿里通义千问团队开源的终端编码 Agent,支持子代理、自动记忆、技能与 MCP,可接入 Qwen、OpenAI、Anthropic、Gemini 等 API 或本地模型,另有 IDE 插件与无头模式(qwen -p)。
QwenLM/qwen-code31.1k
Ponytail
Skill让 agent 按「能不写就不写」的阶梯解题:先问是否需要,再依次复用现有代码、标准库、平台原生能力与已装依赖,只写最少的必要代码,但保留校验、错误处理、安全与无障碍。
DietrichGebert/ponytail202k
PR Review Toolkit
Plugin六个专项评审子代理,分别检查注释准确性、测试覆盖、静默失败、类型设计、代码规范与可简化之处,可单独调用或一次跑全。Anthropic 官方插件。
anthropics/claude-code158k
Code Review and Quality
Skill合并前从正确性、可读性、架构、安全与性能五个维度评审代码变更,适用于自己、其他 agent 或他人写的代码与 PR,按改善整体代码健康度的标准给出结论。Addy Osmani 的 agent-skills 合集之一。
addyosmani/agent-skills122k