bjorn.now

#claude-code

Anthropic's coding agent, working with it (and likely in anger)

10 January, 2026

Add commands to both permissions.allow and sandbox.excludedCommands to run them outside Claude Code’s sandbox by default, because allow grants permission to run at all and excludedCommands runs them unsandboxed.

{
  "permissions": {
    "allow": [
      "Bash(pnpm test:unit:*)",
      "Bash(pnpm test:e2e:*)"
    ]
  },
  "sandbox": {
    "excludedCommands": [
      "pnpm test:unit:*",    // Same commands, different purpose
      "pnpm test:e2e:*"
    ]
  }
}

Note: Tested with Claude Code v2.1.3

Write out colon subcommands explicitly for Claude Code permissions because test:* doesn’t match test:unit (prefix matching treats them as separate commands), and the fallback test* is too broad (matches testAndDestroyEnvironment).

For example:

{
  "permissions": {
    "allow": [
      "Bash(pnpm test:unit:*)", // Allows pnpm test:unit --arg etc.
      "Bash(pnpm test:e2e:*)",
      "Bash(pnpm test*)"        // ❌ <- will allow testAndDestroyEnvironment
    ]
  }
}

Note: Tested with Claude Code v2.1.3