Memory · Software component
Hierarchical History Compressor
Software componentMemoryCognition & Memoryarc:HierarchicalHistoryCompressor
A context window manager that keeps recent turns verbatim, older turns as paragraph summaries and distant turns as key-fact metadata, while full history is stored externally for on-demand retrieval.
Responsibility. Maintains a multi-granularity representation of conversation history within the context window.
Also known as: Hierarchical summarization, Hierarchical compression
Variant of Context Window Manager abstract
When to choose. Choose for long-running conversations where historical context determines current interpretation and users reference earlier turns, accepting retrieval latency and the need to decide which history to fetch.
Relationships
invokes dependency
reads dependency
- Conversation State Store abstract Ch5.9 Ch10.1
writes dependency
is evaluated by assurance
alternative to variability
Design guidance
- SHOULD trigger hierarchical compression before saturation becomes severe (e.g., at turn 30 in the support example).
- SHOULD preserve critical persistent facts (preferences, account details, major decisions) in the distant-history tier.
- SHOULD keep recent messages verbatim and progressively compress older turns, retrieving archived history on demand instead of loading full transcripts.
Quantitative guidance
As stated by the sources; verify before use.
- Support example: turns 1-15 compressed from ~3,000 to ~100 tokens (97%); at turn 50 history reduced from a projected 10,000 to ~3,000 tokens (70%) (Ch5.9).
- Turn-50 task completion 89% with hierarchical compression vs 62% uncompressed (94% early baseline); satisfaction 4.1/5 vs 3.2/5 (Ch5.9).
- Token consumption scales sublinearly with conversation length (Ch5.9).
Classification
- Patterns
- Recency tiers: last 5-10 turns in full, turns 10-30 back as paragraph summaries, beyond 30 as bullet points/structured metadataFull history stored externally and retrieved on demand
- Quality attributes
- Reliability (ISO/IEC 25010 | NIST AI RMF: valid and reliable)Performance efficiency (ISO/IEC 25010)
- Risks mitigated
- Loss of early-conversation contextContext overflow in long conversationsAgent 'forgetting what we discussed earlier'