Get independent code reviews from external LLM CLIs (OpenAI Codex, Google Gemini) on uncommitted changes, branch diffs, or specific commits.
Overview
The Second Opinion plugin shells out to external LLM CLIs for independent code reviews powered by separate models. It supports both OpenAI Codex CLI and Google Gemini CLI, with options to run them individually or compare results side-by-side. Author: Dan GuidoFeatures
Dual Model Support
Run reviews with OpenAI Codex (gpt-5.3-codex) or Google Gemini (gemini-3.1-pro-preview), or both for comparison
Multiple Scopes
Review uncommitted changes, branch diffs vs main, or specific commits
Focused Reviews
General review, security, performance, or error handling focus areas
Project-Aware
Optionally include CLAUDE.md or AGENTS.md for context-aware reviews
Prerequisites
OpenAI Codex CLI
Google Gemini CLI
Installation
Usage
Answer Questions
Claude asks up to 4 questions (skips any already specified):
- Review tool - Codex, Gemini, or both (default: both)
- Review scope - Uncommitted, branch diff, or specific commit
- Project context - Include CLAUDE.md/AGENTS.md? (if exists)
- Review focus - General, security, performance, or error handling
Review Diff Stats
Claude shows what will be reviewed:If the diff is empty, Claude stops. If very large (>2000 lines), Claude warns.
Run Review
For “Both” (default), Claude runs Codex and Gemini in parallel.For single tool, Claude runs just that tool.
Review Scopes
Uncommitted Changes
Reviews all uncommitted work (tracked and untracked files):Branch Diff vs Main
Reviews all changes in current branch since it diverged from default branch:Specific Commit
Reviews changes introduced by a single commit:Focus Areas
- General Review
- Security & Auth
- Performance
- Error Handling
Broad code review covering:
- Code quality and maintainability
- Potential bugs and edge cases
- Best practices and patterns
- Documentation completeness
Codex vs Gemini
| Feature | Codex | Gemini |
|---|---|---|
| Model | gpt-5.3-codex | gemini-3.1-pro-preview |
| Reasoning | xhigh | Default |
| Output | Structured JSON findings by priority | Natural language |
| Headless | codex exec with stdin | gemini -p with stdin |
| Extensions | None | code-review, security |
| Dependency Scan | N/A | /security:scan-deps (when security focus + manifest changed) |
Running both (the default) provides comparison and validation. Where they agree, findings are higher confidence.
Codex Invocation Details
- Uses OpenAI’s published code review prompt (fine-tuned into model)
- Diff is piped via stdin with the prompt
--output-schemaproduces structured JSON findings-ocaptures only final message (no thinking/exec noise)- Falls back to
gpt-5.2-codexon auth errors - Timeout: 600 seconds
Gemini Invocation Details
Uncommitted General Review
Branch/Commit Diffs
Security Focus
Dependency Scanning
When security focus is selected AND the diff touches dependency manifest files, Claude also runs:package.json,package-lock.json,yarn.lock,pnpm-lock.yamlrequirements.txt,setup.py,pyproject.toml,uv.lock,poetry.lockCargo.toml,Cargo.lockgo.mod,go.sumGemfile,*.gemspeccomposer.json,composer.lock
The scan is skipped if no manifest files are in the diff, since it analyzes the entire dependency tree (time-consuming with zero value when deps weren’t touched).
Usage Examples
- Both Tools (Default)
- Inline Arguments
- Large Diff Warning
Error Handling
| Error | Action |
|---|---|
codex: command not found | Show install: npm i -g @openai/codex |
gemini: command not found | Show install: npm i -g @google/gemini-cli |
| Gemini extension missing | Show install: gemini extensions install <url> |
| Model auth error (Codex) | Retry with gpt-5.2-codex |
| Empty diff | Stop and inform user |
| Timeout | Inform user, suggest narrowing scope |
| Tool partially unavailable | Run only available tool, note the skip |
Codex MCP Tools
This plugin bundles Codex CLI’s built-in MCP server (codex mcp-server), which auto-starts when the plugin is installed:
- codex - Start new Codex session with prompt, model, sandbox, approval policy
- codex-reply - Continue existing session by thread ID for multi-turn conversations
/second-opinion command. Use them for direct programmatic access to Codex.
Related Skills
- Modern Python - Reviews can check for modern Python best practices
- GH CLI - Can review branch diffs before opening PRs
- Git Cleanup - Can review branches before cleanup