# Comments

> Annotate code, diffs and docs, then send the batch to an agent as one prompt.

Comments are notes for an agent. You mark lines in the editor, a diff or a markdown preview, collect them into a review, and send the review to an agent as one prompt. Comments stay in Rexa; nothing is written to git or to a forge.

## Where you can comment

- **Editor:** any file in a worktree.
- **Diffs:** unstaged and staged changes.
- **Markdown preview:** any selection.
- **Mermaid flowcharts:** click a node, edge label or subgraph. The comment quotes its source line.

Comments are not available on compare diffs, combined diffs or agent output. For pull request review comments, see [Pull requests](/docs/review/pull-requests).

## Write a comment

Select text or put the caret on a line, then press <Kbd>⌘</Kbd> <Kbd>I</Kbd>. You can also click the chip at the end of the selection, or right-click → **Comment on line N**.

| In the comment box                  | Does                                  |
| ----------------------------------- | ------------------------------------- |
| <Kbd>↵</Kbd>                        | Save the comment into the review.     |
| <Kbd>⇧</Kbd> <Kbd>↵</Kbd>           | New line.                             |
| <Kbd>⌘</Kbd> <Kbd>L</Kbd>           | Send this comment now.                |
| <Kbd>Esc</Kbd>                      | Close.                                |

A saved comment shows as a band under its line, with send, edit and delete. Comments follow the text they quote. If that text is deleted, the comment is dropped.

## The review

The status bar shows **Comments (N)**. Click it, or run **rexa: show comments**, to list comments by file. Click one to jump to it. Comments are saved per worktree and survive a relaunch.

## Send to an agent

<Steps>

### Choose send

Click send in the review, on a single comment band, or press <Kbd>⌘</Kbd> <Kbd>L</Kbd> in the box.

### Pick the agent

The picker lists the agents in this worktree. Pick one and press <Kbd>↵</Kbd>.

### Submit the prompt

Rexa writes one prompt starting with `Review comments:` into that agent's terminal, with an `@file:lines` reference and your text for each comment. Rexa does not press Enter; read it and submit.

</Steps>

You can also drag a comment, or the review's send button, onto any agent terminal.

What happens depends on the agent's state:

| Agent state                 | Result                                                 |
| --------------------------- | ------------------------------------------------------ |
| Idle                        | The prompt is written.                                 |
| Working or waiting on you   | Sending is disabled until it is idle.                  |
| Finished                    | The session is resumed with the prompt.                |

Sent comments leave the review once they are written.

## Add to an agent's prompt

<Kbd>⌘</Kbd> <Kbd>L</Kbd> with a selection and no open comment box adds a reference such as `@src/app.ts:42-47` to an agent's prompt line. It does not send. This works while the agent is busy.

## Settings

<FieldGroup>
  <Field name="comments.target_ring" type="boolean" default="false">Highlight the target terminal while choosing an agent.</Field>
</FieldGroup>
