Repo Trending

alibaba/open-code-review

AI code review CLI from Alibaba that combines deterministic file selection and rule matching with an LLM agent to produce line-level review comments on Git diffs or whole files.

  • 56.1k GitHub stars
  • Go

Last verified: repo last pushed

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

What it is

Open Code Review (ocr) is an AI-powered code review CLI that began as Alibaba Group's internal code review assistant. 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 files, search the codebase and inspect other changed files for context. ocr scan additionally reviews entire files, for example in unfamiliar codebases with no meaningful diff.

Who it's for

  • Developers who want AI review of Git diffs, branch ranges or single commits from the command line
  • Teams concerned about token cost and false positives in AI code review
  • Users of coding agents (Claude Code, Codex, Cursor, Kimi Code, OpenCode) who want review integrated into their agent
  • Teams wiring automated review into CI/CD (GitHub Actions, GitLab CI, GitFlic CI, Gerrit)

Requirements

Requirements

  • Git >= 2.41
  • A configured LLM provider, model and API key (unless using Delegation Mode)
  • npm for the documented global install (other methods are covered in the Installation docs)

Setup

  1. Install the CLI

    Install globally via npm; the ocr command becomes available afterwards.

    bash
    npm install -g @alibaba-group/open-code-review
  2. Configure an LLM

    Use the interactive UI to pick a provider (built-in or custom) and a model. It guides you through API key entry and tests connectivity automatically. Not needed in Delegation Mode.

    bash
    ocr config provider          # Select a built-in provider or add a custom one
    ocr config model             # Pick a model for the active provider
  3. Run a review

    From inside your project, review all staged, unstaged and untracked changes.

    bash
    cd your-project
    ocr review

Examples

Review a branch range

bash
bash
ocr review --from main --to feature-branch

What it does: Reviews the changes in feature-branch since it diverged from main (merge-base mode).

Review a single commit

bash
bash
ocr review --commit abc123

What it does: Limits the review to one commit.

Resume an interrupted review

bash
bash
ocr session list
ocr review --from main --to feature-branch --resume <session-id>

What it does: Lists sessions, then resumes an interrupted range review by session ID.

Full-file scan

bash
bash
ocr scan                          # scan the entire repository
ocr scan --path internal/agent    # scan a directory or specific files

What it does: Reviews whole files instead of a diff; no git history is needed.

JSON output and delegation mode

bash
bash
ocr review --format json --output result.json

ocr delegate preview
ocr delegate rule src/main.go src/handler.go

What it does: The first command saves results to a file (recommended for AI host agents). The delegate commands let your AI coding agent do the review itself while OCR handles file selection and rule resolution, with no LLM configuration needed.

Pros & cons

Pros

  • Pro:Deterministic file selection, bundling and rule matching aim to avoid missed files and unstable review quality, with sub-agents per bundle for large changesets
  • Pro:README benchmark claims higher precision and F1 than Claude Code with the same model, at about 1/9 of the tokens
  • Pro:Supports workspace, branch range, single-commit and full-file scan reviews, with session resume
  • Pro:Delegation mode and plugins for several coding agents, plus documented CI/CD integrations

Cons

  • Con:Recall is lower than general-purpose agents, a deliberate precision-over-noise trade-off
  • Con:Requires Git >= 2.41 and an LLM configuration (except in Delegation Mode)
  • Con:Much of the detail (installation alternatives, CLI reference, rules, CI setup) lives on the external docs site rather than in the README

Images