Skip to content

Clear, Compact, and Rewind

Context is the resource you manage in Claude Code.

Use session tools deliberately instead of letting every question, correction, and failed attempt stay in the same working memory.

Use /clear between unrelated tasks.

Terminal window
/clear

This starts a fresh context. It is often better than dragging a previous task’s assumptions into a new one.

Use /compact during long-running work when you want to preserve the important parts and reduce noise.

Terminal window
/compact Focus on modified files, decisions made, failing tests, and next steps.

Add compaction preferences to CLAUDE.md if you want the same information preserved every time.

Use /rewind or double Esc when a session goes down the wrong path.

The rewind menu offers five options at any checkpoint:

  • Restore code and conversation
  • Restore conversation
  • Restore code
  • Summarize from here
  • Summarize up to here

The last two make compaction partial instead of all-or-nothing. “Summarize up to here” compacts everything before the chosen point and keeps the recent turns verbatim, which is useful when the early exploration is noise but the last stretch of work is exactly what you need intact.

Rewind is not a replacement for git, but it is useful while exploring.

If you have corrected the same issue more than twice, clear or rewind. Start again with a sharper prompt that includes what you learned.