OpenAI Codex reference

OpenAI Codex commands and CLI guide

Look up Codex CLI commands, slash actions, permission settings, configuration paths, and common workflows. Copy an entry, then check release-specific options in your local installation.

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

Choose the Codex interface that gives your task the context and controls it needs.
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 reference, filter by purpose, or pin entries you use often.

03 / Set a clear operating boundary

Safe launch builder

Select the access and workspace options you need, then review the suggested command and its trade-offs.
Recommended starting command

04 / Turn intent into a testable brief

Codex prompt builder

Describe the result you want, the evidence to use, and any limits the task should follow.
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

See where to put personal settings, repository instructions, scoped rules, 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 relevant project files. Add more context only when the task needs it.
  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 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

These workflows show the commands and checks involved, from the first request through 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.