March 16, 202618 min readai-cli-tools

AI CLI Tools Guide 2026: Setup to Multi-Agent

A comprehensive guide to every major AI-powered CLI coding tool in 2026. Covers Claude Code, Gemini CLI, Copilot CLI, Codex CLI, aider, Crush, OpenCode, Goose, and Amp — with installation, pricing, context engineering, multi-agent workflows, MCP integration, terminal pairing, and security best practices for developers building with AI in the terminal.

DH
Danny Huang

What Are AI CLI Tools? (And Why They're Taking Over)

Consider the simplest way to tell a computer what to do. You type a sentence. Not into a chatbot window. Not into an IDE search bar. Into the terminal where your code already lives. The computer reads your project, writes the code, runs the tests, commits the result. That is an AI CLI tool.

The idea is older than it looks. Programmers have always chained small command-line tools to solve problems bigger than any single tool could handle. grep finds patterns. sed transforms text. git tracks history. Each does one thing well. The shell connects them. AI CLI tools follow the same principle -- except the "one thing" they do well is reason about code.

What changed in 2025 was proof. Claude Code and Gemini CLI demonstrated that a headless agent with well-structured context could handle complex, multi-file refactors better than any IDE-integrated copilot. By early 2026, every major AI lab ships a terminal agent: Anthropic has Claude Code, Google has Gemini CLI, GitHub has Copilot CLI, OpenAI has Codex CLI.

Three forces explain why the terminal won:

  • Composability. CLI tools chain with other CLI tools. Pipe one agent's output into another. Run agents in parallel across git worktrees. Not natural inside an IDE.
  • Zero overhead. No GUI rendering. No extension API layer. Every cycle goes to reasoning, not painting syntax-highlighted panels.
  • Automation. A CLI agent slots into CI/CD pipelines, git hooks, and shell scripts the way a wrench fits a bolt. Trigger a code review agent in a pre-push hook without opening an editor.

Takeaway: If your code lives in the terminal, your AI should too. The IDE is not going away, but the locus of AI-assisted work has shifted to the command line.

The Big 10: Every AI CLI Tool Worth Knowing in 2026

Imagine ten workshops on the same street, each run by a different craftsman. They all build furniture, but one specializes in fine joints, another in speed, a third in working with whatever wood you bring.

ToolDeveloperModel(s)PriceOpen SourceKey Strength
Claude CodeAnthropicClaude Opus 4.6, Sonnet 4.6$20-200/mo or APINoBest agentic reasoning, 1M context
Gemini CLIGoogleGemini 2.5 Pro/FlashFree (1,000 req/day)YesBest free tier, massive context
Copilot CLIGitHubMulti-model (Claude, GPT, Gemini)Free-$39/mo (Copilot sub)NoGitHub integration, fleet mode, delegation
Codex CLIOpenAIcodex-mini, o3, o4-mini$20-200/mo (ChatGPT sub)YesCloud sandboxed execution, open source
aiderPaul GauthierAny (100+ models)Free + API costsYesBest git integration, model-agnostic
CrushCharmbraceletAny (OpenAI, Anthropic, Google, etc.)Free + API costsYesBest TUI, LSP-enhanced, widest platform support
OpenCodeAnomaly Innovations75+ models, local + cloudFree + API costsYesLSP integration, YAML subagent architecture
GooseBlock (Linux Foundation)Any LLMFree + API costsYesBest extensibility via MCP, neutral governance
AmpSourcegraphMulti-modelFree tier availablePartialCodebase-wide intelligence, deep mode
Cline CLIClineMulti-modelFree + API costsYesVS Code integration (CLI is secondary)

The short version: Claude Code leads in raw agentic capability. Gemini CLI is the undisputed free-tier champion at 1,000 requests per day. Copilot CLI wins for teams deep in the GitHub ecosystem, with fleet mode for parallel subtasks and cloud delegation. For open-source purists who want full control, aider and Goose are the strongest picks.

Cline CLI appears for completeness. The February 2026 supply chain attack (covered in the security section) damaged trust significantly.

Takeaway: No single tool wins every category. Pick one paid tool for deep reasoning and one free tool for everything else.

Quick Start: Your First AI CLI Session in 10 Minutes

One question decides your starting point: are you willing to pay? No -- begin with Gemini CLI. Yes -- begin with Claude Code. Both share the same interaction model: describe what you want, review proposed changes, approve or refine.

Gemini CLI (free, ~2 minutes)

Requires Node.js 18+ and a Google account. No credit card. No API key.

npx @google/gemini-cli

First launch authenticates with your Google account, granting a free Gemini Code Assist license. Navigate to your project:

cd your-project
gemini

Type "explain the architecture of this project" or "add input validation to the signup form." Gemini CLI reads your codebase, proposes changes, applies after approval.

Claude Code (paid, ~5 minutes)

Requires an Anthropic API key or Claude Pro/Max subscription ($20-200/month).

curl -fsSL https://claude.ai/install.sh | bash
claude

Prompts for authentication on first run. Once connected, same interaction: read project, understand context, propose and apply changes.

# Run with a specific task
claude "refactor the authentication module to use JWT tokens"

The difference: depth of reasoning. Opus 4.6 handles more complex, multi-step tasks. Gemini CLI's 2.5 Pro/Flash blend is faster for straightforward changes.

Takeaway: Run npx @google/gemini-cli today. Zero cost, two minutes. Add Claude Code when free tools hit their ceiling.

The Dual-Tool Strategy: Free + Paid

Think of a two-person team. One handles routine work quickly and cheaply. The other steps in when the problem requires sustained, careful thought. Neither wasted. Neither redundant.

Gemini CLI (free) for:

  • Codebase exploration ("what does this module do?")
  • Simple refactors and code generation
  • Writing tests for existing code
  • Quick debugging and error explanation
  • Documentation generation

Claude Code (paid) for:

  • Multi-file architectural changes
  • Complex refactors requiring system-wide understanding
  • Debugging subtle concurrency or state management issues
  • Code requiring deep domain reasoning
  • Tasks where first-pass correctness saves hours

The cost math: Gemini CLI's 1,000 daily requests cover all exploratory and routine work. Claude Code Pro ($20/month) handles 5-10 complex tasks per day. A developer spending $20/month on Claude Code while using Gemini CLI for everything else gets 90% of a $200/month Max subscription's capability.

The practical workflow: Gemini CLI in one terminal exploring the codebase. Claude Code in another doing the main implementation. Two tools, two terminals, one developer doing the work of a small team.

Try Termdock Multi Terminal works out of the box. Free download →

Takeaway: $20/month plus a free tool covers nearly everything. The dual-tool strategy matches cost to complexity, not brand loyalty.

Context Engineering: CLAUDE.md, AGENTS.md, and Beyond

A curious problem with AI agents: give them too little information and they guess wrong. Give them too much and they follow irrelevant instructions with the same diligence as good ones. The sweet spot is surprisingly narrow.

What Context Files Do

Claude Code reads CLAUDE.md. Codex CLI reads AGENTS.md. Most tools read one or both. These files brief the agent on your project's architecture, conventions, and constraints before it writes a line. Think of it as onboarding a new team member -- except this one reads the briefing every single time.

A Working CLAUDE.md Template

## Project Overview
[One paragraph describing what this project does]

## Architecture
- Framework: Next.js 15 App Router
- Database: PostgreSQL via Prisma
- Auth: NextAuth.js v5
- Styling: Tailwind CSS

## Code Conventions
- Use TypeScript strict mode
- Prefer server components; use 'use client' only when necessary
- Error handling: use Result types, not try/catch
- Tests: Vitest for unit, Playwright for e2e

## Directory Structure
- src/app/ — routes and pages
- src/components/ — shared UI components
- src/lib/ — business logic and utilities
- src/db/ — Prisma schema and migrations

## Important Constraints
- Never modify migration files directly
- All API routes must validate input with Zod
- No default exports except for pages

The ETH Zurich Finding

A February 2026 study from ETH Zurich tested context files across 138 repositories. The counterintuitive result: LLM-generated context files actually reduced task success in 5 of 8 settings, averaging -0.5% on SWE-bench Lite and -2% on AGENTbench. Inference costs rose 20-23%.

Human-written files performed better: +4% average improvement. But costs still rose ~19%.

The conclusion: AI agents are too obedient. Unnecessary instructions get followed with the same diligence as critical ones, making tasks harder. The sweet spot is 200-500 words of high-signal information: architecture, critical conventions, hard constraints. Omit anything the agent can infer (like "this is TypeScript" when tsconfig.json exists).

AGENTS.md for Multi-Tool Compatibility

OpenAI's AGENTS.md works similarly to CLAUDE.md but is recognized by Codex CLI, Copilot CLI, and others. If you use multiple tools, maintain both -- or use AGENTS.md as the canonical source with CLAUDE.md referencing it.

Takeaway: Write your context file by hand. Under 500 words. Only what the agent cannot figure out on its own.

Multi-Agent Development with Git Worktree

A single agent works on a single task. Fine for small problems. For anything larger, you want multiple agents in parallel -- like a construction crew with electricians, plumbers, and carpenters on different parts of the same building simultaneously.

The Pattern

Git worktree checks out multiple branches into separate directories simultaneously. Each agent works in its own worktree, on its own branch, without interfering with others or your main working directory.

Setup Steps

# Create worktrees for parallel agent work
git worktree add ../myproject-feature-auth feature/auth
git worktree add ../myproject-feature-api feature/api
git worktree add ../myproject-fix-tests fix/flaky-tests

Run a separate agent in each:

# Terminal 1: Claude Code working on auth
cd ../myproject-feature-auth
claude "implement OAuth2 PKCE flow for the auth module"

# Terminal 2: Gemini CLI working on API
cd ../myproject-feature-api
gemini "add rate limiting middleware to all API routes"

# Terminal 3: aider fixing tests
cd ../myproject-fix-tests
aider --message "fix the flaky integration tests in tests/api/"

Each agent has full codebase context, makes changes on its own branch, commits independently. When done, review and merge each branch.

Why This Works

The bottleneck in AI-assisted development is not agent speed. It is the developer's ability to context-switch. Running agents in parallel across worktrees delegates context-switching to git while maintaining clean separation.

The challenge: managing multiple terminal sessions, each running a different agent in a different directory. You need all agents visible, quick switching, and clear tracking of which terminal does what. Termdock handles this natively: drag-resize panes to see all three agents, drop files into any terminal, workspace-level Git status syncing across all terminals.

Try Termdock Multi Terminal works out of the box. Free download →

Takeaway: Git worktrees plus multiple terminals turn one developer into a small team. The hard part is not git commands -- it is keeping all those sessions visible and organized.

Cost Reality Check: What You'll Actually Spend

Money clarifies priorities. Actual costs, stripped of marketing:

ToolFree TierPaid EntryPower UserBilling Model
Claude CodeNone$20/mo (Pro)$100-200/mo (Max 5x/20x)Subscription
Gemini CLI1,000 req/dayGoogle AI ProGoogle AI UltraSubscription
Copilot CLI2,000 completions + 50 premium req/mo$10/mo (Pro)$39/mo (Pro+)Subscription
Codex CLINone$20/mo (ChatGPT Plus)$200/mo (Pro)Subscription
aiderUnlimitedN/AN/AAPI costs only
CrushUnlimitedN/AN/AAPI costs only
OpenCodeUnlimitedN/AN/AAPI costs only
GooseUnlimitedN/AN/AAPI costs only
AmpFree tier (up to $10/day)N/AN/APay-as-you-go

Monthly estimates by profile:

  • Budget developer: $0/month. Gemini CLI free handles 80%. Pair with aider or Goose using free local models for offline work.
  • Professional developer: $20-49/month. Claude Code Pro ($20) + Copilot Pro ($10) for GitHub integration + Gemini CLI free for exploration.
  • Power user: $100-200/month. Claude Code Max 5x ($100) or Max 20x ($200) for extended complex reasoning. Free tools for routine work.
  • API-first developer: Variable, typically $30-80/month. aider, Crush, or OpenCode with direct API access. Per-token: cheaper at moderate use, more expensive heavy.

Free-tier stacking: Gemini CLI (1,000 req/day) + Copilot CLI free (50 premium/month) + Goose (free, open source) = three capable agents for $0/month.

Takeaway: Serious AI-assisted development for $0. Nearly all of it for $20. Above $100/month is for developers whose time savings justify the cost many times over.

Terminal Emulators for AI CLI: Ghostty, Warp, and the Rest

Your terminal is the cockpit. One AI agent -- almost any modern terminal works. Three agents across three worktrees -- the cockpit matters a lot.

The Quick Comparison

TerminalPlatformInput LatencyAI FeaturesSplit PanesBest For
GhosttymacOS, Linux~2msNoneYesSpeed + correctness
WarpmacOS, Linux~8msBuilt-in AIYesAI-native terminal
TermdockmacOS, Windows, LinuxNativeAI integration, AST analysisYesMulti-agent workspace with drag-and-drop, Git visual workflow
iTerm2macOS~5msNoneYesmacOS power users
KittymacOS, Linux~3msNoneYesKeyboard-driven workflows
AlacrittyCross-platform~2msNoneNoMinimalism
WezTermCross-platform~4msNoneYesCross-platform consistency

Ghostty deserves its reputation. Created by Mitchell Hashimoto (Terraform, Vagrant). Alacritty-level speed with proper terminal correctness and native platform integration. Over 46,000 GitHub stars in under 15 months. Fast, correct, nothing else? Ghostty.

Warp embeds AI directly: block-based output, error explanation, natural language commands. Tradeoff: higher latency (~8ms), closed source.

The real question is not which terminal for a single session. It is how to manage multiple sessions running parallel AI agents. Individual emulators handle one session well. Three Claude Code instances across three worktrees needs something built for that.

Termdock takes a different approach. A terminal-centric development environment combining terminal management with built-in AI provider integration (OpenAI, Anthropic, Google, xAI), AST-based code analysis across 12+ languages, visual Git workflows, and an integrated file manager. Drag-resize terminals freely. Drop files into any session. Switch workspaces with full state recovery. Git status auto-syncs across all terminals in a workspace.

Ghostty and Warp are excellent standalone terminals. Termdock is the layer turning multiple sessions into a unified AI development workflow.

Takeaway: Pick your terminal based on how many agents you run simultaneously. One: Ghostty. Multiple: you need workspace-level management.

MCP and ACP: The Protocol Layer

Protocols are boring until they are not. Consider USB: before it existed, every device needed its own cable. After, everything just worked. MCP and ACP are doing the same for AI agents.

How MCP Works in CLI Tools

Model Context Protocol (MCP), introduced by Anthropic November 2024, is the open standard connecting AI CLI tools to external data and services. The MCP Servers repository has surpassed 79,000 stars, reflecting massive adoption.

MCP servers expose tools, resources, and prompts for agents. A Postgres MCP server lets Claude Code query your database directly. A GitHub MCP server lets Gemini CLI read issues and create PRs. A Sentry MCP server lets any agent investigate production errors with real data.

{
  "mcpServers": {
    "postgres": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-postgres"],
      "env": { "DATABASE_URL": "postgresql://..." }
    },
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": { "GITHUB_TOKEN": "ghp_..." }
    }
  }
}

