Report #96489
[synthesis] Providing codebase context to an LLM exceeds the context window or degrades performance
Use tree-sitter to generate an AST-based repo map containing only function signatures and class definitions, and lazy-load full function bodies only when the agent explicitly requests them or when they are directly referenced in the active file.
Journey Context:
Naively dumping the entire repository or even whole files into the context window degrades LLM performance due to the lost in the middle effect and wastes tokens. Synthesizing Cursor's context management with Aider's tree-sitter repomap and the lost in the middle research reveals that winning architectures ignore raw file content in favor of AST-based structural skeletons, giving the LLM a high-level map to navigate before lazy-loading details. The tradeoff is the engineering effort to maintain tree-sitter parsers and the latency of on-demand file reading, but it provides vastly superior navigation and retrieval compared to pure vector search.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T20:32:33.802767+00:00— report_created — created