SYS/2026.Q1Agentic SEO audits delivered in 72 hoursSee how →
DevelopmentDeep Dive13 min readPublished May 10, 2026

config.toml schema, per-profile settings, three sandbox modes — the reference deep dive for engineers running Codex CLI in production.

Codex CLI Deep Dive: Config, Profiles, Sandbox 2026

Codex CLI (the OpenAI agentic CLI, versions 0.128–0.130 as of May 2026) is among the most configurable agentic coding CLIs shipping today — and that configurability is the differentiator. This deep dive walks the config.toml schema, the named profiles, the three sandbox modes, the MCP-server integration surface, and the four production workflows that ship.

DA
Digital Applied Team
Agentic engineering · Published May 10, 2026
PublishedMay 10, 2026
Read time13 min
ScopeCodex CLI
Sandbox modes
3
read-only · workspace-write · danger-full-access
Named profiles
Unlimited
per-profile model · sandbox · approval
Config surface
Flat + nested
top-level keys + [profiles.*] + [mcp_servers.*]
Recommended starting point
Per-env
profiles per environment, not per person

Codex CLI is the most configurable agentic coding CLI shipping in 2026, and that configurability is its defining feature — every team that runs Codex in production touches config.toml, designs at least two profiles, picks a sandbox mode per workload, and wires at least one MCP server. Teams that treat configuration as an afterthought end up with a CLI that works on a laptop but fights them in CI; teams that invest a half-day in the config surface ship reliably.

The CLI's design philosophy is honest about the trade-off. Codex CLI is opinionated where the cost of a wrong default is high (sandbox defaults are conservative, approval policies start untrusted), and configurable where the right answer is workload-specific (model choice, network access, MCP servers, approval thresholds). The result is a CLI that can run a developer's exploratory edit, a CI test-generation pipeline, and an unattended production agent — from the same binary, with three different profiles, on the same machine.

This deep dive is the reference for engineers running Codex CLI in production (versions 0.128 through 0.130 as of May 2026 — see the official changelog). The config.toml surface — flat top-level keys plus [profiles.*] and [mcp_servers.*] tables — the named-profile pattern and how to design profiles for dev / CI / prod / agent, the three sandbox modes (read-only, workspace-write, danger-full-access) and which workloads each fits, the MCP-server integration surface and the agent-loop primitives it exposes, a five-axis comparison with Claude Code, and four production workflows that ship. The closing FAQ covers the questions engineers ask before standardising on Codex.

Key takeaways
  1. 01
    Per-profile configuration is the real leverage.Codex CLI's profile API lets one config file describe many environments — dev laptops, CI workers, production agents — each with their own model, sandbox, approval policy, and auth mode. Treat profiles as the unit of design and the rest of the config surface stays small.
  2. 02
    Three sandbox modes — pick by workload risk.workspace-write for trusted developer edits, danger-full-access for short-lived sandboxed runs in ephemeral containers that need unrestricted filesystem access, read-only for production agents that observe but don't mutate. The matching of mode to workload is what separates a reliable Codex deployment from a brittle one. (Official mode names per the Codex CLI config reference.)
  3. 03
    MCP integration is on par with Claude Code.Codex CLI supports the same Model Context Protocol surface as Claude Code — local server processes, remote endpoints, per-profile server lists. The agent loop exposes tool-call primitives that compose with MCP servers the same way Claude Code's does, so the integration story carries across the two CLIs.
  4. 04
    Codex wins specific workflow archetypes.Test-generation pipelines, large-scale codemod runs, and CI-resident agentic refactors are the workloads where Codex CLI's headless auth and explicit profile activation pay back the configuration investment. For interactive editor-side work, Claude Code and Cursor are competitive.
  5. 05
    Configuration is the differentiator — invest in it.Teams that spend a half-day designing the profile layout, naming sandbox modes per workload, and wiring MCP servers deliberately get a CLI that runs predictably across environments. Teams that copy a config from the README and forget about it eventually pay for it in a 2am incident.

01Why Deep DiveCodex CLI is configurable — most teams configure it wrong.

