Original URL: https://getagenttools.com/blog/codex-config-toml/

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

16 Nov 2026Marek.

- 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.

 

```toml
#: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
```

 

```toml
# ~/.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](https://getagenttools.com/blog/codex-dangerously-skip-permissions/) post. What each `sandbox_mode` blocks is in [Codex sandbox](https://getagenttools.com/blog/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](https://learn.chatgpt.com/docs/config-file/config-basic) says Codex "stores user-level configuration" there. `CODEX_HOME` moves the whole folder. The [Advanced Config page](https://learn.chatgpt.com/docs/config-file/config-advanced) 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](https://getagenttools.com/blog/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](https://learn.chatgpt.com/docs/config-file/config-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](https://getagenttools.com/blog/codex-hooks/). The status line sits under `[tui]`, see [Codex statusline](https://getagenttools.com/blog/codex-statusline/). Plugin switches are in [Codex plugins](https://getagenttools.com/blog/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`:

 

```text
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](https://learn.chatgpt.com/docs/permissions) marks the feature beta and says it "may change".

 

```toml
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.

 

```bash
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:

 

```text
-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](https://code.claude.com/docs/en/settings), not a test.

 

|  | Codex CLI 0.166.0 | Claude Code |
| --- | --- | --- |
| User file | `~/.codex/config.toml` | `~/.claude/settings.json` |
| Move the folder | `CODEX_HOME` | `CLAUDE_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.toml` | No profile flag on the settings page |
| Highest layer | CLI flags and `-c`, inside admin requirements | Managed 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`](https://getagenttools.com/blog/codex-review/).

 

### Where is the Codex config.toml documentation?

 

On three pages: [Config basics](https://learn.chatgpt.com/docs/config-file/config-basic), [Advanced Config](https://learn.chatgpt.com/docs/config-file/config-advanced) and the [Configuration Reference](https://learn.chatgpt.com/docs/config-file/config-reference). The `docs/config.md` file in the [openai/codex](https://github.com/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](https://learn.chatgpt.com/docs/config-file/config-basic), [Advanced Config](https://learn.chatgpt.com/docs/config-file/config-advanced), [Configuration Reference](https://learn.chatgpt.com/docs/config-file/config-reference) and [Permissions](https://learn.chatgpt.com/docs/permissions) pages, `docs/config.md` in [openai/codex](https://github.com/openai/codex), the Claude Code [settings page](https://code.claude.com/docs/en/settings) and local help and `codex features list` output for `codex-cli 0.166.0`. The 21 test commands are my own.

Put this into practice

[See the tool list](https://getagenttools.com/tools/)[Train your team](https://getagenttools.com/#training)
