AI IDE List
AI IDE List
OpenAI Codex最終確認: 2026年6月18日

Codex CLI チートシート

公式に文書化された Codex CLI コマンド、よく使うフラグ、非対話実行、MCP、プラグイン管理、組み込み slash commands を素早く確認できます。

codex

ローカルリポジトリでの対話作業

codex exec

スクリプトと単発タスク

codex cloud

Cloud タスクのワークフロー

/permissions

実行中セッションの制御

クイックスタート

最初に使うことが多いコマンド

ローカル作業、自動化、Cloud タスク、対話セッション制御でよく使う流れをまとめています。

対話作業
codex

現在のワークスペースでターミナル UI を開きます。

単発自動化
codex exec "fix the failing test"

Codex を非対話で実行し、結果をストリーミングします。

作業を続ける
codex resume --last

直近の対話セッションに戻ります。

Cloud 出力を適用
codex apply TASK_ID

Codex Cloud タスクの最新 diff を適用します。

セッション権限
/permissions

Codex が確認なしに実行できる操作を調整します。

モデル制御
/model

使用するモデルと reasoning effort を選択します。

グローバルオプション

codex [OPTIONS] [PROMPT]

主に基本の codex コマンドで使うオプションです。多くはサブコマンドでも利用できます。

--add-dir

型 / 値

path

用途

Add another writable directory beside the main workspace.

--ask-for-approval, -a

型 / 値

untrusted | on-request | never

用途

Choose when Codex asks before running commands.

--cd, -C

型 / 値

path

用途

Set the working directory before the agent starts.

--config, -c

型 / 値

key=value

用途

Override configuration values inline.

--dangerously-bypass-approvals-and-sandbox

型 / 値

boolean

用途

Disable approvals and sandboxing for externally isolated environments.

--yolo

型 / 値

boolean

用途

Alias for the dangerous bypass mode.

--dangerously-bypass-hook-trust

型 / 値

boolean

用途

Run enabled hooks without persisted trust for this run.

--disable

型 / 値

feature

用途

Force-disable a feature flag.

--enable

型 / 値

feature

用途

Force-enable a feature flag.

--image, -i

型 / 値

path[,path...]

用途

Attach images to the initial prompt.

--model, -m

型 / 値

string

用途

Override the configured model.

--no-alt-screen

型 / 値

boolean

用途

Disable alternate-screen mode in the terminal UI.

--oss

型 / 値

boolean

用途

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

--profile, -p

型 / 値

string

用途

Load a named Codex config profile.

--remote

型 / 値

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

用途

Connect the TUI to a remote app-server.

--remote-auth-token-env

型 / 値

ENV_VAR

用途

Read the remote bearer token from an environment variable.

--sandbox, -s

型 / 値

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

用途

Select the sandbox policy for shell commands.

--search

型 / 値

boolean

用途

Enable live web search.

--strict-config

型 / 値

boolean

用途

Error on unknown config fields.

PROMPT

型 / 値

string

用途

Optional starting instruction.

--dangerously-bypass-approvals-and-sandbox または --yolo は、周辺環境で十分な隔離がある場合だけ使ってください。

コマンド一覧

文書化済みのトップレベルコマンド

Stable は通常利用向けです。Experimental は Codex の進化に合わせて変わる可能性があります。

codexStable

対話型ターミナル UI を起動します。

codex appStable

Codex デスクトップアプリを開きます。

codex app-serverExperimental

開発またはデバッグ用のローカル app-server を起動します。

codex applyStable

Codex Cloud タスクの diff をローカルに適用します。

codex aStable

codex apply のエイリアスです。

codex archiveStable

保存済みの対話セッションをアーカイブします。

codex cloudExperimental

ターミナルから Codex Cloud タスクを閲覧または実行します。

codex cloud-tasksExperimental

Alias for codex cloud.

codex completionStable

shell 補完スクリプトを生成します。

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

ローカル診断レポートを作成します。

codex execStable

Codex を非対話で実行します。

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

Codex を認証します。

codex logoutStable

保存済み認証情報を削除します。

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

以前の対話セッションを再開します。

codex sandboxExperimental

Codex sandbox 内でコマンドを実行します。

codex unarchiveStable

Restore an archived session.

codex updateStable

Check for or apply a CLI update when supported.

サブコマンド

ワークフロー別コマンドマトリクス

公式に文書化された範囲を保ちつつ、探しやすいよう用途別に整理しています。

codex

用途

対話型ターミナル UI を起動します。

codex "PROMPT"

用途

Start the TUI with an initial instruction.

codex --image path

型 / 値

path[,path...]

用途

Start with one or more image attachments.

codex --remote ENDPOINT

型 / 値

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

用途

Connect the TUI to a remote app-server.

codex app

用途

Open the desktop app.

codex app PATH

型 / 値

path

用途

Open a workspace path in Codex Desktop.

codex app --download-url URL

型 / 値

url

用途

Override the desktop installer download URL.

codex app-server

用途

Start the local app server.

codex app-server --listen VALUE

型 / 値

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

用途

Set the transport listener.

codex app-server --stdio

型 / 値

boolean

用途

Use stdio transport.

