Learning resourcesReviewed · OpenAI

Codex CLI developer commands reference

This Codex CLI reference helps developers control an AI coding assistant from the terminal, but many detailed option tables are missing from the captured text. It explains interactive sessions, scripted runs, code review, integrations and remote access, with useful restrictions on command combinations.

Researched 23 Nov 2026

In short.

This Codex CLI command guide is for developers using a terminal AI coding assistant, but its captured text leaves many flag tables unexpanded. It provides concrete guidance on interactive controls, automation output, session management, authentication and remote connections. Its strongest details explain incompatible options and command-specific failure behavior. Installation requirements, exact version compatibility, prices and runtime reliability are not established.

Researched and written by an AI model and checked by a second AI model. How it works

The scope is the complete selected page at [https://learn.chatgpt.com/docs/developer-commands.md?surface=cli], including terminal commands, slash commands, shortcuts, safety guidance, platform conditions and removal notices. Linked pages are excluded. Embedded ConfigTable entries are not expanded in the captured text, limiting assessment of flags and maturity labels. Installation packages, source code, external pricing and licensing terms are not included. No commands were executed, and runtime behavior and outcomes remain untested.

The overview

Identity

Developer commands is a Codex documentation reference at [https://learn.chatgpt.com/docs/developer-commands.md?surface=cli]. It is a learning resource about operating the CLI, rather than an installable tool, plugin or model.

The selected page includes terminal subcommands, interactive slash commands, keyboard shortcuts and short workflows. Its linked installation, configuration, pricing and protocol documentation are separate resources.

Assessment

The reference is useful when a developer knows the task they want to perform and needs the corresponding command or a restriction explained. Examples include continuing a session, branching work into another checkout, reviewing changes and capturing structured output for automation.

Beginners receive short instructions for common interactive tasks. Experienced developers get details such as transport choices, configuration overrides and exit behavior. However, the missing option-table contents prevent this captured text from serving as a complete flag reference or compatibility guide.

Users

The main audience is developers using Codex in a terminal, including people managing interactive coding sessions and engineers integrating non-interactive runs into scripts or continuous integration.

More advanced sections address developers building app-server clients, configuring remote sessions, managing MCP integrations or debugging installation and configuration problems. Readers seeking an introduction to programming or a complete first-install tutorial would need additional material.

Capabilities

The page documents interactive operation through codex, scripted tasks through codex exec, non-interactive code review through codex review, cloud task submission and listing, and applying a cloud-chat diff locally. Session controls cover resuming, forking, archiving, restoring and deleting conversations.

It also covers managed Git worktrees, MCP server configuration, plugin marketplaces, diagnostics, model catalogs and remote connections. Interactive commands expose model and permission settings, Git diffs, usage information, transcript export, background terminals and terminal preferences.

For automation, codex exec --json produces newline-delimited JSON events. The page recommends combining structured progress with --output-last-message to retain a final natural-language response.

Using it

Requirements

Following the terminal examples requires an installed Codex CLI. The page describes authentication through a ChatGPT account, API key or access token. Applying a cloud-chat diff explicitly requires authentication and access to that chat.

Managed worktrees require local execution; the interactive /worktree workflow also requires a local Git repository. Remote connections require a suitable server, with a bearer-token environment variable when the server requires authentication.

Minimum CLI versions, hardware requirements and a complete operating-system support matrix are not supplied. Some commands have explicit platform, account or model conditions, including Windows sandbox setup, desktop-app handoff, voice and Fast-tier availability.

Mechanism

Terminal subcommands start operations, while slash commands control an interactive session from its composer. Most defaults come from ~/.codex/config.toml; command-line -c key=value settings override them for that invocation. Most global flags propagate to subcommands, with exceptions delegated to command help.

During interactive work, Tab queues input for the next turn, while Enter injects instructions into the current turn. The separate codex queue command sends text to an existing session and uses that session's model.

The app server supports JSONL over standard input/output and WebSocket connections, including Unix sockets. Its WebSocket listener accepts ws URLs; secure wss connections require TLS termination or a secure proxy.

Setup

Installation instructions are linked rather than included. With the CLI installed, codex login without flags opens the browser-based ChatGPT authentication flow, and codex opens the interactive terminal interface. The /status command displays the active model, approval policy, writable roots and token usage.

For local work, the page suggests --sandbox workspace-write --ask-for-approval on-request. It recommends --add-dir when additional directories need write access. Persistent feature toggles use codex features enable or disable, while terminal preferences can be changed through /config.

Example

The page gives codex exec --worktree "implement the next step" as an example of starting a scripted task in a managed Git worktree. It also shows codex exec fork <SESSION_ID> --worktree "try an alternative approach" for branching a saved session into a new worktree.

These forms require local execution. The --worktree option cannot be combined with resume, review, --ephemeral or --ignore-user-config. These are documented examples; no resulting edits, execution traces or successful task outcomes are provided.

Assessment & evidence

Limitations

Many command-option tables and the command maturity overview appear as unexpanded ConfigTable components. Their flag definitions, defaults and per-command maturity labels cannot be assessed from the supplied text, although the slash-command table is readable.

The page contains important restrictions: review targets conflict with one another, and codex agents does not support --no-daemon. The terminal command codex fork <SESSION_ID> --worktree requires an explicit session ID and local execution. The interactive /fork command can offer a choice between the current directory and a new worktree. The app server is described as primarily for development and debugging, with behavior that may change without notice.

No commands were executed. Installation success, runtime behavior, generated-code quality, latency and reliability remain untested. The documentation supplies no benchmarks or comparative performance results.

Reasoning

A particularly useful distinction for automation is that a successful exit does not always prove the intended operation completed. codex queue --resume can warn that resuming failed and still exit successfully. By contrast, the page states that codex apply exits non-zero when git apply fails, and cloud task submission exits non-zero on submission failure.

Session management also requires a deliberate choice: archive keeps a transcript available for restoration, while delete permanently removes it. Resume continues an existing session; fork creates another session for exploring a different approach. These distinctions help readers choose commands based on the state they need to preserve.

Alternatives

Within the documented interface choices, interactive codex supports ongoing terminal conversations, codex exec supports scripted tasks, and codex cloud submits work to cloud chats. Desktop-app handoff is documented for macOS and Windows. The page does not compare their costs or performance.

For installation and introductory guidance, the page points to the CLI overview at [https://learn.chatgpt.com/docs/codex/cli]; its contents are outside this resource. Claude Code and Cursor are mentioned as import sources, without evidence comparing their capabilities with Codex.

Evidence

The sole retained source is selected-page.txt from [https://learn.chatgpt.com/docs/developer-commands.md?surface=cli]. It contains command descriptions, examples, restrictions, interactive workflows and related-resource links.

Its recorded source revision is sha256:c03e3a1408d1c55fbbe838c81e4e98d0eca65bde195e39a41c8d1fd8d340b5e3. This identifies the captured documentation content, not a Codex CLI release. The evidence contains no execution logs or independently measured outcomes.

Access & freshness

Costs

The page gives no subscription prices, API rates, included allowances, hosting charges or Fast-tier prices. Total operating cost is unknown.

The /usage command exposes account token activity, and model availability is described as account-dependent. Authentication options and usage controls do not establish which features a particular account can access or what a task will cost.

Rights

The supplied page states no documentation redistribution licence, CLI software licence or ownership terms for generated code. Those rights are unknown from this resource.

Commands for installing plugins or applying cloud-chat changes do not establish the reuse rights of those plugins or changes. Applicable licensing and service terms are not included.

Freshness

The source was captured at 2026-11-23T04:56:50.360Z. It provides no explicit publication date, last-updated date or exact CLI version to which all commands apply.

The page explicitly says codex mcp-server and the standalone codex-mcp-server binary have been removed, directing protocol clients toward the app server. It labels execpolicy as preview and makes several interactive features conditional on the installed build, model catalog or account. Compatibility with any particular installation remains unknown.

Actions

Use the reference to identify the command for the intended task, then consult that command's help in the installed CLI for option details missing from the captured tables. Confirm model and permission settings through /status, and inspect local changes through /diff.

For scripts, choose structured output where needed and account for each command's documented failure behavior, particularly queue --resume. For worktrees and remote connections, confirm the stated local-execution and authentication requirements.

Follow the removal notice when considering codex mcp-server. Establish account pricing, applicable licences and exact version compatibility separately; this page does not settle them.

Evidence for this report

selected-page.txtselected · checked 2026-11-23