Master Claude Code in a Week (Part 4): Checkpoints & Rewind
This is the fourth part of the "Master Claude Code in a Week" series. In this article, we'll explore Checkpoints — a feature that lets you save and restore session state.
What are Checkpoints?
Checkpoints are session snapshots — save points of the conversation and code state at a specific moment. You can "rewind" to any checkpoint to try a different approach without losing progress.
┌──────────────────────────────────────────────────────────────────┐
│ CHECKPOINTS │
├──────────────────────────────────────────────────────────────────┤
│ │
│ Timeline: │
│ │
│ [Start] ──► [CP1] ──► [CP2] ──► [CP3] ──► [Current] │
│ │ │ │ │
│ │ │ └── Rewind here? │
│ │ │ ↓ │
│ │ │ Try approach B │
│ │ │ │
│ │ └── Or rewind here? │
│ │ ↓ │
│ │ Try completely different solution │
│ │ │
│ └── Safe experimentation from any point! │
│ │
└──────────────────────────────────────────────────────────────────┘
Key Characteristics
| Criteria | Value |
|---|---|
| Created | Automatic (every user prompt) |
| Persistence | Session-based |
| What it saves | Conversation state + Code changes |
| Best For | Safe experimentation, recovery |
How Checkpoints Work
Automatic Checkpoint Creation
Every time you send a prompt, Claude Code automatically creates a checkpoint:
User: "Add user authentication"
↓
[Checkpoint A created]
↓
Claude makes changes...
↓
User: "Use JWT instead of sessions"
↓
[Checkpoint B created]
↓
Claude refactors...
↓
User: "Actually, let's try Passport"
↓
[Checkpoint C created]
Rewind to Checkpoint
┌────────────────────────────────────────────┐
│ REWIND OPTIONS │
├────────────────────────────────────────────┤
│ │
│ Press Esc twice or type /rewind │
│ │
│ ┌─────────────────────────────────────┐ │
│ │ Choose what to restore: │ │
│ │ │ │
│ │ 1. Restore code and conversation │ │
│ │ 2. Restore conversation only │ │
│ │ 3. Restore code only │ │
│ │ 4. Summarize from here │ │
│ │ 5. Never mind │ │
│ └─────────────────────────────────────┘ │
│ │
└────────────────────────────────────────────┘
Using Checkpoints
Method 1: Keyboard Shortcut
Press Esc twice consecutively to open the rewind menu.
Method 2: Slash command
/rewind
Rewind Options
1. Restore code and conversation
Go back to complete state — both code and conversation.
Use case: Want to try a completely different approach from a certain point.
2. Restore conversation only
Only rewind conversation, keep current code.
Use case: Code is good but want to re-explain or adjust conversation flow.
3. Restore code only
Keep conversation, rewind to previous code.
Use case: Conversation is still relevant but recent code changes aren't good.
4. Summarize from here
Create summary from checkpoint to current state.
Use case: Create overview of what's been done from a certain point.
5. Never mind
Cancel operation, return to current state.
Real-World Use Cases
1. Try Multiple Approaches
Prompt: "Implement caching for API responses"
[Checkpoint created]
↓
Approach A: File-based cache
↓
❌ Too slow for production
↓
/rewind → Restore code and conversation
↓
Approach B: Redis cache
↓
✅ Works great!
2. A/B Testing Implementations
Prompt: "Create user notification system"
[Checkpoint created]
↓
Implementation A: Database polling
- Measure performance
- Note pros/cons
↓
/rewind → Restore code and conversation
↓
Implementation B: WebSocket push
- Measure performance
- Note pros/cons
↓
Compare and choose best solution
3. Recover from Mistakes
Prompt: "Refactor authentication module"
[Checkpoint created]
↓
Making changes...
↓
Oops! Accidentally broke everything
↓
/rewind → Restore code only
↓
Code reverted, continue with conversation context
4. Safe Large-Scale Refactoring
Prompt: "Migrate from Laravel 10 to Laravel 11"
[Checkpoint created at stable state]
↓
Step 1: Update composer.json
[Checkpoint]
↓
Step 2: Update config files
[Checkpoint]
↓
Step 3: Update middleware
[Checkpoint]
↓
Tests fail at step 3?
/rewind to step 2
↓
Fix and continue
Branch Points
Checkpoints allow creating branch points — from one checkpoint, you can explore multiple paths:
┌── Approach A (JWT)
│
[Checkpoint] ───────┼── Approach B (OAuth)
│
└── Approach C (Sessions)
Suggested Workflow
- Create stable checkpoint: Ensure code is working
- Try approach A: Implement and test
- Document findings: Note results
- Rewind: Go back to checkpoint
- Try approach B: Implement and test
- Compare: Choose best solution
- Commit: Proceed with chosen solution
Best Practices
1. Checkpoint before risky changes
User: "Before making any changes, confirm this is the current
stable state. I want to be able to rewind here."
Claude: "Confirmed. Current checkpoint created. You can safely
rewind to this point anytime."
User: "Now, let's try rewriting the entire service layer..."
2. Name your checkpoints mentally
While checkpoints don't have actual names, you should note in conversation:
User: "This is CHECKPOINT-STABLE-AUTH. The authentication
system is working. Let's experiment from here."
3. Regular rewind points for long sessions
Session:
├── [0min] Start
├── [15min] Basic structure done - safe rewind point
├── [30min] Core logic implemented - safe rewind point
├── [45min] Tests added - safe rewind point
└── [60min] Documentation - final state
4. Use Summarize for complex sessions
/rewind
Choose: 4. Summarize from here
Output:
"From checkpoint to current state:
- Added UserService with CRUD operations
- Created validation layer
- Implemented caching
- Added 15 unit tests
- Fixed 3 edge cases
Total: 12 files changed, 450 lines added"
Checkpoints vs Git
| Aspect | Checkpoints | Git |
|---|---|---|
| Scope | Session | Permanent |
| Includes | Code + Conversation | Code only |
| Speed | Instant | Requires commit |
| Persistence | Session only | Forever |
| Collaboration | Individual | Team |
When to use which?
Use Checkpoints when:
- Quick experimentation with multiple approaches
- Exploration phase
- Uncertain about direction
- Need to rollback conversation context
Use Git when:
- Code is stable and tested
- Need permanent save
- Need to share with team
- Milestone reached
Suggested workflow
┌─────────────────────────────────────────────┐
│ CHECKPOINT + GIT WORKFLOW │
├─────────────────────────────────────────────┤
│ │
│ ┌─────────────┐ │
│ │ Git Commit │ ◄── Stable point │
│ └──────┬──────┘ │
│ │ │
│ ▼ │
│ ┌─────────────┐ │
│ │ Checkpoint │ ◄── Start experimenting │
│ └──────┬──────┘ │
│ │ │
│ Try A ──► Fail ──► Rewind │
│ │ │
│ Try B ──► Success! │
│ │ │
│ ▼ │
│ ┌─────────────┐ │
│ │ Git Commit │ ◄── New stable point │
│ └─────────────┘ │
│ │
└─────────────────────────────────────────────┘
Monitoring Context with Checkpoints
Claude-howto introduces cc-context-stats — a tool to monitor context usage:
# Install cc-context-stats
npm install -g cc-context-stats
# Monitor context zones
cc-context-stats watch
# Output:
# Context Usage:
# ├── Green Zone: 0-50% (Safe to add more)
# ├── Yellow Zone: 50-75% (Consider summarizing)
# └── Red Zone: 75-100% (Summarize or rewind soon)
When context is full
Context at 85%!
↓
Options:
1. /rewind → Summarize from checkpoint
2. Start new session with summary
3. Continue (risk truncation)
Summary
Checkpoints are a safety net for experimentation:
- ✅ Automatically created every prompt
- ✅ Restore code and/or conversation
- ✅ Safe experimentation
- ✅ Compare multiple approaches
- ✅ Recovery from mistakes
Next Up
In the next part, we'll explore CLI Reference — how to use Claude Code from the command line for automation and scripting.
References
This series is translated and expanded from claude-howto — MIT License.