Best Open Source CLI Coding Agents in 2026


Updated on May 25, 2026
· 15 mins read
CLI tools AI coding agents open-source command line harness terminal OpenCode Pi Aider Goose OpenHands Cline
mosaic of open source CLI coding agents: OpenCode, Codex, OpenHands, Cline, Pi, Goose, Aider, Continue, Crush

Open source coding agents had a wild first half of 2026. OpenCode, the most-starred one, blew past 165k GitHub stars and then got into a public fight with Anthropic over subscription login. Google announced it’s retiring the 104k-star Gemini CLI in June and replacing it with a closed-source successor. Block handed Goose to the Linux Foundation. Roo Code, at 24k stars, archived itself. And a brand-new harness called Pi - from Armin Ronacher, the person behind Flask and Jinja2 - showed up and crossed 54k stars by running on a system prompt under 1,000 tokens.

If you want an AI coding agent that lives in your terminal, drives your shell directly, and ships under a license you can actually read, this is the field. Below are the open source CLI coding agents worth your time in 2026, ranked by GitHub stars (the clearest popularity signal we have, all pulled live in late May 2026), with honest notes on licenses, local-model support, and which projects are quietly dying.

Comparison Table for Top Open Source CLI Coding Agents

CLI AgentGitHub StarsLicenseLocal ModelsBest For
OpenCode~165kMITYes (Ollama)The default open-source pick; provider-agnostic
OpenAI Codex CLI~85kApache-2.0Yes (--oss)OpenAI users wanting a sandboxed agent
OpenHands~75kMITYesAutonomous, sandboxed runs and CI/CD
Cline~62kApache-2.0YesOne agent across IDE, CLI, and SDK
Pi~54kMITYesA lean, hackable, token-efficient harness
Goose~46kApache-2.0YesMCP-driven general automation (not just code)
Aider~45kApache-2.0YesGit-native, surgical multi-file edits
Continue~33kApache-2.0YesOpen-source agent wired into CI as PR checks
Qwen Code~25kApache-2.0YesOpen fork of Gemini CLI + open-weight models
Crush~25kFSL-1.1-MITYesThe best-looking terminal UI; mid-session model swaps

Summary

  1. The open-source leader: OpenCode (~165k stars, MIT) is the de facto open-source alternative to Claude Code: provider-agnostic, local models, polished TUI.

  2. The breakout newcomer: Pi (~54k stars, MIT), from Armin Ronacher and Mario Zechner, runs on a sub-1,000-token system prompt via “lazy skills” and is built to be forked and rewired.

  3. Top open source CLI agents in 2026 (by GitHub stars):

    • OpenCode (~165k) - the default provider-agnostic harness
    • OpenAI Codex CLI (~85k) - open source (Apache-2.0), tuned for OpenAI models, sandboxed
    • OpenHands (~75k) - autonomous, sandboxed, runs headless in CI
    • Cline (~62k) - model-agnostic across IDE, CLI, and SDK
    • Pi (~54k) - lean, token-efficient, hackable
    • Goose (~46k) - general MCP agent, now under the Linux Foundation
    • Aider (~45k) - Git-native pair programming
  4. What changed in 2026: Gemini CLI is being retired on June 18, 2026 for a closed-source successor; Roo Code (~24k stars) was archived in May; OpenCode dropped Claude Pro/Max login after an Anthropic dispute; Goose moved to the Linux Foundation.

  5. How to pick: read the license (not all “free” tools are open source), confirm local-model support if privacy matters, and check the last commit date so you don’t adopt something stalled.

What an open source CLI coding agent actually is

A coding “harness” is the scaffolding around a model: the loop that reads your files, calls tools, runs shell commands, and feeds the results back so the model can take the next step. The model does the thinking; the harness does the driving. The interesting consequence is that the harness and the model are separable, so an open source harness lets you swap GPT-5.5 for Claude Opus 4.7 for a local Qwen model without changing your workflow.

