Context management
Claude can only keep so much in mind at once. That space is called the context window, and everything in the conversation uses some of it: your messages, the files it read and the command output.
When it fills up, answers get slower and Claude can lose track of earlier instructions. A few habits prevent that.
Signs the context is full#
- Claude forgets a rule you gave it earlier.
- It repeats work it already did.
- Replies become slower or less focused.
Start fresh with /clear#
Run /clear between unrelated tasks. It wipes the conversation so the next task starts clean. It is the single most useful habit.
Shrink a long session with /compact#
When you are in the middle of a task and the session is long, run /compact. Claude summarizes the conversation and keeps the important parts, freeing space. You can add a hint, such as /compact keep the database migration plan.
Put lasting facts in CLAUDE.md#
Anything you want Claude to remember in every session belongs in CLAUDE.md, not in the conversation. It is loaded fresh each time.
Pick up where you left off#
claude --continue # resume the most recent session
claude --resume # choose from past sessionsKeep noisy work out of the main chat#
Subagents run in their own context. Use one for research or log digging, and only the result comes back. See how to create subagents.