Claude Code Checkpointing
# Claude Code Checkpointing
Checkpointing is Claude Code's **code safety rollback tool**, which automatically tracks Claude's file editing operations, helping you quickly undo unwanted changes and avoid difficult recovery when code breaks.
## How Checkpointing Works
Checkpoints run **automatically in the background** when you use Claude Code, requiring no manual configuration:
1. **Automatic Creation**: A checkpoint is automatically created after each user prompt is sent, recording the current code state
2. **Persistent Storage**: Checkpoints are retained across sessions; even if you close a session, you can still access historical checkpoints when you resume
3. **Automatic Cleanup**: Checkpoints older than 30 days are automatically deleted (cleanup time is configurable)
> Note: Only tracks direct modifications made by Claude **through file editing tools**; changes made through other methods are not recorded.
* * *
## How to Use Checkpoints to Roll Back Changes
### 1. Open the Rewind Menu
There are two ways to trigger it, choose either:
* Shortcut: Press `Esc` twice (`Esc` + `Esc`)
* Slash command: Type `/rewind`
### 2. Select Rewind Type
After opening the menu, you can choose from three rewind modes based on your needs:
| Rewind Type | Effect | Applicable Scenario |
| --- | --- | --- |
| Conversation Only | Rewind to historical conversation content, keeping current code changes | When you feel the conversation has gone off track and want to re-ask, but the code changes are fine |
| Code Only | Restore files to historical state, keeping current conversation | When code changes broke something, but you want to continue adjusting based on current conversation |
| Code and Conversation | Rewind both code and conversation to previous state | When you want to completely start over and return to a satisfactory point |
* * *
## Common Use Cases
Checkpointing is particularly suitable for the following development scenarios:
1. **Exploring Multiple Solutions**: Try different code implementation approaches; if unsatisfied, one-click rollback to the starting point and try another solution
2. **Quickly Fixing Mistakes**: When Claude's modifications introduce bugs or break functionality, quickly rollback to the working state before the changes
3. **Iterative Feature Development**: Make multiple variant experiments on features, with the ability to restore to any stable intermediate version at any time
* * *
## Important Limitations
Checkpoints are a **temporary safety net**, not a universal solution. Be aware of its boundaries:
**Does Not Track Bash Command Changes**
File operations executed through Bash tools like `rm`, `mv`, `cp` are not recorded by checkpoints and cannot be rolled back.
**Does Not Track External Changes**
Only files edited by Claude in the current session are tracked. Files you manually modified in external tools like VS Code, terminal, or changes from other sessions are not captured.
**Cannot Replace Version Control Tools**
YouTip