Top 5 CLI coding agents in 2026
Updated on Jul 22, 2026 · 20 mins read

The CLI coding agent space consolidated hard through the first half of 2026. OpenAI bought Windsurf for $3 billion in March. Google actually pulled the plug on Gemini CLI on June 18, replacing it with a closed-source binary called Antigravity CLI (agy) and cutting the free tier from 1,000 requests a day to roughly 20. Four days before that, SpaceX - fresh off merging with Elon Musk’s xAI in February - announced a $60 billion all-stock deal to acquire Cursor, folding Grok, Colossus compute, and Cursor’s 4 million developers into one stack; the deal is expected to close in Q3 2026. Meanwhile OpenAI shipped a Codex refresh on GPT-5.5 that several rankings still put at #1, Claude Code moved to Opus 4.8, and the open-source side kept growing: opencode (now anomalyco/opencode after a rebrand) crossed 165k GitHub stars, and a lean new harness called Pi, from Flask/Jinja2 creator Armin Ronacher, showed up and picked up over 50k stars in months.
If you read this blog earlier in the year, the ranking has shuffled again - and not just because of new model releases. With three of the five vendor tools in this space now either owned by Big Tech, pending acquisition, or shut down outright, independence has become a real selection criterion, not just a nice-to-have. This update reorders the list to reflect that, and points to more open-source options than before.
Comparison Table for Top CLI Coding Agents
| CLI Agent | Best For | Default Model | Pricing | Key Strength |
|---|---|---|---|---|
| Claude Code | Multi-file reasoning, long-running tasks | Claude Opus 4.8 / Sonnet 4.6 | API pay-per-use or Claude Pro/Max subscription | Reasoning quality and skill/subagent ecosystem |
| OpenAI Codex | Tight loop with GPT-5.5; agentic execution | GPT-5.5 | API pay-per-use; ChatGPT plans include quota | Top-ranked agent benchmarks in 2026; open source (Apache-2.0) |
| OpenCode | Provider-agnostic, local models, staying independent | Bring your own (75+ supported) | Free (open source, MIT) | 165k+ stars; LSP, SDK, dual build/plan agents |
| Cursor CLI | Cursor IDE users; long async runs | Auto-routes (Claude / GPT / Gemini) | Bundled with Cursor Pro ($20/mo) and above | Plan/Ask modes, Cloud Handoff with & prefix |
| Antigravity CLI | Google ecosystem; multi-agent workflows | Gemini 3 | ~20 free req/day; more for AI Pro/Ultra; enterprise via Code Assist | Shared harness with Antigravity 2.0 desktop; Skills/Hooks/Subagents |
| GitHub Copilot CLI | Teams already on GitHub/Copilot seats | Auto-routes (Claude / GPT / Gemini) | Bundled with Copilot ($10-$39/mo); moved to token-based billing in May 2026 | Deepest GitHub/PR integration; untouched by the 2026 acquisition wave |
Summary
What changed in 2026:
- Google actually shut down Gemini CLI on June 18, 2026 - it wasn’t a deprecation, the open-source repo stopped serving requests and was replaced by the closed-source Antigravity CLI, with the free tier cut roughly 50x
- SpaceX announced a $60B acquisition of Cursor on June 16, 2026, merging it with xAI/Grok; the deal is expected to close in Q3 2026, and until then Cursor CLI runs independently
- OpenAI Codex is still on GPT-5.5 and tops several agent benchmarks
- OpenCode passed 165k GitHub stars and moved to
anomalyco/opencode, but lost Claude Pro/Max subscription login after a dispute with Anthropic (a raw API key still works) - A new open-source harness, Pi, crossed 50k+ stars on the strength of a system prompt under 1,000 tokens
Top 5 CLI coding agents in 2026 (reordered from earlier this year to reflect who’s independent and who isn’t):
- Claude Code (Opus 4.8): still the consensus pick for deep, multi-file work
- OpenAI Codex (GPT-5.5): highest-ranked agent on several 2026 benchmarks
- OpenCode: provider-agnostic, MIT-licensed, 165k+ stars, and not owned by any of the companies buying up the rest of this list
- Cursor CLI: push a local session to a Cloud Agent with a
&prefix - though its long-term ownership is now an open question - Antigravity CLI: Google’s flagship since Gemini CLI’s shutdown; closed source, same harness as the Antigravity 2.0 desktop app
More open source options worth knowing: Aider (Git-native pair programming), Pi (minimal, sub-1K-token harness from Armin Ronacher), Cline (one agent across IDE/CLI/SDK), Goose (now under the Linux Foundation), Continue, Qwen Code, Crush, Kilo Code, Forge, and Plandex. See our full ranked breakdown in Best Open Source CLI Coding Agents in 2026.
Other honorable mentions: GitHub Copilot CLI (Microsoft’s entry, sitting outside the 2026 acquisition wave), Warp 2.0 (now open source under AGPL-3.0), Sourcegraph Amp (“Deep mode”), OpenHands, Amazon Q Developer CLI, Kimi CLI
What to look for: model choice (own API key vs subscription), local model support if privacy matters, sandboxed shell execution, MCP support, who owns the vendor behind the tool, and how the agent handles long-running tasks (background, resumable)
Why Use CLI Coding Agents and How to Choose the Right One
CLI agents are useful for a specific reason: they own the same surface your shell already owns. Files, processes, env vars, Git, make, kubectl, your project’s CLI - the agent can read and modify any of it without an IDE plugin in between. For long-running tasks (refactors, migrations, dependency bumps, “fix all the failing tests”), that’s a meaningful win over an IDE chat panel.
The tradeoffs are real too. Most CLI agents trust the model to drive your shell, so a bad tool call can rm -rf something. Sandboxing varies a lot - Codex runs in a sandboxed env by default, Claude Code asks before destructive ops, Aider stays inside its file edit + commit lane. Read each tool’s default permission model before turning it loose on a real repo.
A rough decision tree for picking one:
- You’re already a Claude or ChatGPT subscriber. Use the matching CLI - Claude Code or Codex. The subscription quota usually beats per-token API pricing for daily work.
- You’re inside the Cursor or Google ecosystem. Cursor CLI ties into your editor sessions and Cloud Agents, though its ownership is changing (see below). Antigravity CLI shares state with the Antigravity desktop app but is Google’s only terminal option now that Gemini CLI is gone.
- You want to bring your own model (or run local) and stay independent. OpenCode, Aider, Pi, Goose, or Crush - all support Ollama, OpenAI-compatible endpoints, and most commercial providers, and none of them are caught up in the 2026 acquisition wave.
- You need 1M+ tokens of context. Plandex’s planning sandbox or Gemini-backed agents (Antigravity CLI on Gemini 3) handle bigger context than Claude or GPT today.
- Your workflow is “edit + commit + repeat”. Aider’s repomap + automatic commits is still hard to beat.
Top CLI Coding Agents in 2026
1. Claude Code
Claude Code is Anthropic’s official CLI - npm i -g @anthropic-ai/claude-code, then claude in any repo. It’s the consensus “default” for serious work in 2026, and with SpaceX buying Cursor and Google closing off Antigravity CLI, it’s also the most notable commercial CLI left that hasn’t recently changed hands or gotten shut down.
What it actually does well: it asks before destructive shell calls, keeps a coherent plan across long sessions (helped by the 200K context on Sonnet 4.6 and the larger Opus 4.8 window), and has the deepest plugin ecosystem - Skills (procedure libraries the agent loads on demand), Subagents (specialized child agents), Hooks (run on tool calls), and a growing list of MCP servers. The “Auto memory” feature keeps user/feedback/project notes in ~/.claude/projects/.../memory/ so it doesn’t forget your conventions between sessions.
Two real annoyances worth knowing: it’s cloud-only (no Ollama fallback), and at scale the API bill adds up fast - the Claude Pro/Max subscriptions ($20/$200/mo) bundle Claude Code quota, which is usually the better deal if you use it daily.
Strengths
- Best-in-class reasoning on Opus 4.8 for refactors and multi-file edits
- Rich extension surface: Skills, Subagents, Hooks, MCP, custom slash commands
- Sandboxed shell with explicit permission prompts; no surprise
rm -rf - Auto memory persists project/user/feedback notes between sessions
Tradeoffs
- Cloud only - no local model support
- Per-token costs add up; subscription is usually cheaper for daily users
Pricing
Pay-per-use on the Anthropic API (Sonnet 4.6 / Opus 4.8 standard rates) or bundled with Claude Pro ($20/mo) or Claude Max ($100-$200/mo) subscriptions with included quota.
2. OpenAI Codex

