OpenCodeReview
An AI-powered code review CLI that combines deterministic pipelines with LLM agents, battle-tested at Alibaba scale, delivering precise line-level comments.
Evidence shows: CLI tool requires user-configured LLM API keys, but least privilege principle is not explicitly stated; interactive config UI may provide user confirmation, but not clearly documented; data flow transparency is insufficient, no detailed explanation of how code and prompts are sent to LLM; sensitive data handling (e.g., API keys) is mentioned in security policy, but no implementation details; dependency security: CI includes govulncheck and CodeQL, but no vulnerability reports provided; external effects: tool calls external LLM APIs, but data exfiltration scope not specified; rollback: session resume feature exists, but no rollback mechanism described; source attribution: publisher unverified, but code has copyright notice. Deductions: least privilege, user confirmation, data flow transparency, sensitive data handling, external effects, rollback, and source attribution lack concrete implementation evidence, only partial mentions.
Evidence shows: README and docs are consistent; CI includes tests and coverage checks, but no test results provided; dependency availability: go.mod and package.json exist, but no dependency locking or mirrors; failure messages: no error handling documentation. Deductions: self-consistency is supported by docs, but dependency availability and failure messages lack concrete evidence.
Evidence shows: README clearly targets developers, supports multiple platforms and agents; capability boundaries documented, e.g., diff and scan modes; trigger precision: rule matching and file selection mechanisms; environment fit: supports multiple OS and CI integrations. Deductions: capability boundaries and trigger precision are documented, but no specific configuration examples provided.
Evidence shows: information architecture clear, with doc links; install notes detailed, multiple installation methods; naming stability: CLI command names consistent, but version in package.json is 0.0.0; examples and FAQ documented; known limitations mentioned in README (e.g., lower recall); license Apache-2.0; versioning changelog not provided; maintenance responsibility: contribution guide and security policy exist. Deductions: naming stability deducted due to unupdated version, versioning changelog missing.
Evidence shows: output usability: generates line-level comments, structured format; marginal value: benchmark against generic agents; cost benefit: claims low token consumption, but no specific data. Deductions: cost benefit lacks concrete data support.
Evidence shows: README has benchmark claims, but no raw data; cross-source corroboration: OpenSSF badge, but no specific report; fact-inference separation: docs distinguish design trade-offs, but not explicitly labeled. Deductions: claim traceability insufficient, cross-source corroboration lacks concrete evidence.
- Publisher identity unverified; be cautious about supply chain risks.
- Handling of sensitive information like API keys is not explicit in source; check config storage.
- Data flow transparency insufficient; process of sending code and prompts to LLM not detailed.
- Version in package.json is 0.0.0, which may affect dependency resolution.
- Benchmark claims lack raw data; independent verification needed.
What does this agent do, and when should you use it?
OpenCodeReview (OCR) is an AI-powered code review CLI tool open-sourced by Alibaba Group, originally the internal official AI code review assistant that served tens of thousands of developers and identified millions of defects. It uses a hybrid architecture: deterministic engineering handles file selection, bundling, rule matching, and comment positioning for hard correctness; an LLM agent handles dynamic decisions, reading full files and searching the codebase for deep context. It reads Git diffs and produces structured comments with line-level precision, supporting multi-language rulesets for NPE, thread-safety, XSS, and SQL injection. The CLI offers commands like `ocr review` and `ocr scan`, with session resume and delegation mode. It integrates with coding agents like Claude Code, Codex, and Cursor via plugins, and supports CI/CD platforms. Licensed under Apache-2.0, with documentation in English, Simplified Chinese, Japanese, Korean, and Russian.
OpenCodeReview reads Git diffs to generate review comments. The deterministic layer selects which files to review, filters irrelevant ones, and bundles related files (e.g., grouping message_en.properties with message_zh.properties). It matches review rules to each file's characteristics using a template engine, and uses external positioning and reflection modules to improve comment accuracy. The LLM agent, configured via ocr config provider and ocr config model, reads full file content, searches the repository for context, and generates line-specific comments. Commands include: ocr review for workspace, branch ranges (--from main --to feature-branch), or single commits (--commit abc123); ocr scan for full-file scans of directories or files; ocr session list and --resume to continue interrupted reviews; and ocr delegate for delegation mode where a coding agent performs the review using its own LLM. Output is structured review comments, with options for CI/CD integration.
- A developer reviewing a feature branch before merging:
ocr review --from main --to feature-branchprovides line-level comments on all changed files. - A CI pipeline automatically runs
ocr reviewon each pull request to catch defects early, integrating with GitHub Actions or GitLab CI. - A security auditor uses
ocr scan --path internal/agentto review entire unfamiliar codebases for vulnerabilities like SQL injection or XSS. - A team using Claude Code or Codex wants code review without managing a separate LLM API key, using
ocr delegateso the coding agent performs the review. - A developer working on a massive changeset relies on OCR's file bundling and concurrent sub-agents to maintain full coverage and stable performance.
- An organization wants to enforce custom review rules, configuring path-specific rules to focus the model's attention on critical files.
What are this agent's strengths and limitations?
- Deterministic + Agent hybrid ensures precise file selection and rule matching, improving review accuracy over pure language-driven agents.
- Proven at Alibaba scale: served tens of thousands of developers and found millions of defects, indicating production readiness.
- Higher precision and F1 than general-purpose agents (e.g., Claude Code) with the same underlying model, while consuming about 1/9 of the tokens and faster.
- Built-in multi-language ruleset covers common issues like NPE, thread-safety, XSS, and SQL injection, reducing false positives.
- Extensive integrations: plugins for Claude Code, Codex, Cursor, OpenCode, and CI/CD systems, plus MCP server support.
- Requires LLM configuration with API key for default mode, adding cost and setup complexity.
- CLI-only interface may be less accessible for non-developers; requires Git >= 2.41.
- Network dependency for API calls; latency and availability depend on the model provider.
- Recall is lower than general-purpose agents by design, potentially missing some issues that need human review.
- Advanced configuration (custom providers, environment variables) has a learning curve, as documented in the official configuration docs.
How do you install or deploy this agent?
Install globally via npm: npm install -g @alibaba-group/open-code-review. The ocr command becomes available. Alternative methods include install script, GitHub Release binary, or from source, as documented in the official installation guide.
How do you use this agent?
- Configure an LLM: run
ocr config providerto select a provider (OpenAI/Anthropic compatible) or add custom, thenocr config modelto choose a model. The interactive UI guides through API key entry and connectivity test. 2. Review code: navigate to project and runocr reviewto review all changes, or specify a branch rangeocr review --from main --to feature-branch, or a commit--commit abc123. 3. Full-file scan:ocr scan --path internalscans a directory. 4. Delegation mode:ocr delegate previewto preview, no LLM needed. To resume an interrupted review, useocr session listand--resume <session-id>.
FAQ
What are the prerequisites for using OpenCodeReview?
How does OCR save tokens compared to general agents?
Can I customize the review rules?
Is OpenCodeReview suitable for large codebases?
What is delegation mode and when should I use it?
ocr delegate) lets your coding agent (e.g., Claude Code) perform the review using its own LLM, so you don't need to configure a separate LLM for OCR. It's useful when you already use a coding agent and want to reduce setup.