From awesome-agent-tools
Interact with OpenAI Codex CLI for plan review, code review, and complex problem discussion. Supports model selection and multi-round conversations.
How this skill is triggered — by the user, by Claude, or both
Slash command
/awesome-agent-tools:codex-cliThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
> **🚨 MANDATORY MODEL RULE — READ FIRST**:
🚨 MANDATORY MODEL RULE — READ FIRST:
- If the user specifies a model, use exactly that model. Respect the user's choice.
- If the user does NOT specify a model, default to
gpt-5.5.
- For
codex exec/codex exec review: use-m gpt-5.5- For
codex review(top-level): use-c model="gpt-5.5"(this command has NO-mflag)- NEVER pick a model on your own. Do NOT substitute o3, o4-mini, or any other model you think is "better" — that is the user's decision, not yours.
- The
-c model="..."syntax is REQUIRED for top-levelcodex review. It is NOT an override — it is the only way to set the model for that command.
Interact with OpenAI Codex CLI to leverage its powerful reasoning capabilities for plan review, code analysis, and complex problem discussions.
⚠️ Naming Clarification:
- "codex-cli" Skill = This AI agent skill (current document)
- Codex CLI = The OpenAI command-line tool being invoked (the program)
Throughout this document, "Codex CLI" refers to the command-line tool being called.
You MUST have these installed before using this skill:
Codex CLI - The OpenAI Codex command-line tool
# Check if installed
which codex
codex --version
OpenAI API Key - Required for authentication
Option A: Interactive login (Recommended - most secure)
# Interactive prompt - API key won't appear in shell history
codex login
# Follow the prompts to enter your API key
Option B: Environment variable
# Add to ~/.zshrc or ~/.bashrc (not in shell history)
export OPENAI_API_KEY="your-api-key-here"
source ~/.zshrc
# Then login
codex login --with-api-key <<< "$OPENAI_API_KEY"
Option C: File-based (if interactive not available)
# Create a temporary file with your key
echo "your-api-key" > /tmp/key.txt
codex login --with-api-key < /tmp/key.txt
rm /tmp/key.txt
# Or pipe directly (⚠️ key appears in shell history)
echo "YOUR_KEY" | codex login --with-api-key
Verify login:
codex login status
# Should show: "Logged in using an API key - sk-proj-***"
Active API Access - Your OpenAI account must have API access and credits
Security Best Practices
# Secure your config file (contains API key reference)
chmod 600 ~/.codex/config.toml
# Clear shell history if you used echo with API key
history -c # or close and reopen terminal
If not installed:
Important considerations when using this skill:
~/.codex/config.toml - ensure proper file permissions--sandbox read-only which prevents Codex from modifying filesRecommendation: Review OpenAI's data usage policies for API usage
⚠️ CRITICAL:
codex reviewandcodex exec reviewhave DIFFERENT flags!
codex review: Use-c model="gpt-5.5"(NO-mflag exists)codex exec review: Can use-m gpt-5.5OR-c model="gpt-5.5"- When in doubt, use
codex reviewwith-c— it always works.
codex review --help (top-level review)Usage: codex review [OPTIONS] [PROMPT]
Options:
-c, --config <key=value> Override config value (e.g., -c model="o3")
--uncommitted Review staged, unstaged, and untracked changes
--base <BRANCH> Review changes against the given base branch
--commit <SHA> Review the changes introduced by a commit
--title <TITLE> Optional commit title for the review summary
--enable <FEATURE> Enable a feature
--disable <FEATURE> Disable a feature
-h, --help Print help
codex exec --help (non-interactive execution)Usage: codex exec [OPTIONS] [PROMPT] [COMMAND]
Subcommands: resume, review, help
Options:
-m, --model <MODEL> Model the agent should use
-c, --config <key=value> Override config value
-s, --sandbox <MODE> Sandbox policy (read-only, workspace-write, danger-full-access)
-i, --image <FILE>... Attach image(s) to the prompt
--skip-git-repo-check Allow running outside a Git repository
--full-auto Low-friction sandboxed automatic execution
--ephemeral Run without persisting session files
--enable <FEATURE> Enable a feature
--disable <FEATURE> Disable a feature
-h, --help Print help
codex exec review --help (review via exec — inherits exec flags)Usage: codex exec review [OPTIONS] [PROMPT]
Options:
-m, --model <MODEL> Model the agent should use ← NOT available in top-level review!
-c, --config <key=value> Override config value
--uncommitted Review staged, unstaged, and untracked changes
--base <BRANCH> Review changes against the given base branch
--commit <SHA> Review the changes introduced by a commit
--title <TITLE> Optional commit title for the review summary
--skip-git-repo-check Allow running outside a Git repository
--full-auto Low-friction sandboxed automatic execution
-h, --help Print help
| Flag | codex review | codex exec review | codex exec "prompt" |
|---|---|---|---|
-m, --model | NO | YES | YES |
-c, --config | YES | YES | YES |
--uncommitted | YES | YES | NO |
--base | YES | YES | NO |
--commit | YES | YES | NO |
--sandbox | NO | NO | YES |
--skip-git-repo-check | NO | YES | YES |
Most common commands:
/codex-cli ask "your question" # Quick questions (medium reasoning)
/codex-cli reviewplan # Review implementation plans (high reasoning)
/codex-cli review --uncommitted # Review uncommitted changes
/codex-cli review --base main # Review changes vs branch
Default behavior:
gpt-5.5 (unless you specify --model)medium for short questions, high for everything elseLong-running calls (>60s expected) — use Bash background mode:
reasoning=high/xhigh, codex review --base <branch> on large diffs, full-repo auditsBash(run_in_background=true) so the main session stays responsive; poll progress with BashOutput or read the output fileask/single-file reviews — the realtime reasoning trace is more useful in foregroundConvenience shortcuts:
# These are equivalent:
/codex-cli ask "question"
/codex-cli "question" # Shorter form
Error: "command not found: codex"
# Codex CLI is not installed
# Solution: Install Codex CLI first (see Prerequisites above)
which codex # Should return path like /opt/homebrew/bin/codex
Error: "Authentication required" or "API key not found"
# Not logged in with OpenAI API key
# Solution: Login with your API key (use interactive method for security)
codex login # Interactive - recommended
# Or: codex login --with-api-key <<< "$OPENAI_API_KEY"
codex login status # Verify you're logged in
Error: "model 'xxx' does not exist"
# The model name changed or doesn't exist
# Solution: Use default gpt-5.5
/codex-cli ask "question" # Will auto-use gpt-5.5
Error: "Specify --uncommitted, --base, or --commit"
# Review command needs to know what to review
# Solutions:
/codex-cli review --uncommitted # Review unstaged changes
/codex-cli review --base main # Review vs main branch
/codex-cli review --commit HEAD~1 # Review specific commit
Error: "Permission denied" or "Must execute in main session"
Verify setup:
# Check installation
which codex && codex --version
# Check login status
codex login status
# Test basic functionality
codex exec "test" -m gpt-5.5 --skip-git-repo-check
⚠️ CRITICAL RULE: Use the model the user specifies. If the user does NOT specify a model, default to
gpt-5.5. Forcodex exec/codex exec reviewuse-m gpt-5.5; for top-levelcodex reviewuse-c model="gpt-5.5". NEVER pick a different model on your own judgment.
Default: gpt-5.5 when no --model is specified by the user.
Available models (user must explicitly request via --model):
| Model | When to Use |
|---|---|
gpt-5.5 | Default - ALL tasks, ALWAYS |
Note: Model names may change. If a model fails, fallback to
gpt-5.5. NEVER fallback to o-series models.
Reasoning effort:
mediumhighxhigh (use -c model_reasoning_effort="xhigh")Multiple review rounds:
For very long plans (>2000 chars):
Always use these exact forms. Do NOT mix flags between commands.
codex review — simplest and most reliable)# Review uncommitted changes
codex review --uncommitted -c model="gpt-5.5" -c model_reasoning_effort="high"
# Review changes vs a branch
codex review --base main -c model="gpt-5.5" -c model_reasoning_effort="high"
# Review a specific commit
codex review --commit HEAD~1 -c model="gpt-5.5" -c model_reasoning_effort="high"
codex exec — supports -m and --sandbox)# Plan review
codex exec "Review this implementation plan: [plan content]
Evaluate: technical soundness, risks, missing considerations, approval status" \
-m gpt-5.5 \
-c model_reasoning_effort="high" \
--sandbox read-only \
--skip-git-repo-check
# Simple question
codex exec "Quick question: [...]" \
-m gpt-5.5 \
-c model_reasoning_effort="medium" \
--sandbox read-only \
--skip-git-repo-check
-m flag)# Only use this form if you specifically need -m instead of -c model=
codex exec review --base main -m gpt-5.5 -c model_reasoning_effort="high"
codex exec review --uncommitted -m gpt-5.5 -c model_reasoning_effort="high"
⚠️ WARNING — Flag Mismatch Will Cause Errors:
codex review -m gpt-5.5→ WILL FAIL (-mdoes not exist on top-levelcodex review)codex review -c model="gpt-5.5"→ CORRECT (use-cfor top-level review)codex exec review -m gpt-5.5→ CORRECT (-mworks onexec review)- See the CLI Flag Reference section above for the full compatibility matrix.
Different commands have different ways of accessing your codebase:
review / exec review
git diff as context--sandbox read-only modereviewplan
Plan content must be included in the prompt
To provide code context, you have two options:
Option 1: Reference file paths in plan
Plan modifies these files:
- src/components/Button.tsx (lines 45-60)
- src/utils/validate.ts (add validateEmail function)
Option 2: Include code snippets in prompt
Current implementation (Button.tsx):
[code snippet]
Planned changes:
[improved code]
Codex CLI can read files in current working directory under --sandbox read-only
ask
Note: Codex CLI uses
--sandbox read-onlyby default, which allows reading files in the current directory but prevents writes.
After each Codex interaction:
=== CODEX FEEDBACK [Round N/MAX] ===
Model: <model name>
Reasoning: <effort level>
Status: APPROVED / NEEDS REVISION
[Codex full response]
=== END CODEX FEEDBACK ===
| Error | Resolution |
|---|---|
codex command fails | Check Codex installation: brew install openai-codex |
| Response timeout (3min) | Report and offer retry option |
| Plan file not found | Ask user to specify location |
| Permission denied | Must execute in main session, background Task not supported |
Task(...) — subagents cannot surface Bash permission prompts and will hangBash(run_in_background=true) for long-running calls. See "Long-running calls" under Quick Start for thresholds.[Round N/MAX]Note: Model availability and naming may change over time. If links are outdated or models fail, check your local Codex CLI configuration at
~/.codex/config.tomlor consult the latest OpenAI documentation.
Guides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.
npx claudepluginhub awakehsh/awesome-agent-tools --plugin handoff