From awesome-agent-tools
Invokes OpenAI Codex CLI for plan review, code review, and complex problem discussions. Supports model selection and multi-round conversations via /codex-cli <command> [options].
npx claudepluginhub awakehsh/awesome-agent-tools --plugin system-prompt-architectThis skill uses the workspace's default tool permissions.
> **๐จ MANDATORY MODEL RULE โ READ FIRST**:
Mandates invoking relevant skills via tools before any response in coding sessions. Covers access, priorities, and adaptations for Claude Code, Copilot CLI, Gemini CLI.
Share bugs, ideas, or general feedback.
๐จ 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.2.
- For
codex exec/codex exec review: use-m gpt-5.2- For
codex review(top-level): use-c model="gpt-5.2"(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)
- gpt-X-codex = Model name suffix (e.g., gpt-5.2-codex) indicating code-optimized variants
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.2"(NO-mflag exists)codex exec review: Can use-m gpt-5.2OR-c model="gpt-5.2"- 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
With custom model:
/codex-cli --model gpt-5.2-codex reviewplan # Use code-optimized variant
Default behavior:
gpt-5.2 (unless you specify --model)medium for short questions, high for everything elseConvenience shortcuts:
# These are equivalent:
/codex-cli ask "question"
/codex-cli "question" # Shorter form
# For code-heavy tasks, add --coding flag idea:
/codex-cli --model gpt-5.2-codex reviewplan
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.2
/codex-cli ask "question" # Will auto-use gpt-5.2
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.2 --skip-git-repo-check
โ ๏ธ CRITICAL RULE: Use the model the user specifies. If the user does NOT specify a model, default to
gpt-5.2. Forcodex exec/codex exec reviewuse-m gpt-5.2; for top-levelcodex reviewuse-c model="gpt-5.2". NEVER pick a different model on your own judgment.
Default: gpt-5.2 when no --model is specified by the user.
Available models (user must explicitly request via --model):
| Model | When to Use |
|---|---|
gpt-5.2 | Default - ALL tasks, ALWAYS |
gpt-5.2-codex | Code-optimized (only if user specifies --model gpt-5.2-codex) |
gpt-5.1-codex-max | Complex migrations (only if user specifies --model) |
gpt-5.1-codex-mini | Budget-conscious (only if user specifies --model) |
Note: Model names may change. If a model fails, fallback to
gpt-5.2. 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.2" -c model_reasoning_effort="high"
# Review changes vs a branch
codex review --base main -c model="gpt-5.2" -c model_reasoning_effort="high"
# Review a specific commit
codex review --commit HEAD~1 -c model="gpt-5.2" -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.2 \
-c model_reasoning_effort="high" \
--sandbox read-only \
--skip-git-repo-check
# Simple question
codex exec "Quick question: [...]" \
-m gpt-5.2 \
-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.2 -c model_reasoning_effort="high"
codex exec review --uncommitted -m gpt-5.2 -c model_reasoning_effort="high"
โ ๏ธ WARNING โ Flag Mismatch Will Cause Errors:
codex review -m gpt-5.2โ WILL FAIL (-mdoes not exist on top-levelcodex review)codex review -c model="gpt-5.2"โ CORRECT (use-cfor top-level review)codex exec review -m gpt-5.2โ 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 tool[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.