31 tools· updated nov 2026

Codex config.toml: where it lives, the keys people change, and why profiles are separate files now

Marek.

  • codex
  • coding-agents
  • agent-ops

Codex config.toml lives at ~/.codex/config.toml. Set CODEX_HOME and Codex reads it from that folder instead. A repo can add its own .codex/config.toml, but only in a trusted project. This post is a map of the file for anyone setting up Codex CLI. The short version: shared defaults go in config.toml. Since Codex 0.134.0 a profile is a separate file, ~/.codex/<name>.config.toml, picked with -p. I checked this on codex-cli 0.166.0 with an empty CODEX_HOME and no model calls.

#:schema https://developers.openai.com/codex/config-schema.json
# ~/.codex/config.toml
model = "gpt-6.1-sol"
approval_policy = "on-request"
sandbox_mode = "workspace-write"

[features]
memories = true
# ~/.codex/ci.config.toml, used with: codex --profile ci
approval_policy = "never"
sandbox_mode = "read-only"
  • Location. ~/.codex/config.toml, or config.toml inside $CODEX_HOME. Project files go in .codex/config.toml and need a trusted project.
  • Order. CLI flags and -c win. Project files beat a profile. A profile beats your user file.
  • Profiles are files. -p ci lays ci.config.toml over the base. A profile = "ci" line in config.toml now stops Codex with an error.
  • Permission profiles are a different thing. [permissions.<name>] tables plus default_permissions. Beta, per the docs.
  • My test. 21 read-only commands on 6 November 2026. No sessions, no login.

What approval_policy = "never" really skips is in my Codex dangerously skip permissions post. What each sandbox_mode blocks is in Codex sandbox. This post covers the file itself.

Where is the Codex config.toml file?

The user file is ~/.codex/config.toml. The Config basics page says Codex "stores user-level configuration" there. CODEX_HOME moves the whole folder. The Advanced Config page says Codex keeps its local state under CODEX_HOME, which "defaults to ~/.codex". Other tools read that folder too: T3 Code reads ~/.codex/auth.json for its analytics, as I show in T3 Code telemetry.

In my run I pointed CODEX_HOME at an empty folder. With no file there, codex features list showed memories as false. With a small config.toml that set it to true, the command showed true. So Codex read the file from the variable.

Codex also reads .codex/config.toml files inside a repo, from the project root down to the current folder. The closest file wins. Per the docs, a project file cannot set provider, auth, notify, otel or profile keys. On Unix a system file can sit at /etc/codex/config.toml.

Which Codex config.toml options do people change most?

The keys people change most sit at the top of the file, above any table. The Config basics page names model, approval_policy, sandbox_mode, model_reasoning_effort and web_search among them. Optional features go under [features]. The Configuration Reference lists every key.

approval_policy takes on-request, never or a granular table. sandbox_mode takes read-only, workspace-write or danger-full-access. The two posts linked above cover what those values do.

Hooks go in [hooks], see Codex hooks. The status line sits under [tui], see Codex statusline. Plugin switches are in Codex plugins.

The #:schema line in the example is from the reference. With the Even Better TOML extension, VS Code and Cursor then complete keys, per the docs.

How do Codex profiles work in 0.166.0?

A Codex profile is a separate TOML file next to config.toml. codex --profile ci loads config.toml first, then lays ci.config.toml over it. The profile file uses top-level keys only. Per the Advanced Config page, this changed in Codex 0.134.0. [profiles.<name>] tables and the profile = "<name>" selector are no longer read.

The local help agrees: "Layer $CODEX_HOME/<name>.config.toml on top of the base user config". A profile only needs the keys that differ.

I tried the old style. A profile = "legacy" line in the base file stopped codex features list:

Error: failed to load configuration
    legacy `profile = "legacy"` config is no longer supported; use `--profile legacy` with `legacy.config.toml` instead

-c profile=quiet gave the same error. A leftover [profiles.legacy] table without the selector did not. Codex ran with no warning. The table's value did not apply. I think that is the trap for people with multiple profiles. Nothing flags the dead table.

