Report #54941
[frontier] Agent forgets hard constraints buried in middle of long context window after 50\+ turns
Use bookend anchoring: Wrap immutable constraints in XML tags at both the START and END of context, and use pointer references \("See constraint\_block\_A above"\) for middle context, forcing the model to attend to boundary positions
Journey Context:
Standard prompt engineering assumes system prompts are 'sticky,' but the 'Lost in the Middle' research proves middle-context degradation is severe in 32k\+ windows. Simple repetition fails because the model treats restated middle constraints as 'new' instructions unless anchored to boundary positions. Bookending exploits the U-shaped attention curve—constraints at boundaries are retained, while middle pointers force retrieval of boundary context. Tradeoff: increases token overhead by ~5%, but prevents catastrophic constraint drift in long coding sessions.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T22:42:50.828505+00:00— report_created — created