AI IDE List
AI IDE List
OpenAI CodexLast checked June 18, 2026

Codex CLI Cheatsheet

A compact reference for documented Codex CLI commands, common flags, non-interactive runs, MCP and plugin management, and built-in slash commands.

codex

Interactive local repo work

codex exec

Scripts and one-shot tasks

codex cloud

Cloud task workflows

/permissions

Live session control

Quick Start

Commands you will reach for first

These cover the most common local, automated, Cloud, and interactive-control flows.

Interactive work
codex

Open the terminal UI in the current workspace.

One-shot automation
codex exec "fix the failing test"

Run Codex non-interactively and stream the result.

Continue work
codex resume --last

Return to the most recent interactive session.

Apply Cloud output
codex apply TASK_ID

Apply the latest diff from a Codex Cloud task.

Session permissions
/permissions

Adjust what Codex can do without asking.

Model control
/model

Choose the active model and reasoning effort.

Global Options

codex [OPTIONS] [PROMPT]

These options mainly apply to the base codex command. Many are also accepted by subcommands.

--add-dir

Type / Values

path

Use

Add another writable directory beside the main workspace.

--ask-for-approval, -a

Type / Values

untrusted | on-request | never

Use

Choose when Codex asks before running commands.

--cd, -C

Type / Values

path

Use

Set the working directory before the agent starts.

--config, -c

Type / Values

key=value

Use

Override configuration values inline.

--dangerously-bypass-approvals-and-sandbox

Type / Values

boolean

Use

Disable approvals and sandboxing for externally isolated environments.

--yolo

Type / Values

boolean

Use

Alias for the dangerous bypass mode.

--dangerously-bypass-hook-trust

Type / Values

boolean

Use

Run enabled hooks without persisted trust for this run.

--disable

Type / Values

feature

Use

Force-disable a feature flag.

--enable

Type / Values

feature

Use

Force-enable a feature flag.

--image, -i

Type / Values

path[,path...]

Use

Attach images to the initial prompt.

--model, -m

Type / Values

string

Use

Override the configured model.

--no-alt-screen

Type / Values

boolean

Use

Disable alternate-screen mode in the terminal UI.

--oss

Type / Values

boolean

Use

Use a local open-source model provider, commonly with Ollama.

--profile, -p

Type / Values

string

Use

Load a named Codex config profile.

--remote

Type / Values

ws://host:port | wss://host:port | unix:// | unix://PATH

Use

Connect the TUI to a remote app-server.

--remote-auth-token-env

Type / Values

ENV_VAR

Use

Read the remote bearer token from an environment variable.

--sandbox, -s

Type / Values

read-only | workspace-write | danger-full-access

Use

Select the sandbox policy for shell commands.

--search

Type / Values

boolean

Use

Enable live web search.

--strict-config

Type / Values

boolean

Use

Error on unknown config fields.

PROMPT

Type / Values

string

Use

Optional starting instruction.

Use --dangerously-bypass-approvals-and-sandbox or --yolo only when the surrounding environment already provides strong isolation.

Command Overview

Documented top-level commands

Stable commands are intended for regular use. Experimental commands may change as Codex evolves.

codexStable

Start the interactive terminal UI.

codex appStable

Open the Codex desktop app.

codex app-serverExperimental

Start the local app server for development or debugging.

codex applyStable

Apply a Codex Cloud task diff locally.

codex aStable

Alias for codex apply.

codex archiveStable

Archive a saved interactive session.

codex cloudExperimental

Browse or run Codex Cloud tasks from the terminal.

codex cloud-tasksExperimental

Alias for codex cloud.

codex completionStable

Generate shell completion scripts.

codex debug app-server send-message-v2Experimental

Send a V2 test message to app-server.

codex debug modelsExperimental

Print the model catalog Codex sees.

codex doctorStable

Create a local diagnostic report.

codex execStable

Run Codex non-interactively.

codex eStable

Alias for codex exec.

codex execpolicyExperimental

Evaluate command execution policy rules.

codex featuresStable

List or persist feature flag overrides.

codex forkStable

Fork a previous session into a new thread.

codex loginStable

Authenticate Codex.

codex logoutStable

Remove stored credentials.

codex mcpExperimental

Manage MCP server definitions and auth.

codex mcp-serverExperimental

Run Codex itself as an MCP server.

codex pluginExperimental

Install, list, and remove Codex plugins.

codex plugin marketplaceExperimental

Manage plugin marketplace sources.

codex remote-controlExperimental