The first time a team installs Codex CLI, the natural impulse is to copy the example config.toml from the README, set model = "gpt-5.5-codex", and start using the CLI. That config works — for one developer, on one laptop, doing exploratory edits. The moment the CLI moves into CI or onto a production agent, the README config becomes a liability: the sandbox is too permissive, the approval policy is wrong for unattended runs, the auth mode leaks long-lived tokens into CI logs, and the lack of profiles means every environment is fighting the same config.

The right mental model is to treat Codex CLI's config surface as a small, deliberately-designed declarative specification — six sections, named profiles, per-profile overrides — rather than a flat list of CLI flags transcribed to disk. Engineers familiar with Kubernetes manifests, Terraform modules, or CI workflow YAML already have the muscle memory: the schema is small, the activation is explicit, the defaults are conservative. Codex's value compounds when the config is designed; it leaks when the config is copy-pasted.

The remainder of this deep dive treats the configuration surface as the primary unit of analysis. Every section — schema, profiles, sandbox, MCP — is framed around the design decisions a team needs to make before standardising on Codex in production. The workflow archetypes at the end show how the decisions compose into shippable patterns.

"Codex CLI rewards teams that design the config and punishes teams that copy-paste it. The CLI's defaults are conservative; the leverage is in the profile layout, not the flags."— Internal note, Digital Applied agentic engineering team

The deeper context — what changed in the TypeScript-to-Rust rewrite, why the schema reset was necessary, how teams should phase the cut-over — is covered in our Codex CLI Rust migration playbook. This deep dive assumes a team has either completed that migration or is starting fresh on the Rust CLI; the focus here is the production configuration design rather than the upgrade path.

02config.tomlSchema, sections, defaults.

The Codex CLI config.toml schema uses flat top-level keys for the core controls — model, approval_policy, sandbox_mode, web_search — with nested tables for the structured surfaces: [sandbox_workspace_write] for write-scope tuning, [mcp_servers.NAME] for the MCP registry, [profiles.NAME] for named overrides, and [shell_environment_policy] for env-var hygiene. See the official config reference for the canonical key list.

The schema is structurally flat at the top level and nested under [profiles.NAME] for per-profile overrides. Any top-level setting can be overridden inside a profile — so the base layer establishes defaults and the profile layer specialises them. Profiles do not chain via an extends key; each profile simply re-states the keys it wants to override and inherits the rest from the top-level defaults.

# ~/.codex/config.toml — Codex CLI reference shape
# See: https://developers.openai.com/codex/config-reference

# --- Top-level defaults (flat keys) ---
model           = "gpt-5.5-codex"
approval_policy = "on-request"           # untrusted | on-request | never
sandbox_mode    = "workspace-write"      # read-only | workspace-write | danger-full-access
web_search      = "cached"               # "live" enables --search browsing

# Write-scope tuning for workspace-write mode
[sandbox_workspace_write]
network_access  = false
writable_roots  = ["./", "./tmp"]

# --- MCP server registry ---
[mcp_servers.filesystem]
command = "npx"
args    = ["-y", "@modelcontextprotocol/server-filesystem", "/workspace"]

[mcp_servers.github]
command  = "npx"
args     = ["-y", "@modelcontextprotocol/server-github"]
env_vars = ["GITHUB_TOKEN"]

[mcp_servers.figma]
url                  = "https://mcp.figma.com/mcp"
bearer_token_env_var = "FIGMA_OAUTH_TOKEN"

# --- Named profiles ([profiles.NAME], override any top-level key) ---
[profiles.dev]
model           = "gpt-5.5-codex"
approval_policy = "never"
sandbox_mode    = "workspace-write"

[profiles.ci]
approval_policy = "untrusted"
sandbox_mode    = "workspace-write"

[profiles.prod]
approval_policy = "untrusted"
sandbox_mode    = "read-only"

Two things to notice in the example above. First, each profile in [profiles.NAME] overrides only the keys it cares about — there is no explicit extends mechanism; everything not re-stated in a profile falls back to the top-level defaults. Second, MCP servers are declared once under [mcp_servers.NAME] and are available across all profiles by default — most teams find a single shared MCP roster sufficient and rely on a wrapper script or CI policy to scope tool access where needed.