That separation is the whole pitch for open source here, and there are three concrete reasons to care:

  • You can run local models. Provider-agnostic harnesses talk to Ollama, LM Studio, or any OpenAI-compatible endpoint, so your code never leaves your machine. That’s the deciding factor for teams with data-residency rules.
  • No vendor can switch it off. When a closed CLI changes pricing, retires (see Gemini CLI below), or blocks a login method, you’re stuck. An MIT or Apache repo can be forked.
  • You can read and change the prompt. The system prompt, the tool definitions, the permission model: all in the repo. If the agent does something dumb, you can see why and fix it.

The tradeoff is real: most of these expect you to bring your own API key and to understand their permission model before you let a model run rm in your repo. None of that is hard, but it’s not the one-click experience of a paid product.

How to choose an open source CLI coding agent

  • Check the license, not the price. “Free” and “open source” aren’t the same. OpenCode, Pi, OpenHands, and Kilo Code are MIT. Aider, Goose, Cline, Continue, Codex, and Qwen Code are Apache-2.0. Crush ships under FSL (it reverts to MIT two years after each release). Warp is AGPL-3.0. If you want to embed or resell, that distinction matters.
  • Decide if you need local models. If yes, stay with the provider-agnostic harnesses: OpenCode, Pi, Goose, Aider, Crush, Continue, or Forge.
  • Match the tool to the work. Surgical Git edits point to Aider. Autonomous, unattended runs point to OpenHands. General automation beyond code points to Goose. A hackable base to build on points to Pi.
  • Check the pulse. Stars show popularity; the last commit date shows momentum. A 20k-star project with no commits in seven months is a worse bet than a 5k-star one shipping weekly.

The best open source CLI coding agents in 2026

1. OpenCode

opencode cli

OpenCode is the open-source breakout of the era and the most-starred coding agent on GitHub, full stop. It’s a terminal-first TUI with two built-in agents (build with full access, plan read-only), LSP integration for 20+ languages, and MCP support. Install with curl -fsSL https://opencode.ai/install | bash or npm i -g opencode-ai.

The core selling point is provider neutrality: it works with OpenAI, Google, OpenRouter, dozens of others, and local models through Ollama and any OpenAI-compatible endpoint. It ships through npm, Homebrew, the AUR, Nix, and more, and it’s under genuine MIT.

Two things to know before you adopt it. First, the project moved from sst/opencode to anomalyco/opencode (the team rebranded to Anomaly), so old Docker image references break. Second, after a January 2026 dispute, Anthropic forced OpenCode to remove Claude Pro/Max subscription login; you can still use Claude with a raw API key, and OpenAI now partners with the project so ChatGPT subscriptions work natively.

Strengths

  • Largest open-source community by far; very active releases
  • Truly provider-agnostic, including local models
  • build / plan agent split, LSP, and MCP out of the box

Tradeoffs

  • Ollama auto-discovery is reportedly flaky in some configs
  • Claude Pro/Max subscription login was removed (API key still works)
  • Huge, fast-moving project means lots of open issues

Repo: anomalyco/opencode (was sst/opencode) - ~165k stars - MIT

2. OpenAI Codex CLI

openai codex cli

Codex CLI is worth including precisely because people forget it’s open source: it’s Apache-2.0, rewritten in Rust, and the repo is openai/codex. Install with npm i -g @openai/codex or brew install --cask codex. It defaults to GPT-5.5 on a ChatGPT login (or GPT-5.2-Codex on an API key).

The differentiator is sandboxing: shell commands run in a containerized environment by default and can’t touch the rest of your machine without explicit approval or --full-auto. That makes it the safest of the big agents to point at a repo unattended. And while it’s clearly built around OpenAI’s models, it isn’t hard-locked: the --oss flag runs against a local Ollama model (gpt-oss:20b by default), and you can wire up any OpenAI-compatible endpoint in config.toml.

