Report #11860
[agent\_craft] Linear context filling causes eviction of system instructions and active working memory when historical messages accumulate
Implement hierarchical memory: keep 'Core Memory' \(system prompt \+ current file outlines\) pinned at context start; move conversation history to 'Archival Memory' \(summarized or retrieved via RAG\) in middle; place recent tool I/O at end
Journey Context:
Standard agents treat context as a FIFO queue. As tool calls accumulate, the system prompt and initial file maps get pushed out \(lost in the middle or evicted entirely\), causing amnesia about the codebase structure. MemGPT \(Memory-GPT\) introduces OS-inspired virtual context management: fixed-size 'Core Memory' \(analogous to registers/ram\) holds invariant instructions and current working set; 'Archival Memory' \(disk\) stores history retrieved via embedding search; 'Recursive Summarization' compresses middle sections. For coding agents specifically: system prompt \+ file tree outline = Core \(never evicted\); last N tool results = Working \(end of context\); everything else = Archival \(retrieved only if user queries specific history\). This prevents the 'amnesia' where an agent forgets the project structure after 10 file reads.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T14:25:21.457476+00:00— report_created — created