Aider CLI Coding Agent 10 min read

Aider AI: Complete Guide to the Git-Aware CLI Coding Agent

Aider is an open-source terminal coding agent that automatically commits every AI change to git. If you're a Python, Go, or Rust developer who lives in the terminal and values a clean git history, Aider is the coding agent to know.

What Is Aider?

Aider is a CLI coding agent built by Paul Gauthier. Its defining feature is git-awareness: every change Aider makes is automatically committed with a descriptive commit message. This gives you a clean, auditable history of all AI edits — easily reversible with git revert or Aider's own /undo command.

Aider works with any language and supports multi-file edits. You specify which files are relevant, describe the change in plain English, and Aider applies the diff and commits. Key capabilities:

  • Multi-file edits with automatic git commits
  • Support for 100+ AI models (Claude, GPT-4o, DeepSeek, Gemini, Ollama)
  • Architect mode: separate planning model + editor model
  • Auto-run tests after each change (--auto-test)
  • Voice input support
  • Linting and auto-fix on each edit

Aider is MIT-licensed, free to use, and you bring your own API key. Visit the aider.chat website for documentation.

Installation

Aider requires Python 3.9+ and an API key for your chosen model provider.

# Install via pip
pip install aider-chat

# Or via pipx (recommended for isolation)
pipx install aider-chat

# Set API key (Anthropic example)
export ANTHROPIC_API_KEY=sk-ant-...

# Navigate to a git repo and start
cd my-project
aider
# Start with a specific model
aider --model claude/claude-sonnet-4-6

# Start with OpenAI
aider --model gpt-4o

Git required: Aider must be run inside a git repository. Run git init first if your project isn't tracked. Aider will not make changes in a non-git directory.

Key Slash Commands

Aider's interactive session uses slash commands to manage context and control the agent:

Command What it does
/add <file> Add a file to the editable context (Aider can modify it)
/drop <file> Remove a file from context
/commit Manually commit current changes with an AI-generated message
/undo Undo the last git commit made by Aider
/diff Show the diff of uncommitted changes
/run <cmd> Run a shell command and show output to the AI
/ls List files currently in context
/model <name> Switch to a different AI model mid-session

Architect Mode

Architect mode is Aider's most powerful feature for complex tasks. It separates thinking from writing:

  • Architect model (e.g., claude-opus-4) — plans the approach, reasons about the codebase, decides what to change
  • Editor model (e.g., claude-haiku-4-5) — takes the architect's plan and writes the actual code diffs
aider --architect \
  --model claude/claude-opus-4 \
  --editor-model claude/claude-haiku-4-5

Architect mode typically produces better results on complex refactors while keeping editing costs low. The architect's tokens cost more, but the editor's are cheap — net cost is often similar to running Sonnet alone.

Configuring .aider.conf.yml

Avoid typing flags every session by creating a .aider.conf.yml in your project root or home directory:

.aider.conf.yml

# .aider.conf.yml example
model: claude/claude-sonnet-4-6
auto-commits: true
auto-test: pytest
editor-model: claude/claude-haiku-4-5

Other useful config options include auto-commits: false (disable auto-commit, review first), read: CONVENTIONS.md (always read a context file), and dark-mode: true for terminal color scheme.

SWE-bench Performance

SWE-bench measures how well AI agents fix real GitHub issues. Aider consistently places among the top open-source tools:

Configuration SWE-bench Verified score
Aider + claude-opus-4 (architect) ~72%
Aider + claude-sonnet-4-6 ~67%
Aider + gpt-4o ~56%
Aider + DeepSeek V3 ~49%

Scores change frequently as models improve. See aider.chat/docs/leaderboards for the current benchmark results.

Aider vs Claude Code vs Cursor

Feature Aider Claude Code Cursor
Interface Terminal (CLI) Terminal + VS Code Full GUI IDE
Auto git commits ✅ Core feature ⚠ Manual
Model choice ✅ Any Claude only Claude/GPT-4o/Gemini
Architect mode
Open source ✅ MIT
Tab autocomplete

Use Aider when you want terminal-native, git-committed AI edits with full model freedom. For more context, see our Claude Code guide and Cursor guide.

Power User Tips

  • Use --auto-test: Run aider --auto-test pytest to automatically run your test suite after every change. If tests fail, Aider retries the fix automatically.
  • Keep context tight: Only /add files that are directly relevant to the current task. Adding too many files inflates the context window and increases cost without improving results.
  • Use /run for feedback loops: After Aider makes a change, use /run python myfile.py to show the output back to Aider for immediate iteration.
  • Read-only context: Use aider --read README.md to provide context files that Aider can read but not edit.
  • Monitor API uptime: Aider stops working when your AI provider is down. Track Anthropic status on Prismix to know immediately.

Never Lose a Coding Session to a Provider Outage

Aider depends on external AI APIs. When Anthropic or OpenAI has an incident, your work stops. Monitor all your AI providers in one dashboard and get email alerts the moment something degrades.

Monitor AI APIs Free →