Strengths

  • Sandboxed shell by default; safe for unattended runs
  • Genuinely open source (Apache-2.0), local OSS models via --oss
  • Tight ChatGPT integration for cloud handoff

Tradeoffs

  • Tuned for OpenAI models; local/other providers are clearly the B-path
  • Sandbox adds a small latency tax on file-heavy work
  • Thinner skill/plugin ecosystem than OpenCode

Repo: openai/codex - ~85k stars - Apache-2.0

3. OpenHands

openhands - build with coding agents

OpenHands (formerly OpenDevin) is the most autonomous option here. It runs the agent inside a sandboxed runtime that can browse the web, execute code, and edit files end to end, and it has the strongest headless story of the bunch: openhands -t "fix the failing tests" for one-shot tasks, --headless for CI/CD, and --resume to pick a conversation back up. It rebuilt on a new Software Agent SDK for the 1.0 release in 2026.

Under the hood it uses LiteLLM, so 100+ providers work without code changes, including local Ollama, llama.cpp, vLLM, and MLX. Install needs Python 3.12 and uv: uvx openhands or pip install openhands.

Strengths

  • Genuinely autonomous, sandboxed multi-step runs
  • True headless mode for CI/CD pipelines
  • 100+ providers via LiteLLM, including local models

Tradeoffs

  • Python 3.12-only install is strict
  • Open-weight local model results are mixed in practice
  • More moving parts than a simple edit-and-commit agent

Repo: OpenHands/OpenHands (was All-Hands-AI/OpenHands) - ~75k stars - MIT (core)

4. Cline

cline github repository

Cline started as the VS Code extension that Roo Code and Kilo Code later forked from, and in the 3.x line it grew a real standalone CLI and SDK. The repo now bills itself as “an autonomous coding agent as an SDK, IDE extension, or CLI assistant.” Install with npm i -g cline; it ships prebuilt platform binaries so you don’t need a separate runtime.

It’s model-agnostic by design (30+ providers in 2026, plus local via Ollama and LM Studio), and the 2026 additions lean into teams: parallel agent execution with Kanban task boards, plus Slack and Linear integrations. The catch is that the CLI is newer than the long-established extension, so it’s less battle-tested as a pure terminal tool than OpenHands’ CLI.

Strengths

  • One model-agnostic agent across IDE, CLI, and SDK
  • Parallel agents with Kanban task boards
  • Prebuilt binaries, no runtime juggling

Tradeoffs

  • The standalone CLI is relatively new
  • No bundled free model tier without an account or your own key

Repo: cline/cline - ~62k stars - Apache-2.0

5. Pi

pi coding agent github repository

Pi is the most interesting new entry. It’s a minimal terminal coding harness from Mario Zechner and Armin Ronacher (yes, the Flask and Jinja2 author), and its headline trick is a system prompt under 1,000 tokens, against roughly 7,000 to 10,000 for Cline, OpenCode, and Claude Code. It pulls that off with “lazy skills”: every capability keeps only a one-line description in context, and the full instructions and tool schemas load only when the skill is actually invoked.

The pitch isn’t “most features,” it’s “smallest, clearest harness you can adapt without forking internals.” It ships a coding agent CLI, a unified LLM API, TUI and web UI libraries, and MCP support, all MIT and TypeScript. It’s on npm as @mariozechner/pi-coding-agent. If you want to understand exactly what your agent sends to the model, or build your own tool on a clean base, this is the one to read.

Strengths

  • Sub-1K-token system prompt via lazy skills; cheaper and faster turns
  • Small, readable, designed to be adapted and embedded
  • Unified LLM API plus TUI/web libraries in one toolkit

Tradeoffs

  • Younger and less battle-tested than OpenCode or Aider
  • Minimalism means fewer batteries-included features
  • Several near-identical forks/mirrors exist; start from the canonical repo

Repo: earendil-works/pi (formerly badlogic/pi-mono) - ~54k stars - MIT