Key 01
model
Model selection

Top-level flat key. Selects the default model; can be overridden inside any [profiles.NAME] block. A CI profile can pin a different model than the dev profile if the workload demands it. Generation knobs (model_reasoning_effort, etc.) sit alongside it.

Required in practice
Key 02
sandbox_mode
Sandbox containment

Top-level flat key. Accepts read-only, workspace-write, or danger-full-access. The [sandbox_workspace_write] nested table refines write-scope when workspace-write is active (network_access, writable_roots). Defaults are conservative — opt in explicitly.

Read section 04
Key 03
approval_policy
Approval policy

Top-level flat key governing when Codex pauses for confirmation. Values: untrusted, on-request, never (plus a granular table form for per-category control). 'never' fits trusted developer laptops; 'untrusted' is the right default for unattended CI and production runs.

Match to workload
Key 04
Auth
Authentication mode

Codex authenticates via ChatGPT OAuth (interactive sign-in, the recommended path) or via OpenAI API key. The forced_login_method key locks an environment to one or the other. For unattended runs, the API-key path is the practical choice; rotate via your secret store.

Per-environment
Key 05
[profiles.NAME]
Named profile overrides

TOML tables that override any top-level key. Activated via the --profile / -p flag (e.g. codex --profile ci). No 'extends' chain — each profile re-states the keys it wants to change and inherits the rest from the top-level defaults.

The leverage section
Key 06
[mcp_servers.NAME]
MCP server registry

TOML tables for the Model Context Protocol servers Codex invokes as tool-call primitives. STDIO servers take command/args/env; HTTP servers take url plus bearer_token_env_var. Shared across profiles by default. The IDE extension and CLI read the same registry.

Tool-call primitives

A few schema notes worth keeping in mind. Unknown keys generally log a warning rather than hard-failing — useful when CLI versions move ahead of your config, but it also means typos can drift silently. Pin a Codex version per environment, and audit ~/.codex/config.toml when bumping. Admin-managed constraints (lifecycle hooks, forced login method) live in requirements.toml rather than config.toml.

One under-appreciated default worth calling out: workspace-write defaults to network access off, writes scoped to the workspace, and the user's home directory and most system paths blocked. Teams that want broader write access (a temp dir, a build cache) add it via writable_roots in [sandbox_workspace_write]; teams that want network access (package installs, web fetches) flip network_accesson per profile. The defaults are deliberately conservative — opt in, don't opt out.

Schema review discipline
Treat the config like any other production specification. Check ~/.codex/config.toml into source control (or a managed dotfiles repo), review changes via PR, and avoidad-hoc edits on developer laptops that don't propagate back. The config is a contract between the CLI and the team — the contract is only useful if it's versioned and enforced.

03ProfilesPer-profile model, sandbox, approval, MCP.

The profile API is where Codex CLI separates itself from every prior agentic CLI. A profile is a named bundle of settings — model, sandbox, approval, auth, and MCP overrides — that activates as a single unit. One config.toml file can declare any number of profiles, and activation is always explicit: either --profile dev on the command line or CODEX_PROFILE=dev in the environment.

The judgement call is which profiles to declare. The shape that ages best is profiles named after environments rather than people or projects — dev, ci, prod, and optionally agent for long-running production agents that deserve their own auth and approval policy. Teams that name profiles after people (alice, bob) discover the surface doesn't scale; teams that name them after projects (migration, refactor-2026) end up with stale profiles cluttering the config. Environments are the durable axis.

Profile 01
dev — developer laptops

workspace-write sandbox with network enabled, approval policy 'never' for trusted developers, interactive OAuth auth, full MCP server roster. The most permissive profile — appropriate because a human is at the keyboard and reviews every edit before it ships.

OAuth · workspace-write
Profile 02
ci — CI workers

workspace-write sandbox but network_access disabled — generated tests and codemods don't need outbound calls. approval_policy = 'untrusted' so any sensitive operation halts the run for human review. API-key auth scoped to the CI runner and rotated via the secret store. The right balance for unattended pipelines.

