# Claude Code Checkpoints and rewind

> How Claude Code captures edits, restores code or conversation with /rewind, summarizes context, and handles changes it does not track.

URL: https://docs.passion8.cc/en/docs/claude-code/checkpointing
Language: en
Publisher: Passion8

Checkpointing is Claude Code's session-level undo mechanism. It records changes made through Claude's file-editing tools so you can return to earlier code and conversation states when an approach fails or context becomes too long.




Use checkpoints to undo operations in the current session quickly. They do not replace Git branches, commits or shared project history.




## What it records

Claude Code captures code state automatically as you work:

| Action | Result |
| --- | --- |
| Each new user prompt | Creates a new checkpoint |
| Claude uses file-editing tools such as Edit/Write | Includes the file changes in the restore scope |
| Resume a saved session | Its checkpoints remain accessible |
| Session cleanup | Removes checkpoints with the session, normally after about 30 days; configurable |

You do not need to create checkpoints manually. Changes made through Claude Code's own editing tools can generally be restored from the rewind menu.

## Open the rewind menu

| Entry point | Behavior |
| --- | --- |
| `/rewind` | Opens rewind in the current session |
| Press `Esc` twice with an empty input | Opens the same menu |




If the input contains text, pressing `Esc` twice clears it instead. The cleared text enters input history and can be recovered with `Up`.




The menu lists prompts you sent in this session. Select a point, then choose what to do with the code, conversation or context summary.

## Available actions

| Action | Result | When to use it |
| --- | --- | --- |
| Restore code and conversation | Returns both to the selected point | Restart from the prompt before an incorrect implementation |
| Restore conversation | Rewinds conversation while keeping files on disk | Rewrite the discussion without losing file changes |
| Restore code | Rewinds file edits while keeping the conversation | Recover files while retaining the analysis |
| Summarize from here | Summarizes the selected message and everything after it; earlier content stays intact | Compress a side discussion while retaining the initial context |
| Summarize up to here | Summarizes content before the selected message; that message and later content stay intact | Compress early preparation while continuing recent work |
| Never mind | Returns to the message list | Make no changes |

After Restore conversation or Summarize from here, the selected prompt returns to the input for editing or resending. After Summarize up to here, you remain at the end of the session with an empty input.

## Restore versus summarize

| Action | Changes files on disk? | Changes conversation? | Purpose |
| --- | --- | --- | --- |
| Restore code | Yes | No | Undo file changes |
| Restore conversation | No | Yes | Return to an earlier conversation state |
| Restore code and conversation | Yes | Yes | Undo both |
| Summarize from/up to here | No | Replaces part of the context with a summary | Free context capacity |

Summarize does not roll back files. It compresses a chosen part of the conversation into a Claude-generated summary, like a more targeted `/compact`. Original messages remain in the session transcript, and Claude may still refer to their details when needed.

To try a different approach while retaining the original session, use [session branching](https://docs.passion8.cc/en/docs/claude-code/sessions) or:

```bash
claude --continue --fork-session
```

## Return after `/clear`

After `/clear` within the same Claude Code process, the top of the rewind menu may show:

```text
/resume <session-id> (previous session)
```

Select it to resume the session from before `/clear`. This entry remains until you exit Claude Code or resume another session. The official guide requires Claude Code v2.1.191 or later for this menu entry. Earlier versions can locate the session manually with `/resume`.

## Typical workflow





### Try a larger change

Ask Claude to plan first, then implement. Each prompt creates a restore point, making it easier to compare approaches.



### Rewind when the direction is wrong

Rather than adding repeated undo instructions to the context, open `/rewind`, select the prompt before the problem, and restore code, conversation or both.



### Summarize a long detour

If research or a discarded discussion is the problem, use Summarize from here or Summarize up to here without changing files.



### Commit stable work to Git

Checkpoints follow the session cleanup lifecycle. Preserve long-term states with a Git commit, branch or PR.






## Limits

| Limit | Effect |
| --- | --- |
| Bash file changes are not tracked | `rm`, `mv`, `cp` and generated files cannot be undone reliably with rewind |
| External edits generally are not tracked | Manual edits, other terminals and other Claude sessions are usually outside the checkpoint |
| Scope covers files edited in this session | Files never edited by this session generally have no restore state |
| Not long-term history | Checkpoints expire with sessions and do not resolve collaboration conflicts |

Check Git status before running generators, formatters, migrations or deletion commands. Checkpointing is useful for direct Claude edits, but does not fully protect filesystem changes made by shell commands.

## With Passion8

Checkpointing is managed by Claude Code locally. With Passion8, `/rewind`, summarization and restoration remain client features; model requests use your `ANTHROPIC_BASE_URL` and `ANTHROPIC_AUTH_TOKEN` configuration.

## Official references

- [Checkpointing](https://code.claude.com/docs/en/checkpointing.md)
- [Manage sessions](https://code.claude.com/docs/en/sessions.md)
- [Commands](https://code.claude.com/docs/en/commands.md)