Claude Code, Codex CLI, Copilot CLI, Goose, Crush, and OpenCode all support MCP natively. Gemini CLI added MCP in early 2026. The ecosystem effect: once an MCP server exists for a service, every compatible tool uses it immediately.

ACP: The Agent Client Protocol

Agent Client Protocol (ACP), developed by JetBrains and Zed. MCP connects agents to data. ACP connects agents to code editors. The ACP Agent Registry launched January 2026, letting developers browse and install ACP-compatible agents (including Claude Code, Codex CLI, Gemini CLI) directly from their IDE.

MCP and ACP are complementary. MCP gives agents tools and data access. ACP gives agents editor capabilities. Both now live under the Agentic AI Foundation (AAIF) within the Linux Foundation, backed by AWS, Anthropic, Google, Microsoft, and OpenAI.

Takeaway: MCP is the USB port for AI agents. Configure once, every compatible tool benefits. Start with GitHub and your database. Add more as needed.

Security: Supply Chain Attacks and Permission Models

Every tool that can write code and run commands on your machine can be weaponized. Not theoretical. It happened.

What Happened with Cline CLI

February 17, 2026. An unauthorized party used a compromised npm publish token to push a modified Cline CLI 2.3.0 to npm. The malicious version silently ran npm install -g openclaw@latest as a postinstall script, installing the OpenClaw AI agent on approximately 4,000 machines over eight hours.

