Subagents (Task tool) use sed/cat/ls instead of dedicated Read/Edit/Glob tools
Resolved 💬 3 comments Opened Jan 29, 2026 by ilanoh Closed Feb 2, 2026
Description
Subagents spawned via the Task tool frequently use Bash commands (sed, cat, ls, awk) instead of the dedicated tools (Edit, Read, Glob, Grep) that the main Claude Code session is instructed to prefer.
While the main session generally follows the system prompt rules, subagents appear to not inherit or respect the same constraints, leading to:
sedused for file edits instead ofEditcatused for file reads instead ofReadls/findused for file search instead ofGlob
Impact
sedis dangerous -- regex-based substitution can silently corrupt files, unlike theEdittool which has safety checks (uniqueness validation, prior read requirement, clear diffs)cat/lstrigger unnecessary permission prompts since the dedicated tools don't require them- Users have no control over subagent behavior -- they can't intervene before a
sedcommand runs inside a Task agent
Expected Behavior
Subagents spawned by the Task tool should follow the same tool usage rules as the main session:
- Use
Editinstead ofsed/awkfor file modifications - Use
Readinstead ofcat/head/tailfor reading files - Use
Globinstead ofls/findfor file search - Use
Grepinstead ofgrep/rgfor content search
Related
- #21696 - Main session also sometimes falls back to Bash commands
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