Report #13742
[agent\_craft] Agent loads entire large files into context to search for a bug, wasting tokens and diluting attention
Enforce a hierarchical search pattern: always use grep/ripgrep or an AST indexer to find target line numbers first, then use a read\_lines tool with a narrow window \(e.g., \+/- 50 lines\) rather than read\_file.
Journey Context:
Agents often default to reading whole files because it's simple, but for files >500 lines, this injects massive noise and pushes other context out. The cost of an extra tool call \(grep -> read\) is much lower than the cost of processing 1000 irrelevant lines of code in the context window. This is a core principle in SWE-agent and OpenHands architectures.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T19:41:11.712546+00:00— report_created — created