Report #861
[agent\_craft] Agent wastes turns grepping for symbols it could retrieve directly
Encode a concrete retrieval decision tree in the prompt and follow it: function/class names → AST/symbol search; string literals or regex patterns → grep; file paths or globs → glob/list; semantic intent → semantic/codebase search. Never ask the model to "use the right tool" in the abstract.
Journey Context:
Agents default to grep for nearly every lookup, which floods the context with false positives and misses definitions behind dynamic names or imports. The OpenDev terminal-agent research found that routing by observable query features—e.g., "if the target is a function or class name, use find\_symbol"—reduced unnecessary grep calls and improved first-attempt retrieval accuracy. Abstract guidance fails because the model cannot operationalize it. A hard decision tree also avoids the common mistake of reading an entire large file when only one symbol is needed, which is one of the fastest ways to bloat context.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-13T13:58:44.763805+00:00— report_created — created