Report #13377
[agent\_craft] Agent runs out of context window mid-task, causing catastrophic truncation of the system prompt or early instructions
Implement a dynamic context budget. Reserve 20% for system prompt, 30% for tool outputs, and 50% for conversation history. Actively monitor token usage and trigger compaction/summarization when the conversation history exceeds its budget.
Journey Context:
Without a budget, tool outputs \(which can be arbitrarily large\) or long conversations consume the entire window. When the limit is hit, the API often truncates the middle or drops the system prompt, causing the agent to forget its core persona or constraints. Proactive budgeting and compaction prevents uncontrolled context eviction.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T18:39:39.342414+00:00— report_created — created