Coding Assistants

Aider

Aider is an open-source AI pair programmer for the terminal. Chat with Claude or GPT about your git repo, and Aider makes the code changes, commits them with sensible messages, and runs tests — all from the command line.

CLI-first
Interface
Git-native
Auto-commits
Any LLM
Configurable backend

Table of Contents

SECTION 01

What Aider does

Aider is a terminal-based AI pair programmer. You start a chat session pointed at your git repo, add files to the conversation, and tell Aider what you want changed. Aider talks to the LLM, applies the changes to your files using a reliable diff format, and automatically commits the changes with a descriptive commit message.

Unlike browser-based tools, Aider runs entirely locally in your terminal and integrates deeply with git. You always see what's happening: the LLM response, the diff being applied, and the commit being made. This makes Aider transparent and auditable — critical for production codebases.

Aider consistently ranks at or near the top of the SWE-bench leaderboard (a benchmark measuring autonomous code editing performance), often outperforming commercial tools like Copilot Workspace.

SECTION 02

Getting started

pip install aider-chat

# Configure your API key
export ANTHROPIC_API_KEY=sk-ant-...
# or
export OPENAI_API_KEY=sk-...

# Start Aider in your project directory
cd my-project
aider --model claude-3-5-sonnet-20241022

# Basic usage
aider  # uses default model (claude-3-5-sonnet or gpt-4o)
aider --model gpt-4o  # specify model
aider --model ollama/llama3.1  # use local Ollama model
aider --no-auto-commits  # review changes before committing
──────────────────────────────────────────────────────
Aider v0.50.0, model: claude-3-5-sonnet-20241022
Git repo: .git with 47 files
Repo-map: using 1024 tokens, auto refresh
────────────────────────────────────────────────────────────────
>
SECTION 03

The /add workflow

Aider's core workflow is adding files to the chat context, then making requests. Files in the chat give the LLM read access; files added with /add give write access (Aider will modify these files).

> /add src/api/routes.py src/models/user.py

Added src/api/routes.py to the chat.
Added src/models/user.py to the chat.

> Add a /users/me endpoint that returns the current authenticated user's profile as JSON

src/api/routes.py
  + @router.get("/users/me")
  + async def get_current_user(current_user: User = Depends(get_current_user)):
  +     return current_user.to_dict()

src/models/user.py
  + def to_dict(self):
  +     return {"id": self.id, "email": self.email, "name": self.name}

Apply changes? (y/n) y
[main 3a7f8b2] feat: add /users/me endpoint returning current user profile

> /run pytest tests/test_routes.py
SECTION 04

Architect + Editor mode

Aider's Architect mode uses a stronger model for reasoning and planning, and a faster/cheaper model for actually making the code edits. This gives you the reasoning quality of a frontier model at a fraction of the cost.

# Architect with claude-3-5-sonnet, editor with haiku (cheap)
aider --architect --model claude-3-5-sonnet-20241022       --editor-model claude-3-haiku-20240307

# Or use opus for architect, sonnet for editor
aider --architect --model claude-3-opus-20240229       --editor-model claude-3-5-sonnet-20241022

The architect model reads the full context and produces a detailed plan. The editor model takes the plan and implements the specific file changes. Because the editor's job is simpler (just apply a described change), a cheaper model performs nearly as well — typically 80–90% of the quality at 30% of the cost.

SECTION 05

Git integration

Aider is deeply integrated with git. By default, every successful change is committed automatically with a message generated by the LLM describing what was changed and why.

# Aider respects .gitignore automatically
# Useful flags:
aider --no-auto-commits     # don't commit, just make changes
aider --dirty-commits       # commit even if repo has uncommitted changes
aider --dry-run             # show changes but don't apply them

# Undo the last Aider commit
aider --undo

# Common workflow: start on a feature branch
git checkout -b feature/my-feature
aider --model claude-3-5-sonnet-20241022
# make changes, review the auto-commits, squash before merging
git rebase -i main  # squash Aider's fine-grained commits into one

The auto-commit feature means you always have a clean rollback point. If Aider makes a bad change, just git revert the commit.

SECTION 06

Model configuration

# Best models for Aider (benchmark performance order):
aider --model claude-3-5-sonnet-20241022  # top performer on SWE-bench
aider --model o1-mini                      # strong reasoning tasks
aider --model gpt-4o                       # reliable all-rounder

# Cost-optimised:
aider --model claude-3-haiku-20240307      # fast, cheap, good for simple tasks
aider --model gpt-4o-mini

# Local models (privacy, no API cost):
aider --model ollama/llama3.1:70b
aider --model ollama/qwen2.5-coder:32b    # best local coding model