API key · workspace-write
Profile 03
prod — production agents

read-only sandbox, network_access disabled, approval_policy = 'untrusted', dedicated API key rotated quarterly. For agents that observe and report — incident triage, log summarisation, scheduled audits — without mutating the codebase. The least-privilege profile.

API key · read-only
Profile 04
agent — autonomous workers

Optional fourth profile for long-running autonomous agents that genuinely need to write code in production. workspace-write narrowed via writable_roots in [sandbox_workspace_write], network access scoped to a known allowlist, dedicated API key with audit logging. Used by a minority of teams — most don't need a profile beyond dev / ci / prod.

Audit-logged · narrowed

Two practical rules for designing profiles. First, lean on the top-level defaults rather than duplicating settings across every profile — Codex profiles do not chain via an extends key, so anything not re-stated inside a [profiles.NAME] table simply inherits from the top-level config. Keep the shared defaults at the top and let each profile re-state only the deltas. Second, keep the profile count low until pressure forces an addition — three profiles is the common landing point, four is reasonable for teams running autonomous agents, five or more is usually a sign that something else (project-level config files, environment variables, command-line flags) is being misused as a profile substitute.

Activation discipline matters as much as profile design. Every CI workflow, every wrapper script, every long-running agent should pass --profile NAME (or its short form -p NAME) on the codex command line; relying on the default profile leads to confused incidents where the wrong settings apply silently. The pattern that holds up is treating the profile flag as required everywhere except the developer laptop, where a shell alias handles it.

The activation footgun
The single most common Codex CLI incident is a CI workflow that forgets to pass --profileand silently runs under the top-level defaults. The settings are wrong, the run succeeds anyway because Codex doesn't know it's misconfigured, and the output is subtly broken in ways nobody notices for a sprint. Audit every workflow for explicit profile activation after any config change.

04Sandboxread-only, workspace-write, danger-full-access.

Codex CLI ships three sandbox modes, each designed for a specific risk profile. The mode is set via the top-level sandbox_mode key (or per-profile inside [profiles.NAME]); the [sandbox_workspace_write] nested table refines the policy when workspace-write is active — network_access, writable_roots, and related knobs. The matching of mode to workload is what separates a reliable Codex deployment from a brittle one — a workspace-write profile running an unattended production agent is asking for an incident; a read-only profile blocking a developer's exploratory edit is asking for friction. See the Codex CLI reference for the canonical mode list.

Mode 01
workspace-write
writes scoped to workspace

The CLI can read anywhere it has OS access and write inside the workspace by default. The [sandbox_workspace_write] table tunes the policy via writable_roots, network_access, and related keys. The right mode for developer laptops and CI workers that need to mutate the codebase.

Default for dev and CI
Mode 02
danger-full-access
unrestricted · short-lived only

The most permissive mode — grants unrestricted filesystem access with no sandboxing. Intended only for sandboxed short-lived runs in ephemeral containers, throwaway VMs, or CI runners that are themselves disposable. Never use on a developer laptop or a long-lived host. Suitable for codemod batch runs in ephemeral environments.

Sandboxed batch runs
Mode 03
read-only
observability and triage agents

The CLI can read any path the OS permits but cannot mutate the filesystem. The right mode for production agents that observe and report — incident triage, scheduled audits, dashboard refreshes — without ever touching the codebase.

Production-default

The defaults inside each mode are conservative and worth knowing. workspace-write defaults to network_access = false and writes scoped to the workspace; the [sandbox_workspace_write] table is where you broaden writable_roots or enable network access per profile. danger-full-access bypasses sandboxing entirely — there is no allowlist to maintain because the mode is intended for environments that are themselves disposable. read-only blocks all filesystem writes. Teams that want network access in any mode need to opt in explicitly.

One subtle but important behaviour: read-only mode is genuinely read-only — the CLI cannot write to a temporary directory. If a production agent legitimately needs scratch space, the practical pattern is a wrapper script that creates a tmp dir outsideCodex and exposes it to the agent via an MCP server, rather than relaxing the sandbox mode. Most production agents don't need scratch space — log readers, triage summarisers, audit walkers — and the explicit-opt-in design keeps the blast radius small.

