# Claude Code permissions: modes, rules and precedence

> Claude Code permission modes, allow, ask and deny rule syntax, evaluation order, path anchors and the /permissions dialog, checked against the docs.

Claude Code permissions come from a mode and a set of rules. Rules are evaluated in order, deny, then ask, then allow, and the first match wins. Run `/permissions` to see every rule and the settings file it came from. The docs say the rules are enforced by Claude Code, not the model, so a line in `CLAUDE.md` does not change them.

## Modes

Set the default with `permissions.defaultMode`, start one with `--permission-mode`, or press `Shift+Tab` in the CLI.

| Mode | Behavior |
| --- | --- |
| `default` (Manual) | Prompts before most edits, shell commands and network requests. |
| `acceptEdits` | Accepts file edits and common filesystem commands in the working directory. |
| `plan` | Reads and explores, no source edits. |
| `auto` | A background classifier checks actions instead of you. |
| `dontAsk` | Auto-denies every call that would prompt. |
| `bypassPermissions` | Skips prompts. See [the skip-permissions flag](https://www.excellent.so/guides/claude-code-dangerously-skip-permissions). |

The docs say `auto` and `bypassPermissions` values of `defaultMode` don’t take effect from project or local settings. Use user or managed settings, or `--permission-mode`.

## Rule syntax

Rules go under `permissions` in a settings file.

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

A bare tool name such as `Bash` matches every use, and as a deny rule it removes the tool from Claude’s context. In Bash rules, `*` is a wildcard. The space before a trailing `*` is part of the rule, so `Bash(ls *)` matches `ls -la` but not `lsof`, while `Bash(ls*)` matches both. `Bash(ls:*)` is an equivalent trailing form.

## Precedence

A broad deny such as `Bash(aws *)` blocks a call even if `Bash(aws s3 ls)` is allowed. An allow rule can’t carve an exception out of a deny rule. The same holds across files. A user-level deny blocks a project-level allow. Managed settings sit highest, and nothing on the command line overrides a managed rule.

A `PreToolUse` hook returning allow does not bypass deny or ask rules, but a hook that exits 2 blocks before rules are evaluated. [Claude Code hooks](https://www.excellent.so/guides/claude-code-hooks)

## Path rules for Read and Edit

| Pattern | Meaning |
| --- | --- |
| `//path` | Absolute path from the filesystem root |
| `~/path` | From your home directory |
| `/path` | Relative to the settings source |
| `./path` or `path` | Relative to the current directory |

A pattern like `/Users/alice/file` is not absolute. The single slash anchors at the settings source, so use `//Users/alice/file`. Deny rules apply when either the requested path or the file it resolves to matches, so a symlink to a denied file is denied.

## What rules can’t see

Bash rules match the command text after the docs’ compound-command splitting and wrapper stripping. They don’t match the same program in another form. `Bash(rm *)` stops `rm -rf build/` but not `/bin/rm -rf build/` or `bash -c 'rm -rf build/'`. Patterns that constrain arguments, such as a `curl` URL, are fragile. For enforcement that doesn’t depend on command text, the docs point to sandboxing. [Claude Code sandbox](https://www.excellent.so/guides/claude-code-sandbox)

## Useful keys

- `permissions.additionalDirectories` adds working directories.
- `permissions.blockReadsOutsideWorkingDirectories` and `permissions.blockWritesOutsideWorkingDirectories` make file tools refuse paths outside them in every mode. A `true` from any scope is honored even over managed settings.
- `permissions.denyInsteadOfPrompting` denies calls that would prompt, for unattended runs.
- `permissions.disableBypassPermissionsMode` and `permissions.disableAutoMode` set to `"disable"` turn those modes off.
- `allowManagedPermissionRulesOnly` makes managed settings the only source of rules.

Project `allow` rules and `additionalDirectories` wait until you trust the folder. Deny and ask rules apply right away. For file locations, see [Claude Code settings.json](https://www.excellent.so/guides/claude-code-settings-json).

Checked against the vendor documentation on November 25, 2026. [Permissions](https://code.claude.com/docs/en/permissions) · [Permission modes](https://code.claude.com/docs/en/permission-modes) · [Settings](https://code.claude.com/docs/en/settings)

## Where Excellent fits

Excellent Pro adds checks before supported actions. Claude Code can display an ask prompt. It blocks or asks before the risky actions it checks for. [Agent coverage](https://www.excellent.so/agents) · [Pricing](https://www.excellent.so/pricing). Pro is US-only for now.

Excellent’s free scan reads supported logs on the Mac and reports findings for review. [Run the free scan](https://www.excellent.so/scan) · [See a sample report](https://www.excellent.so/r/sample). For both agents side by side, see [Claude Code and Codex security controls](https://www.excellent.so/guides/claude-code-codex-security-controls).

Source: https://www.excellent.so/guides/claude-code-permissions
