Tool

Review Code Changes with AI-Powered Line-Level Feedback

An AI code review CLI, from Alibaba's internal reviewer, tuned for precision over general-purpose coding agents.

Works with gitgithubnpmanthropicclaude

88
Spark score
out of 100
Updated 28 days ago
Source checked Oct 12, 2026
Version 1.12.13

Add to Favorites

Why it matters

Automatically review Git diffs and pull requests with an AI agent that provides structured, line-level code feedback by reading full file contents, searching the codebase for context, and applying fine-grained review rules to catch defects before they ship.

Outcomes

What it gets done

01

Analyze staged, unstaged, or branch-range Git diffs to identify files requiring review

02

Bundle related files together and run parallel sub-agent reviews with isolated context

03

Generate precise, line-level code comments using LLM tool-calling with codebase search

04

Position and reflect on review comments to ensure location accuracy and content quality

Source

Get it from source

A command-line tool. Install it with its own package manager. Spark does not host a copy of it.

Open source
  1. 1

    Install the CLI globally. (README)

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

    Configure an LLM provider and model (interactive). (README)

    ocr config provider ocr config model

Check that it works:

cd your-project ocr review

Requires: Git >= 2.41, Node.js with npm, An LLM provider API key, unless you use Delegation Mode

Reports

Agent outcome reports

No reports yet

Overview

An AI code review CLI from Alibaba that combines deterministic engineering (file selection, bundling, rule matching) with an agent for dynamic review decisions, tuned for precision over recall versus general-purpose coding agents. Reach for it when you want low-false-positive automated code review, standalone or via a plugin/CI step; skip it if maximum recall matters more than precision.

What it does

Open Code Review (ocr) is an AI-powered code review CLI tool that originated as Alibaba Group's internal AI code review assistant - over two years it served tens of thousands of developers and identified millions of code defects before being incubated into an open source project. It reads Git diffs, sends changed files to a configurable LLM through 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, and inspect other changed files for context rather than reviewing the raw diff in isolation. Beyond diff review, ocr scan reviews entire files for auditing unfamiliar codebases or directories with no meaningful diff.

Its own benchmark - built from 50 popular open-source repositories, 200 real pull requests, and 10 programming languages, cross-validated by 80+ senior engineers into 1,505 annotated ground-truth issues - reports significantly higher Precision and F1 than general-purpose agents like Claude Code on the same underlying model, while consuming only about 1/9 of the tokens and completing reviews faster. Recall is explicitly lower than general-purpose agents - a deliberate trade-off favoring precision over noise.

The project attributes general-purpose agents' weaknesses on code review to a purely language-driven architecture with no hard constraints on the review process: incomplete coverage on large changesets, review comments whose line numbers or file references drift from the actual location, and quality that fluctuates with minor prompt changes. Its answer is a deterministic-engineering-plus-agent hybrid: engineering logic (not the model) handles file selection, groups related files into a single review unit run as an isolated sub-agent for large changesets, matches review rules to each file's characteristics through a template engine, and runs independent comment-positioning and comment-reflection modules to improve location and content accuracy; the agent itself is reserved for scenario-tuned prompts and a toolset distilled from analyzing tool-call traces in production data.

When to use - and when NOT to

Use it when you want automated code review tuned for precision - fewer false alarms to triage, at the cost of catching somewhat fewer issues overall - either as a standalone CLI, a plugin inside an existing coding agent, or a CI/CD step.

Do not reach for it when you specifically need maximum recall (catching every possible issue, false positives included) over precision - the project states this trade-off explicitly - or when you want a general-purpose agent's open-ended natural-language review rather than a rule-and-template-driven one.

Inputs and outputs

Prerequisite is Git >= 2.41, since the tool relies on Git for diff generation, code search, and repository operations. Install globally via npm:

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

After installing, configure a provider and model (ocr config provider, ocr config model - an interactive UI walks through provider selection, API key entry, and connectivity testing), unless using Delegation Mode. Input is then a Git diff or a set of files: ocr review covers all staged, unstaged, and untracked changes; ocr review --from main --to feature-branch reviews a branch's changes since it diverged from main; ocr review --commit <sha> reviews a single commit; and ocr scan (optionally --path) reviews whole files instead of a diff. Interrupted range, commit, or scan reviews can be resumed via ocr session list and a --resume <session-id> flag. Output is structured, line-level review comments, which can be written to a file with --format json --output result.json - the format the docs recommend for AI host agents.

Integrations

It has integration plugins for Claude Code and Kimi Code (slash commands), Codex and Cursor (callable/portable review skills), OpenCode (native review tools and slash commands), and a generic portable agent skill for other skill-compatible agents. A Delegation Mode lets your own coding agent run the review with its own LLM instead of OCR's configured one, requiring no OCR API key (ocr delegate preview, ocr delegate rule <files>). It documents CI/CD integration for GitHub Actions, GitLab CI, GitFlic CI, and Gerrit, an MCP server for extending the review agent with external tools, a browser-based Session Viewer for replaying review sessions and marking comments fixed or ignored, and OpenTelemetry-based telemetry for observability. It is released under the Apache-2.0 license.

Who it's for

Engineering teams that want automated code review with a low false-positive rate - running it standalone, wired into an existing coding agent (Claude Code, Codex, Cursor, Kimi Code, OpenCode), or as a CI/CD gate - rather than relying on a general-purpose agent's unconstrained review. It runs on Windows, macOS, and Linux.

Source README

OpenCodeReview logo

OpenCodeReview

alibaba%2Fopen-code-review | Trendshiftalibaba%2Fopen-code-review | Trendshiftalibaba%2Fopen-code-review | TrendshiftnpmBuild statusLicenseAsk DeepWikiOpenSSF Best PracticesWindowsmacOSLinuxClaude CodeCodexCursorKimi Code


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.

Highlights

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).

Hugging Face 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

Benchmark

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.properties and message_zh.properties are 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
  • Git >= 2.41 - Open Code Review relies on Git for diff generation, code search, and repository operations.
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 config provider          # Select a built-in provider or add a custom one
ocr config model             # Pick a model for the active provider

Provider setup

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

# 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
  • 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

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.