✻Founding-member pricing: every lesson for $19/mo. The first 3 lessons are free. Start lesson 1 →
Unit 2 · Steer the Work · Lesson 9 of 40

Steering Long Sessions: Compaction, Rewind & Goals

Keep long Claude Code sessions on track: steer compaction, roll back with rewind and checkpoints, and choose hands-on steering or /goal-driven runs.

ACADEMY12 min+74 XP4-question quiz

🎯 By the end of this lesson you'll be able to

  • Interrupt and redirect without losing work
  • Roll back code and conversation with rewind
  • Direct compaction so summaries keep what matters
  • Choose between hands-on steering and /goal runs

Long sessions drift

Short sessions rarely go wrong. Long ones (a migration, a big feature, a gnarly debugging hunt) accumulate stale context, half-abandoned approaches and small misunderstandings. Steering is the skill of keeping a long session pointed at the goal.

Interrupt early, redirect precisely

The moment you see Claude heading the wrong way, press Esc. The current turn stops and the work so far is kept. Then redirect with specifics:

text
stop, don't refactor the whole module. only change the parsing function and keep its signature.

An early nudge costs seconds. A late one costs a rewrite.

Rewind: a time machine for your session

Claude Code takes checkpoints as it edits. Press Esc Esc with an empty prompt (or type /rewind) to open the rewind menu, pick an earlier point, and restore:

  • the conversation only (keep the code, rewind the chat),
  • the code only (keep the chat, undo the edits), or
  • both.
!
Checkpoints track Claude's file edits

Rewind restores files that Claude changed with its edit tools. Changes made by shell commands (a migration script, rm, a code generator) aren't captured. That's one more reason to work on a git branch and commit at good checkpoints.

✓
The two-correction rule

If you've corrected Claude twice on the same thing and it's still wrong, stop correcting. The context is now full of failed attempts. Rewind to before the first attempt (or /clear) and write a better prompt that includes what you learned.

Directing compaction

In a long session, compaction is inevitable. Auto-compaction will summarize for you, but you'll get a better summary by compacting at a good moment with explicit focus:

text
/compact keep: the agreed migration plan, files already migrated, the 3 remaining failures and their error messages. drop: exploration of the old ORM.

Good moments to compact: right after finishing a phase, before starting the next, or when /context shows you're past about two-thirds full.

Hands-on steering vs. goal-driven runs

StyleHow it worksBest for
Hands-onYou prompt, review, nudge, repeatAmbiguous work, design decisions, learning a codebase
Goal-drivenYou set a completion condition with /goal and Claude keeps working across turns until it's metWell-defined work with an objective finish line
text
/goal all tests in tests/billing pass and `pnpm tsc --noEmit` reports no errors

A goal works best when "done" is checkable: tests pass, the build is clean, a benchmark meets a threshold. "Make it better" isn't a goal. "p95 latency under 200ms in bench/api.ts" is.

⇅Rescue a drifting sessiondrag or use arrows
  1. ⋮⋮Press Esc to stop the current turn
  2. ⋮⋮Open the rewind menu with Esc Esc
  3. ⋮⋮Restore code and conversation to before the bad approach
  4. ⋮⋮Write a sharper prompt that includes what you learned
⇄Flashcards4 cards

Check your understanding

?Lesson quiz10 XP per correct answer · +25 for a perfect score
QUESTION 1 OF 4

What does rewind NOT capture?

Why: Checkpoints cover Claude's file edits, not side effects of Bash commands. Use git too.
QUESTION 2 OF 4

After two failed corrections, the best move is usually:

Why: Failed attempts pollute context. Start from a clean point with what you learned.
QUESTION 3 OF 4

Which is a good /goal?

Why: Goals need an objective, checkable finish line.
QUESTION 4 OF 4

When is a good moment to run /compact manually?

Why: Compacting at a phase boundary with explicit focus produces the best summaries.
0 / 4 correct
Academy lesson

Unlock lesson 9 and the next 31

You've finished the free lessons. Join the Academy for $19/month to unlock every lesson, quiz, terminal simulation and puzzle, plus the final exam and your certificate of completion.

  • All 40 lessons across 9 units
  • 165+ quiz questions
  • Final exam + certificate
  • New lessons as Claude Code evolves
  • XP, streaks and badges
  • Cancel anytime

Already a member? Log in to continue.

Key takeaways

  • Interrupt early with Esc. Redirect with precise constraints.
  • Rewind restores code, conversation or both. Bash side effects aren't covered, so use git too.
  • Compact at phase boundaries with explicit focus.
  • Use /goal when done is objectively checkable.

Nice work. Lesson 9 done?

Mark it complete to earn +74 XP, keep your streak alive and unlock badges.

Written by Curtis Cornell from Anthropic's public Claude Code documentation. Last reviewed November 14, 2026. Claude Code changes fast; if something here differs from your version, the official docs win.

Start lesson 1 free →