Codex CLI

CCCOpen source

Agents · Build

OpenAI's local coding agent; a second opinion in the terminal, sandboxed and read-only when you want it.

What it is

Codex CLI is OpenAI's coding agent that runs on your machine, licensed Apache-2.0. The README installs it with curl -fsSL https://chatgpt.com/codex/install.sh | sh, npm install -g @openai/codex or Homebrew, and you sign in with a ChatGPT account (Plus, Pro, Business, Edu or Enterprise) or an API key. codex opens an interactive session; codex app launches the desktop experience.

The parts that matter for a multi-agent workflow are the non-interactive mode and the sandbox. codex exec "<prompt>" runs one task and prints the result, and --sandbox read-only guarantees it can look at the repository but not write to it or reach the network, which makes it a safe reviewer. Approval policies control when it may run commands, and an AGENTS.md file plays the role CLAUDE.md plays for Claude Code.

Where it fits in the AI OS

Build, as the independent second reviewer. Two agents from two vendors reading the same diff with the same rubric catch different things, and neither has the author's blind spots. It is also a reasonable primary agent if your team lives in the OpenAI plans.

Insider notes

members

How Serge's stack uses it

The dual code review rule in the project's CLAUDE.md: before any merge to main, a read-only Claude agent and Codex CLI review the same diff in parallel with the same priorities (security and authorization, then correctness, then Cloudflare and Next.js practice, then performance and maintainability). Codex runs as codex exec --sandbox read-only --color never "<prompt>" and writes its findings to a file; the two reports are merged, deduplicated, disagreements flagged, and Critical and High findings fixed before shipping. Reviewers never edit files.

Setup in 5 minutes

  1. Install with the script or npm install -g @openai/codex; run codex once to sign in.
  2. Add an AGENTS.md at the repo root with build and test commands.
  3. Try a review: codex exec --sandbox read-only "Review the diff of this branch against main for security and correctness; group by severity with file:line" > review.md.
  4. Compare with a Claude Code review of the same diff; keep the merged list.
  5. Put both into a review script so the step is one command.

Alternatives

  • Claude Code — the primary agent in this stack; the two are complementary.
  • Gemini CLI — Google's open-source terminal agent.
  • Aider / OpenCode — model-agnostic terminal agents.
  • CodeRabbit / GitHub Copilot code review — hosted PR reviewers that comment inline.