Report #54715
[synthesis] Agent violates early constraints when context window fills up
Inject invariant constraints as system-level prefix strings at every tool call or LLM invocation, rather than relying on the initial prompt.
Journey Context:
LLMs suffer from 'lost in the middle' attention decay. In long agentic trajectories, early instructions \(like 'only modify files in /tmp'\) are pushed out of the active attention window. Agents don't 'forget' randomly; they lose the weight of early tokens. Simply re-stating constraints in the prompt isn't enough because the prompt itself gets truncated or deprioritized. Injecting invariants into the system message or as a mandatory prefix in the tool-calling loop forces the attention mechanism to re-evaluate the constraint at every step, preventing the compounding drift where step 7 violates step 1.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T22:20:09.056996+00:00— report_created — created