config.toml.
Configuration File
Location:~/.codex/config.toml
Format: TOML (Tom’s Obvious, Minimal Language)
Schema: codex-rs/core/config.schema.json
Top-Level Options
Model Configuration
Default model to use for conversations.Examples:
"gpt-4.1", "gpt-5.1", "gpt-5.1-codex", "o4-mini"Key from
model_providers map identifying which provider to use.Example: "openai", "azure", "ollama"Default reasoning effort for reasoning-capable models.Options:
"none", "minimal", "low", "medium", "high", "xhigh"Controls reasoning summary presentation.Options:
"auto", "concise", "detailed", "none"Output detail level for GPT-5 models.Options:
"low", "medium", "high"Reasoning effort override specifically for Plan mode.When unset, Plan mode uses built-in default (
"medium"). When set (including "none"), overrides Plan preset.Context window size for the model in tokens.
Token threshold that triggers automatic conversation compaction.
Path to file containing custom model instructions.⚠️ Warning: Overriding built-in instructions may degrade performance.
Path to JSON model catalog file (applied on startup only).
Force-enable reasoning summaries for the configured model.
Approval & Execution
When to ask user for approval before executing operations.String options:
"untrusted"- Auto-approve only safe read operations"on-request"- Model decides when to ask"on-failure"- DEPRECATED: Auto-approve sandboxed, escalate on failure"never"- Never ask; return failures to model
Filesystem access boundaries.Options:
"read-only"- Read-only access"workspace-write"- Read anywhere, write in workspace"danger-full-access"- Full filesystem access
Whether model may request login shell for shell tools.If
false, login = true requests are rejected and default is non-login shell.Sandbox Workspace Write
Allow network access in workspace-write mode.
Exclude
/tmp from writable paths.Exclude
$TMPDIR from writable paths.Additional absolute paths where writes are allowed.Example:
["/additional/path", "/another/path"]Authentication
Where to store CLI authentication credentials.Options:
"file"-~/.codex/auth.json"keyring"- OS keyring service"auto"- Prefer keyring, fallback to file"ephemeral"- Memory only (current process)
Restrict login mechanism.Options:
"chatgpt", "api"When set, restricts ChatGPT login to specific workspace.
Base URL for ChatGPT (as opposed to OpenAI API) requests.
Instructions
Global system instructions for the agent.
Developer role message instructions.
Custom prompt for conversation history compaction.
Path to file containing custom compaction prompt.
Profiles
Active profile name from the
profiles map.Named configuration profiles for easy switching.Each profile can override any configuration option.Example:
Personality
Agent personality mode.Options:
"none", "friendly", "pragmatic"Model Providers
User-defined provider configurations.Example:
Provider Configuration
Friendly display name for the provider.
Base URL for provider’s OpenAI-compatible API.
Environment variable storing the API key.
Help text for obtaining and setting the API key.
Whether provider requires OpenAI API key or ChatGPT login.
Static HTTP headers (key-value pairs).
Headers with values from environment variables (header → env var name).
Query parameters to append to requests.
Maximum HTTP request retries.
Idle timeout (ms) before treating streaming connection as lost.
Maximum streaming reconnection attempts.
Whether provider supports Responses API WebSocket transport.
Wire protocol the provider expects. Currently only
"responses" supported.MCP Servers
MCP server configurations keyed by server name.Example:
MCP Server Configuration
Executable to launch (stdio transport).
Command arguments (stdio transport).
Server URL (streamable HTTP transport).
Whether server is enabled.
If true, Codex fails to start if server connection fails.
Environment variables for server process (stdio only).
Environment variable names to inherit from parent.
Working directory for server process (stdio only).
Environment variable with bearer token (HTTP only).
Static HTTP headers (HTTP only).
Headers from environment variables (HTTP only).
Maximum server startup time (seconds).
Maximum tool execution time (seconds).
Whitelist of enabled tools. If set, only these are exposed.
Blacklist of disabled tools.
OAuth scopes to request.
OAuth resource identifier.
MCP OAuth Settings
Where to store MCP OAuth credentials.Options:
"auto", "file", "keyring"Fixed port for OAuth callback server. If unset, uses ephemeral port.
Redirect URI for OAuth flow. Local listener still binds to 127.0.0.1.
Apps Configuration
App/connector control settings.Example:
App Settings
Default enabled state for all apps.
Whether destructive tools are allowed by default.
Whether open-world tools are allowed by default.
Enable or disable specific app.
Whether tools are enabled by default for this app.
Default approval mode for app tools.Options:
"auto", "prompt", "approve"Allow destructive tools for this app.
Allow open-world tools for this app.
Enable/disable specific tool.
Approval mode for specific tool.
Shell Environment Policy
Which environment to inherit.Options:
"core"- Essential variables only (HOME, PATH, USER, etc.)"all"- Full parent environment"none"- Empty environment
If set, only inherit variables matching these regex patterns.
Regex patterns for variables to exclude (after inherit).
Ignore built-in exclude patterns.
Explicitly set environment variables.
Experimental: Use shell profile during initialization.
Agent Configuration
Maximum concurrent agent threads. If unset, no limit.
Maximum nesting depth for spawned agents (root = 0).
Default maximum runtime for agent job workers (seconds).
Path to role-specific config layer.
Human-facing role documentation.
Tools
Enable
view_image tool for attaching local images.Enable web search tool.
Web search mode.Options:
"disabled", "cached", "live"Token budget for tool/function output storage.
Permissions
Enable network proxy.
Network access mode.Options:
"limited", "full"Allowed domain patterns.
Explicitly denied domains.
Allowed Unix socket paths.
Allow all Unix sockets (use with caution).
Allow binding to local ports.
Allow proxying to upstream servers.
HTTP proxy URL.
SOCKS proxy URL.
Admin interface URL.
Enable SOCKS5 proxy.
Enable SOCKS5 UDP support.
TUI Settings
Enable desktop notifications when terminal unfocused.
Notification method.Options:
"auto", "osc9", "bel"Alternate screen buffer mode.Options:
"auto"- Disable in Zellij, enable elsewhere"always"- Always use alternate screen"never"- Never use (preserves scrollback)
Enable TUI animations and effects.
Show startup tooltips in welcome screen.
Syntax highlighting theme name (kebab-case).Overrides automatic light/dark detection. Custom themes in
$CODEX_HOME/themes.Ordered list of status line item identifiers.Default:
["model-with-reasoning", "context-remaining", "current-dir"]History
History persistence mode.Options:
"save-all"- Save to~/.codex/history.jsonl"none"- Don’t save to disk
Maximum history file size (bytes). Oldest entries dropped when exceeded.
Memories
Inject memory usage instructions into prompts.
Enable automatic memory generation.
Maximum age of threads for memory generation (days).
Minimum idle time before memory creation (hours, >12 recommended).
Maximum rollout candidates processed per pass.
Maximum days since last use before memory becomes ineligible.
Maximum recent raw memories retained for global consolidation.
Model for thread summarization.
Model for memory consolidation.
Ghost Snapshots
Exclude untracked files larger than this (bytes).
Ignore untracked dirs with this many files or more.
Disable ghost snapshot warning events.
Skills
User-level skill configurations.Example:
Project Settings
Markers for detecting project root when searching for
.codex folders.Fallback filenames when
AGENTS.md is missing.Maximum bytes to include from
AGENTS.md files.Trust level for project directory.Options:
"trusted", "untrusted"Notices
Tracks whether user acknowledged full access warning.
Tracks whether user opted out of rate limit model nudge.
Tracks acknowledged model migrations (old → new mappings).
Notification
External command to run for notifications.Example:
["terminal-notifier", "-title", "Codex", "-message", "Done"]Analytics & Feedback
Enable usage analytics.
Enable feedback prompts.
Logging & Storage
Directory for log files. Defaults to
$CODEX_HOME/log.SQLite database directory. Defaults to
$CODEX_SQLITE_HOME or $CODEX_HOME.JavaScript REPL
Absolute path to Node.js runtime for js_repl.
Ordered list of Node module search directories.
Miscellaneous
URI-based file opener for file citations.Options:
"vscode", "vscode-insiders", "windsurf", "cursor", "none"Commit attribution text for co-author trailers. Empty string disables.
Check for Codex updates on startup.
Disable burst-paste detection for typed input.
Hide
AgentReasoning events from UI.Show raw agent reasoning content events.
Suppress warnings about unstable features.
Maximum poll window for background terminal output (ms).
Model override for
/review feature.Preferred OSS provider for local models (e.g.,
"lmstudio", "ollama").Absolute path to patched zsh for zsh-exec-bridge shell execution.
Windows Settings
Windows sandbox mode.Options:
"elevated", "unelevated"Tracks whether Windows onboarding screen was acknowledged.
OpenTelemetry
Environment tag for traces (dev, staging, prod, test).
Include user prompts in trace logs.
Log exporter configuration.
Trace exporter configuration.
Metrics exporter configuration.
Audio
Realtime audio microphone device preference.
Realtime audio speaker device preference.
Feature Flags
Centralized feature flags for experimental features.Available flags:
multi_agentmemoriesweb_searchsqliteundocollaboration_modesrealtime_conversationvoice_transcription- And many more…
Configuration Priority
Configuration is merged in this order (later overrides earlier):- Built-in defaults
- Global config (
~/.codex/config.toml) - Project config (
.codex/config.tomlin project root) - Profile settings (when
profileis set or--profileflag used) - CLI flags (
--model,--approval-policy, etc.) - Environment variables (
CODEX_MODEL, etc.)
Validation
Codex validates configuration against JSON Schema atcodex-rs/core/config.schema.json.
Common validation errors:
- Invalid enum values (e.g., unknown
approval_policy) - Type mismatches (string vs integer)
- Missing required fields in nested objects
- Invalid path formats for file paths
Next Steps
Basic Configuration
Get started with essential options
Advanced Configuration
Explore power user features