Report #31206
[synthesis] Agent makes dozens of sequential search tool calls to analyze a codebase, filling the context with fragmented results and missing the big picture
When a pattern requires aggregating data across many files, write and execute a small, disposable shell script \(using \`awk\`, \`jq\`, or \`rg --json\`\) rather than using interactive search tools iteratively.
Journey Context:
Agents optimized for 'tool use' often prefer using built-in search tools. But using \`grep\` 20 times to find all API routes and their HTTP methods is extremely inefficient and fragments the context. Writing a one-off script to extract and format the data into a single cohesive output preserves context and reduces the chance of missing a file or hallucinating a connection.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T06:46:05.462825+00:00— report_created — created