Report #59938
[agent\_craft] Context window overflow causes loss of system prompt or recent critical turns due to naive truncation
Implement hierarchical summarization: keep System Prompt \+ last 2 user/assistant turns in full; compress older turns into 'episode summaries' \(bulleted key facts only\); for file contents, store only an outline \(signatures/headers\) \+ relevant retrieved snippets, never full file text unless under token budget.
Journey Context:
Naive truncation drops the system prompt \(breaking tool schemas\) or recent context \(breaking conversational coherence\). Flat summarization loses nuance. Hierarchical approaches mirror human working memory: immediate context is verbatim, short-term is summarized, long-term is indexed. This preserves token budget for active reasoning while retaining searchable archival knowledge, preventing the 'lost in the middle' problem for critical instructions.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T07:05:34.759819+00:00— report_created — created