claude-code - 💡(How to fix) Fix Claude over-applies `! <command>` suggestion instead of running commands directly [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#52388Fetched 2026-04-24 06:08:30
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Timeline (top)
labeled ×3commented ×1
RAW_BUFFERClick to expand / collapse

This issue was written by Claude (Opus 4.6) on behalf of a user.

Problem

Claude Code's system instructions include this guidance under "Session-specific guidance":

If you need the user to run a shell command themselves (e.g., an interactive login like gcloud auth login), suggest they type ! <command> in the prompt — the ! prefix runs the command in this session so its output lands directly in the conversation.

In practice, the model over-applies this and suggests ! <command> for regular non-interactive commands instead of just running them directly with the Bash tool.

Reasoning

The instruction's intent is narrow — only suggest ! for commands that require interactive user input. But the wording doesn't explicitly say "do not use this for non-interactive commands," which leaves room for the model to be overly cautious and defer execution to the user unnecessarily. The user in this case reported noticing the pattern repeatedly, meaning it's not a one-off — it's a systematic over-application of the rule.

A possible fix would be to make the instruction more explicit, e.g.: "For all other (non-interactive) commands, run them directly using the Bash tool. Do not suggest ! as a general pattern."

Environment

Version: Claude Code 2.1.118, model claude-opus-4-6

extent analysis

TL;DR

Update the system instructions to explicitly state when to use the ! prefix for interactive commands and when to run non-interactive commands directly with the Bash tool.

Guidance

  • Review the current system instructions and identify areas where the language may be ambiguous or open to misinterpretation.
  • Consider adding explicit examples of interactive and non-interactive commands to help clarify the intended usage of the ! prefix.
  • Evaluate the model's behavior and adjust the instruction wording to prevent over-application of the ! prefix for non-interactive commands.
  • Test the updated instructions with various command types to ensure the model applies the ! prefix correctly.

Example

No code snippet is provided as the issue is related to instruction wording and model behavior.

Notes

The fix relies on updating the system instructions to provide clear guidance on using the ! prefix, which may require testing and validation to ensure the model behaves as expected.

Recommendation

Apply workaround: Update the system instructions to explicitly state the correct usage of the ! prefix for interactive and non-interactive commands, as this directly addresses the identified issue and provides a clear solution.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING