How does aider edit modes work?
- User
How does aider edit modes work?
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
How does aider edit modes work?
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
aider is designed to be an AI pair programmer that works with you, not just for you. This "human-in-the-loop" philosophy is central to how its editing modes work. It primarily uses two main editing approaches, always followed by a user review and approval step.
Here's a breakdown:
No matter which editing mode aider uses, it will always show you the proposed changes and ask for your approval before writing anything to disk. This is a critical safety and control mechanism.
When aider proposes changes, you'll see a prompt like:
Apply? [y/n/a/c/f/s/v/d/?]
You have several options here:
y (yes): Apply the changes and commit them to Git.n (no): Discard the proposed changes.a (again): Ask aider to try making the changes again with the same prompt.c (context): Add more context/instructions to your previous prompt and ask aider to try again.f (fix): Manually edit the file yourself, then tell aider to continue.s (skip): Skip this file and go to the next (if multiple files are proposed).v (view): Open the proposed changes in a pager (like less) for easier review.d (diff tool): Open the proposed changes in an external diff tool (like meld, kdiff3).?: Show help for all options.Now, let's look at the editing modes themselves:
This is aider's primary and most common editing mode. It's designed for precise, targeted changes.
How it Works:
aider analyzes your request, the current file content, and the conversation history.+), remove (-), or modify in specific parts of the file.git diff produces.What You See:
aider displays the proposed diff directly in your terminal, often highlighted for readability (showing green for additions, red for deletions).Advantages:
aider intends to do.aider's operations feel natural within a Git workflow.When it's Used:
This mode is used when aider determines that a complete overhaul or creation of a file is necessary.
How it Works:
aider generates the entire new content of the file.What You See:
aider will show you the full content of the file it wants to create.aider will indicate that it proposes a full file replacement. It might not show the entire content in the terminal by default if the file is very large, but it will prompt you to open a diff tool (d option) to compare the old and new versions.Advantages:
Disadvantages:
When it's Used:
aider to create a new file (e.g., /add filename.py).aider to "rewrite the entire file" or suggest a radical change to a file's structure that makes a diff impractical for the AI.aider can't generate a sensible incremental diff for a complex request.aider is built on top of Git. This is crucial for its functionality:
y (yes) to apply changes, aider automatically stages and commits the changes with a descriptive commit message.git revert or git reset if you realize a change was a mistake.In summary, aider prioritizes precision and user control. By defaulting to incremental diffs and requiring explicit approval for all changes (whether small patches or full file replacements), it ensures that you remain in charge of your codebase while leveraging AI for efficient development.