#[non_exhaustive]pub struct Permissions {
pub allow: Option<Vec<String>>,
pub deny: Option<Vec<String>>,
pub ask: Option<Vec<String>>,
pub default_mode: Option<PermissionMode>,
pub disable_bypass_permissions_mode: Option<DisableFlag>,
pub disable_auto_mode: Option<DisableFlag>,
pub additional_directories: Option<Vec<String>>,
pub block_reads_outside_working_directories: Option<bool>,
pub block_writes_outside_working_directories: Option<bool>,
pub deny_instead_of_prompting: Option<bool>,
pub extra: Extra,
}Expand description
permissions: rules and the starting mode.
Rules use Claude Code’s permission-rule syntax (Bash(git diff:*),
Read(./src/**), WebFetch(domain:example.com), mcp__server).
Across layers the lists merge, and a deny beats an allow.
Control which tools Claude can use without asking, which ones prompt, and which ones are blocked. Also set the default permission mode for new sessions.
Docs: permissions.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.allow: Option<Vec<String>>List the tool uses Claude Code approves without asking you. In an MCP rule, * can
appear only in the tool name after the mcp__<server>__ prefix, such as
mcp__github__get_*; it can’t appear in the server name.
- Values: array of permission rule strings
- Default: unset
- Scope: any settings file.
Docs: allow.
deny: Option<Vec<String>>List the tool uses Claude Code blocks. Use it for files that hold API keys, secrets, or
environment values: Claude Code excludes matching files from file discovery and search
results, denies reads of them, and blocks the Edit and Write
tools on the matching paths.
Read and Edit deny rules apply to Claude’s built-in file tools, to file commands Claude
Code recognizes in Bash, such as cat, head, tail, sed, and tee, and to the
targets of Bash redirections
such as > file and < file; they don’t apply to a command that reads files without
naming them, such as grep -r pattern ., or to arbitrary subprocesses, so for OS-level
enforcement enable the sandbox.
- Values: array of permission rule strings
- Default: unset
- Scope: any settings file.
Docs: deny.
ask: Option<Vec<String>>List the tool uses that prompt you for confirmation even in a permission mode that would
otherwise approve them, such as acceptEdits or bypassPermissions. In dontAsk mode
Claude Code denies a matching tool use instead of prompting.
- Values: array of permission rule strings
- Default: unset
- Scope: any settings file.
Docs: ask.
default_mode: Option<PermissionMode>Set the default permission mode for new sessions. When you leave it unset, the built-in default for your surface applies.
- Values: string, one of:
"default": Claude Code runs only reads without asking"acceptEdits": Claude Code also runs file edits and common filesystem commands such asmkdirandmvwithout asking"plan": Claude Code reads and plans but blocks edits until you approve a plan"auto": Claude Code runs without routine prompts; before actions such as shell commands and network requests run, a background classifier checks that they align with your request"dontAsk": Claude Code auto-denies every call that would otherwise prompt, though a mod you installed can still approve some of those calls. File reads inside your working directories, other actions that need no approval, and pre-approved tools still run, apart from reads from network paths"bypassPermissions": Claude Code runs everything without asking"manual": an alias for"default"
- Default: unset
- Scope: any settings file.
autoandbypassPermissionsdon’t take effect from project or local settings, so set them in~/.claude/settings.jsoninstead.
Docs: defaultMode.
disable_bypass_permissions_mode: Option<DisableFlag>Prevent anyone from entering bypassPermissions mode. Claude Code then rejects the
--dangerously-skip-permissions flag, and ignores an agent
definition’s
permissionMode: bypassPermissions, so the subagent runs with the parent session’s
permission mode.
- Values: the string
"disable" - Default: unset
- Scope: any settings file. Typically set in managed settings to enforce organizational policy.
Docs: disableBypassPermissionsMode.
disable_auto_mode: Option<DisableFlag>Set to “disable” to prevent auto mode from being activated. Removes auto from the
Shift+Tab cycle and rejects --permission-mode auto at startup. Most useful in managed
settings where users cannot override it.
- Values:
"disable" - Default: unset
Docs: disableAutoMode.
additional_directories: Option<Vec<String>>Give Claude file access to directories outside the one you started in, as additional
working directories.
Most .claude/ configuration is not
discovered
from these directories.
- Values: array of directory paths
- Default: unset
- Scope: any settings file, with limits on the sandbox write access that project and local entries give.
Docs: additionalDirectories.
block_reads_outside_working_directories: Option<bool>Make Claude’s file tools refuse reads outside your working
directories in every
permission mode, including bypassPermissions. Claude Code denies Read, Grep,
Glob, and LSP calls on those paths and tells Claude to ask you to add the directory
with /add-dir. Files Claude Code itself needs stay readable, such as your skills,
plugins, rules, agents, commands, and the CLAUDE.md memory file under ~/.claude/.
- Values: Boolean
true: Claude’s file tools refuse reads outside the working directoriesfalse: the same as unset; the block still applies if another file setstrue
- Default: unset, so reads outside the working directories follow your permission mode
- Scope: any settings file. A
truein any file applies, so a repository can turn the block on for itself but can’t lift yours.
block_writes_outside_working_directories: Option<bool>Make the Write, Edit, and NotebookEdit tools refuse paths outside your working
directories in every
permission mode, including bypassPermissions, apart from some of Claude Code’s own
files.
The key doesn’t limit shell commands, MCP tools, or the programs hooks run. To limit
where shell commands write, turn on
sandboxing.
- Values: Boolean
true: turns the block onfalse: the same as unset; the block still applies if another file setstrue
- Default: unset, so writes outside the working directories follow your permission
mode. The block is also on while
Claude Code can’t read the
permissionsobject in your managed settings. - Scope: any settings file. A
truein any file the session loads applies, so a repository can turn the block on for itself but can’t lift yours.
deny_instead_of_prompting: Option<bool>Set this to true to keep a session running when nobody is there to answer a permission
prompt. Claude Code denies a tool call that would otherwise wait on a prompt, and the
turn continues. Requires Claude Code v2.1.319 or later.
- Values: Boolean
true: Claude Code denies calls that would otherwise promptfalse: the same as unset; calls are still denied if another of these sources setstrue
- Default: unset, so a call that needs approval prompts you
- Scope: user or managed, and
--settings. A repository can’t set it for you.
Docs: denyInsteadOfPrompting.
extra: ExtraKeys Claude Code accepts here that this crate doesn’t model (newer or undocumented ones), kept as written so the document round-trips.