GetNotes Tools
alibaba/open-code-review
Tool นี้คืออะไร
Open Code Review เป็นเครื่องมือ CLI สำหรับรีวิวโค้ดที่ขับเคลื่อนด้วย AI ซึ่งพัฒนาโดย Alibaba Group เหมาะสำหรับนักพัฒนาที่ต้องการปรับปรุงคุณภาพโค้ด ลดข้อบกพร่อง และเพิ่มประสิทธิภาพกระบวนการรีวิวโค้ดด้วยความแม่นยำสูงและต้นทุนที่ต่ำกว่าเครื่องมือ AI ทั่วไป
ข้อมูลโปรเจกต์
ดาว
13.5K
Forks
921
License
Apache-2.0
อัปเดต GitHub ล่าสุด
26 ก.ค. 2569
เพิ่มใน GetNotes
30 ก.ค. 2569
Repository
alibaba/open-code-review
เหมาะกับงาน
เหมาะกับอาชีพ
Ecosystem
Go
แปลและเรียบเรียงโดย AI
เนื้อหาฉบับภาษาไทย
ใช้อ่านเพื่อทำความเข้าใจเบื้องต้น โปรดตรวจสอบรายละเอียดสำคัญกับเอกสารต้นฉบับด้านล่าง
Open Code Review คืออะไร?
Open Code Review เป็นเครื่องมือ CLI สำหรับรีวิวโค้ดที่ขับเคลื่อนด้วย AI ซึ่งมีต้นกำเนิดมาจากผู้ช่วยรีวิวโค้ด AI อย่างเป็นทางการภายในของ Alibaba Group ตลอดสองปีที่ผ่านมา ได้ให้บริการนักพัฒนาหลายหมื่นคนและระบุข้อบกพร่องของโค้ดได้หลายล้านรายการ หลังจากการตรวจสอบอย่างละเอียดในระดับขนาดใหญ่ เราได้บ่มเพาะให้เป็นโครงการโอเพนซอร์สสำหรับชุมชน เพียงแค่กำหนดค่าปลายทางของโมเดลก็สามารถเริ่มต้นใช้งานได้
เครื่องมือนี้จะอ่าน Git diffs ส่งไฟล์ที่เปลี่ยนแปลงไปยัง LLM ที่กำหนดค่าได้ผ่านเอเจนต์ที่มีความสามารถในการใช้เครื่องมือ และสร้างความคิดเห็นการรีวิวที่มีโครงสร้างพร้อมความแม่นยำระดับบรรทัด เอเจนต์สามารถอ่านเนื้อหาไฟล์ทั้งหมด ค้นหาโค้ดเบส ตรวจสอบไฟล์ที่เปลี่ยนแปลงอื่น ๆ เพื่อหาบริบท และสร้างการรีวิวเชิงลึก ไม่ใช่แค่การตอบรับ diffs แบบผิวเผิน นอกจากการรีวิว diff แล้ว ocr scan ยังรีวิวไฟล์ทั้งหมดเพื่อตรวจสอบโค้ดเบสที่ไม่คุ้นเคย หรือไดเรกทอรีที่ไม่มี diff ที่มีความหมาย
เยี่ยมชม เว็บไซต์อย่างเป็นทางการ สำหรับรายละเอียดเพิ่มเติม

เกณฑ์มาตรฐาน
เมื่อเทียบกับเอเจนต์ทั่วไป (Claude Code) Open Code Review มี Precision และ F1 สูงกว่าอย่างมีนัยสำคัญด้วยโมเดลพื้นฐานเดียวกัน ในขณะที่ใช้โทเค็นเพียง ~1/9 และรีวิวได้เร็วกว่า โปรดทราบว่า Recall ของมันต่ำกว่าเอเจนต์ทั่วไป ซึ่งเป็นการแลกเปลี่ยนที่จงใจเพื่อเน้นความแม่นยำมากกว่าเสียงรบกวน
เกณฑ์มาตรฐานการรีวิวโค้ดในโลกจริงที่สร้างขึ้นจาก 50 repositories โอเพนซอร์สยอดนิยม, 200 Pull Requests จริง และ 10 ภาษาโปรแกรม — ตรวจสอบข้ามโดยวิศวกรอาวุโสกว่า 80 คน (1,505 ปัญหาที่ระบุว่าเป็น ground-truth)
| Metric | สิ่งที่วัด | ทำไมถึงสำคัญ |
|---|---|---|
| F1 | ค่าเฉลี่ยฮาร์มอนิกของ precision และ recall | ตัวเลขเดียวที่ดีที่สุดสำหรับคุณภาพการรีวิวโดยรวม |
| Precision | สัดส่วนของปัญหาที่รายงานที่เป็นข้อบกพร่องจริง | สูงขึ้น = มีการแจ้งเตือนที่ผิดพลาดน้อยลงที่ต้องคัดแยก |
| Recall | สัดส่วนของข้อบกพร่องจริงที่พบ | สูงขึ้น = มีปัญหาน้อยลงที่หลุดรอดจากการรีวิว |
| Avg Time | เวลาจริงต่อการรีวิว | สำคัญสำหรับความล่าช้าของ CI pipeline |
| Avg Token | โทเค็นทั้งหมดที่ใช้ต่อการรีวิว | ส่งผลโดยตรงต่อค่าใช้จ่าย API |