Codex CLI sandbox mode mix · share of profiles by mode

Source: Digital Applied internal benchmark, May 2026 · n = 31 production Codex CLI deployments. Indicative observation, not a public statistic.
workspace-write · dev and CIthe most common production deployment shape
58%
read-only · production agentsobservability, triage, and audit workloads
26%
danger-full-access · ephemeral batch runscodemod sweeps in throwaway containers only
12%
mixed · workload-by-workloadadvanced teams matching mode per workflow
4%

The honest reading of the mix is that most teams settle on a two-mode shape: workspace-write for dev and CI, read-only for production agents, danger-full-accessreserved for specific batch workloads inside throwaway containers. The teams that mix modes per workload tend to be running mature agentic platforms with five or more distinct Codex use cases; the rest find the two-mode shape sufficient and don't benefit from added complexity.

05MCPServer config and agent-loop primitives.

Codex CLI supports the Model Context Protocol as a first-class extension surface — the same protocol Claude Code popularised — which means the MCP server ecosystem is portable across both CLIs. The [mcp_servers.NAME] tables in config.toml declare the server roster; STDIO servers take command / args / env, HTTP servers take url plus bearer_token_env_var. Each server is launched (or connected to) when Codex starts, and the tools the server exposes become tool-call primitives the agent loop can invoke. The CLI and the Codex IDE extension share the same registry, so a server wired once is available in both clients.

The agent-loop primitives Codex exposes are the standard MCP shape: list_tools, call_tool, list_resources, read_resource, and the prompts surface for parameterised tool calls. Tool calls flow through the active sandbox and approval policy — a tool that wants to mutate the filesystem is bound by the profile's sandbox_mode, and an action that crosses the approval threshold pauses for confirmation rather than executing blindly.

# [mcp_servers.NAME] — Codex CLI MCP registry
# Docs: https://developers.openai.com/codex/mcp

# STDIO server: filesystem access scoped to the workspace
[mcp_servers.filesystem]
command = "npx"
args    = ["-y", "@modelcontextprotocol/server-filesystem", "/workspace"]

# STDIO server: GitHub API for PR / issue manipulation
[mcp_servers.github]
command  = "npx"
args     = ["-y", "@modelcontextprotocol/server-github"]
env_vars = ["GITHUB_TOKEN"]

# STDIO server: Postgres for data-aware code generation
[mcp_servers.postgres]
command  = "npx"
args     = ["-y", "@modelcontextprotocol/server-postgres"]
env_vars = ["DATABASE_URL"]

# HTTP server: bearer-token auth via env var
[mcp_servers.figma]
url                  = "https://mcp.figma.com/mcp"
bearer_token_env_var = "FIGMA_OAUTH_TOKEN"

# Narrowing for CI: use a separate ~/.codex/config.toml in the CI image
# (or a CODEX_HOME override) that simply omits the servers CI shouldn't
# reach. The registry is global to the config file; least-privilege is
# applied at the config-layer/profile-image boundary, not via an
# "inherit" key.

Codex does not ship an in-config "inherit" key for the MCP registry — the registry is global to a given config.toml. The production discipline that holds up is to narrow tool surfaces at the layer above: separate CODEX_HOME directories per environment, a CI image that ships a stripped-down config.toml, or admin-managed entries in requirements.toml. The result is a CI run that cannot reach the production database because the postgres server simply isn't declared in the CI image — least-privilege applied to tool surfaces, not just filesystem paths.

MCP across CLIs
The same MCP server you write for Claude Code runs unchanged under Codex CLI — the protocol is the contract, the CLI is just the host. Teams investing in custom MCP servers get portable tool-call infrastructure that survives CLI changes; teams embedding tool calls into Codex-specific config alone pay a migration cost the next time they evaluate a new CLI.

06vs Claude CodeFive-axis comparison.

