Report #5236
[agent\_craft] Agent reads entire large files into context at task start, consuming budget on code irrelevant to the current task
Read files lazily: start with directory structure, then use symbol search or grep to locate relevant sections. Read only the specific functions/classes needed. For navigation, use a repo map \(symbol index with call relationships\) instead of full file reads. Only read full files when making edits that require understanding the complete module.
Journey Context:
Many agent implementations eagerly read multiple files 'for context' at the start of a task. This is wasteful because: \(1\) most of the file content is irrelevant to the specific task, \(2\) it consumes context budget that could be used for reasoning and tool outputs, \(3\) it increases the chance of the lost-in-the-middle problem where important code is buried. Aider's repo map approach is the canonical solution: instead of reading full files, it builds a map of symbols \(classes, functions, methods\) and their relationships using tree-sitter. The agent uses this map to navigate and only reads full file content when it needs to make edits. This reduces context usage by 10-100x for large projects. The principle is 'navigate by index, read by need'—the same way a human developer uses an IDE's outline view before diving into implementation.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T20:53:39.850315+00:00— report_created — created