ChatGPT web has its own composer command menu. Type / to see the actions
available in the current conversation. It doesn’t expose the Codex app or CLI
command set; the Codex slash commands, CLI subcommands, and flags in this
reference don’t apply to ChatGPT web.
ChatGPT desktop app commands
The general Commands page covers app navigation, task shortcuts, keyboard customization, and deep links for tasks, settings, skills, scheduled tasks, plugins, and pets.
The Slash commands page covers the commands
available from the app composer, including /feedback, /goal, /init,
/mcp, /plan, /review, and /status.
How to read this reference
This page catalogs every documented Codex CLI command and flag. Use the interactive tables to search by key or description. Each section indicates whether the option is stable or experimental and calls out risky combinations.
The CLI inherits most defaults from ~/.codex/config.toml. Any
-c key=value overrides you pass at the command line take
precedence for that invocation. See Config
basics for more
information.
Global flags
| Key | Type / Values | Details |
|---|---|---|
--add-dir | path | Grant additional directories write access alongside the main workspace. Repeat for multiple paths. |
--ask-for-approval, -a | untrusted | on-request | never | Control when Codex pauses for human approval before running a command. |
--cd, -C | path | Set the working directory for the agent before it starts processing your request. |
--config, -c | key=value | Override configuration values. Values parse as TOML if possible; otherwise the literal string is used. |
--dangerously-bypass-approvals-and-sandbox, --yolo | boolean | Run every command without approvals or sandboxing. Only use inside an externally hardened environment. |
--dangerously-bypass-hook-trust | boolean | Run enabled hooks without requiring persisted hook trust for this invocation. Intended only for automation that already vets hook sources. |
--disable | feature | Force-disable a feature flag (translates to -c features.<name>=false). Repeatable. |
--enable | feature | Force-enable a feature flag (translates to -c features.<name>=true). Repeatable. |
--image, -i | path[,path...] | Attach one or more image files to the initial prompt. Separate multiple paths with commas or repeat the flag. |
--local-provider | lmstudio | ollama | Choose the local provider used with --oss, overriding oss_provider for this run. |
--model, -m | string | Override the model set in configuration (for example gpt-5.4). |
--no-alt-screen | boolean | Disable alternate screen mode for the TUI (overrides tui.alternate_screen for this run). |
--oss | boolean | Use a local open source model provider. Codex uses --local-provider, your configured oss_provider, or prompts you to choose between LM Studio and Ollama. |
--profile, -p | string | Layer $CODEX_HOME/profile-name.config.toml on top of the base user config. |
--remote | ws://host:port | wss://host:port | unix:// | unix://PATH | Connect to a remote app-server endpoint over WebSocket or a Unix socket. Supported for codex, codex resume, codex fork, codex archive, codex delete, and codex unarchive; other subcommands reject remote mode. |
--remote-auth-token-env | ENV_VAR | Read a bearer token from this environment variable and send it when connecting with --remote. Requires --remote; tokens are only sent over wss:// URLs or local-only ws:// URLs. |
--sandbox, -s | read-only | workspace-write | danger-full-access | Select the sandbox policy for model-generated shell commands. |
--search | boolean | Enable live web search (sets web_search = "live" instead of the default "cached"). |
--strict-config | boolean | Error when config.toml contains fields this Codex version does not recognize. Supported by runtime commands such as codex, exec, review, resume, fork, app-server, mcp-server, and exec-server. |
PROMPT | string | Optional text instruction to start the session. Omit to launch the TUI without a pre-filled message. |
--add-dirpath--ask-for-approval, -auntrusted | on-request | never--cd, -Cpath--config, -ckey=value--dangerously-bypass-approvals-and-sandbox, --yoloboolean--dangerously-bypass-hook-trustboolean--disablefeature-c features.<name>=false). Repeatable.--enablefeature-c features.<name>=true). Repeatable.--image, -ipath[,path...]--local-providerlmstudio | ollama--oss, overriding oss_provider for this run.--model, -mstringgpt-5.4).--no-alt-screenbooleantui.alternate_screen for this run).--ossboolean--local-provider, your configured oss_provider, or prompts you to choose between LM Studio and Ollama.--profile, -pstring$CODEX_HOME/profile-name.config.toml on top of the base user config.--remotews://host:port | wss://host:port | unix:// | unix://PATHcodex, codex resume, codex fork, codex archive, codex delete, and codex unarchive; other subcommands reject remote mode.--remote-auth-token-envENV_VAR--remote. Requires --remote; tokens are only sent over wss:// URLs or local-only ws:// URLs.--sandbox, -sread-only | workspace-write | danger-full-access--searchbooleanweb_search = "live" instead of the default "cached").--strict-configbooleanconfig.toml contains fields this Codex version does not recognize. Supported by runtime commands such as codex, exec, review, resume, fork, app-server, mcp-server, and exec-server.PROMPTstringThese options apply to the base codex command. Most propagate to commands;
see the notes above or the relevant command help for exceptions. For propagated
flags, follow the relevant command help. For example, codex exec --oss ...
applies --oss to exec.
Command overview
The Maturity column uses feature maturity labels such as Experimental, Beta, and Stable. See Feature Maturity for how to interpret these labels.
| Key | Maturity | Details |
|---|---|---|
codex | Stable | Launch the terminal UI. Accepts the global flags above plus an optional prompt or image attachments. |
codex app | Stable | Launch the ChatGPT desktop app on macOS or Windows. On macOS, Codex can open a workspace path; on Windows, Codex prints the path to open. |
codex app-server | Experimental | Launch the Codex app server for local development or debugging over stdio, WebSocket, or a Unix socket. |
codex apply | Stable | Apply the latest diff generated by a Codex cloud task to your local working tree. Alias: codex a. |
codex archive | Stable | Archive a saved interactive session by session ID or session name. |
codex cloud | Experimental | Browse or execute Codex cloud tasks from the terminal without opening the TUI. Alias: codex cloud-tasks. |
codex completion | Stable | Generate shell completion scripts for Bash, Zsh, Fish, or PowerShell. |
codex debug app-server send-message-v2 | Experimental | Debug app-server by sending a single V2 message through the built-in test client. |
codex debug models | Experimental | Print the raw model catalog Codex sees, including an option to inspect only the bundled catalog. |
codex debug prompt-input | Experimental | Render the model-visible prompt input list as JSON, optionally with a prompt and images. |
codex delete | Stable | Permanently delete a saved interactive session by session ID or session name. |
codex doctor | Stable | Generate a diagnostic report for local installation, config, auth, runtime, Git, terminal, app-server, and thread inventory issues. |
codex exec | Stable | Run Codex non-interactively. Alias: codex e. Stream results to stdout or JSONL and optionally resume previous sessions. |
codex execpolicy | Experimental | Evaluate execpolicy rule files and see whether a command would be allowed, prompted, or blocked. |
codex features | Stable | List feature flags and persistently enable or disable them in config.toml. |
codex fork | Stable | Fork a previous interactive session into a new task, preserving the original transcript. |
codex login | Stable | Authenticate Codex using ChatGPT OAuth, device auth, an API key, or an access token piped over stdin. |
codex logout | Stable | Remove stored authentication credentials. |
codex mcp | Stable | Manage Model Context Protocol servers (list, add, remove, authenticate). |
codex mcp-server | Stable | Run Codex itself as an MCP server over stdio. Useful when another agent consumes Codex. |
codex plugin | Stable | Install, list, and remove plugins from configured marketplace sources. |
codex plugin marketplace | Stable | Add, list, upgrade, or remove plugin marketplaces from Git or local sources. |
codex remote-control | Experimental | Run or manage remote control for the local app-server, or create a short-lived pairing code. |
codex resume | Stable | Continue a previous interactive session by ID or resume the most recent conversation. |
codex review | Stable | Run a non-interactive review of uncommitted changes, a base branch diff, a commit, or custom review instructions. |
codex sandbox | Stable | Run arbitrary commands inside Codex-provided macOS, Linux, or Windows sandboxes. |
codex unarchive | Stable | Restore an archived interactive session by session ID or session name. |
codex update | Stable | Check for and apply a Codex CLI update when the installed release supports self-update. |
codexcodex appcodex applycodex a.codex cloudcodex cloud-tasks.codex deletecodex doctorcodex execcodex e. Stream results to stdout or JSONL and optionally resume previous sessions.config.toml.codex forkcodex logincodex mcpcodex plugincodex resumecodex reviewcodex updateCommand details
codex (interactive)
Running codex with no subcommand launches the interactive terminal UI (TUI). The agent accepts the global flags above plus image attachments. Web search defaults to cached mode; use --search to switch to live browsing. For low-friction local work, use --sandbox workspace-write --ask-for-approval on-request.
Use --remote ws://host:port or --remote wss://host:port to connect the TUI to an app server started with codex app-server --listen ws://IP:PORT. For a local Unix socket, use --remote unix:// for the default socket or --remote unix://PATH for an explicit path. Add --remote-auth-token-env <ENV_VAR> when the server requires a bearer token for WebSocket authentication.
codex app-server
Launch the Codex app server locally. This is primarily for development and debugging and may change without notice.
| Key | Type / Values | Details |
|---|---|---|
--analytics-default-enabled | boolean | Defaults analytics to enabled for first-party app-server clients unless the user opts out in config. |
--listen | stdio:// | ws://IP:PORT | unix:// | unix://PATH | off | Transport listener URL. Use stdio:// for JSONL, ws://IP:PORT for a TCP WebSocket endpoint, unix:// for the default Unix socket, unix://PATH for a custom Unix socket, or off to disable the local transport. |
--stdio | boolean | Use stdio transport. Equivalent to --listen stdio:// and mutually exclusive with --listen. |
--ws-audience | string | Expected aud claim for signed bearer tokens. Requires --ws-auth signed-bearer-token. |
--ws-auth | capability-token | signed-bearer-token | Authentication mode for app-server WebSocket clients. If omitted, WebSocket auth is disabled; non-local listeners warn during startup. |
--ws-issuer | string | Expected iss claim for signed bearer tokens. Requires --ws-auth signed-bearer-token. |
--ws-max-clock-skew-seconds | number | Clock skew allowance when validating signed bearer token exp and nbf claims. Requires --ws-auth signed-bearer-token. |
--ws-shared-secret-file | absolute path | File containing the HMAC shared secret used to validate signed JWT bearer tokens. Required with --ws-auth signed-bearer-token. |
--ws-token-file | absolute path | File containing the shared capability token. Use with --ws-auth capability-token unless you provide --ws-token-sha256 instead. |
--ws-token-sha256 | hexadecimal SHA-256 digest | Expected SHA-256 digest for capability-token authentication. Use instead of --ws-token-file when the client token comes from another source. |
--analytics-default-enabledboolean--listenstdio:// | ws://IP:PORT | unix:// | unix://PATH | offstdio:// for JSONL, ws://IP:PORT for a TCP WebSocket endpoint, unix:// for the default Unix socket, unix://PATH for a custom Unix socket, or off to disable the local transport.--stdioboolean--listen stdio:// and mutually exclusive with --listen.--ws-audiencestringaud claim for signed bearer tokens. Requires --ws-auth signed-bearer-token.--ws-authcapability-token | signed-bearer-token--ws-issuerstringiss claim for signed bearer tokens. Requires --ws-auth signed-bearer-token.--ws-max-clock-skew-secondsnumberexp and nbf claims. Requires --ws-auth signed-bearer-token.--ws-shared-secret-fileabsolute path--ws-auth signed-bearer-token.--ws-token-fileabsolute path--ws-auth capability-token unless you provide --ws-token-sha256 instead.--ws-token-sha256hexadecimal SHA-256 digest--ws-token-file when the client token comes from another source.codex app-server --listen stdio:// keeps the default JSONL-over-stdio behavior, and codex app-server --stdio is an alias for that transport. --listen ws://IP:PORT enables WebSocket transport for app-server clients. The server accepts ws:// listen URLs; use TLS termination or a secure proxy when clients connect with wss://. Use --listen unix:// to accept WebSocket handshakes on Codex’s default Unix socket, or --listen unix:///absolute/path.sock to choose a socket path. If you generate schemas for client bindings, add --experimental to include gated fields and methods.
codex remote-control
Run codex remote-control to start remote control in the foreground. Use
codex remote-control start to start the local app-server daemon with remote
control enabled, and codex remote-control stop to stop it. Managed
remote-control clients and SSH remote workflows use these commands; they aren’t
a replacement for codex app-server --listen when you’re building a local
protocol client.
After the daemon is running, use codex remote-control pair to create and
print a short-lived manual pairing code. Add --json to any remote-control
command for machine-readable output. For pair, the JSON response includes
pairingCode, manualPairingCode, environmentId, and expiresAt.
codex app
Launch the ChatGPT desktop app from the terminal on macOS or Windows. On macOS, Codex can open a specific workspace path; on Windows, Codex prints the path to open.
| Key | Type / Values | Details |
|---|---|---|
--download-url | url | Advanced override for the ChatGPT desktop app installer URL used during install. |
PATH | path | Workspace path for the ChatGPT desktop app. On macOS, Codex opens this path; on Windows, Codex prints the path. |
--download-urlurlPATHpathcodex app opens an installed ChatGPT desktop app, or starts the installer when
the app is missing. On macOS, Codex opens the provided workspace path; on
Windows, it prints the path to open after installation.
codex debug app-server send-message-v2
Send one message through app-server’s V2 thread/turn flow using the built-in app-server test client.
| Key | Type / Values | Details |
|---|---|---|
USER_MESSAGE | string | Message text sent to app-server through the built-in V2 test-client flow. |
USER_MESSAGEstringThis debug flow initializes with experimentalApi: true, starts a thread, sends a turn, and streams server notifications. Use it to reproduce and inspect app-server protocol behavior locally.
codex debug models
Print the raw model catalog Codex sees as JSON.
| Key | Type / Values | Details |
|---|---|---|
--bundled | boolean | Skip refresh and print only the model catalog bundled with the current Codex binary. |
--bundledbooleanUse --bundled when you want to inspect only the catalog bundled with the current binary, without refreshing from the remote models endpoint.
codex debug prompt-input
Render the exact model-visible prompt input list as JSON. Use this when debugging instruction discovery, session context, or prompt construction.
| Key | Type / Values | Details |
|---|---|---|
--image, -i | path[,path...] | Attach one or more images to the user prompt. Separate multiple paths with commas or repeat the flag. |
PROMPT | string | Optional user prompt appended after the session context. |
--image, -ipath[,path...]PROMPTstringcodex apply
Apply the most recent diff from a Codex cloud task to your local repository. You must authenticate and have access to the task.
| Key | Type / Values | Details |
|---|---|---|
TASK_ID | string | Identifier of the Codex cloud task whose diff should be applied. |
TASK_IDstringCodex prints the patched files and exits non-zero if git apply fails (for example, due to conflicts).
codex review
Run a code review non-interactively. Choose exactly one review target, or pass custom review instructions as a prompt.
| Key | Type / Values | Details |
|---|---|---|
--base | branch | Review changes against the specified base branch. |
--commit | SHA | Review the changes introduced by the specified commit. |
--strict-config | boolean | Error when config.toml contains fields this Codex version does not recognize. |
--title | string | Set the commit title shown in the review summary. Requires --commit. |
--uncommitted | boolean | Review staged, unstaged, and untracked changes. |
PROMPT | string | - (read stdin) | Custom review instructions. Use - to read the instructions from stdin. |
--basebranch--commitSHA--strict-configbooleanconfig.toml contains fields this Codex version does not recognize.--titlestring--commit.--uncommittedbooleanPROMPTstring | - (read stdin)- to read the instructions from stdin.--uncommitted, --base, --commit, and a custom PROMPT conflict with one
another. Use --title only with --commit.
codex archive and codex unarchive
Archive or restore a saved interactive session by session ID or session name. Use these commands when you want to clean up the session picker without deleting the transcript. Session IDs take precedence over session names.
codex archive <SESSION>
codex unarchive <SESSION>| Key | Type / Values | Details |
|---|---|---|
--remote | ws://host:port | wss://host:port | unix:// | unix://PATH | Connect to a remote app-server endpoint before changing archive state. |
--remote-auth-token-env | ENV_VAR | Read a bearer token from this environment variable when --remote requires authentication. |
SESSION | session ID | session name | Saved session to archive or restore. Session IDs take precedence over session names. |
--remotews://host:port | wss://host:port | unix:// | unix://PATH--remote-auth-token-envENV_VAR--remote requires authentication.SESSIONsession ID | session namecodex delete
Permanently delete a saved interactive session by session ID or session name. Use this only when you want to remove the transcript instead of hiding it from active session lists.
codex delete <SESSION>
codex delete <SESSION_UUID> --force| Key | Type / Values | Details |
|---|---|---|
--force | boolean | Delete without prompting. The session argument must be a UUID; names still require interactive confirmation. |
--remote | ws://host:port | wss://host:port | unix:// | unix://PATH | Connect to a remote app-server endpoint before deleting the session. |
--remote-auth-token-env | ENV_VAR | Read a bearer token from this environment variable when --remote requires authentication. |
SESSION | session ID | session name | Saved session to delete. Session IDs take precedence over session names. |
--forceboolean--remotews://host:port | wss://host:port | unix:// | unix://PATH--remote-auth-token-envENV_VAR--remote requires authentication.SESSIONsession ID | session nameUse --force only with a session UUID. Named sessions still require
confirmation so Codex doesn’t delete a repeated or ambiguous name without a prompt.
codex cloud
Interact with Codex cloud tasks from the terminal. The default command opens an interactive picker; codex cloud exec submits a task directly, and codex cloud list returns recent tasks for scripting or quick inspection.
| Key | Type / Values | Details |
|---|---|---|
--attempts | 1-4 | Number of assistant attempts (best-of-N) Codex cloud should run. |
--env | ENV_ID | Target Codex cloud environment identifier (required). Use codex cloud to list options. |
QUERY | string | Task prompt. If omitted, Codex prompts interactively for details. |
--attempts1-4--envENV_IDcodex cloud to list options.QUERYstringAuthentication follows the same credentials as the main CLI. Codex exits non-zero if the task submission fails.
codex cloud list
List recent cloud tasks with optional filtering and pagination.
| Key | Type / Values | Details |
|---|---|---|
--cursor | string | Pagination cursor returned by a previous request. |
--env | ENV_ID | Filter tasks by environment identifier. |
--json | boolean | Emit machine-readable JSON instead of plain text. |
--limit | 1-20 | Maximum number of tasks to return. |
--cursorstring--envENV_ID--jsonboolean--limit1-20Plain-text output prints a task URL followed by status details. Use --json for automation. The JSON payload contains a tasks array plus an optional cursor value. Each task includes id, url, title, status, updated_at, environment_id, environment_label, summary, is_review, and attempt_total.
codex completion
Generate shell completion scripts and redirect the output to the appropriate location, for example codex completion zsh > "${fpath[1]}/_codex".
| Key | Type / Values | Details |
|---|---|---|
SHELL | bash | zsh | fish | power-shell | elvish | Shell to generate completions for. Output prints to stdout. |
SHELLbash | zsh | fish | power-shell | elvishcodex doctor
Generate a local diagnostic report before filing a support issue or while investigating a broken Codex installation. The report checks installation, configuration, authentication, runtime, Git, terminal, app-server, and thread inventory health.
| Key | Type / Values | Details |
|---|---|---|
--all | boolean | Expand long lists in the detailed human-readable report. |
--ascii | boolean | Use ASCII status labels and separators in human-readable output. |
--json | boolean | Emit a redacted machine-readable support report. |
--no-color | boolean | Disable ANSI color in human-readable output. |
--summary | boolean | Show grouped check rows and the final count summary only. |
--allboolean--asciiboolean--jsonboolean--no-colorboolean--summarybooleancodex features
Manage feature flags stored in $CODEX_HOME/config.toml. The enable and
disable commands persist changes so they apply to future sessions. The
features subcommand doesn’t accept --profile.
| Key | Type / Values | Details |
|---|---|---|
Disable subcommand | codex features disable <feature> | Persistently disable a feature flag in $CODEX_HOME/config.toml. |
Enable subcommand | codex features enable <feature> | Persistently enable a feature flag in $CODEX_HOME/config.toml. |
List subcommand | codex features list | Show known feature flags, their maturity stage, and their effective state. |
Disable subcommandcodex features disable <feature>$CODEX_HOME/config.toml.Enable subcommandcodex features enable <feature>$CODEX_HOME/config.toml.List subcommandcodex features listcodex exec
Use codex exec (or the short form codex e) for scripted or CI-style runs that should finish without human interaction.
| Key | Type / Values | Details |
|---|---|---|
--cd, -C | path | Set the workspace root before executing the task. |
--color | always | never | auto | Control ANSI color in stdout. |
--dangerously-bypass-approvals-and-sandbox, --yolo | boolean | Bypass approval prompts and sandboxing. Dangerous—only use inside an isolated runner. |
--dangerously-bypass-hook-trust | boolean | Run enabled hooks without requiring persisted hook trust for this invocation. Intended only for automation that already vets hook sources. |
--ephemeral | boolean | Run without persisting session rollout files to disk. |
--full-auto | boolean | Deprecated compatibility flag. Prefer --sandbox workspace-write; Codex prints a warning when this flag is used. |
--ignore-rules | boolean | Do not load user or project execpolicy .rules files for this run. |
--ignore-user-config | boolean | Do not load $CODEX_HOME/config.toml. Authentication still uses CODEX_HOME. |
--image, -i | path[,path...] | Attach images to the first message. Repeatable; supports comma-separated lists. |
--json, --experimental-json | boolean | Print newline-delimited JSON events instead of formatted text. |
--local-provider | lmstudio | ollama | Choose the local provider used with --oss, overriding oss_provider for this run. |
--model, -m | string | Override the configured model for this run. |
--oss | boolean | Use a local open source provider. Codex uses --local-provider or your configured oss_provider, and exits with an error if neither is set. |
--output-last-message, -o | path | Write the assistant’s final message to a file. Useful for downstream scripting. |
--output-schema | path | JSON Schema file describing the expected final response shape. Codex validates tool output against it. |
--profile, -p | string | Layer $CODEX_HOME/profile-name.config.toml on top of the base user config. |
--sandbox, -s | read-only | workspace-write | danger-full-access | Sandbox policy for model-generated commands. Defaults to configuration. |
--skip-git-repo-check | boolean | Allow running outside a Git repository (useful for one-off directories). |
-c, --config | key=value | Inline configuration override for the non-interactive run (repeatable). |
PROMPT | string | - (read stdin) | Initial instruction for the task. Use - to pipe the prompt from stdin. |
Resume subcommand | codex exec resume [SESSION_ID] | Resume an exec session by ID or add --last to continue the most recent session from the current working directory. Add --all to consider sessions from any directory. Accepts an optional follow-up prompt. |
--cd, -Cpath--coloralways | never | auto--dangerously-bypass-approvals-and-sandbox, --yoloboolean--dangerously-bypass-hook-trustboolean--ephemeralboolean--full-autoboolean--sandbox workspace-write; Codex prints a warning when this flag is used.--ignore-rulesboolean.rules files for this run.--ignore-user-configboolean$CODEX_HOME/config.toml. Authentication still uses CODEX_HOME.--image, -ipath[,path...]--json, --experimental-jsonboolean--local-providerlmstudio | ollama--oss, overriding oss_provider for this run.--model, -mstring--ossboolean--local-provider or your configured oss_provider, and exits with an error if neither is set.--output-last-message, -opath--output-schemapath--profile, -pstring$CODEX_HOME/profile-name.config.toml on top of the base user config.--sandbox, -sread-only | workspace-write | danger-full-access--skip-git-repo-checkboolean-c, --configkey=valuePROMPTstring | - (read stdin)- to pipe the prompt from stdin.Resume subcommandcodex exec resume [SESSION_ID]--last to continue the most recent session from the current working directory. Add --all to consider sessions from any directory. Accepts an optional follow-up prompt.Codex writes formatted output by default. Add --json to receive newline-delimited JSON events (one per state change). The optional resume subcommand lets you continue non-interactive tasks. Use --last to pick the most recent session from the current working directory, or add --all to search across all sessions:
| Key | Type / Values | Details |
|---|---|---|
--all | boolean | Include sessions outside the current working directory when selecting the most recent session. |
--image, -i | path[,path...] | Attach one or more images to the follow-up prompt. Separate multiple paths with commas or repeat the flag. |
--last | boolean | Resume the most recent conversation from the current working directory. |
PROMPT | string | - (read stdin) | Optional follow-up instruction sent immediately after resuming. |
SESSION_ID | uuid | session name | Resume the specified session. Omit and use --last to continue the most recent session. |
--allboolean--image, -ipath[,path...]--lastbooleanPROMPTstring | - (read stdin)SESSION_IDuuid | session name--last to continue the most recent session.codex execpolicy
Check execpolicy rule files before you save them. codex execpolicy check accepts one or more --rules flags (for example, files under ~/.codex/rules) and emits JSON showing the strictest decision and any matching rules. Add --pretty to format the output. The execpolicy command is currently in preview.
| Key | Type / Values | Details |
|---|---|---|
--pretty | boolean | Pretty-print the JSON result. |
--rules, -r | path (repeatable) | Path to an execpolicy rule file to evaluate. Provide multiple flags to combine rules across files. |
COMMAND... | var-args | Command to be checked against the specified policies. |
--prettyboolean--rules, -rpath (repeatable)COMMAND...var-argscodex login
Authenticate the CLI with a ChatGPT account, API key, or access token. With no flags, Codex opens a browser for the ChatGPT OAuth flow.
| Key | Type / Values | Details |
|---|---|---|
--device-auth | boolean | Use OAuth device code flow instead of launching a browser window. |
--with-access-token | boolean | Read an access token from stdin (for example printenv CODEX_ACCESS_TOKEN | codex login --with-access-token). |
--with-api-key | boolean | Read an API key from stdin (for example printenv OPENAI_API_KEY | codex login --with-api-key). |
status subcommand | codex login status | Print the active authentication mode and exit with 0 when logged in. |
--device-authboolean--with-access-tokenbooleanprintenv CODEX_ACCESS_TOKEN | codex login --with-access-token).--with-api-keybooleanprintenv OPENAI_API_KEY | codex login --with-api-key).status subcommandcodex login statuscodex login status exits with 0 when credentials are present, which is helpful in automation scripts.
codex logout
Remove saved credentials for both API key and ChatGPT authentication. This command has no flags.
codex mcp
Manage Model Context Protocol server entries stored in ~/.codex/config.toml.
| Key | Type / Values | Details |
|---|---|---|
add <name> | -- <command...> | --url <value> | Register a server using a stdio launcher command or a streamable HTTP URL. Supports --env KEY=VALUE for stdio transports. |
get <name> | --json | Show a specific server configuration. --json prints the raw config entry. |
list | --json | List configured MCP servers. Add --json for machine-readable output. |
login <name> | --scopes scope1,scope2 | Start an OAuth login for a streamable HTTP server (servers that support OAuth only). |
logout <name> | Remove stored OAuth credentials for a streamable HTTP server. | |
remove <name> | Delete a stored MCP server definition. |
add <name>-- <command...> | --url <value>--env KEY=VALUE for stdio transports.get <name>--json--json prints the raw config entry.list--json--json for machine-readable output.login <name>--scopes scope1,scope2logout <name>remove <name>The add subcommand supports both stdio and streamable HTTP transports:
| Key | Type / Values | Details |
|---|---|---|
--bearer-token-env-var | ENV_VAR | Environment variable whose value is sent as a bearer token when connecting to a streamable HTTP server. |
--env KEY=VALUE | repeatable | Environment variable assignments applied when launching a stdio server. |
--oauth-client-id | CLIENT_ID | OAuth client identifier for a streamable HTTP MCP server. Requires --url. |
--oauth-resource | RESOURCE | OAuth resource parameter to include during login for a streamable HTTP MCP server. Requires --url. |
--url | https://… | Register a streamable HTTP server instead of stdio. Mutually exclusive with COMMAND.... |
COMMAND... | stdio transport | Executable plus arguments to launch the MCP server. Provide after --. |
--bearer-token-env-varENV_VAR--env KEY=VALUErepeatable--oauth-client-idCLIENT_ID--url.--oauth-resourceRESOURCE--url.--urlhttps://…COMMAND....COMMAND...stdio transport--.OAuth actions (login, logout) only work with streamable HTTP servers (and only when the server supports OAuth).
codex plugin
Install, list, and remove plugins from configured marketplaces.
| Key | Type / Values | Details |
|---|---|---|
add <plugin[@marketplace]> | [--marketplace, -m NAME] [--json] | Install a plugin from a configured marketplace. Use --marketplace or -m when the plugin argument omits @marketplace. |
list | [--marketplace, -m NAME] [--available --json] [--json] | List installed plugins. With --json, output has installed and available arrays; --available includes uninstalled marketplace plugins and requires --json. |
marketplace | Manage configured marketplace sources. See codex plugin marketplace below. | |
remove <plugin[@marketplace]> | [--marketplace, -m NAME] [--json] | Remove an installed plugin from local config and cache. Use --json for automation-friendly output. |
add <plugin[@marketplace]>[--marketplace, -m NAME] [--json]--marketplace or -m when the plugin argument omits @marketplace.list[--marketplace, -m NAME] [--available --json] [--json]--json, output has installed and available arrays; --available includes uninstalled marketplace plugins and requires --json.marketplacecodex plugin marketplace below.remove <plugin[@marketplace]>[--marketplace, -m NAME] [--json]--json for automation-friendly output.codex plugin add --json prints pluginId, name, marketplaceName,
version, installedPath, and authPolicy. codex plugin list --json prints
installed and available arrays. Entries include pluginId, name,
marketplaceName, version, installed, enabled, source, installPolicy,
authPolicy, and, when available, marketplaceSource with the configured
marketplace source type and value. codex plugin remove --json prints
pluginId, name, and marketplaceName.
codex plugin marketplace
Manage plugin marketplace sources that Codex can browse and install from.
| Key | Type / Values | Details |
|---|---|---|
add <source> | [--ref REF] [--sparse PATH] [--json] | Install a plugin marketplace from GitHub shorthand, a Git URL, an SSH URL, or a local marketplace root directory. --sparse is supported only for Git sources and can be repeated. |
list | [--json] | Show plugin marketplaces Codex is currently considering and the root path for each marketplace. |
remove <marketplace-name> | [--json] | Remove a configured plugin marketplace. |
upgrade [marketplace-name] | [--json] | Refresh one configured Git marketplace, or all configured Git marketplaces when no name is provided. |
add <source>[--ref REF] [--sparse PATH] [--json]--sparse is supported only for Git sources and can be repeated.list[--json]remove <marketplace-name>[--json]upgrade [marketplace-name][--json]codex plugin marketplace add accepts GitHub shorthand such as owner/repo or
owner/repo@ref, HTTP or HTTPS Git URLs, SSH Git URLs, and local marketplace
root directories. Use --ref to pin a Git ref, and repeat --sparse PATH to
use a sparse checkout for Git-backed marketplace repositories.
codex plugin marketplace list prints in-scope marketplace names and roots,
including implicitly discovered default marketplaces and configured marketplace
snapshots.
Add --json to marketplace add, list, upgrade, or remove commands for
automation-friendly output. Marketplace add JSON includes marketplaceName,
installedRoot, and alreadyAdded; list JSON includes a marketplaces array
with name, root, and optional marketplaceSource; upgrade JSON includes
selectedMarketplaces, upgradedRoots, and errors; remove JSON includes
marketplaceName and installedRoot.
codex mcp-server
Run Codex as an MCP server over stdio so that other tools can connect. This command inherits global configuration overrides and exits when the downstream client closes the connection.
codex resume
Continue an interactive session by ID or resume the most recent conversation. codex resume scopes --last to the current working directory unless you pass --all. It accepts the same global flags as codex, including model and sandbox overrides.
| Key | Type / Values | Details |
|---|---|---|
--all | boolean | Include sessions outside the current working directory when selecting the most recent session. |
--include-non-interactive | boolean | Include non-interactive sessions in the picker and --last selection. |
--last | boolean | Skip the picker and resume the most recent conversation from the current working directory. |
SESSION_ID | uuid | session name | Resume the specified session. Omit and use --last to continue the most recent session. |
--allboolean--include-non-interactiveboolean--last selection.--lastbooleanSESSION_IDuuid | session name--last to continue the most recent session.codex fork
Fork a previous interactive session into a new task. By default, codex fork opens the session picker; add --last to fork your most recent session instead.
| Key | Type / Values | Details |
|---|---|---|
--all | boolean | Show sessions beyond the current working directory in the picker. |
--last | boolean | Skip the picker and fork the most recent conversation automatically. |
SESSION_ID | uuid | Fork the specified session. Omit and use --last to fork the most recent session. |
--allboolean--lastbooleanSESSION_IDuuid--last to fork the most recent session.codex sandbox
Use the sandbox helper to run a command under the same policies Codex uses internally.
macOS seatbelt
| Key | Type / Values | Details |
|---|---|---|
--allow-unix-socket | path | Allow the sandboxed command to bind or connect Unix sockets rooted at this path. Repeat to allow multiple paths. |
--cd, -C | DIR | Working directory used for profile resolution and command execution. Requires --permission-profile. |
--config, -c | key=value | Pass configuration overrides into the sandboxed run (repeatable). |
--include-managed-config | boolean | Include managed requirements while resolving an explicit permissions profile. Requires --permission-profile. |
--log-denials | boolean | Capture macOS sandbox denials with log stream while the command runs and print them after exit. |
--permission-profile, -P | NAME | Apply a named permissions profile from the active configuration stack. |
--profile, -p | NAME | Layer $CODEX_HOME/NAME.config.toml on top of the base user config. |
COMMAND... | var-args | Shell command to execute under macOS Seatbelt. Everything after -- is forwarded. |
--allow-unix-socketpath--cd, -CDIR--permission-profile.--config, -ckey=value--include-managed-configboolean--permission-profile.--log-denialsbooleanlog stream while the command runs and print them after exit.--permission-profile, -PNAME--profile, -pNAME$CODEX_HOME/NAME.config.toml on top of the base user config.COMMAND...var-args-- is forwarded.Linux Landlock
| Key | Type / Values | Details |
|---|---|---|
--cd, -C | DIR | Working directory used for profile resolution and command execution. Requires --permission-profile. |
--config, -c | key=value | Configuration overrides applied before launching the sandbox (repeatable). |
--include-managed-config | boolean | Include managed requirements while resolving an explicit permissions profile. Requires --permission-profile. |
--permission-profile, -P | NAME | Apply a named permissions profile from the active configuration stack. |
--profile, -p | NAME | Layer $CODEX_HOME/NAME.config.toml on top of the base user config. |
COMMAND... | var-args | Command to execute under Landlock + seccomp. Provide the executable after --. |
--cd, -CDIR--permission-profile.--config, -ckey=value--include-managed-configboolean--permission-profile.--permission-profile, -PNAME--profile, -pNAME$CODEX_HOME/NAME.config.toml on top of the base user config.COMMAND...var-args--.Windows
| Key | Type / Values | Details |
|---|---|---|
--cd, -C | DIR | Working directory used for profile resolution and command execution. Requires --permission-profile. |
--config, -c | key=value | Configuration overrides applied before launching the sandbox (repeatable). |
--include-managed-config | boolean | Include managed requirements while resolving an explicit permissions profile. Requires --permission-profile. |
--permission-profile, -P | NAME | Apply a named permissions profile from the active configuration stack. |
--profile, -p | NAME | Layer $CODEX_HOME/NAME.config.toml on top of the base user config. |
COMMAND... | var-args | Command to execute under the native Windows sandbox. Provide the executable after --. |
--cd, -CDIR--permission-profile.--config, -ckey=value--include-managed-configboolean--permission-profile.--permission-profile, -PNAME--profile, -pNAME$CODEX_HOME/NAME.config.toml on top of the base user config.COMMAND...var-args--.codex update
Check for and apply a Codex CLI update when the installed release supports self-update. Debug builds print a message telling you to install a release build instead.
Flag combinations and safety tips
- Use
--sandbox workspace-writefor unattended local work that can stay inside the workspace, and avoid--dangerously-bypass-approvals-and-sandboxunless you are inside a dedicated sandbox VM. - When you need to grant Codex write access to more directories, prefer
--add-dirrather than forcing--sandbox danger-full-access. - Pair
--jsonwith--output-last-messagein CI to capture machine-readable progress and a final natural-language summary.
Interactive shortcuts
- Type
@to search for a file in the workspace and add its path to the prompt. - Press Up or Down to restore draft history.
- Press Ctrl+R to search prompt history, then press Enter to use a match or Esc to cancel.
- Press Ctrl+O or run
/copyto copy the latest completed Codex output. - Prefix a line with
!to run a local shell command under the current approval and sandbox settings. - Press Tab while Codex is working to queue a follow-up prompt, slash command, or shell command for the next turn.
- Press Enter while Codex is working to inject new instructions into the current turn.
- Press Esc twice with an empty composer to edit the previous user message and fork the conversation from that point.
- Press Ctrl+C or run
/exitto close the session.
Related resources
- Codex CLI overview: installation, upgrades, and quick tips.
- Config basics: persist defaults like the model and provider.
- Advanced Config: profiles, providers, sandbox tuning, and integrations.
- AGENTS.md: conceptual overview of Codex agent capabilities and best practices.
Slash commands give you fast, keyboard-first control over Codex. Type / in
the composer to open the slash popup, choose a command, and Codex will perform
actions such as switching models, adjusting permissions, or summarizing long
conversations without leaving the terminal.
This guide shows you how to:
- Find the right built-in slash command for a task
- Steer an active session with commands like
/model,/fast,/personality,/permissions,/approve,/raw,/agent, and/status
Built-in slash commands
Codex ships with the following commands. Open the slash popup and start typing the command name to filter the list.
When a task is already running, you can type a slash command and press Tab to
queue it for the next turn. Codex parses queued slash commands when they run, so
command menus and errors appear after the current turn finishes. Slash
completion still works before you queue the command.
| Command | Purpose | When to use it |
|---|---|---|
/permissions | Set what Codex can do without asking first. | Relax or tighten approval requirements mid-session, such as switching between Auto and Read Only. |
/ide | Include open files, current selection, and other IDE context. | Pull editor context into the next prompt without re-explaining what’s open in your IDE. |
/keymap | Remap TUI keyboard shortcuts. | Inspect and persist custom shortcut bindings in config.toml. |
/vim | Toggle Vim mode for the composer. | Switch between Vim normal/insert behavior and the default composer editing mode. |
/setup-default-sandbox | Set up the elevated agent sandbox (Windows only). | Replace the degraded Windows sandbox after Codex offers the elevated setup. |
/sandbox-add-read-dir | Grant sandbox read access to an extra directory (Windows only). | Unblock commands that need to read an absolute directory path outside the current readable roots. |
/agent, /subagents | Switch the active agent thread. | Inspect or continue work in a spawned subagent thread. |
/apps | Browse apps (connectors) and insert them into your prompt. | Attach an app as $app-slug before asking Codex to use it. |
/plugins | Browse installed and discoverable plugins. | Inspect plugin tools, install suggested plugins, or manage plugin availability. |
/hooks | View and manage lifecycle hooks. | Inspect configured hooks, trust new or changed hooks, or disable non-managed hooks before they run. |
/clear | Clear the terminal and start a fresh task. | Reset the visible UI and task context together when you want a fresh start. |
/rename | Rename the current task. | Give a saved session a recognizable name without leaving the TUI. |
/archive | Archive the current session and exit Codex. | Remove the current session from active session lists without deleting its transcript. |
/delete | Permanently delete the current session and exit Codex. | Remove the transcript and descendant sessions when archiving isn’t enough. |
/compact | Summarize the visible conversation to free tokens. | Use after long runs so Codex retains key points without blowing the context window. |
/copy | Copy the latest completed Codex output. | Grab the latest finished response or plan text without manually selecting it. You can also press Ctrl+O. |
/diff | Show the Git diff, including files Git isn’t tracking yet. | Review Codex’s edits before you commit or run tests. |
/exit | Exit the CLI (same as /quit). | Alternative spelling; both commands exit the session. |
/experimental | Toggle experimental features. | Enable options such as Network proxy or Prevent sleep while running. |
/approve | Approve one retry of a recent auto review denial. | Retry a command or action that the auto reviewer denied. |
/memories | Configure memory use and generation. | Turn memory injection or memory generation on or off without leaving the TUI. |
/skills | Browse and use skills. | Improve task-specific behavior by selecting a relevant local skill. |
/import | Import Claude Code setup, project files, and recent chats. | Migrate supported external-agent artifacts into Codex configuration and local files. |
/feedback | Send logs to the Codex maintainers. | Report issues or share diagnostics with support. |
/init | Generate an AGENTS.md scaffold in the current directory. | Capture persistent instructions for the repository or subdirectory you’re working in. |
/logout | Sign out of Codex. | Clear local credentials when using a shared machine. |
/mcp | List configured Model Context Protocol (MCP) tools. | Check which external tools Codex can call during the session; add verbose for server details. |
/mention | Attach a file to the conversation. | Point Codex at specific files or folders you want it to inspect next. |
/model | Choose the active model (and reasoning effort, when available). | Switch between models such as gpt-5.4-mini and gpt-5.5 before running a task. |
/fast | Toggle a Fast service tier when the model catalog exposes one. | Turn the current model’s Fast tier on or off and persist the selection. |
/plan | Switch to plan mode and optionally send a prompt. | Ask Codex to propose an execution plan before implementation work starts. |
/goal | Set, edit, pause, resume, view, or clear a task goal. | Give Codex a persistent target to track while a larger task runs. |
/personality | Choose a communication style for responses. | Make Codex more concise, more explanatory, or more collaborative without changing your instructions. |
/ps | Show background terminals and their recent output. | Check long-running commands without leaving the main transcript. |
/stop | Stop all background terminals. | Cancel background terminal work started by the current session. |
/fork | Fork the current task into a new task. | Branch the active session to explore a new approach without losing the current transcript. |
/app | Continue the current session in the ChatGPT desktop app. | Move from the TUI to the desktop app on macOS or Windows. |
/side, /btw | Start an ephemeral side conversation. | Ask a focused follow-up without disrupting the main task’s transcript. |
/raw | Toggle raw scrollback mode. | Make terminal selection and copying less formatted while reviewing long output. |
/resume | Resume a saved conversation from your session list. | Continue work from a previous CLI session without starting over. |
/new | Start a new task inside the same CLI session. | Reset the task context without leaving the CLI when you want a fresh prompt in the same repo. |
/quit | Exit the CLI. | Leave the session immediately. |
/review | Ask Codex to review your working tree. | Run after Codex completes work or when you want a second set of eyes on local changes. |
/status | Display session configuration and token usage. | Confirm the active model, approval policy, writable roots, and remaining context capacity. |
/usage | View account token usage or use a rate-limit reset. | Inspect daily, weekly, or cumulative ChatGPT token activity from inside the TUI. |
/debug-config | Print config layer and requirements diagnostics. | Debug precedence and policy requirements, including experimental network constraints. |
/statusline | Configure TUI status-line fields interactively. | Pick and reorder footer items (model/context/limits/git/tokens/session) and persist in config.toml. |
/title | Configure terminal window or tab title fields interactively. | Pick and reorder title items such as project, status, thread, branch, model, and task progress. |
/theme | Choose a syntax-highlighting theme. | Preview and persist a terminal syntax-highlighting theme. |
/pets, /pet | Choose or hide a terminal pet. | Personalize the TUI with a built-in or custom ambient pet. |
/quit and /exit both exit the CLI. Use them only after you have saved or
committed any important work.
Use /permissions to adjust what Codex can do without asking first. Use
/approve only when you need to retry a recent action that automatic review
denied.
Control your session with slash commands
The following workflows keep your session on track without restarting Codex.
Set the active model with /model
- Start Codex and open the composer.
- Type
/modeland press Enter. - Choose a model such as
gpt-5.4-miniorgpt-5.5from the popup.
Expected: Codex confirms the new model in the transcript. Run /status to verify the change.
Toggle Fast mode with /fast
- Type
/fastto turn the current model’s Fast service tier on. - Type
/fastagain to turn it off.
Expected: Codex toggles the tier and saves the selection. In the TUI footer,
you can also show a Fast mode status-line item with /statusline.
Fast tier commands are catalog-driven. If the current model doesn’t advertise a
Fast tier, Codex won’t show /fast.
Set a communication style with /personality
Use /personality to change how Codex communicates without rewriting your prompt.
- In an active conversation, type
/personalityand press Enter. - Choose a style from the popup.
Expected: Codex confirms the new style in the transcript and uses it for later responses in the task.
Codex supports friendly, pragmatic, and none personalities. Use none
to disable personality instructions.
If the active model doesn’t support personality-specific instructions, Codex hides this command.
Switch to plan mode with /plan
- Type
/planand press Enter to switch the active conversation into plan mode. - Optional: provide inline prompt text (for example,
/plan Propose a migration plan for this service). - You can paste content or attach images while using inline
/planarguments.
Expected: Codex enters plan mode and uses your optional inline prompt as the first planning request.
While a task is already running, /plan is temporarily unavailable.
Set or view a task goal with /goal
- Type
/goal <objective>to set the goal, for example/goal Finish the migration and keep tests green. - Type
/goalto view the current goal. - Use
/goal editto revise the objective. Use/goal pause,/goal resume, or/goal clearto pause, resume, or remove it.
Expected: Codex keeps the goal attached to the active task while work continues.
Goal objectives must be non-empty and at most 4,000 characters. For longer instructions, put the details in a file and point the goal at that file.
Toggle experimental features with /experimental
- Type
/experimentaland press Enter. - Toggle the features you want (for example, Network proxy or Prevent sleep while running), then restart Codex if the prompt asks you to.
Expected: Codex saves your feature choices to config and applies them on restart.
Approve an auto review denial with /approve
Use /approve when the automatic reviewer denied a recent action and you want
Codex to retry it once.
- Type
/approve. - Confirm the retry when Codex shows the relevant denied action.
Expected: Codex retries that denied action once under the current session policy.
Configure memories with /memories
- Type
/memories. - Choose whether Codex should use existing memories, generate new memories, or keep memory behavior disabled.
Expected: Codex updates the relevant memory settings for future sessions.
Use skills with /skills
- Type
/skills. - Pick the skill you want Codex to apply.
Expected: Codex inserts the selected skill context so the next request follows that skill’s instructions.
Import Claude Code configuration with /import
- Type
/import. - Choose the Claude Code setup, project files, or recent chats you want to migrate.
Expected: Codex opens the external-agent import picker and imports the selected supported artifacts into Codex configuration and local files.
Run /import from a local TUI session. It’s unavailable while a task is running,
in remote sessions, and while connected to the local app-server daemon.
Clear the terminal and start a new task with /clear
- Type
/clearand press Enter.
Expected: Codex clears the terminal, resets the visible transcript, and starts a fresh task in the same CLI session.
Unlike Ctrl+L, /clear starts a new conversation.
Ctrl+L only clears the terminal view and keeps the current task. Codex disables both actions while a task is in progress.
Archive the current session with /archive
- Type
/archiveand press Enter. - Confirm that you want to archive the current session and exit Codex.
Expected: Codex archives the current session and closes the interactive TUI.
Codex keeps the session transcript stored locally; restore it later with
codex unarchive <SESSION>.
/archive is unavailable while a task is running.
Delete the current session with /delete
- Type
/deleteand press Enter. - Confirm that you want to delete the current session and exit Codex.
Expected: Codex deletes the current session transcript and closes the interactive TUI. Deletion is permanent and also removes spawned descendant sessions.
/delete is unavailable while a task is running or in a side conversation.
Update permissions with /permissions
- Type
/permissionsand press Enter. - Select the approval preset that matches your comfort level, for example
Autofor hands-off runs orRead Onlyto review edits. When named permission profiles are active, the picker also shows configured custom profiles and their descriptions.
Expected: Codex announces the updated policy. Future actions respect the updated approval mode until you change it again.
Include IDE context with /ide
- Type
/ide. - Add optional inline text if you want to explain what Codex should do with the current IDE selection or open files.
Expected: Codex includes available IDE context in the next prompt.
Toggle Vim mode with /vim
- Type
/vim. - Continue editing in the composer.
Expected: Codex toggles composer Vim mode for the current session. To make Vim
mode the default for new sessions, set tui.vim_mode_default = true in
config.toml.
Set up the elevated Windows sandbox with /setup-default-sandbox
This command appears only on Windows when Codex is using the degraded restricted-token sandbox.
- Type
/setup-default-sandbox. - Follow the administrator setup flow.
Expected: Codex configures the elevated Windows sandbox and selects the corresponding automatic approval preset.
Copy the latest response with /copy
- Type
/copyand press Enter.
Expected: Codex copies the latest completed Codex output to your clipboard.
If a turn is still running, /copy uses the latest completed output instead of
the in-progress response. The command is unavailable before the first completed
Codex output and immediately after a rollback.
You can also press Ctrl+O from the main TUI to copy the latest completed response without opening the slash command menu.
Toggle raw scrollback with /raw
- Type
/raw,/raw on, or/raw off.
Expected: Codex toggles raw scrollback mode, which makes terminal selection and
copying more direct. You can also use the default Alt+R
binding or persist the default with tui.raw_output_mode = true.
Grant sandbox read access with /sandbox-add-read-dir
This command is available only when running the CLI natively on Windows.
- Type
/sandbox-add-read-dir C:\absolute\directory\pathand press Enter. - Confirm the path is an existing absolute directory.
Expected: Codex refreshes the Windows sandbox policy and grants read access to that directory for later commands that run in the sandbox.
Inspect the session with /status
- In any conversation, type
/status. - Review the output for the active model, approval policy, writable roots, and current token usage. When the TUI connects remotely, the output also shows the remote address and the server version.
Expected: Codex prints a summary confirming that it’s operating where you expect.
View account usage with /usage
- Type
/usageto open the usage menu. - Choose whether to show token activity or redeem an available earned reset.
- To open token activity directly, type
/usage daily,/usage weekly, or/usage cumulative.
Expected: Codex opens usage actions or shows account token activity for the selected view. If the session doesn’t have Codex service account auth, Codex shows a sign-in requirement.
Inspect config layers with /debug-config
- Type
/debug-config. - Review the output for config layer order (lowest precedence first), on/off state, and policy sources.
Expected: Codex prints layer diagnostics plus policy details such as
allowed_approval_policies, allowed_sandbox_modes, mcp_servers, rules,
enforce_residency, and experimental_network when configured.
Use this output to debug why an effective setting differs from config.toml.
Configure footer items with /statusline
- Type
/statusline. - Use the picker to toggle and reorder items, then confirm.
Expected: The footer status line updates immediately and persists to
tui.status_line in config.toml.
Available status-line items include model, model+reasoning, context stats, rate limits, git branch, token counters, session id, current directory/project root, and Codex version.
Configure terminal title items with /title
- Type
/title. - Use the picker to toggle and reorder items, then confirm.
Expected: The terminal window or tab title updates immediately and persists to
tui.terminal_title in config.toml.
Available title items include app name, project, spinner, status, thread, git branch, model, and task progress.
Choose a syntax theme with /theme
- Type
/theme. - Preview a theme from the picker, then confirm.
Expected: Codex updates syntax highlighting and persists the choice to
tui.theme in config.toml.
Choose a terminal pet with /pets
- Type
/pets(or/pet) to open the pet picker. - Choose a built-in or custom pet, or turn pets off.
Expected: Codex displays the selected ambient pet in supported terminals and
persists the selection. You can also type /pets off to hide it.
Remap TUI shortcuts with /keymap
Use /keymap to inspect, update, and persist keyboard shortcut bindings for the TUI.
- Type
/keymap. - Pick the shortcut context and action you want to change.
- Enter the new binding or remove the existing one.
Expected: Codex updates the active keymap and writes the custom binding to tui.keymap in config.toml.
Key bindings use names such as ctrl-a, shift-enter, and page-down. Context-specific bindings override tui.keymap.global; an empty binding list unbinds the action.
Check background terminals with /ps
- Type
/ps. - Review the list of background terminals and their status.
Expected: Codex shows each background terminal’s command plus up to three recent, non-empty output lines so you can gauge progress at a glance.
Background terminals appear when unified_exec is in use; otherwise, the list may be empty.
Stop background terminals with /stop
- Type
/stop. - Confirm if Codex asks before stopping the listed terminals.
Expected: Codex stops all background terminals for the current session. /clean
is still available as an alias for /stop.
Keep transcripts lean with /compact
- After a long exchange, type
/compact. - Confirm when Codex offers to summarize the conversation so far.
Expected: Codex replaces earlier turns with a concise summary, freeing context while keeping critical details.
Review changes with /diff
- Type
/diffto inspect the Git diff. - Scroll through the output inside the CLI to review edits and added files.
Expected: Codex shows changes you’ve staged, changes you haven’t staged yet, and files Git hasn’t started tracking, so you can decide what to keep.
Highlight files with /mention
- Type
/mentionfollowed by a path, for example/mention src/lib/api.ts. - Select the matching result from the popup.
Expected: Codex adds the file to the conversation, ensuring follow-up turns reference it directly.
Start a new conversation with /new
- Type
/newand press Enter.
Expected: Codex starts a fresh conversation in the same CLI session, so you can switch tasks without leaving your terminal.
Unlike /clear, /new doesn’t clear the current terminal view first.
Rename the current task with /rename
- Type
/rename <name>, or type/renameto open the naming prompt. - Enter a short name that will help you find the task later.
Expected: Codex updates the saved task name without changing its transcript.
Resume a saved conversation with /resume
- Type
/resumeand press Enter. - Choose the session you want from the saved-session picker.
Expected: Codex reloads the selected conversation’s transcript so you can pick up where you left off, keeping the original history intact.
Fork the current conversation with /fork
- Type
/forkand press Enter.
Expected: Codex clones the current task into a new task with a fresh ID, leaving the original transcript untouched so you can explore an alternative approach in parallel.
If you need to fork a saved session instead of the current one, run
codex fork in your terminal to open the session picker.
Continue in the desktop app with /app
On macOS and Windows, type /app to open the current session in the ChatGPT
desktop app. If the app isn’t installed or running, Codex shows an error asking
you to install or launch it.
Expected: The desktop app opens the same saved task so you can continue there.
Start a side conversation with /side
Use /side to start an ephemeral fork from the current conversation without switching away from the main task.
- Type
/sideto open a side conversation. - Optionally add inline text, for example
/side Check whether this plan has an obvious risk. - Return to the parent task after the focused detour finishes.
Expected: Codex opens a side conversation whose transcript is separate from the parent task. While you are in side mode, the TUI continues to show the parent task’s status so you can see whether the main task is still running.
/side is unavailable inside another side conversation and during review mode.
Generate AGENTS.md with /init
- Run
/initin the directory where you want Codex to look for persistent instructions. - Review the generated
AGENTS.md, then edit it to match your repository conventions.
Expected: Codex creates an AGENTS.md scaffold you can refine and commit for
future sessions.
Ask for a working tree review with /review
- Type
/review. - Follow up with
/diffif you want to inspect the exact file changes.
Expected: Codex summarizes issues it finds in your working tree, focusing on
behavior changes and missing tests. It uses the current session model unless
you set review_model in config.toml.
List MCP tools with /mcp
- Type
/mcp. - Review the list to confirm which MCP servers and tools are available.
Expected: You see the configured Model Context Protocol (MCP) tools Codex can call in this session.
Use /mcp verbose to include detailed server diagnostics. If you pass anything other than verbose, Codex shows the command usage.
Browse apps with /apps
- Type
/apps. - Pick an app from the list.
Expected: Codex inserts the app mention into the composer as $app-slug, so
you can immediately ask Codex to use it.
Browse plugins with /plugins
- Type
/plugins. - Choose a marketplace tab, then pick a plugin to inspect its capabilities or available actions.
Expected: Codex opens the plugin browser so you can review installed plugins, discoverable plugins that your configuration allows, and installed plugin state. Press Space on an installed plugin to toggle its enabled state.
View and manage lifecycle hooks with /hooks
- Type
/hooks. - Choose a hook event to inspect the matching handlers.
- Trust, disable, or re-enable non-managed hooks as needed.
Expected: Codex opens the hook browser so you can review configured lifecycle hooks. Managed hooks appear as managed and can’t be disabled from the user hook browser.
Switch agent threads with /agent
- Type
/agentor/subagentsand press Enter. - Select the thread you want from the picker.
Expected: Codex switches the active thread so you can inspect or continue that agent’s work.
Send feedback with /feedback
- Type
/feedbackand press Enter. - Follow the prompts to include logs or diagnostics.
Expected: Codex collects the requested diagnostics and submits them to the maintainers.
Sign out with /logout
- Type
/logoutand press Enter.
Expected: Codex clears local credentials for the current user session.
Exit the CLI with /quit or /exit
- Type
/quit(or/exit) and press Enter.
Expected: Codex exits immediately. Save or commit any important work first.
Use these commands to control Codex from the VS Code Command Palette. You can also bind them to keyboard shortcuts.
Assign a key binding
To assign or change a key binding for a Codex command:
- Open the Command Palette (Cmd+Shift+P on macOS or Ctrl+Shift+P on Windows/Linux).
- Run Preferences: Open Keyboard Shortcuts.
- Search for
Codexor the command ID (for example,chatgpt.newChat). - Select the pencil icon, then enter the shortcut you want.
Extension commands
| Command | Default key binding | Description |
|---|---|---|
chatgpt.addToThread | - | Add selected text range as context for the current task |
chatgpt.addFileToThread | - | Add the entire file as context for the current task |
chatgpt.newChat | macOS: Cmd+NWindows/Linux: Ctrl+N | Create a new task |
chatgpt.newCodexPanel | - | Create a new Codex panel |
chatgpt.openCommandMenu | - | Open the Codex command menu |
chatgpt.openSidebar | - | Open the Codex sidebar panel |
Slash commands let you control Codex without leaving the composer. Use them to check status, switch between local and cloud mode, or send feedback.
Use a slash command
- In the Codex composer, type
/. - Select a command from the list, or keep typing to filter (for example,
/status). - Press Enter.
Available slash commands
| Slash command | Description |
|---|---|
/approve | Approve one retry of a recent automatic-review denial, when automatic review is active. |
/cloud | Run the task in the cloud, when cloud execution is available. |
/cloud-environment | Choose the cloud environment for the task. |
/compact | Compact the current task’s context. |
/fast | Turn a catalog-provided Fast service tier on or off, when available. |
/feedback | Open the feedback dialog to submit feedback and optionally include logs. |
/fork | Copy a local task into a new local task. |
/goal | Set a persistent goal for Codex to work toward. |
/ide-context | Turn automatic IDE context on or off. |
/init | Generate an AGENTS.md scaffold for the current project. |
/local | Run the task in your local workspace. |
/mcp | Open MCP status to view connected servers. |
/memories | Configure whether the task can use or generate memories, when Memories is available. |
/model | Choose the model for the current task. |
/personality | Choose how Codex responds, when the current model supports personalities. |
/plan | Toggle plan mode for multi-step planning. |
/project | Choose a project for new tasks. |
/reasoning | Choose the reasoning effort for the current task. |
/review | Start code review mode to review uncommitted changes or compare against a base branch. |
/side | Start a temporary side conversation without interrupting the main task. |
/status | Show the task ID, context usage, and rate limits. |
/worktree | Run the task in a new Git worktree. |