Codex CLI config.toml: where it lives and what to set
Codex reads ~/.codex/config.toml, a trusted project's .codex/config.toml, a profile and -c flags. Flags win, then the closest project file.
Contents
Codex CLI reads ~/.codex/config.toml for your own settings, and .codex/config.toml inside a repository for that project's, though only after you've trusted the project. When the two disagree, the project file wins. A profile picked with --profile sits between them, and a -c key=value flag beats everything.
OpenAI's config basics page is where the keys and that order come from; we read it on 23 October 2026 and again on 25 October 2026. Codex changes often, so check it there when a key doesn't behave.
Where the Codex config files live#
| File | Scope | Notes |
|---|---|---|
~/.codex/config.toml |
You, every project | The one to edit first |
.codex/config.toml in a repository (or a subfolder) |
That project | Read only when the project is trusted |
~/.codex/<name>.config.toml |
A profile | Loaded with codex --profile <name> |
/etc/codex/config.toml |
The machine (Unix) | Usually left alone |
Signing in to a ChatGPT workspace can add one more layer, cloud-managed defaults, and they rank below your own file. The IDE extension edits the same file as the CLI: gear icon › Codex Settings › Open config.toml.
If you mark a project untrusted, Codex skips everything under its .codex/ folder: the project config, its hooks and its rules. Your own and the system config still load.
Which setting wins#
OpenAI lists the order from highest to lowest:
- Command-line flags and
-c/--configoverrides - Project
.codex/config.tomlfiles, from the project root down to the folder you're in (the closest wins; trusted projects only) - The profile file chosen with
--profile - Your
~/.codex/config.toml - Cloud-managed defaults for your signed-in workspace
/etc/codex/config.toml- Codex's built-in defaults
A project file can therefore override your personal default model without telling you. When one repository behaves differently from the rest, look for a .codex/ folder there first.
On a managed machine there can be one more layer, requirements.toml, where your organisation sets limits rather than defaults. OpenAI's examples are disallowing approval_policy = "never" or sandbox_mode = "danger-full-access".
The keys worth setting first#
model = "gpt-6.1-sol"
model_reasoning_effort = "medium"
approval_policy = "on-request"
sandbox_mode = "workspace-write"
web_search = "cached"
modelis the default model. The value above is the example OpenAI's page uses; run/modelin Codex to see what your plan offers. To run Codex on a model served by Ollama or LM Studio, see Codex CLI with local models.model_reasoning_effortsets how much the model reasons, where the model supports it.approval_policyis when Codex stops to ask you:on-requestornever. OpenAI's approvals page says the olduntrustedvalue is retired and can stop Codex from starting, so delete it if an old config still has it.sandbox_modeis what Codex may touch:read-only,workspace-writeordanger-full-access. Which pair suits which job is in the approval modes guide.web_searchtakes"cached"(the default, OpenAI's own index of results),"indexed","live"(the same as--search) or"disabled".
Network access is off inside workspace-write by default. To allow it:
[sandbox_workspace_write]
network_access = true
MCP servers go in [mcp_servers.<name>] tables in the same file (add an MCP server to Codex CLI has the commands and keys). If one won't start, Codex MCP server failed to start explains each error message.
Less common keys from the same page#
| Key | What it does |
|---|---|
personality = "none" |
Drops the Personality section from the model's built-in instructions. friendly and pragmatic no longer pick a style, and /personality is gone |
[tui.keymap.global], .composer, .chat |
Rebind terminal keys, e.g. open_transcript = "ctrl-t"; an empty list unbinds |
[shell_environment_policy] |
Which environment variables reach the commands Codex runs. ignore_default_excludes defaults to true, which skips filtering names containing KEY, SECRET or TOKEN; false filters them |
log_dir |
Moves the logs and turns on the plaintext codex-tui.log there |
default_permissions |
A permission profile: built-in :read-only, :workspace, :danger-full-access, or your own [permissions.<name>] |
[features] |
Optional parts. multi_agent, hooks, shell_snapshot default to true; memories is experimental and false. codex --enable <feature> turns one on from the command line |
Change a setting for one run#
For one run, pass -c (or --config). It outranks every file:
codex -c model_reasoning_effort="high"
For a whole setup you come back to, such as a careful one for production repositories, use a profile:
- Create
~/.codex/careful.config.tomlwith only the keys that differ, for examplesandbox_mode = "read-only". - Start Codex with
codex --profile careful.
Everything else still comes from config.toml, which is the split OpenAI recommends: shared defaults there, differences in the profile.
A project file the whole team shares#
Everyone who trusts the repository gets what a committed .codex/config.toml sets. Two things are worth putting in it:
sandbox_modeandapproval_policy, so Codex has the same boundary for every person in that repo.[sandbox_workspace_write]withnetwork_access = true, if the test suite needs the network.
Leave model out. It's a personal choice, and the project file would override it for everyone.
When you also run Claude Code#
Claude Code doesn't read this file. Its MCP servers live in ~/.claude.json and in a project's .mcp.json, so a server added to Codex has to be added there too. Shuriken keeps one list of MCP servers and hands it to every Codex and Claude Code chat when the chat starts. Doing it by hand on the Claude side takes claude mcp add --scope user, covered in set up MCP servers once for every project.
Sources
- OpenAI: Codex config basics (accessed 25 October 2026)
- OpenAI: Agent approvals and security (accessed 23 October 2026)
- OpenAI: Model Context Protocol in Codex (accessed 23 October 2026)
Frequently asked questions
Where is the Codex config file?
Your own settings are in ~/.codex/config.toml. A project can add .codex/config.toml in the repository, which Codex reads only when you trust the project.
Does the Codex IDE extension use the same config.toml?
Yes for MCP servers: OpenAI's MCP page says the ChatGPT desktop app, the Codex CLI and the IDE extension share the same configuration in ~/.codex/config.toml.
How do I change one setting for a single run?
Pass it with -c, for example codex -c model_reasoning_effort="high". Command-line flags and -c overrides win over every file.
Is approval_policy = "untrusted" still valid?
No. OpenAI's approvals page says untrusted is retired and can stop Codex from starting. Use on-request or never.