Help: a dev agent in CLI
Aider is a command-line coding agent that edits your files from a request in French and commits every change to Git. Locally, it connects to Ollama with the ollama_chat/ prefix; the decisive setting is the context window, because Ollama silently truncates it to 2,000 tokens by default. A 24-billion-parameter model such as Devstral is the minimum for comfortable use.
An assistant that genuinely modifies your files must be reversible, predictable, and able to run without sending your code to a third party. Aider checks those boxes, provided you configure it correctly for a local model. This guide reviews installation, connecting it to Ollama, model selection, chat modes, the role of Git and your tests, and what fails in practice.
#What Aider is and what it does in your repository
Aider is an open-source command-line programming assistant that describes itself as AI pair programming in the terminal. You run the aider command in a Git repository, describe a change in natural language, and it proposes file changes, applies them, and then records them in a commit. It works with hosted models (Claude, GPT, DeepSeek) as well as local models served by Ollama or LM Studio, making it one of the few coding agents you can use without a single line of your project leaving the machine. The official repository has more than 49,000 stars on GitHub.
Three things distinguish it from a simple chat. First, it maintains a map of the repository: for each request, it sends the model a list of files with their classes, functions, and main signatures, so the model knows where to look without you showing it everything. Next, it is integrated with Git: every change becomes a revertible commit. Finally, it loops over commands you give it—linter and tests—and attempts to fix whatever fails. It is not an autonomous agent that explores the web or launches servers; it is a conversation-driven code editor.
#Install Help
This guide gets you to the model. The kit gets you to the coding copilot in your editor.
- Lifetime online access
- PDF + files
- Lifetime updates
The shortest official method uses the aider-install package, which installs Aider in its own isolated Python environment and, when needed, downloads a compatible Python version. The prerequisite for this route is Python between 3.8 and 3.13. One-line installers based on uv are available for macOS, Linux, and Windows. The old pipx method still works, but the current documentation recommends aider-install.
Then move to the root of your project. If the directory isn't a Git repository, Aider offers to create one, but it's better to initialize it yourself: all the safety net described below relies on Git.
#Connect it to Ollama without getting tripped up by context
Aider's official documentation for Ollama boils down to four steps: define the OLLAMA_API_BASE variable (the usual address is http://127.0.0.1:11434), download the model with ollama pull, start the server, then launch aider with the ollama_chat/ prefix before the model name. The ollama_chat/ prefix is explicitly recommended over ollama/.
The most costly pitfall is the context window. Ollama uses 2,000 context tokens by default, which is tiny for a coding agent, and, crucially, it silently discards anything beyond that limit. Without realizing it, you may therefore be talking to a model that received only the beginning of your files. Aider limits the problem: by default, it automatically sets the Ollama window to the size of each request plus 8,000 tokens for the response. If you prefer a fixed size, you must use a model settings file, not the main configuration file.
Context has a memory cost: the KV cache grows with the window, and a 24-billion-parameter model that already occupies about 14 GB in Q4 leaves little headroom on a 16 GB card. The guide to context windows and the one on KV-cache quantization provide the approximate figures.
#Which local model for Aider
Aider is only as good as the model driving it, and the challenge is twofold: the model must reason about code and follow a strict editing format. A model that doesn't follow this format produces changes the tool can't apply. Aider's public leaderboard, based on 225 Exercism exercises in six languages, measures precisely this dual capability; it is dominated by very large hosted models, while models that fit on a personal machine rank significantly lower. Check it before expecting cloud-level results.
For a local workstation, Devstral 24B, released by Mistral AI and All Hands AI, is a sensible starting point: it is designed for coding agents, weighs 14 GB in the Ollama library, and advertises a 128,000-token context window. On a GPU with 12 GB or less, you need to move down to a smaller model and accept more formatting errors. The “Best Local LLM for Coding” guide compares the current candidates; this guide does not lock in any ranking because it changes too quickly.
| Available memory | Realistic model size | What to expect from Aider |
|---|---|---|
| 8 to 12 GB | 7 to 14 billion (5 to 9 GB) | Small, targeted edits, one file at a time; frequent formatting errors |
| 16 GB | 14 to 24 billion (9 to 14 GB) | Changes across two or three files with limited context |
| 24 GB and up | 24 to 32 billion (14 to 20 GB) | Acceptable for daily use, with a context of 16,000 tokens or more |
| Hosted models | Very large models | Better reliability; reserve for nonconfidential repositories |
#A first change, from prompt to commit
- 01Add the right filesRun aider and pass it the files to modify, for example aider src/api.py src/models.py. The files you add are the ones it can edit; it knows the rest of the repository from the map.
- 02Describe the change preciselyWrite a complete request: “Add a GET /users/:id endpoint that returns the user, or a 404 error if the user doesn’t exist.” A vague request produces a vague diff.
- 03Review the diffAider displays the changes and applies them. Review them with /diff before continuing: this is the time to refuse, not after three additional requests.
- 04Check the commitEach edit is recorded with a descriptive message. If the result is poor, /undo cancels the last commit made by Aider.
- 05Chain together small stepsThen ask for tests, edge-case handling, and logging, one step at a time. Small steps keep the context short and the diff readable.
#The chat commands that matter
Aider offers dozens of slash commands; a handful are enough to work. The general rule: what you haven’t added to the chat can’t be modified, but the repository map lets the model know that other files exist.
- /add et /drop
- Add or remove files from the chat. Removing files that are no longer needed frees up context, which matters greatly with a local model.
- /read-only
- Add a file as read-only reference: the model can read it but cannot edit it. Useful for a conventions file or an interface contract.
- /ask, /code, /architect
- Change the chat mode, for one message or persistently with /chat-mode.
- /run et /test
- /run lance une commande shell et peut en verser la sortie dans le chat ; /test lance la commande de test et ajoute la sortie au chat si elle échoue, ce qui déclenche une correction.
- /diff et /undo
- /diff montre les changements depuis votre dernier message ; /undo annule le dernier commit s'il a été fait par Aider.
- /tokens
- Report the number of tokens used by the current context: the habit to develop to understand why a local model “forgets.”
- /map
- Displays the repository map sent to the model.
#Chat modes: code, ask, architect
Aider distinguishes four chat modes. Code mode, the default, modifies your files. Ask mode discusses the code without ever modifying it. Architect mode uses two models: an architect model proposes the solution, then an editor model translates it into precise file changes. Help mode answers questions about Aider itself. There is no intermediate mode named “paired”; pairing a strong model with a fast model is configured with the --model and --editor-model options.
The workflow recommended by the documentation is to alternate between /ask and /code: discuss the approach in ask mode, then switch to code mode, where a simple “go ahead” is enough to execute the agreed plan. It is a smoother version of architect mode using a single model. For a medium-sized local model, this is often the best compromise: you avoid loading two models into memory and retain control of the plan.
Architect mode is justified for models that reason well but edit poorly. It costs two requests instead of one: enable it only if code mode regularly produces invalid diffs.
#Git, your safety net
Aider relies on Git to make every mistake reversible. With each edit, it commits the changes with a descriptive message generated by the weaker model from the diff and conversation, following the conventional commits style. Before touching a file with uncommitted changes, it first commits the existing state: your work and the AI's remain separate in the history. The commits it creates include “(aider)” in the author name, making them easy to find.
The corollary is a large number of small commits. The best practice is to have Aider work on a dedicated branch, review it, then squash the commits before merging. Two options are worth knowing: --no-auto-commits disables automatic commits, and --git-commit-verify re-enables the pre-commit hooks, which the tool bypasses by default with --no-verify. If your team relies on these hooks, this option changes everything.
#Run your tests in the loop
This is the setting that turns Aider from a code generator into a tool that fixes its own work. With --test-cmd and --auto-test, it runs your test suite after every change; if the command returns a nonzero exit code, it reads the output and attempts a fix. The principle is the same for the linter, with --lint-cmd, and Aider lints the files it edits by default.
Two precautions. The test command must be fast: with a local model, each cycle already costs several dozen seconds of generation. And it must display errors with a nonzero exit code; otherwise, Aider assumes everything is fine.
#What fails with a local model, and how to work around it
- Editing format errors
- The model returns a modification that the tool cannot apply. Switch to a larger model, or test architect mode. Aider's documentation has a troubleshooting page dedicated to these errors.
- Context loss
- Symptom: the model ignores a file you just added. Likely cause: the window is too small or the context is saturated. Response: /tokens, /drop the unnecessary files, then use a larger context.
- Files too long
- A file several thousand lines long overwhelms a local context. Split it up, or request a change to a specific function.
- Vague requests
- “Improve this code” produces unpredictable diffs. Name the file and function, and describe the expected behavior.
- Token limit error
- Aider flags when a model exceeds its limits and suggests actions: request smaller changes, split files, or switch models.
#Aider or an agent in the editor
Aider is for people who work in the terminal and want a clean Git history. If you prefer to stay in VS Code, Cline offers an equivalent experience with step-by-step approval; if you want a more autonomous terminal agent, OpenCode is worth considering. The choice doesn’t depend on model quality, which is the same, but on where you want to review the diffs.
| Criterion | Aider | Agent in the editor (Cline) | Terminal agent (OpenCode) |
|---|---|---|---|
| Interface | Terminal | VS Code | Terminal |
| Git history | Automatic commit per edit | Your responsibility | Your responsibility |
| Repository context | Repository map, files added manually | Tool-based exploration | Tool-based exploration |
| Ideal case | Targeted, reviewed modifications | Multistep tasks with visual validation | Long-running terminal tasks |
- Help + Ollama: the complete workflow in the terminal
- Best local LLM for coding
- Understanding the context window
- Cline + Ollama in VS Code
- OpenCode + Ollama in the terminal
- Review code with a local LLM before committing
- Source: Aider documentation for Ollama
- Source: Aider chat modes
- Source: Aider Git integration
- Source: linting and tests in Aider
- Source: Devstral in the Ollama library
Does Aider really work with a local model?+
Which model should you choose for Aider with Ollama?+
Why does Aider seem to forget my files?+
How do you undo an Aider change?+
Should you disable automatic commits?+
Can Aider run my tests on its own?+
Feedback, an error, or a clarification? Let us know—it improves the guide for everyone.