The Navigator · 9 min mission

Time Travel: Checkpoints, Rewind & Session Recovery

Undo a bad turn, branch a session, and recover work without leaning on git.

sessionsrecoveryworkflowFact-checked 2026-06-13
On this page

Claude just refactored your auth module across nine files, and three of them are now wrong. The old reflex is panic: git stash, git checkout --, squint at a diff, lose the two good edits along with the seven bad ones. But you never committed, so git can only take you back to the last commit — not to the good middle of this conversation.

Claude Code keeps its own time machine. As you work, it captures the state of your code before each edit [V], so you can jump back to any prompt you sent — restore the files, the conversation, or both — without touching git at all. This guide is about using that machine deliberately: undoing a bad turn, branching a session to race two refactors, recovering work after you've wandered off course, and the one hard limitation that will bite you if you don't know it.

What checkpointing actually is

Checkpointing is automatic [V] and on by default. You don't run a "save" command. Two facts define the whole system:

  • Every user prompt creates a new checkpoint [V]. The unit of rewind is the message you sent, not the individual edit — so the menu you'll open later lists your prompts, and picking one rolls back everything Claude did in response.
  • Checkpoints persist across sessions [V]. Quit Claude, come back tomorrow, claude --continue, and your rewind points are still there. They're automatically cleaned up along with the session after 30 days [V] — configurable, covered below.

The mental model that keeps you out of trouble: checkpoints are a local undo for Claude's own edits, scoped to this session's file-editing tools. They are not a snapshot of your entire working tree, and — critically — they are not git. Hold that thought; the [V] limitation section makes it concrete.

Opening the time machine: /rewind and Esc Esc

There are two ways into the rewind menu, and they're equivalent:

  • Type /rewind and hit Enter.
  • Press Esc twicewhen the prompt input is empty [V].

That emptiness clause matters. If the input contains text, double-Esc clears it instead of opening the menu [V]. That's not a bug — Esc Esc is overloaded: "clear my draft" when there's a draft, "rewind" when there isn't. And it's friendly about it: the cleared text is saved to your input history, so press Up to recall the draft after you're done in the rewind menu [V].

The menu lists each prompt you sent during the session [V]. Navigate to the point you want to act on, pick an action, and Claude does the rest. There are six choices — three that restore (move state backward) and two that summarize (compress context without moving files), plus an escape hatch.

ActionCodeConversationUse it when
Restore code and conversationRevertedRevertedA whole turn went wrong — wipe it cleanly and retry from there
Restore conversationKept as-isRevertedThe edits are fine but you want to re-ask the question differently
Restore codeRevertedKept as-isUndo the file changes but keep the discussion that produced them
Summarize from hereUntouchedCompressed (this msg → end)Discard a long side-quest, keep your early setup in full detail
Summarize up to hereUntouchedCompressed (start → this msg)Squeeze old setup chatter, keep recent work verbatim
Never mindUntouchedUntouchedBack out — return to the message list with no changes
The six actions in the /rewind menu. Restore moves state backward; Summarize compresses the conversation without changing files on disk. All verified against the official checkpointing docs.
a rewind in action
… scroll to run this session
Claude breaks the build refactoring across files. Esc Esc opens the rewind menu (input is empty), you pick the prompt before the damage and Restore code and conversation, and the bad turn is gone — files and history both. The original prompt drops back into the input so you can re-send it, reworded.

Restore vs. summarize: undo state, or compress context

These are two different operations that happen to live in the same menu, and conflating them is the most common confusion.

Restore reverts state. It undoes code changes, conversation history, or both — you physically move backward to an earlier point. After Restore conversation or Summarize from here, Claude is helpful: it restores the original prompt from the selected message back into your input field so you can re-send or edit it [V]. After Summarize up to here, you stay at the end of the conversation with the input empty [V].

Summarize compresses context without changing a single file on disk [V]. It's surgical /compact: instead of summarizing the entire conversation, you pick a pivot message and choose which side to crush into an AI-generated summary [V].

  • Summarize from here → the selected message and everything after it become a summary; everything before stays in full detail. Use it to throw away a verbose debugging side-quest while keeping your initial instructions intact [V].
  • Summarize up to here → everything before the selected message becomes a summary; the selected message onward stays verbatim, and you remain at the end of the conversation [V].