Ensure app-server remote control support is enabled.

codex resumeStable

Resume a previous interactive session.

codex sandboxExperimental

Run commands inside Codex sandboxes.

codex unarchiveStable

Restore an archived session.

codex updateStable

Check for or apply a CLI update when supported.

Subcommands

Detailed command matrix

Grouped by workflow so the page stays scannable while still covering the documented command surface.

codex

Use

Start the interactive terminal UI.

codex "PROMPT"

Use

Start the TUI with an initial instruction.

codex --image path

Type / Values

path[,path...]

Use

Start with one or more image attachments.

codex --remote ENDPOINT

Type / Values

ws://, wss://, unix://

Use

Connect the TUI to a remote app-server.

codex app

Use

Open the desktop app.

codex app PATH

Type / Values

path

Use

Open a workspace path in Codex Desktop.

codex app --download-url URL

Type / Values

url

Use

Override the desktop installer download URL.

codex app-server

Use

Start the local app server.

codex app-server --listen VALUE

Type / Values

stdio:// | ws://IP:PORT | unix:// | unix://PATH | off

Use

Set the transport listener.

codex app-server --stdio

Type / Values

boolean

Use

Use stdio transport.

codex app-server --analytics-default-enabled

Type / Values

boolean

Use

Default analytics to enabled for app-server clients.

codex app-server --ws-auth MODE

Type / Values

capability-token | signed-bearer-token

Use

Choose WebSocket authentication mode.

codex app-server --ws-audience VALUE

Type / Values

string

Use

Expected JWT audience.

codex app-server --ws-issuer VALUE

Type / Values

string

Use

Expected JWT issuer.

codex app-server --ws-max-clock-skew-seconds N

Type / Values

number

Use

Allow clock skew for token time checks.

codex app-server --ws-shared-secret-file PATH

Type / Values

absolute path

Use

HMAC secret file for signed bearer tokens.

codex app-server --ws-token-file PATH

Type / Values

absolute path

Use

Capability token file.

codex app-server --ws-token-sha256 HEX

Type / Values

hex SHA-256

Use

Expected SHA-256 digest for a token.

codex remote-control

Use

Ensure the local app-server daemon is running with remote-control enabled.

codex apply TASK_ID

Type / Values

string

Use

Apply a Codex Cloud task diff locally.

codex a TASK_ID

Type / Values

string

Use

Alias for codex apply.

codex archive SESSION

Type / Values

session ID | session name

Use

Archive a saved session by ID or name.

codex unarchive SESSION

Type / Values

session ID | session name

Use

Restore an archived session by ID or name.

codex archive --remote ENDPOINT SESSION

Type / Values

endpoint

Use

Connect to remote app-server before changing archive state.

codex cloud

Use

Browse or run Cloud tasks from the terminal.

codex cloud exec QUERY

Type / Values

string

Use

Submit a Cloud task directly.

codex cloud exec --attempts N

Type / Values

1-4

Use

Set the number of assistant attempts.

codex cloud exec --env ENV_ID

Type / Values

ENV_ID

Use

Target a Codex Cloud environment.

codex cloud list

Use

List recent Cloud tasks.

codex cloud list --cursor VALUE

Type / Values

string

Use

Use a pagination cursor.

codex cloud list --env ENV_ID

Type / Values

ENV_ID

Use

Filter by environment.

codex cloud list --json

Type / Values

boolean

Use

Emit JSON output.

codex cloud list --limit N

Type / Values

1-20

Use

Limit the number of tasks returned.

codex cloud-tasks

Use

Alias for codex cloud.

codex resume

Use

Resume an interactive session.

codex resume SESSION_ID

Type / Values

uuid

Use

Resume a specific interactive session.

codex resume --all

Type / Values

boolean

Use

Show sessions outside the current directory.

codex resume --last

Type / Values

boolean

Use

Resume the most recent session.

codex fork

Use

Fork a previous session into a new thread.

codex fork SESSION_ID

Type / Values

uuid

Use

Fork a specific session.

codex fork --all

Type / Values

boolean

Use

Show sessions outside the current directory.

codex fork --last

Type / Values

boolean

Use

Fork the most recent session.

Non-Interactive Mode

codex exec options

Use these flags when Codex is launched as a one-shot command from a terminal, script, or automation.

--cd, -C

Type / Values

path

Use

Set the workspace root.

--color

Type / Values

always | never | auto

Use

Control ANSI color output.

--dangerously-bypass-approvals-and-sandbox

Type / Values

boolean