6. Goose

goose cli

Goose is a general-purpose agent, not strictly a coding tool, which is its strength and its caveat. Built in Rust with a single-binary CLI plus a desktop app, it handles research, automation, and data tasks alongside code, and it leans hard on MCP with 70+ extensions. It supports 15+ providers including local Ollama.

The 2026 story is governance: Block donated Goose to the Linux Foundation’s new Agentic AI Foundation in April, so it’s now vendor-neutral and foundation-governed (and the repo moved from block/goose to aaif-goose/goose). Install via the script at goose-docs.ai.

Strengths

  • General agent: code, research, automation, system glue
  • 70+ MCP extensions; Rust single binary
  • Foundation-governed, vendor-neutral

Tradeoffs

  • Broader scope means less coding specialization than Aider or Crush
  • The org move left a trail of stale block/goose links

Repo: aaif-goose/goose (was block/goose) - ~46k stars - Apache-2.0

7. Aider

aider cli

Aider is the original “AI pair programming in your terminal,” and it’s still the best at one specific thing: disciplined, Git-native editing. It builds a tree-sitter repomap for context across 100+ languages, applies coordinated multi-file edits, and auto-commits each change with a sensible message so your history stays clean and reversible. Install with pipx install aider-chat.

One honest note on momentum: Aider is maintained (the default branch still gets real commits in 2026), but there’s been no tagged release since August 2025, so velocity has clearly slowed compared with OpenCode, Goose, and Crush. If your workflow is “describe a change, review the diff, commit, repeat,” it’s still hard to beat.

Strengths

  • Tree-sitter repomap; excellent on large existing codebases
  • Git-native: auto-commits, easy diff and undo
  • Works with Claude, GPT, DeepSeek, and local models

Tradeoffs

  • No tagged release since Aug 2025; slowing momentum
  • Largely single-maintainer driven

Repo: Aider-AI/aider - ~45k stars - Apache-2.0

8. Continue

continue - quality control for your software factory

Continue ships an open-source terminal agent called cn (install npm i -g @continuedev/cli, then run cn), the same engine that powers its IDE extensions. It runs as a TUI or fully headless (cn -p "prompt") for scripts and git hooks, with a permission policy file at ~/.continue/permissions.yaml and first-class Ollama support including autodetect.

What’s different is the 2026 positioning: Continue pivoted toward “Continuous AI,” running agents on every pull request as enforceable CI status checks defined as markdown in .continue/checks/. The interactive terminal agent still exists, but the project’s center of gravity is now CI. Note the naming: the command is cn, the package is @continuedev/cli, and a separate @continuedev/cn engine package also exists, so don’t mix them up.

Strengths

  • cn CLI plus an unusual CI-checks workflow
  • Strong local-model and autocomplete support
  • Per-role model config (chat, edit, embed, and so on)

Tradeoffs

  • Headline focus shifted to CI; the terminal agent is no longer the pitch
  • Package/command naming is genuinely confusing

Repo: continuedev/continue - ~33k stars - Apache-2.0

Honorable mentions

The list above is the high-star core. These each own a narrower niche worth knowing:

Qwen Code (~25k stars, Apache-2.0) - Alibaba’s terminal agent, a fork of Google’s Gemini CLI tuned for Qwen-Coder models. Given the Gemini CLI sunset, it’s effectively the open fork of that codebase that lives on, and it pairs well with strong open-weight models. Install npm i -g @qwen-code/qwen-code@latest.

Crush (~25k stars, FSL) - Charm’s gorgeous Go TUI, from the team behind Bubble Tea. Multi-model with mid-session switching, LSP and MCP support. The pick if terminal aesthetics and snappiness matter. Note the license is FSL, not MIT (it converts to MIT after two years), and it’s still pre-1.0. Install brew install charmbracelet/tap/crush.

crush cli

