Skip to content

[FEATURE] Allow suppressing bash safety heuristic prompts via settings #30435

@chrispmcgee

Description

@chrispmcgee

Preflight Checklist

  • I have searched existing requests and this feature hasn't been requested yet
  • This is a single feature request (not multiple features)

Problem Statement

Claude Code's built-in bash safety heuristics trigger interactive "Do you want to proceed?" prompts on common, legitimate shell patterns — and unlike allowlist-based permission prompts, these cannot be permanently suppressed through permissions.allow rules, acceptEdits mode, or "don't ask again."

Patterns that trigger these prompts include:

  • $() command substitution (e.g., git commit -m "$(cat <<'EOF'...)" — Claude's own recommended commit format)
  • Backtick command substitution (e.g., in gh pr create bodies)
  • Newlines separating multiple commands (e.g., for loops, multi-step scripts)
  • Empty quotes before dashes ("potential bypass")
  • Quote characters inside # comments ("can desync quote tracking")
  • ANSI-C quoting ("can hide characters")
  • Compound commands with cd and output redirection

For power users running Claude Code interactively on their own machines, these prompts fire dozens of times per session on routine development commands. The prompts have no "don't ask again" option, so each one requires manual intervention — even when the command prefix is explicitly in the allowlist.

Proposed Solution

A setting to configure the behavior of individual safety heuristic categories. For example:

{
  "bashSafety": {
    "commandSubstitution": "allow",
    "newlines": "allow",
    "ansiQuoting": "allow",
    "ambiguousSyntax": "prompt"
  }
}

Or a simpler blanket setting:

{
  "bashSafety": "allow"
}

When set to "allow", the heuristic check would still run but would auto-approve instead of prompting. This preserves the detection logic (it could still log warnings) while removing the interactive friction.

This is the complement to #28993, which proposes auto-deny so Claude reformulates. Both approaches want to eliminate the interactive prompt — this one for users who trust their local shell environment and want flow, #28993 for users who want stricter automatic enforcement.

Alternative Solutions

  • --dangerously-skip-permissions: Too broad — disables all permission checks, not just heuristics. Intended for containers, not interactive use.
  • PreToolUse hooks: As noted in Option to auto-deny (not prompt) when built-in safety checks flag a command #28993, users can write hooks to intercept these, but this requires reimplementing detection logic that Claude Code already has. A configuration toggle would be much simpler.
  • Avoiding trigger patterns: Claude could use simpler commands (e.g., no heredocs in commits), but this sacrifices formatting quality and forces workarounds for standard shell patterns.

Priority

High - Significant impact on productivity

Feature Category

Configuration and settings

Use Case Example

  1. User has Bash(git:*) in their allowlist and acceptEdits mode enabled
  2. User asks Claude to commit changes
  3. Claude runs git add file.php && git commit -m "$(cat <<'EOF' ... EOF)"
  4. Despite the allowlist match, user gets prompted: "Command contains $() command substitution — Do you want to proceed?"
  5. User approves. Next commit, same prompt. And the next. Every single commit.
  6. With this feature, user sets "bashSafety": "allow" and commits flow without interruption

Additional Context

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions