Skip to main content
Watch: I Built an AI App Without Leaving Databricks

Codex CLI reference - Subcommands

Codex CLI commands and subcommands

Codex CLI documents 54 subcommands, including codex, codex agents and codex app. These run as codex <command> from your shell. Each row gives the docs' description, accepted values and an example where one is documented.

Last verified 1 official pageFull Codex CLI reference

Codex CLI subcommands
CommandDescriptionExample
codex

Launch the terminal UI. Accepts the global flags above plus an optional prompt or image attachments.

Maturity: Stable

Docs: codex
-no example
codex agents

Open the agent command center on a shared local or remote server.

Maturity: Stable

Docs: codex agents
-no example
codex app

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.

Maturity: Stable

Docs: codex app
-no example
codex app-server

Launch the Codex app server for local development or debugging over stdio, WebSocket, or a Unix socket.

Maturity: Experimental

Docs: codex app-server
codex app-server --listen ws://IP:PORT
codex apply

Apply the latest diff generated by a Codex cloud chat to your local working tree. Alias: codex a.

Maturity: Stable; alias: codex a

Docs: codex apply
-no example
codex archive

Archive a saved interactive session by session ID or session name.

Maturity: Stable

Docs: codex archive
codex archive <SESSION>
codex cloud

Browse or execute Codex cloud chats from the terminal without opening the TUI. Alias: codex cloud-tasks.

Maturity: Experimental; alias: codex cloud-tasks

Docs: codex cloud
-no example
codex completion

Generate shell completion scripts for Bash, Zsh, Fish, or PowerShell.

Maturity: Stable

Docs: codex completion
codex completion zsh
codex debug app-server send-message-v2

Debug app-server by sending a single V2 message through the built-in test client.

Maturity: Experimental

Docs: codex debug app-server send-message-v2
-no example
codex debug models

Print the raw model catalog Codex sees, including an option to inspect only the bundled catalog.

Maturity: Experimental

Docs: codex debug models
-no example
codex debug prompt-input

Render the model-visible prompt input list as JSON, optionally with a prompt and images.

Maturity: Experimental

Docs: codex debug prompt-input
-no example
codex delete

Permanently delete a saved interactive session by session ID or session name.

Maturity: Stable

Docs: codex delete
codex delete <SESSION> codex delete <SESSION_UUID> --force
codex doctor

Generate a diagnostic report for local installation, config, auth, runtime, Git, terminal, app-server, and thread inventory issues.

Maturity: Stable

Docs: codex doctor
-no example
codex exec

Run Codex non-interactively. Alias: codex e.

Maturity: Stable; alias: codex e

Docs: codex exec
-no example
codex execpolicy

Evaluate execpolicy rule files and see whether a command would be allowed, prompted, or blocked.

Maturity: Experimental

Docs: codex execpolicy
codex execpolicy check --pretty \ --rules ~/.codex/rules/default.rules \ -- gh pr view 7888 --json title,body,comments
codex features

List feature flags and persistently enable or disable them in config.toml.

Maturity: Stable

Docs: codex features
-no example
codex fork

Fork a previous interactive session into a new chat, preserving the original transcript.

Maturity: Stable

Docs: codex fork
-no example
codex login

Authenticate Codex using ChatGPT OAuth, device auth, an API key, or an access token piped over stdin.

Maturity: Stable

Docs: codex login
-no example
codex logout

Remove stored authentication credentials.

Maturity: Stable

Docs: codex logout
-no example
codex mcp

Manage Model Context Protocol servers (list, add, remove, authenticate).

Maturity: Stable

Docs: codex mcp
-no example
codex plugin

Install, list, and remove plugins from configured marketplace sources.

Maturity: Stable

Docs: codex plugin
-no example
codex plugin marketplace

Add, list, upgrade, or remove plugin marketplaces from Git or local sources.

Maturity: Stable

Docs: codex plugin marketplace
-no example
codex queue

Queue a text message for an existing session by UUID or exact name.

Maturity: Stable

Docs: codex queue
codex queue --thread <SESSION_ID> --message "Run the remaining checks"
codex remote-control

Run or manage remote control for the local app-server, or create a short-lived pairing code.

Maturity: Experimental

Docs: codex remote-control
-no example
codex resume

Continue a previous interactive session by ID or resume the most recent chat.

Maturity: Stable

Docs: codex resume
-no example
codex review

Run a non-interactive review of uncommitted changes, a base branch diff, a commit, or custom review instructions.

Maturity: Stable

Docs: codex review
-no example
codex sandbox

Run arbitrary commands inside Codex-provided macOS, Linux, or Windows sandboxes.

Maturity: Stable

Docs: codex sandbox
-no example
codex unarchive

Restore an archived interactive session by session ID or session name.

Maturity: Stable

Docs: codex unarchive
codex unarchive <SESSION>
codex update

Check for and apply a Codex CLI update when the installed release supports self-update.

