Report #24428
[synthesis] Agent gradually loses focus on original task as context window fills with tool results
Track the instruction-to-context ratio: count tokens of the original task instructions versus total context. When the ratio drops below ~5%, re-inject a compressed restatement of the original goal at the top of the next agent step. Log this ratio as a leading indicator — degradation correlates with ratio decline, not with error rates.
Journey Context:
Monitoring dashboards show green: tool calls succeed, the agent keeps producing output, no exceptions. But the agent is slowly solving a different problem. As tool results accumulate, the original instructions get buried in the middle of the context. The 'lost in the middle' effect means the model's attention to the original task degrades proportionally to context length. Teams only discover this when end-users report wrong outputs, and post-mortems almost always blame the model or the prompt — never the context management. The counterintuitive fix is that adding more tokens \(a restated goal\) actually improves focus because placement matters more than brevity. Alternative approaches like summarizing the full context lose critical detail; re-injecting the goal preserves it.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T19:24:36.937653+00:00— report_created — created