# .aider.conf.yml — persistent configuration
model: claude-3-5-sonnet-20241022
auto-commits: true
dark-mode: true
SECTION 07

Gotchas

Repo map context: Aider builds a "repo map" — a compressed summary of all files in your project — and includes it in every prompt. For large repos (1000+ files), this can consume significant context. Use --map-tokens 0 to disable it if context is too full.

Large file additions: Adding a 5,000-line file to the chat uses most of the context window. Prefer adding only the relevant files, or use /read (read-only) instead of /add (writeable) for reference files you don't want Aider to edit.

LLM costs: With claude-3-5-sonnet at $3/1M input tokens, a complex multi-file task can cost $0.10–$0.50 depending on file sizes. For ongoing development, the Architect+Editor pattern significantly reduces costs.

Merge conflicts: If you edit a file manually while it's also in the Aider chat, you may get merge conflicts when Aider tries to apply its diff. Pause manual editing of chat-tracked files while Aider is working.

Model selection for Aider tasks

Aider supports multiple LLM backends and model configurations, with performance varying significantly across model families and task types. The architect-editor pattern — using a reasoning model for planning and a faster model for edits — provides a good quality-cost tradeoff for complex refactoring tasks. For simpler tasks like adding docstrings or fixing type errors, using a single capable model in code mode is more efficient than the two-call architect-editor flow.

ModelModeBest forTradeoff
claude-3-5-sonnetcode / architectComplex refactoring, new featuresHigher cost per edit
gpt-4ocode / architectMulti-file changes, debuggingGood balance of speed/quality
claude-3-haikueditorFast edits in architect modeLower quality on complex diffs
deepseek-codercodeCost-sensitive code tasksWeaker on reasoning-heavy tasks

Aider's benchmark suite (aider-bench) provides edit correctness scores across model-mode combinations on a standard set of coding tasks. The benchmark scores are the most reliable guide for model selection decisions, as informal impressions from interactive use can be misleading — models that feel fast and responsive in short sessions may perform worse on complex multi-file tasks that the benchmark captures.

Aider's repository map feature automatically constructs a compressed representation of the codebase by extracting function signatures, class definitions, and key structural elements from all files using tree-sitter parsing. This repo map is included in the context for every request, enabling the AI to make changes that correctly reference or modify code in files not explicitly added to the chat. The repo map size scales with codebase size and is automatically truncated when approaching context limits, with the most recently referenced files receiving higher weight in the truncation heuristic.

Aider's /lint command runs the project's configured linter and feeds any errors back to the AI for automatic correction. This tight integration between linting and AI-driven repair enables workflows where the AI generates a first-pass implementation, the linter identifies type errors and style violations, and the AI fixes them in a second pass — all within a single aider session. For typed Python projects using mypy or pyright, this lint-fix loop catches interface mismatches and type annotation errors that the AI's initial generation missed, significantly reducing the manual review burden for AI-generated code.

Watch mode in Aider monitors specified files for changes and automatically incorporates them as context updates during a session. This is particularly useful for test-driven development workflows where the developer writes failing tests and Aider watches the test file, receives the new test as context, and implements the code to pass it. The combination of watch mode with Aider's automatic lint and test running creates a tight feedback loop — the AI sees the failing tests, implements a fix, runs the tests, and iterates until all tests pass, reducing the manual coordination overhead between writing tests and implementing features.

Aider's voice coding feature enables hands-free coding by transcribing spoken instructions using the local whisper model and feeding the transcription as a chat message. This is particularly useful for dictating high-level intent instructions while simultaneously reviewing code on a second monitor, or for developers who find keyboard-intensive coding sessions fatiguing. The voice input workflow works best for architectural instructions and refactoring requests where the spoken description maps naturally to the AI's code modification capabilities, rather than for precise syntax-sensitive instructions where dictation transcription errors would corrupt the intent.

Aider's /undo command reverts the last AI-generated change by running git reset HEAD~1, making it easy to discard a poor suggestion and try a different approach. This tight git integration means that every Aider session produces a clean, reviewable commit history where each AI-generated change is a discrete commit with a message summarizing what was changed. Teams that adopt Aider for production codebases typically configure branch-based workflows where all Aider changes happen on feature branches, preserving the option to review and selectively merge individual commits from an Aider session.

Aider's in-context learning from project conventions happens through the .aider.conf.yml configuration file and the .cursorrules or CONVENTIONS.md files it reads automatically. Including a conventions file that specifies the project's preferred patterns — error handling style, type annotation requirements, logging format, test structure — significantly improves the consistency of Aider-generated code with the existing codebase. Teams that invest 30 minutes in writing a thorough conventions file report substantially higher acceptance rates for Aider's first-attempt code suggestions, reducing the revision cycles needed to align generated code with project standards.