Skip to content
pi-c Artifact [fdf222369f]
Login

Artifact [fdf222369f]

Artifact fdf222369fa2695ce3f9ab37471d15c28da6956613c8eb9148b9224c2f02465f:


Rewind

Rewind takes you back to before one of your earlier messages and restores the conversation, the files pic changed after it, or both, as Claude Code's checkpoints do. Nothing is deleted: the conversation you leave stays in /resume, and a rewind of files can be undone.

In the terminal

Press Esc twice on an empty editor, or type /rewind. Pick a message (newest first; each says how many files were changed after it), then what to restore:

To give Esc Esc back to Pi's /tree, set doubleEscapeAction to tree (or fork, or none).

On the command line

pic rewind [ID] --list
pic rewind [ID] --to ENTRY [--files | --conversation] [--force-partial] [--json]
pic rewind [ID] --undo [--force-partial] [--json]

--list prints the conversation's messages with their entry numbers. --to ENTRY rewinds to before that message: conversation and files, or only the files (--files) or only the conversation (--conversation). --undo puts back the files the conversation's latest rewind changed; undoing an undo rewinds again. ID defaults to the latest conversation. RPC mode has the same as the rewind command.

What is tracked

Every file the write and edit tools change is saved as it was just before the change, in the journal, so a rewind can put it back; a file that did not exist is deleted again. Files larger than rewindMaxBytes (1 MiB by default) are not saved, and rewind says it cannot restore them.

Changes made by bash commands, by ! commands, by you in an editor or by any other program are not tracked. Rewind cannot undo them, and it does not delete or move files a command created.

When a file changed since

Before it writes anything, rewind checks each file against what this conversation last left in it. A file that changed since (you edited it, a command or another conversation wrote it) is not overwritten. Rewind lists such files and asks before restoring the rest; on the command line it does nothing, exits with status 3, and --force-partial restores the rest. A file whose earlier contents were too large to keep is listed the same way.

After a crash

A rewind is written to the journal before it touches a file. If pic dies part way, the next pic to open the journal finishes it, including the switch to the new conversation, and never writes over a file that changed meanwhile.