Reference · Reference
Codex CLI Commands List
Free OpenAI Codex CLI commands list (2026): all 65 commands, slash commands, keyboard shortcuts, key options, setup guide, and practical workflow examples
Last updated:
How to Use
Expand how to useCollapse how to use
- 1
Filter by category
Switch between Core Commands, Key Options, Setup, and Workflow Examples to focus on the commands you need.
- 2
Search details
Use keyword search to match command names, option notes, and example commands at once.
- 3
Copy and run
Copy the command snippet with one click, then run it directly in your terminal.
Latest Updates (Summary)
Quick view of important changes. See details in the section below.
codex-cli 0.147.0 (August 7, 2026)
- Added the
--approve-for-meflag to route approval requests through automatic review using the workspace-write sandbox - Added portable Agent Plugins installation and search across local, personal, workspace, and remote plugin catalogs
- Added persistent, manually ordered conversation sections and incremental browsing of long transcripts
codex-cli 0.146.1 (August 5, 2026)
- Applied safer automatic-review defaults for cyber-capable models
- The terminal interface now explains permission changes when they are applied
codex
Key points
- codex "<prompt>": Start with an initial prompt.
- codex --help: Show available subcommands and global options.
Examples
codexLaunch interactive mode in the current directory.codex "Summarize this repository structure"Start a session with a task-focused prompt.codex exec
Key points
- --sandbox: Choose execution sandbox mode.
- --profile: Load a predefined profile from config.toml.
Examples
codex exec "Review this PR diff"Run a one-shot review task from the CLI.cat plan.md | codex exec -Read instructions from stdin.codex review
Key points
- --uncommitted: Review staged, unstaged, and untracked changes.
- --base <branch>: Compare the current branch against a base branch.
- --commit <sha>: Review changes introduced by a specific commit.
Examples
codex review --uncommittedReview local changes before committing.codex review --base mainReview changes against main branch.codex resume
Key points
- --last: Resume the most recent session immediately.
- --all: Show all sessions beyond current working directory filter.
Examples
codex resume --lastContinue the latest session quickly.codex resume <SESSION_ID>Resume a specific saved session.codex fork
Key points
- --last: Fork the most recent session without opening the picker.
- --all: Show sessions across all working directories in the picker.
Examples
codex fork --lastFork the latest session and continue in a new direction.codex fork <SESSION_ID> "Try an alternative implementation"Start a new branch from a specific session.codex archive
Key points
- `codex archive <SESSION>`: Archive a session by its id (UUID) or session name.
- The `/archive` slash command in the TUI performs the same operation.
Examples
codex archive <SESSION>Archive a finished session to keep your session list tidy.codex unarchive <SESSION>Restore the session later when you need it again.codex unarchive
Key points
- `codex unarchive <SESSION>`: Restore a session by its id (UUID) or session name.
- Restored sessions reappear in the `codex resume` picker.
Examples
codex unarchive <SESSION>Restore an archived session.codex resume <SESSION_ID>Resume the restored session and continue working.codex delete
Key points
- `codex delete <SESSION>`: Delete a session by its id (UUID) or session name. UUIDs take precedence when parseable.
- `--force`: Delete without prompting (SESSION must be a UUID).
- The `/delete` slash command in the TUI performs the same operation.
Examples
codex delete <SESSION>Permanently delete a session you no longer need, after confirmation.codex delete --force <SESSION_ID>Delete a session immediately without prompting (UUID required).codex apply
Key points
- <TASK_ID>: Specify the Codex task ID to apply.
- Review the generated diff in Codex Cloud before applying locally.
Examples
codex apply <TASK_ID>Apply the latest diff for the specified task.codex cloud diff <TASK_ID>Preview the patch before applying it locally.codex cloud
Key points
- codex cloud list: List tasks in Codex Cloud.
- codex cloud apply <TASK_ID>: Apply a cloud task diff to local repository.
Examples
codex cloud listCheck available tasks from Codex Cloud.codex cloud diff <TASK_ID>Preview task diff before applying locally.codex app
Key points
- codex app: Open Codex desktop app on macOS.
- Useful when switching between terminal workflows and desktop session management.
Examples
codex appLaunch (or install then launch) the desktop app.codex app --helpCheck platform support and startup options.codex login
Key points
- codex login: Start browser-based authentication flow.
- codex login status: Check current login state.
Examples
codex loginAuthenticate via browser.codex login statusCheck authentication state and user info.codex logout
Key points
- `codex logout`: Deletes locally stored authentication tokens.
- Useful for shared machines and CI cleanup workflows.
Examples
codex logoutClear the current authenticated session.codex loginSign in again when needed.codex app-server
Key points
- `codex app-server`: Starts the app server or related tooling (experimental).
- `codex app-server --help`: Show available subcommands and flags.
Examples
codex app-server --helpInspect supported app-server operations.codex app-serverStart the experimental app-server command.codex exec-server
Key points
- `--listen <URL>`: Transport endpoint URL (default `ws://127.0.0.1:0`).
- `-c, --config <key=value>`: Override a value from config.toml for this run.
- `--enable / --disable <FEATURE>`: Toggle feature flags for the session.
Examples
codex exec-serverStart on the default local WebSocket endpoint.codex exec-server --listen ws://127.0.0.1:8080Listen on a specific port.codex remote-control
Key points
- `codex remote-control`: Launch the app-server with remote control enabled.
- `-c, --config <key=value>`: Override a config.toml value for this launch.
- `--enable / --disable <FEATURE>`: Toggle feature flags at startup.
Examples
codex remote-controlStart a headless app-server you can drive remotely.codex remote-control --helpInspect available options and flags.codex remote-control pair
Key points
- `codex remote-control pair`: Generate a short-lived manual pairing code.
- `--json`: Emit the pairing code as machine-readable JSON.
- `-c, --config <key=value>`: Override a config value for this run.
Examples
codex remote-control pairPrint a short-lived code for manual pairing.codex remote-control pair --jsonGet the pairing code as JSON.codex sandbox
Key points
- `codex sandbox`: Entry point for sandbox utility commands.
- `codex sandbox --help`: Show sandbox subcommands and usage.
Examples
codex sandbox --helpReview available sandbox capabilities.codex sandboxExecute sandbox-related commands directly.codex debug
Key points
- `codex debug`: Entry point for debugging utilities.
- `codex debug --help`: List diagnostics and debug helpers.
Examples
codex debug --helpList debug subcommands before running them.codex debugRun debug tooling from the CLI.codex update
Key points
- `codex update`: Pulls the latest release and replaces the local binary.
- Run `codex --version` afterwards to confirm the upgrade.
Examples
codex updateUpgrade to the latest Codex CLI release.codex update && codex --versionUpdate and verify the new version.codex doctor
Key points
- --summary: Show only grouped check rows and the final count summary.
- --json: Emit a redacted, machine-readable report.
- --all: Expand long lists in detailed human output.
Examples
codex doctorDiagnose installation and configuration at once.codex doctor --jsonGet a machine-readable diagnostic report for CI.codex login status
Key points
- Shows user info when authenticated.
- Suggests `codex login` when not authenticated.
Examples
codex login statusCheck login state.codex login status && codex exec "task"Verify auth before running a task.codex plugin
Key points
- codex plugin marketplace: Manage plugin marketplaces (add, upgrade, remove).
- Combines with feature flags and `-c/--config` overrides like other subcommands.
Examples
codex plugin --helpList available plugin subcommands.codex plugin marketplace add openai/codex-marketplaceInstall the official marketplace via the new plugin surface.codex plugin marketplace
Key points
- add <SOURCE>: Install a plugin marketplace from GitHub (`owner/repo[@ref]`), an HTTP(S)/SSH Git URL, or a local directory.
- upgrade: Update installed marketplaces.
- remove: Uninstall a marketplace.
Examples
codex plugin marketplace add openai/codex-marketplaceInstall the official marketplace from GitHub.codex plugin marketplace add ./local-marketplaceInstall from a local marketplace directory.-m, --model
Key points
- -m <model>: Launch with a specific model.
- Temporarily overrides the default from config.toml.
Examples
codex -m o3 "Analyze this code"Start an interactive session with o3.codex exec -m codex-mini-latest "Check the structure"Run non-interactively with a lightweight model.-p, --profile
Key points
- fast: Quick lookup and lightweight analysis.
- default | deep | max: Increase reasoning depth for complex tasks.
Examples
codex exec --profile fast "Inspect routing"Run a low-cost analysis task.codex exec --profile deep "Design refactor plan"Use deeper reasoning for architecture tasks.-s, --sandbox
Key points
- read-only: Prevent file writes.
- workspace-write | danger-full-access: Allow broader editing access.
Examples
codex exec --sandbox read-only "List potential bugs"Analyze code without changing files.codex exec --sandbox workspace-write "Apply the fix"Allow edits in the current workspace.-a, --ask-for-approval
Key points
- untrusted: Ask for approval for commands outside the trusted set.
- on-request | never: Switch approval behavior by interactive vs non-interactive workflows.
- on-failure: Deprecated in the latest CLI.
Examples
codex -a on-requestStart interactive mode with request-based approvals.codex exec -a never "Run checks and summarize"Use no-approval policy for scripted runs.--search
Key points
- codex --search: Enable web search for a new interactive session.
- When enabled, the Responses `web_search` tool is available.
- codex resume --search: Resume a session with web search enabled.
Examples
codex --search "Check latest framework changes"Start with web search enabled.codex resume --last --searchContinue the latest session with web search.--remote
Key points
- --remote <ws://...|wss://...>: Connect to an app-server-backed WebSocket endpoint.
- Useful when Codex app-server runs on another machine or as a long-lived service.
Examples
codex --remote ws://127.0.0.1:8080Launch the TUI against a local app-server WebSocket.codex --remote wss://codex.example.com/socket --no-alt-screenUse a remote endpoint while keeping inline terminal scrollback.-i, --image
Key points
- -i <file>: Specify image file(s) (repeatable).
- Useful for analyzing screenshots and UI designs.
Examples
codex -i screenshot.png "Suggest improvements for this UI"Start a session with an attached image.codex exec -i error.png "Identify the cause of this error"Run non-interactively with an image.-C, --cd
Key points
- -C <dir>: Use the specified directory as the workspace root.
- Useful for running Codex against a different project.
Examples
codex -C /path/to/projectStart a session in a different directory.codex exec -C ../other-repo "Run the tests"Run non-interactively in another repository.--add-dir
Key points
- --add-dir <dir>: Grant write access to an additional directory.
- Useful for monorepos and shared library access.
Examples
codex --add-dir ../shared-libAllow edits to a shared library directory.codex exec --add-dir ../configs "Update the settings"Grant write access to a config directory.codex --oss
Key points
- --oss: Connect to LM Studio or Ollama.
- --local-provider <provider>: Explicitly choose lmstudio or ollama.
Examples
codex --ossStart a session with a local model.codex --oss --local-provider ollamaExplicitly use Ollama as the provider.--no-alt-screen
Key points
- Preserves terminal scrollback history.
- Useful in terminal multiplexers like Zellij.
Examples
codex --no-alt-screenLaunch while preserving scrollback.codex --no-alt-screen "Start working"Interactive session in a multiplexer environment.--skip-git-repo-check
Key points
- --skip-git-repo-check: Skip Git repository validation.
- For standalone scripts and document generation outside repos.
Examples
codex exec --skip-git-repo-check "Draft a README"Run in a non-Git directory.codex exec --skip-git-repo-check --sandbox read-only "Analyze"Combine with read-only for safe execution.--ephemeral
Key points
- --ephemeral: Disable session persistence.
- Keeps disk clean for temporary analysis and CI runs.
Examples
codex exec --ephemeral "Explain this function"Analyze without saving a session.codex exec --ephemeral --sandbox read-only "Check dependencies"Leave no trace with read-only analysis.--output-schema
Key points
- --output-schema <file>: Path to a JSON Schema file.
- Ensures structured output in CI/CD pipelines.
Examples
codex exec --output-schema schema.json "Output analysis as JSON"Get schema-validated structured output.codex exec --output-schema report.schema.json -o result.json "Generate report"Schema validation with file output.--enable / --disable
Key points
- --enable <feature>: Shortcut for `-c features.<name>=true`.
- --disable <feature>: Shortcut for `-c features.<name>=false`.
Examples
codex --enable some_featureEnable a specific feature for this session.codex exec --disable experimental_feature "Run task"Disable an experimental feature for this run.--dangerously-bypass-approvals-and-sandbox
Key points
- Skips all confirmation prompts and disables sandboxing.
- Intended solely for Docker or externally isolated environments.
Examples
codex exec --dangerously-bypass-approvals-and-sandbox "Build"Use only in externally sandboxed environments.# Use inside Docker or isolated containersNever use directly on development machines.--local-provider
Key points
- --local-provider <provider>: Choose lmstudio or ollama explicitly.
- Used with --oss. If omitted, uses config default or shows a selection prompt.
Examples
codex --oss --local-provider lmstudioExplicitly use LM Studio as the provider.codex --oss --local-provider ollama "Analyze the code"Use Ollama with an initial prompt.--color
Key points
- --color <always|never|auto>: Set color output mode.
- Use never in CI to strip ANSI escapes. Defaults to auto.
Examples
codex exec --color never "Run the tests"Plain output for log files.codex exec --color always "Show the diff"Force color output even when piped.--remote-auth-token-env
Key points
- --remote-auth-token-env <ENV_VAR>: Read the bearer token from the named environment variable and send it when connecting.
- Use with --remote for authenticated remote connections.
Examples
codex --remote wss://codex.example.com/ws --remote-auth-token-env CODEX_TOKENConnect remotely using the token in the CODEX_TOKEN variable.CODEX_TOKEN=secret codex resume --last --remote wss://host:8080 --remote-auth-token-env CODEX_TOKENResume the latest session over an authenticated remote connection.--json
Key points
- --json: Stream events in JSONL format.
- Ideal for programmatic parsing and CI/CD pipeline integration.
Examples
codex exec --json "Analyze the code" > events.jsonlSave event log to a file.codex exec --json "Run tests" | jq '.type'Filter event types with jq.-o, --output-last-message
Key points
- -o <file>: Set the output file for the last response.
- Useful for CI/CD result capture and report generation.
Examples
codex exec -o result.txt "Summarize this PR"Save the final response to a text file.codex exec --output-schema schema.json -o result.json "Generate report"Schema-validated JSON file output.--ignore-user-config
Key points
- --ignore-user-config: Skip `$CODEX_HOME/config.toml` while keeping CLI-specified `-c` overrides.
- Useful in CI runners to enforce deterministic, profile-free runs.
Examples
codex exec --ignore-user-config "Run tests and summarize failures"Execute without interference from personal configuration.codex exec --ignore-user-config -c model=o3 "Refactor utils"Start from a clean slate and override the model inline.--ignore-rules
Key points
- --ignore-rules: Ignore both user and project `.rules` policy files for this run.
- Combine with `--ignore-user-config` for fully isolated automated runs.
Examples
codex exec --ignore-rules "Check formatting"Bypass locally defined execpolicy rules.codex exec --ignore-rules --ignore-user-config --sandbox read-only "Audit dependencies"Fully isolated audit from any user-side configuration.--strict-config
Key points
- --strict-config: Fail when unknown configuration keys are detected.
- Useful for catching config mistakes and typos early.
Examples
codex --strict-configFail at startup if unknown config keys exist.codex exec --strict-config "Run the tests"Strictly validate configuration in CI.--dangerously-bypass-hook-trust
Key points
- --dangerously-bypass-hook-trust: Skip the hook trust check for this run only.
- **Dangerous**: For automation environments where hook sources are already vetted.
Examples
codex exec --dangerously-bypass-hook-trust "Run with hooks"Run hooks without the trust prompt (vetted environments only).# Use in CI where hook sources are managedDo not use during interactive development.-P, --permission-profile
Key points
- -P, --permission-profile <name>: Name of the permissions profile to apply.
- Reuse a sandbox permission set defined in config.toml by name.
Examples
codex sandbox -P ci-readonly -- npm testRun the command with the ci-readonly profile permissions.codex sandbox --permission-profile build -- makeBuild with the write access granted by the build profile.--approve-for-me
Key points
- --approve-for-me: Hand pending approvals to automatic review and run them in the workspace-write sandbox.
- Accepted by both the interactive session (codex) and non-interactive runs (codex exec).
Examples
codex --approve-for-meLet automatic review handle approval prompts in an interactive session.codex exec --approve-for-me "Fix the failing tests"Keep a non-interactive run moving without stalling on approvals.-c, --config
Key points
- -c model="gpt-5-codex": Set model for the current run.
- -c features.name=true: Toggle a feature flag for this run only.
Examples
codex -c model="gpt-5-codex"Launch with a specific model override.codex exec -c 'sandbox_permissions=["workspace-write"]' "Explain risk"Override sandbox permissions inline.codex login --with-api-key
Key points
- --with-api-key: Read API key from stdin.
- --device-auth: Use browser-based device authentication.
- --with-access-token: Read access token from stdin.
Examples
printenv OPENAI_API_KEY | codex login --with-api-keyLogin non-interactively with environment variable.codex login --device-authStart interactive device authentication.printenv CODEX_ACCESS_TOKEN | codex login --with-access-tokenLogin non-interactively with an access token.codex mcp add
Key points
- codex mcp list: Show configured MCP servers.
- codex mcp remove <name>: Remove an MCP server from config.
- codex mcp login <name> / logout <name>: Interactively authenticate or deauthenticate an MCP server that requires OAuth (no experimental opt-in needed since v0.144.0).
Examples
codex mcp add docs -- command --flagRegister a new MCP server command.codex mcp get docsInspect details of a configured MCP server.codex mcp-server
Key points
- Use this when integrating Codex into MCP-compatible clients and tools.
- Supports `-c/--config` and feature flags just like other subcommands.
Examples
codex mcp-serverStart Codex in MCP server mode on stdio.codex mcp-server -c model="gpt-5-codex"Launch MCP server mode with a one-off config override.codex features
Key points
- codex features list: Show known features and their effective state.
- codex features enable|disable <name>: Persist toggles in config.toml.
Examples
codex features listCheck staged and experimental flags before enabling.codex features enable <feature_name>Enable a feature flag in your local Codex config.codex completion zsh
Key points
- codex completion zsh: Output zsh completion script.
- codex completion bash: Output bash completion script.
Examples
codex completion zsh > ~/.zsh/completions/_codexInstall zsh completion manually.codex completion fish > ~/.config/fish/completions/codex.fishInstall fish completion script.codex plugin marketplace add <SOURCE>
Key points
- <SOURCE> accepts `owner/repo[@ref]`, HTTP(S) or SSH Git URLs, or a local marketplace root directory.
- --ref <REF>: Git ref to check out. Overrides any `@ref` or `#ref` suffix in SOURCE.
- --sparse <PATH>: Sparse-checkout path (repeatable) for trimming large Git sources.
Examples
codex plugin marketplace add openai/codex-marketplace@mainPin a GitHub marketplace to a specific branch or tag.codex plugin marketplace add https://github.com/openai/codex-marketplace.git --sparse plugins/linterFetch only the `plugins/linter` subtree via sparse checkout.codex exec --profile fast --sandbox read-only "<prompt>"
Key points
- --profile fast: Use lower-cost profile for quick checks.
- --sandbox read-only: Guarantee no file modifications.
Examples
codex exec --profile fast --sandbox read-only "Find dead code candidates"Run static analysis without editing files.codex exec --profile fast --sandbox read-only "Map i18n key usage"Inspect translation usage safely.codex exec --profile default --sandbox workspace-write "<prompt>"
Key points
- --profile default: Balanced speed and reasoning.
- --sandbox workspace-write: Allow edits inside project workspace.
Examples
codex exec --profile default --sandbox workspace-write "Implement tooltip improvements"Run a typical implementation task.codex exec --profile default --sandbox workspace-write "Update docs and tests"Apply code and documentation updates together.codex review --uncommitted
Key points
- --uncommitted: Include staged, unstaged, and untracked files.
- --title <name>: Add context label to review summary.
Examples
codex review --uncommittedRun a quick local review pass.codex review --uncommitted --title "before-merge-check"Attach a custom review title.codex exec --json -o result.json "<prompt>"
Key points
- --json: Stream execution events as JSONL.
- -o <file>: Save the last assistant message to a file.
Examples
codex exec --json -o result.json "List migration risks"Capture structured events and final summary.codex exec --json "Generate release notes draft"Use JSONL stream in custom tooling.codex review --base <branch>
Key points
- --base <branch>: Set the base branch for comparison.
- Ideal for pre-PR branch-to-branch reviews.
Examples
codex review --base mainReview diff against the main branch.codex review --base develop "Review for security issues"Branch review with custom instructions.codex review --commit <sha>
Key points
- --commit <sha>: Specify the commit SHA to review.
- --title <title>: Add a title to the review summary.
Examples
codex review --commit abc1234Review a specific commit's changes.codex review --commit HEAD --title "Latest commit review"Review the latest commit with a title.codex cloud exec "<prompt>"
Key points
- codex cloud exec: Create a cloud task without launching the TUI.
- Use codex cloud status / list / diff / apply to check and apply results.
Examples
codex cloud exec "Run all tests and report results"Execute a task in the cloud.codex cloud list && codex cloud apply <task-id>List tasks and apply a diff locally.Important Updates by Version
Summarized from official OpenAI GitHub releases, focused on practical capabilities.
- Added the
--approve-for-meflag to route approval requests through automatic review using the workspace-write sandbox - Added portable Agent Plugins installation and search across local, personal, workspace, and remote plugin catalogs
- Added persistent, manually ordered conversation sections and incremental browsing of long transcripts
- Added Cursor-managed skill imports and duplicate-free syncing of imported Claude and Cursor conversations
- Added support for the opt-in MCP 2026-07-28 protocol, including paginated discovery, multi-round requests, and non-blocking server startup
- Enabled cached web search and remote conversation compaction for Amazon Bedrock
- Removed the deprecated
codex exec --full-autoflag; use--sandbox workspace-writeinstead
- Applied safer automatic-review defaults for cyber-capable models
- The terminal interface now explains permission changes when they are applied
- Set session names via
/newand/clearfor pinning and switching between threads - Added Agent Plugins manifest support and workspace plugin publishing
- Added plugin marketplaces for Amazon Bedrock and Claude Code
- Added paginated thread forking
- app-server can now connect to remote Code Mode hosts over WebSocket
- Enabled standalone web search for compatible custom model providers
- Expanded
/importto migrate Cursor and Claude Code settings, MCP servers, plugins, sessions, commands, and project-scoped memories - Stabilized the opt-in multi-agent V2 experience with configurable sub-agent models, reasoning levels, concurrency, restored roles, and improved agent navigation
- Added experimental paginated thread history with efficient resume, search, persisted names, sub-agent support, and memories
- Added audio inputs and tool outputs (common local audio formats) and introduced streaming realtime V3 conversations
- Added experimental Amazon Bedrock login with custom endpoint and authentication support, and GPT-5.6 Sol as the default Bedrock model
- Hotfix refreshing the bundled instructions for GPT-5.6 Sol, Terra, and Luna, and correcting their context window to 272,000 tokens
- Improved dangerous-command detection, including more forced
rmforms, with clearer rejection reasons when commands are denied
- Fixed standalone installs failing when GitHub returns compact or reordered release metadata
- Ensured macOS package installs expose the code-mode host binary alongside the
codexexecutable - Kept code mode working when the companion host binary is unavailable by falling back to the embedded runtime
- MCP tools can now request OAuth authentication interactively without an experimental opt-in; use
codex mcp login <name>/codex mcp logout <name>to authenticate or deauthenticate a server - Added a
writesapp-approval mode that allows declared read-only actions while prompting for writes - Usage-limit reset credits now show their type and expiration, letting you choose which credit to redeem
- Windows sandbox sessions can now delete files in writable roots and access the managed primary runtime
- Pasted terminal control sequences can no longer corrupt TUI rendering or resumed conversation history
- Remote plugins are now enabled by default, adding npm marketplace sources, richer catalog rows, and visible remote/local versions
- Routes authentication and Responses API traffic through macOS and Windows system proxies, including PAC and WPAD configurations
- Added
codex remote-control pairto generate short-lived manual pairing codes from a running daemon - Added Amazon Bedrock GPT-5.6 Sol, Terra, and Luna models with first-class support for
maxreasoning effort - MCP tools now use tool search by default, and ChatGPT-hosted MCP servers can explicitly use session authentication
- Fixed an issue where full Responses WebSocket request payloads could be written to trace logs, preventing accidental exposure of sensitive data
- MCP tools now use tool search by default on supported servers, improving tool discovery while staying compatible with older models and providers
- Plugins can ship dedicated dark-mode logos via local manifests and remote catalogs
- macOS authentication can honor system proxy, PAC, and WPAD settings when
respect_system_proxyis enabled - Remote HTTP(S) image inputs now return clear model-visible validation errors; inline data URLs and local images remain supported
- Added opt-in Windows system proxy support for authentication, including PAC, WPAD, static proxies, and bypass rules
/usagecan now show and redeem earned usage-limit reset credits, with confirmation, retry, and refreshed availability states/pluginsnow organizes remote plugins into OpenAI Curated, Workspace, and Shared with me sections, while eligible turns can recommend and install relevant plugins- Configurable rollout token budgets track usage across agent threads, provide remaining-budget reminders, and abort turns when exhausted
- App-server clients can configure multi-agent delegation as disabled, explicit-request-only, or proactive at the thread and turn level
- Added an indexed web-search mode that permits live searches while restricting direct page access to server-approved URLs
- Codex can now receive scheduled UTC time reminders and query the current time directly, including through client-provided app-server clocks
- Bug fixes: restored Linux TUI rendering after suspending with
Ctrl+Zand resuming withfg, exec-server processes and stdio MCP sessions now survive transient disconnects (including signed-URL refresh and retry-safe stdin writes), and parent agents now receive terminal subagent errors instead of seeing failed work as an empty successful completion
- Remote executors now use authenticated, end-to-end encrypted Noise relay channels, and cross-platform remote execution preserves executor-native working directories and shells (including filesystem permission paths) across the app-server and exec-server boundaries
- Selected executor plugins can activate their stdio MCP servers per thread; plugin discovery also adds a created-by-me marketplace and auth-specific curated catalogs
- App-server clients can list immediate child threads, correlate external-agent imports with detailed results, and read or redeem rate-limit reset credits
- Realtime clients can explicitly append speech, control how Codex responses enter conversations, and omit startup context
- TUI input prompts can auto-resolve after inactivity, with a countdown that pauses on interaction
- Bug fixes: hook-trust bypass now persists through
codex execthread start and resume while blockingPostToolUsehooks correctly reject code-mode tool calls, Windows sandbox execution repairs stale credentials automatically, bundled SQLite is pinned to a WAL-reset corruption fix, and TLS now supports P-521 certificate signatures used by enterprise proxies. The default MCP tool timeout increased to 300 seconds
- Added permanent session deletion via
codex delete <SESSION>,/delete, and app-serverthread/delete, with confirmation safeguards and subagent cleanup; use--forceto skip the prompt (UUID required) - Added
/usageviews for daily, weekly, and cumulative account token activity - Added
/importto selectively pull setup, project configuration, and recent chats from Claude Code - Typing
@now opens the unified mentions menu for files, plugins, and skills by default; added managed Amazon Bedrock API-key authentication and encrypted local storage for CLI and MCP OAuth credentials - Bug fixes: corrupted SQLite state databases are backed up and rebuilt automatically from rollout data,
/reviewno longer crashes on Esc with queued guidance, and non-TTY background commands can be interrupted with Ctrl-C. Removed the experimental/realtimevoice controls from the TUI
codex sandboxgained-P, --permission-profile <name>to apply a named permissions profile defined in the configuration stack when running a command- Code mode can now call standalone web search directly, including from nested JavaScript tool calls, and receive plaintext search results
- Tool and connector input schemas preserve
oneOfandallOf, and large schemas keep more shallow structure when compacted, improving compatibility with richer MCP tools codex doctorincludes editor and pager environment details in the local report while redacting raw values in JSON output, and plugin lists return from the cached remote catalog before refreshing in the background- Bug fixes:
codex resume --last "..."andcodex fork --last "..."treat the trailing argument as the initial prompt instead of a session ID, subagent MCP startup warnings stay in their owning thread, image edits use the exact referenced file paths, and/new,/clear, and/forkno longer drop cloud requirements or feature flags
- The
/appcommand can hand off the current CLI thread to Codex Desktop on macOS and native Windows, and Windows workspace launches open directly into Desktop instead of stopping at a manual prompt - Local image attachments and standalone image generations now expose their saved file paths to the model, making follow-up edits and file references more reliable
- Plugin automation gained richer structured output:
codex plugin add/remove/marketplacecommands support--json, plugin list JSON includes the marketplace source, and plugin detail exposes default prompts, remote MCP servers, and unavailable app templates - Reasoning effort selection is more flexible, with TUI fallback shortcuts for terminals missing
Altbindings and model-defined effort levels flowing through in the order the model advertises - App-server integrations can read account token usage, and Codex auth supports v2 personal access tokens across CLI and app-server flows
- Bug fixes: multiline paste in
/goal editno longer submits early, idle auto-turns stay out of Plan mode, forked threads keep user-renamed titles, the TUI avoids extra blank space while streaming, and AGENTS.md loading is accurate for remote and symlinked workspaces
- TUI keymaps now support F13-F24 function keys, allow pasting inside searchable selection menus, and add a compact reasoning-only status item
- Plugin workflows gained machine-readable
codex plugin list --jsonoutput and cached remote catalog suggestions - Remote-control clients can start pairing and list or revoke controller grants through app-server v2 RPCs
- Hosted web and image tools are available in more code-mode flows, with standalone web searches able to run in parallel
- Enterprise/admin flows now show monthly credit limits and can apply cloud-managed config bundles, including EDU workspaces
- Bug fixes: cancelling a prompt before visible output restores the draft, attachments, and collaboration mode; slash-command filtering and footer shortcut hints reset to the current UI state; macOS app launch and Windows SQLite startup reliability improved; duplicate local/remote plugin installs are deduplicated
- Added session archiving: archive and restore sessions from the TUI with
/archiveor from the CLI withcodex archive/codex unarchive; archived sessions are protected from resume/fork until restored - TUI markdown now keeps web links clickable with OSC 8 metadata, and cramped tables switch to readable key/value records without losing link targets
- App-server integrations can launch stdio mode with
codex app-server --stdio, resume a thread with its initial turns page, and see richer MCP server status - Remote execution setup now supports
CODEX_API_KEYregistration, while remote-control websockets use short-lived server tokens instead of ChatGPT access tokens - Windows admins get an alpha
codex sandbox setup --elevatedprovisioning path - Bug fixes: ChatGPT auth refreshes tokens before the five-minute expiry window,
/diffno longer runs repository-provided Git helpers/hooks, resumed TUI sessions seed prompt history from the transcript, and Vim normal-mode editing behaves correctly
- Richer
codex doctordiagnostics: reports environment, Git, terminal, app-server, and thread inventory details for support cases /permissionsnow understands named permission profiles and displays configured custom profiles- Vim mode gained text-object editing, improved word/line-end behavior, and a configurable interrupt-turn binding
/statusshows remote connection details and server version when connected over a remote transportinstall.sh/install.ps1support a non-interactive installation mode whenCODEX_NON_INTERACTIVE=1is set- Bug fixes: more readable markdown tables and multiline lists in the TUI, stable output on macOS and Zellij, slash-command completion preserves draft text, and older tmux/iTerm sessions keep normal
Ctrl-Chandling
- Made
--profilethe primary profile selector across CLI, TUI, and sandbox flows; the legacy--profile-v2flag was removed and legacy profile configs are rejected with migration guidance - Added thread search across local conversation history, with case-insensitive content matching and result previews
- Improved MCP setup with per-server environment routing and OAuth options for streamable HTTP servers
- Let read-only MCP tools that advertise
readOnlyHintrun in parallel - Preserved local
$ref/$defsstructures in connector tool schemas, and compacted oversized schemas before exposing them - Richer extension and hook context: conversation history available to extension tools, and subagent identity passed to hook inputs
- Bug fixes: reconnect stale exec-server websocket clients with fresh sessions, retry remote control immediately after auth recovery, retry remote compaction v2 streams, fix Windows TUI rendering corruption, and surface workspace-specific usage-limit messages
- Goals are now enabled by default, backed by dedicated storage and tracking progress across active turns
codex remote-controlUX overhaul: now runs like a foreground command, waits for readiness, reports machine status, and keeps explicitstart/stopdaemon subcommands- Stronger permission profiles: list APIs, inheritance, managed
requirements.tomlsupport, runtime refresh behavior, and tighter Windows sandbox integration - Easier plugin discovery: marketplace-aware list output, installed versions, visible marketplace roots, and remote collection support
- Extensions can observe more lifecycle events (subagent start/stop, tool execution, turn metadata, async approval/turn processing)
- Bug fixes: TUI startup no longer picks the wrong working directory when reusing a local app-server socket, plan-mode Shift+Enter no longer submits, more reliable AGENTS instruction loading, app-server startup/shutdown races and plugin upgrade failures resolved
codex exec resumenow accepts--output-schema, so resumed automations keep session context while enforcing structured JSON output- The Python SDK gained first-class authentication: API key login, ChatGPT browser and device-code flows, account inspection, and logout APIs
- Python turn APIs accept a plain string as input and return a richer
TurnResultwith collected items, timing, and usage data - Faster TUI startup by batching terminal capability probes instead of running them serially
- Remote executor registration can now use standard Codex auth instead of a separate registry credential flow
- App-server turns preserve requested image fidelity, including original-resolution local images
- Bug fixes: goal continuations stop at usage limits and repeated blockers to avoid burning tokens, session picker paste/rename hints, remote websocket keepalive, Windows
codex doctornpm detection, and MSVC static-CRT linking
- New subcommand
codex doctorfor support-ready diagnostics across runtime, auth, terminal, network, config, and local state (--summary/--json/--all) - New option
--strict-config: error out when config.toml contains unrecognized fields to catch config mistakes early - New option
--profile-v2: layer$CODEX_HOME/<name>.config.tomlon top of the base user config - New option
--dangerously-bypass-hook-trust: run hooks without requiring persisted trust (for vetted automation only) - Richer TUI session controls and display: service-tier commands, blended token usage, permissions/approval mode, effective workspace roots, and responsive Markdown tables
@mentions now search files, directories, plugins, and skills in a single picker- Plugin workflows gained marketplace CLI commands, version-aware sharing, share checkout, and default-enabled plugin hooks
- Remote workflows now support daemon-managed
codex remote-control, runtime enable/disable APIs, status reads, and registry-backed/configured remote environments - The Python SDK moved to
openai-codex/openai_codex, with pinned runtime-generated types, concurrent turn routing, and approval modes
- New
codex remote-controlsubcommand launches a headless, remotely controllable app-server with a simpler entry point thancodex app-server - Plugin details now show bundled hooks; plugin sharing exposes link metadata and discoverability controls
- Bedrock auth can use AWS console-login credentials from
aws loginprofiles - App-server clients can page large threads with
unloaded,summary, orfullturn-item views view_imagecan resolve files through the selected environment in multi-environment sessions- Live app-server threads now pick up the latest config snapshot without a restart
- Turn diffs stay accurate across apply-patch operations, including partial failures that mutated files
- Remote compaction emits
response.processedfor v2 streams and avoids sendingservice_tieron API-key compact requests - Windows sandbox setup grants sandbox users access to the desktop runtime binary cache
- Removed stale "research preview" wording from the
codex execstartup banner
- TUI composer gains modal Vim editing:
/vim, default-mode config, and Vim-specific keymap contexts - Redesigned resume/fork picker with raw scrollback mode,
/idecontext injection, and workspace-aware/diff - Status line shows theme-aware colors plus optional PR and branch-change summaries;
/keymap debuginspects terminal key events - Plugin management adds workspace sharing, share access controls, source filtering, local share path tracking, marketplace removal/upgrades, remote bundle sync, and admin-disabled status handling
- Hooks browser via
/hooks, before/after compaction hooks, andPreToolUsecontext for richer lifecycle integration - Experimental
/goals are now discoverable, stay paused across resume unless the user opts back in, and show clearer validation and multi-day duration output - macOS
/copyworks better in tmux; Alt+Enter and modified Delete/Backspace behave correctly; Windows typing/paste latency was reduced - Linux sandbox startup is more reliable across older
bwrap, slow mount probes, symlink-protected paths, and shared/tmpsetups; standalonebwrapfallback now built and verified for Linux releases - Windows sandbox and exec policy fixes for named pipes, ConPTY teardown, PowerShell-wrapped allow rules, worktree
safe.directory, and unsafe Git options - Fixes for custom CA login behind TLS-inspecting proxies, Bedrock runtime endpoint reporting, dangerous project config keys, heredoc redirect approval matching, and unbounded MCP/hook output growth
- New
codex updatesubcommand upgrades the CLI to the latest release in one step (no manual reinstall required) --full-autois deprecated in favor of explicit permission profiles (combine--profilewith--sandboxor pick a built-in profile)- Persisted
/goalworkflows: app-server APIs, model tools, runtime continuation, and TUI controls for create, pause, resume, and clear - TUI improvements: configurable keymaps, plan-mode nudges from composer drafts, action-required terminal titles, and active-turn
/statuslineand/titleedits - Permission profiles add built-in defaults, sandbox CLI profile selection (
codex sandbox), cwd controls, and active-profile metadata for clients - Plugin workflows:
/pluginsmarketplace install flow, remote bundle caching, remote uninstall, plugin-bundled hooks, persisted hook enablement state, and external-agent config import - External agent session import, including background imports and imported-session title handling
- MultiAgentV2 configuration: thread caps, wait-time controls, root/subagent hints, and v2-specific depth handling
- Bug fixes: stale interrupt hangs, persisted provider restoration, large remote resume responses, TUI terminal-resize / markdown / shell-mode escape stability, Windows sandbox + PTY edge cases,
git -Cauto-approval handling, Bedrock GPT-5.4 reasoning levels
codex exec --jsonusage now includes reasoning tokens, enabling automated inference-cost accounting- Permission profiles persist across TUI sessions, user turns, MCP sandbox state, and shell escalation, keeping enforcement consistent across surfaces
- Model providers now own model discovery; AWS/Bedrock account state is exposed to app clients
- Remote plugin install writes plus an app-server
marketplace upgradeRPC enable programmatic plugin marketplace management - Rollout tracing records tool, code-mode, session, and multi-agent boundaries; a debug command reduces traces for inspection
- App-server adds Unix socket transport, pagination-friendly resume/fork, sticky environments, and remote thread config/store plumbing
- Bug fixes:
/reviewinterrupt and TUI exit no longer wedge, exec-server retains buffered output, WebSocket bursts no longer drop clients, Windows sandbox startup stabilized
- TUI reasoning controls:
Alt+,lowers reasoning,Alt+.raises it; accepted model upgrades reset reasoning to the new model's default - Hooks promoted to stable: configurable inline in
config.tomland managedrequirements.toml; can observe MCP tools,apply_patch, and long-running Bash sessions - First-class Amazon Bedrock support for OpenAI-compatible providers, including AWS SigV4 signing and AWS credential-based auth
- App-server sessions now manage multiple environments and choose an environment + working directory per turn (multi-workspace and remote setups)
- Remote plugin marketplaces can be listed and read directly with more reliable detail lookups and larger result pages
- Eligible ChatGPT plans default to the Fast service tier unless explicitly opted out
- Cloudflare cookies preserved across approved ChatGPT hosts, reducing auth breakage in HTTP-backed ChatGPT flows
- Built-in
amazon-bedrockmodel provider with configurable AWS profile support - Added
/mcp verbosefor full MCP server diagnostics, resources, and resource templates while keeping plain/mcpfast - Plugin MCP loading accepts both
mcpServersand top-level server maps in.mcp.json - Improved realtime handoffs: background agents receive transcript deltas and can explicitly stay silent when appropriate
- Host-specific
remote_sandbox_configrequirements supported for remote environments codex execinherits root-level shared flags such as sandbox and model options- Fixed
/copyafter rollback so it copies the latest visible assistant response, not a pre-rollback response
- Added
codex pluginumbrella subcommand for managing Codex plugins - Moved marketplace management to
codex plugin marketplace(add/upgrade/remove); the top-levelcodex marketplacecommand was removed codex exec --ignore-user-configskips$CODEX_HOME/config.tomlwhile preserving auth viaCODEX_HOMEcodex exec --ignore-rulesignores user and project execpolicy.rulesfiles for isolated automated runs- Combine
--ignore-user-configwith--ignore-rulesfor deterministic, profile-free CI execution
- Added
codex marketplace addto install plugin marketplaces fromowner/repo[@ref], HTTP(S)/SSH Git URLs, or local directories — with--refand--sparsefor precise checkout - TUI composer gains
Ctrl+Rreverse history search plus local recall for accepted slash commands - TUI and app-server add memory-mode controls, memory reset/deletion, and memory-extension cleanup
- MCP gains namespaced tool registration, parallel-call opt-in, MCP Apps tool calls, and sandbox-state metadata delivered with each call
- Realtime streams output modality, transcript completion events, and raw turn-item injection; app-server surfaces symlink-aware filesystem metadata
- Secure devcontainer profile with bubblewrap support lands alongside macOS Unix-socket sandbox allowlists
- Removed the
danger-full-accessdenylist-only network mode and fixed macOS sandbox handling for private DNS - Fixed
resume --lastandthread/listwhen Windows paths use verbatim prefixes
- Realtime V2 streams background agent progress and queues follow-up responses so long-running work stays interactive
- TUI hook activity rendering improved: running hooks render in their own line and only useful output is retained after completion
- Code-mode tool declarations now include MCP
outputSchemadetails so structured results are typed accurately - Windows elevated sandbox supports split filesystem policies with read-only carveouts
- Fixed a panic when using
codex --remote wss://...by installing a Rustls crypto provider
- Realtime voice sessions default to the v2 WebRTC path with richer transport, voice selection, and TUI media support
- MCP apps and custom MCP servers support resource loading, tool-call metadata, and server-driven elicitation questions
- Added experimental
codex exec-serversubcommand: a standalone WebSocket endpoint for remote and app-server workflows /resumejumps directly to a session by ID or name without going through the picker- TUI notifications support Warp OSC 9 and add a focused-notification option
- Windows sandbox can enforce proxy-only networking with OS-level egress rules instead of relying on environment variables alone
codex execsupports prompt-plus-stdin workflow: pipe input and still pass a separate prompt on the command line- Custom model providers can dynamically fetch and refresh short-lived bearer tokens instead of static credentials
- App-server TUI fixes:
/copyand/resume <name>work again, hook notifications replay correctly, skills picker scrolls past first page - MCP server startup improved: longer startup window for local servers and failed handshakes surface warnings again
- Plugins integrated as a first-class workflow: sync, browse in
/plugins, install, and remove with clearer auth handling - Sub-agents now use readable path-based addresses like
/root/agent_awith structured inter-agent messaging /titlepicker works in both classic TUI and app-server TUI for easier parallel session identification- App-server clients can connect to remote WebSocket servers with bearer-token auth (
--remote-auth-token-env) - Image workflows improved:
view_imagereturns URLs in code mode, generated images are reopenable, and history survives resume
- App-server TUI now supports device-code ChatGPT sign-in during onboarding and can refresh existing ChatGPT tokens
- Codex can prompt to install missing plugins or connectors, respect a configured suggestion allowlist, and sync install or uninstall state remotely
- Added a
userpromptsubmithook to block or augment prompts before execution and before they enter history - Realtime sessions start with recent thread context and are less likely to self-interrupt during audio playback
- Fixed first-turn websocket prewarm stalls, restored remote resume or fork history, and improved Linux sandbox startup
view_imageandcodex.emitImage(..., detail: "original")now support full-resolution images- JS REPL now exposes
codex.cwdandcodex.homeDir, and keeps tool/image references across cells - app-server v2 gained filesystem RPCs for read/write, copy, directory operations, and path watching
- Review requests can be routed through the guardian subagent, with better sandbox/network inheritance for subagents
- Fixed resume-time
--profilepersistence, TUI exit stalls, and related stability issues
- Experimental code mode and hooks engine (SessionStart / Stop) are now available
- Permission/profile compatibility improved for legacy workspace-write + sandbox settings
- App-server health endpoints (/readyz, /healthz) and realtime handoff context were enhanced
- Session resume and Linux tmux stability issues were fixed
- Added request_permissions tool for in-turn permission escalation
- Plugin UX expanded with list/uninstall support and improved mentions
- app-server exec gained stdin/stdout/stderr streaming with TTY/PTY support
- Cloud and session tooling received reliability and UX improvements
@pluginmentions in chat auto-include plugin context (MCP/app/skill)- Latest model catalog now surfaced in the TUI model picker
- Skill permission profiles merged into sandbox policy for safer execution
- JS REPL bindings now persist after a failed cell for smoother iteration
emitImagerestricted todata:URLs only (security fix)
approval_policynow correctly takes precedence oversandbox_modecodex cloud applybetter supportsgit worktreeworkflows- Improved MCP server connection and authentication stability
- Cancelled approval requests can now be re-issued cleanly
- Added custom token reset to simplify auth recovery
- Reliability improvements for long-running sessions (watchdog and related fixes)
- Added
codex mcp listfor easier MCP inventory checks - Added
sandbox_workspace_write.network_accesssupport codex exec --last-message-filecan write final output to a chosen file
codex applynow leveragesgit apply --3waybehavior- Risk evaluation is more strict to reduce unnecessary approvals
- Improved Codex Cloud task integration stability
codex exec --include-plan-toolenables plan tool usage in exec mode- MCP auth failures now guide users toward
codex mcp login - OAuth flow keeps using existing clients for better connection stability
About This Tool
This free OpenAI Codex CLI commands list and cheat sheet consolidates all 65 commands, key options, keyboard shortcuts, slash commands, and workflow examples you need into one searchable reference page — from interactive sessions and one-shot codex exec tasks to MCP integration, sandbox configuration, guardian approval, and CI/CD automation. Filter by category, search by keyword, and copy any command in one click so you can move from lookup to execution without leaving your current context.
What You Can Check
- Complete Codex CLI commands list for interactive sessions, non-interactive exec, and resume workflows
- Key global options including profile, sandbox mode, approval policy, guardian approval, and web search
- Keyboard shortcuts and slash commands reference for fast in-session navigation
- Practical setup commands for login, MCP servers, shell completion, and config.toml overrides
- Workflow-ready examples you can copy and run immediately in a terminal or CI/CD pipeline
- Version update summaries showing what changed in each release
When It Helps
- Looking up the correct codex exec flags before adding an automated code-review step to a GitHub Actions or GitLab CI pipeline
- Comparing sandbox modes (read-only vs workspace-write) when deciding how much file-system access to grant Codex in a production codebase
- Onboarding a teammate to Codex CLI by sharing a cheat sheet of exec, mcp add, and profile commands without them needing to read the full docs
- Referencing the -a / --ask-for-approval options (untrusted, on-request, never) when configuring how Codex pauses for confirmation in an interactive or scripted workflow
- Checking the correct syntax for codex mcp add before wiring up a GitHub or Jira MCP server to a Codex workflow
FAQ
Where can I find a complete OpenAI Codex CLI commands list?
This page is the complete OpenAI Codex CLI commands list and cheat sheet reference. Every command — codex, codex exec, codex review, codex resume, codex mcp, codex login, codex cloud, and more — is grouped into Core Commands, Key Options, Setup, and Workflow Examples tabs. Use the search box to filter by command name, option, or example, and copy any entry with one click.
What keyboard shortcuts and slash commands are available in Codex CLI?
Inside an interactive codex session you can use slash commands like /resume, /title, /plugins, /copy, and /help for quick navigation and session control. TUI keyboard shortcuts include Ctrl+C to cancel the current turn, Ctrl+D to exit, Ctrl+R for reverse history search (0.121.0+), and Alt+, / Alt+. to lower or raise reasoning depth (0.124.0+). The cheat sheet above lists the commonly-used in-session commands and keyboard shortcuts so you can copy them directly.
What is OpenAI Codex CLI?
OpenAI Codex CLI is an open-source terminal agent that can read, write, and execute code in your local project. It is distinct from the older Codex API model — the CLI is an agentic tool that runs tasks autonomously in your shell, with optional MCP server integration, sandbox controls, and approval policies for safe automation.
What is the difference between codex and codex exec?
codex launches an interactive REPL where you converse with the agent. codex exec runs a single task non-interactively and exits, making it ideal for CI/CD pipelines, cron jobs, and scripted automation where you need one-shot execution.
How does codex resume work and how do I continue the last session?
codex resume reopens a previous interactive session by ID, name, or through an interactive picker, preserving the full conversation history. Recent releases also support /resume <name> inside a running session for direct jumps. To continue your most recent conversation, run codex resume --last, or run codex resume --help to see the flags supported by your installed version.
Which sandbox mode should I use?
Codex has three sandbox modes. Use read-only for analysis tasks (reviewing code, generating reports) where Codex shouldn't touch files, and workspace-write when you want it to create or edit files in the workspace. workspace-write blocks network access by default, so for tasks that call external APIs, either enable sandbox_workspace_write.network_access in config.toml or use danger-full-access, which removes all restrictions — reserve it for trusted operations.
How do I add a GitHub or Jira MCP server?
Run codex mcp add <name> <command> with the appropriate MCP server binary for your tool. Then use codex mcp list to confirm it's registered. MCP servers let Codex file GitHub issues, query Jira boards, or interact with databases without leaving the terminal.
How do I use Codex in a GitHub Actions workflow?
codex exec runs non-interactively, so it takes no approval flag. Set your OPENAI_API_KEY as a GitHub Actions secret and call codex exec --sandbox read-only "Review the diff and summarize risks" (use --sandbox workspace-write if it needs to edit files). Only on a fully isolated runner where you want to drop every restriction should you add --dangerously-bypass-approvals-and-sandbox.
What is Guardian approval in Codex CLI?
Guardian is a subagent that can route sensitive review requests for additional approval before actions are taken. When configured, the guardian inherits sandbox and network settings from its parent session. Combine it with the interactive -a / --ask-for-approval policy (untrusted, on-request, or never) to control how Codex escalates risky operations, keeping Guardian as an extra gate for high-impact edits.
Are these command examples safe to run directly?
Treat them as templates. Replace placeholder prompts with your actual task, and choose --sandbox and approval settings appropriate for your environment. In interactive runs, -a / --ask-for-approval controls when Codex pauses for confirmation; codex exec is non-interactive and never prompts, so in automated pipelines the --sandbox mode is your main safety control.
How up to date is this OpenAI Codex CLI cheat sheet?
This reference is refreshed alongside each new codex-cli release, tracking every release from codex-cli 0.107.0 through the latest version (0.147.0, August 2026). You can quickly scan which flags, subcommands, sandbox behaviors, slash commands, and keyboard shortcuts shipped in each version — making it a practical cheat sheet for everyday terminal work.