-p does not work everywhere. codex -p quiet features list failed with --profile only applies to runtime commands. The error lists codex, codex exec, codex review and ten more. So I could not watch a profile take effect without a model session. The overlay itself is the docs, not my run.

What are permission profiles in Codex?

Permission profiles are named sandbox policies, not config profiles. You define one under [permissions.<name>] and select it with default_permissions. The built-ins are :read-only, :workspace and :danger-full-access. The Permissions page marks the feature beta and says it "may change".

default_permissions = "project-edit"

[permissions.project-edit]
extends = ":workspace"

[permissions.project-edit.filesystem.":workspace_roots"]
"**/*.env" = "deny"

That example is from the docs. One rule matters more than the syntax. Permission profiles do not combine with sandbox_mode. If sandbox_mode appears in any loaded file, Codex uses the older sandbox settings instead. Pick one of the two. I have not run a permission profile myself.

Which wins in Codex: -c, --profile or config.toml?

The command line wins. Per Config basics, the order starts with CLI flags and -c overrides. Next come trusted project files, then the profile file, then your user config.toml. Cloud-managed defaults, /etc/codex/config.toml and built-in defaults sit below. An admin requirements.toml can still forbid values such as approval_policy = "never".

One detail surprised me. A trusted project file outranks your profile. By that order, -p ci cannot undo a sandbox_mode set in the repo. Only a flag or -c can.

codex -c sandbox_workspace_write.network_access=true
codex features list -c features.memories=false

-c is the part I could test. My base file set memories = true. With -c features.memories=false, codex features list printed false. The value is parsed as TOML. Bad values fail fast:

-c approval_policy=sometimes
    unknown variant `sometimes`, expected one of `untrusted`, `on-failure`, `on-request`, `granular`, `never`
-c features.memories=yes
    invalid type: string "yes", expected a boolean

-c approval_policy=untrusted failed with a clear reason: approval_policy = "untrusted" is no longer supported; remove this setting. The docs call untrusted retired too. The parser error above still lists it as a variant.

How does Codex config.toml compare with Claude Code settings.json?

Same idea, different shape. Both tools have a user file and a project layer. Claude Code splits the project layer into a shared file and a local one. Codex has named profile files. The Claude Code column is from its settings docs, not a test.

Codex CLI 0.166.0Claude Code
User file~/.codex/config.toml~/.claude/settings.json
Move the folderCODEX_HOMECLAUDE_CONFIG_DIR
Project layer.codex/config.toml, trusted projects only.claude/settings.json plus .claude/settings.local.json
One-run override-c key=value, parsed as TOML--settings <file-or-json>
Named sets-p name loads name.config.tomlNo profile flag on the settings page
Highest layerCLI flags and -c, inside admin requirementsManaged settings

Frequently asked questions

Can I keep multiple Codex profiles in one config.toml?

No, not since 0.134.0. Each profile is its own <name>.config.toml next to config.toml. On 0.166.0 a profile = "..." line in the base file stops Codex with an error that names the new file.

Why does codex --profile fail with "only applies to runtime commands"?

The command you gave it does not start a session. In my run codex -p quiet features list failed that way. Use -c with features list. Pass -p to codex, codex exec or codex review.

Where is the Codex config.toml documentation?

On three pages: Config basics, Advanced Config and the Configuration Reference. The docs/config.md file in the openai/codex repo now only links to them.

Did you test this?

Yes, read-only. On 6 November 2026 I ran 21 commands on codex-cli 0.166.0 against an empty CODEX_HOME: help pages and codex features list, with and without -c. No model calls. A live session with a profile is untested.

The verdict

I use Codex every day as a worker next to Claude Code. Keep ~/.codex/config.toml short. Shared defaults go there. Differences go in profile files. -c is for one run. If your setup predates 0.134.0, move each [profiles.x] table into x.config.toml and delete the table. Codex stops on the selector line. It stays quiet about the table.

Sources, read on 6 November 2026: the Codex Config basics, Advanced Config, Configuration Reference and Permissions pages, docs/config.md in openai/codex, the Claude Code settings page and local help and codex features list output for codex-cli 0.166.0. The 21 test commands are my own.