ทำไมต้อง Open Code Review?
ปัญหาของเอเจนต์ทั่วไป
หากคุณเคยใช้เอเจนต์ทั่วไป เช่น Claude Code ที่มี Skills สำหรับการรีวิวโค้ด คุณอาจเคยพบปัญหาเหล่านี้:
- การครอบคลุมไม่สมบูรณ์ — ในชุดการเปลี่ยนแปลงที่ใหญ่ขึ้น เอเจนต์มักจะ "ตัดมุม" โดยรีวิวเพียงบางไฟล์และพลาดไฟล์อื่น ๆ
- ตำแหน่งคลาดเคลื่อน — ปัญหาที่รายงานมักจะไม่ตรงกับตำแหน่งโค้ดจริง โดยมีหมายเลขบรรทัดหรือการอ้างอิงไฟล์คลาดเคลื่อน
- คุณภาพไม่เสถียร — Skills ที่ขับเคลื่อนด้วยภาษาธรรมชาติยากต่อการดีบัก และคุณภาพการรีวิวผันผวนอย่างมีนัยสำคัญกับการเปลี่ยนแปลง prompt เพียงเล็กน้อย
สาเหตุหลัก: สถาปัตยกรรมที่ขับเคลื่อนด้วยภาษาล้วน ๆ ขาดข้อจำกัดที่เข้มงวดในกระบวนการรีวิว
การออกแบบหลัก: วิศวกรรมเชิงกำหนด × เอเจนต์ไฮบริด
ปรัชญาหลักของ Open Code Review คือการรวมวิศวกรรมเชิงกำหนดเข้ากับเอเจนต์ โดยแต่ละส่วนจะจัดการในสิ่งที่ทำได้ดีที่สุด
วิศวกรรมเชิงกำหนด — ข้อจำกัดที่เข้มงวด
สำหรับขั้นตอนการรีวิวที่ ต้องไม่ผิดพลาด ตรรกะทางวิศวกรรม — ไม่ใช่โมเดลภาษา — รับประกันความถูกต้อง:
- การเลือกไฟล์ที่แม่นยำ — กำหนดว่าไฟล์ใดบ้างที่ต้องรีวิวและไฟล์ใดควรถูกกรองออก เพื่อให้แน่ใจว่าจะไม่มีการเปลี่ยนแปลงที่สำคัญถูกมองข้าม
- การรวมไฟล์อัจฉริยะ — จัดกลุ่มไฟล์ที่เกี่ยวข้องเข้าเป็นหน่วยการรีวิวเดียว (เช่น
message_en.propertiesและmessage_zh.propertiesถูกรวมเข้าด้วยกัน) แต่ละชุดทำงานเป็น sub-agent ที่มีบริบทแยกต่างหาก — กลยุทธ์แบบแบ่งแยกและพิชิตที่คงความเสถียรในชุดการเปลี่ยนแปลงขนาดใหญ่มาก และรองรับการรีวิวพร้อมกันได้อย่างเป็นธรรมชาติ - การจับคู่กฎแบบละเอียด — จับคู่กฎการรีวิวกับลักษณะของแต่ละไฟล์ ทำให้ความสนใจของโมเดลมุ่งเน้นอย่างคมชัดและกำจัดข้อมูลรบกวนที่ต้นทาง เมื่อเทียบกับการแนะนำกฎที่ขับเคลื่อนด้วยภาษาล้วน ๆ การจับคู่กฎที่ใช้ template-engine มีความเสถียรและคาดการณ์ได้มากกว่า
- โมดูลการกำหนดตำแหน่งและการสะท้อนภายนอก — โมดูลการกำหนดตำแหน่งความคิดเห็นและการสะท้อนความคิดเห็นที่เป็นอิสระช่วยปรับปรุงความแม่นยำของตำแหน่งและความแม่นยำของเนื้อหาของข้อเสนอแนะ AI อย่างเป็นระบบ
เอเจนต์ — การตัดสินใจแบบไดนามิก
จุดแข็งของเอเจนต์มุ่งเน้นไปที่สิ่งที่สำคัญที่สุด — การตัดสินใจแบบไดนามิกและการดึงบริบทแบบไดนามิก:
- Prompts ที่ปรับแต่งตามสถานการณ์ — เทมเพลต Prompt ที่ได้รับการปรับแต่งอย่างลึกซึ้งสำหรับการรีวิวโค้ด ช่วยเพิ่มประสิทธิภาพในขณะที่ลดการใช้โทเค็น
- ชุดเครื่องมือที่ปรับแต่งตามสถานการณ์ — กลั่นกรองจากการวิเคราะห์เชิงลึกของร่องรอยการเรียกใช้เครื่องมือในข้อมูลการผลิตขนาดใหญ่ — รวมถึงการกระจายความถี่การเรียกใช้ อัตราการทำซ้ำต่อเครื่องมือ และผลกระทบของเครื่องมือใหม่ต่อห่วงโซ่การเรียกใช้โดยรวม — ส่งผลให้ได้ชุดเครื่องมือที่สร้างขึ้นเพื่อวัตถุประสงค์เฉพาะ ซึ่งมีความเสถียรและคาดการณ์ได้มากกว่าสำหรับรีวิวโค้ดเมื่อเทียบกับชุดเครื่องมือเอเจนต์ทั่วไป
วิธีใช้งาน
ข้อกำหนดเบื้องต้น
- Git >= 2.41 — Open Code Review อาศัย Git ในการสร้าง diff, ค้นหาโค้ด และการดำเนินการกับ repository
CLI
การติดตั้ง
npm install -g @alibaba-group/open-code-reviewหลังจากการติดตั้ง คำสั่ง ocr จะพร้อมใช้งานทั่วโลก
สำหรับวิธีการติดตั้งอื่น ๆ (install script, GitHub Release binary, จาก source) โปรดดูที่ Installation
เริ่มต้นใช้งานอย่างรวดเร็ว
1. กำหนดค่า LLM
คุณต้องกำหนดค่า LLM ก่อนที่จะรีวิวโค้ด เว้นแต่คุณจะใช้ Delegation Mode
ocr config provider # เลือก provider ในตัวหรือเพิ่ม provider ที่กำหนดเอง
ocr config model # เลือกโมเดลสำหรับ provider ที่ใช้งานอยู่
UI แบบโต้ตอบจะแนะนำคุณตลอดการเลือก provider, การป้อน API key และการกำหนดค่าโมเดล จากนั้นจะทดสอบการเชื่อมต่อโดยอัตโนมัติ
สำหรับการตั้งค่า CLI, ตัวแปรสภาพแวดล้อม, custom providers และการกำหนดค่าขั้นสูงอื่น ๆ โปรดดูที่ Configuration
2. รีวิว
cd your-project
# โหมด Workspace — รีวิวการเปลี่ยนแปลงทั้งหมดที่ staged, unstaged และ untracked
ocr review
# ช่วง Branch — เปรียบเทียบสอง refs
ocr review --from main --to feature-branch
# Single commit
ocr review --commit abc123
# ดำเนินการต่อการรีวิวช่วงหรือ commit ที่ถูกขัดจังหวะ
ocr session list
ocr review --from main --to feature-branch --resume <session-id>
# การสแกนไฟล์ทั้งหมด — รีวิวไฟล์ทั้งหมดแทนที่จะเป็น diff (ไม่จำเป็นต้องมีประวัติ git)
ocr scan # สแกน repository ทั้งหมด
ocr scan --path internal/agent # สแกนไดเรกทอรีหรือไฟล์ที่ระบุ
# โหมด Delegation — ให้ AI coding agent ของคุณทำการรีวิวเอง
# OCR จัดการการเลือกไฟล์และการแก้ไขกฎ; ไม่จำเป็นต้องกำหนดค่า LLM
ocr delegate preview
ocr delegate rule src/main.go src/handler.go
## เอกสารประกอบ
เอกสารประกอบฉบับเต็มอยู่ที่ **[open-codereview.ai/docs](https://open-codereview.ai/docs)**:
- [Quickstart](https://open-codereview.ai/docs/quickstart) — ติดตั้งและรันการรีวิวครั้งแรกของคุณ
- [Installation](https://open-codereview.ai/docs/installation) — ทุกแพลตฟอร์มและตัวจัดการแพ็กเกจ
- [CLI Reference](https://open-codereview.ai/docs/cli-reference) — ทุกคำสั่งและแฟล็ก
- [Review Rules](https://open-codereview.ai/docs/review-rules) — ปรับแต่งกฎการรีวิวด้วยการกรองและกำหนดเป้าหมายตามพาธ
- [Configuration](https://open-codereview.ai/docs/configuration) — คีย์การกำหนดค่าและตัวแปรสภาพแวดล้อม
- [MCP Server](https://open-codereview.ai/docs/mcp) — ขยายเอเจนต์การรีวิวด้วยเครื่องมือภายนอก
- การผสานรวม Coding Agent — เลือกแพลตฟอร์มที่คุณใช้
- [Claude Code](https://github.com/alibaba/open-code-review/blob/main/plugins/open-code-review/README.md#claude-code) — ติดตั้งปลั๊กอินพร้อมคำสั่ง slash สำหรับการรีวิว
- [Codex](https://github.com/alibaba/open-code-review/blob/main/plugins/open-code-review/README.md#codex) — ติดตั้งปลั๊กอินพร้อมทักษะการรีวิวที่เรียกใช้ได้
- [Cursor](https://github.com/alibaba/open-code-review/blob/main/plugins/open-code-review/README.md#cursor) — ติดตั้งปลั๊กอินพร้อมทักษะการรีวิวแบบพกพา
- [OpenCode](https://github.com/alibaba/open-code-review/blob/main/plugins/open-code-review/opencode/README.md) — ติดตั้งเครื่องมือรีวิวและคำสั่ง slash แบบเนทีฟ
- [Skill-compatible agents](https://open-codereview.ai/docs/agent-skill) — ติดตั้งทักษะเอเจนต์แบบพกพา
- โหมดการดำเนินการรีวิว — หลังจากการผสานรวม เลือก LLM ที่จะทำการรีวิว
- [Default (OCR-managed)](https://open-codereview.ai/docs/configuration) — OCR รันการรีวิวโดยใช้ LLM ที่กำหนดค่าไว้
- [Delegation Mode](https://open-codereview.ai/docs/delegate) — เอเจนต์การเขียนโค้ดของคุณรันการรีวิวโดยใช้ LLM ของตัวเอง ไม่ต้องใช้ OCR API key
- [CI/CD Integration](https://open-codereview.ai/docs/cicd) — การผสานรวม GitHub Actions, GitLab CI, GitFlic CI และ Gerrit
- [Session Viewer](https://open-codereview.ai/docs/viewer) — เรียกดูและเล่นเซสชันการรีวิวซ้ำในเบราว์เซอร์
- [Telemetry](https://open-codereview.ai/docs/telemetry) — การผสานรวม OpenTelemetry สำหรับการสังเกตการณ์
- [FAQ](https://open-codereview.ai/docs/faq) — คำถามที่พบบ่อยและการแก้ไขปัญหา
## การมีส่วนร่วม
โปรเจกต์นี้เกิดขึ้นได้ด้วยผู้มีส่วนร่วมทุกท่าน ดู [CONTRIBUTING.md](https://github.com/alibaba/open-code-review/blob/main/CONTRIBUTING.md) สำหรับการตั้งค่าการพัฒนา แนวทางการเขียนโค้ด และวิธีการส่ง pull request
<a href="https://github.com/alibaba/open-code-review/graphs/contributors">
<img src="https://contrib.rocks/image?repo=alibaba/open-code-review" />
</a>
## ลิขสิทธิ์
[Apache-2.0](https://github.com/alibaba/open-code-review/blob/main/LICENSE) — ลิขสิทธิ์ 2026 Alibabaเอกสารโปรเจกต์
อ่านเอกสารต้นฉบับ
README วิธีติดตั้ง วิธีใช้งาน และข้อกำหนดจาก repository ต้นฉบับ
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.

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

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.propertiesandmessage_zh.propertiesare 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-reviewAfter 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
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 — compare two refs
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
# 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.goDocumentation
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](https://github.com/alibaba/open-code-review/blob/main/plugins/open-code-review/README.md#claude-code) — install a plugin with review slash commands - [Codex](https://github.com/alibaba/open-code-review/blob/main/plugins/open-code-review/README.md#codex) — install a plugin with callable review skills - [Cursor](https://github.com/alibaba/open-code-review/blob/main/plugins/open-code-review/README.md#cursor) — install a plugin with portable review skills - [OpenCode](https://github.com/alibaba/open-code-review/blob/main/plugins/open-code-review/opencode/README.md) — install native review tools and slash commands - [Skill-compatible agents](https://open-codereview.ai/docs/agent-skill) — install the portable agent skill
- Review Execution Modes — after integration, choose which LLM performs the review- [Default (OCR-managed)](https://open-codereview.ai/docs/configuration) — OCR runs the review using its configured LLM - [Delegation Mode](https://open-codereview.ai/docs/delegate) — your coding agent runs the review using its own LLM; no OCR API key required
- CI/CD Integration — GitHub Actions, GitLab CI, GitFlic CI, and Gerrit integration
- Session Viewer — browse and replay review sessions in browser
- Telemetry — OpenTelemetry integration for observability
- FAQ — common questions and troubleshooting
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
