skip to content

Codex CLI

8 cheat sheets

Codex CLI#

OpenAI’s open-source agentic coding CLI (github.com/openai/codex). Runs GPT models directly in your terminal, edits code, executes commands, and supports OS-native sandboxing (Seatbelt on macOS, bwrap+seccomp on Linux). Configurable via ~/.codex/config.toml with profiles, MCP servers, and an experimental hooks system.

What’s in this section#

PageTopics
OverviewInstall, auth (ChatGPT plan vs API key), default model, session modes
Configurationconfig.toml schema — model, approval policy, sandbox mode, profiles, env
Slash CommandsFull reference: /init, /model, /plan, /fork, /resume, /mcp, /diff, /quit, …
Approvals & SandboxApproval policies, sandbox modes, platform mechanics, —full-auto
MCP Servers[mcp_servers.*] config, codex mcp subcommand, runtime /mcp
Tips & AGENTS.mdAGENTS.md authoring, profiles, hooks, codex exec, codex cloud

Sections#

  • Overview — Install, authenticate, and understand interactive vs exec modes.
  • Configuration — Every key in ~/.codex/config.toml explained.
  • Slash Commands — The full interactive slash-command surface.
  • Approvals & Sandbox — Control what the agent can do and how it’s sandboxed.
  • MCP Servers — Connect external tools via the Model Context Protocol.
  • Tips & AGENTS.md — Advanced workflows: AGENTS.md, profiles, hooks, non-interactive use.

[!TIP] Start with Overview and Configuration, then read Approvals & Sandbox before running in --full-auto mode.