Codex CLI and Claude Code are the two production-grade agentic CLIs in 2026, and most teams running serious agentic engineering eventually pick one as the default and use the other for specific workloads. The honest comparison is five-axis rather than headline-feature: configuration model, sandbox design, MCP surface, headless auth, and editor integration. Each axis has a winner; no CLI sweeps all five.

Axis 01
Configuration model

Codex CLI ships a TOML config.toml with flat top-level keys (model, approval_policy, sandbox_mode), named [profiles.NAME] overrides, and a [mcp_servers.*] registry. Claude Code uses a flatter settings.json with project-level CLAUDE.md files for behaviour. Codex wins for teams that want declarative configuration in source control; Claude Code wins for teams that prefer behaviour-as-documentation.

Codex CLI
Axis 02
Sandbox design

Codex CLI ships three explicit sandbox modes (read-only, workspace-write, danger-full-access) with profile-scoped activation. Claude Code uses a permission system (read / edit / run) layered on tool calls with optional --dangerously-skip-permissions for trusted sessions. Codex's mode-based design is more legible for production; Claude Code's permission model is more flexible for interactive work.

Tie — different shapes
Axis 03
MCP surface

Both CLIs support the Model Context Protocol natively. Codex CLI exposes the registry under [mcp_servers.*] shared between the terminal CLI and the IDE extension; Claude Code has tighter integration with its subagent system. The same MCP server runs unchanged under both — the ecosystem is portable.

Tie — protocol is portable
Axis 04
Headless auth

Codex CLI supports two auth paths — ChatGPT OAuth for interactive use and OpenAI API keys for headless / CI runs (selectable via forced_login_method). Claude Code relies on Anthropic API keys for headless use. Both CLIs need disciplined key rotation; neither ships a CI-native short-lived credential surface today. Slight edge to Codex on flexibility, not a sweep.

Slight edge: Codex CLI
Axis 05
Editor integration

Claude Code ships an officially-supported VS Code extension with diff-review UI, plan mode, and subagent surfacing. Codex CLI ships its own IDE extension that shares the config.toml registry but the terminal is the primary surface; richer editor integrations come via MCP. Claude Code wins clearly for interactive editor-side work; Codex's terminal-first design suits CI and unattended runs better.

Claude Code

The pattern that emerges from teams running both CLIs in production: Codex CLI for CI-resident agentic workloads (test generation, codemod runs, scheduled audits) where the headless auth and per-profile config pay back the configuration investment; Claude Code for interactive editor-side work (refactors, feature builds, code review) where the VS Code integration and subagent system reduce friction. The choice isn't exclusive — most mature teams use both — and the MCP-server roster carries across the boundary, so the tool-call investment is durable either way.

For broader CLI context including Windsurf, Cursor, and the agentic-editor surface, our AI transformation engagements cover the longer-form evaluation pattern. The TL;DR for most teams is: pick one CLI as the default for interactive work, run the other in CI where its strengths shine, and treat the MCP server roster as the portable layer that survives the choice.

07WorkflowsFour production workflows that ship.

The four workflow archetypes below are the patterns we see most often across production Codex CLI deployments. Each has a characteristic profile design, sandbox mode, auth pattern, and MCP-server roster. The patterns aren't mutually exclusive — most teams run two or three of them — but isolating them as archetypes makes the configuration design concrete.

Workflow 01
Test-generation pipeline
ci profile · workspace-write · API key

CI workflow runs Codex against a diff to generate or update tests. Profile: ci. Sandbox: workspace-write with network_access disabled. Auth: OpenAI API key supplied via the CI secret store and scoped to the runner. MCP: filesystem and github only. The canonical Codex CLI production workflow.

Most common archetype
Workflow 02
Codemod batch run
agent profile · danger-full-access · API key

Ephemeral container runs a large-scale codemod across many repos. Profile: agent. Sandbox: danger-full-access inside the disposable container (never on a long-lived host). Auth: API key scoped to the codemod runner. MCP: filesystem and github. Used for fleet-wide refactors and migration sweeps.

Sandboxed batch
Workflow 03
Incident-triage agent
prod profile · read-only · API key