OpenAI Codex ships as npm i -g @openai/codex, is genuinely open source (Apache-2.0, openai/codex on GitHub, rewritten in Rust), and runs on GPT-5.5 by default. Several 2026 rankings put it at #1 on agent benchmarks, citing materially better long-task execution than the GPT-5 era. Worth noting: this is a separate product line from Windsurf, the IDE OpenAI acquired for $3 billion in March 2026 - Codex is the terminal-first agent, Windsurf is the editor.
What it does differently: it leans hard on sandboxed execution by default - shell commands run in a containerized env that can’t touch the rest of your machine without --full-auto or explicit approval. That means it’s a bit slower than Claude Code on filesystem-heavy tasks (extra IPC) but safer to point at a real repo unattended. It also has the tightest integration with ChatGPT - kick off a task in the CLI, push it to ChatGPT’s Codex Cloud, watch from your phone. The --oss flag also runs it against a local Ollama model if you want to test the harness without an API key.
Where it lags: the plugin/skill ecosystem is thinner than Claude Code’s, and MCP support arrived later. If you don’t care about Skills/Subagents, that’s a non-issue.
Strengths
- GPT-5.5 leads multiple agent benchmarks in 2026
- Default sandboxed shell - safer for unattended runs
- Genuinely open source (Apache-2.0), with
--ossfor local models - Cloud handoff to ChatGPT Codex Cloud for long async tasks
Tradeoffs
- Smaller extension/plugin ecosystem vs Claude Code
- Sandbox adds a small latency tax on file-heavy work
- Tuned for OpenAI models; local providers are clearly the B-path
Pricing
Open source (Apache 2.0). Pay-per-token on the OpenAI API, or bundled with ChatGPT Plus/Pro/Business plans, which include Codex Cloud quota.
3. OpenCode

