Work like a pro

The context window: Claude Code's fuel gauge

Why long sessions get worse, and the commands that fix it.

4 min12 / 18

Almost every Claude Code tip comes back to one fact from Anthropic's best-practices guide: the fills up fast, and performance gets worse as it fills. Every message, every file Claude reads and every command output takes space.

All current Claude models can hold about one million . That is huge, but Claude Code fills it fast: one big log file or a long command output can take more space than your whole conversation. Size does not change the rule: the fuller the window, the worse the focus.

EmptyFull

Plenty of room. Claude has your full attention.

Everything counts: messages, replies, files and instructions.

The commands that manage it

CommandWhat it does
/contextShows what is using your context space.
/clearStarts fresh. Use it between unrelated tasks.
/compact [focus]Summarizes the conversation to free space, e.g. /compact focus on the API changes.
EscStops Claude mid-action without losing the context.
Esc Esc or /rewindOpens the rewind menu to restore an earlier point in the conversation and files.
/btw questionAsks a side question that does not enter the conversation history.
claude --continue / --resumePicks up an earlier session.

Two failure patterns to avoid

  • The kitchen-sink session. One task, then an unrelated one, then back. Fix: /clear between tasks.
  • Correcting over and over. After two failed corrections, the context is full of dead ends. Fix: /clear and write a better first using what you learned.

Signs your context is too full

  • Claude forgets a rule you gave it earlier.
  • It repeats a fix that already failed.
  • Answers get longer but less precise.

A clean restart in three moves

  1. Ask: “Summarize what we learned, what works, and what is still broken, in 10 lines.”
  2. Copy the summary, then run /clear.
  3. Paste the summary as your first message, with the next task.
keep research out of your main chatSay "Use a subagent to investigate how login works." Subagents work in their own context window and report back a summary, so your main conversation stays clean.
Checkpoints are not gitClaude snapshots files before it edits, so you can rewind. But checkpoints only track edits made through Claude's file tools, not everything a command might do. Keep git as your real safety net.

Check yourself

1. You have corrected Claude twice on the same issue and it is still wrong. What does Anthropic suggest?
2. Which command shows what is using your context?
3. Are checkpoints a replacement for git?
4. Claude keeps repeating a fix that already failed. What is the most likely cause?

Tip: use ← and → to move between lessons.