Claude Code Checkpoints & Rewind: Undo an Edit Without Losing Your Session
Engineering
Claude Code Checkpoints & Rewind: Undo an Edit Without Losing Your Session
Claude Code makes one bad edit, and your instinct is to nuke the whole session and start over. Usually you don't have to. Rewind rolls your files back to before that edit while keeping the conversation — so you lose the bad diff, not the good context. Here's how it works, and when to reach for it instead of a full restart.
Checkpoints, automatically
Before Claude Code edits a file, it quietly snapshots it — a checkpoint. You don't set these up; they happen on every edit. That snapshot stack is what lets you step backward through changes.
Rewinding
Press Esc twice to rewind. Claude Code walks back through the checkpoints, restoring your files to an earlier state. Crucially, rewind restores files, not the conversation — the reasoning up to that point stays in context. So you undo the change without undoing the understanding.
What it does not restore: anything outside your local files — a database write, an API call, a deploy. Those already happened. Rewind is for the code on disk.
Rewind vs. restart — which one
This is the key call:
- Rewind when the edit was wrong but the session is fine — one bad change, good reasoning up to it. Roll the files back and keep going. Cheapest fix there is.
- Restart (
/clearor a fresh session) when the context itself has gone bad — loops, drift, an anchored wrong assumption. Rewinding files won't help; the problem is the conversation. (When to kill the session instead →)
The mistake is using a full restart for a problem a rewind would've fixed in two keystrokes — and vice versa. Wrong edit → rewind. Poisoned context → restart.
Across sessions
Rewind and restart are per-session moves, and the judgment call — bad edit or bad context? — gets harder when you're running several agents at once. Mwah helps you triage: every live session on your desktop as a robot flagged ALIVE or STUCK, so you can tell the one that made a bad edit (rewind it) from the one whose context is gone (and put it down).
Related: Shoot your Claude Code in the head · How to restart Claude Code
Keep reading
View all dispatches →Shopify AI Agent Tools: What Your Agents Can Actually Do in Your Store
Clearly now ships Shopify store tools your AI agents can call — browse the catalog, read orders, roll up revenue, edit products, and attach generated images — over MCP and the beehaven CLI, with a dry-run preview on every write. Here are the tools, with example commands.
How to Manage Your Shopify Store with AI Agents
AI agents can now do the work of running a Shopify store — writing descriptions, generating product images, answering customers, updating the catalog. Here's how agent-run commerce works, and how to set it up.
Claude Code for Shopify: Run Your Store from Your Terminal
If you already run your codebase with Claude Code, the same agents can run your Shopify store — edit the catalog, generate product images, answer customers — with a connector and the right guardrails. Here's the setup.