Skip to content

cedricwider/opencode-review

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

opencode-review — Multi-Agent Code Review Configuration

Personal OpenCode configuration for automated pull request reviews using a multi-specialist orchestrator pattern.

Architecture

The review system uses an orchestrator + specialist fan-out model:

  1. pr-reviewer-orchestrator gathers PR context, selects relevant lenses, and dispatches specialist agents in parallel
  2. Each specialist reviews the diff through a single focused lens and returns a structured JSON report
  3. The orchestrator synthesises findings, deduplicates, resolves conflicts, and posts an inline GitHub PR review
pr-reviewer-orchestrator
├── pr-review-design
├── pr-review-solid
├── pr-review-security
├── pr-review-consistency
└── pr-review-testing

Each specialist is activated conditionally based on what changed — not all lenses run on every PR.

Agents

pr-reviewer (orchestrator)

Principal-level engineering lead. Does not review code itself — gathers PR context, selects relevant lenses, dispatches specialists in parallel, collects their JSON reports, validates findings against the diff, resolves conflicts, and posts the final review via gh-pr-review.

pr-review-design

Senior software architect. Evaluates whether the chosen approach is appropriate, proportionate, and well-suited to the problem: problem-solution fit, proportionality, alternative approaches, architectural fit, future implications, and abstraction level.

pr-review-solid

Senior software engineer focused on code structure. Evaluates SOLID principles (SRP, OCP, LSP, ISP, DIP) plus function size and complexity, duplication, naming clarity, and coupling/cohesion.

pr-review-security

Senior application security engineer. Reviews against OWASP Top 10: broken access control, cryptographic failures, injection, insecure design, security misconfiguration, vulnerable components, authentication failures, data integrity failures, logging gaps, and SSRF. Also checks for secrets in code and information disclosure.

pr-review-consistency

Consistency guardian. Ensures new code follows the established patterns of the codebase: naming conventions, file organization, architectural patterns, error handling, API design, import patterns, configuration, and observability.

pr-review-testing

Senior QA engineer. Verifies that changed or added functionality is properly tested: coverage of new and changed functionality, edge cases, test quality, isolation, mock appropriateness, naming, and regression risk.

Structured Output

Each specialist returns a JSON object:

{
  "lens": "security",
  "verdict": "REQUEST_CHANGES",
  "confidence": "HIGH",
  "summary": "...",
  "findings": [
    {
      "severity": "critical",
      "path": "src/api/users.ts",
      "line": 42,
      "end_line": null,
      "description": "...",
      "suggestion": "...",
      "rationale": "...",
      "references": ["https://owasp.org/..."]
    }
  ],
  "positive": ["..."],
  "out_of_scope": ["..."]
}

Posting

The orchestrator uses the gh-pr-review skill to post the final review directly as a GitHub (or GitLab) inline PR review — with inline diff comments, line validation, and 422 error recovery built in.

If no PR number is provided, the review is printed to stdout instead.

Installation

Prompts live in ~/.config/opencode/prompts/ and the skill in ~/.config/opencode/skills/gh-pr-review/.

Recommended: symlink the directories so this repo stays the single source of truth.

# Prompts
for f in prompts/*.md; do
  ln -sf "$(pwd)/$f" ~/.config/opencode/prompts/$(basename $f)
done

# Skill
ln -sf "$(pwd)/skills/gh-pr-review" ~/.config/opencode/skills/gh-pr-review

Usage

From within a git repo, open OpenCode and use the /review command:

/review 42

Or non-interactively:

opencode run --agent pr-reviewer "Review the current branch against main. PR #42."

Comparison to Single-Agent Approaches

Single-agent This setup
Lenses One generalised reviewer 5 independent specialists
Parallelism Sequential Parallel fan-out
Output Text Structured JSON per lens
Posting Manual Automated inline PR review
Conflict resolution N/A Explicit orchestrator synthesis
Activation Always full Conditional per lens

About

Multi-agent OpenCode configuration for automated PR reviews — orchestrator + 5 specialist lenses (design, SOLID, security, consistency, testing)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors