FIELD MANUAL / 18 CLI + 06 ARCHIVE
18本の CLI レッスンと API archive。
完全な primary track と、別番号の API/SDK architecture archive を明確に分離します。
Codex CLI コア
Codex CLI 完全コース
01–18 を順に進み、installation/permissions から automation、Cloud、sandbox policy、diagnostics まで学びます。
- 01 ガイドを読む↗
Foundation / 10 分 / Stable
Codex を導入し、toolchain を証明する
信頼できる Codex workflow は最初の prompt より前に始まります。公式 standalone installer を使い、実際に動く binary と version を確認し、意図的に更新し、config・auth・Git・terminal の問題を codex doctor の evidence で解決します。
- 02 ガイドを読む↗
Foundation / 11 分 / Stable
Credential を漏らさず認証を選ぶ
Codex は subscription access の ChatGPT sign-in と usage-based の API-key sign-in をサポートします。Flow を意図的に選び、secret は stdin で渡し、active method を検証し、local auth storage を password として扱います。
- 03 ガイドを読む↗
Foundation / 12 分 / Stable
最初の terminal session を engineering task にする
有用な最初の session は正しい repository、境界付き permission、goal・context・constraints・done condition を含む prompt から始まります。Codex は探索、編集、checks を行えますが、task boundary は明示する必要があります。
- 04 ガイドを読む↗
Safety / 14 分 / Stable
自律性より先に authority を設定する
Codex security は OS-enforced sandbox と approval policy の組み合わせです。workspace-write + on-request は実用的な local default、read-only は分析向け。web search は spawned command の network access を自動では許可しません。
- 05 ガイドを読む↗
Workflow / 13 分 / Stable
長い CLI session を制御する
Codex CLI は live work の keyboard-first controls と、persisted session の top-level lifecycle commands を提供します。Plan/status/diff/compact/review で現在の作業を制御し、resume、fork、archive、unarchive、永久 delete で保存済み work を明示的に管理します。
- 06 ガイドを読む↗
Repository setup / 15 分 / Stable
AGENTS.md で repository knowledge を永続化する
Codex は作業前に global guidance、repo root から cwd までの project files を結合します。近い guidance が後で override し、各 level では AGENTS.override.md が優先。combined project guidance には default size limit があります。
- 07 ガイドを読む↗
Repository setup / 22 分 / Stable
Model、effort、scope で Codex work を計画する
Model-aware planning は最大 model を選ぶだけではありません。Repository と会話 context を持つ CLI を維持し、task role に model を割り当て、その model が公開する native effort だけを使い、subagent orchestration と single-task depth を分離します。Codex config は scope で解決され、model access は release、account、auth、quota、rollout で変化します。
- 08 ガイドを読む↗
Workflow / 14 分 / Stable
変更を reviewable evidence にする
Codex は実装、checks、working-tree diff、dedicated reviewer を扱えます。Review scope は uncommitted、base branch、commit、custom instruction のいずれか一つ。Reviewer は findings を返し tree を変更しません。
- 09 ガイドを読む↗
Extension / 16 分 / Stable
MCP で外部 system を接続する
Codex は STDIO と Streamable HTTP MCP をサポートし、CLI・IDE・desktop app が host config を共有します。Connection には transport、auth source、timeouts、required status、enabled tools、approval behavior が必要です。
- 10 ガイドを読む↗
Extension / 15 分 / Stable
繰り返す workflow を Skills にする
Skills は instructions、references、scripts、assets を package し、Codex は選択時だけ full instructions を読みます。Plugins は configured marketplace 経由で skills と optional MCP を配布します。Install 前に marketplace を list/review し、明示的な plugin を選びます。
- 11 ガイドを読む↗
Guardrails / 17 分 / Mixed: hooks stable; rules experimental
Hooks と Rules で guardrails を置く
Hooks は PreToolUse、PostToolUse、Stop、SessionStart 等で trusted command handlers を実行します。Rules は sandbox 外の command prefix を allow/prompt/forbidden にします。Hooks は stable、rules は experimental、最も restrictive な match が優先です。
- 12 ガイドを読む↗
Automation / 19 分 / Stable core; custom-agent authoring may evolve
Subagents から安全な Automation へ拡張する
Subagents は noisy exploration を main thread から分離し、independent read-heavy work を並行化します。codex exec は default read-only、progress は stderr、final は stdout。JSONL/schema が machine consumer を支え、GitHub Actions は公式 action と least privilege を使います。
- 13 ガイドを読む↗
Automation / 12 分 / Runtime-confirmed in Codex 0.147.0
codex exec で再現可能な headless 作業を行う
codex exec は script と CI の非対話入口です。Prompt を引数または stdin から受け取り、repository guidance と sandbox model を共有し、process status を返し、保存済み exec session も再開できます。信頼性は自動化という言葉ではなく、固定 working directory、明示的 authority、隔離 credential、会話の調子に依存しない verification から生まれます。
- 14 ガイドを読む↗
Automation / 11 分 / Runtime-confirmed in Codex 0.147.0
JSONL を stream し、最終結果を制約する
codex exec --json は newline-delimited JSON events を stdout へ出します。--output-schema は最終 response を JSON Schema で制約し、--output-last-message は最後の message を別 file に保存します。Event stream は progress/diagnostics、final artifact は安定した consumer contract のための別 surface です。どちらも code change の正しさまでは証明しません。
- 15 ガイドを読む↗
Operations / 10 分 / Runtime-confirmed in Codex 0.147.0
Codex session を resume、fork、archive、restore する
Codex は interactive/exec sessions を保存します。resume は lineage 継続、fork は分岐、archive/unarchive は可逆整理、delete は指定 session の永久削除です。安全な continuation の単位は exact session と compatible repository state の組です。
- 16 ガイドを読む↗
Cloud operations / 12 分 / Experimental Cloud surface; commands runtime-confirmed
Codex Cloud task を local apply 前に review する
Experimental cloud command は environment へ task を送り、state を一覧・確認し、指定 attempt の unified diff を表示し、local working tree へ apply できます。Apply は merge でも correctness 証明でもありません。Exact task/attempt、local status、tests を確認します。
- 17 ガイドを読む↗
Security / 13 分 / Sandbox command stable; execpolicy is evolving
Sandbox で command を試し execpolicy を監査する
codex sandbox は Codex sandbox 内で command を実行し、permission profile、readable roots/network、macOS denial logs を扱えます。execpolicy check は rule files に対して argv を評価します。これらは authority の診断手段であり、危険 command を安全に変えず、OS enforcement を置き換えません。
- 18 ガイドを読む↗
Operations / 10 分 / Runtime-confirmed in Codex 0.147.0
Codex を診断し features と completions を確認する
doctor は installation/runtime layers、features は stage/effective state、completion は shell integration、debug utilities は bundled model catalog など特定 evidence を提供します。Read-only inspection から始め、version context を保ち、ticket/startup file へ置く前に output を review します。
OpenAI Platform / API
OpenAI Platform / API archive
CLI curriculum とは別の companion archive です。
- A01 ガイドを読む↗
Platform architecture / 9 分 / Stable
Responses をシステム境界にする
Responses API は新しい OpenAI integration の推奨出発点です。単なる text generation wrapper ではなく、message、tool call、tool result、将来の input type を明示的な event として扱います。
- A02 ガイドを読む↗
Platform architecture / 11 分 / Stable
各 Tool に狭い契約を与える
OpenAI tools は検索、file retrieval、code execution、MCP 接続、custom function を提供できます。信頼性は各 action の周囲——小さな schema、明示 authority、idempotency、解釈可能な result——から生まれます。
- A03 ガイドを読む↗
Platform architecture / 8 分 / Stable
Schema をユーザー体験として設計する
Structured Outputs は response を JSON Schema に従わせ、parsing failure の一部をなくします。しかし値の真実性、有用性、権限、安全な適用までは証明しません。
- A04 ガイドを読む↗
Platform architecture / 12 分 / Stable
Agent Loop の所有者を決める
Agent は plan、tool call、state、specialist handoff を扱います。重要なのは agent 数ではなく、run loop、tool policy、state、approval、trace を誰が所有するかです。
- A05 ガイドを読む↗
Platform architecture / 10 分 / Stable
Realtime をライブシステムとして設計する
Realtime session は低遅延 live interaction 向けです。本番 voice は audio streaming だけでなく、client に合う transport、session state、interruption、tool latency budget、partial turn recovery が必要です。
- A06 ガイドを読む↗
Platform architecture / 9 分 / Stable
モデル選択を境界へ隔離する
OpenAI model catalog は変化します。製品 code は quality、latency、modalities、tool support、budget の capability profile を要求し、configuration と evaluation で実体へ解決します。