The attack exploited a vulnerability chain dubbed "Clinejection". Cline's issue triage bot was manipulable via prompt injection to leak credentials. Even after initial disclosure on February 9, credential rotation was incomplete, leaving the npm publish token active. Snyk's analysis documents how the attack composed known vulnerabilities (prompt injection, GitHub Actions cache poisoning, credential weaknesses) into a single exploit requiring nothing more than opening a GitHub issue.

The attack did not affect Cline's VS Code extension or JetBrains plugin. Cline released 2.4.0, revoked the token, migrated to OIDC-based publishing via GitHub Actions.

Permission Models Across Tools

  • Claude Code: Tiered permissions. Reads allowed by default. Writes, shell commands, MCP calls require approval unless allowlisted.
  • Copilot CLI: Plan Mode (review first) and Autopilot Mode (autonomous). Autopilot is opt-in per session.
  • Codex CLI: Cloud sandbox by default. Code execution isolated from your machine.
  • Goose: Explicit approval for tool use and shell commands.
  • aider: Confirmation before changes. Every change is a git commit. Always revertible.

Best Practices

  1. Pin dependencies. Exact versions for AI CLI tools. Never @latest in CI/CD.
  2. Use lockfiles. Commit and verify package-lock.json or equivalent.
  3. Review permissions. Start in confirmation mode. Enable autonomous execution only after trusting the tool on your specific codebase.
  4. Audit MCP servers. Only connect known sources. Review code before granting database or API access.
  5. Separate environments. Run agents in worktrees or containers to limit blast radius.

