Skip to main content

/cli:codex-review

Interactive code review command that invokes codex review via CCW CLI endpoint with guided parameter selection.

Overview

The /cli:codex-review command provides an interface to Codex's powerful code review capabilities, supporting multiple review targets and customizable review parameters.

Review Parameters

ParameterDescription
[PROMPT]Custom review instructions (positional)
-c model=<model>Override model via config
--uncommittedReview staged, unstaged, and untracked changes
--base <BRANCH>Review changes against base branch
--commit <SHA>Review changes introduced by a commit
--title <TITLE>Optional commit title for review summary

Usage

Direct Execution (No Interaction)

# Review uncommitted changes
/cli:codex-review --uncommitted

# Review against main branch
/cli:codex-review --base main

# Review specific commit
/cli:codex-review --commit abc123

# Review with custom model
/cli:codex-review --uncommitted --model o3

# Review with security focus
/cli:codex-review --uncommitted security

# Full options
/cli:codex-review --base main --model o3 --title "Auth Feature" security

Interactive Mode

# Start interactive selection (guided flow)
/cli:codex-review

Review Targets

TargetDescriptionUse Case
UncommittedReviews staged, unstaged, and untracked changesQuick pre-commit review
Base BranchReviews changes against specified branchPR review, branch comparison
CommitReviews changes introduced by specific commitHistorical commit review

Focus Areas

FocusDescriptionKey Checks
GeneralComprehensive reviewCorrectness, style, bugs, documentation
SecuritySecurity-first reviewInjection vulnerabilities, auth issues, validation, data exposure
PerformanceOptimization reviewComplexity analysis, memory usage, query optimization, caching
Code QualityMaintainability reviewSOLID principles, code duplication, naming conventions, test coverage

Execution Flow

Interactive Mode

  1. Select Review Target - Choose uncommitted, base branch, or commit
  2. Select Focus Area - Choose general, security, performance, or code quality
  3. Configure Options - Set model, title, and custom instructions
  4. Execute Review - Runs Codex review with selected parameters
  5. Display Results - Shows structured review findings

Command Construction

# Base structure
ccw cli -p "<PROMPT>" --tool codex --mode review [OPTIONS]

# Example with custom prompt
ccw cli -p "
PURPOSE: Comprehensive code review to identify issues and improve quality
TASK: • Review correctness and logic • Check standards compliance • Identify bugs
MODE: review
CONTEXT: Reviewing uncommitted changes
CONSTRAINTS: Actionable feedback
" --tool codex --mode review --rule analysis-review-code-quality

# Example with target flag only
ccw cli --tool codex --mode review --uncommitted

Prompt Template

Follow the standard CCW CLI prompt template:

PURPOSE: [what] + [why] + [success criteria]
TASK: • [step 1][step 2][step 3]
MODE: review
CONTEXT: [target description] | Memory: [project context]
EXPECTED: [deliverable format] + [quality criteria]
CONSTRAINTS: [domain constraints]

Validation Constraints

IMPORTANT: Target flags (--uncommitted, --base, --commit) and custom prompt are mutually exclusive.

Valid Combinations

CommandResult
codex review "Focus on security"✓ Custom prompt, reviews uncommitted (default)
codex review --uncommitted✓ No prompt, uses default review
codex review --base main✓ No prompt, uses default review
codex review --commit abc123✓ No prompt, uses default review

Invalid Combinations

CommandResult
codex review --uncommitted "prompt"✗ Mutually exclusive
codex review --base main "prompt"✗ Mutually exclusive
codex review --commit abc123 "prompt"✗ Mutually exclusive

Error Handling

No Changes to Review

No changes found for review target. Suggestions:
- For --uncommitted: Make some code changes first
- For --base: Ensure branch exists and has diverged
- For --commit: Verify commit SHA exists

Invalid Branch

# Show available branches
git branch -a --list | head -20

Invalid Commit

# Show recent commits
git log --oneline -10

Examples

Pre-Commit Review

# Quick review before committing
/cli:codex-review --uncommitted

# Output:
# Reviewing 3 files with 45 changes
# - src/auth/login.ts: 2 issues found
# - src/user/profile.ts: 1 issue found
# - tests/auth.test.ts: No issues

Branch Comparison

# Review feature branch against main
/cli:codex-review --base feature-auth

# Shows all differences between branches

Security-Focused Review

# Security review of uncommitted changes
/cli:codex-review --uncommitted "Focus on security vulnerabilities, injection risks, authentication issues"

# Prioritizes security-related findings
  • /cli:cli-init - Initialize CLI configuration
  • /workflow:review-session-cycle - Session-based code review
  • /workflow:review-module-cycle - Module-specific code review

Integration Notes

  • Uses ccw cli --tool codex --mode review endpoint
  • Model passed via prompt (codex uses -c model= internally)
  • Target flags passed through to codex
  • Prompt follows standard CCW CLI template format
  • Results include severity levels, file:line references, and remediation suggestions