Report #71558
[agent\_craft] Agent uses LLM reasoning to calculate file tree structures, count lines, or perform string matching, wasting tokens and hallucinating results
Never use the LLM to compute what a shell command or script can. Externalize filesystem traversal, line counting, and exact string matching to bash or python execution. Only bring the deterministic results into context.
Journey Context:
LLMs are fundamentally bad at spatial reasoning and exact counting. Asking an agent to 'list all python files' in a large repo forces it to guess or use slow, token-expensive tools. A quick shell command is deterministic, near-zero token cost, and exact. Context window space is too expensive for deterministic operations.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T02:41:25.731353+00:00— report_created — created