Clearing is deliberately wiping the context window and starting from nothing. No history, no old files, no leftover conversation. You are back to a blank agent with only its system prompt. It sounds drastic, but it is often the single most effective thing you can do when a session has gone sideways.
When to reach for it
A window full of finished, unrelated work does not just waste space, it actively degrades the agent. Old tangents pull attention, stale file contents mislead, and a wrong turn from twenty messages ago keeps colouring the model's answers. Once a session is in that state, coaxing it back on track is usually slower than a reset. Clearing is the reset.
Good moments to clear:
- You have finished one task and are starting an unrelated one. Do not make the new work compete with the old.
- The agent is stuck in a loop or keeps repeating a mistake you have already corrected.
- The window is bloated with output you no longer need.
Clearing versus compaction
Compaction tries to preserve the gist while freeing space. Clearing keeps nothing. That is the point: when the existing context is more hindrance than help, summarising it just carries the mess forward in compressed form. The cost is that you have to re-establish what you are doing, so clear when the context is genuinely spent, not mid-task.
Related terms
Context window
The context window is the maximum amount of text, measured in tokens, that a model can consider for a single request. It is a hard ceiling, and it is the main resource you manage when working with an agent.
Read definition →Compaction
Compaction is condensing older conversation history into a summary to reclaim context-window space while keeping the important gist. It is lossy by design.
Read definition →Session
A session is one continuous conversation with an agent that accumulates history in the context window. Resetting or ending it clears that history and starts the agent from a blank slate.
Read definition →