# Changes and undo

> What the agent changed in a turn and how to take it back: the summary under the answer, the diff, a safe rewind that checks for other edits, the file tree.

Every turn that changed files leaves a **summary** under the answer: how many files and lines
were changed. From it you open the diff and rewind the whole turn — with a check that the rewind does not overwrite
your own edits.

## The turn summary

“**Changed 2 files +23 −1**” under the answer expands into a list of files: each shows how many
lines were added and removed, new and deleted ones are marked. A click on a file opens the changes
panel on it.

_Illustration: The turn summary expanded: two files and the lines for each._

## The changes panel

On the right a **“Files Changed N”** tab opens — all uncommitted changes in the project,
not only this turn’s.

_Illustration: The changes panel: files on the left, the diff on the right. Unchanged lines are collapsed._

| Button | What it does |
| --- | --- |
| ← → | previous and next file |
| “Show all lines” / “Hide non-diff lines” | expand or collapse unchanged sections |
| “Unified diff” / “Split diff” | the diff in one column or “before | after” side by side. One column by default: it reads well in a narrow panel too |
| file tree (top left) | show or hide the file list |
| “Open in …” (top right) | open the project folder in a file manager or an editor |

The panel opens and closes with the “Show or hide changes” button in the session header.
The panel watches the disk: a file changed by the agent, by a command or by you in an editor appears in
it without a reload.

## Rewinding a turn

“**Rewind the turn**” shows what will come back and warns about danger:

_Illustration: A rewind with a check: “The rewind is safe” — nobody touched these files after the turn._

- **“The rewind is safe”** — nobody changed the files after the turn; they return to their state before the turn.
- **“There are edits made after the turn”** — after the turn the file was changed by someone other than the agent: you in an editor or
  a command. Such a file is marked — the rewind will overwrite those edits.
- **“Only the conversation”** — rewind the conversation and leave the files as they are.
- **“Revert”** — the conversation and the files.

After the rewind, above the input field there is the line “Turn rewound: 2 files are back to their previous state” and
the **“Bring it back”** button. The text of your message returns to the input field — you can
edit it and send it again. A new message makes the rewind final.

_Illustration: The turn is rewound: the files are back, the message is in the input field. “Bring it back” cancels the rewind._

“Bring it back” restores both the agent’s files and the person’s edits that the rewind overwrote.

## The file tree and file view

Project files open in the right panel: **“+”** next to the tabs gives an “Open file” tab with
the project tree and a filter. The tree updates itself when the agent creates or deletes files;
new and changed files are marked.

_Illustration: README.md in a preview tab: “Preview” shows Markdown as a page, “Source” shows the text._

A file opens in a preview tab:

| File | How it is shown |
| --- | --- |
| code and text | with highlighting and line numbers |
| Markdown, Mermaid | a “Preview / Source” switch; diagrams are drawn |
| images, SVG, audio, video | as they are |
| PDF | in the built-in viewer: pages, zoom, search |
| binary file | with a message that it cannot be shown |

**Add to chat.** The “Add to chat” item in a file’s menu (right mouse button in the tree), or the button
above a file when lines are selected in it, puts a mention into the input field: `@README.md`,
`@src/cart.js:12`. The agent gets the file or those lines together with the message. The same menu has “Open
in” (a file manager, VS Code, Cursor, Zed, Sublime Text) and “Copy path”.

## In the console

- Under the answer — “Changed 1 file +1 −0 · /undo — rewind”.
- `/undo` shows the same preview and asks; if there are edits after the turn — a choice between “Only
  the conversation” and “The conversation and the files”. `/redo` brings back what was undone.
