# Clearing

> Ending the current session and starting a fresh one. The next message begins with an empty session and an empty context window.

Ending the current [session](https://ai9k.vercel.app/en/session) and starting a fresh one. The next message begins with an empty session and an empty [context window](https://ai9k.vercel.app/en/context-window). Usually user-driven.

Clearing is the cure for a polluted context. A session accumulates everything: failed attempts, wrong turns, stale [tool results](https://ai9k.vercel.app/en/tool-result), abandoned plans. The [model](https://ai9k.vercel.app/en/model) re-reads all of it on every [turn](https://ai9k.vercel.app/en/turn), and bad history drags on new work. Deep into a long session the [agent](https://ai9k.vercel.app/en/agent) gets vaguer and less obedient — instructions you gave clearly get ignored, quality slips, and prodding it to do better doesn't help, because the noise it's wading through is still in its [context](https://ai9k.vercel.app/en/context). Clearing removes the noise.

Clearing doesn't erase the conversation. Most [harnesses](https://ai9k.vercel.app/en/harness) keep session history on your computer, so the transcript is still there to read or resume. What's gone is the agent's working state: the model is [stateless](https://ai9k.vercel.app/en/stateless), so the new session knows nothing the old one knew. If the session holds decisions or progress the next one will need, have the agent write a [handoff artifact](https://ai9k.vercel.app/en/handoff-artifact) first, then start the new session by pointing at it.

Compare [compaction](https://ai9k.vercel.app/en/compaction), which summarises the session into the new context instead of starting empty. Clearing is the blunter tool: nothing carries over, including the junk.

**Usage**

"It's stuck looping on the failing test."

"Just clear it — start a fresh session with the plan doc and the test file. No point fighting the existing context."

---

- Section 5 — Handoffs · Term 44 of 72
- Page: https://ai9k.vercel.app/en/clearing
- Learn step by step: https://ai9k.vercel.app/en/learn#/clearing
- On the map: https://ai9k.vercel.app/en?term=clearing
- JSON: https://ai9k.vercel.app/data/terms/clearing.json
- Mentioned in: [Input tokens](https://ai9k.vercel.app/en/input-tokens.md), [Stateless](https://ai9k.vercel.app/en/stateless.md), [Context window](https://ai9k.vercel.app/en/context-window.md), [Stateful](https://ai9k.vercel.app/en/stateful.md), [Session](https://ai9k.vercel.app/en/session.md), [Sycophancy](https://ai9k.vercel.app/en/sycophancy.md), [Hallucination](https://ai9k.vercel.app/en/hallucination.md), [Attention budget](https://ai9k.vercel.app/en/attention-budget.md), [Attention degradation](https://ai9k.vercel.app/en/attention-degradation.md), [Smart zone](https://ai9k.vercel.app/en/smart-zone.md), [Handoff](https://ai9k.vercel.app/en/handoff.md), [Handoff artifact](https://ai9k.vercel.app/en/handoff-artifact.md), [Spec](https://ai9k.vercel.app/en/spec.md), [Compaction](https://ai9k.vercel.app/en/compaction.md), [Memory system](https://ai9k.vercel.app/en/memory-system.md)
- Previous: [Smart zone](https://ai9k.vercel.app/en/smart-zone.md)
- Next: [Handoff](https://ai9k.vercel.app/en/handoff.md)

Every term page has a markdown copy: add .md to its address.
