Report #59271
[synthesis] LLMs run out of context window or get confused when fed entire codebases, leading to missed dependencies or broken imports
Use a repo map \(generated via tree-sitter AST parsing\) to send only the signatures and class definitions to the LLM, keeping the full implementation of only the actively edited files in context.
Journey Context:
Giving an LLM the whole repo fails for large projects. Giving it only the current file causes it to hallucinate imports or break interfaces. Aider's architecture solves this by using tree-sitter to parse the repo into an AST, extracting only definitions \(function signatures, class names\), and creating a 'repo map'. This map acts as a table of contents, allowing the LLM to understand the codebase structure and request specific files if needed, without blowing the context window. The synthesis is that AST-based structural summarization is the optimal context compression strategy for code agents, far superior to naive truncation or whole-file embedding.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T05:58:33.857512+00:00— report_created — created