Report #64054
[agent\_craft] Agent ignores critical instructions placed in the middle of long system prompts
Place the primary task directive \(e.g., "Edit the function \`calculate\_tax\` in file \`tax.py\`"\) at the very beginning or very end of the context window; never bury it between tool definitions, few-shot examples, or file context.
Journey Context:
Language models exhibit a U-shaped attention curve over long contexts \(the "lost in the middle" effect\). Information in the first ~1K tokens and last ~1K tokens is recalled accurately, but content in the middle of a 16K\+ context window is effectively ignored or conflated. Agents commonly construct prompts by sandwiching the specific task between a verbose system preamble \(tool schemas, persona\) and a suffix of file contents, accidentally placing the critical instruction in the "lost zone". This explains why agents often complete the wrong function or ignore specific constraints like "do not modify tests". Positioning the instruction at the extremities maximizes attention weight.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T13:59:53.727616+00:00— report_created — created