Advanced 13 minDev

Help: a dev agent in CLI

Direct response

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.

By Mohamed Meguedmi·Update 2026-09-30·Tested on Windows, macOS, and Linux

#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.

i
This guide and its companion
This guide covers installation, local configuration, and the habits that help avoid failures. The “Help + Ollama: coding in the terminal” guide goes further into a complete workflow; the code-model comparison is in the dedicated guide.

#Install Help

The Local Copilot Kit

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.

Recommended installation
python -m pip install aider-install
aider-install

# Vérifier
aider --version

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/.

Launching with a local model
export OLLAMA_API_BASE=http://127.0.0.1:11434
ollama pull devstral:24b
OLLAMA_CONTEXT_LENGTH=8192 ollama serve

# Dans un autre terminal, à la racine du projet
aider --model ollama_chat/devstral:24b

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.

.aider.model.settings.yml file (fixed context size)
- name: ollama_chat/devstral:24b
  extra_params:
    num_ctx: 32768
!
A common mistake in tutorials
Writing num_ctx directly in .aider.conf.yml does not fix the Ollama window: this setting belongs to the model settings (extra_params). Check the value actually being used with the /tokens command, which details what is sent.

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.

Choose based on your machine (memory guidelines, Q4 weights excluding context)
Available memoryRealistic model sizeWhat to expect from Aider
8 to 12 GB7 to 14 billion (5 to 9 GB)Small, targeted edits, one file at a time; frequent formatting errors
16 GB14 to 24 billion (9 to 14 GB)Changes across two or three files with limited context
24 GB and up24 to 32 billion (14 to 20 GB)Acceptable for daily use, with a context of 16,000 tokens or more
Hosted modelsVery large modelsBetter reliability; reserve for nonconfidential repositories

#A first change, from prompt to commit

  1. 01
    Add the right files
    Run 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.
  2. 02
    Describe the change precisely
    Write 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.
  3. 03
    Review the diff
    Aider displays the changes and applies them. Review them with /diff before continuing: this is the time to refuse, not after three additional requests.
  4. 04
    Check the commit
    Each edit is recorded with a descriptive message. If the result is poor, /undo cancels the last commit made by Aider.
  5. 05
    Chain together small steps
    Then 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.

Work on a disposable branch
git switch -c ai/endpoint-users
aider src/api.py
# ... relire, tester, puis :
git rebase -i main

#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.

Automatic test loop
aider --test-cmd "pytest -x -q" --auto-test --lint-cmd "ruff check"

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.
→
Privacy: what actually leaves the system
With Ollama locally, the code stays on the machine. However, check Aider's configuration: the tool offers optional usage-statistics collection, and a hosted model configured by mistake would send code excerpts to a third party. The site's privacy checklist details the points to check.

#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.

Competing with other local coding agents
CriterionAiderAgent in the editor (Cline)Terminal agent (OpenCode)
InterfaceTerminalVS CodeTerminal
Git historyAutomatic commit per editYour responsibilityYour responsibility
Repository contextRepository map, files added manuallyTool-based explorationTool-based exploration
Ideal caseTargeted, reviewed modificationsMultistep tasks with visual validationLong-running terminal tasks
FAQ
Does Aider really work with a local model?+
Yes, Aider's documentation describes connecting to Ollama. Quality depends mainly on the model: 24- to 32-billion-parameter models are usable daily; below that, editing-format errors multiply. For confidential code, this is the usual tradeoff: slightly less reliability in exchange for no data leaving the system.
Which model should you choose for Aider with Ollama?+
Devstral 24B is a reasonable starting point: it's designed for code agents and weighs 14 GB. With less memory, use a smaller coding model and accept more errors. Aider's public ranking shows which models follow the editing format well; consult it instead of relying on a fixed leaderboard.
Why does Aider seem to forget my files?+
Ollama uses a 2,000-token window by default and silently rejects anything beyond it. Usually set the rule to the query size plus 8,000 tokens, but a saturated context remains possible. Use /tokens to measure, /drop to free up space, and set num_ctx in the model settings.
How do you undo an Aider change?+
Type /undo: the command undoes the last commit if it was made by Aider. To go back further, use Git normally with git reset or git revert. The safest approach is to work on a dedicated branch, which you can delete entirely if you are not satisfied with the result.
Should you disable automatic commits?+
Not necessarily. They make every change reversible and easy to review in the history. The downside is the number of small commits, which you can resolve with a rebase or squash before merging. With --no-auto-commits, you lose this safety net; reserve it for cases where your team requires manual commits.
Can Aider run my tests on its own?+
Yes: with --test-cmd and --auto-test, it runs the command after each change and attempts to fix it if it fails. Plan for a fast command that displays its errors and returns a nonzero exit code. With a local model, each correction cycle adds several dozen seconds.
Did this guide help you?

Feedback, an error, or a clarification? Let us know—it improves the guide for everyone.