[BUG] False positive permission check for >> ( and << ( patterns in quoted strings (Breaks auto approve for Bash Tool)

Resolved 💬 4 comments Opened Jan 8, 2026 by dnvang Closed Mar 22, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

The permission system flags multi-angle-bracket patterns followed by ( as potential shell redirects, even when they appear inside quoted strings. This causes false positives for Clojure's thread-last macro ->> and other legitimate use cases.

What Should Happen?

These patterns should not trigger permission checks when inside quoted strings.

Error Messages/Logs

Steps to Reproduce

Minimal reproduction:
```bash
# Triggers permission prompt (with no option for auto-approve):
echo ">> (test"
echo "<< (test"
echo ">>> (test"
echo "<<< (test"

# Works fine - other patterns:
echo "> (test"
echo "< (test"
echo ">> test"
echo "<< test"
echo ">> [test"
echo "<< [test"
echo "test" > /dev/null 2>&1

Real-world Clojure impact (with Bash(clj-eval:*) allowlisted):
# Triggers permission prompt:
clj-eval "(->> (range 3) vec)"
clj-eval "(->> () vec)"

# Works fine:
clj-eval "(->> 5 inc)" # no paren after ->>
clj-eval "(->> [1 2] (map inc))" # bracket, not paren
clj-eval "(->> #_x (range 3) vec)" # discard macro breaks pattern
cmd > /dev/null 2>&1 && cmd2 # standard redirects work


### Claude Model

Opus

### Is this a regression?

I don't know

### Last Working Version

_No response_

### Claude Code Version

2.1.1

### Platform

Anthropic API

### Operating System

Other Linux

### Terminal/Shell

Other

### Additional Information

  Root cause: The shell redirect detection scans the raw command string for patterns like >>, <<, >>>, <<< followed by ( without respecting quoted string boundaries.

  Workarounds for Clojure users:
  - Insert discard macro: (->> #_x (range 3) vec)
  - Use let binding: (let [r (range 3)] (->> r vec))

  Impact: ->> (expr) is extremely common in Clojure/ClojureScript. This disrupts REPL-driven development workflows.

  Suggested Fix

  Shell redirect detection should be context-aware and not match patterns inside quoted string arguments.

View original on GitHub ↗

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