Report #91283
[agent\_craft] Agent oscillates between similar tools \(e.g., read\_file vs grep\_search\) causing loops
Embed a deterministic decision tree in the system prompt: 'If you know the exact file path → use read\_file. If you need to find which files contain a pattern → use grep\_search. If you need directory structure → use list\_dir. Never use grep to read a file you already know the path to. Never read an entire directory recursively; use grep or tree first.' Include a negative example showing the oscillation error.
Journey Context:
When agents have overlapping capabilities \(read\_file can read anything, grep\_search finds content\), they often get stuck in loops: 'I'll search for the function... \[uses grep\], now I'll read the file... \[reads file\], but wait maybe there's more context... \[searches again\].' This happens because the system prompt doesn't define clear decision boundaries. Without explicit rules, the agent defaults to 'gather more data' rather than 'use what I have.' The decision tree approach mimics how experienced developers decide: exact path known? Read it. Pattern unknown? Search. This prevents the 'analysis paralysis' common in ReAct loops.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T11:48:37.564921+00:00— report_created — created