OpenCode moves up this list not just because of growth, but because of what it isn’t: caught up in the acquisition wave that swallowed Cursor and Windsurf, or shut down like Gemini CLI. It’s the open-source breakout of 2026, having crossed 165k GitHub stars, and the team rebranded to Anomaly, so the repo now lives at anomalyco/opencode (old Docker image references pointing at sst/opencode will break).
The pitch is provider neutrality. OpenCode supports 75+ LLM endpoints out of the box: Anthropic, OpenAI, Google, AWS Bedrock, Azure OpenAI, OpenRouter, and anything OpenAI-compatible including local Ollama servers. You can switch models mid-session and the context carries over. The TUI is built in Bubble Tea (Go), has a plan agent that won’t touch files and a build agent that will, and ships an SDK if you want to embed it in scripts.
One thing to know before you adopt it: after a January 2026 dispute, Anthropic forced OpenCode to remove Claude Pro/Max subscription login - Claude still works fine with a raw API key, and OpenAI now partners with the project so ChatGPT subscriptions work natively. It’s not the only fast-growing open-source harness this year either - see Pi in the honorable mentions below, and our dedicated roundup of open-source CLI agents for the full field.
Strengths
- 75+ LLM providers including local Ollama; no vendor lock-in
- Dual
planandbuildagents for read-only vs write workflows - LSP-integrated for syntax highlighting and error detection across the project
- Not owned by, or dependent on, any single vendor
Tradeoffs
- Claude Pro/Max subscription login was removed (API key still works)
- You’re responsible for picking the right model per task; auto-routing is less polished than Cursor’s
- Plugin ecosystem is smaller than Claude Code’s Skills/Subagents
Pricing
Free (MIT licensed). You pay only for the underlying model API.
4. Cursor CLI