Kilo Code (~20k stars, MIT) - a Roo Code fork (and Roo forked from Cline) whose CLI is itself built on OpenCode. It’s the main recommended migration target for ex-Roo users, with a large free model selection out of the box. Heavily derivative, but polished and active. Install npm i -g @kilocode/cli.

Forge (~7k stars, Apache-2.0) - 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. Install curl -fsSL https://forgecode.dev/cli | sh.

gptme (~4k stars, MIT) - a deliberately small Python CLI agent that can use the shell, run Python, and edit files. Good if you want something minimal and scriptable that works fine with local models.

Plandex (~15k stars, MIT) - built for very large, multi-step tasks with up to 2M tokens of context and a diff-review sandbox. Caveat: the repo has had no commits since October 2025 and Plandex Cloud is winding down, so treat it as effectively maintenance-mode and self-host it.

Notable 2026 changes (and what to avoid)

The open-source field reshuffled hard this year. A few storylines are worth tracking before you commit:

  • Gemini CLI is being retired. Google’s gemini-cli (~104k stars, Apache-2.0) stops serving requests for AI Pro, Ultra, and free users on June 18, 2026, replaced by Antigravity CLI, which is not open source (its GitHub presence is a changelog and a community forum, no source). If you want the Gemini-CLI experience to stay open, Qwen Code is the living fork. Code Assist Standard/Enterprise licenses are unaffected.
  • Roo Code is archived. The VS Code extension (~24k stars) shipped its final release on May 15, 2026 and the repo is read-only. The team pivoted to a cloud product, “Roomote.” Don’t start new work on it; migrate to Kilo Code or Cline.
  • OpenCode dropped Claude subscription login. After Anthropic’s January 2026 enforcement, OpenCode removed Claude Pro/Max OAuth. Claude still works via a raw API key, and OpenAI now partners with the project.
  • Goose joined the Linux Foundation. A net positive for neutrality, but expect stale block/goose links for a while.
  • Warp open-sourced its client. Warp (~60k stars) released its client under AGPL-3.0 (UI crates are MIT) in April 2026. It’s a full agentic terminal rather than a single CLI agent, and AGPL is more restrictive than the Apache/MIT licenses most tools here use, so weigh that before building on it.

How to get the most out of a CLI coding agent

A few habits that pay off with any of these after a couple of weeks:

  • Bring your own key and pin a model. Most of these are free; you pay only for API usage. Start with one strong model rather than letting auto-routing decide, then adjust.
  • Read the permission model before you let it run. Codex sandboxes the shell by default; OpenHands has approval modes; Aider stays in an edit-and-commit lane; others trust the model more. Know which one you’re using before pointing it at production code.
  • Branch first, agent second. Run git checkout -b agent/<task> before any long edit so you can git diff main... afterward. Aider does per-change commits for you.
  • Cap the context. Scope the agent to specific files or directories; smaller context is cheaper and usually gives better results. Reach for Plandex only when you genuinely need 1M+ tokens.
  • Wire in tests and lints. The fastest way to validate AI changes is a test suite the agent runs after each edit. Let it iterate until tests pass instead of eyeballing diffs.
  • Use MCP for integrations. Before writing custom glue to reach GitHub, Linear, or your database, check for an MCP server. Most of these support MCP first-class now.

Conclusion

For most people the answer is short: OpenCode is the lowest-risk open-source default in 2026, provider-agnostic and by far the most active. If you want something lean and hackable to build on, Pi is the most interesting new harness in years. For unattended, sandboxed runs and CI, reach for OpenHands; for disciplined Git-native edits, Aider still wins; and if you want a general agent that does more than code, Goose fits.

Whatever you pick, check two things first: the actual license, and the date of the last commit. The Gemini CLI sunset and the Roo Code archival are reminders that popularity today doesn’t guarantee the project is alive tomorrow. The advantage of staying in open source is that if your tool stalls, you can fork it or switch the model underneath and keep going.