Skip to content

Repository files navigation

opencode-review

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.

Features

  • 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:fixer sub-agent that applies minimal fixes automatically
  • On-demand review/review slash command or Tab-switchable review agent 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

Installation

Local plugin (recommended)

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

npm (coming soon)

Add to your opencode.json:

{
"plugin": ["opencode-review"]
}

Usage

Slash Command

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

Agent Mode

Press Tab twice to switch to the review agent, then describe what you want reviewed.

CLI

opencode run --agent review "Review the current changes"

Configuration

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"
]
}

Options

OptionDescriptionDefault
languageOutput language ("zh" or "en")"zh"
dimensionsReview dimensions to checkAll 5 dimensions
max_diff_linesMax diff lines before truncation500
trigger.auto_on_idleAuto-review when session goes idlefalse
trigger.cooldown_secondsMinimum interval between auto-reviews (seconds)120
custom_rulesAdditional project-specific rules[]

License

MIT

About

OpenCode automatic review agent plugin

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages