OpenAI Codex field guide

OpenAI Codex Command Cheatsheet and CLI Guide

Find the command, slash action, permission setting, configuration path, or workflow you need—then copy it without breaking your flow.

Updated July 29, 2026 · Release-dependent features are marked “Check locally”.

codex / workspace
Click any row to copy
116searchable entries
11focused categories
4guided workflows
2interactive builders

01 / Choose the right surface

Match the interface to the job

Start with the smallest Codex surface that gives the task enough context, control, and visibility.
01

Interactive CLI

Explore, discuss, and iterate

Use the terminal interface when the task needs conversation, approvals, or course correction.

02

Exec

Script a bounded task

Use non-interactive execution for repeatable checks, CI steps, and output pipelines.

03

Review

Inspect a diff

Use the dedicated review command for working-tree, branch, or commit-focused feedback.

04

Sessions

Continue or branch work

Resume saved context or fork a session when you want to explore another route.

05

Extensions

Connect trusted tools

Use MCP, skills, and plugins when the task genuinely needs external capabilities.

02 / Search the command graph

Commands, flags, shortcuts, paths, and concepts

Search the full reference, filter by purpose, and pin the cards you reach for most.

03 / Set a clear operating boundary

Safe launch builder

Choose what the task needs and get a conservative starting command with the tradeoff explained.
Recommended starting command

04 / Turn intent into a testable brief

Codex prompt builder

Give Codex an outcome, evidence, boundaries, and a definition of done.
Ready-to-edit prompt

Attach only the files and external tools the task actually needs. Narrow context usually produces clearer evidence and easier review.

05 / Put durable context in the right place

Codex path map

Separate personal defaults, repository guidance, scoped overrides, and reusable workflows.
User defaults~/.codex/config.toml

Default model, sandbox, approvals, web search, interface settings, and MCP servers for the current user.

Named profile$CODEX_HOME/<name>.config.toml

A focused configuration layer activated with --profile, useful for review, automation, or restricted workflows.

Repository guidanceAGENTS.md

Project build commands, conventions, architectural boundaries, and verification requirements that travel with the repository.

Scoped overrideAGENTS.override.md

Directory-specific guidance that takes priority within its scope. Keep overrides narrow and deliberate.

Repository skill.agents/skills/<name>/SKILL.md

A reusable project workflow with optional scripts, references, and assets.

Personal skill~/.agents/skills/<name>/SKILL.md

A reusable workflow available across repositories for the current user.

06 / Build context deliberately

Context decision ladder

Start with the repository and expand only when the result lacks the evidence it needs.
  1. 1
    Working directory

    Start Codex in the smallest relevant project root.

  2. 2
    @ file mentions

    Attach the known entry point, failing test, or configuration file.

  3. 3
    AGENTS.md

    Use durable repository guidance for commands, conventions, and boundaries.

  4. 4
    --add-dir

    Grant a specific adjacent directory only when the task truly crosses roots.

  5. 5
    Web, MCP, apps

    Connect external information last, after reviewing permissions and data boundaries.

07 / Follow a reliable route

Practical Codex workflows

Each route keeps scope, action, and verification visible from the first command to the final diff.

Understand a repository

Build an evidence-based map before requesting changes.

  1. Root

    Start with inspection-only access in the repository root.

  2. Ask

    Request a concrete map instead of a generic summary.

  3. Attach

    Mention the entry file or failing test when you know it.

  4. Check

    Confirm model, permissions, writable roots, and context state.

08 / Before Codex acts

Keep powerful workflows reviewable

  • Start narrow: use read-only for discovery and workspace-write for bounded implementation.
  • Inspect commands: review installers, package scripts, migrations, and destructive operations before approval.
  • Review the diff: agent summaries are useful, but the changed files and test output are the evidence.
  • Protect secrets: do not place credentials in prompts, checked-in instructions, screenshots, or command history.
  • Vet extensions: MCP servers, apps, plugins, hooks, and skills can expand access and shape future behavior.
  • Isolate unattended work: never disable both approvals and sandboxing unless a dedicated external sandbox provides the boundary.
Fast local checks
Keep learning

Use this cheatsheet for discovery and recall. Before production automation, security-sensitive work, or broad repository changes, confirm the installed release’s behavior and review the resulting commands, permissions, and diffs.