The Cartographer · 11 min mission
Gemini CLI vs Claude Code vs Codex CLI
Pick the right terminal coding agent — an honest, current three-way comparison.
Gemini CLI, Claude Code, and OpenAI's Codex CLI are terminal coding agents: each reads your repo, edits files, runs commands, and loops until the task is done. They differ on three axes that decide the choice — context window, cost (including whether a free path exists), and sandbox/trust model. This guide gives the exact model IDs, flags, config keys, file paths, and defaults for each, plus a decision procedure.
| Tool | Latest stable | Canonical install | Launch |
|---|---|---|---|
| Gemini CLI | v0.46.0 (2026-06-10) | npm install -g @google/gemini-cli | gemini |
| Claude Code | Auto-updating native install (no pinned version) | curl -fsSL https://claude.ai/install.sh | bash | claude |
| Codex CLI | 0.139.0 (~2026-06-11) | npm install -g @openai/codex | codex |
Context window and model selection
All three flagships reach a 1,000,000-token input window. Pick or override the model per run; the strings below are the verified current IDs.
| Tool | Flagship model ID | Context (in / out) | How to select | Notes |
|---|---|---|---|---|
| Gemini CLI | gemini-3.1-pro-preview | 1,048,576 / 65,536 | gemini -m <id> | Knowledge cutoff Jan 2025. Stable: gemini-3.5-flash, gemini-3.1-flash-lite. gemini-3-pro-preview is retired — do not use. |
| Claude Code | claude-opus-4-8 | 1M / 128k | /model or config | claude-sonnet-4-6 (1M/64k), claude-fable-5 (1M/128k, GA 2026-06-09), claude-haiku-4-5 (200k/64k). IDs are pinned dated snapshots, not evergreen aliases. |
| Codex CLI | gpt-5.5 (recommended) | — | -m <id> or /model | No hard-pinned default string; inherited from ~/.codex/config.toml. Reference example: -m gpt-5.4. |
Cost and free tier
Two of the three have no $0 plan, and the third loses its free individual tier on 2026-06-18. The cheapest paid CLI entry for Claude Code and Codex CLI is $20/mo.
| Tool | Free for individuals? | Cheapest paid entry | Pay-as-you-go |
|---|---|---|---|
| Gemini CLI | Yes until 2026-06-18 — 60 req/min, 1,000 req/day, no card | Gemini Code Assist Standard/Enterprise (after cutover) | Paid Gemini API key (~1,000 req/day on Gemini 3) |
| Claude Code | No free tier | Pro $20/mo (Max 5× $100, Max 20× $200) | Anthropic API, metered per token |
| Codex CLI | No $0 plan (Codex Mobile ≠ Codex CLI) | ChatGPT Plus $20/mo (Pro/Business/Edu/Enterprise too) | OpenAI API key, standard rates |
MCP and extensibility
All three speak the Model Context Protocol (MCP) and read a project-memory file before you type. The config locations and memory files differ.
| Tool | Project memory file | MCP / config location | Extensibility surface |
|---|---|---|---|
| Gemini CLI | GEMINI.md | MCP servers in ~/.gemini/settings.json | Extensions, custom commands; Apache-2.0 open source. |
| Claude Code | CLAUDE.md (+ auto-memory) | MCP via /mcp; tool definitions deferred by default (only names enter context until used) | Skills, hooks (PreToolUse/PostToolUse), subagents, agent teams (CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1), plugins, Agent SDK; terminal, VS Code, JetBrains, desktop, web, Slack, GitHub Actions. |
| Codex CLI | AGENTS.md (cross-tool standard) | Config in ~/.codex/config.toml | exec for scripting; /model and slash-commands in the TUI. |
Sandboxing
This is the widest gap. Default postures: Codex sandboxes by default, Claude is opt-in, Gemini is opt-in. macOS uses Seatbelt on all three; Linux/WSL2 uses bubblewrap for the two that ship OS sandboxing.
Enable and control each sandbox
Codex CLI — on by default
Already sandboxed at
workspace-write. Set mode withsandbox_modein config, or--sandbox/-s:read-only→workspace-write(default) →danger-full-access. Set approvals withapproval_policy, or--ask-for-approval/-a:untrusted→on-request(default) →never.Claude Code — opt in
Run
/sandbox, or setsandbox.enabled: trueinsettings.json. By default the agent writes only to the working directory and a session temp dir, reads most of the disk, and reaches the network through a deny-by-default out-of-sandbox proxy that allowlists by hostname. Choose auto-allow (no prompts) or regular permissions.Gemini CLI — opt in
Pass
--sandbox/-s, or set theGEMINI_SANDBOXenv var to a method:true(OS default),docker,podman,sandbox-exec,runsc(gVisor), orlxc. On macOS,SEATBELT_PROFILEselects the Seatbelt profile (permissive-opendefault).
| Tool | Sandbox by default? | How you control it | Isolation mechanism |
|---|---|---|---|
| Codex CLI | Yes — workspace-write | sandbox_mode + approval_policy (read-only → workspace-write → danger-full-access) | macOS Seatbelt; Linux/WSL2 bubblewrap |
| Claude Code | Opt-in (/sandbox) | Auto-allow vs regular permissions; deny-by-default network proxy | macOS Seatbelt; Linux/WSL2 bubblewrap (+socat) |
| Gemini CLI | Opt-in (--sandbox/-s) | GEMINI_SANDBOX method: docker/podman/sandbox-exec/runsc/lxc | macOS Seatbelt; container or gVisor by choice |
Compare the three CLIs row by row
Claude Code vs Codex
The same agentic-coding ideas, two houses. Each column carries its own accent — coral for Claude, mint for Codex. Tap a header to isolate a tool, or replay the reveal.
CLAUDE.md at the repo root (plus ~/.claude/CLAUDE.md and auto memory).
AGENTS.md in the repo, with config.toml for settings.
Plugins, skills and marketplaces — sharable across a team.
Custom prompts and config profiles.
Markdown agents in .claude/agents/ — each its own context, tools and model.
Supported for delegating focused subtasks.
Shell hooks on lifecycle events, wired up in settings.json.
Hooks for workflow automation.
MCP servers; tool definitions deferred until first used.
MCP servers for third-party tools and context.
Terminal, VS Code + JetBrains, Desktop, Web, GitHub Actions, Agent SDK.
CLI, IDE extension, Cloud/Web, GitHub Action, Codex SDK, Chrome.
Opus 4.8, Sonnet 4.6, Haiku 4.5, Fable 5.
GPT-5.5, GPT-5.4, GPT-5.4 mini.
Claude Pro / Max / Team / Enterprise, or Anthropic API tokens.
ChatGPT Plus / Pro / Business / Edu / Enterprise, or API tokens.
Deep, multi-surface workflows tuned through CLAUDE.md, skills and hooks.
Teams already living in ChatGPT and the OpenAI stack.
Showing both
Verified against code.claude.com/docs and developers.openai.com/codex — current as of 2026. Both tools ship fast; check the docs for the latest.
Pick X when — decision procedure (first match wins)
Pick Gemini CLI
You need Apache-2.0 source you can read and fork, you are an enterprise on Gemini Code Assist, or you want the most container-flexible sandbox (
docker/podman/runsc/lxc). Individuals chasing the free tier must act before 2026-06-18 or plan for the paid API key that follows.Pick Claude Code
You want the broadest surface (terminal, VS Code, JetBrains, desktop, web, Slack, GitHub Actions), the deepest extensibility (skills, hooks, subagents, deferred MCP), and a network-aware sandbox — and you accept a paid subscription and, on Windows, WSL2.
Pick the Codex CLI
You already pay for ChatGPT Plus or above, you want sandboxing on by default with the least setup, and
AGENTS.mdfits your team’s cross-tool standard.Still torn
Optimize for what you already pay for: Google/Gemini enterprise → Gemini, Anthropic subscriber → Claude Code, ChatGPT subscriber → Codex.
Knowledge check
A teammate shows you a comparison chart with a "$0 / Free" column checked for all three CLIs. Which part of that chart is correct as of June 15, 2026?
Reach the end and this star joins your charted sky.