claude-code-notifier
how it works guides faq
◐English
English العربية Deutsch Español Français עברית Italiano 日本語 한국어 Nederlands Polski Português (Brasil) Русский Türkçe Tiếng Việt 简体中文 繁體中文
Get started
All guides

Claude Code permissions: allow and deny rules in settings.json

Updated 27 November 2026 · 4 min read
on this page 01A first example 02Where the rules live 03How rules are checked 04Bash rules 05File, web and MCP rules 06The /permissions command 07Related settings 08Rules and walking away 09FAQ

Claude Code decides whether to run a tool by checking permission rules in your settings files. Rules go in a permissions object with allow, ask and deny lists, for example "allow": ["Bash(npm run *)"]. Deny rules are checked first, then ask, then allow, and the first match wins. Run /permissions inside Claude Code to see every rule and the file it comes from. Anything no rule covers falls back to your permission mode, which in the default mode means Claude asks you.

01A first example

Put this in .claude/settings.json in your project:

{
  "permissions": {
    "allow": ["Bash(npm run *)", "Bash(git commit *)"],
    "deny": ["Bash(git push *)", "Read(./.env)"]
  }
}

Claude can now run any npm run script and make commits without asking, can never push, and can never read .env.

02Where the rules live

FileScope
~/.claude/settings.jsonYou, in every project
.claude/settings.jsonThe project, shared with your team through git
.claude/settings.local.jsonThe project, just for you

When you answer a prompt with "Yes, and don't ask again", Claude Code saves the rule to .claude/settings.local.json at the root of the git repository. Organizations can also set managed rules, which no other file and no command line option can override.

03How rules are checked

  • The order is deny, then ask, then allow. The first match decides, and a more specific rule does not change the order.
  • An allow rule cannot make an exception to a deny rule.
  • Anything no rule matches is handled by your permission mode.

04Bash rules

  • Bash(npm run build) matches that exact command.
  • * matches any text, including spaces. Bash(git log *) allows only git log; Bash(git *) allows every git command.
  • A space before a trailing * matters: Bash(ls *) matches ls and ls -la but not lsof, while Bash(ls*) also matches lsof.
  • Commands joined with &&, ||, ; or | are split, and every part must be allowed.
  • Simple wrappers such as timeout, time and nohup are stripped before matching. Runners such as npx and docker exec are not.

Bash rules match the command text, so they are a convenience, not a sandbox. Anthropic's documentation notes, for example, that Bash(curl *) does not stop /usr/bin/curl.

05File, web and MCP rules

  • Files: Read(./.env) or Read(./secrets/**) use gitignore-style patterns. A Read deny also blocks editing and writing that path. Start a path with // for an absolute path and ~/ for your home folder; a single leading / means relative to the settings file's location.
  • Web: WebFetch(domain:example.com) covers one domain, WebFetch(domain:*.example.com) its subdomains.
  • MCP: mcp__puppeteer__* covers every tool from a server, mcp__puppeteer__puppeteer_navigate one tool.

06The /permissions command

Type /permissions in a session to list every rule and the settings file it comes from, and to add or remove rules. You can open it while Claude is working; changes apply from Claude's next tool call.

07Related settings

  • defaultMode sets the permission mode a session starts in: default, acceptEdits, plan, auto, dontAsk or bypassPermissions.
  • permissions.disableBypassPermissionsMode set to "disable" stops anyone using bypass mode.
  • permissions.additionalDirectories gives Claude file access to folders outside the project, like --add-dir at launch or /add-dir in a session.

08Rules and walking away

Good allow rules are what let a long task run without stopping at every command, while deny rules keep the risky ones off the table. Whatever is left still waits for you. If you are away from the keyboard, a notification tool can bring those prompts to your phone. Claude Code Notifier is one: an independent tool (not made by Anthropic) with a free command line tool, ccn, for Mac, Windows and Linux, and apps for iPhone and Android, which lets you allow once, allow for the session or deny with a tap. See Approve Claude Code permission requests from your phone.

09FAQ

Where do I put Claude Code permission rules?

In a permissions object in ~/.claude/settings.json (all your projects), .claude/settings.json (shared with the project) or .claude/settings.local.json (the project, just for you).

Which wins, allow or deny?

Deny. Claude Code checks deny rules first, then ask, then allow, and an allow rule cannot override a deny rule.

How do I allow all git commands?

Add "Bash(git *)" to the allow list. To allow only some, list them, for example "Bash(git status)" and "Bash(git log *)".

How do I stop Claude Code reading my .env file?

Add "Read(./.env)" to the deny list. A Read deny also stops Claude editing or writing that file.

Claude Code Notifier Get a push on your phone when Claude Code finishes or needs you, then approve, deny or answer from there. The ccn command line tool is free on Mac, Windows and Linux.
Download for iOS Download for Android Install ccn

Use OpenAI's Codex CLI? Notifier for Codex does the same for Codex.

Use Antigravity? Try Antigravity Notifier

Related guides

  • Claude Code permission modes explained (default, acceptEdits, plan, bypassPermissions)What each Claude Code permission mode does (default, acceptEdits, plan, auto, dontAsk, bypassPermissions), how to switch, and when each is safe.
  • Approve Claude Code permission requests from your phoneClaude Code's PermissionRequest hook can return allow or deny. Here is how to answer permission prompts from your phone, by hand or with ccn.
  • Answering permission requests from a hook (PermissionRequest)How Claude Code's PermissionRequest hook works, how to allow or deny from a script, and why permission rules are often the better tool.
  • Leave Claude Code running and walk away: a workflowA practical routine for long Claude Code tasks: keep the computer awake, cut needless prompts, get pinged on your phone and reply from there.
claude-code-notifier

Claude Code Notifier is an independent third-party application. It is not affiliated with, endorsed by, or sponsored by Anthropic, PBC. "Claude" and "Claude Code" are trademarks of Anthropic, PBC.

apps iOS App Android App ccn for macOS, Windows & Linux All guides Use Codex? Try Notifier for Codex Use Antigravity? Try Antigravity Notifier
legal Privacy Policy Terms of Service Other languages © 2026 touchtap. All rights reserved. TouchTap Ltd is registered in England and Wales, company number 13942589.