﻿# Aider watches AI comments and uses AI! or AI? to trigger work

Use Aider AI comments deliberately: ordinary AI markers collect instructions, AI! requests edits and AI? requests an answer, with marked files entering the continuing chat context.

Author: Retrivium editorial team
Updated: 2026-11-03
Canonical URL: https://retrivium.ai/journal/guide-aider-watch-ai-comment-triggers/
Language: en

## Understand the editor-to-agent bridge

Aider can watch repository files while a developer works in an ordinary editor. The [IDE guide](https://aider.chat/docs/usage/watch.html) describes `--watch-files` looking for marked one-line comments. This is a task-input mechanism rather than an editor extension that only reads the current selection. A saved comment can enter a continuing agent conversation together with the other repository context already present there.

## Distinguish collection from a trigger

Comments beginning or ending with `AI` are collected as instructions. `AI!` triggers code changes, while `AI?` triggers a question response. The trigger collects the marked comments rather than necessarily acting on a single isolated line. Before saving a trigger, check for other pending markers in the working files. A forgotten instruction elsewhere can widen the resulting task even when the newest comment looks narrowly scoped.

## Recognize file-context effects

The guide says adding an AI comment can add that file to the chat. Removing the comment immediately does not automatically remove the file from context. This matters when switching between unrelated tasks in the same session. Use the [command reference](https://aider.chat/docs/usage/commands.html) to inspect known and included files, and deliberately manage unnecessary context. Do not assume an editor undo restores every part of the agent's conversation state.

## Check the actual enabled watcher

The [options reference](https://aider.chat/docs/config/options.html) identifies file watching as disabled by default. Confirm effective configuration when markers appear inert. The guide recognizes specific one-line comment styles rather than arbitrary prose inside any document. A literal example in documentation and a deliberately saved trigger in a watched source file are different contexts. Keep instructions explicit enough that the requested behavior and edit boundary can be reviewed before the agent acts.

## Verify the task and resulting changes together

Start with a bounded harmless edit, inspect the collected instructions, and review the diff and relevant check. If using the question trigger, confirm the interaction stayed within the requested explanatory task. The [task-contract guide](/journal/learn-codex-task-contract/) helps write a precise marker, while [tool observations](/journal/learn-codex-tool-observation/) distinguish detection from successful implementation. Continue in the terminal when useful, preserving awareness that the editor-triggered work has already become part of that session.