Always-on agent that reads logs and code in response to alerts. Profile: prod. Sandbox: read-only. Auth: dedicated API key rotated quarterly via the secret store. MCP: filesystem (read-only), github, and a logs server. Produces summarised triage reports without ever mutating the codebase.

Observability surface
Workflow 04
Interactive developer session
dev profile · workspace-write · ChatGPT OAuth

A developer runs Codex on their laptop for exploratory edits. Profile: dev. Sandbox: workspace-write with network_access enabled. Auth: ChatGPT OAuth (the recommended interactive flow). MCP: full server roster including any in-house tools. approval_policy = 'never' because the developer reviews every edit.

The local default

The test-generation pipeline is the workflow that most teams adopt first because the value is immediate and the configuration is well-trodden. Our Codex test-generation pipeline tutorial walks the full pattern end-to-end, including the CI workflow YAML, the profile definition, and the failure modes to watch for. Workflows 02 through 04 build on the same foundation with progressively different trade-offs around containment and auth.

One operating rule that holds across all four archetypes: each workflow gets its own profile, even if two workflows share most settings. The cost of an extra profile is small (a few lines in config.toml); the cost of sharing a profile across distinct workflows is high (a change to one workflow's sandbox accidentally affects the other). Profile-per-workflow is the discipline that pays back across quarters.

Workflow design rule
One profile per workflow archetype, named after the workflow rather than the environment, and nevershared across workflows with different risk profiles. The extra config surface is cheap insurance; the alternative is a CI change that quietly relaxes a production agent's sandbox because the profile is shared.
Wrapping up

Codex CLI is config-first — get the profiles right and the workflows follow.

Codex CLI (versions 0.128–0.130 as of May 2026) is among the most configurable agentic coding CLIs shipping in 2026, and the configurability is the differentiator. Flat top-level keys in config.toml, named [profiles.NAME] overrides that bundle model, sandbox, and approval into a single activation unit, three sandbox modes (read-only, workspace-write, danger-full-access) matched to workload risk, and an [mcp_servers.*] roster that carries across CLIs. Teams that treat configuration as the primary unit of design ship reliably; teams that copy a README config and forget about it pay for it eventually.

The named-profile pattern is the leverage. Three profiles — dev, ci, prod — covers the majority of production deployments, and a fourth agent profile handles the minority running long-lived autonomous workers. Activation is always explicit via --profile, settings that aren't re-stated in a profile inherit from the top-level defaults, and the sandbox-mode choice flows from the profile design rather than the other way around. The discipline isn't complicated; it's consistent.

The broader pattern is the one to keep. Treat agentic CLIs as production specifications, not editor toys. Version the config in source control, validate in CI, design profiles per environment and workflow, and invest in portable tool-call infrastructure via MCP rather than CLI-specific extensions. The CLI you standardise on today won't be the only CLI you run two years from now — the configuration discipline that survives the next CLI change is the one worth practising now.

Configure Codex right

Codex CLI is config-first — profiles are the leverage.

Our team designs Codex CLI deployments — per-environment profiles, sandbox modes, MCP integration, agent loops — with team rollout playbooks.

Free consultationExpert guidanceTailored solutions
What we ship

Codex CLI engagements

  • config.toml design per-environment
  • Profile slots (dev / CI / prod / agent)
  • Sandbox mode selection per workload
  • MCP-server integration
  • Workflow archetype rollout
FAQ · Codex CLI

The questions engineers ask before production.

Codex CLI's ~/.codex/config.toml is a flat key file at the top level with nested tables for the structured surfaces. Top-level keys include model, approval_policy, sandbox_mode, web_search, and a handful of others. Nested tables include [sandbox_workspace_write] for write-scope tuning, [mcp_servers.NAME] for the MCP registry, [profiles.NAME] for named overrides, [shell_environment_policy] for env hygiene, and [model_providers.ID] for custom provider plumbing. The canonical key list lives in the official config reference at developers.openai.com/codex/config-reference. Admin-managed constraints (lifecycle hooks, forced login method) live in a separate requirements.toml. Codex does not ship an 'extras' escape hatch — unknown keys generally log a warning rather than hard-failing, so pin a CLI version per environment and audit config.toml on upgrades.