Skip to main content
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 Guido

Features

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

1

Install Codex CLI

2

Configure Authentication

Requires OpenAI API key or ChatGPT Plus subscription configured for Codex

Google Gemini CLI

1

Install Gemini CLI

2

Authenticate

3

Install Extensions

Installation

Usage

1

Invoke the Command

or with inline arguments:
2

Answer Questions

Claude asks up to 4 questions (skips any already specified):
  1. Review tool - Codex, Gemini, or both (default: both)
  2. Review scope - Uncommitted, branch diff, or specific commit
  3. Project context - Include CLAUDE.md/AGENTS.md? (if exists)
  4. Review focus - General, security, performance, or error handling
3

Review Diff Stats

Claude shows what will be reviewed:
If the diff is empty, Claude stops. If very large (>2000 lines), Claude warns.
4

Run Review

For “Both” (default), Claude runs Codex and Gemini in parallel.For single tool, Claude runs just that tool.
5

View Results

Results are presented with clear headers:

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

Broad code review covering:
  • Code quality and maintainability
  • Potential bugs and edge cases
  • Best practices and patterns
  • Documentation completeness

Codex vs Gemini

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-schema produces structured JSON findings
  • -o captures only final message (no thinking/exec noise)
  • Falls back to gpt-5.2-codex on auth errors
  • Timeout: 600 seconds

Gemini Invocation Details

Uncommitted General Review

Branch/Commit Diffs

Security Focus

Safety Note: Gemini CLI is invoked with --yolo, which auto-approves all tool calls without confirmation. Required for headless operation.

Dependency Scanning

When security focus is selected AND the diff touches dependency manifest files, Claude also runs:
Manifest files detected:
  • package.json, package-lock.json, yarn.lock, pnpm-lock.yaml
  • requirements.txt, setup.py, pyproject.toml, uv.lock, poetry.lock
  • Cargo.toml, Cargo.lock
  • go.mod, go.sum
  • Gemfile, *.gemspec
  • composer.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

Error Handling

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
These tools work independently of the /second-opinion command. Use them for direct programmatic access to Codex.
  • 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