In both summarize modes, the original messages are preserved in the session transcript, so Claude can still reference the details if needed [V]. And you can type optional instructions to steer what the summary focuses on [V].

Summarize (compress) vs. Branch (fork)

Summarize from/up to here

Stays in the same session and compresses context in place. [V] Files on disk are untouched; the chosen slice of conversation is replaced by a summary to free context-window space. Reach for it when a session got long and verbose but you want to keep going in it. The original messages still live in the transcript for reference. [V]

Branch / fork

Creates a copy of the conversation and switches you into it, leaving the original intact. [V] Use it to try a genuinely different approach without losing the path you were on. From inside a session: /branch [name]. From the CLI: claude --continue --fork-session. [V] The docs are explicit — summarize to compress, fork to branch off and explore. [V]

The session layer: resume, rename, branch

Rewind moves within one conversation. Sessions are the layer above: a session is a saved conversation tied to a project directory, stored locally and saved continuously as you work [V] — so you can return to it after exiting or even after /clear.

The entry points, all verified [V]:

  • claude --continue — resume the most recent session in the current directory.
  • claude --resume — open the interactive session picker.
  • claude --resume <name> — resume a named session directly.
  • claude --from-pr <number> — resume the session linked to that pull request. (You can also paste a GitHub/GitLab/Bitbucket PR URL into the picker's search to find the session that created it [V].)
  • /resume — switch to a different conversation from inside an active session.

Name your sessions so they're findable later — this matters most when you're juggling several in parallel. Set a name at startup with claude -n auth-refactor, rename mid-session with /rename auth-refactor (the name shows on the prompt bar), or highlight one in the picker and press Ctrl+R [V]. Accepting a plan in plan mode auto-names the session from the plan content unless you've already set one [V].

Branch a session to race two refactors (senior scenario)

  1. Get to a clean decision point

    You've described the problem, Claude has read the relevant files, and you're about to choose an architecture: a state machine vs. a reducer. This shared context is exactly what you want to reuse for both attempts rather than re-explaining twice.

  2. Fork attempt A

    Run /branch state-machine. Branching creates a copy of the conversation so far and switches you into it, leaving the original intact [V]. The confirmation prints two session IDs — the new branch you're now in, and the original [V]. Let Claude build the state-machine version here.

  3. Return to the fork point and fork attempt B

    Go back to the original via the session picker or /resume <original-name> [V], then /branch reducer and have Claude build the reducer version from the same starting context. Two independent timelines, one shared setup.

  4. Compare and keep the winner

    Run each branch's tests, read both diffs, decide. The loser is just abandoned — the original session is unchanged and remains available in the picker [V]. Forked sessions are grouped under their root session in the picker; press to expand the group [V]. One caveat the docs flag: permissions you approved with "allow for this session" do not carry over to the new branch [V].

Where your sessions live, and how long they last

Sessions aren't a black box — they're files you can read, export, and configure.

On disk, transcripts are JSONL at:

text
~/.claude/projects/<project>/<session-id>.jsonl

…where <project> is derived from your working-directory path, and each line is a JSON object for a message, a tool use, or a metadata entry [V]. Want it somewhere other than ~/.claude? Set CLAUDE_CONFIG_DIR [V]. For a human-readable copy, /export writes the conversation to your clipboard or to a file you name, with messages and tool outputs rendered as plain text [V].

Retention: these local transcript files are removed after 30 days by default — change that with the cleanupPeriodDays setting [V]. That same 30-day window is what cleans up the checkpoints attached to a session, which is why your rewind points and your transcript disappear together. Bump cleanupPeriodDays if you routinely revisit week-old sessions; lower it if you want a tighter retention footprint.

Two more knobs worth knowing: to suppress transcript writes entirely, set CLAUDE_CODE_SKIP_PROMPT_HISTORY, or in non-interactive mode pass --no-session-persistence [V]. And note that sessions created with claude -p (headless) or the Agent SDK don't appear in the picker, but you can still resume one by passing its session ID to claude --resume <session-id> [V].

Knowledge check

Claude refactored three files (good edits you want to keep) AND ran `rm legacy_config.json` in shell mode, which you now realize you needed. You open /rewind and pick the prompt before all this. Which statement is correct?

Reach the end and this star joins your charted sky.