The open supply AI code evaluation agent.
English | 简体中文
What’s Open Code Evaluate?
Open Code Evaluate is an AI-powered code evaluation CLI instrument. It originated as Alibaba Group’s inside official AI code evaluation assistant — over the previous two years, it has served tens of 1000’s of builders and recognized tens of millions of code defects. After thorough validation at large scale, we incubated it into an open supply venture for the group. Merely configure a mannequin endpoint to get began.
It reads Git diffs, sends modified information to a configurable LLM through an agent with tool-use capabilities, and generates structured evaluation feedback with line-level precision. The agent can learn full file contents, search the codebase, examine different modified information for context, and produce deep critiques — not simply surface-level diff suggestions.

The Downside with Basic-Goal Brokers
When you’ve used general-purpose brokers like Claude Code with Abilities for code evaluation, you’ve got seemingly encountered these ache factors:
Incomplete protection — On bigger changesets, brokers are inclined to “reduce corners,” selectively reviewing just some information and lacking others.
Place drift — Reported points steadily do not match the precise code location, with line numbers or file references drifting off track.
Unstable high quality — Pure-language-driven Abilities are arduous to debug, and evaluation high quality fluctuates considerably with minor immediate variations.
The basis trigger: a purely language-driven structure lacks arduous constraints on the evaluation course of.
Core Design: Deterministic Engineering × Agent Hybrid
Open Code Evaluate’s core philosophy is to mix deterministic engineering with an agent, every dealing with what it does finest.
Deterministic Engineering — Arduous Constraints
For evaluation steps that should not go fallacious, engineering logic — not the language mannequin — ensures correctness:
Exact file choice — Determines precisely which information want evaluation and which ought to be filtered, guaranteeing no essential change is missed.
Good file bundling — Teams associated information right into a single evaluation unit (e.g., message_en.properties and message_zh.properties are bundled collectively). Every bundle runs as a sub-agent with remoted context — a divide-and-conquer technique that stays steady on very massive changesets and naturally helps concurrent evaluation.
Nice-grained rule matching — Matches evaluation guidelines to every file’s traits, maintaining the mannequin’s consideration sharply targeted and eliminating info noise on the supply. In comparison with purely language-driven rule steering, template-engine-based rule matching is extra steady and predictable.
Exterior positioning and reflection modules — Unbiased comment-positioning and comment-reflection modules systematically enhance each the placement accuracy and content material accuracy of AI suggestions.
Agent — Dynamic Resolution-Making
The agent’s strengths are concentrated the place they matter most — dynamic choices and dynamic context retrieval:
Situation-tuned prompts — Immediate templates deeply optimized for code evaluation, enhancing effectiveness whereas lowering token consumption.
Situation-tuned toolset — Distilled from deep evaluation of tool-call traces in large-scale manufacturing information — together with name frequency distributions, per-tool repetition charges, and the influence of recent instruments on the general name chain — leading to a purpose-built toolset that’s extra steady and predictable for code evaluation than a generic agent toolkit.
By way of NPM (Beneficial)
After set up, the ocr command is accessible globally.
From GitHub Launch
Obtain the newest binary from GitHub Releases:
curl -Lo ocr https://github.com/alibaba/open-code-review/releases/newest/obtain/opencodereview-darwin-arm64
chmod +x ocr && sudo mv ocr /usr/native/bin/ocr
# macOS (Intel)
curl -Lo ocr https://github.com/alibaba/open-code-review/releases/newest/obtain/opencodereview-darwin-amd64
chmod +x ocr && sudo mv ocr /usr/native/bin/ocr
# Linux (x86_64)
curl -Lo ocr https://github.com/alibaba/open-code-review/releases/newest/obtain/opencodereview-linux-amd64
chmod +x ocr && sudo mv ocr /usr/native/bin/ocr
# Linux (ARM64)
curl -Lo ocr https://github.com/alibaba/open-code-review/releases/newest/obtain/opencodereview-linux-arm64
chmod +x ocr && sudo mv ocr /usr/native/bin/ocr
# Home windows (x86_64) — transfer ocr.exe to a listing in your PATH
curl -Lo ocr.exe https://github.com/alibaba/open-code-review/releases/newest/obtain/opencodereview-windows-amd64.exe
# Home windows (ARM64) — transfer ocr.exe to a listing in your PATH
curl -Lo ocr.exe https://github.com/alibaba/open-code-review/releases/newest/obtain/opencodereview-windows-arm64.exe
From Supply
cd open-code-review
make construct
sudo cp dist/opencodereview /usr/native/bin/ocr
1. Configure LLM
You need to configure an LLM earlier than reviewing code.
ocr config set llm.url https://api.anthropic.com/v1/messages
ocr config set llm.auth_token your-api-key-here
ocr config set llm.mannequin claude-opus-4-6
ocr config set llm.use_anthropic true# Choice B: Surroundings variables (highest precedence)
export OCR_LLM_URL=https://api.anthropic.com/v1/messages
export OCR_LLM_TOKEN=your-api-key-here
export OCR_LLM_MODEL=claude-opus-4-6
export OCR_USE_ANTHROPIC=true
Config is saved in ~/.opencodereview/config.json.
It is usually suitable with Claude Code atmosphere variables (ANTHROPIC_BASE_URL, ANTHROPIC_AUTH_TOKEN, ANTHROPIC_MODEL) and parses ~/.zshrc / ~/.bashrc for these exports.
2. Check Connectivity
3. Evaluate
cd your-project
# Workspace mode — evaluation all staged, unstaged, and untracked modifications
ocr evaluation
# Department vary — evaluate two refs
ocr evaluation –from principal –to feature-branch
# Single commit
ocr evaluation –commit abc123
Combine with Coding Brokers
OCR might be seamlessly built-in into AI coding brokers as a slash command, enabling code evaluation immediately inside your agent workflow.
Choice 1: Set up as a Ability
Use npx to put in the OCR ability into your venture:
This installs the open-code-review ability from the talents registry, which teaches your coding agent how you can invoke ocr for code evaluation, classify points by precedence, and optionally apply fixes.
Choice 2: Set up as a Claude Code Plugin
For Claude Code, set up the command plugin by means of the next command in Claude Code:
/plugin set up open-code-review@open-code-review
This registers the /open-code-review:evaluation slash command, which runs OCR and robotically filters and fixes points.
Choice 3: Copy the Command File Instantly
For a fast setup with none bundle supervisor, merely copy the command file to make use of the /open-code-review slash command in Claude Code.
Mission-level (shared with crew through git):
curl -o .claude/instructions/open-code-review.md
https://uncooked.githubusercontent.com/alibaba/open-code-review/principal/plugins/open-code-review/instructions/evaluation.md
Consumer-level (private international use throughout all initiatives):
curl -o ~/.claude/instructions/open-code-review.md
https://uncooked.githubusercontent.com/alibaba/open-code-review/principal/plugins/open-code-review/instructions/evaluation.md
Prerequisite: All integration strategies require the ocr CLI to be put in and an LLM configured. See Set up and Configure LLM above.
OCR might be built-in into CI/CD pipelines to automate code evaluation on Merge Requests / Pull Requests.
The core command for CI integration:
–from “origin/principal“
–to “origin/feature-branch“
–format json
The –format json flag outputs machine-readable outcomes appropriate for parsing in CI scripts.
See the examples/ listing for integration examples:
Command
Alias
Description
ocr evaluation
ocr r
Begin a code evaluation
ocr guidelines examine
—
Preview which evaluation rule applies to a file path
ocr config set
—
Set configuration values
ocr llm check
—
Check LLM connectivity
ocr viewer
ocr v
Launch WebUI session viewer on localhost:5483
ocr model
—
Present model information
Flag
Shorthand
Default
Description
–repo
—
present dir
Git repository root
–from
—
—
Supply ref (e.g., principal)
–to
—
—
Goal ref (e.g., feature-branch)
–commit
-c
—
Single decide to evaluation
–preview
-p
false
Preview which information shall be reviewed with out working the LLM
–format
-f
textual content
Output format: textual content or json
–concurrency
—
8
Max concurrent file critiques
–timeout
—
10
Concurrent activity timeout in minutes
–audience
—
human
human (present progress) or agent (abstract solely)
–rule
—
—
Path to customized JSON evaluation guidelines
–max-tools
—
built-in
Max instrument name rounds per file; solely takes impact when larger than template default
–tools
—
—
Path to customized JSON instruments config
ocr evaluation –preview
ocr evaluation -c abc123 -p# Evaluate workspace modifications with default settings
ocr evaluation
# Evaluate department diff with increased concurrency
ocr evaluation –from principal –to my-feature –concurrency 4
# Evaluate a selected commit with verbose JSON output
ocr evaluation –commit abc123 –format json –audience agent
# Use customized evaluation guidelines
ocr evaluation –rule /path/to/my-rules.json
# Preview which rule applies to a file
ocr guidelines examine src/principal/java/com/instance/Foo.java
ocr guidelines examine –rule customized.json src/principal/sources/mapper/UserMapper.xml
# View evaluation session historical past in browser
ocr viewer
ocr viewer –addr :3000
The viewer serves session JSONL contents (LLM request messages and responses) over HTTP. It enforces a Host-header allowlist on each request: loopback names (localhost, 127.0.0.0/8, ::1) and the concrete bind host are all the time allowed. Wildcard binds (–addr :3000, –addr 0.0.0.0:3000) and different non-loopback Hostnames should be added through the OCR_VIEWER_ALLOWED_HOSTS atmosphere variable (comma-separated):
This blocks DNS-rebinding assaults towards the native viewer.
OCR resolves evaluation guidelines utilizing a four-layer precedence chain. Every layer makes use of first-match-wins: if a file path matches a sample, that rule is used; in any other case it falls by means of to the following layer.
Precedence
Supply
Path
Description
1 (highest)
–rule flag
Consumer-specified path
CLI specific override
2
Mission config
/.opencodereview/rule.json
Per-project guidelines, might be dedicated to git
3
International config
~/.opencodereview/rule.json
Consumer-wide private preferences
4 (lowest)
System default
Embedded system_rules.json
Constructed-in guidelines protecting widespread languages and file sorts
Layers 1–3 share the identical JSON format:
“guidelines”: [
{
“path”: “force-api/**/*.java“,
“rule”: “All new methods must validate required parameters for null values“
},
{
“path”: “**/*mapper*.xml“,
“rule”: “Check SQL for injection risks, parameter errors, and missing closing tags“
}
]
}
path helps ** recursive matching and {java,kt} brace enlargement.
Inside every layer, guidelines are evaluated in declaration order — the primary match wins.
If a rule file doesn’t exist, it’s silently skipped.
Config file: ~/.opencodereview/config.json
Key
Sort
Instance
llm.url
string
https://api.openai.com/v1/chat/completions
llm.auth_token
string
sk-xxxxxxx
llm.mannequin
string
claude-opus-4-6
llm.use_anthropic
boolean
true | false
language
string
English | Chinese language (default: Chinese language)
telemetry.enabled
boolean
true | false
telemetry.exporter
string
console | otlp
telemetry.otlp_endpoint
string
OTLP collector tackle
telemetry.content_logging
boolean
Embody prompts in telemetry
Surroundings variables take priority over the config file.
Variable
Goal
OCR_LLM_URL
LLM API endpoint URL
OCR_LLM_TOKEN
API key / auth token
OCR_LLM_MODEL
Mannequin title
OCR_USE_ANTHROPIC
true = Anthropic, false = OpenAI
OpenTelemetry integration for observability (spans, metrics). Disabled by default.
ocr config set telemetry.exporter otlp
ocr config set telemetry.otlp_endpoint localhost:4317
Set telemetry.content_logging to incorporate LLM prompts and responses in exported information.
See CONTRIBUTING.md for growth setup, coding tips, and how you can submit pull requests.
Apache-2.0 — Copyright 2026 Alibaba

