Context Compaction

Taking control of the context you provide to agents.

Interactions with agents can get long. Today, when such interactions exceed the "context" of the agent, older messages are pruned automatically. This is invisible to users and can lead to unexpected loss of information about previous interactions. To solve that problem we introduce context compaction.

Context compaction summarises the earlier part of a long interaction so the agent can keep working with full summarised context. The original messages are not deleted; a compaction message is inserted into the conversation and future agent runs use that summary instead of replaying all older messages.

When to Compact

Use compaction when a conversation has become long or close to its context limit to avoid unexpected interactions pruning. In the conversation input bar, the circular context indicator shows the current context usage percentage.

Compaction is controlled by the user. When usage is high enough (33%), the tooltip offers a Compact now button. When usage is high (70%) a warning message is displayed to the user to invite them to compact. When usage is very high (80%) compaction is required before sending new user messages.

How to Compact

  1. Open the conversation.
  2. Click the new context usage indicator in the input bar.
  3. Click Compact now.
  4. Wait for the "Compacting context..." marker to finish.

While compaction is running, new user messages are blocked with "Wait for compaction to finish". When it succeeds, the conversation shows a compact marker "Context compacted". If it fails, the conversation keeps using its full history and shows a warning marker.

What Changes

After a successful compaction, future agent messages receive:

  • The compaction summary.
  • Messages after the compaction marker.

Messages before the marker remain stored and visible in the conversation history, but they are no longer sent in full to the model. If the conversation is compacted again, the latest successful compaction becomes the active history boundary.

Notes and Limitations

  • The latest agent's model is used to perform the compaction.
  • Compaction summaries are generated by an LLM, so they can omit details.
  • Failed or in-progress compaction messages are ignored by model rendering.
  • Compaction generally take between 10s and 1mn depending on the size of the context to compact.