Use

Disable approvals and sandboxing.

--yolo

Type / Values

boolean

Use

Alias for dangerous bypass mode.

--dangerously-bypass-hook-trust

Type / Values

boolean

Use

Run hooks without persisted trust.

--ephemeral

Type / Values

boolean

Use

Do not persist session rollout files.

--full-auto

Type / Values

boolean

Use

Deprecated compatibility option.

--ignore-rules

Type / Values

boolean

Use

Do not load execpolicy rule files.

--ignore-user-config

Type / Values

boolean

Use

Do not load user config.

--image, -i

Type / Values

path[,path...]

Use

Attach images to the first message.

--json

Type / Values

boolean

Use

Emit NDJSON events.

--experimental-json

Type / Values

boolean

Use

Older alias for JSON event output.

--model, -m

Type / Values

string

Use

Override the model.

--oss

Type / Values

boolean

Use

Use a local OSS model provider.

--output-last-message, -o

Type / Values

path

Use

Write the final assistant message to a file.

--output-schema

Type / Values

path

Use

Validate the final output against a JSON Schema.

--profile, -p

Type / Values

string

Use

Load a config profile.

--sandbox, -s

Type / Values

read-only | workspace-write | danger-full-access

Use

Choose the sandbox policy.

--skip-git-repo-check

Type / Values

boolean

Use

Allow running outside a Git repository.

--config, -c

Type / Values

key=value

Use

Override config inline.

PROMPT

Type / Values

string | -

Use

Initial instruction. Use - to read from stdin.

Interactive TUI

Built-in slash commands

Type / in the Codex composer to open the slash command popup.

/permissions

Set what Codex may do without asking.

/ide

Include IDE context such as open files and selection.

/keymap

Remap TUI keyboard shortcuts.

/vim

Toggle Vim mode for the composer.

/sandbox-add-read-dir

Add sandbox read access to a directory on Windows.

/agent

Switch the active agent thread.

/apps

Browse apps or connectors and insert one into the prompt.

/plugins

Browse installed and discoverable plugins.

/hooks

Review lifecycle hooks.

/clear

Clear the terminal and start a fresh chat.

/archive

Archive the current session and exit Codex.

/compact

Summarize visible conversation to free tokens.

/copy

Copy the latest completed Codex output.

/diff

Show Git diff, including untracked files.

/exit

Exit the CLI.

/experimental

Toggle experimental features.

/approve

Approve one retry after an auto-review denial.

/memories

Configure memory usage and generation.

/skills

Browse and use skills.

/feedback

Send logs to Codex maintainers.

/init

Generate an AGENTS.md scaffold.

/logout

Sign out of Codex.

/mcp

List configured MCP tools.

/mcp verbose

Show MCP server details.

/mention

Attach a file or folder to the conversation.

/model

Choose model and reasoning effort.

/fast

Toggle or inspect the Fast service tier.

/plan

Switch to plan mode.

/goal

Set, view, pause, resume, or clear a goal.

/personality

Choose communication style.

/ps

Show experimental background terminals.

/stop

Stop all background terminals.

/fork

Fork the current conversation into a new thread.

/side

Start an ephemeral side conversation.

/btw

Start a short side conversation.

/raw

Toggle raw scrollback mode.

/resume

Resume a saved conversation.

/new

Start a new conversation in the same CLI session.

/quit

Exit the CLI.

/review

Ask Codex to review the working tree.

/status

Display session config and token usage.

/debug-config

Print config-layer diagnostics.

/statusline

Configure TUI status-line fields.

/title

Configure terminal title fields.

/theme

Choose syntax-highlighting theme.

Common forms

/fast on

Turn the Fast tier on.

/fast off

Turn the Fast tier off.

/fast status

Show Fast tier status.

/personality friendly

Use the friendly communication style.

/personality pragmatic

Use the pragmatic communication style.

/personality none

Disable personality styling.

/goal <objective>

Set a task goal.

/goal pause

Pause the current goal.

/goal resume

Resume the current goal.

/goal clear

Clear the current goal.

/prompts:<name>

Run a local custom prompt. Custom prompts are deprecated in favor of skills.

Local extensions

Built-in slash commands are finite, but installed skills, plugins, MCP servers, and deprecated /prompts:* files can add machine-local capabilities.

Sources

Official documentation

The command names, flags, maturity labels, and slash command coverage are based on OpenAI's documented Codex CLI pages.

Reading note

This page is written as an English quick-reference page, not a full reproduction of the official documentation.