Multi-Level Compaction
Long conversations remain usable thanks to intelligent context management.
Every language model has a limited context window. When a conversation exceeds that limit, you have to choose: truncate or summarize. Both approaches are unsatisfactory.
Multi-level compaction applies a strategy inspired by operating system memory management. Context is organized across multiple levels of detail: the distant past is heavily summarized, the recent past retains more details, and the immediate context is fully preserved.
The result: conversations that can last hours without losing coherence. The agent remembers the overall plan, decisions made along the way, and has full detail of the most recent exchanges.
Monitoring
The system continuously monitors context size relative to the model's limit.
Thresholds
When context reaches 70% of capacity, the first level of compaction triggers.
Progressive summarization
The oldest exchanges are summarized while preserving key decisions, important facts, and the narrative thread.
Detail levels
Level 1 (full detail) for the last 20 messages, Level 2 (detailed summary) for the previous 50, Level 3 (condensed summary) for the rest.
Anchors
Elements marked as critical (decisions, validated code, explicit instructions) are protected from compaction.
Long development session
An agent works for 3 hours on a complex feature. Without compaction, the beginning of the session would be lost. With compaction, the design remains accessible.
Interactive debugging
A debugging cycle with dozens of back-and-forth exchanges. Compaction keeps the context of the original problem while preserving the latest attempts in detail.
Multi-topic conversation
A user addresses several topics in the same session. Compaction adapts by keeping a summary of each topic covered.
featurePages.compaction.config
- Active by default on all EasyClaw v2 agents
- Transparent to the user (no action required)
- Thresholds and levels are configurable per agent
