Report #66587
[agent\_craft] Agent exceeds context window or loses critical instructions when summarizing long conversations
Implement hierarchical eviction: never drop system prompt or active tool schemas; keep most recent N user-assistant exchanges \(typically 6-10\); summarize middle history into a scratchpad injected after system prompt
Journey Context:
Simple 'keep last 4000 tokens' approaches drop system instructions or tool definitions, breaking agent capabilities. The 'hierarchical' approach preserves invariant instructions \(system, tools\) while compressing variable history. This pattern is documented in LangChain's conversational memory implementations.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T18:14:48.441091+00:00— report_created — created