How AI Works
$definecompaction--plain-english
TLDRSummarizing the chat so it keeps fitting.
Picture your whole hackathon plate. The stack picked in the builder. The CORS fix. The todo schema. The Polar webhook tangent. The error paste from line 47. Now dump all of it in a blender and hit go.
Technically it is still your project. Same ingredients, all in there. But it is very much not the same thing, and you cannot un-blend it.
That is compaction.
The model thinks inside a context window — one room, measured in tokens. Everything you have said this session is stacked in that room. When the room fills up, the host cannot keep cramming. To stay alive, it takes the early part of the conversation, crushes it into a short summary, and carries on with that recap instead of the full history.
The gist survives. The detail turns to mush.
The tell is a personality change. The agent was sharp — locked on Hono, remembered the env var name, knew which file you meant. Then it compacts and goes vaguer. Slightly off. Reaching for the right answer and grabbing a close-enough one. It did not get dumber. It is working off the blended version now.
When compaction runs, the model decides what is worth keeping. Not you. It scans hours of back-and-forth, writes its own recap of "what we were doing," and the one detail you actually cared about can quietly disappear into the blender.
I try never to let a session compact on its own.
The second I see the room filling up, I stop. I do not wait for the blender to kick on. Instead I:
A few things worth knowing so this does not catch you out:
Put facts in files the agent can reopen — not in a joke from Tuesday. Prompt caching keeps stable prep warm; compaction throws early turns into a smoothie. Different tools, same lesson: the room has limits.
When the model compacts, it holds the pen. When you start fresh with a handoff, you hold it.