Skip to content

Context compaction

Large Language Models have a finite context window. As a conversation grows, the agent eventually runs out of space for new information. Context compaction summarises older messages to free up room while preserving the essential details.

How it works

When an agent's context usage crosses the compaction threshold, Ironspire automatically summarises older messages and replaces them with a condensed version. The most recent messages are always preserved so the agent does not lose track of what it was just doing.

Default settings

SettingDefaultRange
EnabledYesOn / Off
Threshold80% of context window50--95%
Preserved turns42--10

A warning fires when context reaches the threshold minus 10% (e.g. 70% for an 80% threshold). This warning appears once per session.

Per-agent overrides

Each agent can have its own compaction settings. In the agent's configuration, toggle the compaction override and set a custom threshold and preserved turn count.

Manual compaction

Type /compact in the chat input to trigger compaction immediately, regardless of the current context level.

There is no manual compact button in the UI. Use the /compact slash command instead.

Compaction metadata

After a compaction runs, the chat shows a summary with:

  • Messages summarised
  • Tokens before and after
  • Tokens freed
  • Context percentage before and after
  • Compression cost in USD

Next steps