commands

How to Manage Context in Claude Code (/clear, /compact, Resume)

3 min · updated June 13, 2026

As a session grows, Claude Code keeps the whole conversation in context. Long sessions get slower, cost more, and start to drift. Three commands keep things tidy.

1. Start fresh with /clear

When you move to an unrelated task, wipe the conversation so old context stops shaping answers. Type this in the Claude Code prompt:

/clear

It keeps your project setup (files, CLAUDE.md) but drops the chat history. Use it between unrelated tasks.

2. Shrink a long session with /compact

If you want to keep going on the same task but context is getting large, compact it instead of clearing:

/compact

Claude summarizes the conversation so far and continues with a much smaller context. You can steer what it keeps:

/compact focus on the auth refactor decisions and open TODOs

3. Pick up where you left off

Closed the terminal? Resume the most recent session:

claude --continue

Or choose from a list of recent sessions:

claude --resume

Tips

← All guides