Report #40533
[frontier] Agent forgets negative constraints placed in the middle of long system prompts after 20\+ interaction turns
Use Constraint Bookending: place critical negative constraints at the very beginning AND very end of the system prompt; for sessions exceeding 50 turns, re-inject the end-bookend constraint block every 15 turns via a tool call that appends it to the context
Journey Context:
Research from Stanford and Anthropic \(Lost in the Middle, 2023\) proved that transformer attention degrades for middle context in long sequences, following a U-shaped curve. Early attempts to solve this used repetition, but that increases token costs linearly and context pollution. Bookending exploits the U-shaped attention curve—models attend strongly to start \(priming\) and end \(recency\)—without linear cost increase. The 15-turn re-injection threshold comes from empirical observation that context compression becomes aggressive after ~8k tokens in current Claude 3.5 Sonnet and GPT-4o models, which corresponds to roughly 15-20 turns of tool-heavy coding conversations.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T22:30:27.682409+00:00— report_created — created