Report #62047
[agent\_craft] Context window fills and naive truncation loses system instructions
Implement three-tier context: \(1\) System prompt \(fixed, never truncated\), \(2\) Working memory \(last 6-8 messages verbatim\), \(3\) Summarized history \(everything older condensed into a running 'previous context summary'\). Use a compression prompt: 'Extract key facts, user preferences, and decisions from the following...' Update the summary each turn.
Journey Context:
Truncating from the middle loses tool schemas. Truncating from the start loses user goals established 20 turns ago. MemGPT-style hierarchical memory solved this: we keep system \+ recent N turns raw, and maintain a compressing summary of older turns. When summarizing, explicitly extract 'facts' and 'decisions' to prevent loss of user constraints. This prevents the 'middle truncation' problem where the model forgets it's a coding agent.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T10:38:00.669996+00:00— report_created — created