Coding Agent CLIs Compared
You already picked a model. But the program that wraps the model — the loop that reads files, plans, runs commands, checks its own work and retries — is a separate choice, and it matters at least as much. The community name for that wrapper is the harness (or agent), and the same model can look brilliant in one and mediocre in another. This page maps the terminal coding agents of 2026, what actually separates them, and how to keep your config portable so switching costs stay low.
- Separate two choices people conflate: the model vs the harness that drives it
- Know the durable shape of each major CLI agent — Claude Code, Codex CLI, Gemini CLI, and the open-source pack
- Pick on the axes that actually decide it: autonomy, openness, model-agnosticism, sandboxing and ecosystem
- Make your setup portable with AGENTS.md so you can switch agents without rewriting your project context
The model is not the agent
A frontier model is a text predictor. A coding agent is the harness around it: the system prompt, the tool set (read, edit, run shell, search), the planning loop, the context-management strategy, the permission and sandbox model, and the retry logic. Change the harness and you change the results — practitioner reports through 2026 describe the same model swinging tens of points on real repository tasks depending on which agent drives it.
That has two practical consequences:
- A benchmark number is a pairing, not a model score. "83% on Terminal-Bench" is a model + harness + scaffold result. Swap any part and it moves.
- Your loop is the real unit of comparison. The best agent is the one that works best on your stack, in your terminal, at a price you can live with — exactly the same logic as choosing a coding model. See Claude vs GPT vs Gemini for Coding for the model half of the decision; this page is the harness half.
The field in 2026
The terminal-agent space split into two camps: first-party agents tuned to one lab's models, and model-agnostic agents you point at whatever model (or local weights) you like.
| Agent | Who | Openness | Models | Shape |
|---|---|---|---|---|
| Claude Code | Anthropic | Closed-source | Claude (first-party) | Autonomous, agentic multi-file work; OS-enforced sandbox; deep skills/MCP/subagent ecosystem |
| Codex CLI | OpenAI | Open (Apache-2.0, Rust) | GPT (first-party) | Autonomous terminal agent; native Windows sandbox; broad platform reach |
| Gemini CLI | Open-source | Gemini (first-party) | Large-context agent, Google-ecosystem tie-ins (see freshness note below) | |
| opencode | Community (anomalyco) | Open (MIT, TypeScript) | Any (model-agnostic) | Most-starred open agent; CLI + desktop; bring-your-own-model |
| Aider | Community | Open (Apache-2.0) | Any, incl. local | Git-native pair-programmer, not a full autonomous orchestrator |
| Cline / Goose / others | Community | Open | Any | Editor-embedded (Cline) or general open agents (Goose); model-agnostic |
The axes that actually decide it
Ignore the leaderboard for a minute. These are the durable questions:
- First-party agents (Claude Code, Codex CLI, Gemini CLI) are tuned for their own model and usually give the smoothest peak experience. Model-agnostic agents (opencode, Aider, Cline) let you swap models — frontier today, cheap or local tomorrow — without changing tools. Pick agnostic if avoiding lock-in or running local weights matters to you.
- Aider is a pair-programmer: focused, file-level, git-native edits with you in the loop on every commit. Claude Code and Codex CLI are orchestrators: give a goal, they plan and execute across many files and shell commands. More autonomy means more leverage and more need for guardrails.
- An agent that runs shell commands can delete files, push code, or spend money. Prefer an OS-enforced sandbox and an explicit permission model over 'trust me'. Claude Code and Codex CLI both ship sandboxing in 2026; verify what any agent can touch before you let it run unattended.
- Beyond the core loop: MCP servers for tools, reusable skills, subagents, hooks, IDE integration, CI actions. A thinner agent on a great model can lose to a thicker agent on a good-enough one because the ecosystem does more of the work.
- Subscription vs API metering, context window, caching, and how chatty the harness is all move the real bill. A cheaper model in a token-hungry harness can cost more than a pricier model in a lean one.
- Don't buy a harness on a headline benchmark. Buy it on a 30-minute trial against a real task in your own repo — the same 'eval on your own code' move that beats every model leaderboard.
- Openness is a hedge, not a feature you'll use daily. Its value shows up the day a price changes or a free tier disappears and you want to move.
Portability: write your context once
The biggest hidden switching cost is your project context — build commands, conventions, test rules, things the agent cannot infer. In 2026 that has a de-facto standard: AGENTS.md, a plain-Markdown file at your repo root, stewarded by the Agentic AI Foundation under the Linux Foundation and read natively by Codex, Gemini CLI, Cursor, Aider, Copilot's coding agent, opencode, Goose and 20+ other tools (60k+ repos have adopted it).
AGENTS.md= cross-tool project context. Write it once; most agents read it.CLAUDE.md= Claude Code's own project-memory file (see CLAUDE.md). You can keep a smallCLAUDE.mdthat points atAGENTS.md, or maintain both.SKILL.md= Anthropic's separate spec for packaging reusable skills with frontmatter and bundled scripts. It's complementary toAGENTS.md, not a competitor — one describes the project, the other packages a reusable procedure.
Keeping context in AGENTS.md means the day you try a different agent, your project rules come along for free.
Minimal AGENTS.md — write only what an agent cannot infer
# AGENTS.md ## Setup - Install: `pnpm install` - Dev server: `pnpm dev` (port 3000) ## Build & test (run before every commit) - Typecheck: `pnpm typecheck` - Lint: `pnpm lint` - Tests: `pnpm test` — all must pass ## Conventions - TypeScript strict; no `any`. - Components in `src/components`, one per file. - Never edit files under `generated/` by hand. ## Constraints - Do NOT run `git push` or open PRs without being asked. - Secrets live in `.env.local`; never commit them.
- Only put in AGENTS.md what the agent can't discover on its own. Restating the obvious costs tokens on every run and buries the rules that matter. Curate it by hand — auto-generated context files tend to be noise.
A decision, in one breath
- Deep, autonomous Claude work with the richest tool ecosystem → Claude Code.
- Open-source first-party agent tied to GPT, with strong platform/Windows reach → Codex CLI.
- You want to swap models freely or run local weights → opencode or Cline.
- Careful, git-native, human-in-the-loop edits → Aider.
- Big Google-ecosystem context play → Gemini CLI (confirm current access first).
Whatever you pick, keep your project context in AGENTS.md and prove the choice with a real task in your own repo before you commit.
Check yourself
0/4Flashcards
Sources & further reading
- AGENTS.md — official site & spec (Agentic AI Foundation / Linux Foundation)
- openai/codex — Codex CLI repo (Apache-2.0, Rust)
- sst/opencode — opencode repo (MIT, TypeScript)
- Aider-AI/aider — Aider repo (Apache-2.0)
- google-gemini/gemini-cli — Gemini CLI repo
- Anthropic — Claude Code documentation
- Related on this site: Claude vs GPT vs Gemini for Coding · Local coding agents · CLAUDE.md · Skills