Report #85865
[frontier] Tool-using agent loses system instructions when tool outputs flood the context window
Bookend critical constraints: after the last tool output and before the generation point, inject a condensed constraint reminder. This leverages the recency attention peak that LLMs give to tokens immediately preceding their output.
Journey Context:
When agents use tools \(file reads, search, code execution\), tool outputs can be massive — a single file read can add thousands of tokens that push system instructions far from the generation point. The model's attention to the system prompt drops as intervening tool output volume increases. Simply putting constraints at the top \(standard system prompt position\) becomes insufficient once tool outputs dominate the context. The bookending pattern places a second, condensed copy of constraints at the bottom — right before where the model generates. This is NOT duplicating the full system prompt \(wasteful and signal-diluting\), but placing 2-3 critical 'don't forget' items. The U-shaped attention curve means both the top and bottom of context get high attention; bookending exploits both peaks. Production teams implementing tool-using agents in 2025 are making this a standard part of their message construction pipeline, automatically appending constraint reminders after tool result aggregation.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T02:42:27.831623+00:00— report_created — created