> ## Documentation index
> Fetch the complete documentation index at: https://haarness.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Review changes

`/diff` opens a full-screen review of what changed: a file tree on the left, the patches on the
right, and a cursor you move line by line. Comments you leave there become your next message.
`/undo` rolls the agent's last change back.

## Review what changed

1. Run `/diff`.
2. Move through files with `]` and `[`, and through edits with `n` and `p`.
3. Press `c` on a line to leave a comment. Type it and press Enter.
4. Press `q` or Esc to close. Your comments are now in the prompt, ready to send.

Press `s` to switch what you are looking at, or name it when you open the review:

| Open with | Shows |
| --- | --- |
| `/diff` | Uncommitted changes in the Git working tree, new files included |
| `/diff branch` | Everything on this branch since it left the default branch |
| `/diff last` | What the agent's most recent turn changed |

`/diff` and `/diff branch` need a Git repository; in another folder, use `/diff last`. On the
default branch itself, the branch review is empty.

## Undo a change

`/undo` stops the agent if it is working, then puts the files back as they were before its last
change. Your prompt for that turn comes back into the prompt box, so you can edit it and try
again. In the transcript, the undone turn folds into one row that says how many steps were undone.

- Run `/undo` again to go back further.
- `/redo` puts the files back the way the agent left them. You can type it straight over the
  prompt that came back.
- Sending a new message makes the undo final.

If you edited one of those files yourself since, nothing is rolled back and Haarness names the
file, so your edit is never overwritten.

## Go back to an earlier point

`/timeline` lists every checkpoint in this chat, each named after the request that came after it.
Pick one, and Haarness undoes its way back to that point, one change at a time. It stops at a file
you edited yourself, the same way `/undo` does.

To start a new chat from an earlier message without touching files, use
[Fork from message](https://haarness.ai/docs/tui/messages.md#start-over-from-an-earlier-point).

## Turn checkpoints on, or keep them longer

Checkpoints are what `/undo`, `/redo`, `/timeline` and `/diff last` use. They are on by default
in Git repositories. In a folder that is not a Git repository, turn them on in your
[configuration](https://haarness.ai/docs/cli/configuration.md), `haarness.json`:

```jsonc
{
  "snapshots": {
    "enabled": true,
    "retention_days": 7,     // 0 keeps checkpoints forever
    "keep_per_thread": 20    // always kept per chat, however old
  }
}
```

Checkpoints are stored with your Haarness data, not in the project. Files larger than 2 MiB are
not copied, so `/undo` cannot restore them.

## Keys in the review

| Key | Does |
| --- | --- |
| `q`, Esc | Close. Comments go to the prompt |
| Tab | Switch between the file tree and the patches |
| `j`, `k`, ↓, ↑ | Move the line cursor, or the selection in the tree |
| `n`, `p` | Next, previous edit |
| `]`, `[` | Next, previous file |
| Enter | Open a file, or fold a folder |
| →, ← (or `l`, `h`) | Expand, collapse a folder |
| `a` | Expand every folder |
| `t` | Show or hide the file tree |
| `o` | One file at a time, or all of them |
| `v` | Side by side, or one column |
| `x` | Context lines: 4, 12, 50, all |
| `r` | Mark the file reviewed |
| `c` | Comment on the current line |
| `s` | Working tree, branch, or last turn |
| `g`, `G` (or Home, End) | Top, bottom |
| Page Up, Page Down | Scroll a screen (also Ctrl+F, Ctrl+B) |
| Ctrl+D, Ctrl+U | Scroll half a screen |
| `?` | List these keys |

Side by side needs a wide terminal; narrower ones show one column. Your layout, context and tree
choices are remembered next time.

## Next

- [Find messages and ask side questions](https://haarness.ai/docs/tui/messages.md): fork a chat at an earlier message
- [Work on a branch in a worktree](https://haarness.ai/docs/cli/worktrees.md): give the agent its own copy of the
  repository
