메뉴
HN
Hacker News 54일 전

알리바이, AI 기반 코드 리뷰 CLI 오픈소스 공개

IMP
8/10
핵심 요약

알리바이 그룹이 사내 수만 명의 개발자를 통해 검증된 AI 코드 리뷰 CLI 도구를 오픈소스로 공개했습니다. 이 도구는 기존 범용 에이전트의 한계인 불안정한 품질과 위치 오류를 극복하기 위해, 엔지니어링 기반의 결정론적 하드 컨스트레인트와 LLM 에이전트의 동적 의사결정을 결합한 하이브리드 방식을 채택한 것이 특징입니다.

번역된 본문

오픈소스 AI 코드 리뷰 에이전트 (English | 简体中文)

Open Code Review(오픈 코드 리뷰)란 무엇인가? Open Code Review는 AI 기반의 코드 리뷰 CLI(명령줄 인터페이스) 도구입니다. 이 도구는 알리바바 그룹의 공식 사내 AI 코드 리뷰 어시스턴트에서 시작되었으며, 지난 2년 동안 수만 명의 개발자에게 서비스를 제공하고 수백만 개의 코드 결함을 식별했습니다. 대규모 환경에서의 철저한 검증을 거친 후, 우리는 이를 커뮤니티를 위한 오픈소스 프로젝트로 발전시켰습니다. 모델 엔드포인트(endpoint)만 구성하면 바로 시작할 수 있습니다. 이 도구는 Git diff를 읽고, 변경된 파일을 도구 사용(Tool-use) 기능을 갖춘 에이전트를 통해 구성 가능한 LLM으로 전송하여, 라인 수준의 정밀함으로 구조화된 리뷰 코멘트를 생성합니다. 에이전트는 전체 파일 내용을 읽고 코드베이스를 검색하며 컨텍스트를 위해 다른 변경된 파일을 검사하여 표면적인 diff 피드백이 아닌 심층적인 리뷰를 수행할 수 있습니다.

왜 Open Code Review를 사용해야 하는가? 범용 에이전트의 문제점 Claude Code와 같은 Skills 기반의 범용 에이전트를 코드 리뷰에 사용해 본 적이 있다면 다음과 같은 문제점을 겪었을 것입니다.

  • 불완전한 커버리지 — 규모가 큰 변경 사항(changeset)에서 에이전트는 종종 '편법'을 써서 일부 파일만 선택적으로 리뷰하고 나머지는 누락하는 경향이 있습니다.
  • 위치 드리프트(Position drift) — 보고된 문제가 실제 코드 위치와 자주 일치하지 않으며, 줄 번호나 파일 참조가 대상에서 벗어나는 경우가 많습니다.
  • 불안정한 품질 — 자연어 기반의 Skills는 디버깅하기 어려우며, 사소한 프롬프트 변화에도 리뷰 품질이 크게 요동칩니다.

근본적인 원인: 순수하게 언어에 의존하는 아키텍처는 리뷰 과정에 대한 강력한 제약(Hard constraints)이 부족합니다.

핵심 설계: 결정론적 엔지니어링 × 에이전트 하이브리드 Open Code Review의 핵심 철학은 결정론적 엔지니어링과 에이전트를 결합하여 각각이 가장 잘하는 일을 처리하도록 하는 것입니다.

결정론적 엔지니어링 — 강력한 제약(Hard Constraints) 절대로 오류가 나서는 안 되는 리뷰 단계에 대해서는 언어 모델이 아닌 엔지니어링 로직이 정확성을 보장합니다.

  • 정밀한 파일 선택 — 어떤 파일을 리뷰해야 하고 어떤 파일을 필터링해야 하는지 정확히 결정하여 중요한 변경 사항이 누락되지 않도록 합니다.
  • 스마트 파일 번들링 — 관련 파일을 단일 리뷰 단위로 묶습니다 (예: message_en.properties 및 message_zh.properties를 함께 묶음). 각 번들은 격리된 컨텍스트를 가진 하위 에이전트로 실행됩니다. 이는 매우 큰 변경 사항에서도 안정성을 유지하는 분할 정복(Divide-and-conquer) 전략이며 자연스럽게 동시 리뷰를 지원합니다.
  • 세분화된 규칙 매칭 — 각 파일의 특성에 맞게 리뷰 규칙을 매칭하여 모델의 주의력을 집중시키고 정보 노이즈를 원천적으로 차단합니다. 순수하게 언어로만 구동되는 규칙 안내와 비교하여, 템플릿 엔진 기반의 규칙 매칭이 훨씬 더 안정적이고 예측 가능합니다.
  • 외부 위치 지정 및 성찬(Reflection) 모듈 — 독립적인 코멘트 위치 지정 및 코멘트 성찬 모듈은 AI 피드백의 위치 정확도와 내용 정확도를 체계적으로 향상시킵니다.

에이전트 — 동적 의사결정 에이전트의 강점은 가장 중요한 역할, 즉 동적 의사결정과 동적 컨텍스트 검색에 집중됩니다.

  • 시나리오 맞춤형 프롬프트 — 코드 리뷰에 최적화된 프롬프트 템플릿을 사용하여 효율성을 높이고 토큰 소비를 줄입니다.
  • 시나리오 맞춤형 도구 세트 — 대규모 프로덕션 데이터의 도구 호출 추적을 심층적으로 분석하여 추출되었습니다. 여기에는 호출 빈도 분포, 도구별 반복률, 새로운 도구가 전체 호출 체인에 미치는 영향이 포함됩니다. 그 결과 범용 에이전트 도구 세트보다 코드 리뷰에 더 안정적이고 예측 가능한 전용 도구 세트가 탄생했습니다.

