I like tools that disappear into the work. For AI coding, that usually means the terminal. CLIs are scriptable, easy to version, and they respect how teams actually ship software. Below is the short list I use and recommend, with setup commands you can run today, a practical comparison, and project-level config files that make these tools stick across sessions.
The Contenders
- OpenAI Codex CLI - agentic terminal assistant with approval modes for reading, editing, and executing changes. Good guardrails when you need them.
- Google Gemini CLI - open source, interactive TUI and non-interactive modes, multiple auth paths, and Model Context Protocol (MCP) support.
- Anthropic Claude Code - polished terminal workflow, proposes edits, asks before changing files, and can drive common git actions by instruction.
- Aider - OSS, Git-first, works with many providers and local models via Ollama or LM Studio. Great if your source of truth is the repo.
- Opencode - OSS, provider-agnostic, first-class local LLMs (LM Studio, Ollama), and an enterprise path when you need SSO or internal registries.
Copy-Paste Setup: “Hello World” for Each CLI
1) OpenAI Codex CLI
# macOS/Linux via npm or Homebrew
npm install -g @openai/codex
# or
brew install codex
# launch, then follow login prompts
codex
# try a one-off
codex "list the main services in this repo"
Switch approval modes as you gain trust:
/approvals # see current mode
/approvals read-only # safest
/approvals full # reads/edits/runs without asking (use carefully)
2) Google Gemini CLI
# try without installing globally
npx gemini-cli
# or install:
npm install -g gemini-cli
gemini
gemini login # OAuth, or use API key / Vertex/Service Account per docs
3) Anthropic Claude Code
# Node (cross-platform)
npm install -g @anthropic-ai/claude-code
# or native installers (macOS/Linux/Windows)
# macOS/Linux:
curl -fsSL https://claude.ai/install.sh | bash
# Windows PowerShell:
irm https://claude.ai/install.ps1 | iex
# then
claude
# log in with Claude.ai (subscription) or Claude Console (API)
4) Aider
python -m pip install aider-install
aider-install
cd /your/project
# example with Anthropic, but many providers are supported
aider --model claude-3-5-sonnet-20241022 --api-key anthropic=<key>
To go fully local with Ollama:
# defaults to http://127.0.0.1:11434
export OLLAMA_API_BASE=http://127.0.0.1:11434 # Mac/Linux
setx OLLAMA_API_BASE http://127.0.0.1:11434 # Windows (restart shell)
ollama pull qwen2.5-coder:7b
aider --model ollama/qwen2.5-coder:7b
5) Opencode
# one-liner
curl -fsSL https://opencode.ai/install | bash
# or:
npm install -g opencode-ai
brew install sst/tap/opencode
opencode
opencode auth login # add provider keys
opencode models # list available providers/models
opencode run "hello from opencode"
Make it Stick Across Sessions with Project Config Files
These tools look like chat, but the power comes from project-level context. Two files matter most right now:
A) CLAUDE.md (for Claude Code)
What it is A project-scoped markdown file that Claude Code reads at startup to learn your repo, rules, and preferences.
Create quickly
- From inside
claude, run:This generates a starter/initCLAUDE.mdat your repo root (or suggests one).
What to put inside Keep it short and opinionated. A minimal but useful starter:
# Project rules
## Code style
- Follow existing patterns. Prefer small, pure functions.
- Always write unit tests for new code and changed behavior.
## Tech constraints
- Backend: FastAPI + PostgreSQL. Use async endpoints.
- Frontend: React + TypeScript. State via Zustand.
## Safety
- Never write secrets to logs.
- Never push directly to `main`. Open PRs with clear, testable diffs.
## Workflows
- Plan first. For non-trivial work, write a step-by-step plan before making edits.
- Use git branches: `feat/<short-desc>`.
How to use it
- Ask Claude to plan first: “Propose a plan to add an endpoint for /reports with pagination. Use our patterns.”
- Approve small chunks. Let it stage a commit, then you review diffs.
- Update
CLAUDE.mdas conventions evolve.
Tip: For team-wide reuse, consider project subagents under
.claude/agents/that point back to the same rules.
B) AGENTS.md (for Opencode)
What it is An open format file at your repo root that sets rules, roles, and tools for agents. Opencode reads it and wires agents accordingly.
Create quickly Inside an Opencode session, run:
/init
This scaffolds an AGENTS.md you can edit and commit.
What to put inside Here is a compact starter with a primary agent and a subagent for migrations:
# Agents for this project
## Primary agent
description: "General coding agent for this repo"
system: |
You write small, focused changes with tests.
Prefer clarity over cleverness. Follow the service boundaries described in README.md.
tools:
- filesystem
- terminal
- git
## Subagent: db-migrator
description: "Owns DB schema changes and migrations"
system: |
Generate safe Alembic migrations and idempotent scripts.
Require approval before applying migrations.
tools:
- terminal
- filesystem
- git
How to use it
- Start an Opencode session at the repo root and ask the primary agent to plan a change.
- Switch to a subagent when specialized knowledge is required: “@db-migrator add NOT NULL to user.email with a safe backfill.”
- Keep rules tight. Limit tools to what an agent truly needs.
C) Aider config: .aider.conf.yml
If Aider is your daily driver, check in a minimal per-repo config:
model: ollama/qwen2.5-coder:7b
# or: anthropic/claude-3-5-sonnet-20241022
architect: false
git: true
watch: true
openai-api-base: http://127.0.0.1:11434/v1 # when using Ollama's OpenAI-compatible endpoint
files:
- src/**
- tests/**
This removes command noise from your workflow and keeps sessions consistent in CI and locally.
The Useful Comparison (Quick View)
| Capability | Codex CLI | Gemini CLI | Claude Code | Aider | Opencode |
|---|---|---|---|---|---|
| Open source CLI | Yes | Yes | Repo + quickstart available | Yes | Yes |
| Interactive TUI | Yes | Yes | Yes | Yes | Yes |
| Reads/edits code | Yes (approval modes) | Yes | Proposes edits with confirmation | Git-tracked diffs | Yes |
| Runs shell/commands | Yes (approval-gated) | Yes | Yes | Yes | Yes (includes headless mode) |
| Git workflows | Basic | Tools/Actions | Natural-language git tasks | Tight git integration | CI/CD-friendly |
| MCP support | Limited | Yes | Yes (via guides) | Provider compatibility | Yes |
| Local LLMs | Not documented | Not documented | Not documented | Yes (Ollama/LM Studio) | Yes (Ollama/LM Studio) |
First 5 Minutes That De-Risk Adoption
- Codex: start in read-only approvals, ask for a plan, then approve small edits in a feature branch.
- Gemini: test OAuth or API key, add a safe MCP server, and try a non-interactive script in CI.
- Claude Code: run
/initto scaffoldCLAUDE.md, ask it to propose a refactor, approve staged diffs. - Aider: generate a tiny function with tests, review diffs, and tune
.aider.conf.yml. - Opencode: run
/initto scaffoldAGENTS.md, create a subagent for migrations, and testopencode runin CI.
Situational Guidance: Pick by Constraints
- Strict change control → Codex with read-only or ask-first approvals.
- Google Cloud shop → Gemini CLI slots into Vertex and supports MCP.
- Terminal-native pair programming → Claude Code’s flows are smooth and predictable.
- Git-first with local models → Aider + Ollama or LM Studio.
- Open source, provider-agnostic, local today with enterprise runway → Opencode with
AGENTS.md+ subagents.
What’s Next in the Series
- Part 2: Practices that make these tools reliable - session feedback loops, global system prompts, and prompt templates that live next to code.
- Part 3: Enterprise setups - two concrete paths with Opencode: Jetson Orin + Ollama + Qwen on-device, and a hosted open model that mirrors a private internal deployment.