[BUG] Permission system duplicates complex bash commands in settings.local.json

Resolved 💬 4 comments Opened Aug 3, 2025 by kobi232 Closed Jan 6, 2026

Environment

  • Platform (select one):
  • AWS Bedrock
  • Claude CLI version: 1.0.62
  • Operating System: macOS (Darwin 24.5.0)

Bug Description

The permission system in Claude Code creates duplicate entries in .claude/settings.local.json for complex bash commands containing special characters and shell syntax. Instead of deduplicating permissions, the same bash command gets added multiple times to the permissions array.

Steps to Reproduce

  1. Use a slash command or workflow that contains a bash command with complex syntax like [[ "$(basename "$PWD")" != "main" ]] && cd main
  2. Execute the command multiple times (e.g., run a custom slash command repeatedly)
  3. Check .claude/settings.local.json in your project directory
  4. Observe multiple identical entries for the same bash command

Expected Behavior

Each unique bash command should only appear once in the permissions array, regardless of how many times it's executed.

Actual Behavior

Complex bash commands with special characters (quotes, brackets, dollar signs) are added repeatedly to the permissions array. For example, the command Bash([[ "$(basename "$PWD")" != "main" ]]) appears 8 times instead of once.

Additional Context

This issue specifically affects bash commands with complex shell syntax. Simple commands appear to deduplicate correctly. The problem causes the settings file to grow unnecessarily large and makes permission management cluttered and harder to read.

Example from affected settings.local.json:
{
"permissions": {
"allow": [
"Bash([[ \"$(basename \"$PWD\")\" != \"main\" ]])",
"Bash([[ \"$(basename \"$PWD\")\" != \"main\" ]])",
"Bash([[ \"$(basename \"$PWD\")\" != \"main\" ]])",
"Bash([[ \"$(basename \"$PWD\")\" != \"main\" ]])",
"Bash([[ \"$(basename \"$PWD\")\" != \"main\" ]])",
"Bash([[ \"$(basename \"$PWD\")\" != \"main\" ]])",
"Bash([[ \"$(basename \"$PWD\")\" != \"main\" ]])",
"Bash([[ \"$(basename \"$PWD\")\" != \"main\" ]])"
]
}
}

View original on GitHub ↗

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