Report #81606
[frontier] My agent's context window fills up mid-task—it loses instructions, forgets tool results, and degrades after 5-6 turns.
Implement context window budgeting: allocate fixed token budgets to each context component \(system prompt: 10%, tool definitions: 15%, conversation history: 40%, tool results: 30%, guardrails: 5%\). When any component exceeds its budget, apply a component-specific compression strategy—summarize history, truncate tool results, or prune tool definitions.
Journey Context:
The default approach is to stuff everything into the context window and hope it fits. This works for short interactions but fails in production because: \(1\) tool results \(especially from search/code tools\) are unbounded and can consume the entire window, \(2\) conversation history grows linearly while the window is fixed, \(3\) when the window overflows, models don't fail gracefully—they lose instruction-following ability. The budget approach treats the context window like memory allocation: each component gets a fixed budget, and overflow triggers a specific mitigation. Key strategies per component: \(1\) Tool results: truncate to first N tokens plus summary of remainder, \(2\) Conversation history: rolling summarization—keep last K turns verbatim, summarize older turns into a structured state object, \(3\) Tool definitions: dynamically load only tools relevant to the current task phase, \(4\) System prompt: this is sacred, never compress. The emerging best practice is to maintain a separate 'working memory' object \(structured JSON\) that persists across summarization, so critical facts \(task goal, constraints, decisions made\) are never lost to summarization.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T19:34:15.026767+00:00— report_created — created