AI glossary
Context compaction
Summarising the older part of a long conversation or agent run so it fits in the context window and the work can continue.
Every model has a limited context window. When a long task approaches it, the system replaces old messages and tool results with a compact summary of what matters: decisions taken, open problems, files touched. The agent then carries on with room to spare.
Good compaction keeps the details that are hard to rediscover and drops the noise. It is now built into several agent platforms and APIs.
Example: After two hours of work, a coding agent has read dozens of files. Before the window fills up it compacts: it keeps a summary of what has changed, what is left and the open errors, and carries on.
In practice
- A summary can lose details: if something is crucial, ask the agent to write it down in a file.
- If the agent seems to “forget” a decision, remind it or start a new session with a good summary.
- For tasks that can be split up, subagents stop the main context from filling up.
More on how agents are organised in agent design patterns.