Recovering when it goes wrong
Checkpoints make mistakes cheap to undo, /clear beats a third correction, and a few debugging habits find the cause when the tool itself misbehaves.
Mistakes are cheap if you can go back
Every prompt that starts a turn captures the file state first. These are checkpoints, and they are why you can let Claude try something without fear.
/rewind opens the menu. Its aliases are /checkpoint and /undo, and pressing Esc Esc on an empty prompt does the same. The menu offers five choices:
- restore code and conversation
- restore conversation only
- restore code only
- summarize from here
- summarize up to here
The split matters. If Claude edited the right things but you took a wrong turn in the discussion, restore the conversation only. If the conversation is fine but the edits went bad, restore the code only.
Rewinding is also the cheap way to change direction. The guide prefers /rewind to abandoning a path, because it returns to a prefix that is already cached, unlike compaction.
Claude's code edits are good, but the conversation went down a wrong path. Which rewind choice fits?
Correct early, then reset
The cheapest correction is the first one. As soon as you see Claude heading the wrong way, press Esc. It interrupts and keeps the work done so far, then you redirect.
Stop correcting at two. The guide's advice is exact: after two failed corrections, /clear and write a better prompt instead of a third correction. A long thread of failed attempts is itself in the context, and it is re-read on every turn. The old mistakes keep influencing the next try.
/clear is free, and it also separates unrelated tasks, so the old history is not re-read each turn. It labels the old session for /resume. After a /clear, the rewind menu offers a /resume <session-id> (previous session) entry to get back until you exit.
Remember that CLAUDE.md edits and this reset arrive together: the new text loads after /clear.
Debugging habits
When the problem is Claude's answer, the tools above are enough. When the problem is the tool, the docs give a short order of checks.
/doctorchecks installation, settings, extensions and context usage, and proposes fixes.claude doctorruns from the shell.- If settings do not apply, hooks do not fire, or MCP does not load, try
claude --safe-modefirst, to see whether a plugin, MCP server or hook is the cause. - Compare
/contextwith a/cleared baseline to see which rows (messages, MCP, memory) fill the window. --debug-file <path>writes logs to a file and turns debug on.- Vague searches slow Claude down. Name the directory or file type.
Claude has failed to fix the same bug after two corrections. What does the guide recommend?
Chapter complete
You've finished chapter 6 of 6 in Claude Code foundations.