Aider

On this page 8

Aider is an open-source AI pair programming tool that runs in the terminal, connects to a large language model and edits source files directly inside a local git repository, committing every change with a descriptive message. In AI for coding, it is one of the earliest and most influential command-line coding assistants, created by Paul Gauthier and released under the Apache 2.0 license in 2023.

Aider is model-agnostic: it works with hosted models from Anthropic, OpenAI, Google and DeepSeek as well as local models served through tools such as Ollama. Its design favors a tight conversational loop in which the developer decides which files the model may change, reviews each diff and can undo any step with a single command.

How Aider edits a codebase

A session starts when the developer runs Aider in a project folder and adds files to the chat. Those files are sent to the model in full, while the rest of the repository is summarized by a repository map. The developer then describes a change in natural language, the model replies with structured edit instructions, and Aider applies the edits to disk and creates a git commit.

The repository map is central to Aider’s efficiency. It uses tree-sitter parsers to extract classes, functions and signatures from every file, builds a graph of which symbols reference which, and ranks them with a PageRank-style algorithm. Only the most relevant symbols are included, trimmed to a configurable token budget of about 1,000 tokens by default, so the model understands the wider codebase without receiving all of it.

The model must express changes in an edit format that Aider can parse reliably. The choice of format strongly affects accuracy and cost, as the table below shows.

Edit formatHow changes are expressedStrengthWeakness
WholeThe model returns the complete updated fileSimple and robust for weak modelsExpensive for large files
DiffSearch and replace blocks quoting the original linesEfficient for targeted changesFails if quoted text does not match exactly
UdiffUnified diff similar to git outputReduces lazy or truncated edits in some modelsHarder for small models to produce
Architect and editorOne model plans, a second model writes the editsCombines strong reasoning with precise editingTwo model calls per change
Edit formats used by Aider

Chat modes and in-chat commands

Aider separates talking about code from changing code through chat modes. In code mode the model edits files; in ask mode it answers questions without touching anything; in architect mode a reasoning model proposes a solution that an editor model then applies. This separation lets developers explore a design safely before allowing edits.

Slash commands control the session. The most frequently used ones are listed below.

CommandPurpose
/add and /dropAdd files to the editable context or remove them
/read-onlyProvide reference files the model may read but not change
/undoRevert the last commit made by Aider
/diffShow the changes since the last message
/run and /testExecute a shell or test command and share the output with the model
/architect and /askSwitch to planning or question-only mode
/tokensReport how much of the context window each item uses
Common Aider commands

Aider can also lint and test automatically after each edit. When a linter or test suite fails, the error output is fed back to the model, creating a self-debugging loop that often fixes syntax errors and simple regressions without developer intervention.

Git integration and safety

Every accepted edit becomes a git commit, with a message generated by a smaller model. This makes the full history of AI changes auditable and reversible through ordinary git tools. If the working tree already contains uncommitted human changes, Aider commits them separately first, so human and AI work stay distinguishable in the log.

Aider does not run arbitrary commands on its own initiative in the way fully autonomous agents do; shell commands it suggests require explicit confirmation. This keeps the developer in control but also means Aider is closer to AI pair programming than to unattended agentic coding.

Aider compared with other coding assistants

Aider is often compared with IDE extensions and autonomous agents. The comparison below highlights where its approach differs.

ToolInterfaceAutonomy levelContext strategy
AiderTerminal, optional IDE watch modeDeveloper-guided, change by changeChosen files plus repository map
ClineVS Code extensionAgentic with approval stepsTool calls that read files on demand
OpenHandsWeb interface and sandboxHigh, runs tasks end to endAgent explores a container
SWE-agentResearch agent frameworkHigh, issue to patchCustom agent-computer interface
JetBrains AI AssistantIDE integratedMostly assistiveEditor context and indexing
Aider and related tools

The project also maintains the Aider polyglot benchmark, a set of 225 difficult Exercism exercises in C++, Go, Java, JavaScript, Python and Rust. Its public leaderboard measures how well different models perform as code editors, including the share of responses that use the edit format correctly.

Configuration and practical use

Aider is installed as a Python package and configured through command-line flags, environment variables or a YAML configuration file in the project or home directory. An ignore file excludes paths from the repository map, and a conventions file loaded as read-only context communicates coding standards, similar to a project rules file or AGENTS.md.

  • Add only the files that need changing; extra files waste tokens and distract the model.
  • Use a strong model for architect mode and a cheaper, precise model as the editor.
  • Enable auto-testing with a fast test command so failures return to the model immediately.
  • Use watch mode to trigger edits from special comments written in any editor.

Limitations and common pitfalls

Aider’s quality depends heavily on the underlying model: weaker models produce malformed edit blocks or incomplete changes. Very large refactors can exceed the context window, and the developer must still select the right files. Costs with hosted models can rise quickly when many large files are added, and generated code can include hallucinated packages or APIs that need careful review before merging.

A plain-language summary

Aider is a coding helper that lives in the command line. A programmer tells it in ordinary words what to change. It asks an AI model for the change and writes it straight into the files.

Every change is saved as a separate step in the project history. If something goes wrong, one command undoes it. It works like a careful assistant who edits only the pages you hand over and labels each edit.

An example from practice

A backend developer maintains a Python web service and must add rate limiting to three API endpoints. She starts Aider in the repository, adds the routing module and the settings file, and marks the existing tests as read-only reference material.

In architect mode, a reasoning model proposes a token-bucket design with configurable limits. After she approves it, the editor model writes the middleware, updates the routes and adds new tests. Aider runs the test suite automatically; one failing test is sent back to the model, which corrects an off-by-one error in the refill logic.

The work ends with four small commits that she reviews with ordinary git tools before opening a pull request. The whole change takes under an hour, and the clean commit history makes the code review straightforward for her teammates.