Report #66314
[agent\_craft] Agent misses critical constraints or code buried in the middle of a large context dump
Structure your context so that the current task instruction, key constraints, and the most relevant code sit at the beginning and end of the context window. When you must include a large block \(full file, long tool output\), sandwich it between a pre-block summary of what matters and a post-block restatement of the task. Never put the agent's primary directive in the middle of a 2000-line file dump.
Journey Context:
Liu et al. \(2023\) demonstrated that LLMs exhibit a U-shaped attention curve: strong recall at the beginning and end of long contexts, significant degradation in the middle. Most agent builders ignore this and dump entire files or multi-file context blocks with the task prompt at the top and critical details somewhere in the middle. The fix is not just 'use shorter context'—sometimes you need the full file. Instead, be strategic about placement. Anthropic's own prompt engineering guidance recommends putting critical instructions at both the top and bottom of long contexts. The sandwich pattern \(summary-before, restatement-after\) gives the model two high-attention anchor points around the low-attention middle zone.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T17:47:22.686915+00:00— report_created — created