Maturity: Stable

Docs: codex update
-no example
codex features disable

Persistently disable a feature flag in $CODEX_HOME/config.toml.

codex features disable <feature>

Docs: codex features disable
-no example
codex features enable

Persistently enable a feature flag in $CODEX_HOME/config.toml.

codex features enable <feature>

Docs: codex features enable
-no example
codex features list

Show known feature flags, their maturity stage, and their effective state.

codex features list

Docs: codex features list
-no example
codex exec resume

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.

codex exec resume [SESSION_ID]

Docs: codex exec resume
-no example
codex login status

Print the active authentication mode and exit with 0 when logged in.

codex login status

Docs: codex login status
-no example
codex mcp add

Register a server using a stdio launcher command or a streamable HTTP URL. Supports --env KEY=VALUE for stdio transports.

add <name> -- <command...> | --url <value>

Docs: codex mcp add
-no example
codex mcp get

Show a specific server configuration. --json prints the raw config entry.

get <name> --json

Docs: codex mcp get
-no example
codex mcp list

List configured MCP servers. Add --json for machine-readable output.

list --json

Docs: codex mcp list
-no example
codex mcp login

Start an OAuth login for a streamable HTTP server (servers that support OAuth only).

login <name> --scopes scope1,scope2

Docs: codex mcp login
-no example
codex mcp logout

Remove stored OAuth credentials for a streamable HTTP server.

logout <name>

Docs: codex mcp logout
-no example
codex mcp remove

Delete a stored MCP server definition.

remove <name>

Docs: codex mcp remove
-no example
codex plugin add

Install a plugin from a configured marketplace. Use --marketplace or -m when the plugin argument omits @marketplace.

add <plugin[@marketplace]> [--marketplace, -m NAME] [--json]

Docs: codex plugin add
-no example
codex plugin list

List installed plugins. With --json, output has installed and available arrays; --available includes uninstalled marketplace plugins and requires --json.

list [--marketplace, -m NAME] [--available --json] [--json]

Docs: codex plugin list
-no example
codex plugin remove

Remove an installed plugin from local config and cache. Use --json for automation-friendly output.

remove <plugin[@marketplace]> [--marketplace, -m NAME] [--json]

Docs: codex plugin remove
-no example
codex plugin marketplace add

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.

add <source> [--ref REF] [--sparse PATH] [--json]

Docs: codex plugin marketplace add
-no example
codex plugin marketplace list

Show plugin marketplaces Codex is currently considering and the root path for each marketplace.

list [--json]

Docs: codex plugin marketplace list
-no example
codex plugin marketplace remove

Remove a configured plugin marketplace.

remove <marketplace-name> [--json]

Docs: codex plugin marketplace remove
-no example
codex plugin marketplace upgrade

Refresh one configured Git marketplace, or all configured Git marketplaces when no name is provided.

upgrade [marketplace-name] [--json]

Docs: codex plugin marketplace upgrade
-no example
codex cloud exec

Submits a Codex cloud task directly from the terminal (the default codex cloud command opens an interactive picker).

Docs: codex cloud exec
-no example
codex cloud list

List recent cloud chats with optional filtering and pagination.

Docs: codex cloud list
-no example
codex remote-control start

Start the local app-server daemon with remote control enabled.

Docs: codex remote-control start
-no example
codex remote-control stop

Stop the local app-server daemon started for remote control.

Docs: codex remote-control stop
-no example
codex remote-control pair

After the daemon is running, create and print a short-lived manual pairing code. With --json, the response includes pairingCode, manualPairingCode, environmentId, and expiresAt.

Docs: codex remote-control pair
-no example
codex execpolicy check

Evaluate one or more --rules files against a command and emit JSON showing the strictest decision and any matching rules. The execpolicy command is currently in preview.

[--pretty] --rules <path> -- <command...>

Docs: codex execpolicy check
codex execpolicy check --pretty \ --rules ~/.codex/rules/default.rules \ -- gh pr view 7888 --json title,body,comments
codex exec fork

codex exec can resume sessions or fork them into new sessions; codex exec fork is listed among the commands that support --worktree (requires local execution).

Docs: codex exec fork
-no example

The rest of the Codex CLI reference

FAQ

How many subcommands does Codex CLI have?

The official Codex CLI docs list 54 subcommands, including codex, codex agents and codex app. All of them are in the table above, in the docs' order.

What does codex do in Codex CLI?

Launch the terminal UI. Accepts the global flags above plus an optional prompt or image attachments. Values: Maturity: Stable.

Where are Codex CLI subcommands documented?

On 1 official docs page at learn.chatgpt.com, last read on October 17, 2026. Every row in the table links the exact section it came from.

More on Codex CLI

Sources

Last verified . Names and examples are copied verbatim from the official page below, and every row above links the exact section it came from.

Newsletter

Know when your tools change

One email per week. New coding agent releases, the flags and commands they add, and what they mean for how you work.