Skip to content
pi-c Rewind
Login

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.

A restored file is replaced the way write replaces one, so a hard link to it keeps the old contents. Rewind keeps what it replaces, whatever its size, so it can be undone.

When a rewind deletes a file that a write created, it also removes the folders that write made, if they are empty by then. A folder that was already there, or that holds anything else (a file you added), stays.

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 or folders a command created.

pic prune (and pic itself, hourly) drops saved file contents that no rewind or undo can reach.

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 you changed between two of pic's changes is refused too, since putting back the older contents would lose your change; so is a file whose earlier contents were too large to keep. A file that changes while the rewind runs is left as it is and reported. A change made in the instant between pic saving a file and writing it, or between the rewind's last look and its write, is not caught.

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.