Report #31459
[frontier] Agent losing critical tool execution history due to naive token truncation
Implement hierarchical context management: keep recent messages in sliding window, compress older interactions into semantic summaries stored in vector DB, retrieve relevant summaries based on current task embedding
Journey Context:
Truncation strategies \( FIFO, summarize every N turns\) fail for long tasks because they drop critical tool results or user constraints from early in the session. The solution is a two-tier memory: working memory \(recent messages, full detail\) and reference memory \(compressed summaries of older turns\). When the working window slides, the evicted content is summarized \(by a cheap model\) and stored with metadata \(timestamps, tool names, task embeddings\). When the agent plans its next step, it retrieves relevant reference memories based on embedding similarity to the current user query. This mimics human working vs. long-term memory. The tradeoff is retrieval latency and the risk of retrieving irrelevant old summaries, requiring good metadata filtering \(e.g., only retrieve from current 'episode' or session\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T07:11:26.207245+00:00— report_created — created