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

# Diff review — Track and manage agent code changes

> Review every code change your AI coding agent makes in the stagewise agentic IDE. Accept, reject, or undo agent edits with full inline diffs and design previews.

Every time an agent modifies a file, stagewise records the change. You stay in full control — see exactly what changed, keep what you like, and undo what you don't.

```mermaid theme={null}
stateDiagram-v2
    [*] --> Written: Agent edits a file
    Written --> Reviewing: You open the diff
    Reviewing --> Accepted: Accept hunk
    Reviewing --> Rejected: Reject hunk
    Accepted --> Undone: Undo tool call
    Undone --> Redone: Redo tool call
    Rejected --> [*]
    Accepted --> [*]
    Redone --> Accepted
```

Every edit is a discrete unit tracked at the tool-call level. You can accept, reject, or undo any edit independently.

## How diff tracking works

When the agent edits a file:

1. The change is written to disk immediately
2. A diff is recorded — exactly what was added, removed, or modified
3. You review the change in the chat sidebar or the dedicated Diff Review page

## Reviewing changes

### In the chat sidebar

After the agent modifies files, a compact diff summary appears inline. Click it to expand the full diff with:

* Which files were changed
* Lines added and removed
* A preview of the actual changes

### Diff Review page

For changes across multiple files, open the dedicated **Diff Review** page. It provides:

* A scrollable list of every modified file
* Side-by-side diff view
* Per-hunk and per-file controls

## Accepting and rejecting changes

* **Accept** — Keep the change. Accepted hunks disappear from pending review.
* **Reject** — Undo the change. The file reverts to its previous state.
* **Accept/Reject all** — Apply your choice to every hunk in a file at once.

## Undo and redo

Changed your mind? stagewise tracks the full edit history at the tool-call level:

* **Undo** — Roll back all changes from a specific agent action
* **Redo** — Reapply changes you previously undid

Step backward and forward through the agent's entire edit history.

## Design previews

Before the agent writes real code, use **design previews** to iterate on visual changes. The agent generates a preview of the result, letting you approve the direction before touching your actual files.

This is especially useful for UI work — explore options quickly without committing to code.

## What's next

<CardGroup cols={2}>
  <Card icon="file-check" href="/reference/diff-review" title="Diff review reference">
    Step-by-step guide to accepting, rejecting, and undoing agent changes.
  </Card>

  <Card icon="brain" href="/core-concepts/how-agents-work" title="How agents work">
    Understand the agent loop that produces these tracked changes.
  </Card>
</CardGroup>
