codex(1)

CODEX-CLI(1) User Commands CODEX-CLI(1)

NAME

codex-cli - manual page for codex-cli 0.164.0

SYNOPSIS

codex [OPTIONS] [PROMPT]

DESCRIPTION

Codex CLI

If no subcommand is specified, options will be forwarded to the interactive CLI.

codex [OPTIONS] <COMMAND> [ARGS]

Commands:

agents
Browse all agent sessions on the shared local app-server daemon
exec
Run Codex non-interactively [aliases: e]
review
Run a code review non-interactively
login
Manage login
logout
Remove stored authentication credentials
mcp
Manage external MCP servers for Codex
plugin
Manage Codex plugins
app-server
[experimental] Run the app server or related tooling
remote-control
[experimental] Manage the app-server daemon with remote control enabled
completion
Generate shell completion scripts
update
Update Codex to the latest version
doctor
Diagnose local Codex installation, config, auth, and runtime health
sandbox
Run commands within a Codex-provided sandbox
debug
Debugging tools
apply
Apply the latest diff produced by Codex agent as a `git apply` to your local working tree [aliases: a]
resume
Resume a previous interactive session (picker by default; use --last to continue the most recent)
queue
Queue a message for an existing session
archive
Archive a saved session by id or session name
delete
Permanently delete a saved session by id or session name
migrate-rollouts
Inspect or migrate legacy local sessions to paginated thread history
migrate-nfs-db
[experimental] Migrate configured SQLite databases to DELETE mode in place
unarchive
Unarchive a saved session by id or session name
fork
Fork a previous interactive session (picker by default; use --last to fork the most recent)
cloud
[EXPERIMENTAL] Browse tasks from Codex Cloud and apply changes locally
exec-server
[EXPERIMENTAL] Run the standalone exec-server service
features
Inspect feature flags
help
Print this message or the help of the given subcommand(s)

Arguments:

[PROMPT]
Optional user prompt to start the session

OPTIONS

-c, --config <key=value>

Override a configuration value that would otherwise be loaded from `~/.codex/config.toml`. Use a dotted path (`foo.bar.baz`) to override nested values. The `value` portion is parsed as TOML. If it fails to parse as TOML, the raw string is used as a literal.
Examples: - `-c model="o3"` - `-c 'sandbox_permissions=["disk-full-read-access"]'` - `-c shell_environment_policy.inherit=all`

--enable <FEATURE>

Enable a feature (repeatable). Equivalent to `-c features.<name>=true`

--disable <FEATURE>

Disable a feature (repeatable). Equivalent to `-c features.<name>=false`

--remote <ADDR>

Connect the TUI to a remote app server endpoint.
Accepted forms: `ws://host:port`, `wss://host:port`, `unix://`, or `unix://PATH`.

--remote-auth-token-env <ENV_VAR>

Name of the environment variable containing the bearer token to send to a remote app server websocket

--strict-config

Error out when config.toml contains fields that are not recognized by this version of Codex

-i, --image <FILE>...

Optional image(s) to attach to the initial prompt

-m, --model <MODEL>

Model the agent should use

--oss

Use open-source provider

--local-provider <OSS_PROVIDER>

Specify which local provider to use (lmstudio or ollama). If not specified with --oss, will use config default or show selection

-p, --profile <CONFIG_PROFILE_V2>

Layer $CODEX_HOME/<name>.config.toml on top of the base user config

-s, --sandbox <SANDBOX_MODE>

Select the sandbox policy to use when executing model-generated shell commands
[possible values: read-only, workspace-write, danger-full-access]

--approve-for-me

Route approval requests through automatic review using the workspace-write sandbox

--dangerously-bypass-approvals-and-sandbox

Skip all confirmation prompts and execute commands without sandboxing. EXTREMELY DANGEROUS. Intended solely for running in environments that are externally sandboxed

--dangerously-bypass-hook-trust

Run enabled hooks without requiring persisted hook trust for this invocation. DANGEROUS. Intended only for automation that already vets hook sources

-C, --cd <DIR>

Tell the agent to use the specified directory as its working root

--worktree

Run the session in a new managed Git worktree

--add-dir <DIR>

Additional directories that should be writable alongside the primary workspace

-a, --ask-for-approval <APPROVAL_POLICY>

Configure when the model requires human approval before executing a command
Possible values: - on-request: The model decides when to ask the user for approval - never: Never ask for user approval Execution failures are immediately returned to
the model

--search

Enable live web search. When enabled, the native Responses `web_search` tool is available to the model (no per???call approval)

--no-alt-screen

Disable alternate screen mode
Runs the TUI in inline mode, preserving terminal scrollback history.

--no-daemon

Run without the shared background server, even if it is already running

-h, --help

Print help (see a summary with '-h')

-V, --version

Print version
October 2026 codex-cli 0.164.0