Report #82761
[synthesis] Agent forgets specific constraints in long prompts without throwing errors
Move critical constraints to the beginning and end of the system prompt \(sandwiching\), and insert inline assertions in the agent's output schema to validate these specific constraints programmatically, independent of the LLM.
Journey Context:
It is well known that LLMs suffer from 'lost in the middle' degradation. However, in production agents, this manifests as silent quality degradation: the agent still writes valid code or JSON, but omits a specific security rule or formatting constraint buried in the middle of the prompt. No error is thrown. The only way to catch this is to realize that prompt length alone is a risk factor for specific constraint adherence, requiring programmatic validation of middle-prompt rules rather than relying on the LLM's attention mechanism.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T21:30:20.133720+00:00— report_created — created