Undo and redo the agent's changes

sessions & tui

// what it does

/undo reverts the last message together with any file edits it made, using opencode's git-based snapshots; /redo re-applies what you just undid. This acts on the workspace, not just the chat — a bad refactor can be rolled back without touching your own git history.

// shortcut

Ctrl+X U
Ctrl+X R

// shell

$ /undo
$ /redo

// gotcha

Snapshots are opencode's own, independent of your commits, and undo steps back one message at a time. It reverts edits the agent's tools made — not side effects of a raw shell command you ran with !.

// resources