Takeaway: The Cline incident is a template for future attacks. Pin versions, use lockfiles, start in confirmation mode. Three habits that prevent the most common vectors.

What's Next: 2026 H2 and Beyond

Some trends have enough momentum to be extrapolation, not prediction.

Agent-to-agent collaboration is moving from experimental to production. Claude Code's agent teams, Copilot CLI's fleet mode, Codex CLI's multi-agent features -- all pointing toward workflows where specialized agents coordinate automatically: one writes, one reviews, one tests.

Local model quality is crossing the usability threshold. aider, Crush, and Goose already support local models via Ollama and LM Studio. As open-weight models improve, "free plus private" becomes viable for production, not just experiments.

Protocol convergence between MCP and ACP will likely happen. Same goal: interoperable AI agents. The Agentic AI Foundation is the venue.

Cost compression continues. Gemini CLI's free tier forced every competitor to justify pricing. Expect more generous free tiers and lower per-token costs. Direction: basic AI coding assistance becomes free, premium reasoning stays paid.

Terminal emulators will specialize for AI workflows. Managing three agents across three worktrees with good visibility is solved in theory, painful in practice. Purpose-built solutions will close this gap.

Takeaway: The near future is multi-agent, increasingly free, protocol-driven. Learn worktree-based parallel workflows now.

