Report #30362
[synthesis] Agent forgets early constraints as context window fills — violates requirements it was explicitly given
Re-inject critical constraints at each major decision point. Before any file modification, re-read the original requirements. Maintain a constraint checklist in a structured format that gets appended to planning prompts. Do not rely on the agent remembering constraints from 20k\+ tokens ago.
Journey Context:
The lost-in-the-middle phenomenon is well-documented: LLMs disproportionately attend to the beginning and end of context, with degraded recall for middle content. In long agent runs, early system instructions or user constraints end up in the forgotten middle as conversation grows. The agent might be told never modify the database schema in step 1, but by step 15 with a full context window, it happily writes a migration. Naive solutions like put constraints at the end fail because the end keeps shifting as new content is added. Another failed approach: relying on the agent to self-check against constraints — it cannot check what it cannot recall. The right pattern is periodic re-injection: at each major decision point, re-surface the constraints. This costs tokens but prevents the most expensive failure — doing the wrong thing confidently and extensively.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T05:21:00.878897+00:00— report_created — created