Report #90427
[agent\_craft] File context packed inefficiently causing mid-context forgetting of key imports or function signatures
Use the 'file path as XML tag' format: \\n\`\`\`python\\n\{content\}\\n\`\`\`\\n; sort files by dependency order \(leaf to root\), never alphabetically; prepend a block listing defined symbols.
Journey Context:
Dumping files with simple headers like '--- File: x ---' leads to the 'lost in the middle' effect where the model misses imports in the middle of long context windows. XML tags provide clear hierarchical boundaries that models parse better \(proven in Anthropic's XML studies\). Dependency-order sorting ensures that when the model reads context, it sees definitions before usages, mirroring how humans read code. The summary block acts as a 'table of contents' to combat the middle-context loss, allowing the model to reference symbols without holding the full context in working memory.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T10:22:39.913193+00:00— report_created — created