FIELD GUIDE / CODEX CLI 0.147.0
Operate Codex from prompt to proof.
Eight practical modules connect the complete command inventory to real terminal workflows. Commands come from the shared release manifest; safety boundaries stay explicit.
Open the exhaustive reference→codex exec = headless
JSONL → schema → evidenceFIELD PROCEDURE / 01
Interactive sessions and the root command
Start in the intended repository, choose a model or profile, and inspect the active state before work begins. In Codex, -p selects a profile; it never means print or non-interactive mode.
- $
cd your-repository - $
codex --profile deep-review - ›
/status - ›
/permissions
FIELD PROCEDURE / 02
Headless execution, JSONL, and schemas
Use codex exec for scripts and CI. --json emits newline-delimited event objects to stdout; --output-schema constrains the final response; --output-last-message saves the final assistant text separately.
- $
codex exec "Run the affected tests" - $
codex exec --json --output-schema schema.json --output-last-message final.txt "Audit the change"
FIELD PROCEDURE / 03
Configuration layers, profiles, and overrides
Put durable defaults in config.toml, select $CODEX_HOME/NAME.config.toml with --profile, and reserve -c key=value for a single invocation. Admin requirements constrain what users may override.
- $
codex --profile deep-review - $
codex -c model_reasoning_effort=high - $
codex --strict-config
FIELD PROCEDURE / 04
Approvals, sandboxing, and permissions
Select filesystem and approval boundaries before granting autonomy. workspace-write plus on-request is a practical starting point; danger-full-access and bypass flags require an external containment boundary.
- $
codex --sandbox workspace-write --ask-for-approval on-request - $
codex sandbox --permission-profile NAME -- command - ›
/permissions
FIELD PROCEDURE / 05
Resume, fork, archive, and delete
Resume continues a transcript, fork branches it, archive is reversible, and delete is permanent. Use --last for the newest matching session or a precise session ID when automation must be deterministic.
- $
codex resume --last - $
codex fork --last - $
codex archive SESSION_ID - $
codex unarchive SESSION_ID - $
codex delete SESSION_ID
FIELD PROCEDURE / 06
MCP servers and authentication
Register stdio servers after -- or streamable HTTP servers with --url. Keep bearer token values outside config by naming an environment variable, and use MCP login only for servers that support OAuth.
- $
codex mcp add docs --url https://developers.openai.com/mcp - $
codex mcp add local -- node server.mjs - $
codex mcp get docs --json - $
codex mcp login docs --scopes tools.read
FIELD PROCEDURE / 07
Plugins, skills, and hooks
Marketplaces provide plugin catalogs; plugins may add tools, MCP servers, skills, and hooks. Inspect the source and trust state before enabling lifecycle hooks or running skill scripts.
- $
codex plugin marketplace list - $
codex plugin list --available --json - $
codex plugin add PLUGIN@MARKETPLACE - ›
/plugins - ›
/skills - ›
/hooks
FIELD PROCEDURE / 08
Review, diagnostics, and evidence
Finish with the affected tests, inspect the diff, run a focused review, and use doctor when installation, auth, config, Git, or runtime state is unclear.
- ›
/diff - ›
/review - $
codex review --uncommitted - $
codex doctor --summary - $
git status --short
SHARED MANIFEST / SUPPORTED WORKFLOWS
The guide resolves back to the inventory.
Examples target installed Codex CLI 0.147.0. Hidden execpolicy surfaces are inventory-only and are not part of these supported workflows.
codexruntime-confirmedcodex execruntime-confirmedcodex sandboxruntime-confirmedcodex resumeruntime-confirmedcodex archiveruntime-confirmedcodex deleteruntime-confirmedcodex forkruntime-confirmedcodex mcp getruntime-confirmedcodex mcp addruntime-confirmedcodex mcp loginruntime-confirmedcodex plugin listruntime-confirmedcodex plugin marketplaceruntime-confirmed
NEXT / SEARCH EVERY SURFACE