AnswerQA

How do I rewind Claude's last 6 prompts but keep my current files?

Answer

Esc+Esc opens the rewind menu — three restore options plus targeted summarize. "Restore conversation" rewinds the chat but leaves your files alone. Here's the menu in full, plus the bash-edits gap and the cases where /branch beats /rewind.

By Kalle Lamminpää Verified May 6, 2026

Claude went down a wrong path 6 prompts ago, but the code you’ve written since is fine — you just want the conversation to forget. That’s “Restore conversation” in Claude Code’s four-action rewind menu, the option most people miss.

What each action does to your code vs your conversation, plus the limitations that determine when rewind helps and when you reach for git reset or --fork-session instead.

1. Open the rewind menu

Two ways. Either type the slash command:

/rewind

Or hit Esc twice in quick succession from the prompt input. Either opens a scrollable list of every user prompt in the current session. Move with / , hit Enter on the prompt you want to act on.

2. Pick the action

Each prompt in the list opens four actions plus a cancel:

  • Restore code and conversation — reverts both. Your files snap back to what they were when you sent that prompt, and the conversation history gets cut at that point. The “full undo” most people use.
  • Restore conversation — rewinds the chat but keeps your current files on disk. Use this when Claude went off the rails but the code that came out the other end is salvageable, or when you’ve manually fixed something and don’t want Claude re-deriving it.
  • Restore code — reverts file edits but keeps the conversation. Useful when Claude wrote bad code but the discussion leading up to it (your spec, the back-and-forth on tradeoffs) is still relevant, so you’d rather edit the next prompt than re-explain everything.
  • Summarize from here — different in kind from the other three. The selected message and everything after it get replaced with a compact AI-generated summary. Files on disk are unchanged. The original messages stay in the session transcript so Claude can still reach for them, but the context window frees up. Think /compact, but targeted: early planning context stays in full, the verbose middle gets crushed.
  • Never mind — closes the menu, no changes.

After “Restore conversation” or “Summarize from here”, the original prompt from the message you selected is reinstated in the input field. You can edit it before resending.

3. The “skip the last 6 prompts, keep my files” recipe

The exact answer to the question that brought you here:

  1. Esc Esc.
  2. Scroll up 6 entries.
  3. Enter.
  4. Pick Restore conversation.
  5. The original prompt you sent at that point reappears in the input. Edit it (you presumably want to give Claude a different instruction this time) and send.

Your files stay exactly as they are now. The conversation between then and now is gone. Claude restarts from the old prompt with current code on disk and no memory of the dead-end attempts in between.

What gets checkpointed and what doesn’t

Every user prompt creates a checkpoint of the files Claude has touched through its file-editing tools (Edit, Write, NotebookEdit). Checkpoints persist across sessions — close the terminal, resume tomorrow with claude --continue, the rewind menu still has yesterday’s prompts. Retention is governed by cleanupPeriodDays in settings.json:

{
  "cleanupPeriodDays": 30
}

The default is 30. Drop it to 7 if you don’t want a month of stale session files lying around in ~/.claude/projects/; raise it if you regularly come back to old sessions to cherry-pick. The minimum is 1 — 0 is rejected as a validation error.

Footguns

Bash-modified files aren’t checkpointed. This is the biggest gap. Claude’s Edit and Write tools are tracked. Anything Claude runs through Bashrm, mv, cp, sed -i, mkdir, a script that mutates files, a build that rewrites generated code — sits outside the checkpoint system. Run rm src/old.ts via Bash, hit “Restore code” five prompts later, the file does not come back. The doc says it directly: “Only direct file edits made through Claude’s file editing tools are tracked.” If you’ve been letting Claude shell out for file ops to keep things fast, you’ve quietly opted out of rewind for those changes. Use the Edit tool when reversibility matters, and keep destructive shell ops behind a real git commit you can revert.

External edits don’t get captured either. Manual edits you make in your IDE while Claude is running, and edits from a second claude session touching the same files, are normally invisible to the first session’s checkpoints. They only get picked up if the first session’s next prompt happens to edit the same file. The footgun: you make a careful manual edit, ask Claude to do something else, hit “Restore code” later expecting your manual edit to survive — it might not, depending on whether Claude’s next move overlapped your file.

/rewind and /branch are the same fork machinery, framed for different intent. Both create a new session at the chosen point and switch you into it; the original session stays available, grouped under its parent in the session picker. The difference is what you’re signaling to yourself. /rewind says “abandon this path” — you take a restore action and keep going forward in the new branch. /branch (or claude --continue --fork-session) says “explore an alternative” — it gives you a chance to name the fork and makes it explicit you intend to come back. If you /rewind by accident, the original isn’t gone: open /resume, expand the parent group, pick the pre-rewind session.

Esc Esc collides with cancellation muscle memory. A single Esc cancels the current input or generation; Esc Esc opens rewind. If you instinctively mash Esc to bail out of a prompt, you can land in the rewind menu by accident. One more Esc exits the menu without changes — same with picking “Never mind”. You haven’t broken anything, but the moment is jarring the first time.

Checkpoints are per-session, not per-repo. If you do work across two sessions in the same project, the rewind menu in session A doesn’t show prompts from session B. Each session keeps its own list. To find work from another session, the right tool is /resume (the session picker), not /rewind.

When NOT to use this

  • You want to undo something that left your machine. A git commit, a git push, a deployment — rewind is local session state and can’t reach any of them. Use git reset, git revert, or git restore for committed changes; git reflog is your friend for recovering Bash-deleted files that pre-date the rm.
  • You want both branches alive in parallel. Rewind switches you into the rewound timeline. If you’re A/B-testing two implementation paths and want to keep working in both, /branch from the original session is the right entry point — same fork machinery, but the framing keeps both sessions visible side by side in the picker.
  • You only want to free up context. If your code state is fine and you just want the context window back, /compact is the broader equivalent that summarizes the whole conversation. “Summarize from here” is the targeted variant — useful when you want to keep the early planning context intact and only crush the verbose middle.

Sources

Was this helpful?