Terminal-first coding agents have settled into the default surface for professional software work. Across 2025 and 2026, four command-line tools moved from demos to daily drivers: Anthropic’s Claude Code, OpenAI’s Codex CLI, Google’s Gemini CLI, and the open-source Aider. Each answers the same three engineering questions differently: how an agent finds code it was never told about, how it is prevented from damaging the machine it runs on, and what happens when the context window fills. The differences matter more than raw model quality, because in practice they determine token burn, blast radius, and whether a long session ends with a working diff or a corrupted repository.
Architecture: Repository Mapping Versus Shell Exploration
Claude Code takes the most literal approach. It ships no pre-built index. The agent navigates with ripgrep, glob, and shell commands, reading files on demand and holding the results in context. This scales to monorepos without an indexing step, but it makes discovery expensive: an agent that greps eight times before finding the right file pays for every one of those reads on the next turn, since the transcript is resent each round.
Codex CLI converged on a similar agentic loop after its 2025 rewrite in Rust, wrapping shell execution in a permission system rather than a retrieval system. Its distinguishing artifact is apply_patch, a structured diff format that has since been adopted, in compatible form, by several competing tools. Aider is the outlier: it builds a tree-sitter-derived repository map, ranks symbols by graph centrality, and injects a compressed skeleton under a configurable token budget. The editor model then proposes edits against files it has effectively already read.
Gemini CLI runs a ReAct-style loop over a very large window, leaning on volume rather than precision. Its hierarchical GEMINI.md files and those of its rivals (CLAUDE.md, AGENTS.md) serve as the one durable, always-reinjected layer of project convention.
Comparison: Licensing, Lock-In, Sandboxing, Compaction
| Tool | License | Model access | Sandboxing | Context strategy | Session cost profile |
|---|---|---|---|---|---|
| Claude Code | Proprietary CLI; API, Bedrock, Vertex | Anthropic models only | macOS Seatbelt; Linux bubblewrap plus seccomp; optional devcontainer | Live ripgrep traversal, no index; automatic compaction as the window fills | Vendor-reported $6-$12+ per heavy hour on metered API |
| Codex CLI | Apache-2.0 (Rust) | OpenAI Codex models; third-party providers via config, second-class | macOS Seatbelt; Linux Landlock plus seccomp; Docker opt-in; --full-auto to full access |
400K-token window (272K input); layered compaction plus AGENTS.md |
Roughly $4-$10 per hour typical, spiking on retry loops |
| Gemini CLI | Apache-2.0 | Gemini models only | Docker or Podman container; macOS Seatbelt | 1M-token window defers compaction; hierarchical GEMINI.md |
Free tier at 60 requests/min and 1,000/day; paid API roughly $3-$8 per hour |
| Aider | Apache-2.0 | Any LiteLLM provider, including local weights | None by default; git commits provide rollback | Tree-sitter repo map under a fixed token budget; manual /drop, no auto-compaction |
$0.50-$4 per hour hosted; near-zero with local models |
Figures are vendor-reported or drawn from independent developer surveys; metered costs vary by model tier, cache hit rate, and harness configuration.
Operational Analysis: Where the Tokens Go
Independent measurements through 2026 put a typical Claude Code or Codex CLI session at $1-$3 for twenty minutes of active work, with heavy refactors reaching $12 or more per hour. The dominant cost driver is not output but re-sent input: every tool call appends to a transcript that is billed again on the following turn. Claude Code mitigates this with prompt caching, which materially cuts the per-turn rate when the prefix is stable, but any edit to the system prompt or tool list invalidates the cache.
Retry loops are the sharpest failure mode. A flaky integration suite that fails for environmental reasons can consume thirty turns of “run tests, read output, patch, re-run” at 60K input tokens per turn. At $3 per million input tokens that is roughly $5.40 for a loop that changed nothing. Worse cases, where the agent rewrites a fixture on each pass, have been reported in the $5-$20 range for a single stuck task. Codex CLI and Gemini CLI are not immune; the loop is a property of the harness pattern, not the vendor.
Diff-apply reliability separates the tools more than benchmark scores do. Aider has published extensively on edit formats, finding that whole-file rewrites are more reliable but token-expensive, while unified diffs are cheaper and fail more often on weak models, which is why its architect mode separates reasoning from formatting. Claude Code’s string-replacement edit tool is precise but brittle against stale reads: if the file changed since the agent last saw it, the replacement anchor disappears and the agent must re-read, paying twice. The apply_patch family used by Codex CLI sits between the two, tolerating context drift at the cost of occasional malformed hunks.
Limitations and Trade-Offs
Automatic compaction is the least honest feature in the category. When a session approaches the window limit, the harness summarizes the transcript and continues. Task state usually survives; negative constraints frequently do not. Instructions such as “do not touch the billing module” or “keep migration numbering sequential” are the first casualties, and the agent proceeds confidently against rules it has forgotten. Re-injecting a short, explicit constraints file after each compaction is the only reliable mitigation, and none of the four tools does it automatically.
Sandboxing is only as strong as the default. Landlock and Seatbelt restrict filesystem writes to the working directory, but network egress is often permitted, which leaves prompt injection through fetched documentation or dependency READMEs as a live path. Approval fatigue pushes users toward --dangerously-skip-permissions and equivalent flags, at which point destructive commands including git reset --hard, force pushes, and recursive deletes execute without a prompt. Aider has no sandbox at all; its safety model is the git commit it makes after each change, which is adequate until the agent commits something broken and the user has not pushed.
Cost predictability remains poor. Metered API usage has no ceiling, subscription tiers have opaque weekly limits that heavy users hit mid-task, and free tiers throttle precisely when a long refactor needs continuity. Model lock-in is near-total for the two vendor CLIs, and only Aider offers a credible path to local weights, at a measurable cost in edit quality.
What to Watch Next
- Whether any harness ships constraint pinning that survives compaction, rather than relying on user discipline.
- Default-deny network egress in Landlock and Seatbelt profiles, which would close the injection path rather than documenting it.
- Convergence on a single patch format, or continued divergence as vendors optimize for their own models.