# Codex CLI Help Reference **Version**: 0.58.0 ## Main Command: `codex --help` ``` Codex CLI If no subcommand is specified, options will be forwarded to the interactive CLI. Usage: codex [OPTIONS] [PROMPT] codex [OPTIONS] [ARGS] Commands: exec Run Codex non-interactively [aliases: e] login Manage login logout Remove stored authentication credentials mcp [experimental] Run Codex as an MCP server and manage MCP servers mcp-server [experimental] Run the Codex MCP server (stdio transport) app-server [experimental] Run the app server or related tooling completion Generate shell completion scripts sandbox Run commands within a Codex-provided sandbox [aliases: debug] 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) cloud [EXPERIMENTAL] Browse tasks from Codex Cloud and apply changes locally 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 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 Enable a feature (repeatable). Equivalent to `-c features.=true` --disable Disable a feature (repeatable). Equivalent to `-c features.=false` -i, --image ... Optional image(s) to attach to the initial prompt -m, --model Model the agent should use --oss Convenience flag to select the local open source model provider. Equivalent to -c model_provider=oss; verifies a local Ollama server is running -p, --profile Configuration profile from config.toml to specify default options -s, --sandbox Select the sandbox policy to use when executing model-generated shell commands [possible values: read-only, workspace-write, danger-full-access] -a, --ask-for-approval Configure when the model requires human approval before executing a command Possible values: - untrusted: Only run "trusted" commands (e.g. ls, cat, sed) without asking for user approval. Will escalate to the user if the model proposes a command that is not in the "trusted" set - on-failure: Run all commands without asking for user approval. Only asks for approval if a command fails to execute, in which case it will escalate to the user to ask for un-sandboxed execution - 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 --full-auto Convenience alias for low-friction sandboxed automatic execution (-a on-request, --sandbox workspace-write) --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 -C, --cd Tell the agent to use the specified directory as its working root --search Enable web search (off by default). When enabled, the native Responses `web_search` tool is available to the model (no per‑call approval) --add-dir Additional directories that should be writable alongside the primary workspace -h, --help Print help (see a summary with '-h') -V, --version Print version ``` ## Exec Command: `codex exec --help` ``` Run Codex non-interactively Usage: codex exec [OPTIONS] [PROMPT] [COMMAND] Commands: resume Resume a previous session by id or pick the most recent with --last help Print this message or the help of the given subcommand(s) Arguments: [PROMPT] Initial instructions for the agent. If not provided as an argument (or if `-` is used), instructions are read from stdin Options: -c, --config 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 Enable a feature (repeatable). Equivalent to `-c features.=true` -i, --image ... Optional image(s) to attach to the initial prompt --disable Disable a feature (repeatable). Equivalent to `-c features.=false` -m, --model Model the agent should use --oss -s, --sandbox Select the sandbox policy to use when executing model-generated shell commands [possible values: read-only, workspace-write, danger-full-access] -p, --profile Configuration profile from config.toml to specify default options --full-auto Convenience alias for low-friction sandboxed automatic execution (-a on-request, --sandbox workspace-write) --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 -C, --cd Tell the agent to use the specified directory as its working root --skip-git-repo-check Allow running Codex outside a Git repository --output-schema Path to a JSON Schema file describing the model's final response shape --color Specifies color settings for use in the output [default: auto] [possible values: always, never, auto] --json Print events to stdout as JSONL -o, --output-last-message Specifies file where the last message from the agent should be written -h, --help Print help (see a summary with '-h') -V, --version Print version ``` ## Exec Resume Command: `codex exec resume --help` ``` Resume a previous session by id or pick the most recent with --last Usage: codex exec resume [OPTIONS] [SESSION_ID] [PROMPT] Arguments: [SESSION_ID] Conversation/session id (UUID). When provided, resumes this session. If omitted, use --last to pick the most recent recorded session [PROMPT] Prompt to send after resuming the session. If `-` is used, read from stdin Options: -c, --config 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` --last Resume the most recent recorded session (newest) without specifying an id --enable Enable a feature (repeatable). Equivalent to `-c features.=true` --disable Disable a feature (repeatable). Equivalent to `-c features.=false` -h, --help Print help (see a summary with '-h') ```