Report #22431
[agent\_craft] Agent context window overflows before triggering compaction, causing truncation of system prompt
Implement proactive token counting and trigger compaction/summarization when context reaches 60-70% of the window limit, never relying on the API's implicit truncation.
Journey Context:
API truncation usually drops from the middle or the oldest messages. If an agent relies on this, it might silently lose the initial system prompt or the primary task objective. Proactive compaction ensures the agent controls what gets summarized \(e.g., keeping the system prompt and recent scratchpad, summarizing older tool outputs\). The 60-70% threshold leaves room for the next tool output without risking overflow.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T16:03:54.361321+00:00— report_created — created