Codex CLI: The Definitive Technical Reference
# Master Codex CLI with this complete 2026 reference. Covers config.toml, sandboxing, AGENTS.md, MCP protocol, plan mode, and cloud tasks.
Codex CLI: The Definitive Technical Reference
TL;DR: Codex is a multi-surface coding agent that reads your codebase, runs commands in an OS-level sandbox, patches files, and delegates tasks to the cloud. Master five core systems (config.toml, sandbox/approval model, AGENTS.md, MCP, and skills) and Codex becomes a force multiplier. Use profiles for context-switching,
/compactto manage the 272K token budget, and AGENTS.md for cross-tool project instructions that work in Codex, Cursor, Amp, and more.
Codex operates as a multi-surface coding agent, not a chatbot that writes code. The CLI reads your codebase, executes commands in a sandbox, patches files, connects to external services via MCP, and delegates long-running tasks to the cloud. It runs locally but thinks globally; the same intelligence powers four distinct surfaces depending on how you work.
The difference between casual and effective Codex usage comes down to five core systems. Master these and Codex becomes a force multiplier:
- Configuration system: controls behavior via
config.toml - Sandbox & approval model: gates what Codex can do
- AGENTS.md: defines project-level operating contracts
- MCP protocol: extends capabilities to external services
- Skills system: packages reusable domain expertise
I spent months running Codex alongside Claude Code across production codebases, CI/CD pipelines, and team workflows. This guide distills that experience into the complete reference I wish existed when I started. Every feature includes actual syntax, real configuration examples, and the edge cases that trip up experienced users.
Stability note: Features marked
[EXPERIMENTAL]are subject to change between releases. Codex Cloud and the MCP command group are both experimental as of v0.104.0. Core CLI, sandbox, AGENTS.md, config.toml, and Skills are stable.
Key Takeaways
- Four surfaces, one brain: CLI, desktop app, IDE extension, and cloud tasks all share the same GPT-5.x-Codex intelligence, so pick the surface that fits your workflow.
- OS-level sandboxing: Codex enforces filesystem and network restrictions at the kernel level (Seatbelt on macOS, Landlock + seccomp on Linux), not inside containers.
- AGENTS.md is cross-tool: Your project instructions work in Codex, Cursor, Copilot, Amp, Jules, Gemini CLI, Windsurf, Cline, Aider, Zed, and 60,000+ open source projects. Write once, use everywhere.
- Profiles save context-switching overhead: Define named config presets (
fast,careful,auto) and switch between them with--profile. - 272K input context fills fast: Use
/compact, focused prompts, and@filereferences to manage token budgets proactively.
How to Use This Guide
This is a 2,500+ line reference — start where your experience level fits:
| Experience | Start Here | Then Explore |
|---|---|---|
| New to Codex | Installation → Quick Start → Mental Model | Configuration, Sandbox |
| Daily user | AGENTS.md, Skills, Plan Mode | MCP, Hooks |
| Team lead / enterprise | Enterprise Deployment → Best Practices | Decision Frameworks, Workflow Recipes |
| Migrating from another tool | Migration Guide | Decision Frameworks |
The Quick Reference Card at the end provides a scannable summary of all major commands.
How Codex Works: The Mental Model
Before diving into features, understand how Codex’s architecture shapes everything you do with it. The system operates across four surfaces backed by a shared intelligence layer:
┌─────────────────────────────────────────────────────────┐
│ CODEX SURFACES │
├─────────────────────────────────────────────────────────┤
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌────────┐ │
│ │ CLI │ │ Desktop │ │ IDE │ │ Cloud │ │
│ │ Terminal │ │ App │ │Extension │ │ Tasks │ │
│ └──────────┘ └──────────┘ └──────────┘ └────────┘ │
│ Local exec Multi-task Editor-native Async │
│ + scripting + worktrees + inline edits detached │
├─────────────────────────────────────────────────────────┤
│ EXTENSION LAYER │
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
│ │ MCP │ │ Skills │ │ Apps │ │ Search │ │
│ └─────────┘ └─────────┘ └─────────┘ └─────────┘ │
│ External tools, reusable expertise, ChatGPT │
│ connectors, web search (cached + live) │
├─────────────────────────────────────────────────────────┤
│ SECURITY LAYER │
│ ┌─────────────────────────────────────────────────┐ │
│ │ Sandbox (Seatbelt / Landlock / seccomp) │ │
│ │ + Approval Policy (untrusted → never) │ │
│ └─────────────────────────────────────────────────┘ │
│ OS-level filesystem + network restrictions │
├─────────────────────────────────────────────────────────┤
│ CORE LAYER │
│ ┌─────────────────────────────────────────────────┐ │
│ │ GPT-5.x-Codex Intelligence │ │
│ │ Tools: Shell, Patch, Read, Web Search │ │
│ └─────────────────────────────────────────────────┘ │
│ Shared model across all surfaces; costs tokens │
└─────────────────────────────────────────────────────────┘
Core Layer: The GPT-5.x-Codex model family powers everything. As of v0.104.0, gpt-5.3-codex is the default model with a 272K-token input context window (128K output, 400K total budget).35 It reads files, writes patches, executes shell commands, and reasons about your codebase. When context fills, Codex compacts the conversation to free space. This layer costs tokens.
Security Layer: Every command Codex runs passes through an OS-level sandbox. On macOS, Apple’s Seatbelt framework enforces kernel-level restrictions. On Linux, Landlock + seccomp filter filesystem and syscall access. The sandbox operates at the kernel level, not inside containers. The approval policy then decides when to ask for human confirmation.
Extension Layer: MCP connects external services (GitHub, Figma, Sentry). Skills package reusable workflows that Codex loads on demand. Apps connect to ChatGPT connectors. Web search adds real-time context from the internet.
Surface Layer: CLI for terminal power users and automation. Desktop app for multi-threaded project management. IDE extension for edit-compile-test loops. Cloud for async tasks that run independently.
The key insight: Most users only use one surface. Power users use all four: Cloud for long-running tasks, CLI for deterministic repo operations, IDE extension for tight coding loops, and the desktop app for planning and coordination.
Table of Contents
- How Do I Install Codex?
- Quick Start: Your First Session
- Core Interaction Surfaces
- Configuration System Deep Dive
- Which Model Should I Choose?
- What Does Codex Cost?
- Decision Frameworks
- How Does the Sandbox & Approval System Work?
- How Does AGENTS.md Work?
- Hooks
- What Is MCP (Model Context Protocol)?
- JavaScript REPL Runtime
- What Are Skills?
- Plan Mode & Collaboration
- Memory System
- Session Management
- Non-Interactive Mode (codex exec)
- Codex Cloud & Background Tasks
- The Codex Desktop App
- GitHub Action & CI/CD
- Codex SDK
- Performance Optimization
- How Do I Debug Issues?
- Enterprise Deployment
- Best Practices & Anti-Patterns
- Workflow Recipes
- Migration Guide
- Quick Reference Card
- Changelog
- References
How Do I Install Codex?
Package Managers
# npm (recommended)
npm install -g @openai/codex
# Homebrew (macOS)
brew install --cask codex
# Upgrade to latest
npm install -g @openai/codex@latest
Binary Downloads
For environments without npm or Homebrew, download platform-specific binaries from GitHub Releases1:
| Platform | Binary |
|---|---|
| macOS Apple Silicon | codex-aarch64-apple-darwin.tar.gz |
| macOS x86_64 | codex-x86_64-apple-darwin.tar.gz |
| Linux x86_64 | codex-x86_64-unknown-linux-musl.tar.gz |
| Linux arm64 | codex-aarch64-unknown-linux-musl.tar.gz |
System Requirements
- macOS: Apple Silicon or Intel (full sandbox support via Seatbelt)
- Linux: x86_64 or arm64 (sandbox via Landlock + seccomp)
- Windows: Native sandbox with restricted tokens (promoted from experimental in v0.100.0). WSL also supported2
Authentication
codex login # Interactive OAuth (recommended)
codex login --device-auth # OAuth device code flow (headless)
codex login --with-api-key # API key from stdin
codex login status # Check auth state (exit 0 = logged in)
codex logout # Clear stored credentials
Two authentication paths:
- ChatGPT Account (recommended): Sign in with your existing Plus, Pro, Team, Business, Edu, or Enterprise subscription. Full feature access including cloud tasks.
- API Key: Set via
CODEX_API_KEYenvironment variable orcodex login --with-api-key. Some features (cloud threads) may be unavailable.
Expert tip: Credential storage is configurable via
cli_auth_credentials_storeinconfig.toml. Options:file(default),keyring(OS keychain), orauto(keyring if available, file fallback).
Shell Completions
# Generate completions for your shell
codex completion bash > /etc/bash_completion.d/codex
codex completion zsh > ~/.zsh/completions/_codex
codex completion fish > ~/.config/fish/completions/codex.fish
Verify Installation
codex --version
# Codex CLI v0.104.0
Quick Start: Your First Session
Get from zero to productive in 5 minutes.
1. Install and authenticate:
npm i -g @openai/codex # Install
codex login # Log in with your OpenAI account
2. Navigate to a project:
cd ~/my-project # Any git repo works
3. Start Codex:
codex
You’ll see the interactive TUI. Codex reads your project structure automatically.
4. Ask a question:
> What does this project do? Summarize the architecture.
Codex reads key files and explains the codebase. No changes are made in the default suggest mode.
5. Make a change:
> Add input validation to the login endpoint
Codex proposes edits as a diff. Review and approve with y, or reject with n.
6. Use a slash command:
> /plan Refactor the database layer to use connection pooling
Codex creates a plan without executing. Review the plan, then approve to begin execution.
7. Check your work:
> /diff
See all changes Codex has made in the current session.
What’s next:
- Set up AGENTS.md with project instructions (see How Does AGENTS.md Work?)
- Configure a profile for your workflow (see Profiles)
- Try codex exec for non-interactive automation (see Non-Interactive Mode)
Core Interaction Surfaces
Codex provides four distinct interfaces backed by the same intelligence. Each surface optimizes for a different workflow pattern.
1. Interactive CLI (Terminal UI)
codex # Launch TUI
codex "fix the failing tests" # Launch with initial prompt
codex -m gpt-5.3-codex # Specify model
codex --full-auto # Workspace-write sandbox + on-request approval
The terminal UI is a full-screen application with:
- Composer: Type prompts, attach files with
@, run shell commands with!prefix - Output pane: Streaming model responses, tool calls, and command output
- Status bar: Model, token usage, git branch, sandbox mode
Key TUI shortcuts:
| Shortcut | Action |
|---|---|
@ |
Fuzzy file search (attach to context) |
!command |
Run shell command directly |
Ctrl+G |
Open external editor ($VISUAL / $EDITOR) |
Enter (while running) |
Inject new instructions mid-turn |
Esc twice |
Edit previous messages |
| Arrow keys | Navigate draft history |
Slash commands available in the TUI:
| Command | Description |
|---|---|
/quit or /exit |
Exit the CLI |
/new |
Start new conversation in same session |
/resume |
Resume a saved conversation |
/fork |
Fork current conversation into new thread |
/model |
Switch model and reasoning effort |
/compact |
Summarize conversation to free tokens |
/diff |
Show git diff including untracked files |
/review |
Code review of working tree |
/plan |
Enter plan mode |
/mention |
Attach file to conversation |
/init |
Generate AGENTS.md scaffold |
/status |
Session config and token usage |
/permissions |
Set approval policy |
/personality |
Communication style (friendly/pragmatic/none) |
/mcp |
List configured MCP tools |
/apps |
Browse ChatGPT connectors |
/ps |
Show background terminals |
/skills |
Access and invoke skills |
/config |
Print effective config values and sources |
/statusline |
Configure TUI footer |
/feedback |
Send logs to Codex maintainers |
/logout |
Sign out |
2. Codex Desktop App (macOS)
codex app # Launch desktop app (auto-installs if missing)
The desktop app adds capabilities the CLI doesn’t have:
- Multi-tasking: Run multiple parallel agents across different projects simultaneously
- Git worktree isolation: Each thread works on an isolated copy of your repo
- Inline diff review: Stage, revert, and commit changes without leaving the app
- Integrated terminal: Per-thread terminal for running commands
- Conversation forking: Branch conversations to explore alternatives
- Floating pop-out windows: Detach conversations into portable windows
- Automations: Schedule recurring tasks (issue triage, CI monitoring, alert response)
When to use the app vs CLI: Use the desktop app when you’re coordinating multiple workstreams or need visual diff review. Use the CLI when you want terminal composability, scripting, or CI/CD integration.
3. IDE Extension (VS Code, Cursor, Windsurf)
The Codex IDE extension integrates directly into your editor:
- Agent mode by default: Reads files, makes edits, runs commands
- Inline edits: Context-aware suggestions in your active files
- Shared sessions: Sessions sync between CLI and IDE extension
- Same authentication: Sign in with ChatGPT account or API key
Install from the VS Code Marketplace or Cursor/Windsurf extension stores.3
4. Codex Cloud [EXPERIMENTAL]
Cloud tasks run asynchronously in OpenAI-managed environments:
- Fire and forget: Queue tasks that run independently of your local machine
- Parallel execution: Run multiple cloud tasks simultaneously
- PR creation: Codex creates pull requests from completed work
- Local apply: Pull cloud results into your local repo with
codex apply <TASK_ID>
codex cloud list # List recent cloud tasks
codex apply <TASK_ID> # Apply diff from a specific cloud task
Cloud tasks are also accessible from chatgpt.com/codex.4
Configuration System Deep Dive
Codex uses TOML for configuration. Understanding the precedence hierarchy is critical because it determines which settings win when they conflict.
Precedence (Highest to Lowest)
- Session overrides (highest): CLI flags (
--model,--sandbox,--ask-for-approval,--search,--enable/--disable,--profile) and-c key=valueoverrides - Project config (
.codex/config.toml, discovered from CWD upward to project root; closest directory wins) - User config (
$CODEX_HOME/config.toml, defaults to~/.codex/config.toml) - System config (
/etc/codex/config.tomlon Unix) - Built-in defaults (lowest)
requirements.tomlacts as a policy constraint layer that restricts what values users can select after normal config merging. See Enterprise Deployment.
Config File Locations
| Scope | Path | Purpose |
|---|---|---|
| User | ~/.codex/config.toml |
Personal defaults |
| Project | .codex/config.toml |
Per-repo overrides |
| System | /etc/codex/config.toml |
Machine-wide defaults |
| Managed | /etc/codex/requirements.toml |
Admin-enforced policy constraints |
Expert tip: The
CODEX_HOMEenvironment variable overrides the default~/.codexdirectory. Useful for CI/CD or multi-account setups.
Complete Configuration Reference
# ~/.codex/config.toml — annotated reference
# ─── Model Selection ───────────────────────────────────
model = "gpt-5.3-codex" # Default model (272K input context)
model_provider = "openai" # Provider (openai, oss, or custom provider id)
model_context_window = 272000 # Token count available to active model (override)
model_auto_compact_token_limit = 200000 # Threshold triggering automatic history compaction
model_reasoning_effort = "medium" # minimal|low|medium|high|xhigh (model-dependent)
model_reasoning_summary = "auto" # auto|concise|detailed|none
model_verbosity = "medium" # low|medium|high
personality = "pragmatic" # none|friendly|pragmatic
review_model = "gpt-5.2-codex" # Model for /review command
oss_provider = "lmstudio" # lmstudio|ollama (used with --oss)
# ─── Sandbox & Approval ───────────────────────────────
sandbox_mode = "workspace-write" # read-only|workspace-write|danger-full-access
approval_policy = "on-request" # untrusted|on-failure|on-request|never
[sandbox_workspace_write]
writable_roots = [] # Additional writable paths
network_access = false # Allow outbound network
exclude_tmpdir_env_var = false # Exclude $TMPDIR from sandbox
exclude_slash_tmp = false # Exclude /tmp from sandbox
# ─── Web Search ────────────────────────────────────────
web_search = "live" # Web search mode (constrained by allowed modes)
# ─── Instructions ──────────────────────────────────────
developer_instructions = "" # Additional injected instructions
model_instructions_file = "" # Custom instructions file path
compact_prompt = "" # Custom history compaction prompt
# ─── Shell Environment ─────────────────────────────────
allow_login_shell = false # Allow login shell semantics (loads .profile/.zprofile)
[shell_environment_policy]
inherit = "all" # all|core|none
ignore_default_excludes = false # Set true to keep KEY/SECRET/TOKEN vars
exclude = [] # Glob patterns to exclude
set = {} # Explicit overrides
include_only = [] # Whitelist patterns
# ─── Authentication ────────────────────────────────────
cli_auth_credentials_store = "file" # file|keyring|auto
forced_login_method = "chatgpt" # chatgpt|api
mcp_oauth_callback_port = 0 # Fixed port for MCP OAuth callback (0 = random)
mcp_oauth_credentials_store = "auto" # auto|file|keyring
# ─── History & Storage ─────────────────────────────────
[history]
persistence = "save-all" # save-all|none
max_bytes = 0 # Cap size (0 = unlimited)
tool_output_token_limit = 10000 # Max tokens per tool output
log_dir = "" # Custom log directory
# ─── UI & Display ──────────────────────────────────────
file_opener = "vscode" # vscode|vscode-insiders|windsurf|cursor|none
hide_agent_reasoning = false
show_raw_agent_reasoning = false
check_for_update_on_startup = true
[tui]
notifications = false # Enable notifications
notification_method = "auto" # auto|osc9|bel
animations = true
show_tooltips = true
alternate_screen = "auto" # auto|always|never
status_line = ["model", "context-remaining", "git-branch"]
# ─── Project Trust ─────────────────────────────────────
project_doc_max_bytes = 32768 # Max AGENTS.md size (32 KiB)
project_doc_fallback_filenames = [] # Alternative instruction filenames
project_root_markers = [".git"] # Project root detection
# ─── Feature Flags ─────────────────────────────────────
# Use `codex features list` for current names/stages/defaults.
[features]
shell_tool = true # Shell command execution (stable)
collaboration_modes = true # Plan mode (stable)
personality = true # Personality selection (stable)
request_rule = true # Smart approvals (stable)
unified_exec = true # PTY-backed exec (stable)
shell_snapshot = true # Shell env snapshots (stable)
command_attribution = true # Codex co-author in commits (v0.103.0+)
multi_agent = false # Enable multi-agent collaboration tools (v0.102.0+)
apply_patch_freeform = false # Expose freeform apply_patch tool
apps = false # ChatGPT Apps/connectors (experimental)
child_agents_md = false # AGENTS.md guidance (experimental)
runtime_metrics = false # Runtime summary in turns
search_tool = false # Enable search_tool_bm25 for Apps discovery
# ─── Multi-Agent Roles (v0.102.0+) ───────────────────
[agents]
max_threads = 4 # Maximum concurrent agent threads
[agents.explorer]
description = "Read-only codebase navigator"
config_file = "~/.codex/profiles/explorer.toml"
# ─── Notifications ────────────────────────────────────
notify = ["terminal-notifier", "-title", "Codex"] # Command for notifications
# ─── Per-Project Overrides ────────────────────────────
[projects."/absolute/path/to/repo"]
trust_level = "trusted" # Per-project trust override
Profiles
Named configuration presets for different work modes:
# Define profiles in ~/.codex/config.toml
[profiles.fast]
model = "gpt-5.1-codex-mini"
model_reasoning_effort = "low"
approval_policy = "on-request"
sandbox_mode = "workspace-write"
personality = "pragmatic"
[profiles.careful]
model = "gpt-5.3-codex"
model_reasoning_effort = "xhigh"
approval_policy = "untrusted"
sandbox_mode = "read-only"
[profiles.auto]
model = "gpt-5.3-codex"
model_reasoning_effort = "medium"
approval_policy = "never"
sandbox_mode = "workspace-write"
Activate a profile:
codex --profile fast "quick refactor"
codex --profile careful "security audit"
codex -p auto "fix CI"
Expert tip: Set a default profile with
profile = "fast"at the top level of your config. Override per-session with--profile.
Custom Model Providers
Connect to Azure, local models, or proxy services:
[model_providers.azure]
name = "Azure OpenAI"
base_url = "https://YOUR_PROJECT.openai.azure.com/openai"
wire_api = "responses"
query_params = { api-version = "2025-04-01-preview" }
env_key = "AZURE_OPENAI_API_KEY"
[model_providers.ollama]
name = "Ollama (Local)"
base_url = "http://localhost:11434/v1"
wire_api = "chat"
Warning: The
chat/completionswire API (wire_api = "chat") was deprecated for OpenAI-hosted models, with OpenAI announcing removal in February 2026.36 Local providers (Ollama, LM Studio) may still accept this format. For OpenAI endpoints, usewire_api = "responses"instead.
Use local models with the --oss flag:
codex --oss "explain this function" # Uses default OSS provider
codex --oss --local-provider lmstudio "explain" # Explicit LM Studio
codex --oss --local-provider ollama "explain" # Explicit Ollama
Or set in config:
model_provider = "oss"
oss_provider = "lmstudio" # or "ollama"
Inline Config Overrides
Override any config value from the command line:
codex -c model="gpt-5.2-codex" "refactor the API"
codex -c 'sandbox_workspace_write.network_access=true' "install dependencies"
codex -c model_reasoning_effort="xhigh" "debug the race condition"
Which Model Should I Choose?
Available Models (February 2026)
| Model | Input / Total Context | Default Reasoning | Best For |
|---|---|---|---|
| gpt-5.3-codex | 272K / 400K | medium |
Default flagship: coding + reasoning unified |
| gpt-5.3-codex-spark | 128K / 128K | high |
Real-time pairing, rapid interactive iteration |
| gpt-5.2-codex | 272K / 400K | medium |
Long-horizon refactors, migrations, legacy code |
| gpt-5.1-codex-mini | 272K / 400K | medium |
Quick tasks, cost-sensitive work, high-volume CI |
The exact model list varies by account and rollout. Check your local cache:
~/.codex/models_cache.json.
Model Selection Flowchart
Is this a quick fix or simple question?
├─ Yes → gpt-5.1-codex-mini (fastest, cheapest)
└─ No
├─ Do you need real-time pairing speed?
│ ├─ Yes → gpt-5.3-codex-spark (interactive, lower latency)
│ └─ No
│ ├─ Is this a multi-file refactor or migration?
│ │ ├─ Yes → gpt-5.2-codex (272K context, strong at long tasks)
│ │ └─ No → gpt-5.3-codex (default, best overall)
└─ Still unsure? → gpt-5.3-codex
Reasoning Effort
Control how much the model “thinks” before responding:
| Level | Behavior | When to Use |
|---|---|---|
minimal |
Minimal reasoning (GPT-5 models only) | Trivial tasks, quick lookups |
low |
Brief reasoning | Standard coding tasks, formatting |
medium |
Balanced (default) | Most development work |
high |
Extended reasoning | Complex bugs, architecture |
xhigh |
Maximum reasoning | Security audits, deep analysis |
Supported levels are model-dependent.
minimalis only available for GPT-5 models. Not all models support every level.
codex -c model_reasoning_effort="xhigh" "find the race condition"
Expert tip:
xhighreasoning can use 3-5x more tokens thanmediumfor the same prompt. Reserve it for genuinely hard problems where the extra thinking pays off.
Model Switching
Switch models mid-session with the /model slash command, or set per-run via --model / -m:
codex -m gpt-5.3-codex-spark "pair with me on this component"
What Does Codex Cost?
See also Model Selection for capabilities and Decision Frameworks for choosing the right model per task.
Access via ChatGPT Plans
Codex availability depends on your ChatGPT plan and organization settings:53
| Plan | Price | Codex Access | Rate Limits (5-hour window) |
|---|---|---|---|
| Free / Go | $0 / $5 | Limited time promotional access | Low |
| Plus | $20/mo | Local CLI + cloud tasks (2x rate limits) | 45-225 local msgs, 10-60 cloud tasks |
| Pro | $200/mo | Priority processing, GPT-5.3-Codex-Spark (2x rate limits) | 300-1500 local msgs, 50-400 cloud tasks |
| Business | $30/user/mo | Team allocation, larger cloud VMs, SAML SSO (2x rate limits) | 45-225 local msgs, 10-60 cloud tasks |
| Enterprise / Edu | Contact sales | Custom allocation, admin controls, audit logs | Scales with credits |
| API Key | Usage-based | CLI, SDK, IDE only (no cloud features) | Token-based |
Promotional rates: Free/Go access and 2x rate limits for paid plans coincided with the Codex Desktop App launch (February 2026). These higher limits apply across all surfaces — app, CLI, IDE, and cloud. OpenAI has not announced an end date.17
Credit Costs
Codex operations consume credits from your plan allocation:
| Operation | Approx. Credits | Notes |
|---|---|---|
| Local message (GPT-5.3-Codex) | ~5 | Standard flagship model |
| Local message (GPT-5.1-Codex-Mini) | ~1 | 4x more messages per credit budget |
| Cloud task | ~25 | Runs in OpenAI-managed environment |
| Code review (per PR) | ~25 | Via /review or cloud review |
Enterprise and Edu plans scale credits with contract allocation. Check
/statusin the TUI for current usage.
API Billing
When using Codex through the API, OpenAI bills usage per token under standard OpenAI API pricing for the selected model (plus any applicable prompt-caching discounts). Check the official API pricing page for current rates.21
Cost Optimization Strategies
- Use profiles: Create a
fastprofile withgpt-5.1-codex-miniandmodel_reasoning_effort = "low"for routine tasks - Reserve high reasoning: Only use
xhighfor genuinely hard problems, as it costs 3-5x more tokens - Use
--ephemeral: Skip session persistence in CI/CD to reduce overhead - Minimize reasoning summaries: Set
model_reasoning_summary = "none"when you don’t need explanations - Batch with exec mode:
codex execavoids TUI overhead for automation workflows - Monitor usage: Check
/statusin the TUI and your org billing dashboards
Real-World Cost Examples
Representative API costs for common tasks (gpt-5.3-codex at standard pricing, medium reasoning):
| Task | Input Tokens | Output Tokens | Approx. Cost |
|---|---|---|---|
| Explain a 500-line module | ~15K | ~2K | ~$0.25 |
| Fix a failing test (1-2 files) | ~30K | ~5K | ~$0.50 |
| Add a new API endpoint with tests | ~60K | ~15K | ~$1.10 |
| Refactor auth module (10 files) | ~120K | ~30K | ~$2.25 |
Full repo audit via codex exec |
~200K | ~20K | ~$3.00 |
| Cloud task: triage 20 open issues | ~250K | ~40K | ~$4.50 |
Costs vary by reasoning effort, caching, and conversation length. Use
gpt-5.1-codex-minifor routine tasks to reduce costs by ~40-60%. Cached input tokens are billed at a discount.
Hidden Token Overhead
Every tool call adds tokens beyond your visible prompt:
| Overhead Source | Approx. Cost |
|---|---|
| System prompt + AGENTS.md | ~2-5K tokens per turn (loaded once, cached thereafter) |
| Tool definitions | ~500 tokens per registered tool |
File reads (@file) |
Full file content tokens |
| MCP tool definitions | ~200-500 tokens per connected server |
| Reasoning traces | Variable; xhigh can add 3-5x overhead |
Expert tip: Monitor your actual usage via
/statusin the TUI. The token count includes all overhead, not just your visible messages. If costs surprise you, check how many MCP servers are connected — each adds tool definitions to every API call.
Team Cost Management
| Team Size | Recommended Config | Expected Monthly Cost |
|---|---|---|
| Solo developer | Default model, medium reasoning |
$20-80 |
| Small team (3-5) | Profiles (fast/careful), code reviews via codex exec |
$200-500 |
| Medium team (10-20) | Enterprise plan, requirements.toml limits, CI integration |
$1,000-3,000 |
| Large org (50+) | Enterprise with admin controls, audit logging, allocated budgets | Custom pricing |
Strategies for team cost control:
- Set requirements.toml to enforce model and reasoning effort limits organization-wide
- Use gpt-5.1-codex-mini for CI/CD — automated pipelines rarely need maximum reasoning
- Profile-based budgeting — define ci, review, and dev profiles with appropriate cost ceilings
- Monitor via OpenTelemetry — enterprise deployments can export usage telemetry to existing observability stacks
Decision Frameworks
When to Use Each Surface
| Scenario | Best Surface | Why |
|---|---|---|
| Quick bug fix | CLI | Fast, focused, scriptable |
| Multi-file refactor | CLI or App | CLI for deterministic patches; App for visual diff review |
| Exploring unfamiliar code | CLI | Terminal composability, grep/find integration |
| Parallel workstreams | Desktop App | Worktree isolation, multi-task management |
| Active file editing | IDE Extension | Inline edits, tight compile-test loop |
| Long-running migration | Cloud | Runs independently, creates PR when done |
| CI/CD automation | codex exec |
Non-interactive, JSON output, scriptable |
| Code review | CLI or App | /review command with presets |
| Team onboarding | Desktop App | Visual, guided, less terminal knowledge needed |
When to Use Each Sandbox Mode
| Scenario | Mode | Approval | Why |
|---|---|---|---|
| Exploring unknown code | read-only |
untrusted |
Maximum safety, can’t break anything |
| Daily development | workspace-write |
on-request |
Good balance of speed and safety |
| Trusted automation | workspace-write |
never |
Fast, uninterrupted, sandboxed |
| System administration | danger-full-access |
on-request |
Needs full access but human approval |
| CI/CD pipeline | workspace-write |
never |
Automated, sandboxed to workspace |
When to Use Each Reasoning Level
| Task Type | Reasoning | Model | Profile |
|---|---|---|---|
| Formatting, linting | low |
gpt-5.1-codex-mini |
fast |
| Standard coding | low-medium |
gpt-5.3-codex |
default |
| Complex debugging | high |
gpt-5.3-codex |
careful |
| Security audit | xhigh |
gpt-5.3-codex |
careful |
| Rapid prototyping | low |
gpt-5.3-codex-spark |
fast |
| Migration/refactor | medium-high |
gpt-5.2-codex |
default |
Plan Mode vs Direct Execution
Will Codex need to change more than 3 files?
│
├── YES → Use Plan Mode (/plan)
│ Codex designs the approach BEFORE making changes.
│ You review and approve the plan.
│ Best for: refactors, new features, migrations
│
└── NO → Is the change well-defined?
│
├── YES → Direct execution
│ Just describe the task. Codex executes immediately.
│ Best for: bug fixes, small features, test additions
│
└── NO → Use Plan Mode (/plan)
Let Codex explore and propose an approach first.
Best for: unfamiliar codebases, ambiguous requirements
Steer Mode: Enter vs Tab
| Situation | Use Enter | Use Tab |
|---|---|---|
| Codex is about to make a mistake | Send correction immediately | |
| You have a follow-up task | Queue it for after current work | |
| Codex picked the wrong file | Send redirect immediately | |
| You want to add scope | Queue the addition | |
| Urgent priority change | Send new priority immediately | |
| Non-critical context | Queue it — no rush |
Rule of thumb: Enter = “stop, listen to this now.” Tab = “when you’re done, also do this.”
Desktop App vs CLI
How do you prefer to work?
│
├── Terminal-first → Use CLI
│ │
│ ├── Single focused task → codex (interactive TUI)
│ ├── Scripted automation → codex exec (non-interactive)
│ └── Quick one-shot → codex exec "prompt" -o result.txt
│
└── Visual/multi-project → Use Desktop App
│
├── Multiple parallel tasks → Multi-thread with worktree isolation
├── Visual diff review → Built-in Git diff viewer
├── Scheduled automation → Automations tab
└── Voice-driven → Ctrl+M for voice dictation
| Capability | CLI | Desktop App |
|---|---|---|
| Interactive sessions | Yes | Yes |
| Parallel agents | Manual (multiple terminals) | Built-in (worktree isolation) |
| Diff review | /diff (text) |
Visual inline diffs |
| Automations | Cron + codex exec |
GUI scheduler |
| Voice input | No | Yes (Ctrl+M) |
| CI/CD integration | codex exec + GitHub Action |
No |
| Session sync | Yes | Yes (shared with CLI) |
Which Profile?
Match your task to a pre-configured profile:
| Task Type | Profile | Key Settings |
|---|---|---|
| Quick questions, formatting | fast |
model = "gpt-5.1-codex-mini", model_reasoning_effort = "low" |
| Daily development | (default) | model = "gpt-5.3-codex", model_reasoning_effort = "medium" |
| Architecture, security | careful |
model = "gpt-5.3-codex", model_reasoning_effort = "xhigh" |
| Real-time pairing | pair |
model = "gpt-5.3-codex-spark", model_reasoning_effort = "high" |
| CI/CD automation | ci |
model = "gpt-5.1-codex-mini", model_reasoning_effort = "low", sandbox_mode = "workspace-write" |
config.toml setup:
# Default profile
profile = "default"
[profiles.fast]
model = "gpt-5.1-codex-mini"
model_reasoning_effort = "low"
[profiles.careful]
model = "gpt-5.3-codex"
model_reasoning_effort = "xhigh"
[profiles.pair]
model = "gpt-5.3-codex-spark"
model_reasoning_effort = "high"
[profiles.ci]
model = "gpt-5.1-codex-mini"
model_reasoning_effort = "low"
sandbox_mode = "workspace-write"
Switch profiles per-session: codex --profile careful
How Does the Sandbox & Approval System Work?
Codex uses a two-layer security model that separates what is technically possible from when Codex asks for human approval. The approach differs fundamentally from Claude Code’s permission system — Codex enforces restrictions at the OS kernel level.5 See also Enterprise Deployment for requirements.toml constraints that administrators enforce organization-wide.
Layer 1: Sandbox (What Is Possible)
The sandbox controls filesystem and network access using OS-native mechanisms:
| Mode | File Access | Network | Implementation |
|---|---|---|---|
read-only |
Read only everywhere | Blocked | Strictest; mutations need explicit approval |
workspace-write |
Read/write in workspace + /tmp |
Blocked by default | Normal development; safe default |
danger-full-access |
Full machine access | Enabled | Maximum capability; use with caution |
Platform-specific enforcement:
- macOS: Apple’s Seatbelt framework via
sandbox-execwith mode-specific profiles compiled at runtime and enforced by the kernel6 - Linux: Landlock for filesystem restrictions + seccomp for syscall filtering. A standalone helper process (
codex-linux-sandbox) provides defense-in-depth isolation.5 Bubblewrap (bwrap) is vendored and compiled as part of the Linux build (promoted from optional in v0.100.0)7 - Windows: Native sandbox with restricted tokens (promoted from experimental in v0.100.0). WSL also supported (inherits Linux Landlock + seccomp)
Why this matters: Unlike container-based sandboxing (Docker), OS-level sandboxing is faster, lighter, and harder to escape. The kernel enforces restrictions before Codex even sees the system call.
ReadOnlyAccess policy (v0.100.0+): A configurable policy shape for granular read access control. Use it to restrict which directories Codex can read from, even in workspace-write mode:
[sandbox_workspace_write]
read_only_access = ["/etc", "/usr/local/share"] # Only these paths readable outside workspace
Layer 2: Approval Policy (When To Ask)
The approval policy determines when Codex pauses to ask for human confirmation:
| Policy | Behavior | Use Case |
|---|---|---|
untrusted |
Auto-runs safe reads; prompts for everything else | Highest trust barrier; unfamiliar repos |
on-failure |
Auto-runs until something fails, then asks | Semi-automated; catches errors |
on-request |
Approves within sandbox; prompts for boundary violations | Default; good balance |
never |
No prompts whatsoever | CI/CD, trusted automation |
Distinct Approval IDs (v0.104.0+)
Codex now assigns distinct approval IDs to each command within a multi-step shell execution. This means approvals are granular — approving one command in a sequence doesn’t automatically approve subsequent ones in the same shell invocation.51
The --full-auto Flag
--full-auto is a convenience alias for:
codex --sandbox workspace-write --ask-for-approval on-request
Critical gotcha: --full-auto overrides any explicit --sandbox value. If you pass --full-auto --sandbox read-only, you get workspace-write because --full-auto takes precedence.8
Recommended Configurations
Daily development (safe default):
sandbox_mode = "workspace-write"
approval_policy = "on-request"
Power user (full access, human-in-the-loop):
sandbox_mode = "danger-full-access"
approval_policy = "untrusted"
The combination is the community-recommended “sweet spot”: maximum capability but approval required for every command.9
CI/CD automation:
sandbox_mode = "workspace-write"
approval_policy = "never"
Enabling Network Access
Codex blocks network access by default in workspace-write mode. Enable it when needed:
# Per-run
codex -c 'sandbox_workspace_write.network_access=true' "install the packages"
# In config.toml
[sandbox_workspace_write]
network_access = true
writable_roots = ["/path/to/extra/dir"] # Additional writable directories
exclude_slash_tmp = false # Prevent /tmp from being writable
exclude_tmpdir_env_var = false # Prevent $TMPDIR from being writable
WebSocket Proxy Support (v0.104.0+)
For corporate environments that route WebSocket traffic through a proxy, Codex now supports WS_PROXY and WSS_PROXY environment variables:51
export WSS_PROXY="https://proxy.corp.example.com:8443"
codex "update the README"
These complement the existing HTTPS_PROXY and SOCKS5 proxy support (v0.93.0+), covering all transport layers.
Testing the Sandbox
Verify sandbox behavior before trusting it:
codex sandbox macos --full-auto -- ls /etc/passwd # macOS test
codex sandbox linux --full-auto -- cat /etc/shadow # Linux test
If the sandbox is working correctly, both commands should fail with a permission denied error — the sandbox prevents reading sensitive system files even in --full-auto mode. If either command succeeds, your sandbox configuration needs investigation.
How Does AGENTS.md Work?
AGENTS.md is Codex’s project instruction system — an open standard10 now governed by the Linux Foundation’s Agentic AI Foundation. Supported by Codex, Cursor, Copilot, Amp, Jules (Google), Gemini CLI, Windsurf, Cline, Aider, Zed, Factory, RooCode, and 60,000+ open source projects. It defines how Codex behaves within a specific repository or directory. See Skills for reusable expertise packages that complement AGENTS.md.
Discovery Hierarchy
Codex builds an instruction chain at session start by walking the directory tree:
- Global (
~/.codex/):AGENTS.override.md>AGENTS.md - Project (git root to current directory): Each level checked for
AGENTS.override.md>AGENTS.md> fallback filenames - Merging: Files concatenate root-down; closer files appear later in the prompt and override earlier guidance
~/.codex/AGENTS.md ← Global defaults
└─ /repo/AGENTS.md ← Project-wide rules
└─ /repo/services/AGENTS.md ← Service-specific rules
└─ /repo/services/payments/
AGENTS.override.md ← Overrides everything above for this dir
What Makes a Great AGENTS.md
Based on direct guidance from Codex itself and community patterns11:
DO:
- Be specific: "Use rg --files for discovery" beats "search efficiently"
- Define closure: What does “done” mean? (tests pass, lint clean, etc.)
- Include commands: Build, test, lint, format (exact invocations)
- Organize by task: Coding, review, release, incident/debug sections
- Define escalation: What to do when blocked or encountering unexpected state
DON’T: - Dump entire style guides without execution rules - Use ambiguous directives (“be careful,” “optimize”) - Mix contradictory priorities (speed + exhaustive verification + no runtime budget) - Write prose documentation (AGENTS.md is operational policy, not README)
Example: Production AGENTS.md
# Repository Guidelines
## Build, Test, and Development Commands
- Run API (dev): `python3 -m uvicorn main:app --reload`
- Install deps: `pip install -r requirements.txt`
- Lint: `python3 -m ruff check .` (auto-fix: `--fix`)
- Format: `python3 -m ruff format .`
- Tests: `python3 -m pytest -v`
- Coverage: `python3 -m pytest --cov=app --cov-report=term-missing`
## Coding Style & Naming Conventions
- Python 3.11+. Type hints on all functions.
- Ruff enforced: 88-char lines, double quotes, spaces for indent.
- Naming: modules `snake_case.py`, classes `PascalCase`, functions `snake_case`.
## Commit & Pull Request Guidelines
- Conventional Commits: `feat:`, `fix:`, `docs:`, `refactor:`, `chore:`, `test:`
- Commits should be small and focused.
- PRs must include: description, test plan, and screenshots for UI changes.
## Security
- Never commit secrets. Use `.env` for local config.
- Validate all external API calls with proper error handling.
The Override Mechanism
AGENTS.override.md at any directory level replaces the normal AGENTS.md for that scope. Use for:
- Release freezes: “No new features, fixes only”
- Incident mode: “All changes must be reviewed by on-call”
- Temporary hardening: “No dependency updates this sprint”
Configuration
# Custom fallback filenames (in addition to AGENTS.md)
project_doc_fallback_filenames = ["TEAM_GUIDE.md", ".agents.md"]
# Increase max size for large instruction files
project_doc_max_bytes = 65536 # 64 KiB (default: 32 KiB)
Scaffold Generation
codex # Launch TUI
/init # Generate AGENTS.md scaffold
Or verify your instruction chain:
codex --ask-for-approval never "Summarize your current instructions"
Deep Dive: Anti-patterns that get ignored, patterns that work, and cross-tool compatibility for AGENTS.md files
Hooks
Codex added hooks in v0.99.0 (AfterAgent) and v0.100.0 (AfterToolUse). The hook system is early-stage compared to Claude Code’s 12+ lifecycle events but provides automation entry points for common workflows.
Available Hook Events
| Event | When It Fires | Added |
|---|---|---|
AfterAgent |
After the agent finishes a complete turn | v0.99.0 |
AfterToolUse |
After each individual tool call completes | v0.100.0 |
Hook Configuration
Hooks are configured in .codex/config.toml:
[[hooks]]
event = "AfterToolUse"
command = "echo 'Tool completed' >> /tmp/codex-log.txt"
Replicating Claude Code Hook Patterns
If migrating from Claude Code, here’s how to achieve similar automation without the full hook event set:
| Claude Code Pattern | Codex Alternative |
|---|---|
PreToolUse file blocking |
AGENTS.md instructions + sandbox read-only mode |
PostToolUse linting |
AfterToolUse hook running your linter |
SessionStart context injection |
AGENTS.md (loaded automatically every session) |
SubagentStop notification |
AfterAgent hook with notification script |
| Async hooks | Not yet supported; use Cloud tasks for background work |
Expert tip: The hook system is actively expanding. Check the Codex changelog for new hook events in each release.
What Is MCP (Model Context Protocol)? [EXPERIMENTAL]
MCP extends Codex’s capabilities by connecting to external tools and services. The codex mcp command group is currently marked experimental, and commands and config format may change between releases. Codex supports two transport types: STDIO (local processes) and Streamable HTTP (remote servers).12
Configuring MCP Servers
STDIO servers (local processes):
# In ~/.codex/config.toml or .codex/config.toml
[mcp_servers.context7]
enabled = true
required = true # Fail startup if unavailable
command = "npx"
args = ["-y", "@upstash/context7-mcp"]
env = { "MY_VAR" = "value" } # Static env vars
env_vars = ["PATH", "HOME"] # Forward host env vars
cwd = "/path/to/project" # Optional working directory
startup_timeout_sec = 10
tool_timeout_sec = 60
enabled_tools = ["search", "summarize"] # Tool allowlist
disabled_tools = ["slow-tool"] # Tool denylist
HTTP servers (remote):
[mcp_servers.figma]
enabled = true
url = "https://mcp.figma.com/mcp"
bearer_token_env_var = "FIGMA_OAUTH_TOKEN"
http_headers = { "X-Figma-Region" = "us-east-1" }
env_http_headers = { "X-Org-Id" = "FIGMA_ORG_ID" } # Headers from env vars
startup_timeout_sec = 10
tool_timeout_sec = 60
CLI Management
codex mcp add context7 -- npx -y @upstash/context7-mcp
codex mcp add context7 --env API_KEY=... -- npx -y @upstash/context7-mcp # With env vars
codex mcp add figma --url https://mcp.figma.com/mcp --bearer-token-env-var FIGMA_OAUTH_TOKEN
codex mcp list # List all configured servers
codex mcp list --json # JSON output
codex mcp get context7 # Show server config
codex mcp get context7 --json # JSON output
codex mcp login <server> # OAuth flow for HTTP servers
codex mcp logout <server> # Remove OAuth credentials
codex mcp remove <server> # Delete server definition
In-session: /mcp shows active servers and available tools.
Running Codex AS an MCP Server
Codex can expose itself as an MCP server for multi-agent orchestration:13
codex mcp-server # Start as MCP server (stdio transport)
The server exposes two tools:
1. codex(): Start a new session with prompt, sandbox, model, and approval parameters
2. codex-reply(): Continue an existing session with threadId and prompt
Use with the Agents SDK (Python):
from agents import Agent, Runner
from agents.mcp import MCPServerStdio
async with MCPServerStdio(
name="Codex CLI",
params={"command": "npx", "args": ["-y", "codex", "mcp-server"]},
client_session_timeout_seconds=360000,
) as codex_mcp_server:
agent = Agent(name="Developer", mcp_servers=[codex_mcp_server])
result = await Runner.run(agent, "Fix the failing tests")
Notable MCP Servers
| Server | Purpose | Install |
|---|---|---|
| Context7 | Up-to-date library docs | npx -y @upstash/context7-mcp |
| Figma | Design file access | HTTP: https://mcp.figma.com/mcp |
| Playwright | Browser automation | npx -y @anthropic/mcp-playwright |
| Sentry | Error monitoring | HTTP: https://mcp.sentry.dev/mcp |
| GitHub | Repository operations | npx -y @anthropic/mcp-github |
Practical Patterns
Pattern 1: Context-aware development — Pair Context7 with your framework docs so Codex always has current API references:
[mcp_servers.context7]
enabled = true
required = true
command = "npx"
args = ["-y", "@upstash/context7-mcp"]
Pattern 2: Output limits — MCP tool responses are truncated at ~25K characters by default. For tools that return large payloads (database queries, log captures), use enabled_tools to restrict to specific tools and keep responses focused.
Pattern 3: Enterprise MCP governance — Lock down which MCP servers developers can use via requirements.toml:
# In /etc/codex/requirements.toml — only approved servers allowed
[mcp_servers.approved-internal]
identity = { command = "npx @company/internal-mcp" }
Any server not matching an identity in requirements.toml will be blocked at startup. See Enterprise Deployment for full policy configuration.
JavaScript REPL Runtime [EXPERIMENTAL]
Codex v0.100.0 added an experimental, feature-gated JavaScript REPL runtime (js_repl) that persists state across tool calls. When enabled, Codex can execute JavaScript expressions and maintain variables, objects, and functions between calls within the same session.
Enabling the JS REPL:
# In config.toml
[features]
js_repl = true
Example usage: When enabled, Codex can maintain state across tool calls within a session:
// Codex can accumulate data across multiple tool calls
const results = await fetchTestResults();
const failures = results.filter(r => r.status === "failed");
console.log(`${failures.length} failures out of ${results.length} tests`);
// Variable 'failures' persists and is available in subsequent tool calls
This feature is experimental and feature-gated. The interface may change between releases.
What Are Skills?
Skills are reusable, task-specific capability packages that Codex loads on demand. They follow the open agent skills standard.14
Skill Structure
my-skill/
SKILL.md (required: instructions)
scripts/ (optional: executable scripts)
references/ (optional: reference docs)
assets/ (optional: images, icons)
agents/openai.yaml (optional: metadata, UI, dependencies)
Discovery Locations
Codex stores user-installed skills in $CODEX_HOME/skills (default: ~/.codex/skills), including built-in system skills under .system/. Codex supports symlinked skill folders.
| Scope | Path |
|---|---|
| Project/team | Repository skill folders (layout may vary by version) |
| User | ~/.codex/skills/ (or $CODEX_HOME/skills/) |
| Admin | /etc/codex/skills/ |
| System | Bundled by OpenAI (under ~/.codex/skills/.system/) |
Creating a Skill
SKILL.md format:
---
name: security-audit
description: Run a thorough security audit on the codebase.
---
## Security Audit Procedure
1. Scan for hardcoded secrets using `rg -i "(api_key|password|secret|token)\s*=" --type py`
2. Check for SQL injection: look for string interpolation in queries
3. Verify input validation on all API endpoints
4. Check dependency vulnerabilities: `pip audit` or `npm audit`
5. Review authentication and authorization patterns
6. Report findings with severity levels (Critical/High/Medium/Low)
Metadata (agents/openai.yaml):
interface:
display_name: "Security Audit"
short_description: "Full codebase security review"
icon_small: "./assets/shield.svg"
brand_color: "#DC2626"
default_prompt: "Run a security audit on this repository"
policy:
allow_implicit_invocation: false # Require explicit $skill
dependencies:
tools:
- type: "mcp"
value: "snyk"
transport: "streamable_http"
url: "https://mcp.snyk.io/mcp"
Invoking Skills
- Explicit:
/skillsmenu or$skill-namemention in prompt - Implicit: Codex auto-detects matching skills from task description (if
allow_implicit_invocation: true) - Creator: Use
$skill-creatorto interactively build a new skill - Installer: Use
$skill-installer install <name>to install community skills
Enable/Disable
[[skills.config]]
path = "/path/to/skill/SKILL.md"
enabled = false
Skills vs Slash Commands
| Skills | Slash Commands | |
|---|---|---|
| Defined in | SKILL.md files with optional metadata |
Built into Codex CLI binary |
| Scope | Project, user, or admin level | Global (always available) |
| Invocation | $skill-name in prompt, /skills menu, or implicit detection |
/command syntax |
| Customizable | Fully — you write the instructions | Fixed behavior |
| Dependencies | Can declare MCP server requirements | None |
| Sharing | Copy skill folder to team repo or ~/.codex/skills/ |
Not shareable |
Debugging Skills
If a skill isn’t activating:
- Check discovery:
/skillsshould list it in the TUI - Verify path: Ensure the skill folder is in a recognized location (
~/.codex/skills/, project root, or/etc/codex/skills/) - Check
enabled: Skills withenabled = falsein config.toml won’t load - Check implicit activation: If relying on auto-detection, ensure
allow_implicit_invocation: trueinagents/openai.yaml - Use keywords: Include the skill’s
descriptionterms in your prompt to improve implicit matching
Production Example: Deploy Skill
A complete multi-file skill showing references and scripts working together:
deploy-skill/
SKILL.md
references/
runbook.md
rollback-checklist.md
scripts/
pre-deploy-check.sh
smoke-test.sh
agents/openai.yaml
SKILL.md:
---
name: deploy
description: Deploy the application to staging or production. Runs pre-flight checks, executes deployment, and verifies with smoke tests.
---
## Deployment Procedure
### Pre-flight
1. Run `scripts/pre-deploy-check.sh` to verify:
- All tests pass
- No uncommitted changes
- Branch is up to date with remote
2. Review the runbook at `references/runbook.md` for environment-specific steps.
### Deploy
3. Execute the deployment command for the target environment.
4. Monitor logs for errors during rollout.
### Verify
5. Run `scripts/smoke-test.sh <environment-url>` to confirm critical paths.
6. If smoke tests fail, follow `references/rollback-checklist.md`.
Invoke with: $deploy to staging or $deploy production with canary rollout
Plan Mode & Collaboration
Plan mode lets Codex design an approach before executing changes. It’s enabled by default (since v0.94.0).15 See Decision Frameworks for the “Plan Mode vs Direct Execution” decision tree.
Entering Plan Mode
/plan # Switch to plan mode
/plan "redesign the API layer" # Plan mode with initial prompt
In plan mode, Codex: - Reads files and analyzes the codebase - Proposes an implementation plan - Does not make changes until you approve - Streams the plan in a dedicated TUI view
Steer Mode
Steer mode (enabled by default since v0.98.0) allows you to inject new instructions while Codex is actively working, without interrupting its current task.15
There are two injection methods:
| Input | Behavior | When to Use |
|---|---|---|
| Enter | Sends instructions immediately; Codex sees them during the current turn | Urgent corrections (“stop — don’t modify that file”), clarifications (“the config is in /etc/app.conf, not the default path”), or priority changes (“focus on the tests first”) |
| Tab | Queues instructions for the next turn; Codex finishes its current work first | Follow-up tasks (“after this, also update the changelog”), scope additions (“when you’re done, run the linter”), or non-urgent context (“the deploy target is staging, not prod”) |
Practical examples:
# Codex is refactoring the auth module...
[Enter] "Use bcrypt instead of argon2 — we already have it as a dependency"
→ Codex adjusts immediately, mid-turn
[Tab] "Once auth is done, update the migration script too"
→ Codex finishes auth refactor, then starts the migration
Steer mode is always active in the TUI. If you prefer to wait until Codex finishes before giving instructions, just type normally after the turn completes — no special mode needed.
Memory System
Codex has a persistent memory system (v0.100.0+) that stores facts, preferences, and project context across sessions.25
Memory Commands
| Command | Description |
|---|---|
/m_update <fact> |
Save a memory (e.g., /m_update always use pytest, never unittest) |
/m_drop <query> |
Remove a memory matching the query |
Memories are stored in markdown files under ~/.codex/memory/. Codex loads them at session start and uses them to inform behavior across all future sessions.
What to Store
Memories work best for persistent preferences and project facts:
- Project conventions: “This project uses tabs, not spaces” or “API responses always include a
metafield” - Tool preferences: “Use
pnpminstead ofnpm” or “Run tests withpytest -x --tb=short“ - Architecture decisions: “The auth module is in
src/core/auth/, notsrc/middleware/“ - Workflow preferences: “Always run the linter before showing me a diff”
Memory in Pipelines
When running codex exec, memories are loaded automatically. This means CI/CD pipelines and scripts benefit from the same context as interactive sessions — no need to repeat instructions in every invocation.
Memory Refinements (v0.101.0)
- Secret sanitization: Memories are automatically scanned for secrets before being written to disk
- CWD awareness: Memory files now include the working directory context for project-specific recall
- Developer message exclusion: Developer/system messages are excluded from phase-1 memory input, improving memory quality by focusing on user interactions
Memory vs AGENTS.md
| Use Case | Memory (/m_update) |
AGENTS.md |
|---|---|---|
| Personal preferences | Use memory (persists across all projects) | Not appropriate |
| Project conventions | Either (memory for personal recall, AGENTS.md for team sharing) | AGENTS.md for team |
| Architecture decisions | AGENTS.md (shared context) | Primary choice |
| Tool commands | Memory (quick personal reference) | AGENTS.md for team |
Tip: Use
/m_updatefor facts that should persist indefinitely. For session-specific context, just tell Codex directly in the conversation. For shared team context, use AGENTS.md.
Session Management
Codex persists sessions under ~/.codex/sessions/, enabling resume, forking, and multi-thread workflows across CLI and desktop surfaces.
Resume
Pick up where you left off:
codex resume # Interactive picker (sorted by recency)
codex resume <SESSION_ID> # Resume a specific session
codex exec resume --last "continue" # Non-interactive: resume most recent
The /resume slash command inside the TUI opens the same interactive picker with search.
Fork
Branch a conversation to explore alternatives without losing your current progress:
/fork # Fork current conversation
/fork "try a different approach" # Fork with new prompt
Forks create independent threads sharing the same history up to the fork point. Changes in one fork don’t affect the other. This is useful for comparing approaches (e.g., “fork and try Redis instead of Memcached”) or exploring risky changes safely.
Thread Listing
View and manage active sessions:
/status # Current session info and token usage
/ps # Show background terminals in session
In the desktop app, threads are visible in the sidebar with full history and diff previews.
Session Lifecycle
| Action | CLI | Desktop App |
|---|---|---|
| Start new | codex or /new |
New Thread button |
| Resume | codex resume or /resume |
Click thread in sidebar |
| Fork | /fork |
Right-click thread → Fork |
| End | /quit or Ctrl+C |
Close thread tab |
| Delete | Remove from ~/.codex/sessions/ |
Right-click → Delete |
Sessions sync between CLI and desktop app — start in one, continue in the other.
Non-Interactive Mode (codex exec)
codex exec runs Codex non-interactively for scripting, CI/CD, and automation.16
Basic Usage
codex exec "summarize the repository structure"
codex exec --full-auto "fix the CI failure"
codex exec --json "triage open bugs" -o result.txt
By default, codex exec writes progress/events to stderr and the final agent message to stdout. The design makes it composable with standard Unix pipelines.
JSON Lines Output
With --json, stdout becomes a JSONL event stream:
codex exec --json "fix the tests" | jq
Event types: thread.started, turn.started/completed/failed, item.started/completed, error
{"type":"thread.started","thread_id":"019c5c94-..."}
{"type":"turn.started"}
{"type":"item.started","item":{"id":"item_1","type":"command_execution","status":"in_progress"}}
{"type":"item.completed","item":{"id":"item_3","type":"agent_message","text":"..."}}
{"type":"turn.completed","usage":{"input_tokens":24763,"cached_input_tokens":24448,"output_tokens":122}}
Structured Output
Enforce response shape with JSON Schema:
codex exec "Extract project metadata" \
--output-schema ./schema.json \
-o ./project-metadata.json
-o / --output-last-message writes the final message to a file.
Session Resume and Review
codex exec resume --last "continue where you left off"
codex exec resume <SESSION_ID> "fix the remaining issues"
codex exec review --base main # Code review against a branch
Key Flags
| Flag | Description |
|---|---|
--full-auto |
Workspace-write sandbox + on-request approval |
--json |
JSONL event stream to stdout |
-o, --output-last-message <file> |
Save final message to file |
--output-schema <file> |
Validate response against JSON Schema |
--ephemeral |
Don’t persist session files |
-C, --cd <dir> |
Set working directory |
--add-dir <dir> |
Extra writable directories |
--skip-git-repo-check |
Allow running outside git repos |
--dangerously-bypass-approvals-and-sandbox |
No sandbox, no approvals (CI only) |
CI Authentication
codex exec supports CODEX_API_KEY for non-interactive authentication in automation environments.
Codex Cloud & Background Tasks [EXPERIMENTAL]
Status: Codex Cloud is an experimental feature. Interfaces, pricing, and availability may change. OpenAI manages the cloud environments, and you do not control the infrastructure.
Codex Cloud runs tasks asynchronously in OpenAI-managed environments.4 See also GitHub Action & CI/CD for integrating Codex into your CI pipeline.
How It Works
- Submit a task (via chatgpt.com/codex, Slack integration, or CLI)
- Codex clones your repo into an isolated cloud sandbox
- The agent works independently: reads code, runs tests, makes changes
- When done, Codex creates a PR or provides a diff for review
- Apply results locally with
codex apply <TASK_ID>
Internet Access in Cloud
Agent internet is off by default and configured per environment:
- Off: No agent internet access (default)
- On: Optional domain allowlist + HTTP method restrictions
Allowed domains: pypi.org, npmjs.com, github.com
Allowed methods: GET, HEAD, OPTIONS
Setup scripts can still use internet to install dependencies, even when agent internet is off.
Slack Integration
Mention @Codex in a Slack channel or thread to start a cloud task.
Prerequisites: 1. Eligible ChatGPT plan (Plus, Pro, Business, Enterprise, or Edu) 2. Connected GitHub account 3. At least one configured cloud environment 4. Slack app installed for your workspace
Codex replies with a task link and posts results when complete.
Cloud CLI
codex cloud exec --env <ENV_ID> "Fix failing tests" # Start a cloud task
codex cloud status <TASK_ID> # Check task progress
codex cloud diff <TASK_ID> # View task diff
codex cloud list # List recent tasks
codex cloud list --json # JSON output
codex cloud apply <TASK_ID> # Apply from cloud subcommand
codex apply <TASK_ID> # Apply diff (top-level shortcut)
The Codex Desktop App
The Codex desktop app (macOS only, Apple Silicon) provides a graphical interface optimized for multi-project management.17
Installation
codex app # Auto-downloads and installs on first run
Or download directly: Codex.dmg
Key Features
| Feature | Description |
|---|---|
| Parallel threads | Run multiple tasks across projects simultaneously |
| Thread modes | Start threads in Local, Worktree, or Cloud mode |
| Built-in Git tools | Review diffs, add comments, stage/revert chunks, commit/push, create PRs |
| Integrated terminal | Per-thread terminal (Cmd+J) |
| Voice dictation | Prompt by voice (Ctrl+M) |
| Automations | Schedule recurring tasks |
| Notifications | Completion/approval notifications when app is backgrounded |
| Prevent sleep | Optional setting to keep machine awake while tasks run |
| Skills + MCP | Shared configuration across app, CLI, and IDE extension |
Thread Modes
Each thread runs in one of three modes, selected when you create it:
| Mode | Isolation | File Access | Best For |
|---|---|---|---|
| Local | None — works directly in your project directory | Full read/write | Quick tasks, exploration, non-destructive work |
| Worktree | Git worktree — isolated branch copy of your repo | Isolated copy | Feature development, risky refactors, parallel experiments |
| Cloud | Remote server — runs on OpenAI infrastructure | No local access | Long-running tasks, CI-like workflows, async delegation |
Worktree isolation mechanics:
When you start a Worktree thread, the desktop app:
1. Creates a new git worktree (git worktree add) in a temporary directory
2. Checks out a fresh branch from your current HEAD
3. Runs the agent inside the worktree — all file changes are isolated
4. Presents a diff review when done — you choose which changes to merge back
This means multiple Worktree threads can run simultaneously on the same repo without conflicts. Each gets its own branch and working directory.
Automations
Automations run locally in the app, so the app must be running and the project available on disk:
- In Git repos, automations use dedicated background worktrees (isolated from your working directory)
- In non-Git projects, runs execute directly in the project directory
- Automations use your default sandbox settings
Setting up an automation: 1. Open a project in the desktop app 2. Click the Automations tab in the sidebar 3. Define a trigger (schedule, webhook, or manual) 4. Write the prompt and select the thread mode 5. Automations run on schedule and queue results for review
Example use cases: - Issue triage: Automatically categorize and prioritize new issues - CI monitoring: Watch build failures and suggest fixes - Alert response: React to monitoring alerts with diagnostic analysis - Dependency updates: Check for and apply security patches
Results appear in a review queue for human approval.
Windows Support
Windows support is planned. Check the Codex Desktop App page or GitHub releases for availability updates.18
GitHub Action & CI/CD
The official GitHub Action integrates Codex into your CI/CD pipeline.19
Basic Usage
# .github/workflows/codex.yml
name: Codex
on:
pull_request:
types: [opened]
jobs:
codex:
runs-on: ubuntu-latest
outputs:
final_message: ${{ steps.run_codex.outputs.final-message }}
steps:
- uses: actions/checkout@v5
- name: Run Codex
id: run_codex
uses: openai/codex-action@v1
with:
openai-api-key: ${{ secrets.OPENAI_API_KEY }}
prompt-file: .github/codex/prompts/review.md
sandbox: workspace-write
safety-strategy: drop-sudo
Configuration Options
| Input | Purpose |
|---|---|
openai-api-key |
API key for proxy/auth setup |
responses-api-endpoint |
Override endpoint (e.g. Azure Responses URL) |
prompt / prompt-file |
Task instructions (one required) |
working-directory |
Directory passed to codex exec --cd |
sandbox |
workspace-write / read-only / danger-full-access |
codex-args |
Extra CLI flags (JSON array or shell string) |
output-schema / output-schema-file |
Structured output schema for --output-schema |
model / effort |
Agent configuration |
output-file |
Save final message to disk |
codex-version |
Pin CLI version |
codex-home |
Custom Codex home directory |
allow-users / allow-bots |
Trigger allowlist controls |
safety-strategy / codex-user |
Privilege-reduction behavior and user selection |
Output: final-message, the final Codex response text for downstream steps/jobs.
Safety Strategies
| Strategy | Description |
|---|---|
drop-sudo (default) |
Linux/macOS; removes sudo capability after action step |
unprivileged-user |
Run Codex as a pre-created low-privilege user |
read-only |
Read-only sandbox (runner/user privilege risk still applies) |
unsafe |
No privilege reduction; required on Windows runners |
Access Controls
with:
allow-users: "admin,maintainer" # Limit who can trigger
allow-bots: false # Block bot-triggered runs
Default: Only collaborators with write access can trigger Codex workflows.
Codex SDK
The TypeScript SDK embeds Codex’s agent capabilities into custom applications.20
Installation
npm install @openai/codex-sdk
Basic Usage
import { Codex } from "@openai/codex-sdk";
const codex = new Codex();
const thread = codex.startThread();
// Multi-turn conversation
const turn1 = await thread.run("Diagnose CI failures and propose a fix");
console.log(turn1.finalResponse);
const turn2 = await thread.run("Implement the fix and add tests");
console.log(turn2.items);
// Resume a previous session
const resumed = codex.resumeThread("<thread-id>");
await resumed.run("Continue from previous work");
Advanced SDK Features
runStreamed(...): Async event stream for intermediate updatesoutputSchema: Enforce JSON-shaped final output- Multimodal input: Pass text + local images (
{ type: "local_image", path: "..." })
Thread and Client Configuration
// Custom working directory, skip git check
const thread = codex.startThread({
workingDirectory: "/path/to/project",
skipGitRepoCheck: true,
});
// Custom environment and config overrides
const codex = new Codex({
env: { CODEX_API_KEY: process.env.MY_KEY },
config: { model: "gpt-5.2-codex" },
});
Sessions persist under ~/.codex/sessions.
Runtime: Node.js 18+.
Performance Optimization
Context Management
The flagship models have 272K-token input windows (128K output, 400K total budget), but they still fill faster than you think. Manage proactively:
- Use
/compactregularly: Summarizes conversation history to free tokens - Provide local docs: High-quality
AGENTS.mdand local documentation reduce exploration overhead (which consumes context) - Use
@to attach specific files: Reference files directly instead of asking Codex to find them - Keep prompts focused: Scoped prompts with exact files consume less context than open-ended exploration
Token Efficiency
| Technique | Impact |
|---|---|
Set model_reasoning_summary = "none" |
Reduces output tokens ~20% |
Use model_verbosity = "low" |
Shorter explanations, more action |
| Use mini models for simple tasks | Significantly cheaper per message |
| Split complex tasks into focused sessions | Better per-session token efficiency |
| Use profiles to switch settings by task | Avoid paying for high reasoning on routine work |
Speed Optimization
gpt-5.3-codex-spark: Lower-latency variant for interactive pairing--profile fast: Pre-configured mini model with low reasoning- Parallel tool execution: Codex runs independent reads/checks concurrently, so structure prompts to enable this
- Outcome-driven loops: Ask for “implement, test, fix, stop when green” instead of step-by-step instructions
How Do I Debug Issues?
Common Problems and Solutions
| Problem | Cause | Solution |
|---|---|---|
| “Re-connecting” loop | Multiple Codex instances | Kill all processes, wait 60s, restart single instance |
| 401 auth errors | Stale credentials | rm ~/.codex/auth.json && codex login |
| Network blocked in sandbox | Default behavior | -c 'sandbox_workspace_write.network_access=true' |
| WSL2 disconnections | WSL state corruption | wsl --shutdown in PowerShell, wait 1 min, restart |
| Patch failures | Line ending mismatches | Normalize to LF, provide exact file text |
| Context compacting fails | Too much context | Reduce reasoning effort, split into smaller tasks |
| Model changes unexpectedly | Config.toml override | Run /config to inspect effective settings and sources |
| Plan mode allows mutations | Known bug | Issue #11115 |
| Forgetting AGENTS.md instructions | Context limits | Keep instructions concise; use skill files for detailed procedures |
| Stalling in Read Only mode | Known issue | Discussion #7380 |
Error Messages Reference
| Error Message | Meaning | Fix |
|---|---|---|
Error: EACCES permission denied |
Sandbox blocked a file operation | Check sandbox mode; use workspace-write if Codex needs to edit files |
Error: rate limit exceeded |
API rate limit hit | Wait and retry; reduce model_reasoning_effort or switch to a lighter model |
Error: context length exceeded |
Conversation exceeded 272K input tokens | Use /compact to summarize, or start a new session with /new |
Error: MCP server failed to start |
MCP server process crashed or timed out | Check codex mcp get <name> for config; increase startup_timeout_sec |
Error: authentication required |
No valid API key or session | Run codex login or set CODEX_API_KEY |
Error: sandbox execution failed |
Command failed inside sandbox | Check command syntax; verify required tools are available in the sandbox environment |
WARN: skill not found |
Referenced skill doesn’t exist at expected path | Check /skills list; verify skill folder location |
Error: wire format mismatch |
Wrong wire_api setting for provider |
Use wire_api = "responses" for OpenAI endpoints (see Custom Model Providers) |
Diagnostic Tools
codex --version # Check CLI version
codex login status # Verify authentication
codex mcp list # Check MCP server status
codex debug app-server --help # Debug app server issues
In-session TUI diagnostics:
/status # Token/session overview
/config # Inspect effective config values and sources
/compact # Summarize history to reclaim context
Note:
codex --verboseis not a valid top-level flag. Use the debug subcommands and TUI diagnostics above.
Clean Reinstall
npm uninstall -g @openai/codex && npm install -g @openai/codex@latest
Debug Mode
codex debug app-server send-message-v2 # Test app-server client
Reporting Issues
/feedback # Send logs to Codex maintainers (in TUI)
Or file issues at github.com/openai/codex/issues.1
Enterprise Deployment
Admin Controls (requirements.toml)
Administrators enforce enterprise policy via requirements.toml, an admin-enforced configuration file that constrains security-sensitive settings users cannot override:22
# /etc/codex/requirements.toml
# Restrict which approval policies users can select
allowed_approval_policies = ["untrusted", "on-request", "on-failure"]
# Limit available sandbox modes
allowed_sandbox_modes = ["read-only", "workspace-write"]
# Control web search capabilities
allowed_web_search_modes = ["cached"]
# Allowlist MCP servers by identity (both name and identity must match)
[mcp_servers.approved-server]
identity = { command = "npx approved-mcp-server" }
# Admin-enforced command restrictions
[[rules.prefix_rules]]
pattern = [{ token = "rm" }, { any_of = ["-rf", "-fr"] }]
decision = "forbidden"
justification = "Recursive force-delete is prohibited by IT policy"
[[rules.prefix_rules]]
pattern = [{ token = "sudo" }]
decision = "prompt"
justification = "Elevated commands require explicit approval"
Unlike user-level
config.tomlwhich sets preferences,requirements.tomlis a hard constraint layer that restricts what values users can select, and users cannot override it. Admin requirements rules can only prompt or forbid (never silently allow).
macOS MDM Configuration
Distribute via MDM using the com.openai.codex preference domain.22 Codex honors standard macOS MDM payloads (Jamf Pro, Fleet, Kandji, etc.). Encode TOML as base64 without line wrapping:
| Key | Purpose |
|---|---|
config_toml_base64 |
Base64-encoded managed defaults (starting values users can change) |
requirements_toml_base64 |
Base64-encoded admin-enforced requirements (users cannot override) |
Precedence (highest to lowest):
- macOS managed preferences (MDM)
- Cloud-fetched requirements (ChatGPT Business / Enterprise)
/etc/codex/requirements.toml(local filesystem)
Cloud requirements only fill unset requirement fields, so higher-precedence managed layers always win. Cloud requirements are best-effort; if the fetch fails or times out, Codex continues without the cloud layer.
OpenTelemetry Integration
Codex supports OpenTelemetry trace-context propagation from standard OTel environment variables through to OpenAI API calls. Set the standard environment variables before launching Codex:
# Point Codex at your OTel collector
export OTEL_EXPORTER_OTLP_ENDPOINT="https://otel-collector.internal:4318"
export OTEL_SERVICE_NAME="codex-cli"
export OTEL_RESOURCE_ATTRIBUTES="team=platform,env=production"
# Launch Codex — trace context propagates to all OpenAI API calls
codex
- Standard
OTEL_*environment variables are respected (endpoint, service name, resource attributes) - Trace context propagates through Codex to API calls, enabling end-to-end observability
- Use resource attributes to tag traces by team, environment, or project
- Keep privacy requirements in mind when enabling prompt/tool logging — traces may contain code snippets
Enterprise Access
- ChatGPT Business / Enterprise / Edu: Org-admin controlled access, with cloud-fetched requirements applied automatically. Supports SSO via SAML/OIDC through your identity provider (Okta, Entra ID, etc.)
- API: Standard API auth, billing, and org/project controls. OpenAI publishes SOC 2 Type II and SOC 3 reports; HIPAA BAA available for Enterprise tier
- Codex SDK: Embed in internal tools and workflows
- Policy enforcement at scale: Use MDM-distributed
requirements_toml_base64or filesystem-level/etc/codex/requirements.toml
Data handling and compliance: - API inputs/outputs are not used for training under OpenAI’s Business/Enterprise/API terms - For data residency, OpenAI API traffic routes through US-based infrastructure by default; for EU data residency requirements, consult OpenAI’s Enterprise sales team - Session transcripts are stored locally; only API calls leave the machine - ChatGPT Enterprise supports compliance frameworks including SOC 2, GDPR, and CCPA
Rollout Strategy
Recommended phased rollout for organizations:
- Pilot (Week 1-2): Deploy to 3-5 senior engineers with
requirements.tomlenforcinguntrustedsandbox mode andcachedweb search. Collect feedback on AGENTS.md patterns and MCP server needs. - Team expansion (Week 3-4): Roll out to full team. Distribute team-standard
config.tomlvia MDM or repo. Enableworkspace-writesandbox for trusted repositories. - CI integration (Week 5-6): Add
codex-actionto CI/CD pipelines for automated PR review and test generation. Use--ephemeralto keep costs predictable. - Org-wide (Month 2+): Deploy via MDM with
requirements.tomlenforcing approved MCP servers, sandbox policies, and model allowlists.
Audit Patterns
Track Codex usage and enforce compliance:
- OpenTelemetry traces: Monitor API call volume, token usage, and latency per team
- Session persistence: Audit
~/.codex/sessions/for compliance review (disable with--ephemeralin sensitive contexts) - MCP identity enforcement:
requirements.tomllogs blocked server attempts — review for unauthorized tool usage - Git audit trail: All Codex file changes go through standard git — review via branch history and PR diffs
Best Practices & Anti-Patterns
Prompting Patterns
- Constraint-driven prompts: Lead with boundaries. “Do NOT change the API contracts. Only refactor internal implementation.”
- Structured reproduction steps: Numbered steps produce better bug fixes than vague descriptions
- Verification requests: End with “Run lint + the smallest relevant test suite. Report commands and results.”
- File references: Use
@filenameto attach specific files to context - Outcome-driven loops: “Implement, run tests, fix failures, stop only when all tests pass.” Codex iterates until done
Testing Philosophy
The community converges on test-driven AI collaboration:23
- Define tests upfront as completion signals
- Let Codex iterate until tests pass (red → green → refactor)
- Adopt Tiger Style programming patterns
- Provide exact file text when requesting patches. Codex uses strict matching, not fuzzy AST-based patching
Context Management Best Practices
- Provide high-quality local documentation rather than relying on web search
- Maintain structured markdown with tables of contents and progress files (“progressive disclosure”)
- Normalize line endings (LF vs CRLF) across tracked files to prevent patch failures
- Keep
AGENTS.mdconcise, since long instructions get pushed out of context
Git Workflow
- Always create a new branch before running Codex on unfamiliar repos
- Use patch-based workflows (
git diff/git apply) rather than direct edits - Review Codex suggestions like code review PRs
- Use
/diffto verify changes before committing
Community Skills and Prompts
The feiskyer/codex-settings repository provides community-maintained configurations:24
Reusable prompts (in ~/.codex/prompts/):
- deep-reflector: Extract learnings from development sessions
- github-issue-fixer [issue-number]: Systematic bug analysis and PR creation
- github-pr-reviewer [pr-number]: Code review workflows
- ui-engineer [requirements]: Production-grade frontend development
Community skills:
- claude-skill: Handoff tasks to Claude Code with permission modes
- autonomous-skill: Multi-session task automation with progress tracking
- deep-research: Parallel sub-task orchestration
- kiro-skill: Requirements → design → tasks → execution pipeline
Anti-Patterns
Common mistakes that waste tokens, produce poor results, or create frustrating workflows.
Cost Anti-Patterns
| Anti-Pattern | Why It Fails | Fix |
|---|---|---|
Using xhigh reasoning for everything |
3-5x token cost with diminishing returns on simple tasks | Use medium by default; reserve xhigh for multi-file architecture decisions |
Never using /compact |
Context fills to 272K, responses degrade | Compact after every major milestone or when /status shows >60% usage |
| Running flagship model in CI | Expensive for routine checks | Create a ci profile with gpt-5.1-codex-mini and low reasoning |
Context Anti-Patterns
| Anti-Pattern | Why It Fails | Fix |
|---|---|---|
| Open-ended “explore everything” prompts | Codex reads dozens of files, burning context on irrelevant code | Scope with specific files: “Review src/auth/login.py and tests/test_auth.py“ |
No AGENTS.md in the project |
Codex wastes turns discovering project structure | Add a 20-line AGENTS.md with key paths, conventions, and test commands |
| Attaching entire directories | Floods context with irrelevant files | Use @filename to attach only the files Codex needs |
Workflow Anti-Patterns
| Anti-Pattern | Why It Fails | Fix |
|---|---|---|
Working on main directly |
No safety net; risky edits are hard to revert | Always create a feature branch before starting Codex |
Skipping /diff before committing |
Codex may have made unintended changes | Review /diff after every task, before any commit |
| Ignoring test output | Codex iterates past failures if you don’t flag them | Use “run tests and stop only when all pass” in your prompt |
| Never forking conversations | One wrong turn pollutes the entire context | /fork before risky explorations; discard bad branches |
Prompt Anti-Patterns
| Anti-Pattern | Why It Fails | Fix |
|---|---|---|
| “Fix the bug” (no context) | Codex guesses which bug, reads everything | “Fix the TypeError in src/api/handler.py:42 — user.name is None when unauthenticated” |
| Multi-task prompts in one message | Codex conflates tasks, misses some | One task per message; use steer mode (Tab) to queue follow-ups |
| Repeating context every message | Wastes tokens on duplicate information | Use /m_update for persistent facts; reference earlier context |
Workflow Recipes
End-to-end patterns for common development scenarios.
Recipe 1: New Project Setup
mkdir my-app && cd my-app && git init
codex
> Create a FastAPI project with: main.py, requirements.txt, Dockerfile,
basic health endpoint, and a README. Use async throughout.
> /init
Review the generated AGENTS.md, edit to match your conventions, then:
> Run the health endpoint test and confirm it passes
Recipe 2: Daily Development Flow
cd ~/project && git checkout -b feature/user-auth
codex
> @src/models/user.py @src/api/auth.py
Add password reset functionality. Requirements:
1. POST /api/auth/reset-request (email → sends token)
2. POST /api/auth/reset-confirm (token + new password)
3. Tests for both endpoints
Run tests when done.
Review with /diff, then commit.
Recipe 3: Complex Refactor with Plan Mode
codex
> /plan Migrate the database layer from raw SQL to SQLAlchemy ORM.
Constraints: don't change any API contracts, keep all existing tests passing.
Review the plan. Approve or steer:
[Tab] Also add a migration script using Alembic
After Codex executes, verify:
> Run the full test suite and report results
> /diff
Recipe 4: PR Review with codex exec
codex exec --model gpt-5.1-codex-mini \
"Review the changes in this branch against main. \
Flag security issues, missed edge cases, and style violations. \
Format as a markdown checklist." \
-o review.md
Recipe 5: Debugging with Cloud Tasks [EXPERIMENTAL]
codex cloud exec --env my-env "Diagnose why the /api/orders endpoint returns 500 \
for orders with > 100 line items. Check the serializer, database query, \
and pagination logic. Propose a fix with tests."
Check progress later:
codex cloud status <TASK_ID>
codex cloud diff <TASK_ID>
Apply the fix locally when done:
codex apply <TASK_ID>
Migration Guide
From Claude Code
| Claude Code Concept | Codex Equivalent |
|---|---|
CLAUDE.md |
AGENTS.md (open standard) |
.claude/settings.json |
.codex/config.toml (TOML format) |
--print flag |
codex exec subcommand |
--dangerously-skip-permissions |
--dangerously-bypass-approvals-and-sandbox |
| Hooks (12+ events) | Hooks (AfterAgent, AfterToolUse — nascent; v0.99.0+) |
| Subagents (Task tool) | Sub-agents (internal, max 6; no user-facing Task tool equivalent) |
/compact |
/compact (identical) |
/cost |
/status (shows token usage) |
| Model: Opus/Sonnet/Haiku | Model: gpt-5.3-codex / gpt-5.3-codex-spark / gpt-5.2-codex / gpt-5.1-codex-mini (Codex exclusively uses OpenAI’s GPT-5.x model family) |
claude --resume |
codex resume |
| Permission rules | Sandbox modes + approval policies |
| MCP config in settings.json | MCP config in config.toml |
Key differences to understand:
- Sandbox is OS-level: Codex uses Seatbelt/Landlock, not containers. Restrictions operate at the kernel level, below the application layer.
- Hooks are nascent: Codex added hooks in v0.99.0 (AfterAgent) and v0.100.0 (AfterToolUse), but the system is early-stage compared to Claude Code’s 12+ lifecycle events. For automation patterns not yet covered, use AGENTS.md instructions or skills.
- Sub-agents are internal but now configurable: Codex has sub-agent machinery (max 6 concurrent, reduced from 12 in v0.91.0). As of v0.104.0, multi-agent roles are customizable via config, allowing named agent roles with distinct profiles.49 Codex still lacks Claude Code’s explicit Task tool UX for user-directed delegation — use cloud tasks or SDK orchestration for delegation patterns.
- AGENTS.md is cross-tool: Your AGENTS.md works in Cursor, Copilot, Amp, Jules, Gemini CLI, and 60,000+ open source projects. CLAUDE.md is Claude-only.
- Profiles replace manual switching: Instead of changing flags per-run, define profiles in config.toml.
From GitHub Copilot
| Copilot Concept | Codex Equivalent |
|---|---|
| Copilot CLI (agentic terminal) | Interactive CLI or desktop app |
| Specialized agents (Explore, Plan) | Skills + plan mode + steer mode |
copilot-instructions.md / AGENTS.md |
AGENTS.md (same standard) |
| MCP support | MCP support (STDIO + HTTP) |
| ACP (Agent Client Protocol) | Hooks (AfterAgent, AfterToolUse) |
| Copilot SDK | Codex SDK (TypeScript) |
| Coding agent workflows | Codex agent with sandbox/approval controls + cloud tasks |
What you gain:
- OS-level sandboxing (Seatbelt/Landlock — kernel-enforced vs container-based)
- Cloud task delegation with codex apply
- Config profiles for workflow switching
- Desktop app with worktree isolation
From Cursor
| Cursor Concept | Codex Equivalent |
|---|---|
Project rules (.cursor/rules) / AGENTS.md |
AGENTS.md + profiles/config |
| Agent chat/composer workflows | Interactive CLI or desktop app |
@ file references |
@ file references (identical) |
| Apply/edit + review | Built-in patching and diff review |
Quick Reference Card
╔═══════════════════════════════════════════════════════════════╗
║ CODEX CLI QUICK REFERENCE ║
╠═══════════════════════════════════════════════════════════════╣
║ ║
║ LAUNCH ║
║ codex Interactive TUI ║
║ codex "prompt" TUI with initial prompt ║
║ codex exec "prompt" Non-interactive mode ║
║ codex app Desktop app ║
║ codex resume Resume previous session ║
║ codex fork Fork a session ║
║ ║
║ FLAGS ║
║ -m, --model <model> Select model ║
║ -p, --profile <name> Load config profile ║
║ -s, --sandbox <mode> Sandbox mode ║
║ -C, --cd <dir> Working directory ║
║ -i, --image <file> Attach image(s) ║
║ -c, --config <key=value> Override config ║
║ --full-auto workspace-write + on-request ║
║ --oss Use local models (Ollama) ║
║ --search Enable live web search ║
║ ║
║ SLASH COMMANDS (in TUI) ║
║ /compact Free tokens /diff Git diff ║
║ /review Code review /plan Plan mode ║
║ /model Switch model /status Session info ║
║ /fork Fork thread /init AGENTS.md scaffold ║
║ /mcp MCP tools /skills Invoke skills ║
║ /ps Background /personality Style ║
║ /permissions Approval mode /statusline Footer config ║
║ ║
║ TUI SHORTCUTS ║
║ @ Fuzzy file search ║
║ !command Run shell command ║
║ Ctrl+G External editor ║
║ Enter Inject instructions (while running) ║
║ Esc Esc Edit previous messages ║
║ ║
║ EXEC MODE (CI/CD) ║
║ codex exec --full-auto "task" Sandboxed auto ║
║ codex exec --json -o out.txt "task" JSON + file output ║
║ codex exec --output-schema s.json Structured output ║
║ codex exec resume --last "continue" Resume session ║
║ ║
║ MCP MANAGEMENT [EXPERIMENTAL] ║
║ codex mcp add <name> -- <cmd> Add STDIO server ║
║ codex mcp add <name> --url <u> Add HTTP server ║
║ codex mcp list List servers ║
║ codex mcp login <name> OAuth flow ║
║ codex mcp remove <name> Delete server ║
║ ║
║ CLOUD [EXPERIMENTAL] ║
║ codex cloud exec --env <ID> Start cloud task ║
║ codex cloud status <ID> Check task progress ║
║ codex cloud diff <ID> View task diff ║
║ codex cloud list List tasks ║
║ codex apply <TASK_ID> Apply cloud diff locally ║
║ ║
║ CONFIG FILES ║
║ ~/.codex/config.toml User config ║
║ .codex/config.toml Project config ║
║ ~/.codex/AGENTS.md Global instructions ║
║ AGENTS.md Project instructions ║
║ requirements.toml Enterprise policy constraints ║
║ ║
║ SANDBOX MODES ║
║ read-only Read files only, no mutations ║
║ workspace-write Read/write in workspace + /tmp ║
║ danger-full-access Full machine access ║
║ ║
║ APPROVAL POLICIES ║
║ untrusted Prompt for all mutations ║
║ on-failure Auto-run until failure ║
║ on-request Prompt for boundary violations ║
║ never No prompts ║
║ ║
║ MODELS (Feb 2026) ║
║ gpt-5.3-codex Default flagship (272K in / 400K) ║
║ gpt-5.3-codex-spark Interactive, lower latency (128K) ║
║ gpt-5.2-codex Long-horizon refactors (272K / 400K) ║
║ gpt-5.1-codex-mini Quick tasks, cost-efficient (272K/400K)║
║ ║
╚═══════════════════════════════════════════════════════════════╝
Changelog
| Date | Version | What Changed | Source |
|---|---|---|---|
| 2026-02-24 | Guide v2.7 | Expanded Access/Pricing section: added Free/Go promotional tier, 2x rate limits for paid plans, per-plan usage limits (5-hour window), credit costs table. Added allow_login_shell config key. |
53 |
| 2026-02-22 | Guide v2.6 | Added missing config keys: features.multi_agent, features.apply_patch_freeform, features.search_tool, agents.* (multi-agent roles), model_context_window, model_auto_compact_token_limit, mcp_oauth_callback_port, mcp_oauth_credentials_store, notify. Added App v26.217 changelog entry. |
52 |
| 2026-02-19 | Guide v2.5 | Updated version references to CLI 0.104.0, added v0.103.0 and v0.104.0 changelog entries, added WS_PROXY/WSS_PROXY proxy support, distinct approval IDs, commit co-author attribution, replaced removed remote_models feature flag with command_attribution. |
— |
| 2026-02-18 | CLI 0.104.0 | WS_PROXY/WSS_PROXY WebSocket proxy support, distinct approval IDs for multi-step commands, thread archive/unarchive notifications | 51 |
| 2026-02-17 | App v26.217 | Drag-and-drop to reorder queued messages, model downgrade warning, improved fuzzy file search with attachment recovery after restart | 52 |
| 2026-02-17 | CLI 0.103.0 | Commit co-author attribution via prepare-commit-msg hook (configurable via command_attribution), richer app listing metadata/branding, removed remote_models feature flag |
50 |
| 2026-02-17 | Guide v2.4 | Updated all version references for CLI 0.102.0, added v0.102.0 changelog entry and footnote, updated sub-agents note with configurable multi-agent roles. | — |
| 2026-02-17 | CLI 0.102.0 | Unified permissions flow, structured network approvals, customizable multi-agent roles, model reroute notifications, js_repl stability fixes | 49 |
| 2026-02-16 | Guide v2.3 | Fixed migration table: hooks now exist (v0.99.0+), subagents acknowledged (max 6), model list complete. Added dedicated Hooks section (AfterAgent, AfterToolUse, migration patterns). Fixed Recipe 5 phantom commands (cloud start→cloud exec, cloud pull→apply). Fixed codex auth→codex login. Windows sandbox promoted from Experimental. Linux Bubblewrap now vendored/built-in. Added minimal reasoning effort level. Expanded memory section (v0.101.0 refinements, memory vs AGENTS.md). Updated AGENTS.md adopter list (60,000+ projects, Linux Foundation governance). Updated Copilot migration table. Fixed [EXPERIMENTAL] case consistency. Added ReadOnlyAccess policy documentation, JS REPL Runtime section, production Deploy skill example, expanded cost section (hidden token overhead, team cost management). Tagged 20 untagged code blocks. Verified all 30 ToC anchors. Post-evaluation fixes: /permissions terminology corrected (approval mode→approval policy), duplicate “Project Trust” header renamed, chat/completions deprecation language hedged, OpenTelemetry section expanded with config example, migration “harder to escape” language made precise. |
Deliberation audit |
| 2026-02-16 | Guide v2.2 | Added 19 historical CLI milestone releases (v0.2.0–v0.91.0) to changelog. Replaced bulk 25 citation with 20 individual release footnotes (37–61). Added 61 Apache 2.0 license citation. Added 5 citation to codex-linux-sandbox reference. Added 22 citation to MDM preference domain. Updated 6 Seatbelt note re: bot-blocking. Added note on unverifiable OpenAI blog URLs. Total footnotes: 56 (was 36). | Deliberation audit |
| 2026-02-15 | Guide v2.1 | Enterprise section corrected (managed-admin-config.toml → requirements.toml with verified TOML keys), 272K context qualified as input window with citation, 6 Seatbelt citation URL added, Key Takeaways block added, style violations fixed, meta description trimmed, AGENTS.md adopter list expanded. | Blog evaluator audit |
| 2026-02-14 | Guide v2 | Major revision: Codex-verified corrections to models (272K context), config keys, feature flags, pricing, enterprise config, CI/CD action, SDK API, MCP options, codex exec flags, desktop app features, migration comparisons. Removed unverifiable claims. | Self-review |
| 2026-02-12 | CLI 0.101.0 | Model resolution improvements, memory refinements, stability | 37 |
| 2026-02-12 | CLI 0.100.0 | Experimental JS REPL, multiple rate limits, WebSocket transport, memory commands, enhanced sandbox | 38 |
| 2026-02-12 | App v260212 | Conversation forking, floating pop-out window, Windows alpha | 18 |
| 2026-02-12 | – | GPT-5.3-Codex-Spark launch (lower-latency interactive variant) | 26 |
| 2026-02-11 | CLI 0.99.0 | Concurrent shell commands, /statusline, sortable resume picker, GIF/WebP support, shell snapshotting |
39 |
| 2026-02-06 | CLI 0.98.0 | GPT-5.3-Codex support, steer mode stable and default, model switching fixes | 40 |
| 2026-02-06 | CLI 0.97.0 | “Allow and remember” MCP approvals, live skill detection, /config diagnostics, memory plumbing |
41 |
| 2026-02-06 | CLI 0.96.0 | Async thread/compact v2, WebSocket rate limits, unified_exec non-Windows, config provenance | 42 |
| 2026-02-06 | CLI 0.95.0 | codex app command, personal skills, parallel shell tools, git hardening |
43 |
| 2026-02-05 | – | GPT-5.3-Codex launch — unified model, 25% faster, end-to-end computer operation | 27 |
| 2026-02-02 | – | Codex Desktop App launch (macOS) — multi-tasking, worktrees, automations | 17 |
| 2026-01-30 | CLI 0.94.0 | Plan mode default, personality stable, skills from .agents/skills, runtime metrics |
44 |
| 2026-01-29 | CLI 0.93.0 | SOCKS5 proxy, plan mode streaming, /apps, smart approvals default, SQLite logs |
45 |
| 2026-01-29 | CLI 0.92.0 | API v2 threads, thread filtering, MCP OAuth scopes, multi-agent collaboration | 46 |
| 2026-01-25 | CLI 0.91.0 | Reduced max sub-agents from 12 to 6 for tighter resource guardrails | 47 |
| 2026-01-21 | CLI 0.88.0 | Device-code auth fallback, collaboration modes, /fork, remote models, model_personality config |
48 |
| 2026-01-06 | CLI 0.78.0 | Ctrl+G external editor, project-aware config layering, macOS MDM config, TUI2 transcript nav, .dmg installers |
54 |
| 2025-12-18 | – | GPT-5.2-Codex launch — context compaction, refactors/migrations, cybersecurity | 28 |
| 2025-12-09 | CLI 0.66.0 | Exec policy system (TUI whitelisting, sandbox denial amendments), CRLF preservation, Linux Sigstore signing | 55 |
| 2025-11-19 | – | GPT-5.1-Codex-Max — multi-window compaction, Windows training, 30% fewer thinking tokens | 29 |
| 2025-11-19 | CLI 0.59.0 | Native compaction, tool output limit raised to 10K tokens, Windows Agent mode sandbox, credits in /status |
56 |
| 2025-10-25 | CLI 0.50.0 | /feedback diagnostics, sandbox violation risk assessment, MCP startup improvements, env var redaction |
57 |
| 2025-10-06 | – | Codex GA at DevDay — Slack integration, SDK, admin tools | 30 |
| 2025-10-06 | CLI 0.45.0 | Breaking: codex login --api-key → --with-api-key (stdin). OAuth MCP auth, parallel tool calls, pulsing dot UI |
58 |
| 2025-09-23 | – | GPT-5-Codex + IDE extension + CLI revamp — images, web search, code review | 31 |
| 2025-09-23 | CLI 0.40.0 | Default model → gpt-5-codex, auto-compaction at 220K tokens, /review commands, git undo, Windows binary support |
59 |
| 2025-06-30 | CLI 0.2.0 | First Rust binary release — pre-built binaries for macOS (aarch64/x86_64) and Linux (gnu/musl), codex-exec and codex-linux-sandbox tools |
60 |
| 2025-06 | – | Rust rewrite announced (“Codex CLI is Going Native”) | 32 |
| 2025-06-03 | – | Plus user expansion, internet access for cloud, PR updates, voice dictation | 33 |
| 2025-05-16 | – | Codex Cloud launch — cloud agent with codex-1 model, GitHub PR creation | 34 |
| 2025-04-16 | – | Codex CLI open-source launch (Apache 2.0, TypeScript, codex-mini-latest)61 | 1 |
References
Note on OpenAI blog URLs: References 17, 26–31, and 34 link to
openai.com/index/blog posts which return HTTP 403 to automated access due to Cloudflare bot protection. These URLs are valid when accessed via a standard web browser.
-
GitHub — openai/codex — Open-source repository, releases, and discussions. ↩↩↩
-
Codex CLI Windows Support — Windows installation and WSL guidance. ↩
-
Codex IDE Extension — VS Code, Cursor, and Windsurf integration. ↩
-
Codex Cloud — Cloud task documentation and internet access controls. ↩↩
-
Codex Security — Sandbox architecture and security model. ↩↩↩
-
macOS Seatbelt Sandbox — Community documentation for Apple’s sandbox-exec framework (no official Apple developer docs published). Note: this wiki may block automated access (HTTP 403); see also
man sandbox-execon macOS. ↩↩↩ -
Linux Landlock LSM — Kernel filesystem access control. ↩
-
How Codex CLI Flags Actually Work — Community analysis of flag interactions. ↩
-
Breaking Out of the Sandbox — Community sandbox configuration patterns. ↩
-
AGENTS.md Open Standard — Cross-tool instruction standard under the Linux Foundation. ↩
-
Custom Instructions with AGENTS.md — Official guide. ↩
-
Codex MCP Integration — MCP server configuration and management. ↩
-
Building Workflows with Agents SDK — Codex as MCP server for multi-agent orchestration. ↩
-
Agent Skills — Skills system documentation. ↩
-
Codex CLI Features — Plan mode, steer mode, and collaboration features. ↩↩
-
Non-Interactive Mode —
codex execdocumentation. ↩ -
Introducing the Codex App — Desktop app launch announcement. ↩↩↩↩
-
Codex App Documentation — Desktop app features and troubleshooting. ↩↩
-
Codex GitHub Action — CI/CD integration. ↩
-
Codex Pricing — Subscription and API pricing. ↩
-
Codex Configuration Reference — Enterprise requirements.toml schema and MDM distribution. ↩↩↩
-
Best Practices for Using Codex — Community forum thread. ↩
-
feiskyer/codex-settings — Community-maintained configurations, skills, and prompts. ↩
-
Codex CLI Releases — GitHub release notes. ↩↩
-
Introducing GPT-5.3-Codex-Spark — Cerebras partnership, 1000+ tok/s. ↩↩
-
Introducing GPT-5.3-Codex — Unified model launch. ↩
-
Introducing GPT-5.2-Codex — Context compaction and large-scale changes. ↩
-
Building More with GPT-5.1-Codex-Max — Multi-window compaction. ↩
-
Codex is Now Generally Available — DevDay 2025 announcement. ↩
-
Introducing Upgrades to Codex — GPT-5-Codex + IDE extension. ↩↩
-
Codex CLI is Going Native — Rust rewrite discussion. ↩
-
Codex Updates: Internet Access and Plus Rollout — June 2025 expansion. ↩
-
Introducing Codex — Cloud agent launch. ↩↩
-
Codex Context Window Discussion — 272K input tokens + 128K output tokens = 400K total budget, confirmed via source code. ↩
-
Deprecating chat/completions support in Codex — OpenAI announced chat/completions API removal for Codex, completed February 2026. ↩
-
Codex CLI v0.101.0 — Model resolution improvements, memory refinements, stability. February 12, 2026. ↩↩
-
Codex CLI v0.100.0 — Experimental JS REPL, multiple rate limits, WebSocket transport, memory commands, enhanced sandbox. February 12, 2026. ↩
-
Codex CLI v0.99.0 — Concurrent shell commands,
/statusline, sortable resume picker, GIF/WebP support, shell snapshotting. February 11, 2026. ↩ -
Codex CLI v0.98.0 — GPT-5.3-Codex support, steer mode stable and default, model switching fixes. February 6, 2026. ↩
-
Codex CLI v0.97.0 — “Allow and remember” MCP approvals, live skill detection,
/configdiagnostics, memory plumbing. February 6, 2026. ↩ -
Codex CLI v0.96.0 — Async thread/compact v2, WebSocket rate limits, unified_exec non-Windows, config provenance. February 6, 2026. ↩
-
Codex CLI v0.95.0 —
codex appcommand, personal skills, parallel shell tools, git hardening. February 6, 2026. ↩ -
Codex CLI v0.94.0 — Plan mode default, personality stable, skills from
.agents/skills, runtime metrics. January 30, 2026. ↩ -
Codex CLI v0.93.0 — SOCKS5 proxy, plan mode streaming,
/apps, smart approvals default, SQLite logs. January 29, 2026. ↩ -
Codex CLI v0.92.0 — API v2 threads, thread filtering, MCP OAuth scopes, multi-agent collaboration. January 29, 2026. ↩
-
Codex CLI v0.91.0 — Reduced max sub-agents from 12 to 6 for tighter resource guardrails. January 25, 2026. ↩
-
Codex CLI v0.88.0 — Device-code auth fallback, collaboration modes,
/fork, remote models,model_personalityconfig. January 21, 2026. ↩ -
Codex CLI v0.102.0 — Unified permissions flow, structured network approvals, customizable multi-agent roles, model reroute notifications. February 17, 2026. ↩↩
-
Codex CLI v0.103.0 — Commit co-author attribution via prepare-commit-msg hook, richer app listing metadata/branding, removed
remote_modelsfeature flag. February 17, 2026. ↩ -
Codex CLI v0.104.0 — WS_PROXY/WSS_PROXY WebSocket proxy support, distinct approval IDs for commands, thread archive/unarchive notifications. February 18, 2026. ↩↩↩
-
Codex Changelog — Codex App v26.217: drag-and-drop reorder, model downgrade warning, fuzzy file search improvements. Codex Config Reference — Complete configuration key reference. February 2026. ↩↩
-
Codex Pricing — Plan tiers, usage limits per 5-hour window, credit costs, and Free/Go promotional access. February 2026. ↩↩
-
Codex CLI v0.78.0 —
Ctrl+Gexternal editor, project-aware config layering, macOS MDM config, TUI2 transcript nav,.dmginstallers. January 6, 2026. ↩ -
Codex CLI v0.66.0 — Exec policy system, CRLF preservation on Windows, cloud exec
--branch, Linux Sigstore signing. December 9, 2025. ↩ -
Codex CLI v0.59.0 — Native compaction, tool output limit raised to 10K tokens, Windows Agent mode sandbox, credits in
/status. November 19, 2025. ↩ -
Codex CLI v0.50.0 —
/feedbackdiagnostics, sandbox violation risk assessment, MCP startup improvements, env var redaction. October 25, 2025. ↩ -
Codex CLI v0.45.0 — Breaking:
codex login --api-key→--with-api-key(stdin). OAuth MCP auth, parallel tool calls. October 6, 2025. ↩ -
Codex CLI v0.40.0 — Default model →
gpt-5-codex, auto-compaction at 220K tokens,/reviewcommands, git undo, Windows binary. September 23, 2025. ↩ -
Codex CLI v0.2.0 — First Rust binary release. Pre-built binaries for macOS (aarch64/x86_64) and Linux (gnu/musl),
codex-execandcodex-linux-sandboxtools. June 30, 2025. ↩ -
GitHub — openai/codex LICENSE — Apache License 2.0. Original open-source launch April 2025. ↩↩↩