Claude Code vs Codex vs Gemini CLI: which agent loop actually fits your repo

All three agents can edit a repository. They differ in where the code lives, when a human sees the diff, and what happens when the sandbox cannot reach your tools.

Nov 9, 2026The avbbc desk
Claude Code vs Codex vs Gemini CLI: which agent loop actually fits your repo
All three agents can edit a repository. They differ in where the code lives, when a human sees the diff, and what happens when the sandbox cannot reach your tools.

If you are choosing a coding agent in 2026, the model is rarely the deciding factor. The three most-used agents — Claude Code, Codex, and Gemini CLI — are all competent at editing files. What separates them is architectural: where the code runs, when a human can intervene, and what the agent can reach.

This page is the short answer. Below is the reasoning, a comparison table, and the questions we would ask before adopting any of them.

The one-line answer

Pick Claude Code when you want to read every diff before it lands. Pick Codex when the ticket is already written and you will review a pull request later. Pick Gemini CLI when the work is shell-shaped and you want the same agent inside a script.

That is the decision. Everything below explains why that framing holds up, and where it breaks.

Where the code actually runs

Claude Code runs on your machine. It reads the working directory, executes commands in your shell, and shows each tool call as a block you approve. The consequence is obvious once stated: it can use whatever your laptop can reach — a local service, a database tunnel, a build cache. It also means an approval prompt is the only thing between the agent and your environment.

Codex runs in a remote sandbox with a checked-out copy of the repository. It executes tests there, commits, and hands back a branch or pull request. The consequence is the mirror image: no access to your local services, but also no risk to them. The most common failure is environmental — the agent passes its own tests and your CI disagrees because a dependency or credential differs.

Gemini CLI is a local process like Claude Code, but it is built to be scriptable. The same binary runs interactively or inside a pipeline, and it can attach MCP servers for extra tools. That makes it the natural choice when the agent is one step in a larger job rather than a session you sit in.

When a human sees the diff

This is the variable that changes how teams behave, more than raw capability.

  • Per action (Claude Code): you approve each edit or command. Slow for long tasks, but you notice a wrong assumption in the first thirty seconds rather than the final review.
  • Per task (Codex): you see a finished branch. Fast, and it scales across parallel tickets, but the review is after the fact and the diff can be large.
  • Configurable (Gemini CLI): approval can be automated for known-safe commands, which is the right default in CI and the wrong one on a laptop with production credentials.

There is no universally correct answer, but there is a correct question: how expensive is a wrong edit? On a codebase with a strong test suite, per-task review is fine. On a repository without tests, per-action is not a preference, it is insurance.

What each is genuinely good at

Claude Code Codex Gemini CLI
Runs on Your machine Remote sandbox Your machine
Review point Every tool call Pull request Configurable
Reaches local services Yes No Yes
Good at Multi-file refactors you can watch Scoped tickets in parallel Shell jobs and pipelines
Weak at Long unattended runs Reproducing your environment Teams that need a GUI

A pattern that works well in practice is to use the local agent for exploratory work — the refactor you are still designing — and the cloud agent for work you have already specified. The specification is the interface: if you can write the ticket clearly, a remote sandbox is fine; if you cannot, you probably want to watch the first hour.

The cost model nobody mentions

Cloud agents look cheaper because the per-seat price is visible and the compute is invisible. Local agents invert that: the software may be included in a subscription, but every long autonomous run burns tokens on your account.

The real cost driver is retries. An agent that fails twice and succeeds on the third attempt costs roughly three times one attempt, and the third attempt is the one you see. Both Aider and Claude Code make retries visible in their logs; a hosted agent hides them behind a result. If cost matters, instrument the retry rate before you scale the workflow.

What we would check before adopting any of them

  • Does the agent respect `.gitignore` and your secret-scanning rules? An agent that reads `.env` into context has already leaked it.
  • Can it run your test suite, or only edit files? The difference between a coding agent and a text generator is whether it verifies its own work.
  • What is the approval granularity, and can it be tightened per directory?
  • Does it leave a trace — commit messages, session logs, tool-call history — that a reviewer can follow?
  • If it is hosted, what is the data retention policy for repository content?

Frequently asked questions

Are these three interchangeable? No. They differ in where code runs and when a human reviews it. That architecture, not the model, determines whether the agent fits your workflow.

Which one is best for a team without tests? A local agent with per-action approval. Without a test suite, the diff review is the only verification step, so you want to see edits as they happen rather than after a task completes.

Can I use more than one? Yes, and it is common: a local agent for exploration and a cloud agent for specified work. The cost is context management, since each tool keeps its own session history.

Last checked: 9 November 2026. Agent products change monthly; the architectural differences above are the part that has stayed stable.

Related: Aider, Zed, OpenHands, and our coding tools category.