Web 版 ChatGPT のコンポーザーには専用のコマンドメニューがあります。/ を入力すると、現在のチャットで使える操作が表示されます。ChatGPT デスクトップアプリや CLI のコマンドは利用できません。このリファレンスで説明する Codex のスラッシュコマンド、CLI コマンド、フラグは Web 版 ChatGPT には適用されません。
ChatGPT デスクトップアプリのコマンド
コマンドのページでは、アプリ内の移動、チャットのショートカット、キーボード設定のカスタマイズに加え、チャット、設定、スキル、スケジュール済みタスク、プラグイン、ペットへのディープリンクを説明しています。
スラッシュコマンドのページでは、アプリのコンポーザーで使える /feedback、/goal、/init、/mcp、/plan、/review、/status などのコマンドを説明しています。
リファレンスの見方
このページには、ドキュメントに記載されているすべての Codex CLI コマンドとフラグを掲載しています。各表はキーや説明で検索できます。各セクションではオプションの成熟度を示し、非推奨のオプションやリスクのある組み合わせを明記しています。
CLI のデフォルト値の多くは ~/.codex/config.toml から引き継がれます。コマンドラインで -c key=value を指定すると、その実行に限り、指定した値が優先されます。詳しくは設定の基本を参照してください。
グローバルフラグ
| Key | Type / Values | Details |
|---|---|---|
--add-dir | path | Grant additional directories write access alongside the main workspace. Repeat for multiple paths. |
--approve-for-me, --not-so-yolo | boolean | Use automatic approval review with on-request approvals and the workspace-write sandbox. Conflicts with --sandbox and --yolo; the interactive CLI also rejects --ask-for-approval. |
--ask-for-approval, -a | 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-6.1-sol). |
--no-alt-screen | boolean | Disable alternate screen mode for the TUI (overrides tui.alternate_screen for this run). |
--no-daemon | boolean | Run the interactive CLI without the shared background server. Can't be combined with --remote or codex agents. |
--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 agents, codex queue, 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, and exec-server. |
--worktree | boolean | Start in a new managed Git worktree. Supports new interactive sessions, codex fork <SESSION_ID>, codex exec, and codex exec fork; requires local execution. |
PROMPT | string | Optional text instruction to start the session. Omit to launch the TUI without a pre-filled message. |
--add-dirpath--approve-for-me, --not-so-yolobooleanon-request approvals and the workspace-write sandbox. Conflicts with --sandbox and --yolo; the interactive CLI also rejects --ask-for-approval.--ask-for-approval, -aon-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-6.1-sol).--no-alt-screenbooleantui.alternate_screen for this run).--no-daemonboolean--remote or codex agents.--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 agents, codex queue, 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, and exec-server.--worktreebooleancodex fork <SESSION_ID>, codex exec, and codex exec fork; requires local execution.PROMPTstringこれらのオプションは基本コマンド codex に適用されます。ほとんどはサブコマンドにも引き継がれます。例外については、上の表の注記または各コマンドのヘルプを参照してください。引き継がれるフラグの指定方法は、各コマンドのヘルプに従ってください。たとえば、codex exec --oss ... では --oss が exec に適用されます。
コマンド一覧
「成熟度」列には、実験段階、ベータ、安定、非推奨などのラベルが表示されます。各ラベルの意味は機能の成熟度を参照してください。
| Key | 成熟度 | Details |
|---|---|---|
codex | Stable | Launch the terminal UI. Accepts the global flags above plus an optional prompt or image attachments. |
codex agents | Stable | Open the agent command center on a shared local or remote server. |
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 chat 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 chats 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, resume sessions, or fork them into new 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 chat, 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 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 queue | Stable | Queue a text message for an existing session by UUID or exact name. |
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 chat. |
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, resume sessions, or fork them into new sessions.config.toml.codex forkcodex logincodex mcpcodex plugincodex resumecodex reviewcodex updateコマンドの詳細
codex(対話モード)
サブコマンドを指定せずに codex を実行すると、対話型のターミナル UI(TUI)が起動します。エージェントには、上記のグローバルフラグに加えて画像を渡せます。ウェブ検索ではデフォルトでキャッシュを使用します。最新のページを参照するには --search を指定してください。ローカルで手間を抑えて作業するには、--sandbox workspace-write --ask-for-approval on-request を使用します。
--remote ws://host:port または --remote wss://host:port を指定すると、codex app-server --listen ws://IP:PORT で起動した App Server に TUI から接続できます。ローカルの Unix ソケットを使う場合、デフォルトのソケットには --remote unix:// を、パスを明示するには --remote unix://PATH を指定します。サーバーが WebSocket 認証に Bearer トークンを要求する場合は、--remote-auth-token-env <ENV_VAR> を追加してください。
codex agents
コマンドセンターを開くと、共有サーバー上のチャットを一覧表示し、エージェントを切り替えられます。リモートサーバーに接続するには --remote <URL> を、新しいリモートタスクのディレクトリを指定するには --cd <DIR> を使用します。codex agents は --no-daemon に対応していません。
codex queue
既存のセッションに送るテキストメッセージをキューに追加します。
codex queue --thread <SESSION_ID> --message "Run the remaining checks"--thread には UUID または完全に一致するセッション名を指定できます。同じ名前のセッションが複数ある場合は UUID を使用してください。キューに追加したメッセージの処理には、そのセッションのモデルが使われます。このコマンドが受け付けるのはテキストのみです。
--resume を追加すると、まずメッセージをキューに追加し、セッションがまだ読み込まれていない場合はそのセッションを再開します。再開には、実行中のローカルデーモンまたは --remote で指定したサーバーが必要です。サーバーがトークンを要求する場合は --remote-auth-token-env を使用してください。セッションを再開できなかった場合も、Codex は警告を表示して正常終了します。
codex app-server
Codex App Server をローカルで起動します。主に開発とデバッグを目的とした機能で、予告なく変更される場合があります。
| 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. |
--code-mode-host | http://HOST[:PORT] | https://HOST[:PORT] | Share an outbound HTTP/2 gRPC connection to a remote Code Mode host across threads. Supply an HTTP or HTTPS origin without credentials, a path, a query, or a fragment. |
--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--code-mode-hosthttp://HOST[:PORT] | https://HOST[:PORT]--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:// は、標準入出力で JSONL をやり取りするデフォルトの動作を維持します。codex app-server --stdio でも同じトランスポートを指定できます。--listen ws://IP:PORT は App Server クライアント向けの WebSocket トランスポートを有効にします。サーバーが待ち受けに使用できるのは ws:// の URL です。クライアントが wss:// で接続する場合は、TLS 終端またはセキュアなプロキシを使用してください。Codex のデフォルトの Unix ソケットで WebSocket ハンドシェイクを受け付けるには --listen unix:// を、ソケットのパスを指定するには --listen unix:///absolute/path.sock を使用します。クライアントバインディング用のスキーマを生成する際、利用が制限されているフィールドやメソッドも含めるには --experimental を追加してください。
--code-mode-host https://code-mode.example.com を指定すると、App Server プロセス内のすべてのスレッドが gRPC 経由でリモートの Code Mode ホストに接続します。--listen では、クライアントが App Server に接続する方法を指定します。
codex remote-control
codex remote-control を実行すると、利用条件を満たしていれば管理対象のバックグラウンドサーバー経由でリモート制御が開始されます。それ以外の場合はフォアグラウンドで実行されます。明示的にフォアグラウンドで実行するには codex remote-control --no-daemon を使用します。codex remote-control start はリモート制御を有効にしてローカルの App Server デーモンを起動し、codex remote-control stop はそのデーモンを停止します。これらは管理対象のリモート制御クライアントや SSH 経由のリモート作業で使うコマンドです。ローカルのプロトコルクライアントを開発する際に codex app-server --listen の代わりには使えません。
デーモンの起動後、codex remote-control pair を実行すると、有効期間の短い手動ペアリング用コードが生成され、表示されます。どのリモート制御コマンドでも、--json を追加すると機械可読形式で出力されます。pair の JSON レスポンスには pairingCode、manualPairingCode、environmentId、expiresAt が含まれます。--no-daemon はサブコマンドなしの remote-control にのみ適用されます。start、stop、pair とは併用しないでください。
codex app
macOS または Windows で、ターミナルから ChatGPT デスクトップアプリを起動します。macOS では、Codex が指定されたワークスペースのパスを開けます。Windows では、開くべきパスが表示されます。
| 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 はインストール済みの ChatGPT デスクトップアプリを開きます。未インストールの場合はインストーラーを起動します。macOS では指定したワークスペースのパスを開き、Windows ではインストール後に開くべきパスを表示します。
codex debug app-server send-message-v2
App Server の組み込みテストクライアントを使い、V2 のスレッドとターンの処理を通じてメッセージを 1 件送信します。
| Key | Type / Values | Details |
|---|---|---|
USER_MESSAGE | string | Message text sent to app-server through the built-in V2 test-client flow. |
USER_MESSAGEstringこのデバッグ処理では experimentalApi: true で初期化し、スレッドを開始してターンを送信した後、サーバーからの通知をストリーミングします。App Server プロトコルの動作をローカルで再現して調べる際に使用します。
codex debug models
Codex が参照しているモデルカタログを、そのまま JSON 形式で出力します。
| Key | Type / Values | Details |
|---|---|---|
--bundled | boolean | Skip refresh and print only the model catalog bundled with the current Codex binary. |
--bundledbooleanリモートのモデルエンドポイントから更新せず、現在のバイナリに同梱されているカタログだけを確認するには、--bundled を使用します。
codex debug prompt-input
モデルに渡されるプロンプト入力のリストを、そのまま JSON 形式で出力します。指示の検出、セッションのコンテキスト、プロンプトの組み立てをデバッグする際に使用します。
| 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
Codex Cloud のチャットで作成した最新の差分をローカルリポジトリに適用します。認証が済んでおり、そのチャットへのアクセス権があることが必要です。
| Key | Type / Values | Details |
|---|---|---|
TASK_ID | string | Identifier of the Codex cloud chat whose diff should be applied. |
TASK_IDstringCodex はパッチを適用したファイルを表示します。競合などで git apply が失敗した場合は、ゼロ以外の終了コードを返します。
codex review
コードレビューを非対話形式で実行します。レビュー対象を 1 つだけ選ぶか、独自のレビュー指示をプロンプトとして渡してください。
| 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、独自の PROMPT は互いに併用できません。--title は --commit と組み合わせる場合にのみ使用してください。
codex archive と codex unarchive
保存済みの対話セッションを、セッション ID またはセッション名で指定してアーカイブまたは復元します。チャット履歴を削除せずにセッションの選択画面を整理したい場合に使用します。セッション名よりセッション ID が優先されます。
セッションをアーカイブまたは復元すると、Codex は、そのセッションから起動したサブエージェントのセッションと、そこからさらに派生したセッションについても、同じ操作を試みます。
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
保存済みの対話セッションを、セッション ID またはセッション名で指定して完全に削除します。アクティブなセッションの一覧から非表示にするだけでなく、履歴そのものを削除したい場合にのみ使用してください。
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 name--force はセッションの UUID と組み合わせる場合にのみ使用してください。名前で指定した場合は必ず確認が求められます。名前が重複している場合や対象が曖昧な場合に、Codex が確認なしに削除することを防ぐためです。
codex cloud
ターミナルから Codex Cloud のチャットを操作します。デフォルトでは対話型の選択画面が開きます。codex cloud exec はタスクを直接送信し、codex cloud list は最近のチャットを返します。スクリプトでの処理や簡単な確認に利用できます。
| 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.QUERYstring認証には CLI 本体と同じ認証情報を使用します。タスクの送信に失敗した場合、Codex はゼロ以外の終了コードを返します。
codex cloud list
最近のクラウドチャットを一覧表示します。必要に応じて絞り込みやページ分割を指定できます。
| 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-20プレーンテキスト形式では、タスクの URL に続いてステータスの詳細が表示されます。自動処理には --json を使用してください。JSON ペイロードには tasks 配列が含まれ、必要に応じて cursor 値も含まれます。各タスクには id、url、title、status、updated_at、environment_id、environment_label、summary、is_review、attempt_total が含まれます。
codex completion
シェルの補完スクリプトを生成し、出力を適切な場所にリダイレクトします。たとえば、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
サポートに問題を報告する前や、インストールした Codex が正常に動作しない原因を調べる際に、ローカルで診断レポートを生成します。インストール、設定、認証、ランタイム、Git、ターミナル、App Server、スレッド一覧の状態を確認できます。
| 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. |
--network-only | boolean | Limit checks to configuration, the network environment, provider HTTP connectivity, and Responses WebSocket connectivity. |
--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--network-onlyboolean--no-colorboolean--summarybooleancodex features
$CODEX_HOME/config.toml に保存されている機能フラグを管理します。enable と disable は変更を保存するため、以降のセッションにも適用されます。features サブコマンドには --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
スクリプトや CI など、人の操作なしで完了させたい処理には codex exec(短縮形は codex e)を使用します。
| Key | Type / Values | Details |
|---|---|---|
--approve-for-me, --not-so-yolo | boolean | Use automatic approval review with on-request approvals and the workspace-write sandbox. Conflicts with --sandbox and --yolo; the interactive CLI also rejects --ask-for-approval. |
--cd, -C | path | Set the workspace root before executing the task. |
--color | always | never | auto | Control ANSI color in stdout. |
--cyber-access-program | standard | daybreak_blue | daybreak_red | Request a cyber access program for this turn (experimental, OpenAI provider only). Requires access for the account and model. Unavailable with review. A fork requires a prompt. |
--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. |
--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 | Path to a JSON Schema for the model's final response. |
--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). |
--thread-source | SOURCE | Set the source label for a new or forked thread. Resuming a thread keeps its original label. |
--worktree | boolean | Run a new or forked session in a managed Git worktree. Requires local execution; can't be combined with resume, review, --ephemeral, or --ignore-user-config. |
-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. |
--approve-for-me, --not-so-yolobooleanon-request approvals and the workspace-write sandbox. Conflicts with --sandbox and --yolo; the interactive CLI also rejects --ask-for-approval.--cd, -Cpath--coloralways | never | auto--cyber-access-programstandard | daybreak_blue | daybreak_red--dangerously-bypass-approvals-and-sandbox, --yoloboolean--dangerously-bypass-hook-trustboolean--ephemeralboolean--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--thread-sourceSOURCE--worktreebooleanresume, review, --ephemeral, or --ignore-user-config.-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 はデフォルトで整形済みのテキストを出力します。--json を追加すると、状態が変化するたびに JSON イベントが 1 行ずつ出力されます。必要に応じて resume サブコマンドで非対話型タスクを再開できます。現在の作業ディレクトリの最新セッションを選ぶには --last を使用します。すべてのセッションを対象に検索するには --all を追加します。
| 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 chat 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 exec fork <SESSION_ID> [PROMPT] を使うと、保存済みのセッションを新しいセッションにコピーできます。セッションの引数には UUID または名前を指定できます。プロンプトを省略すると、Codex はターンを開始せずにフォークを作成します。標準入力からプロンプトを読み込むには - を渡し、画像を添付するには --image を追加します。
画像、--output-schema、--output-last-message、--ephemeral のいずれかを使用する場合は、プロンプトが必須です。
新規実行時またはフォークして実行する際に --worktree を追加すると、管理対象の Git Worktree が作成されます。
codex exec --worktree "implement the next step"
codex exec fork <SESSION_ID> --worktree "try an alternative approach"--worktree はローカル実行でのみ使用できます。resume、review、--ephemeral、--ignore-user-config とは併用しないでください。
codex execpolicy
execpolicy のルールファイルを保存する前に検証します。codex execpolicy check には --rules フラグを 1 つ以上指定できます(例:~/.codex/rules 配下のファイル)。最も厳しい判定と、一致したルールが JSON 形式で出力されます。出力を整形するには --pretty を追加します。execpolicy コマンドは現在プレビュー段階です。
| 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
ChatGPT アカウント、API キー、またはアクセストークンを使って CLI の認証を行います。フラグを指定しない場合、Codex はブラウザを開いて ChatGPT の OAuth 認証を開始します。
| 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 は、認証情報が存在すると終了コード 0 を返すため、自動化スクリプトで認証状態を確認できます。
codex logout
API キー認証と ChatGPT 認証の両方について、保存済みの認証情報を削除します。このコマンドにフラグはありません。
codex mcp
~/.codex/config.toml に保存されている MCP サーバー(Model Context Protocol)の登録情報を管理します。
| 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] [--no-browser] [--oauth-client-registration auto|cimd|dcr] | Sign in to a streamable HTTP server that supports OAuth. With --no-browser, open the printed URL in a browser and paste the full redirect URL into the CLI. |
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,scope2] [--no-browser] [--oauth-client-registration auto|cimd|dcr]--no-browser, open the printed URL in a browser and paste the full redirect URL into the CLI.logout <name>remove <name>add サブコマンドは、標準入出力とストリーミング可能な HTTP の両方のトランスポートに対応しています。
| 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 操作(login、logout)は、ストリーミング可能な HTTP サーバーで、そのサーバーが OAuth に対応している場合にのみ使用できます。
codex plugin
設定済みのマーケットプレイスのプラグインをインストール、一覧表示、削除します。
| 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 は pluginId、name、marketplaceName、version、installedPath、authPolicy を出力します。codex plugin list --json は installed 配列と available 配列を出力します。各エントリには pluginId、name、marketplaceName、version、installed、enabled、source、installPolicy、authPolicy が含まれます。取得できる場合は、設定済みのマーケットプレイスのソースの種類と値を示す marketplaceSource も含まれます。codex plugin remove --json は pluginId、name、marketplaceName を出力します。
codex plugin marketplace
Codex がプラグインを参照してインストールできるマーケットプレイスのソースを管理します。
| 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 には、owner/repo や owner/repo@ref などの GitHub の短縮表記、HTTP または HTTPS の Git URL、SSH の Git URL、ローカルのマーケットプレイスのルートディレクトリを指定できます。Git の参照を固定するには --ref を使用します。Git で管理されているマーケットプレイスのリポジトリでスパースチェックアウトを使うには、対象のパスごとに --sparse PATH を指定します。
codex plugin marketplace list は、対象範囲内のマーケットプレイスの名前とルートを表示します。自動検出されたデフォルトのマーケットプレイスや、設定済みのマーケットプレイスのスナップショットも含まれます。
マーケットプレイスの追加、一覧表示、アップグレード、削除の各コマンドに --json を追加すると、自動処理に適した形式で出力されます。追加時の JSON には marketplaceName、installedRoot、alreadyAdded が含まれます。一覧表示では marketplaces 配列に name、root、任意の marketplaceSource が含まれます。アップグレード時には selectedMarketplaces、upgradedRoots、errors が、削除時には marketplaceName と installedRoot が含まれます。
codex mcp-server
codex mcp-server コマンドと単体の codex-mcp-server バイナリは削除されました。代わりに Codex App Server を使用してください。
codex resume
ID を指定して対話セッションを再開するか、直近のチャットを再開します。codex resume で --last を指定した場合、検索対象は現在の作業ディレクトリに限定されます。--all を指定するとこの制限が解除されます。モデルやサンドボックスの設定は上書きできますが、--worktree は指定できません。
現在の作業ディレクトリとセッションに保存されているディレクトリが異なる場合、Codex はどちらを使うか確認します。毎回確認せずに同じ選択を適用するには、tui.resume_cwd を "current" または "session" に設定します。明示的に --cd(-C)を指定した場合は、tui.resume_cwd よりも優先されます。
| 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 chat 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
以前の対話セッションをフォークして新しいチャットを作成します。デフォルトでは codex fork でセッションの選択画面が開きます。現在のディレクトリの最新セッションをフォークするには --last を使用します。すべてのディレクトリを対象に最新セッションをフォークするには --last --all を使用します。
現在の作業ディレクトリとセッションに保存されているディレクトリが異なる場合、codex fork でも、作業ディレクトリの確認方法と tui.resume_cwd の扱いは codex resume と同じです。
| 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 chat 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.管理対象の Git Worktree にフォークするには、codex fork <SESSION_ID> --worktree を実行します。セッション ID を明示し、ローカルで実行する必要があります。--last やセッションの選択画面は使用できません。
codex sandbox
サンドボックスヘルパーを使うと、Codex が内部で使用しているポリシーを適用してコマンドを実行できます。
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 のサンドボックス
| 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 with bubblewrap filesystem isolation and seccomp filtering. 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--.従来の Windows サンドボックスを削除する前に、それを使用しているアプリを停止してください。サンドボックスのプロビジョニングサービスがインストールされている場合は、そのサービスも停止します。その後、管理者として codex sandbox uninstall を実行します。このコマンドは、マシン全体に設定されたサンドボックス用のアカウントとネットワークルールを削除します。Codex のホームディレクトリは、サンドボックスのディレクトリやファイルシステムのアクセス権も含めて保持されます。
codex update
インストール済みのリリースが自己更新に対応している場合、Codex CLI の更新を確認して適用します。デバッグビルドでは、代わりにリリースビルドをインストールするよう案内が表示されます。
フラグの組み合わせと安全に使うためのヒント
- ワークスペース内で完結するローカル作業を無人で実行する場合は、
--sandbox workspace-writeを使用します。専用のサンドボックス VM 内で実行する場合を除き、--dangerously-bypass-approvals-and-sandboxの使用は避けてください。 - Codex に追加のディレクトリへの書き込み権限を与える必要がある場合は、
--add-dirを優先し、--sandbox danger-full-accessの強制は避けてください。 - CI では
--jsonと--output-last-messageを併用すると、機械可読形式の進捗と自然言語による最終要約を取得できます。
対話モードのショートカット
@を入力すると、ワークスペース内のファイルを検索して、そのパスをプロンプトに追加できます。- Up または Down を押すと、履歴から下書きを呼び出せます。
- Ctrl+R でプロンプト履歴を検索し、Enter で一致した項目を使用するか、Escape でキャンセルします。
- Ctrl+ O を押すと、直近の出力が完了した回答をコピーできます。コピーする内容を選ぶには
/copyを実行します。 - 行頭に
!を付けると、現在の承認設定とサンドボックス設定のもとでローカルのシェルコマンドを実行できます。 - Codex の実行中に Tab を押すと、追加のプロンプト、スラッシュコマンド、シェルコマンドを次のターンのキューに追加できます。
- Codex の実行中に Enter を押すと、現在のターンに新しい指示を追加できます。
- コンポーザーが空の状態で Escape を 2 回押すと、前のユーザーメッセージを編集し、そこからチャットをフォークできます。
- Ctrl+C を押すか
/exitを実行すると、セッションを終了します。
関連リソース
- Codex CLI の概要:インストール、アップグレード、使い方のヒント
- 設定の基本:モデルやプロバイダーなどのデフォルト値の保存
- 高度な設定:プロファイル、プロバイダー、サンドボックスの調整、外部連携
- AGENTS.md:Codex エージェントの機能の概要とベストプラクティス
スラッシュコマンドを使うと、キーボードからすばやく Codex を操作できます。コンポーザーに / を入力してポップアップを開き、コマンドを選択してください。ターミナルを離れることなく、モデルの切り替え、権限の調整、長いチャットの要約などを実行できます。
このガイドでは、次の操作を説明します。
- タスクに適した組み込みスラッシュコマンドの検索
/model、/fast、/permissions、/approve、/raw、/agents、/subagents、/statusなどを使ったアクティブなセッションの操作
組み込みスラッシュコマンド
Codex には以下のコマンドが組み込まれています。スラッシュコマンドのポップアップを開いてコマンド名を入力すると、一覧を絞り込めます。
チャットの実行中は、スラッシュコマンドを入力して Tab を押すと、次のターンのキューに追加できます。Codex がキュー内のスラッシュコマンドを解析するのは実行時です。そのため、コマンドのメニューやエラーは現在のターンが終了した後に表示されます。キューに追加する前でもコマンド名の補完は使えます。
| コマンド | 用途 | 使用場面 |
|---|---|---|
/permissions |
Codex が事前確認なしで実行できる操作を設定します。 | セッション中に自動と読み取り専用を切り替えるなど、承認要件を緩和または強化したい場合。 |
/ide |
開いているファイルや選択範囲など、IDE のコンテキストを取り込みます。 | IDE で開いている内容を説明し直さずに、次のプロンプトに取り込みたい場合。 |
/config |
ターミナルの設定を検索、変更します。 | テーマ、通知、キーボードショートカット、テキスト選択の設定を変更したい場合。 |
/keymap |
TUI のキーボードショートカットの割り当てを変更します。 | 独自のキー割り当てを確認し、config.toml に保存したい場合。 |
/vim |
コンポーザーの Vim モードを切り替えます。 | Vim のノーマルモードと挿入モードを使う編集方式と、コンポーザーのデフォルトの編集方式を切り替えたい場合。 |
/setup-default-sandbox |
昇格した権限を使うエージェント用サンドボックスを設定します(Windows のみ)。 | Codex から権限昇格を伴うセットアップを案内された際に、機能が制限された Windows サンドボックスを置き換えたい場合。 |
/agents |
エージェントのコマンドセンターを開きます。 | 接続先サーバーのチャットを一覧表示し、エージェントを切り替えたい場合。 |
/subagents |
アクティブなサブエージェントのスレッドを切り替えます。 | 現在のセッションからサブエージェントの作業を確認または続行したい場合。 |
/apps |
アプリ(コネクタ)を参照し、プロンプトに挿入します。 | Codex にアプリの使用を依頼する前に、$app-slug として添付したい場合。 |
/plugins |
インストール済みのプラグインや、新たに見つけられるプラグインを一覧表示します。 | プラグインのツールの確認、推奨プラグインのインストール、利用できるプラグインの管理を行いたい場合。 |
/hooks |
ライフサイクルフックを表示、管理します。 | 設定済みのフックを確認する、新規または変更されたフックを信頼する、管理対象外のフックを実行前に無効にするといった場合。 |
/clear |
ターミナルをクリアし、新しいチャットを開始します。 | 画面表示とチャットのコンテキストをまとめてリセットしてやり直したい場合。 |
/rename |
現在のチャットの名前を変更します。 | TUI から保存済みのセッションに見分けやすい名前を付けたい場合。 |
/archive |
現在のセッションをアーカイブします。 | 履歴を削除せずに、アクティブなセッションの一覧から現在のセッションを外したい場合。 |
/delete |
現在のセッションを完全に削除します。 | アーカイブでは不十分で、履歴とそこから派生したセッションを削除したい場合。 |
/compact |
表示中のチャットを要約し、トークンの空きを確保します。 | 長時間の実行後、要点を残しながらコンテキストウィンドウの上限に達するのを避けたい場合。 |
/copy |
回答、コードブロック、引用をコピーします。 | Ctrl+ O を押すと、メニューを開かずに、出力が完了した最新の回答をコピーできます。 |
/diff |
Git の未追跡ファイルも含めて差分を表示します。 | コミットやテスト実行の前に Codex の編集内容を確認したい場合。 |
/exit |
CLI を終了します(/quit と同じ)。 |
別名のコマンドです。どちらもセッションを終了します。 |
/experimental |
実験的機能の有効・無効を切り替えます。 | ネットワークプロキシや、実行中のスリープ防止などを有効にしたい場合。 |
/approve |
直近の自動レビューで拒否された操作の再試行を 1 回承認します。 | 自動レビューで拒否されたコマンドや操作を再試行したい場合。 |
/memories |
メモリの使用と生成を設定します。 | TUI からメモリの取り込みや生成の有効・無効を切り替えたい場合。 |
/skills |
スキルを参照して使用します。 | 関連するローカルのスキルを選んで、タスクに合わせて動作を改善したい場合。 |
/import |
Claude Code または Cursor の設定、プロジェクト、チャットをインポートします。 | 対応している外部エージェントのデータを Codex の設定とローカルファイルに移行したい場合。 |
/feedback |
Codex のメンテナーにログを送信します。 | 問題を報告したり、診断情報をサポートに共有したりしたい場合。 |
/init |
現在のディレクトリに AGENTS.md のひな形を生成します。 |
作業中のリポジトリやサブディレクトリで継続的に適用する指示を記録したい場合。 |
/logout |
Codex からサインアウトします。 | 共有マシンでローカルの認証情報を消去したい場合。 |
/mcp |
設定済みの Model Context Protocol(MCP)ツールを一覧表示します。 | セッション中に Codex が呼び出せる外部ツールを確認したい場合。verbose を追加するとサーバーの詳細も表示されます。 |
/mention |
チャットにファイルを添付します。 | 次に確認してほしいファイルやフォルダーを Codex に指定したい場合。 |
/model |
使用するモデルと、設定可能な場合は推論強度を選択します。 | gpt-6-luna または gpt-6.1-sol が表示されていれば選択できます。 |
/presets |
プロンプトやスラッシュコマンドを保存して実行します。 | よく使うコマンドやプロンプトを呼び出したい場合。 |
/fast |
モデルカタログで提供されている場合、Fast サービスティアを切り替えます。 | 現在のモデルの Fast ティアの有効・無効を切り替え、その選択を保存したい場合。 |
/daybreak |
アカウントとモデルが利用条件を満たす場合に、Daybreak の有効・無効を切り替えます。 | 利用が承認されたサイバーセキュリティ向けアクセスプログラムをチャットで使いたい場合。 |
/voice |
音声会話が利用可能な場合に、会話を開始または停止します。 | 音声に対応したターミナルビルドで Codex と話したい場合。 |
/plan |
プランモードに切り替え、必要に応じてプロンプトを送信します。 | 実装を始める前に Codex に実行計画を提案してほしい場合。 |
/goal |
タスクの目標を設定、編集、一時停止、再開、表示、削除します。 | 大きなタスクの実行中に、Codex が継続して追跡する目標を与えたい場合。 |
/ps |
バックグラウンド ターミナルと直近の出力を表示します。 | メインのチャット履歴を離れずに、長時間実行されているコマンドを確認したい場合。 |
/stop |
すべてのバックグラウンド ターミナルを停止します。 | 現在のセッションが開始したバックグラウンド ターミナルの処理をキャンセルしたい場合。 |
/fork |
現在のチャットをフォークして新しいチャットを作成します。 | 現在の履歴を残してアクティブなセッションを分岐させ、別の方法を試したい場合。 |
/app |
現在のセッションを ChatGPT デスクトップアプリで続行します。 | macOS または Windows で TUI からデスクトップアプリに移りたい場合。 |
/side, /btw |
一時的なサイドチャットを開始します。 | メインのチャット履歴に影響を与えずに、特定の点について追加で質問したい場合。 |
/raw |
生の出力を使うスクロールバックモードを切り替えます。 | 長い出力を確認する際に、ターミナルの書式の影響を抑えて選択やコピーをしたい場合。 |
/resume |
セッション一覧から保存済みのチャットを再開します。 | 最初からやり直さずに、以前の CLI セッションの作業を続けたい場合。 |
/new |
同じ CLI セッション内で新しいチャットを開始します。 | 同じリポジトリで新たに指示を出すために、CLI を終了せずにチャットのコンテキストをリセットしたい場合。 |
/quit |
CLI を終了します。 | すぐにセッションを終了したい場合。 |
/review |
作業ツリーのレビューを Codex に依頼します。 | Codex が作業を終えた後や、ローカルの変更を別の視点から確認したい場合。 |
/status |
セッションの設定とトークン使用量を表示します。 | 使用中のモデル、承認ポリシー、書き込み可能なルート、コンテキストの残り容量を確認したい場合。 |
/usage |
アカウントのトークン使用状況を表示するか、レート制限のリセットを使用します。 | TUI から ChatGPT のトークン使用状況を日別、週別、累計で確認したい場合。 |
/debug-config |
設定レイヤーと要件の診断情報を出力します。 | 実験的なネットワーク制約を含め、優先順位やポリシー要件を調査したい場合。 |
/statusline |
TUI のステータス行の項目を対話形式で設定します。 | フッターに表示するモデル、コンテキスト、制限、Git、トークン、セッションの項目を選び、並べ替えて config.toml に保存したい場合。 |
/title |
ターミナルのウィンドウやタブのタイトル項目を対話形式で設定します。 | プロジェクト、ステータス、スレッド、ブランチ、モデル、タスクの進捗などの項目を選んで並べ替えたい場合。 |
/theme |
シンタックスハイライトのテーマを選択します。 | ターミナルのシンタックスハイライトのテーマをプレビューし、選択を保存したい場合。 |
/pets, /pet |
ターミナルのペットを選択するか、非表示にします。 | 組み込みまたはカスタムのペットを表示して TUI を自分好みにしたい場合。 |
/tui |
次回の起動時に使用するターミナルモードを選択します。 | ターミナルのスクロールバック表示と履歴の全画面表示を切り替えたい場合。 |
/export |
会話を Markdown 形式でエクスポートします。 | 履歴全体をファイルに保存するか、クリップボードにコピーしたい場合。 |
/recap |
現在の会話の要約を生成します。 | コンテキストを圧縮せずにチャットの経緯を把握したい場合。 |
/cd |
セッションの作業ディレクトリを変更します。 | 待機中のメインチャットを別のディレクトリで続けたい場合。 |
/pwd, /cwd |
作業ディレクトリを表示します。 | アクティブなセッションが使用しているディレクトリを確認したい場合。 |
/worktree |
管理対象の Git Worktree でチャットを開始または続行します。 | ローカルリポジトリの別のチェックアウトで作業したい場合。 |
/daemon |
バックグラウンドサーバーの操作画面を開きます。 | 接続を確認し、Codex が所有するローカルサーバーを管理したい場合。 |
/warnings |
保存されている警告と診断情報を表示します。 | セッション中に表示された警告を再確認したい場合。 |
/quit と /exit はどちらも CLI を終了します。重要な作業を保存またはコミットしてから使用してください。
Codex が事前確認なしで実行できる操作を調整するには /permissions を使用します。/approve は、自動レビューで拒否された直近の操作を再試行する必要がある場合にのみ使用してください。
スラッシュコマンドによるセッション操作
以下の操作を使うと、Codex を再起動せずにセッションの進め方を調整できます。
/config によるターミナル設定の変更
/config を入力すると、ターミナルの設定画面が開きます。設定はグループ別に確認できます。検索するには / を押します。変更は Codex が自動的に保存します。
/tui によるターミナルモードの選択
/tuiを入力します。- スクロールバックモードまたは全画面モードを選択し、確定します。
- Codex を再起動して選択を適用します。
結果:次回の起動時に、保存したターミナルモードが使用されます。--no-alt-screen など、起動時に指定する上書きオプションは引き続き適用されます。
/export による会話のエクスポート
/exportを入力します。- クリップボードにコピーまたはファイルに保存を選択します。
結果:Codex が会話全体を Markdown 形式でエクスポートします。直接ファイルに保存するには /export session.md を実行します。現在のターンが終了してからエクスポートしてください。
/recap によるチャットの要約
- Codex が待機中に
/recapを入力します。
結果:tui.auto_recap = false の場合でも、Codex が会話の要約を生成します。コンテキストに空きを作りたい場合は /compact を使用します。
/cd によるディレクトリの変更
/pwd(または/cwd)を入力して現在のディレクトリを確認します。- ディレクトリを変更するには
/cd <path>を、ホームディレクトリに移動するには/cdを入力します。
結果:選択したディレクトリでチャットが続行されます。ディレクトリを変更できるのは、メインセッションが待機中で、キュー内の入力もバックグラウンド ターミナルもない場合に限ります。
/worktree による Worktree での作業の続行
- ローカルの Git リポジトリで
/worktreeを入力します。 - 新しい Worktree で新しいチャットを開始するか、現在の会話を続けるかを選択します。
結果:Codex が管理対象の Git Worktree を作成し、そこで選択したチャットを開始します。既存の Worktree と、それぞれを所有するチャットを探すには、Worktree を参照を選択します。このコマンドにはローカルでの Worktree サポートが必要です。タスクの実行中は使用できません。
/daemon によるバックグラウンドサーバーの管理
/daemonを入力します。- サーバーの接続状況と実行可能な操作を確認します。
結果:ローカルのバックグラウンドサーバーに最新の一般公開安定版をインストールするか、現在の CLI ビルドを使用するかを選べます。更新を確定すると Codex が終了するため、進行中の作業が中断される場合があります。管理対象のローカルサーバーを再起動するには、バックグラウンドサーバーを再起動を選択して確定します。Codex は自動的に再接続します。再起動により、他のチャットで実行中の作業やキューに追加されている作業が中断される場合があります。リモート接続の場合は、サーバーが動作するホスト上で管理してください。
/warnings による警告の確認
/warningsを入力します。
結果:保存されている警告と、各警告の詳しい診断情報が表示されます。
/model による使用モデルの設定
選択画面には、利用中のアカウントとワークスペースで使用できるモデルのみが表示されます。GPT-6.1 Sol が一覧にない場合は、別のモデルを選択してください。プラン別の GPT-6.1 Sol の提供状況を参照してください。
- Codex を起動し、コンポーザーを開きます。
/modelを入力し、Enter キーを押します。- ポップアップから
gpt-6-lunaやgpt-6.1-solなどのモデルを選択します。
結果:新しいモデルがチャット履歴に表示されます。/status を実行して変更を確認してください。
現在のセッションの設定を直接変更するには、/model [model] [--reasoning=<level>] [--speed=<tier>] を使用します。たとえば、/model --reasoning=high は現在のモデルを維持し、そのモデルが対応していれば推論強度を「高」に設定します。
/presets によるプロンプトとコマンドの再利用
/presets を入力して n を押すと、番号付きのスロットにプロンプトやスラッシュコマンドを保存できます。 s を押すと、現在のモデル、権限、ターミナルのタイトル、ステータス行の設定からプリセットを作成できます。保存したプリセットを実行するには、/presets を開き、その番号を押します。
/fast による Fast モードの切り替え
/fastを入力して、現在のモデルの Fast サービスティアを有効にします。- もう一度
/fastを入力すると無効になります。
結果:Codex がティアを切り替え、選択を保存します。/statusline を使うと、TUI のフッターのステータス行に Fast モードの項目を表示することもできます。
Fast ティアのコマンドはモデルカタログに基づいて表示されます。現在のモデルに Fast ティアの記載がなければ、/fast は表示されません。
Daybreak の切り替え
OpenAI プロバイダーを使用しており、アカウントとモデルの両方で Daybreak を利用できる場合は、/daybreak で Daybreak の有効・無効を切り替えられます。Codex は選択を現在のチャットに適用し、今後のチャットのデフォルトとして保存します。
/voice による Codex との音声会話
使用中の CLI ビルドとセッションが音声に対応している場合、/voice または F8 で音声会話を開始または停止できます。マイクのオン・オフを切り替えるには /voice mute を、会話を終了するには /voice stop を使用します。今後の会話で使用する音声は /voice settings で選択できます。
/plan によるプランモードへの切り替え
/planを入力して Enter キーを押すと、アクティブなチャットがプランモードに切り替わります。- 必要に応じて、同じ行にプロンプトを入力します。たとえば、このサービスの移行計画を提案してほしい場合は
/plan Propose a migration plan for this serviceと入力します。 /planの引数を同じ行に指定する場合でも、内容を貼り付けたり画像を添付したりできます。
結果:Codex がプランモードに入り、同じ行にプロンプトを指定した場合は、それを最初の計画作成依頼として使用します。
Codex がすでに作業を実行している間は、一時的に /plan を使用できません。
/goal によるタスク目標の設定と確認
/goal <objective>を入力して目標を設定します。たとえば、テストが通る状態を保ちながら移行を完了するには/goal Finish the migration and keep tests greenと入力します。/goalを入力して現在の目標を確認します。- 目標を変更するには
/goal editを使用します。一時停止、再開、削除には、それぞれ/goal pause、/goal resume、/goal clearを使用します。
結果:作業を続けている間も、アクティブなチャットに目標が保持されます。
目標は空にできず、上限は 4,000 文字です。指示が長い場合は詳細をファイルに記載し、目標でそのファイルを参照してください。
/experimental による実験的機能の切り替え
/experimentalを入力し、Enter キーを押します。- ネットワークプロキシや実行中のスリープ防止など、必要な機能の有効・無効を切り替えます。再起動を求められた場合は Codex を再起動します。
結果:機能の選択が設定に保存され、再起動時に適用されます。
/approve による自動レビューで拒否された操作の再試行の承認
直近の操作が自動レビューで拒否され、Codex にその操作を 1 回再試行させたい場合は /approve を使用します。
/approveを入力します。- 拒否された対象の操作が表示されたら、再試行を確定します。
結果:Codex は現在のセッションポリシーに従って、拒否された操作を 1 回再試行します。
/memories によるメモリの設定
/memoriesを入力します。- 既存のメモリを使用するか、新しいメモリを生成するか、メモリ機能を無効のままにするかを選択します。
結果:Codex が以降のセッションに適用されるメモリ設定を更新します。
/skills によるスキルの使用
/skillsを入力します。- Codex に適用させたいスキルを選択します。
結果:選択したスキルのコンテキストが挿入され、次のリクエストはそのスキルの指示に従って処理されます。
/import による Claude Code または Cursor の設定のインポート
/importを入力します。- Claude Code または Cursor を選択します。
- 移行したい設定、プロジェクトファイル、最近のチャットを選択します。
Codex は過去 30 日間のチャットを最大 50 件まで検索します。ローカルデーモンまたはリモートサーバーに接続している場合、Codex はそのデーモンまたはサーバーが動作しているマシン上のファイルを読み込んでインポートします。現在のタスクが終了してからインポートを開始してください。
デスクトップアプリでの手順と対応するデータの種類は、別のエージェントからのインポートを参照してください。
/clear によるターミナルのクリアと新規チャットの開始
/clearを入力し、Enter キーを押します。
結果:ターミナルがクリアされ、表示中の履歴がリセットされます。同じ CLI セッションで新しいチャットが開始されます。
作成時に新しいチャットに名前を付けるには、/clear release prep のように実行します。
Ctrl+L と異なり、/clear は新しいチャットを開始します。
Ctrl+L はターミナルの表示だけをクリアし、現在のチャットを維持します。タスクの実行中はどちらの操作も無効になります。
/archive による現在のセッションのアーカイブ
/archiveを入力し、Enter キーを押します。- 現在のセッションをアーカイブすることを確認します。
結果:セッションがアーカイブされます。ローカルのバックグラウンドサーバーまたはリモートサーバーに接続している場合は、コマンドセンターに戻ります。共有サーバーを使っていない場合は Codex が終了します。履歴は保持されるので、後から codex unarchive <SESSION> で復元できます。
ターンの実行中に /archive を確定すると、そのターンを停止してからアーカイブします。
/delete による現在のセッションの削除
/deleteを入力し、Enter キーを押します。- 現在のセッションを削除することを確認します。
結果:チャット履歴と、そこから派生したすべてのセッションが完全に削除されます。ローカルのバックグラウンドサーバーまたはリモートサーバーに接続している場合は、コマンドセンターに戻ります。共有サーバーを使っていない場合は Codex が終了します。
チャットの実行中やサイドチャット内では /delete を使用できません。
/permissions による権限の変更
/permissionsを入力し、Enter キーを押します。- どこまで操作を任せるかに応じて承認プリセットを選択します。たとえば、操作を任せるには
Auto、編集内容を確認するにはRead Onlyを選択します。名前付きの権限プロファイルが有効な場合は、設定済みのカスタムプロファイルとその説明も選択画面に表示されます。
このセッションで使うプロファイルを ID で指定するには、/permissions <profile-id> [--approval-policy=<policy>] [--reviewer=user|auto_review] を使用します。たとえば、/permissions :workspace --approval-policy=on-request --reviewer=user はワークスペースへのアクセスを選択し、設定で許可されている場合に承認リクエストをユーザー本人に送ります。
/ide による IDE コンテキストの取り込み
/ideを入力します。- IDE で選択中の内容や開いているファイルに対して Codex に行ってほしい操作があれば、同じ行に入力します。
結果:利用可能な IDE コンテキストが次のプロンプトに含まれます。
/vim による Vim モードの切り替え
/vimを入力します。- コンポーザーで編集を続けます。
結果:現在のセッションで、コンポーザーの Vim モードが切り替わります。新しいセッションでも Vim モードをデフォルトにするには、tui.vim_mode_default = true を config.toml に設定します。
/setup-default-sandbox による権限昇格を伴う Windows サンドボックスの設定
このコマンドは、Windows で Codex が制限付きトークンによる機能の限られたサンドボックスを使用している場合にのみ表示されます。
/setup-default-sandboxを入力します。- 管理者権限でのセットアップ手順に従います。
結果:Codex が昇格した権限を使う Windows サンドボックスを設定し、対応する自動承認プリセットを選択します。
/copy による直近の回答のコピー
スクロールバックモードでは、/copy を入力し、出力が完了した最新の回答から、回答全体、コードブロック、引用のいずれかを選択します。全画面モードでは、チャット履歴内のブロックを選択します。Enter を押すと、選択した内容がコピーされます。
/status の実行後に /copy を使うと、ステータス全体または個別の項目をコピーできます。出力が完了した最新の回答を直接コピーするには、Ctrl+ O を押します。
/raw による生のスクロールバック表示の切り替え
/raw、/raw on、/raw offのいずれかを入力します。
結果:生の出力を使うスクロールバックモードが切り替わり、ターミナル上で出力を直接選択してコピーしやすくなります。デフォルトのキー割り当て Alt+R でも切り替えられます。tui.raw_output_mode = true を設定すると、このモードをデフォルトとして保存できます。
/status によるセッションの確認
- 任意のチャットで
/statusを入力します。 - 出力を確認し、使用中のモデル、承認ポリシー、書き込み可能なルート、現在のトークン使用量を把握します。TUI がリモート接続している場合は、接続先のアドレスとサーバーのバージョンも表示されます。
結果:セッションの概要が表示され、Codex が意図した環境で動作しているかを確認できます。
/usage によるアカウント使用状況の確認
/usageを入力して使用状況メニューを開きます。- トークン使用状況を表示するか、獲得済みのリセットのうち利用可能なものを使用するかを選択します。
- トークン使用状況を直接表示するには、
/usage daily、/usage weekly、/usage cumulativeのいずれかを入力します。
結果:使用状況に関する操作画面が開くか、選択した期間のアカウントのトークン使用状況が表示されます。セッションで Codex サービスのアカウント認証が済んでいない場合は、サインインが必要であることが表示されます。
/debug-config による設定レイヤーの確認
/debug-configを入力します。- 出力で、設定レイヤーの順序(優先順位の低い順)、有効・無効の状態、ポリシーの適用元を確認します。
結果:レイヤーの診断情報とともに、設定されている場合は allowed_approval_policies、allowed_sandbox_modes、mcp_servers、rules、network_proxy などのポリシーの詳細が出力されます。
実際に適用された設定が config.toml の内容と異なる理由を調べる際に、この出力を利用できます。
/statusline によるフッター項目の設定
/statuslineを入力します。- 選択画面で項目の表示・非表示を切り替え、順序を変更して確定します。
結果:フッターのステータス行がすぐに更新され、設定が tui.status_line として config.toml に保存されます。
表示できる項目には、モデル、モデルと推論の組み合わせ、コンテキストの統計、レート制限、Git ブランチ、トークン数、セッション ID、現在のディレクトリ/プロジェクトルート、Codex のバージョンがあります。
このセッションに限ってフッターを設定するには、項目を表示したい順に指定します。たとえば、/statusline model project-name では、モデルの後にプロジェクト名が表示されます。このセッションですべての項目を非表示にするには /statusline --clear を使用します。
/title によるターミナルのタイトル項目の設定
/titleを入力します。- 選択画面で項目の表示・非表示を切り替え、順序を変更して確定します。
結果:ターミナルのウィンドウまたはタブのタイトルがすぐに更新され、設定が tui.terminal_title として config.toml に保存されます。
表示できる項目には、アプリ名、プロジェクト、スピナー、ステータス、スレッド、Git ブランチ、モデル、タスクの進捗があります。
このセッションに限ってタイトルを設定するには、項目を表示したい順に指定します。たとえば、/title project-name model では、プロジェクト名の後にモデルが表示されます。このセッションのタイトル項目をすべて消去するには /title --clear を使用します。
/theme によるシンタックスハイライトのテーマ選択
/themeを入力します。- 選択画面でテーマをプレビューし、確定します。
結果:シンタックスハイライトが更新され、選択したテーマが tui.theme として config.toml に保存されます。
/pets によるターミナルのペットの選択
/pets(または/pet)を入力してペットの選択画面を開きます。- 組み込みまたはカスタムのペットを選択するか、ペットを無効にします。
結果:対応するターミナルに選択したペットが表示され、選択内容が保存されます。/pets off と入力して非表示にすることもできます。
/keymap による TUI ショートカットの再割り当て
/keymap では、TUI のキーボードショートカットの割り当てを確認、変更、保存できます。
/keymapを入力します。- 変更したいショートカットの適用先と操作を選択します。
- 新しいキー割り当てを入力するか、既存の割り当てを削除します。
結果:使用中のキーマップが更新され、独自の割り当てが tui.keymap として config.toml に書き込まれます。
キー割り当てには ctrl-a、shift-enter、page-down などの名前を使用します。個別のコンテキストに指定した割り当ては tui.keymap.global より優先されます。割り当てのリストを空にすると、その操作のキー割り当てが解除されます。
/ps によるバックグラウンド ターミナルの確認
/psを入力します。- バックグラウンド ターミナルの一覧とそれぞれの状態を確認します。
結果:各バックグラウンド ターミナルのコマンドと、空行を除いた直近の出力が最大 3 行表示されるので、進捗をひと目で把握できます。
バックグラウンド ターミナルが表示されるのは unified_exec の使用時です。それ以外の場合は一覧が空になることがあります。
/stop によるバックグラウンド ターミナルの停止
/stopを入力します。- 一覧にあるターミナルを停止する前に確認を求められた場合は、停止を確定します。
結果:現在のセッションのバックグラウンド ターミナルがすべて停止します。/clean も引き続き /stop の別名として使用できます。
/compact によるチャット履歴の圧縮
- やり取りが長くなったら
/compactを入力します。 - これまでのチャットを要約するか確認されたら、確定します。
結果:過去のターンが簡潔な要約に置き換わり、重要な情報を保持しながらコンテキストに空きができます。
/diff による変更内容の確認
/diffを入力して Git の差分を確認します。- CLI 内で出力をスクロールし、編集内容と追加されたファイルを確認します。
結果:ステージ済みの変更、未ステージの変更、Git の未追跡ファイルが表示され、どの変更を残すか判断できます。
/mention によるファイルの指定
/mentionに続けてパスを入力します。例:/mention src/lib/api.ts。- ポップアップから一致する項目を選択します。
結果:ファイルがチャットに追加され、以降のターンで直接参照されます。
/new による新規チャットの開始
/newを入力し、Enter キーを押します。- チェックアウト先の選択を求められた場合は、現在のディレクトリまたは新しい Worktree を選択します。
結果:同じ CLI セッション内で新しいチャットが開始され、ターミナルを離れることなくチャットを切り替えられます。
作成時に新しいチャットに名前を付けるには、/new bug bash のように実行します。
/clear と異なり、/new は新しいチャットを始める前にターミナルの表示をクリアしません。
/rename による現在のチャットの名前変更
/rename <name>を入力するか、/renameを入力して名前の入力画面を開きます。- 後からチャットを見つけやすい短い名前を入力します。
結果:履歴を維持したまま、保存済みのチャット名が更新されます。
/resume による保存済みチャットの再開
/resumeを入力し、Enter キーを押します。- 選択画面で検索範囲を選びます。
Cwdは現在のディレクトリのチャットを表示します。Repoを選べる場合は、これを指定すると、リンクされたローカルの Worktree 内の対応するディレクトリも検索対象に含まれます。Allはディレクトリを横断して検索します。 - 再開したいチャットを選択します。
結果:選択したチャットの履歴が読み込まれ、元の履歴を保持したまま中断したところから作業を続けられます。
/fork による現在のチャットのフォーク
/forkを入力し、Enter キーを押します。- チェックアウト先の選択を求められた場合は、現在のディレクトリまたは新しい Worktree を選択します。
結果:現在のチャットが新しい ID のチャットに複製されます。元の履歴はそのまま残るので、別の方法を並行して試せます。
現在のセッションではなく保存済みのセッションをフォークするには、ターミナルで codex fork を実行してセッションの選択画面を開きます。
/app によるデスクトップアプリでの続行
macOS または Windows で /app を入力すると、現在のセッションが ChatGPT デスクトップアプリで開きます。アプリがインストールされていない場合や起動していない場合は、インストールまたは起動を求めるエラーが表示されます。
結果:同じ保存済みチャットがデスクトップアプリで開き、そこで作業を続けられます。
/side によるサイドチャットの開始
/side を使うと、メインチャットを維持したまま、現在のチャットから一時的なフォークを開始できます。
/sideを入力してサイドチャットを開きます。- 必要に応じて、同じ行に依頼を入力します。たとえば、この計画に明らかなリスクがないか確認するには
/side Check whether this plan has an obvious riskと入力します。 - 個別の質問や作業が済んだら親チャットに戻ります。
結果:親チャットとは別に履歴を持つサイドチャットが開きます。サイドモードでも TUI には親チャットのステータスが表示されるため、メインチャットがまだ実行中かどうかを確認できます。
別のサイドチャット内やレビューモードでは /side を使用できません。
AGENTS.md の生成に使う /init
- 継続的に適用する指示を Codex に探してほしいディレクトリで
/initを実行します。 - 生成された
AGENTS.mdを確認し、リポジトリの規約に合わせて編集します。
結果:AGENTS.md のひな形が作成されます。内容を調整してコミットすると、以降のセッションでも使用できます。
/review による作業ツリーのレビュー依頼
/reviewを入力します。- ファイルの変更内容を詳しく確認したい場合は、続けて
/diffを実行します。
結果:Codex が動作の変更や不足しているテストを中心に、作業ツリーで見つけた問題をまとめます。review_model を config.toml に設定していない場合は、現在のセッションのモデルを使用します。
/mcp による MCP ツールの一覧表示
/mcpを入力します。- 一覧で、使用可能な MCP サーバーとツールを確認します。
結果:設定済みの Model Context Protocol(MCP)ツールのうち、このセッションで Codex が呼び出せるものが表示されます。
サーバーの詳しい診断情報も表示するには /mcp verbose を使用します。アクティブなセッションから設定済みの MCP サーバーにサインインするには /mcp login <name> を使用します。
/apps によるアプリの参照
/appsを入力します。- 一覧からアプリを選択します。
結果:アプリへのメンションが $app-slug としてコンポーザーに挿入され、すぐに Codex にアプリの使用を依頼できます。
/plugins によるプラグインの参照
/pluginsを入力します。- マーケットプレイスのタブを選んでからプラグインを選択し、機能や利用可能な操作を確認します。
結果:プラグインの参照画面が開き、インストール済みのプラグイン、現在の設定で見つけられるプラグイン、インストール済みプラグインの状態を確認できます。インストール済みのプラグインを選んで Space を押すと、有効・無効を切り替えられます。
/hooks によるライフサイクルフックの確認と管理
/hooksを入力します。- フックイベントを選択して、対応するハンドラーを確認します。
- 必要に応じて、管理対象外のフックを信頼するか、無効化または再有効化します。
結果:フックの参照画面が開き、設定済みのライフサイクルフックを確認できます。管理対象のフックにはその旨が表示され、ユーザー向けのフック参照画面からは無効化できません。
/agents によるチャットの管理
/agentsを入力し、Enter キーを押します。- コマンドセンターでチャットを選択して開きます。
結果:接続先サーバーのチャットの一覧が表示されます。各チャットの状態を確認したり、チャットを切り替えたりできます。ターミナルからコマンドセンターを直接開くには codex agents を実行します。コマンドセンターには、共有のローカルサーバーまたはリモートサーバーが必要です。
/subagents によるエージェントスレッドの切り替え
/subagentsを入力し、Enter キーを押します。- 選択画面で目的のスレッドを選択します。
結果:アクティブなスレッドが切り替わり、そのエージェントの作業を確認または続行できます。
/feedback によるフィードバックの送信
/feedbackを入力し、Enter キーを押します。- 画面の案内に従ってログや診断情報を含めます。
結果:Codex が指定された診断情報を収集し、メンテナーに送信します。
/logout によるサインアウト
/logoutを入力し、Enter キーを押します。
結果:現在のユーザーセッションのローカル認証情報が消去されます。
/quit または /exit による CLI の終了
/quit(または/exit)を入力し、Enter キーを押します。
結果:Codex が直ちに終了します。重要な作業は先に保存またはコミットしてください。
以下のコマンドを使うと、VS Code のコマンドパレットから Codex を操作できます。キーボードショートカットに割り当てることもできます。
キー割り当ての設定
Codex コマンドのキー割り当てを設定または変更する手順は次のとおりです。
- コマンドパレットを開きます(macOS では Cmd+Shift+P、Windows/Linux では Ctrl+Shift+P)。
- 基本設定: キーボード ショートカットを開くを実行します。
Codexまたはコマンド ID(例:chatgpt.newChat)を検索します。- 鉛筆アイコンを選択し、使用したいショートカットを入力します。
拡張機能のコマンド
| コマンド | デフォルトのキー割り当て | 説明 |
|---|---|---|
chatgpt.addToThread |
- | 選択したテキスト範囲を現在のチャットのコンテキストに追加します。 |
chatgpt.addFileToThread |
- | ファイル全体を現在のチャットのコンテキストに追加します。 |
chatgpt.newChat |
macOS:Cmd+NWindows/Linux: Ctrl+N |
新しいチャットを作成します。 |
chatgpt.newCodexPanel |
- | 新しい Codex パネルを作成します。 |
chatgpt.openCommandMenu |
- | Codex のコマンドメニューを開きます。 |
chatgpt.openSidebar |
- | Codex のサイドバーパネルを開きます。 |
スラッシュコマンドを使うと、コンポーザーから直接 Codex を操作できます。ステータスの確認、ローカルモードとクラウドモードの切り替え、フィードバックの送信などに使用します。
スラッシュコマンドの使い方
- Codex のコンポーザーに
/を入力します。 - 一覧からコマンドを選択するか、続けて入力して絞り込みます(例:
/status)。 - Enter キーを押します。
利用可能なスラッシュコマンド
| スラッシュコマンド | 説明 |
|---|---|
/approve |
承認リクエストの自動レビューを使用する場合、直近の自動レビューで拒否された操作の再試行を 1 回承認します。 |
/cloud |
クラウド実行を利用できる場合、チャットをクラウドで実行します。 |
/cloud-environment |
チャットのクラウド環境を選択します。 |
/compact |
現在のチャットのコンテキストを圧縮します。 |
/fast |
カタログで Fast サービスティアが提供されている場合に、有効・無効を切り替えます。 |
/feedback |
フィードバックダイアログを開いてフィードバックを送信します。必要に応じてログも含められます。 |
/fork |
ローカルのチャットを新しいローカルチャットにコピーします。 |
/goal |
Codex が継続して取り組む目標を設定します。 |
/ide-context |
IDE コンテキストの自動取り込みの有効・無効を切り替えます。 |
/init |
現在のプロジェクト用に AGENTS.md のひな形を生成します。 |
/local |
ローカルのワークスペースでチャットを実行します。 |
/mcp |
MCP のステータス画面を開き、接続中のサーバーを表示します。 |
/memories |
メモリ機能を利用できる場合、チャットでメモリを使用または生成できるかを設定します。 |
/model |
現在のチャットで使用するモデルを選択します。 |
/plan |
複数のステップにわたる計画を立てるために、プランモードを切り替えます。 |
/project |
新しいチャットのプロジェクトを選択します。 |
/reasoning |
現在のチャットの推論強度を選択します。 |
/review |
コードレビューモードを開始し、未コミットの変更をレビューするか、ベースブランチと比較します。 |
/side |
メインチャットを中断せずに、一時的なサイドチャットを開始します。 |
/status |
チャット ID、コンテキスト使用量、レート制限を表示します。 |
/worktree |
新しい Git Worktree でチャットを実行します。 |