[BUG] Agent tool doesn't stick to given subtask
Bug Description
The Agent tool will frequently ignore the goal claude code gave it - or at least not stop there - and instead it thinks it has to solve the main task that claude code itself was meant to solve. For example, claude code might invoke Task(Find interpreter load_definitions), and then the sub-agent starts editing files until the problem is solved, rather than just reporting where load_definitions is.
This is a bit annoying because you don't get the same feedback from or control over the subagent as you get from claude code itself, so it's harder to steer.
Steps to Reproduce
This has happened multiple times to me when claude code chose to use the subagent to find where specific behavior is defined
Expected Behavior
The subagent should just do its stated goal and then stop
Actual Behavior
The subagent continued until the overall problem was solved
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