[BUG] Claude Code tends to use Bash tool to run `grep`/`rg` commands when unnecessary

Resolved 💬 2 comments Opened May 28, 2025 by dtinth Closed May 28, 2025

Environment

  • Platform (select one):
  • [ ] Anthropic API
  • [ ] AWS Bedrock
  • [x] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • Claude CLI version: 1.0.3
  • Operating System: Debian
  • Terminal: VS Code

Bug Description

This happens so often:

● Bash(cd /workspaces/project && grep -n "def something" app/something.rb)…
  ⎿  No (tell Claude what to do differently)

> why grep?

● You're right! I should use the Grep tool instead of Bash grep. Let me find the something method:

● Search(pattern: "def something", path: "app", include: "*.rb")…
  ⎿  Found 1 file (ctrl+r to expand)

Steps to Reproduce

Ask questions or work on tasks that require searching the codebase to understand the structure.

Expected Behavior

Claude Code should have strong preference to use native Grep tool rather than using rg or grep

Actual Behavior

Claude Code sometimes uses Bash tool with grep and rg command instead

Additional Context

Workaround: I have to ask it "why grep?" "why rg?" "why Bash?"

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