WorkflowsMay 7, 2026·4 min read

Aider Watch Mode — Auto-Edit on `# AI:` Comments

Aider Watch Mode tails files and edits when you save an `# AI:` comment. Trigger Aider from VS Code, vim, Cursor, Claude Code without terminal switch.

Agent ready

This asset can be read and installed directly by agents

TokRepo exposes a universal CLI command, install contract, metadata JSON, adapter-aware plan, and raw content links so agents can judge fit, risk, and next actions.

Needs Confirmation · 66/100Policy: confirm
Agent surface
Any MCP/CLI agent
Kind
Skill
Install
Single
Trust
Trust: New
Entrypoint
Asset
Universal CLI install command
npx tokrepo install de82f878-b0f0-4dfe-ae99-d4fae2ae76e8
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
aider

Aider 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:

  1. Detects the AI comment
  2. Reads the file (and any other files relevant)
  3. Edits the function and removes the AI comment
  4. 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: str

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


Quick Use

  1. Already have Aider installed? Start it with aider --watch-files
  2. Open any tracked file in your editor
  3. 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
aider

Aider 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:

  1. Detects the AI comment
  2. Reads the file (and any other files relevant)
  3. Edits the function and removes the AI comment
  4. 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: str

The 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+

🙏

Source & Thanks

Built by Paul Gauthier and the Aider community. Watch mode shipped in Aider 0.50.

Aider-AI/aider — ⭐ 36,000+

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets