Skip to main content

Permission Rules

A permission rule names a tool, and it can name a pattern for that tool. Three lists hold the rules. allow runs a call with no prompt. ask always prompts. deny blocks the call. For example, Bash(git push:*) in deny stops each git push command.

Add rules to permissions.allow, permissions.ask, or permissions.deny in a settings file, run /permissions, or pass --allowedTools and --disallowedTools for one session. Remove a rule to turn it off. allowManagedPermissionRulesOnly turns off rules from every scope except managed settings.

Example​

.claude/settings.json
{
"permissions": {
"allow": ["Bash(bun test)", "Bash(git diff *)", "Read(src/**)"],
"ask": ["Bash(git commit *)"],
"deny": ["Bash(git push:*)", "Read(.env)", "WebFetch"],
"additionalDirectories": ["../shared-lib"]
}
}

The permissions Keys​

Lists from all scopes merge. Official pages: Configure Permissions and Choose a Permission Mode.

ItemStatusWhat it doesHow it worksWhere to set it
permissions.allowDocumentedList of rules for allowed operationsLists from all scopes merge. Project allow rules wait for workspace trust. allowManagedPermissionRulesOnly limits them to managed settingsEach settings scope
permissions.askDocumentedList of rules that always promptask and deny rules apply at once, before trust. An allow rule in a local file does not outrank an ask rule from a project or managed fileEach settings scope
permissions.denyDocumentedList of rules for denied operationsA bare tool name hides the tool from the model. See ToolsEach settings scope
permissions.defaultModeDocumentedDefault permission modemanual is an alias of default. auto and bypassPermissions do not take effect from project or local settingsUser, managed, --settings
permissions.disableBypassPermissionsModeDocumentedValue disable removes bypassPermissionsChecked when a session starts in or can return to that modeMainly managed settings
permissions.blockReadsOutsideWorkingDirectoriesDocumentedRefuses Read, Grep, Glob, and LSP reads outside the working directories in each modetrue from any scope wins, also over a managed false. Needs 2.1.257Each settings scope
permissions.additionalDirectoriesDocumentedExtra directories in the permission scopeApplies after workspace trust. --add-dir and /add-dir do the same for one sessionEach settings scope
permissions.disableAutoModeDocumentedValue disable turns auto mode offThe reason text is disableAutoMode in settings. See Auto ModeSettings, mainly managed
ItemStatusWhat it doesHow it worksWhere to set it
allowManagedPermissionRulesOnlyDocumentedOnly managed settings supply permission rulesRules from other scopes are ignored with a notice that names this keyManaged settings
skipDangerousModePermissionPromptDocumentedThe user accepted the bypass dialogBooleanUser settings
skipAutoPermissionPromptDocumentedThe user accepted the auto mode opt-in dialogBooleanSettings
useAutoModeDuringPlanDocumentedPlan mode uses auto mode semantics when auto mode is availableDefault true. A false from managed, --settings, user, or local settings winsSettings
autoModeDocumentedClassifier rulesSee Auto ModeUser, --settings, managed
sandboxDocumentedBash sandboxSee SandboxEach settings scope

Rule Syntax​

A rule has the form Tool or Tool(content). The tool name is case-sensitive. The content has no space at its start or end inside the parentheses. Source: the program text tool name case-sensitive, non-empty content with no leading/trailing whitespace inside the parens.

FormStatusWhat it matchesNotes
Bash(bun test), PowerShell(...)DocumentedShell commands by pattern.* is a wildcard. \* is a literal star. A pattern that ends in a space and one star also matches the bare command.
Bash(git push:*)DocumentedThe legacy prefix form.The suffix :* matches the prefix before it. Use Bash(git push *) in new rules.
Read(src/**), Edit(...)DocumentedFiles by glob.** crosses folders. A rule that starts with / anchors at the primary working folder.
WebFetch(domain:example.com)DocumentedOne host.The prefix domain: is required. domain:*.example.com is allowed. A full URL is rejected.
WebSearch(terms)DocumentedExact search terms.Wildcards * and ? are rejected.
mcp__server, mcp__server__toolUndocumentedAll tools of one MCP server, or one tool.The program pattern is ^mcp__[\w-]+(?:__(?:[\w.-]+|\*))?$.
Skill(name)DocumentedOne skill.The program text is Skill execution blocked by permission rules.
Bash (no content)DocumentedThe whole tool.In deny, a bare tool name hides the tool from the model.
tip

Explicit deny and ask rules apply before allow rules. See Permission Flow.

Flags and Hooks That Touch Permissions​

ItemStatusWhat it doesHow it worksWhere to set it
--permission-mode <mode>DocumentedSets the mode for one sessionChoices acceptEdits, auto, bypassPermissions, manual, dontAsk, planCLI
--allowedTools, --disallowedToolsDocumentedAllow or deny tool rules for one sessionComma or space separated, such as "Bash(git *) Edit"CLI
--dangerously-skip-permissionsDocumentedSame as --permission-mode bypassPermissionsUse only in sandboxes with no internetCLI
--allow-dangerously-skip-permissionsDocumentedMakes bypass available without enabling itMode can be chosen laterCLI
--permission-prompts <host|none>DocumentedWho answers prompts with --printnone denies every prompt. The mode still decides the restCLI print mode
--restrictedDocumentedRestricted modeRefuses bypassPermissions, confines file tools to the working directories. Env CLAUDE_CODE_RESTRICTED=1CLI
PermissionRequest hookDocumentedAnswers a promptOutput decision.behavior is allow (with updatedInput, updatedPermissions) or deny (message, interrupt)Hooks
PermissionDenied hookDocumentedFires on an auto mode denialOutput retryHooks

Permission Updates​

A PermissionUpdate changes rules or the mode. Hooks and SDK hosts send and receive them.

FieldValues
typeaddRules, replaceRules, removeRules, setMode, addDirectories, removeDirectories
destinationuserSettings, projectSettings, localSettings, session, cliArg
rule valueAn object with toolName and ruleContent.

Source: PermissionUpdate in the program types (types-2.1.304.d.ts).

How It Works​

Permission Flow shows how Claude Code walks the lists, the hooks, and the mode.