context compression
in English: context compaction
The AI agent replaces earlier parts of a long conversation or work session with a short summary to leave room for continuation.
In plain terms
A language model can only keep a limited amount of text "in mind" at once: this is the context window. During a long task, it fills up with the conversation, the files read in, and the responses from tools. Context compression then replaces the older parts with a concise summary.
It is like leaving a multi-day negotiation and taking not the full minutes to the next meeting but a one-page memo: what you agreed on, what is still open, and what the next step is. The details are lost, but you can keep working with the essence.
This allows an agent to work for hours on a single task without getting stuck due to context window limits. It differs from simple truncation, where old messages vanish without a trace: here, the system attempts to preserve what is important.
How it works
- The system continuously measures how full the context window is, meaning how much text the model sees at once.
- When saturation reaches a threshold, or you request it, compression starts.
- The model writes a summary of the work done so far: what the goal was, what decisions were made, what was completed, and what errors and open questions remain.
- This summary replaces the old, detailed history, while the most recent few steps usually remain verbatim.
- The agent continues work from the summary and, if needed, re-reads the files or data it needs again.
An everyday example
You have been working on a program with a coding agent since the morning, and suddenly a message appears stating that the conversation has been compressed. It still knows the task, but it may no longer remember a request you mentioned in passing hours earlier, and you have to tell it again.
Who is affected
A common misconception
Limits and risks
- Small but important details (an exact number, an exception, a side request) may be omitted from the summary.
- The summary is also written by the model, so it may make mistakes or misunderstand what was essential.
- After multiple compressions, errors can accumulate because the summary of the summary is being created.
- Anything you definitely want to preserve should be written into a separate file or a permanent instruction, not left to the conversation.
Similar, but not the same
- context window – The context window itself is the limit, while context compression is one method to fit within it.
- agent memory – Memory is knowledge preserved and stored separately across sessions, while compression shortens the history within a single running session.
- model compression – Model compression makes the model itself smaller and faster, while context compression only shortens the text passed to the model.
Related concepts
context engineering, AI-agent
automatic compression
context window, token, agent memory, context degradation, coding agent
A brief history
Summarizing conversation history is an old trick of chatbots, but under the name 'compaction' it became widely known with the spread of coding agents in 2025. Anthropic's 2025 article on context engineering described it as one of the basic techniques for long tasks.
Where things stand
At the end of 2026, this is a basic function in coding agents and long-running agent systems, and it usually starts automatically. Its quality is still uneven, so forgetting after compression remains a frequent complaint.
Also known as
context compaction · compaction · auto-compact · context compression · context compression · compaction · conversation summarization · context summarization
Sources
This entry was machine-edited and has undergone machine expert review; the “In the news” section updates automatically from Agent Age stories.