open-code-review README

The project's README from github.com/alibaba/open-code-review. As one markdown file: README.md.

OpenCodeReview logo

OpenCodeReview

alibaba%2Fopen-code-review | Trendshift

alibaba%2Fopen-code-review | Trendshift alibaba%2Fopen-code-review | Trendshift

npm Build status License Ask DeepWiki OpenSSF Best Practices

Windows macOS Linux Claude Code Codex Cursor Kimi Code

English | 简体中文 | 日本語 | 한국어 | Русский


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:

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:

Agent — Dynamic Decision-Making

The agent's strengths are concentrated where they matter most — dynamic decisions and dynamic context retrieval:

How to Use

Prerequisites

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:

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 (alibaba/open-code-review)

Searching Database…

Что это такое?CLI-инструмент для ревью кода с помощью ИИ, созданный внутри Alibaba: он читает Git-диффы, отправляет изменённые файлы в настраиваемого LLM-агента и возвращает структурированные комментарии к ревью с точностью до строки.
Это отдельный CLI или что-то, что живёт внутри моего редактора?Отдельный CLI — после установки команда ocr доступна глобально. Есть также плагины для кодинг-агентов (Claude Code, Codex, Cursor, Kimi Code, OpenCode) и MCP-сервер для расширения агента ревью.
Что нужно сделать, чтобы запустить его?Установите его, затем запустите интерактивную настройку: она проведёт вас через выбор провайдера, ввод API-ключа и конфигурацию модели, а перед первым ревью автоматически проверит соединение.
Что должно быть на моей машине, чтобы всё работало?Требуется Git версии 2.41 или новее — ocr опирается на Git для генерации диффов, поиска по коду и операций с репозиторием — и перед ревью кода нужно настроить LLM-эндпоинт.
Найдёт ли он каждый дефект в моих изменениях?Нет — полнота проверки намеренно ниже, чем у агентов общего назначения, зато выше точность: меньше ложных срабатываний, которые нужно разбирать, выше F1 и примерно в 9 раз меньше токенов на одно ревью.
Работает ли он на всех основных операционных системах?Да — документация описывает установку на всех платформах и через все пакетные менеджеры, плюс есть бинарники из GitHub Release, так что Linux, macOS и Windows полностью покрыты.
Что происходит с моим кодом во время ревью?Изменённые файлы отправляются на LLM-эндпоинт, который вы настроили, — ocr читает Git-дифф, а агент изучает эти файлы через выбранную модель, так что именно ваш выбор провайдера определяет, куда уйдёт код.
Зачем сочетать детерминированные пайплайны с LLM-агентом?Ревью, полностью управляемые языковой моделью, часто халтурят на больших изменениях, уходят от реального места в коде и ведут себя нестабильно при правках промптов. Здесь инженерная логика жёстко фиксирует выбор файлов, сборку пакетов и сопоставление правил, а агент занимается динамическими решениями и получением контекста.
Может ли он ревьюить целые файлы, а не только диффы?Да — команда ocr scan ревьюит файлы целиком и предназначена для аудита незнакомых кодовых баз или каталогов, где нет осмысленного диффа.
Что такое режим делегирования (Delegation Mode)?Это режим выполнения, при котором ваш кодинг-агент запускает ревью со своей собственной LLM, поэтому ключ OCR API не нужен; по умолчанию OCR выполняет ревью с моделью, которую вы для него настроили.
Могут ли ревью запускаться автоматически в CI?Да — документация описывает интеграцию с GitHub Actions, GitLab CI, GitFlic CI и Gerrit, так что ревью может запускаться на каждый pull request.
Creator
alibaba
Size
54.6 MB
Stars
47.6K
Age
5mo
Commits · 90 Days