CLI 사용 방법 NPM을 통한 설치 (권장) npm install -g @alibaba-group/open-code-review

설치 후 ocr 명령어를 전역으로 사용할 수 있습니다.

GitHub Release에서 다운로드 GitHub Releases 에서 최신 바이너리를 다운로드하세요:

macOS (Apple Silicon)

curl -Lo ocr https://github.com/alibaba/open-code-review/releases/latest/download/opencodereview-darwin-arm64 chmod +x ocr && sudo mv ocr /usr/local/bin/ocr

macOS (Intel)

curl -Lo ocr https://github.com/alibaba/open-code-review/releases/latest/download/opencodereview-darwin-amd64 chmod +x ocr && sudo mv ocr /usr/local/bin/

원문 보기
원문 보기 (영어)
The open source AI code review agent. 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. 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 CLI Install Via NPM (Recommended) npm install -g @alibaba-group/open-code-review After installation, the ocr command is available globally. From GitHub Release Download the latest binary from GitHub Releases : # macOS (Apple Silicon) curl -Lo ocr https://github.com/alibaba/open-code-review/releases/latest/download/opencodereview-darwin-arm64 chmod +x ocr && sudo mv ocr /usr/local/bin/ocr # macOS (Intel) curl -Lo ocr https://github.com/alibaba/open-code-review/releases/latest/download/opencodereview-darwin-amd64 chmod +x ocr && sudo mv ocr /usr/local/bin/ocr # Linux (x86_64) curl -Lo ocr https://github.com/alibaba/open-code-review/releases/latest/download/opencodereview-linux-amd64 chmod +x ocr && sudo mv ocr /usr/local/bin/ocr # Linux (ARM64) curl -Lo ocr https://github.com/alibaba/open-code-review/releases/latest/download/opencodereview-linux-arm64 chmod +x ocr && sudo mv ocr /usr/local/bin/ocr # Windows (x86_64) — move ocr.exe to a directory in your PATH curl -Lo ocr.exe https://github.com/alibaba/open-code-review/releases/latest/download/opencodereview-windows-amd64.exe # Windows (ARM64) — move ocr.exe to a directory in your PATH curl -Lo ocr.exe https://github.com/alibaba/open-code-review/releases/latest/download/opencodereview-windows-arm64.exe From Source git clone https://github.com/alibaba/open-code-review.git cd open-code-review make build sudo cp dist/opencodereview /usr/local/bin/ocr Quick Start 1. Configure LLM You must configure an LLM before reviewing code. # Option A: Interactive config 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.model claude-opus-4-6 ocr config set llm.use_anthropic true # Option B: Environment variables (highest priority) 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 stored in ~/.opencodereview/config.json . It is also compatible with Claude Code environment variables ( ANTHROPIC_BASE_URL , ANTHROPIC_AUTH_TOKEN , ANTHROPIC_MODEL ) and parses ~/.zshrc / ~/.bashrc for those exports. 2. Test Connectivity ocr llm test 3. Review cd your-project # Workspace mode — review all staged, unstaged, and untracked changes ocr review # Branch range — compare two refs ocr review --from main --to feature-branch # Single commit ocr review --commit abc123 Integrate with Coding Agents OCR can be seamlessly integrated into AI coding agents as a slash command, enabling code review directly within your agent workflow. Option 1: Install as a Skill Use npx to install the OCR skill into your project: npx skills add alibaba/open-code-review --skill open-code-review This installs the open-code-review skill from the skills registry , which teaches your coding agent how to invoke ocr for code review, classify issues by priority, and optionally apply fixes. Option 2: Install as a Claude Code Plugin For Claude Code , install the command plugin through the following command in Claude Code: /plugin marketplace add alibaba/open-code-review /plugin install open-code-review@open-code-review This registers the /open-code-review:review slash command, which runs OCR and automatically filters and fixes issues. Option 3: Copy the Command File Directly For a quick setup without any package manager, simply copy the command file to use the /open-code-review slash command in Claude Code. Project-level (shared with team via git): mkdir -p .claude/commands curl -o .claude/commands/open-code-review.md \ https://raw.githubusercontent.com/alibaba/open-code-review/main/plugins/open-code-review/commands/review.md User-level (personal global use across all projects): mkdir -p ~ /.claude/commands curl -o ~ /.claude/commands/open-code-review.md \ https://raw.githubusercontent.com/alibaba/open-code-review/main/plugins/open-code-review/commands/review.md Prerequisite : All integration methods require the ocr CLI to be installed and an LLM configured. See Install and Configure LLM above. CI/CD Integration OCR can be integrated into CI/CD pipelines to automate code review on Merge Requests / Pull Requests. The core command for CI integration: ocr review \ --from " origin/main " \ --to " origin/feature-branch " \ --format json The --format json flag outputs machine-readable results suitable for parsing in CI scripts. See the examples/ directory for integration examples: github_actions/ — GitHub Actions integration example gitlab_ci/ — GitLab CI integration example Commands Command Alias Desc