Heads up: On June 16, 2026, SpaceX announced a $60 billion all-stock acquisition of Cursor, four days after SpaceX’s own IPO. SpaceX merged with xAI (Elon Musk’s AI lab behind Grok) in February, so this deal brings Colossus compute, the Grok model family, and Cursor’s 4 million developers under one roof. The deal is expected to close in Q3 2026; until then, Cursor operates independently and Claude, GPT-5.5, and Gemini models still work inside it.
Cursor CLI shipped on January 16, 2026 and pulls Cursor’s IDE agent into your terminal - same agent harness, same memory, same MCP connections. Install with curl https://cursor.com/install -fsS | bash, then cursor-agent in a repo.
The differentiating feature is Cloud Handoff. Prepend & to any message and the conversation is pushed to a Cloud Agent that keeps running while you close your laptop. You can resume it from cursor.com/agents on web or mobile and merge the result back when it’s done. It’s the cleanest answer in this list to “I want to leave a long task running.”
Other bits worth knowing: Plan mode asks clarifying questions before touching code (good for new repos), Ask mode explores without editing (good for code-review use cases), and the agent currently auto-routes between Claude, GPT-5.5, and Gemini depending on the task type. What happens to that model-agnostic routing after SpaceX closes the deal is the open question - the practical value of Cursor was always being able to pick Claude for reasoning or GPT for speed and switch freely, and that’s in tension with an owner that also wants to sell you Grok.
Strengths
- Cloud Handoff with
&prefix - resume long tasks from any device - Plan / Ask / Agent modes for different stages of work
- Currently auto-routes across Claude, GPT-5.5, and Gemini
- In-CLI MCP OAuth login flow
Tradeoffs
- Closed source, bundled into the Cursor subscription
- Pending SpaceX/xAI acquisition (closing Q3 2026) makes long-term model neutrality uncertain
- Less useful if you don’t already use the Cursor IDE
Pricing
Included with Cursor Pro ($20/mo), Cursor Business ($40/user/mo), or Cursor Ultra. No standalone CLI tier.
5. Antigravity CLI (Gemini CLI’s replacement)

What happened: Gemini CLI didn’t just get a deprecation notice - Google actually shut it down on June 18, 2026. The open-source repo (Apache 2.0, ~104k stars, 6,000 external contributors) stopped serving requests and was replaced by Antigravity CLI, a closed-source Go binary (command name
agy). The free tier dropped from roughly 1,000 requests a day to about 20. Code Assist Standard/Enterprise (paid org licenses) are unaffected. Official announcement.
Antigravity CLI is Google’s terminal agent and the CLI face of Antigravity 2.0, the agent-first development platform announced at I/O 2026. It shares the same agent harness as the Antigravity desktop app - sessions and agent state move between the two.
Carried over from Gemini CLI: Agent Skills, Hooks, Subagents, and Extensions (now called Antigravity plugins). What’s new: a server-side harness that runs multi-agent workflows asynchronously, so you can kick off background agents and pick the results up later from desktop or web. The underlying model is Gemini 3, with the same 1M+ token context window that made Gemini CLI useful for monorepo-scale work.
The honest tradeoffs: it’s not open source at all now (Gemini CLI was Apache 2.0; Antigravity CLI’s GitHub presence is a changelog and community forum, not a repo you can fork), the much smaller free tier stings if you were a heavy Gemini CLI user, and feature parity isn’t 1:1 - some Gemini CLI workflows needed migration when the switch happened. If you want the open, forkable version of what Gemini CLI used to be, Qwen Code (below) is the closest living fork.
Strengths
- Gemini 3 + 1M token context for very large codebases
- Shared harness with Antigravity 2.0 desktop (resume sessions across surfaces)
- Async multi-agent orchestration as a first-class feature
Tradeoffs
- Closed source (community forum, not open repo) - Gemini CLI’s code is gone
- Free tier cut from ~1,000 requests/day to ~20
- Not 1:1 with Gemini CLI; some workflows required migration
Pricing
A small free tier, more generous limits with Google AI Pro and Ultra, and enterprise access via Gemini Code Assist Standard/Enterprise.
Honorable Mentions: Other CLI Coding Agents Worth Considering
The lineup above shifts based on what you’re optimizing for, and 2026’s consolidation wave means the open-source half of this list matters more than it used to. These tools didn’t make the top 5 but each owns a specific niche - and if you want the deeper, GitHub-stars-ranked version of this section, read Best Open Source CLI Coding Agents in 2026, which covers licenses, local-model support, and which projects are quietly dying in far more detail.
Aider - Was top 5 in earlier versions of this post; moved here because the broader market shifted, not because Aider got worse. Still the best tool I know for “AI pair-programming with Git”: it builds a repomap of your codebase, applies coordinated multi-file edits, and auto-commits with sensible messages so your history stays clean. Works with Claude Opus 4.8, GPT-5.5, DeepSeek, and local models via Ollama. Momentum has slowed (no tagged release since August 2025), but if your workflow is “describe a change, review the diff, commit, repeat,” it’s still hard to beat.
GitHub Copilot CLI - Microsoft’s terminal agent, and worth a mention precisely because it sat out the 2026 acquisition wave entirely: Microsoft has owned GitHub (and by extension Copilot) for years, so nothing here changed hands. Install with npm install -g @github/copilot, then run copilot in a repo; it auto-routes between Claude, GPT, and Gemini models depending on task, and leans on the same permission and PR-review context Copilot already has from GitHub. The catch is the May 2026 switch to token-based billing, which replaced the old flat-rate premium request model and drew plenty of developer pushback over unpredictable costs on larger sessions. A safe default if you’re already paying for Copilot seats org-wide, less compelling if you’re choosing a CLI agent from scratch.

