OpenAI Codexcodex-cli 0.154 · macOS, Linux, WSL, Windows
1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
26 small wins to finish your pathNext lesson

config.toml

Every flag you have typed so far has a home. One file holds your defaults, and a second one can hold a project's.

toml
sandbox_mode = "workspace-write"
approval_policy = "on-request"

That is the pair from lesson 5, written down once instead of passed every time. The CLI and the IDE extension read the same layers, so setting it here sets it for both.

Where the layers are

User settings live in ~/.codex/config.toml. A project can carry its own in .codex/config.toml, which is the one you commit.

Highest firstLayer
1CLI flags and --config overrides
2Project files, from the root down. Closest wins
3Profile files, chosen with --profile
4Your user config
5Cloud-managed defaults for your workspace
6System config, /etc/codex/config.toml
7Built-in defaults

Worth reading once, because it explains the two confusing cases: a flag that seems to be ignored is usually being overridden from above, and a setting that works for you and not a colleague is usually in your user file rather than the project's.

Profiles

A profile is a named set of settings in its own file, chosen per run.

bash
codex --profile review

Useful when you have two or three ways of working: a tight read-only profile for looking at unfamiliar code, and a wider one for your own repository. That is a different thing from the permission profiles in lesson 4, which are about what the sandbox allows, and the two are often set together.

Commit the limits
Put the sandbox and approval settings in the project file and commit them. Then a new colleague gets your limits by cloning, rather than by being told about them in a message they will not read.
Try it yourself
  • Write your preferred sandbox and approval pair into your user config.
  • Add a .codex/config.toml to one repository and see it take precedence.

Slow is fine. Stopping is the only problem.