> configuration
Codex reads settings from ~/.codex/config.toml, a TOML file covering model, reasoning effort, sandbox, approvals, MCP servers, and TUI look. This section covers where that file lives, overriding it per run, profiles for switching setups, and AGENTS.md for project instructions. Precedence, highest to lowest, is CLI flags and -c overrides, then the selected profile, then config.toml, then built-in defaults.
// configuration
5 commands$ cat ~/.codex/config.toml$ /model$ codex -c sandbox_mode="read-only" "just review, do not touch anything"$ codex --profile ci "run the checks"$ /init// faq
Where is the Codex config file?
At ~/.codex/config.toml. The whole directory (which also holds auth.json, sessions/, and logs) can be relocated by setting the CODEX_HOME environment variable; it defaults to ~/.codex. On Windows the path is %USERPROFILE%\.codex.
How do I override a config value for just one command?
Use -c/--config key=value with TOML syntax: codex -c model="gpt-5.6-sol" -c sandbox_mode="read-only" "...". Nested keys use dots (-c tui.theme="dark"), string values need quotes, and -c overrides win over profiles and the config file.
What are profiles for?
A [profiles.NAME] table bundles a set of overrides (model, approval, sandbox) you activate with --profile NAME (or -p). For example a ci profile with approval_policy = "never". A profile only changes the keys it sets; everything else falls back to the top-level config.
What is AGENTS.md and where does it go?
AGENTS.md holds standing instructions Codex merges into every prompt — build and test commands, conventions, review rules. It is read from the repo root, nested folders, and ~/.codex/AGENTS.md for personal defaults; /init scaffolds one. The nearest file wins on conflicts, and project_doc_max_bytes caps how much is read.