Module 7 — Permissions, execution modes, sandbox and settings files
Module 6 showed that a skill pre-approves a few tools for one turn. This module handles the layer beneath: the general rules that decide, for the whole session, what Claude can read, write, execute and reach. It is the layer to put down as soon as you open a repo: it protects .env, lets make test run without prompting, isolates Bash commands with the sandbox, and decides who approves Claude's actions — you, a classifier, or nobody.
The permission model
A permission rule has the form Tool or Tool(specifier). It lives in a permissions.allow, permissions.ask or permissions.deny list of a settings file, or in a CLI flag (--allowedTools, --disallowedTools, --permission-mode). Rules are evaluated deny first, then ask, then allow; the first match wins. A deny has no exception; a general ask forces the question even if a more specific allow matches.
| Form | Effect |
|---|---|
Bash or Bash(*) | Any Bash command. In deny, removes the tool from the context. |
Bash(npm run *) | Any command starting with npm run, including npm run on its own. |
Bash(git *) | Any git command — also covers git push. |
Edit(app/**) | Editing under app/ (gitignore-style, anchored to the source of the settings). |
Edit(/src/**) | Anchored to the project root in project settings. A single // anchors to the system root. |
Read(./.env) | Blocks reading the current .env; also blocks Edit and Write on that path (v2.1.208+/v2.1.228+). |
WebFetch(domain:example.com) | Fetch to example.com. domain:*.example.com covers subdomains. |
mcp__github__get_* | MCP tools whose name starts with get_ on the github server. |
Agent(Explore) | Subagent named Explore. |
Cd(~/code/**) | Authorized target for /cd. An allow flips /cd into allowlist mode. |
Two rules to remember about Bash: * matches any text including spaces, and Claude Code knows about shell operators — a Bash(safe-cmd *) in allow does not cover safe-cmd && rm -rf .. The recognized separators are &&, ||, ;, |, |&, & and the newline. For > file, the target path goes through the Edit rules and the protected paths.
The /permissions command opens an interactive dialog where you see every rule, its scope and its source file; edits take effect on the next tool call in the same turn (v2.1.234+).