Getting Started Checklist

Concrete, numbered. Each step builds on the last. Stop at any step and you are better off than when you started.

  1. Install Gemini CLI. Free, no credit card. npx @google/gemini-cli, authenticate with Google.
  2. Create a CLAUDE.md file in your project root. Architecture, conventions, constraints. 200-500 words. Write it by hand.
  3. Run your first task. Something safe: "explain the architecture of this project." Verify the tool understands your codebase before trusting it with changes.
  4. Set up git worktrees. 2-3 worktrees for parallel work: git worktree add ../project-feature feature/name.
  5. Add Claude Code when free tools are not enough. curl -fsSL https://claude.ai/install.sh | bash. Pro at $20/month is enough for most.
  6. Configure MCP servers for your most-used services (GitHub, database, error tracking).
  7. Establish a permission policy. Confirmation mode for all tools. Autonomous execution only after trust is established.
  8. Set up your terminal for multi-agent work. Download Termdock as your AI development hub. Drag-resize panes for each agent. Drop files into any CLI. Workspace switching with full session recovery. Built-in AST analysis and Git visual workflow make it more than a terminal -- it is your AI agent control center.

The landscape will keep evolving. The fundamentals will not: understand your tools, engineer your context, manage your costs, keep security tight.

DH
Free Download

