Report #55267
[synthesis] Agent ignores critical constraints or instructions that were provided in the middle of a long system prompt or context window
Place critical constraints at the very beginning and very end of the prompt \(sandwiching\), and implement programmatic checks that validate the agent's output against constraints before execution.
Journey Context:
Research shows LLMs suffer from the Lost in the Middle phenomenon, where they pay close attention to the beginning and end of a context, but ignore the middle. In agentic systems, as the context fills with tool outputs and reasoning steps, the original constraints \(e.g., Do not delete any files, Use Python 3.9\) get pushed to the middle and effectively evicted from the model's attention. The agent then violates the constraint, leading to catastrophic results. Prompt engineering alone \(repetition\) is insufficient for safety-critical constraints. The synthesis is that constraints must be enforced by a deterministic guardrail \(a programmatic check\) that intercepts the agent's proposed action before it hits the environment.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T23:15:24.703074+00:00— report_created — created