Framework · Coding Agents

Codex CLI

OpenAI's first-party terminal coding agent: a lightweight Rust CLI that runs models from OpenAI inside a sandbox with a configurable approval policy, AGENTS.md project memory, MCP, and an apply_patch primitive for safe diff application.

Description

Codex CLI is the terminal version of OpenAI's Codex agent. It runs locally, signs in via ChatGPT subscription or API key, and operates inside a layered sandbox where the user picks both a sandbox mode (read-only / workspace-write / danger-full-access) and an approval policy (untrusted / on-request / never). The agent reads AGENTS.md files for project conventions, calls MCP servers in both the CLI and IDE extension, and applies edits via the apply_patch tool. A /plan slash command proposes an execution plan before implementation, and /resume continues prior sessions.

Solution

ReAct-style tool-use loop running entirely inside a sandbox. Each turn: model proposes an action; the sandbox+approval policy decides whether to execute, ask, or refuse; the action runs; output goes back to the model; repeat. AGENTS.md files are read at startup to assemble a layered instruction chain. apply_patch is the diff-editing primitive; /plan switches into a planning mode; /resume picks up a saved conversation.

Primary use cases

  • terminal-native coding agent with sandboxed execution
  • approval-gated automation across sandbox modes
  • MCP-tool integration in the CLI and IDE extension
  • shared AGENTS.md project conventions across editors
  • plan-then-execute and session resume workflows

Open the full interactive page

Diagram, neighbourhood map, code examples, related patterns and full provenance.

Related