A one-run configuration override changes how Codex behaves for the current command without rewriting /~/.codex/config.toml or any project config file. This is useful for testing a feature toggle, forcing a specific model, or adjusting an advanced setting before deciding whether it belongs in a saved profile.
The codex CLI applies CLI flags and --config overrides before profiles, project config, user config, and system config. Override keys can use dotted paths such as features.undo for nested values, and the value portion is parsed as TOML rather than JSON.
Dedicated flags such as --model, --sandbox, and --ask-for-approval are shorter when they exist, but --config covers keys that have no dedicated flag. Quote strings and arrays as TOML so the shell does not split them or change their type unexpectedly.
Related: How to list Codex feature flags
Related: How to set the default model in Codex
Steps to override Codex configuration for a single run:
- Check the current effective value before changing it.
$ codex features list ##### snipped ##### tool_suggest stable true tui_app_server removed true undo stable false unified_exec stable true use_agent_identity under development false ##### snipped #####
The third column is the effective boolean state for the current run.
- Override the undo feature for one command with a dotted-path key.
$ codex -c features.undo=true features list ##### snipped ##### tool_suggest stable true tui_app_server removed true undo stable true unified_exec stable true use_agent_identity under development false ##### snipped #####
-c is shorthand for --config.
- Override a string-valued key with TOML quoting when testing a one-off model selection.
$ codex --config model='"gpt-5.4"' exec --skip-git-repo-check "Return OK." OK
Prefer --model gpt-5.4 when setting only the model, but --config is useful when the same command also needs other override keys.
- Override an array-valued key by passing a TOML array literal.
$ codex --config 'shell_environment_policy.include_only=["PATH","HOME"]' --help Codex CLI If no subcommand is specified, options will be forwarded to the interactive CLI. ##### snipped #####
--config values are parsed as TOML, so strings need quotes inside the value and arrays use square brackets with comma-separated entries.
- Re-run the baseline command without --config to confirm the saved configuration was not changed.
$ codex features list ##### snipped ##### tool_suggest stable true tui_app_server removed true undo stable false unified_exec stable true use_agent_identity under development false ##### snipped #####
One-run overrides disappear as soon as the command exits.
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.
