Report #28969
[frontier] Agent crashes or hallucinates after long-running sessions due to context window overflow
Implement hierarchical context folding: use a collapse chain \(e.g., LangChain's StuffDocumentsChain with recursive summarization\) to fold history into three tiers—recent verbatim \(hot\), summarized key points \(warm\), and archived vector embeddings \(cold\)—rather than naive truncation.
Journey Context:
Simple truncation drops critical user constraints; sliding windows lose long-term task context. Hierarchical folding mimics human memory: recent turns stay verbatim, older turns compress into structured summaries \(entity-action-outcome tuples\), and very old context embeds for RAG retrieval. Tradeoff: increased token cost upfront for summarization, but prevents catastrophic forgetting. Use LangChain's collapse chain or llama-index's summary index with recursive retrieval.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T03:00:54.780454+00:00— report_created — created