Skip to content

[MODEL] Claude uses Bash (cat, grep, head) instead of dedicated tools despite system prompt prohibition #39979

Description

@VoxCore84

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This report does NOT contain sensitive information

Type of Behavior Issue

Claude ignored my instructions or configuration

What You Asked Claude to Do

Use dedicated tools (Read, Grep, Glob, Edit, Write) instead of Bash equivalents, as specified in the system prompt.

What Claude Actually Did

The system prompt contains explicit instructions:

Do NOT use the Bash to run commands when a relevant dedicated tool is provided.

  • To read files use Read instead of cat, head, tail, or sed
  • To edit files use Edit instead of sed or awk
  • To search for files use Glob instead of find or ls
  • To search the content of files, use Grep instead of grep or rg

Despite this, Claude Code routinely:

  • Runs cat file.cpp | head -50 instead of Read(file, limit=50)
  • Runs grep -r "pattern" src/ instead of Grep("pattern", "src/")
  • Runs find . -name "*.h" instead of Glob("**/*.h")
  • Runs sed -i 's/old/new/' file instead of using Edit

Reproduction

This happens in virtually every session longer than 30 minutes. It's especially common:

  1. After context compaction — the dedicated-tool preference gets compressed away
  2. In subagents — spawned agents seem to have weaker adherence to system prompt rules
  3. When the model is "thinking fast" — quick one-off lookups default to Bash

Why This Matters

  1. Bash output is verbose and wastes tokenscat dumps raw content without line numbers; Read provides structured output
  2. Bypasses tool UX — dedicated tools show the user what's being read/searched; Bash calls are opaque
  3. Breaks permission model — users configure tool-level permissions; Bash bypasses these
  4. The system prompt already prohibits this — the model is violating its own instructions

Evidence

Over 200+ sessions on a large C++ codebase (TrinityCore fork, ~2M LOC), this happens in roughly 40% of sessions. The CLAUDE.md reinforces the system prompt with additional rules, and we still see the model reach for cat and grep regularly.

Environment

  • Claude Code v2.1.85
  • Opus 4.6
  • Windows 11 Pro
  • Platform: CLI (bash shell)

Cross-References

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:modelbugSomething isn't workingplatform:windowsIssue specifically occurs on WindowsstaleIssue is inactive

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions