The context window is finite and you pay for it. Learn to keep sessions lean — compact, clear, rewind, and watch your usage so Claude stays sharp and cheap.
Why: when context fills up, Claude gets slower, pricier, and more forgetful — so measure before you manage. When: run /context to see what is consuming the window, and /cost to see the bill so far. Where: a long session with lots of file reads and tool output is the usual culprit.
/context # a map of what's using the context window right now
/cost # tokens and dollars this session
/usage # your plan limits and how much you've usedWhy: these are your two levers — compact keeps the thread but shrinks it, clear starts over. When: /compact when you want to continue the same task with less baggage; /clear when you switch to an unrelated task. Where: starting fresh between tasks is the single biggest context win.
/compact # summarize the conversation so far, keep going with less context
/compact Focus on the auth refactor; drop the unrelated debugging.
/clear # discard the conversation entirely and start cleanWhy: when Claude goes down a bad path, you can roll back the conversation and the files instead of untangling it. When: use /rewind (or press Esc twice) to return to a known-good point and try a different prompt. Where: this restores edited files too, not just the chat.
/rewind # choose a checkpoint to return to (conversation + file changes)
# Or press Esc twice to edit an earlier message and branch from there.Why: a few habits keep sessions fast and inexpensive without you thinking about it. When: clear between unrelated tasks, compact long ones, and be mindful that every MCP server and large file read costs window space. Where: prompt caching is automatic — reusing a stable CLAUDE.md and tool set lets Claude read the prefix cheaply.
Keep context lean:
• /clear when you switch tasks — don't carry old context along
• /compact when one task runs long
• Be mindful: every MCP server and big @file read eats the window
• Stable prompts cache automatically — changing CLAUDE.md or tools
mid-session invalidates that cache, so keep them steady