Skip to content

Other Agentic CLIs: Codex and OpenCode

Claude Code is the primary agentic coding tool here, and the rest of this section treats it as the default. But it isn't the only terminal agent worth knowing. Two others come up often: OpenAI's Codex CLI and OpenCode. This page is a practical survey — what each one is, how it maps onto the concepts you already learned for Claude Code, and when you'd actually reach for it. It stays deliberately high-level; commands and flags move fast, so the authoritative install steps live behind the doc links in Sources.

Who this is for. Engineers curious about alternatives, running a second model for an independent opinion, or working somewhere Claude Code isn't the house tool. You don't need to switch anything — the point is that the habits transfer.

Not the same as the codex plugin. The Codex covered here is OpenAI's standalone CLI, which you run on its own. Separately, inside Claude Code there's a codex plugin that delegates a task to Codex as a second opinion or rescue pass (/codex:rescue) — that one is documented in Skills & Plugins. Same underlying model, two very different entry points.

Codex CLI, OpenCode, and why the habits transfer unchanged — 1 min 34 s.

The shared shape

The reason these tools feel familiar the moment you open them: they're built around the same core loop as Claude Code — you describe a goal, the agent investigates your codebase, proposes and makes edits, runs commands, and reports back while pausing for approval on the risky steps. Beyond the loop, all three share the same handful of building blocks:

  • A project memory/config file you commit to the repo so the agent carries conventions across sessions.
  • An approval / autonomy control — a spectrum from "read-only, suggest first" to "run freely" — that you dial per task.
  • MCP support, so the same external-tool servers you configure for Claude Code can be reused.

So most of what the rest of this guide teaches — plan before you build, keep the context window clean, review every diff, insist on verification — applies unchanged. Only the surface details differ.

OpenAI Codex CLI

Codex CLI is OpenAI's open-source terminal coding agent (written in Rust), driving OpenAI's GPT-class models. It runs an interactive session in your terminal, reads and edits code in the current directory, runs commands, and — like Claude Code — has IDE and cloud counterparts that share the same engine.

How it maps to what you know:

  • Config file: AGENTS.md in the repo root plays the role CLAUDE.md does — project context the agent reads each session. (Claude Code reads AGENTS.md too, so a repo can serve both.)
  • Autonomy: approval modes run from read-only suggestions up to full-auto, mirroring Claude Code's permission modes.
  • Models & auth: sign in with a ChatGPT account or an OpenAI API key; switch models mid-session.
  • MCP: supported, configured in Codex's own config.

Reach for it when you want an OpenAI model's independent take on a problem, you're already in the OpenAI/ChatGPT ecosystem, or you're cross-checking a change against a different model family. See Choosing Models for why a second model is sometimes worth the round-trip.

OpenCode

OpenCode is an open-source, provider-agnostic terminal agent. Its defining trait: it isn't tied to one model vendor — you point it at Anthropic, OpenAI, Google, local/self-hosted models, or others, all behind one TUI. It runs a client/server architecture (a backend that talks to the model and executes tools, with the terminal UI as one front end) and leans hard into a keyboard-driven terminal experience.

How it maps to what you know:

  • Config file: an AGENTS.md for project context, plus an opencode.json for tool/provider settings.
  • Autonomy: ships with Plan (read-only — analyse and suggest without touching files) and Build (full access) modes you toggle with Tab — essentially the same idea as Claude Code's plan mode versus an editing mode.
  • Models: bring-your-own-key across many providers, which is the whole selling point.
  • MCP + LSP: supports MCP servers and language-server diagnostics, and lets you define custom sub-agents as Markdown files — the same patterns covered in Skills & Plugins.

Reach for it when you want a single tool spanning many providers (or local models), you value a vendor-neutral setup, or you're optimizing for a fully terminal-native, keyboard-first flow.

At a glance

Claude Code Codex CLI OpenCode
Config file CLAUDE.md AGENTS.md AGENTS.md + opencode.json
Models Claude OpenAI GPT-class Provider-agnostic (Claude, GPT, Gemini, local, …)
Plan / read-only mode Plan mode (Shift+Tab) Approval modes Plan mode (Tab)
MCP support Yes Yes Yes
Best for The default here; deepest plugin/skill ecosystem An OpenAI-model second opinion One tool across many providers

The takeaway. These are alternatives, not replacements — the workflow discipline is what matters, and it's portable. Pick the tool that fits the model you want and the environment you're in; keep planning, reviewing, and verifying the same way regardless.

Sources

  • Codex — OpenAI Developers docs — https://developers.openai.com/codex
  • Codex CLI — https://developers.openai.com/codex/cli
  • Codex CLI — command & config reference — https://developers.openai.com/codex/cli/reference
  • Codex — source and docs (GitHub) — https://github.com/openai/codex
  • OpenCode — official docs — https://opencode.ai/docs/
  • OpenCode — homepage — https://opencode.ai/