What "context" actually is
A session's context is everything in it so far: your messages, Claude's replies, every file it has read, every command output it has seen. Here's the part that surprises beginners: every new message carries the whole session with it. Ask question #40 and you're re-sending questions #1–39 too.
Three consequences follow, and they explain half the habits in this handbook:
- Long sessions get slower — there's more to re-read every turn.
- Long sessions get dumber — the important instruction from an hour ago is buried under forty exchanges of noise.
- Long sessions get pricier — usage scales with how much context each message drags along.
The core habit: one task per session
The rhythm that fixes all three problems at once:
one task → verify it works → commit → /clear → next task /clear wipes the session to a fresh start. It feels wasteful ("but Claude just
learned my project!") — it isn't, because anything worth keeping is already in files:
the code, the commit, and CLAUDE.md (next chapter). What you're discarding is
the noise. Always commit before clearing, so the work is safely in Git first.
Mid-task pressure valve: /compact
Sometimes one task is legitimately long, and you can feel the session getting heavy — slower
replies, forgotten details. /compact summarizes the conversation so far and
continues with the summary instead of the full transcript. Use it mid-task;
use /clear between tasks.
Watch the meter: /usage
Glance at /usage now and then — not to be anxious, but to build intuition for
what things cost. You'll quickly learn that "read the whole codebase and tell me everything"
is a luxury purchase, while "@Header.astro — fix the menu" is pocket change. Name files;
never ask for the whole codebase when one file will do.
Getting sessions back
claude --continue— run from the terminal, reopens your most recent session. The "oops, closed the window" button./resume— shows past sessions and lets you pick one, for returning to yesterday's thread.
Handy — but don't let resuming replace the memory system. A resumed session drags its old context along; the Project Memory chapters give you a way to come back fresh and informed instead.
The undo button: /rewind
Claude Code keeps checkpoints as it works. /rewind lets you restore the code
and/or the conversation to an earlier checkpoint — undoing an AI change without Git surgery.
Know it exists, use it when an experiment sours. And still commit often:
checkpoints are a convenience, Git is the real safety net.
When you're stuck in a loop
A special rule for a situation every beginner meets: Claude has tried to fix the same bug
three times and each "fix" fails. Stop. More attempts in the same session
make it worse — the context is now full of failed approaches that keep getting re-read.
/clear, then restate the problem fresh (the
Bug-Fix prompt is built for this). Sunk-cost
sessions burn the most tokens and produce the worst code.
Up next: if sessions are disposable, where does project knowledge live? In files — starting with CLAUDE.md, the one file Claude reads at the start of every single session.