Skip to main content

Syntax

Description

The review command runs Codex in code review mode. You can review uncommitted changes, compare against a base branch, review a specific commit, or provide custom review instructions.
The review command runs non-interactively like codex exec. Use codex review --help for all available options.

Usage

Review Uncommitted Changes

Review Against Base Branch

Compare current branch with main:

Review Specific Commit

With commit title for context:

Custom Review Instructions

Provide specific review criteria:
From stdin:

Options

Review Target

--uncommitted
boolean
Review uncommitted changes in the working directory.
--base
string
Review changes compared to a base branch (e.g., main, develop).
--commit
string
Review a specific commit by SHA or reference (e.g., abc123, HEAD~1).
--commit-title
string
Provide a commit title for context. Only valid with --commit.
PROMPT
string
Custom review instructions. Use - to read from stdin.

Output

-o, --output-last-message
path
Save the review report to a file.
--json
boolean
Output review events as JSON Lines.

Model & Execution

-m, --model
string
AI model to use for the review.
--color
string
Control colored output: auto, always, never.

Examples

Pre-Commit Review

Pull Request Review

Commit Review

Focused Reviews

CI/CD Integration

Pre-Commit Hook

Different Models

Review Output

By default, Codex outputs the review to stderr. Use -o to save to a file:
With --json, events are emitted as JSON Lines:

Exit Codes

  • 0 - Review completed successfully
  • 1 - Error occurred during review
The exit code indicates whether the review ran successfully, not whether the code passed review. Check the review content for findings.