---
title: "Claude Code permissions: Master secure configuration modes"
description: "Learn to manage Claude Code permissions efficiently. Configure allow, ask, and deny rules to balance automation and security. Optimize your workflow today."
---

# Claude Code permissions: Master secure configuration modes

Published: 2026-09-14T02:46:00.464Z

Author: [Goon Nguyen](/author/goon)

Reading time: 16 minutes

Learn to manage Claude Code permissions efficiently. Configure allow, ask, and deny rules to balance automation and security. Optimize your workflow today.

# Claude Code permissions: How to configure rules and choose the right mode

While constant permission prompts can disrupt your workflow, disabling them entirely gives Claude Code dangerously broad access to your files and commands. The goal is controlled autonomy: Routine actions proceed seamlessly, while consequential operations require human review. This guide explains how to configure least-privilege permission rules, safe matcher patterns, and a starter policy to balance speed with workstation security.

![Image](https://cdn.agentkit.best/blog/cfai-media/0168c6865ce60343de306c14fa0b3323640633c366658f654cb8baa772637281-48a856c3281dec74e209b642753b7c7cfdd423e9a91f69f8bfa04b625cbeffa5.jpg)

## What are Claude Code permissions?

> Claude Code permissions are rule-based controls that determine how supported tools and resources may be used. Matching actions can be allowed automatically, sent to the user for confirmation, or denied. These `allow`, `ask`, and `deny` rules operate alongside the active session-wide permission mode.

The permission system acts as a [Claude Code](https://agentkit.best/blog/claude-code-guides/what-is-claude-code-a-complete-guide-to-the-ai-coding-tool) access control layer for supported actions. It can govern common capabilities such as:

A rule controls a particular tool, command, path, domain, or agent. A permission mode defines the broader approval posture for the session.

![Image](https://cdn.agentkit.best/blog/cfai-media/38c0cd06e5c2281f7ed90c295ddca795aa6dcff85e1e4d21b18a86af4fb59a18-8fdd322475cd6dac4c6f41cd1d55dbc1edf5b282d5b153b94953ff7be98ff125.jpg)

Keep in mind that permissions are not a [sandbox](https://agentkit.best/blog/claude-code-guides/claude-code-sandbox-a-guide-to-secure-ai-command-execution). They only control whether Claude Code can attempt actions through supported tools-not whether those actions are actually safe or isolated. They do not provide complete protection against every process, integration, credential exposure, or destructive operation.

## How allow, ask and deny rules work

Claude Code evaluates [rules](https://agentkit.best/blog/claude-code-guides/mastering-claude-code-rules-a-guide-to-consistent-ai-development) according to the consequences of an action. Frequently used commands should not automatically be allowed if they can alter production systems, rewrite Git history, or expose credentials.

### Permission rule evaluation order

According to the current [permission rule reference](https://code.claude.com/docs/en/permissions), Claude Code resolves matching rules in this order:

This order means a matching `deny` rule takes priority over broader `ask` or `allow` rules.

Consider a repository where Claude Code may read ordinary project files, but access to environment files is denied:

`Allow: Read(./src/\*\*)
Deny:  Read(./src/config/.env)
`

The broader rule permits source inspection. The narrower denial still blocks the sensitive file because matching `deny` rules are evaluated first.

A useful policy separates actions into three categories:

### What “Yes, and don’t ask again” changes

Selecting “Yes, and don’t ask again” may save a project-local rule in:

`.claude/settings.local.json
`

The saved rule applies to the repository and developer environment rather than becoming a universal team policy. This file is normally excluded from version control.

Review generated local rules periodically. A decision that was reasonable for one command can become overly broad when wildcards, changed arguments, or different working directories are involved.

You can inspect and manage current rules from a Claude Code session with:

`/permissions
`

## Claude Code permission modes compared

Claude Code permission modes define the session-wide approval posture. Rules still govern specific actions, but the mode determines what happens when no rule produces a final decision.

The official documentation currently lists the following modes:

Relative risk is contextual. It also depends on accessible credentials, network access, hooks, repository content, connected MCP servers, and environmental isolation.

Choose a mode by workflow:

> **High-risk mode warning:** `bypassPermissions` skips normal approval controls. It is not a general solution to prompt fatigue and should not be the default for workstation development. Prefer `default` with narrow rules. Reserve bypass behavior for disposable containers or isolated virtual machines with restricted credentials and network access.

![Image](https://cdn.agentkit.best/blog/cfai-media/fb5079cbfd6ab95ecd3f2c532ed7cb45121c86c3ebbace025792b62026bf4e48-54c2b430b8f95cd7fc4b70b92995763191ed229e040ead4052a35fd0047f0cb6.jpg)

## Where Claude Code permissions are stored

Claude Code permission settings can be defined at managed, user, shared-project, and project-local scopes. The correct scope depends on who should control, review, and inherit the rule.

Managed configuration may restrict or override behavior that users cannot change locally. Organizations should consult the current [Claude Code settings reference](https://code.claude.com/docs/en/settings) before distributing policy.

### What belongs in shared project settings

A shared `.claude/settings.json` should contain rules that the whole team can review through pull requests:

Do not include:

### What belongs in local settings

Use `.claude/settings.local.json` for:

> **Workspace trust is a security decision.** Project-level allow rules are applied only after the repository is trusted. Inspect shared settings before trusting an unfamiliar Git repository, particularly when it requests broad Bash, network, file, agent, or MCP access.

After granting trust, run `/permissions` to inspect the active rule set and confirm which capabilities are available.

## Permission rule syntax and useful patterns

**Syntax note:** The following Claude Code `settings.json` allow-list syntax was reviewed against the official documentation on March 8, 2025. Matcher grammar may change, so recheck the official reference after upgrading Claude Code.

Rules generally use a tool name by itself or a tool with a specifier:

`Tool
Tool(specifier)
`

### Match Bash commands narrowly

Exact command matchers provide tight scope but may stop matching when arguments change.

For example:

`Bash(npm test)
`

This rule should not be treated as permission for every possible test command. If the workflow uses multiple approved scripts, each command can be listed separately or covered with a carefully reviewed wildcard:

`Bash(npm run test:\*)
`

Avoid broad allowances such as:

`Bash
`

A tool-level Bash allowance grants far more authority than a routine-development policy normally requires.

Compound commands may be evaluated as separate components. A chain such as:

`npm test && git status
`

may require both components to satisfy the active policy. Wrappers and command variations can also affect matching behavior.

Keep the following operations under `ask` unless a controlled automation environment specifically requires otherwise:

Blocking one command, such as `rm`, does not mean you have blocked every other dangerous shell operation. Command-denial lists are guardrails, not comprehensive shell isolation.

### Protect sensitive paths

Review access to:

Project-relative **Read rules** are easier to review and share than machine-specific absolute paths. Under the documented model, denying read access to a path can also prevent editing or writing that protected resource.

### Restrict web and subagent access

Use domain-specific `WebFetch` rules instead of broad network approval where practical. Network access can expose source code, repository metadata, credentials, or internal URLs to external services.

Use named `Agent` rules to control supported subagents. MCP (Model Context Protocol) integrations create an additional governance surface because connected servers may expose external systems or data. Review their tools, authentication, and access scope separately.

## Safe starter configuration for daily development

The following safe Claude Code configuration is designed to reduce routine prompts rather than disable Claude Code permission prompts completely. It applies least privilege by allowing selected development actions while preserving confirmation for higher-impact operations.

`{
  "permissions": {
    "defaultMode": "default",
    "allow": \[
      "Bash(git status)",
      "Bash(git diff \*)",
      "Bash(npm test)",
      "Bash(npm run lint)",
      "Bash(npm run build)",
      "Read(./src/\*\*)",
      "Read(./tests/\*\*)",
      "Edit(./src/\*\*)",
      "Edit(./tests/\*\*)",
      "WebFetch(domain:docs.anthropic.com)",
      "WebFetch(domain:code.claude.com)"
    \],
    "ask": \[
      "Bash(git rebase \*)",
      "Bash(git reset --hard \*)",
      "Bash(npm run deploy \*)",
      "WebFetch"
    \],
    "deny": \[
      "Read(./.env)",
      "Read(./.env.\*)",
      "Read(./secrets/\*\*)",
      "Read(./credentials/\*\*)",
      "Read(./\*.pem)",
      "Read(./\*.key)"
    \]
  }
}
`

Customize this Claude Code allow list for the project’s operating system, package manager, scripts, directory structure, and deployment environment. Remove any rule that the repository does not need. Sensitive assets to inventory before enabling greater autonomy include:

![Image](https://cdn.agentkit.best/blog/cfai-media/ac22641d79df462b742ee418f61da0da04df0ec52ae2179aa2412549690e7d1b-4061e080694e6ac661c277bc49261e79156f00a246aa6b5c43cf227023b91eca.jpg)

## Why Claude Code is still asking for permission

When Claude Code permission prompts continue after adding an allow rule, inspect the effective policy before broadening access. The most common causes are matcher scope, rule priority, settings origin, working-directory boundaries, and repository trust.

An approval decision and a successful execution are different outcomes. Claude Code may authorize a command that the sandbox, operating system, network policy, or organization-managed configuration still prevents.

![Image](https://cdn.agentkit.best/blog/cfai-media/78b89964648b3ac410556c98d50fab3233bfde5ecef76175cb20dbe49c681771-99d655f2d867e6a7504ab7acb50ad4e1c30a9a03ce7fa83b9433a380aedf25b1.jpg)

## Permissions vs. Sandboxing and working directory access

Permissions decide whether Claude Code may attempt an action through supported tools. Sandboxing provides OS-level isolation by restricting what executed processes can access. These controls solve different problems and should be used together.

The working directory is Claude Code’s normal project context. Additional directories can be exposed with `--add-dir \<path\>` or `/add-dir`. However, workspace scope should not be treated as an impenetrable security boundary.

Use a defense-in-depth model for secure AI workflow automation:

A container or VM is particularly valuable when working with untrusted code, autonomous execution, deployment tooling, or credentials that should not be available on the host workstation.

![Image](https://cdn.agentkit.best/blog/cfai-media/cead343a121ca5a61f813ab548d6cb550d1cd30d1da301c144481f1eba110856-ae3c3c842348bdfa4a2a399a243adc64dbdeca7c84cd300f8d3e69acfe0a5940.jpg)

## Use least privilege, not blanket approval

Effective Claude Code permissions start with a permission mode suited to the repository and workflow. Narrowly allow routine commands, require confirmation for sensitive or irreversible actions, and deny access to known secrets. For high-autonomy execution, add sandboxing, containers, or virtual machines rather than relying on permission rules alone.

Zero prompts are not the objective. A safe configuration removes low-value interruptions while preserving review points where mistakes could affect code, credentials, infrastructure, or production data. When behavior is unexpected, begin with `/permissions`, verify rule priority and scope, then check environmental restrictions.

As a starting point, consider using AgentKit’s reviewable permissions template. It provides the security checks you need when configuring Claude Code permissions. Claude Code can also be configured directly without AgentKit, and every template should be reviewed before use.

## Structured data

`\<script type="application/ld+json"\>
{
  "@context": "https://schema.org",
  "@graph": \[
    {
      "@type": \["TechArticle", "Article"\],
      "@id": "https://agentkit.best/claude-code-permissions/#article",
      "headline": "Claude Code Permissions: How to Configure Rules and Choose the Right Mode",
      "description": "Configure Claude Code permission modes, allow, ask, and deny rules in settings.json to reduce unnecessary prompts without granting broad access.",
      "url": "https://agentkit.best/claude-code-permissions/",
      "dateModified": "2025-03-08",
      "author": {
        "@type": "Organization",
        "name": "AgentKit Engineering Editorial Team",
        "url": "https://agentkit.best/"
      },
      "reviewedBy": {
        "@type": "Organization",
        "name": "AgentKit AI Development Tooling Review Board",
        "url": "https://agentkit.best/"
      },
      "publisher": {
        "@type": "Organization",
        "name": "AgentKit",
        "url": "https://agentkit.best/"
      },
      "mainEntityOfPage": {
        "@type": "WebPage",
        "@id": "https://agentkit.best/claude-code-permissions/"
      },
      "proficiencyLevel": "Intermediate",
      "dependencies": "Claude Code, JSON, Git",
      "about": \[
        "Claude Code permissions",
        "Claude Code permission modes",
        "Claude Code settings.json",
        "Allow ask and deny rules",
        "Claude Code sandboxing"
      \]
    },
    {
      "@type": "BreadcrumbList",
      "@id": "https://agentkit.best/claude-code-permissions/#breadcrumb",
      "itemListElement": \[
        {
          "@type": "ListItem",
          "position": 1,
          "name": "Home",
          "item": "https://agentkit.best/"
        },
        {
          "@type": "ListItem",
          "position": 2,
          "name": "Claude Code",
          "item": "https://agentkit.best/claude-code/"
        },
        {
          "@type": "ListItem",
          "position": 3,
          "name": "Claude Code Permissions",
          "item": "https://agentkit.best/claude-code-permissions/"
        }
      \]
    }
  \]
}
\</script\>
`

## Frequently asked questions

### What are Claude Code permissions and why are they necessary?

Claude Code permissions provide a rule-based authorization layer that controls what the agent can read, edit, or execute on your machine. They prevent unauthorized access by requiring manual approval for sensitive operations, balancing the agent's autonomy with the principle of least privilege.

### What is the difference between allow, ask, and deny rules?

### How does Claude Code resolve conflicting permission rules?

Claude Code evaluates rules in a strict order: **Deny, then Ask, then Allow**. If an action matches a deny rule, it is blocked immediately, even if a separate allow rule would otherwise permit it. The first match in this sequence determines the outcome.

### Which permission mode should I choose for my workflow?

### Where should I configure my Claude Code permission rules?

Permissions are managed across four scopes: **Managed** (enterprise policy), **User** (global defaults), **Project Shared** (team-reviewed rules in git), and **Project Local** (developer-specific exceptions). Always commit shared team rules to the repository, but keep sensitive local overrides in `.claude/settings.local.json`.

### Why am I still receiving permission prompts for routine commands?

Common causes include overly restrictive matchers, an active "Ask" rule, or missing workspace trust. Run the `/permissions` command in your terminal to inspect which rule is triggering the prompt. If the matcher is too narrow (e.g., missing a wildcard for arguments), you may need to adjust your rule syntax.

### Do permissions replace operating system-level sandboxing?

No. Permissions control tool authorization, but they do not provide OS-level enforcement. For high-autonomy agents or untrusted repositories, always use defense-in-depth strategies like OS sandboxing, containerization, or isolated virtual machines to ensure complete system security.

**Read more**:

## Conclusion

Effective Claude Code security relies on applying the principle of least privilege rather than eliminating all prompts. By choosing the right permission mode, narrowly allowing routine commands, requiring confirmation for sensitive operations, and denying access to known secrets, you can minimize interruptions while preserving critical human review points.

For high-autonomy workflows, always combine permission rules with OS-level isolation like sandboxing or containers, since permissions alone cannot prevent every destructive action or credential exposure. When issues arise, start troubleshooting with /permissions to verify rule priority and scope before adjusting access.
