Blog

Claude Code context window: when to /clear, /compact or hand off

Token Coach ·

Short answer: When a thread has done a lot of work and context is mostly full, write a handoff note and /clear. Use /compact when you want to keep going in the same thread with a summary.

What fills the context window

The conversation, every file Claude has read, tool output, CLAUDE.md and tool definitions. As it fills, each turn gets slower and more expensive, and older details get harder for the model to use well.

/compact: keep going, lighter

/compact replaces the conversation with a summary and carries on. Good when you are mid-task and the details that matter are recent.

/clear: start clean

/clear drops the conversation entirely. Best when a piece of work is finished and the next one is different. Your files are untouched.

The handoff note: clear without losing the thread

Before clearing, write five lines: the goal, what is done, what is next, the files that matter, and any decision you do not want revisited. Paste it into the new thread. You keep the state and pay for none of the history.

A simple rule of thumb

Let CTO tell you when

CTO notices when a thread has done a lot of work and the context window is filling, offers to write the handoff note for you, and leaves /clear to you.

Questions

Is /compact or /clear better?

Compact to continue the same task with a summary; clear when the task is done or the next one is different.

Does a full context window hurt quality?

It makes turns slower and costlier, and older details are easier to miss. Starting clean with a handoff note avoids both.

Try CTO free. Paste this in a terminal, then fully quit and reopen Claude Code:

claude plugin install --marketplace tokencoach/token-coach token-coach