Quick Use
- Already have Aider installed? Start it with
aider --watch-files - Open any tracked file in your editor
- Add
# AI: <your instruction>and save — Aider edits and commits
Intro
Aider Watch Mode lets you trigger Aider from inside your editor without switching to a terminal. Add # AI: <instruction> (or // AI: for JS/TS) anywhere in a file and save — Aider notices, edits the file, removes the comment, and commits. Best for: developers who don't want to leave VS Code / vim / Cursor / Claude Code to invoke an AI edit. Works with: Aider 0.50+, any editor that saves files. Setup time: 1 minute.
Start watch mode
# In your repo
aider --watch-files
# Or set in .aider.conf.yml
echo "watch-files: true" >> .aider.conf.yml
aiderAider stays running and watches all tracked files.
Trigger an edit
In any file, add an AI comment:
# main.py
def fetch_user(user_id: int):
# AI: add caching with functools.lru_cache, max 1000 entries
return db.users.find_one({"_id": user_id})Save the file. Aider:
- Detects the AI comment
- Reads the file (and any other files relevant)
- Edits the function and removes the AI comment
- Auto-commits with a generated message
Result:
# main.py
from functools import lru_cache
@lru_cache(maxsize=1000)
def fetch_user(user_id: int):
return db.users.find_one({"_id": user_id})Multi-file via cross-references
# models.py
class User:
# AI! add a 'plan' field with type Literal["free", "pro"], default "free"
name: str
email: strThe AI! (with bang) tells Aider to act immediately even without a save trigger. Aider also updates tests/test_models.py if it imports User.
Bang variants
| Marker | Behavior |
|---|---|
# AI: <instruction> |
Edit on next save |
# AI! <instruction> |
Edit immediately |
# AI? |
Ask Aider a question; reply in chat |
FAQ
Q: Does watch mode work in any editor? A: Yes — watch mode tails files at the filesystem level, so VS Code, vim, neovim, JetBrains, Cursor, even Claude Code's internal edits all trigger it. The editor doesn't matter.
Q: Will it edit files I didn't ask it to?
A: Only files you've /add'd to Aider's session, or the file containing the AI comment. Files in no-edit are protected. Aider also asks before destructive operations (deleting, renaming) by default.
Q: Can I disable auto-commits in watch mode?
A: Yes — auto-commits: false in your config. Aider still edits the files but leaves the changes uncommitted for you to review and commit manually.
Source & Thanks
Built by Paul Gauthier and the Aider community. Watch mode shipped in Aider 0.50.
Aider-AI/aider — ⭐ 36,000+