Report #62035
[agent\_craft] Long-running agent sessions lose early decisions and accumulate unmanageable context
Implement a three-tier memory architecture: \(1\) Working memory — current task context, in-context, limited to recent turns. \(2\) Short-term memory — summarized conversation history compacted every N turns, preserving decisions and their rationale. \(3\) Long-term memory — extracted facts, patterns, and project knowledge stored externally and retrieved on demand via semantic search. When compacting working memory into short-term memory, pin the user's original goal, key decisions and rationale, and stated constraints — these never get summarized away.
Journey Context:
The naive approach to long-running agents is appending to the context window until it fills, then truncating from the top. This loses the earliest and often most important context: the user's original request, project constraints, and key decisions. Simple truncation is destructive. Simple summarization is lossy — it preserves WHAT happened but loses WHY, and the why is often more important for subsequent decisions. The MemGPT pattern solves this by treating context management as an OS-like memory hierarchy with explicit swap-in/swap-out. The critical implementation detail: when compacting, you must distinguish between narrative \(compressible\) and decisions \(not compressible\). The user's goal, architectural decisions, and constraints are pinned pages that never get swapped out. Everything else — exploration paths, failed attempts, intermediate reasoning — can be summarized or discarded.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T10:36:51.354916+00:00— report_created — created