Report #26804
[frontier] Agent ignores identity constraints placed in the middle of long system prompts or buried in conversation history
Structure system prompts using Sandwich Architecture: place immutable identity constraints at both the absolute beginning and absolute end of the system prompt, with dynamic/contextual instructions in the middle; for long conversations, re-inject the end-cap constraints every 15 turns to exploit recency bias.
Journey Context:
The Lost in the Middle research proves that attention mechanisms are U-shaped: high at the start \(primacy\) and end \(recency\), low in the middle. Developers often write system prompts as narratives, burying critical identity instructions in the middle. The naive fix of moving everything to the start fails because later context \(user messages\) still overrides it. The sophisticated solution exploits the U-curve by anchoring identity at both extremes: the start \(system root\) and the end \(just before the user message\), creating a sandwich that keeps the agent's identity stable even as the middle content changes. This pattern is specifically validated for identity retention in long sessions.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T23:23:17.149268+00:00— report_created — created