Pi - The most interesting new open-source entrant of 2026, from Mario Zechner and Armin Ronacher (the Flask and Jinja2 author), and already past 50k GitHub stars. Its headline trick is a system prompt under 1,000 tokens - versus 7,000 to 10,000 for tools like Claude Code or OpenCode - achieved through “lazy skills” that only load full instructions into context when a skill is actually invoked. MIT licensed, TypeScript, ships a CLI, a unified LLM API, and TUI/web UI libraries. Worth a look if you want to understand exactly what your agent sends to the model, or build your own tool on a small, readable base.
Cline - Started as a VS Code extension (the one Roo Code and Kilo Code later forked from) and grew a real standalone CLI and SDK in its 3.x line. Model-agnostic across 30+ providers plus local Ollama/LM Studio, with parallel agent execution and Kanban task boards for team use. Apache-2.0, npm i -g cline.
Warp 2.0 - Not strictly an agent; it’s a terminal that is itself agentic. The universal prompt accepts natural language and shell commands in the same input, and the agent runtime can spawn Claude Code, OpenAI Codex, and Antigravity CLI as managed sub-agents in the same UI, plus an auto-routed open-model option (Kimi K2.5, MiniMax, Qwen). Warp open-sourced its client in April 2026 under AGPL-3.0 (UI crates are MIT) - more restrictive than the Apache/MIT licenses most of this list uses, so weigh that if you plan to build on it.
Sourcegraph Amp - Sourcegraph’s coding agent with both CLI (@sourcegraph/amp on npm) and IDE interfaces. The standout feature is Deep mode - an extended-reasoning autonomous research mode for hard, ambiguous tasks (think “figure out why this CI flakes only on Mondays”).
OpenHands - Formerly OpenDevin. Full open-source agentic dev environment with SDK, CLI, local web GUI, and a hosted cloud version. Genuinely autonomous - it can browse the web, execute code, and manage files end-to-end - with a real headless mode for CI/CD. MIT licensed, rebuilt on a new Software Agent SDK for its 1.0 release.
Goose - Block’s open-source CLI agent, co-designed with Anthropic around MCP from day one. In April 2026, Block donated Goose to the Linux Foundation’s new Agentic AI Foundation, so it’s now vendor-neutral and foundation-governed (the repo moved to aaif-goose/goose, so expect stale block/goose links for a while). Runs local models well via 70+ MCP extensions. Particularly good for DevOps-flavored work.
Continue - Ships an open-source terminal agent called cn (npm i -g @continuedev/cli), the same engine behind its IDE extensions, with first-class local-model support. Its 2026 pivot is toward “Continuous AI” - running agents on every pull request as enforceable CI status checks defined in .continue/checks/. The interactive terminal agent still works, but CI is now the headline pitch. Apache-2.0.
Qwen Code - Alibaba’s CLI agent, adapted from the Gemini CLI codebase and optimized for the Qwen3-Coder 480B MoE model. Apache 2.0 licensed. With Gemini CLI itself gone, this is effectively the open fork of that codebase that lives on - the answer if you want a top-tier open-weights coding model with a polished CLI.
Amazon Q Developer CLI - AWS’s CLI, the obvious choice if your daily work is aws ..., CDK, Terraform on AWS, or IAM. Specialized agents for development, docs, and code review; deep AWS API knowledge.
Kimi CLI - Moonshot AI’s CLI, powered by K2.5 with a 256K context and ~100 tok/s output. Also plugs into Claude Code, OpenCode, and Warp as a model backend, so you can use K2.5 inside other tools without switching CLIs.
Crush - Charm’s TUI-first agent (originally called “Open Code” by Kujtim Hoxha, renamed to avoid confusion with opencode/sst-opencode). Multi-model with mid-session switching, LSP-enhanced, gorgeous Bubble Tea UI. Ships under FSL-1.1-MIT (reverts to plain MIT two years after each release) rather than a permissive license outright, so check that if licensing matters for your use case.
Kilo Code - A Roo Code fork (Roo itself forked from Cline) whose CLI is built on top of OpenCode. The main recommended migration target after Roo Code archived itself in May 2026, with a large free model selection out of the box. MIT licensed, npm i -g @kilocode/cli.
Forge - An independent, model-agnostic Rust harness with a clean three-agent split: forge implements, sage researches read-only, muse plans. Fully bring-your-own-key across 300+ models, Apache-2.0. Install curl -fsSL https://forgecode.dev/cli | sh.
Plandex - Built for tasks where context is the bottleneck: 2M-token effective context via a cumulative-diff sandbox, with 20M+ token Tree-sitter indexing. Best when you’re refactoring a huge monorepo, though it’s effectively in maintenance mode now (no commits since October 2025) - self-host it rather than rely on Plandex Cloud.
How to Integrate CLI Coding Agents into Your Workflow
A few habits that pay off after a couple of weeks with any of these:
Pick one tool and stay with it for a month. Switching constantly burns your time on configuration instead of work. Use the decision tree above. Most people end up with Claude Code or Codex for daily driving plus one open-source option (OpenCode, Aider, Pi, or Goose) for local/offline work or as a hedge against vendor changes.
Set sandbox expectations. Read your tool’s default permission model before pointing it at a real repo. Codex sandboxes shell calls by default; Claude Code prompts before destructive ops; OpenCode and Aider trust the model more. If you’re working on production code, lean toward the conservative defaults.
Branch first, agent second. git checkout -b agent/<task> before kicking off any long-running edit. Lets you git diff main... later instead of trying to reconstruct what the agent touched. Aider does this implicitly by committing per change.
Cap the context. Big projects blow up token budgets fast. Most CLIs let you scope context to specific files or directories - use that, or use Plandex if you genuinely need 1M+ tokens of indexed state. Smaller context also gives better results most of the time.
Tests, lints, types. The fastest way to validate AI changes is a test suite. Configure your CLI to run npm test, pytest, cargo test, etc. after edits. Claude Code, Aider, and Codex all support auto-test loops; let them iterate until tests pass instead of hand-checking.
MCP is the integration layer. If you find yourself wanting an agent to talk to GitHub, Linear, Notion, your DB, or your monitoring stack, look for an MCP server before writing custom glue. Most of the top 5 now support MCP first-class.
Conclusion
The CLI coding agent space in mid-2026 looks less stable than it did in January. Two of the tools in this list (Cursor CLI, Antigravity CLI) are now tied to an acquisition or a shutdown-and-replace, OpenAI owns a competing IDE in Windsurf, and the open-source side (OpenCode, Pi, and the rest) has picked up real momentum as a result. That’s why this update reorders the list toward independence, not just capability.
If you’re picking one for the first time: Claude Code on a Claude Pro/Max subscription is still the lowest-risk default for daily use. If you need to run offline, own your data, or just don’t want your tool’s roadmap decided by an acquisition, OpenCode or Pi with your own API key (or Ollama) is the obvious pick - see Best Open Source CLI Coding Agents in 2026 for the full field. Everything else is a matter of which ecosystem you’re already in, and how comfortable you are with that ecosystem’s new owner.