codex app-server --analytics-default-enabled

型 / 値

boolean

用途

Default analytics to enabled for app-server clients.

codex app-server --ws-auth MODE

型 / 値

capability-token | signed-bearer-token

用途

Choose WebSocket authentication mode.

codex app-server --ws-audience VALUE

型 / 値

string

用途

Expected JWT audience.

codex app-server --ws-issuer VALUE

型 / 値

string

用途

Expected JWT issuer.

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

型 / 値

number

用途

Allow clock skew for token time checks.

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

型 / 値

absolute path

用途

HMAC secret file for signed bearer tokens.

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

型 / 値

absolute path

用途

Capability token file.

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

型 / 値

hex SHA-256

用途

Expected SHA-256 digest for a token.

codex remote-control

用途

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

codex apply TASK_ID

型 / 値

string

用途

Codex Cloud タスクの diff をローカルに適用します。

codex a TASK_ID

型 / 値

string

用途

codex apply のエイリアスです。

codex archive SESSION

型 / 値

session ID | session name

用途

Archive a saved session by ID or name.

codex unarchive SESSION

型 / 値

session ID | session name

用途

Restore an archived session by ID or name.

codex archive --remote ENDPOINT SESSION

型 / 値

endpoint

用途

Connect to remote app-server before changing archive state.

codex cloud

用途

Browse or run Cloud tasks from the terminal.

codex cloud exec QUERY

型 / 値

string

用途

Submit a Cloud task directly.

codex cloud exec --attempts N

型 / 値

1-4

用途

Set the number of assistant attempts.

codex cloud exec --env ENV_ID

型 / 値

ENV_ID

用途

Target a Codex Cloud environment.

codex cloud list

用途

List recent Cloud tasks.

codex cloud list --cursor VALUE

型 / 値

string

用途

Use a pagination cursor.

codex cloud list --env ENV_ID

型 / 値

ENV_ID

用途

Filter by environment.

codex cloud list --json

型 / 値

boolean

用途

Emit JSON output.

codex cloud list --limit N

型 / 値

1-20

用途

Limit the number of tasks returned.

codex cloud-tasks

用途

Alias for codex cloud.

codex resume

用途

Resume an interactive session.

codex resume SESSION_ID

型 / 値

uuid

用途

Resume a specific interactive session.

codex resume --all

型 / 値

boolean

用途

Show sessions outside the current directory.

codex resume --last

型 / 値

boolean

用途

Resume the most recent session.

codex fork

用途

Fork a previous session into a new thread.

codex fork SESSION_ID

型 / 値

uuid

用途

Fork a specific session.

codex fork --all

型 / 値

boolean

用途

Show sessions outside the current directory.

codex fork --last

型 / 値

boolean

用途

Fork the most recent session.

非対話モード

codex exec オプション

Codex をターミナル、スクリプト、自動化から単発コマンドとして実行するときに使います。

--cd, -C

型 / 値

path

用途

Set the workspace root.

--color

型 / 値

always | never | auto

用途

Control ANSI color output.

--dangerously-bypass-approvals-and-sandbox

型 / 値

boolean

用途

Disable approvals and sandboxing.

--yolo

型 / 値

boolean

用途

Alias for dangerous bypass mode.

--dangerously-bypass-hook-trust

型 / 値

boolean

用途

Run hooks without persisted trust.

--ephemeral

型 / 値

boolean

用途

Do not persist session rollout files.

--full-auto

型 / 値

boolean

用途

Deprecated compatibility option.

--ignore-rules

型 / 値

boolean

用途

Do not load execpolicy rule files.

--ignore-user-config

型 / 値

boolean

用途

Do not load user config.

--image, -i

型 / 値

path[,path...]

用途

Attach images to the first message.

--json

型 / 値

boolean

用途

Emit NDJSON events.

--experimental-json

型 / 値

boolean

用途

Older alias for JSON event output.

--model, -m

型 / 値

string

用途

Override the model.

--oss

型 / 値

boolean

用途

Use a local OSS model provider.

--output-last-message, -o

型 / 値

path

用途

Write the final assistant message to a file.

--output-schema

型 / 値

path

用途

Validate the final output against a JSON Schema.

--profile, -p

型 / 値

string

用途

Load a config profile.

--sandbox, -s

型 / 値

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

用途

Choose the sandbox policy.

--skip-git-repo-check

型 / 値

boolean

用途

Allow running outside a Git repository.

--config, -c

型 / 値

key=value

用途

Override config inline.

PROMPT

型 / 値

string | -

用途

Initial instruction. Use - to read from stdin.

対話型 TUI

組み込み slash commands

Codex の入力欄で / を入力すると slash command のポップアップが開きます。

/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.

よく使う形式

/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.

ローカル拡張

組み込み slash commands は固定ですが、インストール済みの skills、plugins、MCP servers、非推奨の /prompts:* ファイルにより、このマシン固有の機能が追加される場合があります。

出典

公式ドキュメント

コマンド名、フラグ、成熟度ラベル、slash command の範囲は OpenAI の Codex CLI 公式ドキュメントに基づきます。

読み方

このページはクイックリファレンスです。公式ドキュメント全体の転載ではありません。