Ready to streamline your terminal workflow?

Multi-terminal drag-and-drop layout, workspace Git sync, built-in AI integration, AST code analysis — all in one app.

Download Termdock →
#ai-cli#claude-code#gemini-cli#copilot-cli#terminal#developer-tools

Related Posts

·ai-cli-tools

Dual-Tool: Gemini CLI + Claude Code Strategy

Cut your AI coding costs by 60-70% with the dual-tool strategy. Use Gemini CLI's free tier for exploration and Claude Code for complex execution. Real workflow, cost math, and setup guide.

gemini-cliclaude-codecost-optimizationai-cliworkflow
·ai-cli-tools

Claude Code + Gemini CLI: Free + Paid Combo

How to combine Claude Code's premium reasoning with Gemini CLI's free tier to cut AI coding costs by 60-70%. Real task routing, setup guide, and cost math for daily development in 2026.

claude-codegemini-clicomparisonai-clideveloper-tools
·ai-cli-tools

First Hour with Claude Code: Install to Output

A step-by-step beginner tutorial for Claude Code. Install, configure CLAUDE.md, complete 3 real tasks on your codebase, and set up your workflow — all in 60 minutes.

claude-codegetting-startedtutorialai-cli
·agent-skills

Agent Skills Guide 2026: Build, Share & Secure

Everything you need to know about Agent Skills: the SKILL.md format, the 490K+ skill ecosystem, security risks, and best practices for Claude Code, Codex CLI, and Copilot.

agent-skillsskill-mdclaude-codecodex-clicopilotai-agents
·ai-cli-tools

Parallel Feature Dev: 3 Claude Code Agents, 3 Worktrees, 1 Termdock

Run 3 Claude Code agents on 3 git worktrees simultaneously from one Termdock window. A step-by-step walkthrough of a real parallel development session.

claude-codegit-worktreeparallel-developmentmulti-agenttermdockai-cli
·ai-cli-tools

Git Worktree Conflicts with Multiple AI Agents: Diagnosis and Fixes

Fix git worktree conflicts when running multiple AI agents. Covers lock files, index.lock, branch conflicts, merge failures, stale worktrees, and build artifacts.

git-worktreemulti-agentconflictsclaude-codetroubleshootingai-cli
·ai-cli-tools

Scaffold a Full-Stack App with 3 AI CLI Tools in Parallel

Use Claude Code, Gemini CLI, and Codex CLI simultaneously to scaffold a full-stack app in under 30 minutes. Step-by-step setup with git worktrees.

claude-codegemini-clicodex-cliscaffoldfullstackparallel-developmentai-cli
·ai-cli-tools

CLAUDE.md Writing Guide: Context Engineering for AI CLI Tools

A step-by-step guide to writing a CLAUDE.md that actually improves AI agent performance. Five sections, real examples, token budgets, and testing strategy.

claude-mdcontext-engineeringclaude-codeworkflowai-clibest-practices