Links marked with * are affiliate links. If a purchase is made through such links, we receive a commission.
You installed Codex, typed codex into your terminal, and wondered: "Okay, now what?"
Same here. OpenAI's coding agent ships with dozens of CLI commands, more than 40 slash commands in the interactive TUI, and a separate desktop app with its own shortcuts. Without a reference, you lose track fast.
This article lays out every Codex command in one place. Each CLI command, every slash command, all flags, every keyboard shortcut for CLI and App. It's the most thorough Codex reference you'll find in English. If you'd rather compare Codex head-to-head with Claude Code, our in-depth Claude Code vs. OpenAI Codex comparison has you covered.
TL;DRKey Takeaways
30+ CLI commands cover the whole tool, from codex exec (non-interactive execution) to codex review (code review) and codex cloud (cloud tasks)
Over 40 slash commands in the composer control the model, permissions, sessions, plan mode, and more, with parameter and (where documented) introduction-version columns
Three sandbox modes (read-only, workspace-write, danger-full-access) and four approval policies control what Codex can do on your system
Codex Cloud offloads long-running tasks to remote sandboxed environments, with best-of-N attempts on demand
Installing and Starting Codex
Codex CLI installs via npm or Homebrew. On first launch, Codex asks you to sign in with your ChatGPT account or an API key.
# Install via npm
npm install -g @openai/codex
# Or via Homebrew (native Rust binary, faster)
brew install codex
# Sign in interactively (opens browser for OAuth)
codex login
# Sign in with an API key
echo $OPENAI_API_KEY | codex login --with-api-key
# Check login status
codex login status
# Sign out
codex logout
# Start an interactive TUI session
codex
# Start with an initial prompt
codex "Explain the architecture of this project"
# Run non-interactively (for scripts)
codex exec -s workspace-write -m gpt-5.5 "Refactor auth.ts"
# Launch the desktop app
codex app
Tip
Always start Codex inside the right project folder. You can also set the working directory explicitly with --cd /path/to/project.
CLI Commands (Overview)
Codex comes in two flavors. The CLI runs in your terminal. The App is a desktop application for macOS and Windows. The "Example" column shows the typical usage of each command.
Commandcodex
DescriptionStart an interactive TUI session in the terminal
Examplecodex
Commandcodex app
DescriptionLaunch the Codex desktop app (macOS/Windows)
Examplecodex app
Commandcodex exec
DescriptionRun a task non-interactively, stream output to stdout
Examplecodex exec "Fix bug"
Commandcodex exec resume
DescriptionResume a previous session non-interactively
Examplecodex exec resume --last "Continue task"
Commandcodex review
DescriptionCode review (uncommitted, branch diff, or commit)
Examplecodex review --uncommitted
Commandcodex apply
DescriptionApply a diff from a Codex session or cloud task
Examplecodex apply TASK_ID
Commandcodex resume
DescriptionResume an interactive session (session picker)
Examplecodex resume
Commandcodex fork
DescriptionFork a session into a new thread
Examplecodex fork
Commandcodex cloud exec
DescriptionSubmit a cloud task in a sandbox environment
Examplecodex cloud exec --env ENV_ID "..."
Commandcodex cloud list
DescriptionList cloud tasks (with filter and pagination)
Examplecodex cloud list
Commandcodex cloud status
DescriptionShow the status of a cloud task
Examplecodex cloud status ID
Commandcodex cloud diff
DescriptionShow the diff of a cloud task
Examplecodex cloud diff ID
Commandcodex cloud apply
DescriptionApply a cloud task diff locally
Examplecodex cloud apply ID
Commandcodex mcp add
DescriptionAdd an MCP server (stdio or HTTP)
Examplecodex mcp add name -- cmd
Commandcodex mcp list
DescriptionList configured MCP servers
Examplecodex mcp list
Commandcodex mcp get
DescriptionShow an MCP server's configuration
Examplecodex mcp get name
Commandcodex mcp remove
DescriptionRemove an MCP server
Examplecodex mcp remove name
Commandcodex mcp login
DescriptionOAuth login for an MCP server
Examplecodex mcp login name
Commandcodex mcp logout
DescriptionRemove an MCP server's OAuth credentials
Examplecodex mcp logout name
Commandcodex features list
DescriptionShow feature flags with status and maturity
Examplecodex features list
Commandcodex features enable/disable
DescriptionEnable or disable a feature flag persistently
Examplecodex features enable NAME
Commandcodex login
DescriptionSign in via OAuth or API key
Examplecodex login
Commandcodex login status
DescriptionShow the current login status
Examplecodex login status
Commandcodex logout
DescriptionRemove stored credentials
Examplecodex logout
Commandcodex sandbox
DescriptionRun a command in the Codex sandbox (macOS/Linux/Windows)
Start a headless app server, controllable from the Codex app or Chrome extension (since 0.130)
codex remote-control
Note
codex exec is the command you'll use most for automation. It runs tasks non-interactively and prints the result to stdout. Perfect for scripts and CI/CD pipelines.
codex exec: Flags for Non-Interactive Execution
codex exec is your workhorse for automated workflows. Without any flags, Codex waits for human approval, and scripts hang. So always set a sandbox mode.
# Standard pattern for automated execution
codex exec -s workspace-write -m gpt-5.5 "your prompt"
# Maximum reasoning depth
codex exec -s workspace-write -m gpt-5.5 \
-c model_reasoning_effort='"xhigh"' "complex task"
# Read-only for analysis (no file changes)
codex exec -s read-only -m gpt-5.5 "Analyze the architecture"
Flag--model, -m
DescriptionOverrides the model from your config
Example-m gpt-5.5
Flag--sandbox, -s
DescriptionSandbox mode: read-only, workspace-write, or danger-full-access
Example-s workspace-write
Flag--ask-for-approval, -a
DescriptionApproval policy: untrusted, on-failure, on-request, never
Example-a on-request
Flag--cd, -C
DescriptionSets the working directory for the agent
Example-C /path/to/project
Flag--add-dir
DescriptionGrants additional writable directories
Example--add-dir ../backend
Flag--image, -i
DescriptionAttaches images to the prompt (repeatable)
DescriptionLoads a named config profile from config.toml
Example-p fast-profile
Flag--enable / --disable
DescriptionEnables or disables a feature flag for this run
Example--enable search_tool
Flag--json
DescriptionOutputs events as JSONL (one JSON line per event)
Examplecodex exec --json "..."
Flag--output-last-message, -o
DescriptionSaves the agent's last message to a file
Example-o /tmp/result.txt
Flag--output-schema
DescriptionJSON Schema file that constrains the final response
Example--output-schema schema.json
Flag--ephemeral
DescriptionSession is not persisted to disk
Examplecodex exec --ephemeral "..."
Flag--skip-git-repo-check
DescriptionAllows running outside a Git repo
Examplecodex exec --skip-git-repo-check "..."
Flag--color
DescriptionControls ANSI colors: always, never, auto
Example--color never
Flag--oss
DescriptionUses the local open-source provider (Ollama)
Examplecodex exec --oss "..."
Flag--full-auto
DescriptionDeprecated. Alias for -a on-request -s workspace-write. Use -s workspace-write directly instead
Examplecodex exec --full-auto "..."
Flag
Description
Example
--model, -m
Overrides the model from your config
-m gpt-5.5
--sandbox, -s
Sandbox mode: read-only, workspace-write, or danger-full-access
-s workspace-write
--ask-for-approval, -a
Approval policy: untrusted, on-failure, on-request, never
-a on-request
--cd, -C
Sets the working directory for the agent
-C /path/to/project
--add-dir
Grants additional writable directories
--add-dir ../backend
--image, -i
Attaches images to the prompt (repeatable)
-i screenshot.png
--config, -c
Overrides config.toml values (TOML syntax)
-c model_reasoning_effort='"xhigh"'
--profile, -p
Loads a named config profile from config.toml
-p fast-profile
--enable / --disable
Enables or disables a feature flag for this run
--enable search_tool
--json
Outputs events as JSONL (one JSON line per event)
codex exec --json "..."
--output-last-message, -o
Saves the agent's last message to a file
-o /tmp/result.txt
--output-schema
JSON Schema file that constrains the final response
--output-schema schema.json
--ephemeral
Session is not persisted to disk
codex exec --ephemeral "..."
--skip-git-repo-check
Allows running outside a Git repo
codex exec --skip-git-repo-check "..."
--color
Controls ANSI colors: always, never, auto
--color never
--oss
Uses the local open-source provider (Ollama)
codex exec --oss "..."
--full-auto
Deprecated. Alias for -a on-request -s workspace-write. Use -s workspace-write directly instead
codex exec --full-auto "..."
Warning
--full-auto is deprecated. Use -s workspace-write instead (or -s workspace-write -a on-request for the same behavior).
Common Patterns
# Attach images (screenshots, design specs)
codex exec -s workspace-write -m gpt-5.5 -i screenshot.png "Implement this UI"
# Multiple writable directories
codex exec -s workspace-write -C apps/frontend --add-dir ../backend "Sync API types"
# JSON output for scripts
codex exec -s workspace-write --json "List all TODO comments"
# Save the result to a file
codex exec -s workspace-write -o /tmp/result.txt "Summarize this codebase"
# Structured output with JSON Schema
codex exec -s workspace-write --output-schema schema.json "Extract all API endpoints"
# Pipe the prompt via stdin
cat prompt.txt | codex exec -s workspace-write -
# Use a config profile
codex exec -s workspace-write -p thorough "Thorough analysis"
# Local open-source model (Ollama)
codex exec --oss -s workspace-write "Explain this function"
Code Review
codex review analyzes code changes non-interactively and prints the results to stdout. It doesn't modify files.
Flag--uncommitted
DescriptionReviews staged, unstaged, and untracked changes
Examplecodex review --uncommitted
Flag--base
DescriptionReviews changes against a base branch
Examplecodex review --base main
Flag--commit
DescriptionReviews a specific commit
Examplecodex review --commit abc123
Flag--title
DescriptionOptional title for the review summary
Examplecodex review --title "Add auth"
FlagPROMPT
DescriptionCustom review instructions (can also be piped via stdin with -)
Examplecodex review "Focus on security"
Flag
Description
Example
--uncommitted
Reviews staged, unstaged, and untracked changes
codex review --uncommitted
--base
Reviews changes against a base branch
codex review --base main
--commit
Reviews a specific commit
codex review --commit abc123
--title
Optional title for the review summary
codex review --title "Add auth"
PROMPT
Custom review instructions (can also be piped via stdin with -)
codex review "Focus on security"
# Review uncommitted changes (staged + unstaged + untracked)
codex review --uncommitted
# Review changes against a branch (before opening a PR)
codex review --base main
# Review a specific commit
codex review --commit abc123
# Review with a title and a custom focus
codex review --base main --title "Add auth" "Focus on security"
# Review via exec with JSON output
codex exec review --uncommitted --json
Session Management
Codex stores sessions locally under ~/.codex/sessions/. You can resume them any time, fork them, or pick them up non-interactively.
# Interactive: open the session picker
codex resume
# Interactive: resume the most recent session directly
codex resume --last
# Non-interactive: resume the latest session with a new prompt
codex exec resume --last -s workspace-write -m gpt-5.5 \
"Now add error handling"
# Resume a specific session by UUID
codex exec resume 7f9f9a2e-1b3c-4c7a... -s workspace-write -m gpt-5.5 \
"Implement the plan"
# Fork a session (new thread from existing context)
codex fork --last
# Apply a diff from a local session
codex apply TASK_ID
# Apply a diff from a cloud task
codex cloud apply TASK_ID
# Apply a specific attempt (when using --attempts N)
codex cloud apply TASK_ID --attempt 2
Tip
Sessions started with --ephemeral aren't saved to disk. Use this for quick one-off questions where you don't need any history.
Codex Cloud
Codex Cloud runs tasks in sandboxed remote environments. All subcommands are non-interactive. The --env flag is required.
Flag--env
DescriptionRequired: target environment ID for the cloud task
Example--env ENV_ID
Flag--attempts
DescriptionNumber of attempts (best-of-N), default: 1, max: 4
Attempt number for diff/apply (when using --attempts N)
codex cloud diff TASK_ID --attempt 2
# Submit a task
codex cloud exec --env ENV_ID "Refactor the payment module"
# Best-of-3: run three attempts
codex cloud exec --env ENV_ID --attempts 3 "Fix the flaky test"
# Run on a specific branch
codex cloud exec --env ENV_ID --branch feature/auth "Add OAuth"
# List tasks
codex cloud list
codex cloud list --json --limit 5
# Check the status
codex cloud status TASK_ID
# Show the diff (specific attempt)
codex cloud diff TASK_ID --attempt 2
Sandbox Modes
The sandbox limits what Codex can do on your system. You pick the mode with -s or --sandbox.
Moderead-only
ReadAnywhere
WriteNowhere
NetworkNo
When to useQuestions, explanations, code analysis
Modeworkspace-write
ReadAnywhere
WriteWorking dir only
NetworkNo
When to useDefault for most tasks
Modedanger-full-access
ReadAnywhere
WriteAnywhere
NetworkYes
When to useOnly when truly needed (e.g., installing packages)
Mode
Read
Write
Network
When to use
read-only
Anywhere
Nowhere
No
Questions, explanations, code analysis
workspace-write
Anywhere
Working dir only
No
Default for most tasks
danger-full-access
Anywhere
Anywhere
Yes
Only when truly needed (e.g., installing packages)
Codex also ships with a codex sandbox command that lets you run any command inside the sandbox without involving the agent:
# Run a command in the sandbox (macOS)
codex sandbox macos -- npm test
# Log denied accesses for debugging
codex sandbox macos --log-denials -- ./build.sh
# Linux (Landlock + seccomp)
codex sandbox linux -- python3 script.py
Approval Policies
Approval policies control when Codex asks for permission before running a command. You set them with -a or --ask-for-approval.
Policyuntrusted
BehaviorOnly trusted commands (ls, cat, sed) run without approval
Policyon-failure
BehaviorAll commands run; approval only on failure
Policyon-request
BehaviorThe model decides when to ask for approval
Policynever
BehaviorNever asks for approval; failures go straight back to the model
Policy
Behavior
untrusted
Only trusted commands (ls, cat, sed) run without approval
on-failure
All commands run; approval only on failure
on-request
The model decides when to ask for approval
never
Never asks for approval; failures go straight back to the model
Note
Inside the interactive TUI you switch approval mode with /permissions. Three presets are available: Auto (default), Read Only, and Full Access.
MCP Servers (Model Context Protocol)
Codex can connect to MCP servers for extra tools (databases, APIs, GitHub, and more). All management commands are non-interactive.
# List configured servers
codex mcp list
codex mcp list --json
# Show a server's config
codex mcp get my-server
codex mcp get my-server --json
# Add a stdio server
codex mcp add my-server -- npx -y @my/mcp-server
codex mcp add my-server --env API_KEY=sk-123 -- node server.js
# Add an HTTP server
codex mcp add my-server --url https://mcp.example.com/sse
codex mcp add my-server --url https://mcp.example.com \
--bearer-token-env-var MY_TOKEN_VAR
# Remove a server
codex mcp remove my-server
# OAuth login for an MCP server
codex mcp login my-server --scopes "read,write"
codex mcp logout my-server
Tip
With codex mcp-server you can run Codex itself as an MCP server. That makes it possible to plug Codex into other tools that speak MCP.
Slash Commands (CLI and App)
Slash commands are available in the interactive TUI (started with codex) and in the desktop app. Type / in the composer to open the list. While a task is running, you can type a slash command and press Tab to queue it for the next turn.
The CLI TUI has far more slash commands than the app. The "Since" column shows the Codex version a command is documented from in the official release notes (where available, otherwise "n/a").
Command/agent
Parameter
Since0.95
DescriptionSwitch the active agent thread
Command/apps
Parameter
Since0.93
DescriptionBrowse connectors and apps and insert them into the prompt
Command/approve
Parameter
Since0.129
DescriptionApprove one retry after a denied auto review
Command/archive
Parameter
Since0.136
DescriptionArchive the current session and exit Codex
Command/clear
Parameter
Since0.105
DescriptionClear the terminal and start a fresh chat
Command/compact
Parameter
Since0.11
DescriptionSummarize the visible conversation to free tokens
Command/copy
Parameter
Since0.105
DescriptionCopy the latest completed Codex output (also Ctrl+O)
Command/debug-config
Parameter
Since0.96
DescriptionPrint config layers and diagnostics
Command/delete
Parameter
Since0.140
DescriptionPermanently delete the current session and exit Codex
Command/diff
Parameter
Since0.23
DescriptionShow the Git diff, including untracked files
Command/exit
Parameter
Since0.53
DescriptionExit the CLI (alias /quit)
Command/experimental
Parameter
Since0.74
DescriptionToggle experimental features on or off
Command/fast
Parameteron | off | status
Since0.110
DescriptionToggle the Fast service tier
Command/feedback
Parameter
Since0.50
DescriptionSend logs to the Codex maintainers (also App)
Command/fork
Parameter
Since0.88
DescriptionFork the current conversation into a new thread
Command/goal
Parametergoal | pause | resume | clear
Since0.128
DescriptionSet, pause, or clear a task goal
Command/hooks
Parameter
Since0.129
DescriptionView and manage lifecycle hooks
Command/ide
Parametertext
Since0.129
DescriptionInclude open files, selection, and IDE context
Command/import
Parameter
Since0.140
DescriptionImport Claude Code setup, project files, and chats
Command/init
Parameter
Since0.28
DescriptionGenerate an AGENTS.md scaffold as project context
Command/keymap
Parameter
Since0.129
DescriptionRemap the TUI keyboard shortcuts
Command/logout
Parameter
Sincen/a
DescriptionSign out of Codex
Command/mcp
Parameterverbose
Since0.23
DescriptionList the configured MCP tools (also App)
Command/memories
Parameter
Sincen/a
DescriptionConfigure memory use and generation
Command/mention
Parameterpath
Sincen/a
DescriptionAttach a file to the conversation
Command/model
Parametermodel
Since0.23
DescriptionChoose the active model and reasoning effort
Command/new
Parameter
Since0.59
DescriptionStart a new conversation in the same CLI session
Command/permissions
Parameter
Since0.89
DescriptionSet what Codex can do without asking first
Command/personality
Parameterstyle
Since0.92
DescriptionChoose a communication style for responses
Command/plan
Parameterprompt
Since0.93
DescriptionSwitch to plan mode (optional inline prompt)
Command/plugins
Parameter
Since0.117
DescriptionBrowse installed and discoverable plugins
Command/ps
Parameter
Since0.76
DescriptionShow experimental background terminals
Command/raw
Parameteron | off
Since0.129
DescriptionToggle raw scrollback mode
Command/resume
Parameter
Since0.65
DescriptionResume a saved session via the session picker
Command/review
Parameter
Since0.39
DescriptionAsk Codex to review your working tree (also App)
Command/sandbox-add-read-dir
Parameterdirectory
Sincen/a
DescriptionGrant the sandbox read access to a directory (Windows only)
Command/side
Parametertext
Since0.122
DescriptionStart an ephemeral side conversation (alias /btw)
DescriptionConfigure the terminal window or tab title
Command/usage
Parameterdaily | weekly | cumulative
Since0.140
DescriptionView token usage or redeem a rate-limit reset
Command/vim
Parameter
Since0.129
DescriptionToggle Vim mode for the composer
Parameter
Description
/agent
0.95
Switch the active agent thread
/apps
0.93
Browse connectors and apps and insert them into the prompt
/approve
0.129
Approve one retry after a denied auto review
/archive
0.136
Archive the current session and exit Codex
/clear
0.105
Clear the terminal and start a fresh chat
/compact
0.11
Summarize the visible conversation to free tokens
/copy
0.105
Copy the latest completed Codex output (also Ctrl+O)
/debug-config
0.96
Print config layers and diagnostics
/delete
0.140
Permanently delete the current session and exit Codex
/diff
0.23
Show the Git diff, including untracked files
/exit
0.53
Exit the CLI (alias /quit)
/experimental
0.74
Toggle experimental features on or off
/fast
on | off | status
0.110
Toggle the Fast service tier
/feedback
0.50
Send logs to the Codex maintainers (also App)
/fork
0.88
Fork the current conversation into a new thread
/goal
goal | pause | resume | clear
0.128
Set, pause, or clear a task goal
/hooks
0.129
View and manage lifecycle hooks
/ide
text
0.129
Include open files, selection, and IDE context
/import
0.140
Import Claude Code setup, project files, and chats
/init
0.28
Generate an AGENTS.md scaffold as project context
/keymap
0.129
Remap the TUI keyboard shortcuts
/logout
n/a
Sign out of Codex
/mcp
verbose
0.23
List the configured MCP tools (also App)
/memories
n/a
Configure memory use and generation
/mention
path
n/a
Attach a file to the conversation
/model
model
0.23
Choose the active model and reasoning effort
/new
0.59
Start a new conversation in the same CLI session
/permissions
0.89
Set what Codex can do without asking first
/personality
style
0.92
Choose a communication style for responses
/plan
prompt
0.93
Switch to plan mode (optional inline prompt)
/plugins
0.117
Browse installed and discoverable plugins
/ps
0.76
Show experimental background terminals
/raw
on | off
0.129
Toggle raw scrollback mode
/resume
0.65
Resume a saved session via the session picker
/review
0.39
Ask Codex to review your working tree (also App)
/sandbox-add-read-dir
directory
n/a
Grant the sandbox read access to a directory (Windows only)
/side
text
0.122
Start an ephemeral side conversation (alias /btw)
/skills
0.65
Browse and use skills
/status
0.23
Show model, approval policy, writable paths, and token usage (also App)
/statusline
0.99
Configure the TUI status-line fields
/stop
0.115
Stop all background terminals
/theme
0.105
Choose a syntax-highlighting theme
/title
0.117
Configure the terminal window or tab title
/usage
daily | weekly | cumulative
0.140
View token usage or redeem a rate-limit reset
/vim
0.129
Toggle Vim mode for the composer
Keyboard Shortcuts: CLI (TUI)
These shortcuts work in the interactive terminal interface (started with codex). You can remap them with /keymap.
ShortcutCtrl+C
DescriptionCancels the current execution
ContextWhile the agent is working
ShortcutCtrl+D
DescriptionCloses the CLI
ContextWhen the input buffer is empty
ShortcutCtrl+G
DescriptionOpens external editor (VISUAL or EDITOR)
ContextFor long prompts
ShortcutCtrl+L
DescriptionClears the screen (without starting a new chat)
ContextWhen the terminal gets too cluttered
ShortcutCtrl+O
DescriptionCopies the last response to the clipboard
ContextAfter a response
ShortcutCtrl+R
DescriptionReverse search through prompt history
ContextIn the composer
ShortcutAlt+,
DescriptionLowers the reasoning depth
ContextDuring the session
ShortcutAlt+.
DescriptionRaises the reasoning depth
ContextDuring the session
ShortcutUp / Down
DescriptionNavigates the draft history in the composer
ContextIn the input field
ShortcutTab
DescriptionQueues follow-up text, slash commands, or shell commands
ContextWhile the agent is working
ShortcutEsc + Esc
DescriptionEdits the previous user message
ContextIn the composer
Shortcut@
DescriptionFuzzy file search for attaching files
ContextIn the input field
Shortcut!
DescriptionRuns a shell command directly
ContextAt the start of the input
Shortcut
Description
Context
Ctrl+C
Cancels the current execution
While the agent is working
Ctrl+D
Closes the CLI
When the input buffer is empty
Ctrl+G
Opens external editor (VISUAL or EDITOR)
For long prompts
Ctrl+L
Clears the screen (without starting a new chat)
When the terminal gets too cluttered
Ctrl+O
Copies the last response to the clipboard
After a response
Ctrl+R
Reverse search through prompt history
In the composer
Alt+,
Lowers the reasoning depth
During the session
Alt+.
Raises the reasoning depth
During the session
Up / Down
Navigates the draft history in the composer
In the input field
Tab
Queues follow-up text, slash commands, or shell commands
While the agent is working
Esc + Esc
Edits the previous user message
In the composer
@
Fuzzy file search for attaching files
In the input field
!
Runs a shell command directly
At the start of the input
Keyboard Shortcuts: Codex App
The desktop app (started with codex app) has its own shortcuts that follow common IDE conventions. On Windows, replace Cmd with Ctrl.
ShortcutCmd+Shift+P / Cmd+K
DescriptionOpens the command palette
ShortcutCmd+,
DescriptionOpens settings
ShortcutCmd+O
DescriptionOpens a folder
ShortcutCmd+N / Cmd+Shift+O
DescriptionNew thread
ShortcutCmd+F
DescriptionFind in thread
ShortcutCmd+B
DescriptionToggle sidebar
ShortcutCmd+Option+B
DescriptionToggle diff panel
ShortcutCmd+J
DescriptionToggle terminal
ShortcutCmd+Shift+[ / ]
DescriptionSwitch to previous / next thread
ShortcutCmd+[ / ]
DescriptionNavigate back / forward
ShortcutCmd++ / Cmd+-
DescriptionIncrease / decrease font size
ShortcutCtrl+L
DescriptionClear terminal
ShortcutCtrl+M
DescriptionStart dictation
Shortcut
Description
Cmd+Shift+P / Cmd+K
Opens the command palette
Cmd+,
Opens settings
Cmd+O
Opens a folder
Cmd+N / Cmd+Shift+O
New thread
Cmd+F
Find in thread
Cmd+B
Toggle sidebar
Cmd+Option+B
Toggle diff panel
Cmd+J
Toggle terminal
Cmd+Shift+[ / ]
Switch to previous / next thread
Cmd+[ / ]
Navigate back / forward
Cmd++ / Cmd+-
Increase / decrease font size
Ctrl+L
Clear terminal
Ctrl+M
Start dictation
Note
The app also supports deeplinks via the codex:// scheme, for example codex://settings for settings or codex://new?prompt=your+prompt for a new thread with a prompt.
Configuration (config.toml)
Codex config lives at ~/.codex/config.toml. You can set defaults and define named profiles.
Settingmodel
DescriptionDefault model for all sessions
Possible values"gpt-5.5" (recommended), "gpt-5.4", "gpt-4.1", "gpt-4.1-mini"
Settingmodel_reasoning_effort
DescriptionReasoning depth for complex tasks
Possible values"xhigh", "high", "medium", "low"
Settingpersonality
DescriptionCommunication style of the agent
Possible values"pragmatic", "friendly", "none"
Settingweb_search
DescriptionWeb search mode
Possible values"cached" (default), "live", "disabled"
# ~/.codex/config.toml
# Default settings
model = "gpt-5.5"
model_reasoning_effort = "high"
# Profile for quick tasks
[profiles.quick]
model = "gpt-4.1-mini"
model_reasoning_effort = "low"
# Profile for thorough work
[profiles.thorough]
model = "gpt-5.5"
model_reasoning_effort = "xhigh"
# Project trust level
[projects."/path/to/project"]
trust_level = "trusted"
# Override a single value
codex exec -s workspace-write -c model='"gpt-5.5"' "Task"
# Set sandbox permissions
codex exec -s workspace-write \
-c 'sandbox_permissions=["disk-full-read-access"]' "Task"
# Load a profile with -p
codex exec -s workspace-write -p quick "Quick question"
Feature Flags
Feature flags control both experimental and stable features. Changes via enable and disable are written permanently to config.toml. Per-run toggles with --enable and --disable only apply to the current run.
# List all feature flags with status and maturity
codex features list
# Permanently enable / disable a feature
codex features enable search_tool
codex features disable shell_snapshot
# Enable for this run only (not persistent)
codex exec -s workspace-write --enable search_tool \
--disable shell_snapshot "Task"
Global Flags
These flags are available on almost every Codex command:
Flag--config, -c
DescriptionOverrides config.toml values. Dotted paths for nesting. Values are parsed as TOML.
Example-c model_reasoning_effort='"high"'
Flag--enable
DescriptionEnables a feature flag for this run (repeatable)
Examplecodex --enable search_tool
Flag--disable
DescriptionDisables a feature flag for this run (repeatable)
Examplecodex --disable search_tool
Flag--help, -h
DescriptionShows help
Examplecodex --help
Flag--version, -V
DescriptionShows the version number
Examplecodex --version
Flag
Description
Example
--config, -c
Overrides config.toml values. Dotted paths for nesting. Values are parsed as TOML.
-c model_reasoning_effort='"high"'
--enable
Enables a feature flag for this run (repeatable)
codex --enable search_tool
--disable
Disables a feature flag for this run (repeatable)
codex --disable search_tool
--help, -h
Shows help
codex --help
--version, -V
Shows the version number
codex --version
Troubleshooting
ProblemAuthentication fails
Likely causeStale token or wrong API key
SolutionRun codex logout, then codex login again
ProblemCodex hangs on codex exec
Likely causeNo sandbox mode set (waiting for approval)
SolutionAlways pass -s workspace-write or -a on-request
ProblemCommand blocked in sandbox
Likely causeNetwork access or write access outside the working directory
SolutionUse -s danger-full-access (only when needed)
ProblemMCP server doesn't connect
Likely causeMissing dependencies or wrong path
SolutionCheck codex mcp get server-name, then remove and add again
ProblemSession won't resume
Likely causeSession was started with --ephemeral
SolutionRestart without --ephemeral so sessions are saved
ProblemCloud task shows no diff
Likely causeTask is still running or has failed
SolutionCheck codex cloud status TASK_ID, then try again
Problem
Likely cause
Solution
Authentication fails
Stale token or wrong API key
Run codex logout, then codex login again
Codex hangs on codex exec
No sandbox mode set (waiting for approval)
Always pass -s workspace-write or -a on-request
Command blocked in sandbox
Network access or write access outside the working directory
Use -s danger-full-access (only when needed)
MCP server doesn't connect
Missing dependencies or wrong path
Check codex mcp get server-name, then remove and add again
Session won't resume
Session was started with --ephemeral
Restart without --ephemeral so sessions are saved
Cloud task shows no diff
Task is still running or has failed
Check codex cloud status TASK_ID, then try again
# Diagnose the config layers
# (in the interactive TUI)
/debug-config
# Show available models as JSON
codex debug models
# Show only the bundled model catalog (no API refresh)
codex debug models --bundled
# Validate exec policy rules (before saving)
codex execpolicy check --rules rules.toml -- npm test
# Log sandbox denials (debugging)
codex sandbox macos --log-denials -- ./build.sh
Finn Hillebrandt is the founder of Gradually AI, an SEO and AI expert. He helps online entrepreneurs simplify and automate their processes and marketing with AI. Finn shares his knowledge here on the blog in 50+ articles as well as through his ChatGPT Course and the AI Business Club.