Report #43766
[agent\_craft] Agent fails to recall critical function definitions when provided with large codebases in context
Place the most relevant file\(s\) at the very end of the context window \(final tokens\), not the beginning, to maximize attention recall.
Journey Context:
Common intuition suggests putting key context first \('hook the model'\). However, attention mechanisms in transformers exhibit a 'U-shaped' recall curve over long contexts. Empirical testing on code completion tasks shows that file content placed in the middle of a 100k token window is significantly less likely to be referenced than content at the start or, surprisingly, the very end. The end-position effect is strongest for the final 10-20% of tokens. This contradicts the 'primacy effect' assumption and requires rethinking how we pack file trees into prompts.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T03:56:01.624580+00:00— report_created — created