An automatic code review plugin for OpenCode CLI. Automatically reviews staged changes when a session goes idle, with configurable cooldown, multi-dimension analysis, and auto-fix support.
- Auto-review on idle — automatically triggers code review when session completes, with configurable cooldown (
cooldown_seconds) to prevent duplicate reviews - Auto-fix chain — critical issues spawn a
review:fixersub-agent that applies minimal fixes automatically - On-demand review —
/reviewslash command or Tab-switchablereviewagent for manual reviews - Three review scopes: staged changes, last commit, full branch diff
- Configurable review dimensions (code quality, security, performance, testing, documentation)
- Structured output with severity levels (critical / suggestion / highlight)
- Supports Chinese and English output
Copy or symlink into your OpenCode plugins directory:
# Project-level
mkdir -p .opencode/plugins
ln -s /path/to/opencode-review/src/index.ts .opencode/plugins/opencode-review.ts
# Or global
ln -s /path/to/opencode-review/src/index.ts ~/.config/opencode/plugins/opencode-review.tsAdd to your opencode.json:
{
"plugin": ["opencode-review"]
}/review # Review staged changes
/review:auto # Toggle auto-review (query current state)
/review:auto on # Enable auto-review
/review:auto off # Disable auto-review
Note: /review:auto changes are in-memory only and reset to the config file value on restart.
Press Tab twice to switch to the review agent, then describe what you want reviewed.
opencode run --agent review "Review the current changes"Create .opencode/review.json in your project (or ~/.config/opencode/review.json globally):
{
"language": "zh",
"dimensions": [
"code-quality",
"security",
"performance",
"testing",
"documentation"
],
"max_diff_lines": 500,
"trigger": {
"auto_on_idle": true,
"cooldown_seconds": 120
},
"custom_rules": [
"All API endpoints must have error handling",
"Database queries must use parameterized statements"
]
}| Option | Description | Default |
|---|---|---|
language |
Output language ("zh" or "en") |
"zh" |
dimensions |
Review dimensions to check | All 5 dimensions |
max_diff_lines |
Max diff lines before truncation | 500 |
trigger.auto_on_idle |
Auto-review when session goes idle | false |
trigger.cooldown_seconds |
Minimum interval between auto-reviews (seconds) | 120 |
custom_rules |
Additional project-specific rules | [] |
MIT