Report #7702
[agent\_craft] Agent loads entire large files into context to search for a string or pattern
Externalize search operations to code execution \(e.g., bash grep, ripgrep\). Only load the exact matching lines and their immediate surrounding context into the LLM context window.
Journey Context:
LLMs are bad at linear search in long text and it costs massive tokens. The agent has a shell tool. Using ripgrep is O\(n\) and free of token costs, returning exact line numbers. Loading the file costs thousands of tokens and degrades attention. The rule of thumb: if the operation is deterministic and syntactic, execute it; if it requires semantic reasoning, load it.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T03:34:26.376543+00:00— report_created — created