Alibaba Open Code Review (OCR) is an open-source, AI-driven code review tool released by Alibaba under the Apache-2.0 license. Battle-tested internally for over two years by tens of thousands of Alibaba engineers, it is designed to find code defects with high precision and extreme token efficiency compared to general-purpose AI coding agents.

Key Features & Architecture

  • Deterministic + Agent Review: Decouples rule-driven file selection, line positioning, and scheduling from LLM-based risk analysis to optimize quality, token cost, and speed.
  • Privacy: Connect any LLM, keep code and review context fully private, and retain control over where inference runs.
  • Precise Comment Positioning: Uses a 3-tier progressive strategy to place findings at exact line numbers and a reflection step to reduce hallucinations and drift.
  • Multi-Model Protocol Support: Works with Anthropic Messages, OpenAI Chat Completions, and OpenAI Responses APIs, plus preset providers like Anthropic, OpenAI, DashScope, DeepSeek, and Z.AI.
  • Effort-Driven Progressive Review: Lets teams choose low, medium, or high review depth depending on risk, with deeper passes only when the added signal is worth the cost.
  • Smart Memory Compression: Uses tiered context partitioning to keep review memory compact enough for deep, large-scale code analysis.
  • Built-in Review Rules: Covers 40+ languages and file types with checks for NPEs, thread safety, XSS, SQL injection, and more.
  • High Precision, Low Noise: Prioritizes precision over broad recall; Alibaba’s benchmarks reported 33.9% precision versus 7.23% for Claude Code on the same model.
  • Token Efficiency: Groups related files into isolated sub-agent review units, using roughly one-ninth the tokens of general-purpose agents.
  • LLM-Agnostic and Private: Supports Anthropic Claude, OpenAI, and compatible endpoints, including local models for private deployments.

Quick Start Guide

1. Installation

You can install the global CLI via npm (requires Git 2.41 or newer):

npm install -g @alibaba-group/open-code-review

2. Configuration

Configure your preferred LLM provider and model interactively:

ocr config provider
ocr config model

Alternatively, you can use Delegation Mode to route the review through an existing coding agent like Claude Code, Cursor, or Codex without needing a standalone LLM API key.

3. Common Commands

Run the tool inside your Git repository to output line-level findings and suggested fixes:

CommandAction
ocr reviewWorkspace mode: Reviews all staged, unstaged, and untracked changes.
ocr review --from main --to feature-branchBranch comparison: Reviews changes since diverging from main.
ocr review --commit <commit_id>Single commit: Reviews a single commit against its parent.
ocr scanFull-file scan: Scans the entire repository without needing Git history.

For advanced setups, the tool natively hooks into CI/CD environments like GitHub Actions and GitLab CI, and includes a Session Viewer to browse and replay review sessions directly in your browser.

You can find the source code and full documentation on the Alibaba Open Code Review GitHub Repository.

“Human code review as we know it is dead, AI does few passes of the code, the human is for governance, security, constraints and ownership.”-Rushi

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>