modified Best Practices for Claude Code View current →
--- a/best-practices.md +++ b/best-practices.md @@ -221,18 +221,15 @@ Configure permissions -Use `/permissions` to allowlist safe commands or `/sandbox` for OS-level isolation. This reduces interruptions while keeping you in control. - -By default, Claude Code requests permission for actions that might modify your system: file writes, Bash commands, MCP tools, etc. This is safe but tedious. After the tenth approval you’re not really reviewing anymore, you’re just clicking through. There are two ways to reduce these interruptions: - - * **Permission allowlists** : permit specific tools you know are safe (like `npm run lint` or `git commit`) +Use [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) to let a classifier handle approvals, `/permissions` to allowlist specific commands, or `/sandbox` for OS-level isolation. Each reduces interruptions while keeping you in control. + +By default, Claude Code requests permission for actions that might modify your system: file writes, Bash commands, MCP tools, etc. This is safe but tedious. After the tenth approval you’re not really reviewing anymore, you’re just clicking through. There are three ways to reduce these interruptions: + + * **Auto mode** : a separate classifier model reviews commands and blocks only what looks risky: scope escalation, unknown infrastructure, or hostile-content-driven actions. Best when you trust the general direction of a task but don’t want to click through every step + * **Permission allowlists** : permit specific tools you know are safe, like `npm run lint` or `git commit` * **Sandboxing** : enable OS-level isolation that restricts filesystem and network access, allowing Claude to work more freely within defined boundaries -Alternatively, use `--dangerously-skip-permissions` to bypass permission prompts for contained workflows like fixing lint errors or generating boilerplate. See [permission modes](</docs/en/permissions#permission-modes>) for what is and isn’t skipped. - -Letting Claude run arbitrary commands can result in data loss, system corruption, or data exfiltration via prompt injection. Only use `--dangerously-skip-permissions` in a sandbox without internet access. - -Read more about [configuring permissions](</docs/en/permissions>) and [enabling sandboxing](</docs/en/sandboxing>). +Read more about [permission modes](</docs/en/permission-modes>), [permission rules](</docs/en/permissions>), and [sandboxing](</docs/en/sandboxing>). ### @@ -630,6 +627,24 @@ Use `--verbose` for debugging during development, and turn it off in production. +### + +​ + +Run autonomously with auto mode + +For uninterrupted execution with background safety checks, use [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>). A classifier model reviews commands before they run, blocking scope escalation, unknown infrastructure, and hostile-content-driven actions while letting routine work proceed without prompts. + +Report incorrect code + +Copy + +Ask AI + + claude --permission-mode auto -p "fix all lint errors" + +For non-interactive runs with the `-p` flag, auto mode aborts if the classifier repeatedly blocks actions, since there is no user to fall back to. See [when auto mode falls back](</docs/en/permission-modes#when-auto-mode-falls-back>) for thresholds. + * * * ##
modified Changelog View current →
--- a/changelog.md +++ b/changelog.md @@ -1,4 +1,87 @@ This page is generated from the [CHANGELOG.md on GitHub](<https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md>). Run `claude --version` to check your installed version. + +​ + +2.1.83 + +March 25, 2026 + + * Added `managed-settings.d/` drop-in directory alongside `managed-settings.json`, letting separate teams deploy independent policy fragments that merge alphabetically + * Added `CwdChanged` and `FileChanged` hook events for reactive environment management (e.g., direnv) + * Added `sandbox.failIfUnavailable` setting to exit with an error when sandbox is enabled but cannot start, instead of running unsandboxed + * Added `disableDeepLinkRegistration` setting to prevent `claude-cli://` protocol handler registration + * Added `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB=1` to strip Anthropic and cloud provider credentials from subprocess environments (Bash tool, hooks, MCP stdio servers) + * Added transcript search — press `/` in transcript mode (`Ctrl+O`) to search, `n`/`N` to step through matches + * Added `Ctrl+X Ctrl+E` as an alias for opening the external editor (readline-native binding; `Ctrl+G` still works) + * Pasted images now insert an `[Image #N]` chip at the cursor so you can reference them positionally in your prompt + * Agents can now declare `initialPrompt` in frontmatter to auto-submit a first turn + * `chat:killAgents` and `chat:fastMode` are now rebindable via `~/.claude/keybindings.json` + * Fixed mouse tracking escape sequences leaking to shell prompt after exit + * Fixed Claude Code hanging on exit on macOS + * Fixed screen flashing blank after being idle for a few seconds + * Fixed a hang when diffing very large files with few common lines — diffs now time out after 5 seconds and fall back gracefully + * Fixed a 1–8 second UI freeze on startup when voice input was enabled, caused by eagerly loading the native audio module + * Fixed a startup regression where Claude Code would wait ~3s for claude.ai MCP config fetch before proceeding + * Fixed `--mcp-config` CLI flag bypassing `allowedMcpServers`/`deniedMcpServers` managed policy enforcement + * Fixed claude.ai MCP connectors (Slack, Gmail, etc.) not being available in single-turn `--print` mode + * Fixed `caffeinate` process not properly terminating when Claude Code exits, preventing Mac from sleeping + * Fixed bash mode not activating when tab-accepting `!`-prefixed command suggestions + * Fixed stale slash command selection showing wrong highlighted command after navigating suggestions + * Fixed `/config` menu showing both the search cursor and list selection at the same time + * Fixed background subagents becoming invisible after context compaction, which could cause duplicate agents to be spawned + * Fixed background agent tasks staying stuck in “running” state when git or API calls hang during cleanup + * Fixed `--channels` showing “Channels are not currently available” on first launch after upgrade + * Fixed uninstalled plugin hooks continuing to fire until the next session + * Fixed queued commands flickering during streaming responses + * Fixed slash commands being sent to the model as text when submitted while a message is processing + * Fixed scrollback jumping when collapsed read/search groups finish after scrolling offscreen + * Fixed scrollback jumping to top when the model starts or stops thinking + * Fixed SDK session history loss on resume caused by hook progress/attachment messages forking the parentUuid chain + * Fixed copy-on-select not firing when you release the mouse outside the terminal window + * Fixed ghost characters appearing in height-constrained lists when items overflow + * Fixed `Ctrl+B` interfering with readline backward-char at an idle prompt — it now only fires when a foreground task can be backgrounded + * Fixed tool result files never being cleaned up, ignoring the `cleanupPeriodDays` setting + * Fixed space key being swallowed for up to 3 seconds after releasing voice hold-to-talk + * Fixed ALSA library errors corrupting the terminal UI when using voice mode on Linux without audio hardware (Docker, headless, WSL1) + * Fixed voice mode SoX detection on Termux/Android where spawning `which` is kernel-restricted + * Fixed Remote Control sessions showing as Idle in the web session list while actively running + * Fixed footer navigation selecting an invisible Remote Control pill in config-driven mode + * Fixed memory leak in remote sessions where tool use IDs accumulate indefinitely + * Improved Bedrock SDK cold-start latency by overlapping profile fetch with other boot work + * Improved `--resume` memory usage and startup latency on large sessions + * Improved plugin startup — commands, skills, and agents now load from disk cache without re-fetching + * Improved Remote Control session titles: AI-generated titles now appear within seconds of the first message + * Improved `WebFetch` to identify as `Claude-User` so site operators can recognize and allowlist Claude Code traffic via `robots.txt` + * Reduced `WebFetch` peak memory usage for large pages + * Reduced scrollback resets in long sessions from once per turn to once per ~50 messages + * Faster `claude -p` startup with unauthenticated HTTP/SSE MCP servers (~600ms saved) + * Bash ghost-text suggestions now include just-submitted commands immediately + * Increased non-streaming fallback token cap (21k → 64k) and timeout (120s → 300s local) so fallback requests are less likely to be truncated + * Interrupting a prompt before any response now automatically restores your input so you can edit and resubmit + * `/status` now works while Claude is responding, instead of being queued until the turn finishes + * Plugin MCP servers that duplicate an org-managed connector are now suppressed instead of running a second connection + * Linux: respect `XDG_DATA_HOME` when registering the `claude-cli://` protocol handler + * Changed “stop all background agents” keybinding from `Ctrl+F` to `Ctrl+X Ctrl+K` to stop shadowing readline forward-char + * Deprecated `TaskOutput` tool in favor of using `Read` on the background task’s output file path + * Added `CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK` env var to disable the non-streaming fallback when streaming fails + * Plugin options (`manifest.userConfig`) now available externally — plugins can prompt for configuration at enable time, with `sensitive: true` values stored in keychain (macOS) or protected credentials file (other platforms) + * Claude can now reference the on-disk path of clipboard-pasted images for file operations + * `Ctrl+L` now clears the screen and forces a full redraw — use this to recover when Cmd+K leaves the UI partially blank. Use `Ctrl+U` or double-Esc to clear prompt input. + * `--bare -p` (SDK pattern) is ~14% faster to the API request + * Memory: `MEMORY.md` index now truncates at 25KB as well as 200 lines + * Disabled `AskUserQuestion` and plan-mode tools when `--channels` is active + * Fixed API 400 error when a pasted image was queued during a failing tool call + * Fixed MCP tool calls hanging indefinitely when an SSE connection drops mid-call and exhausts its reconnection attempts + * Fixed Remote Control session titles showing raw XML when a background agent completed before the first user message + * Fixed remote sessions forgetting conversation history after a container restart due to progress-message gaps in the resumed transcript chain + * Fixed remote sessions requiring re-login on transient auth errors instead of retrying automatically + * Fixed `rg ... | wc -l` and similar piped commands hanging and returning `0` in sandbox mode on Linux + * Fixed voice input hold-to-talk not activating when a CJK IME inserts a full-width space + * Fixed `--worktree` hanging silently when the worktree name contained a forward slash + * [VSCode] Spinner now turns red with “Not responding” when the backend hasn’t responded for 60 seconds + * [VSCode] Fixed session history not loading correctly when reopening a session via URL or after restart + * [VSCode] Added Esc-twice (or `/rewind`) to open a keyboard-navigable rewind picker + * [VSCode] Fixed “Fork conversation from here” and rewind actions failing silently after the session cache goes stale ​
modified Push events into a running session with channels View current →
Show diff (128 lines)
--- a/channels.md +++ b/channels.md @@ -1,8 +1,8 @@ Channels are in research preview and require Claude Code v2.1.80 or later. They require claude.ai login. Console and API key authentication is not supported. Team and Enterprise organizations must explicitly enable them. -A channel is an MCP server that pushes events into your running Claude Code session, so Claude can react to things that happen while you’re not at the terminal. Channels can be two-way: Claude reads the event and replies back through the same channel, like a chat bridge. Events only arrive while the session is open, so for an always-on setup you run Claude in a background process or persistent terminal. Unlike integrations that spawn a fresh cloud session or wait to be polled, the event arrives in the session you already have open: see how channels compare. You install a channel as a plugin and configure it with your own credentials. Telegram and Discord are included in the research preview. When Claude replies through a channel, you see the inbound message in your terminal but not the reply text. The terminal shows the tool call and a confirmation (like “sent”), and the actual reply appears on the other platform. This page covers: - - * Supported channels: Telegram and Discord setup +A channel is an MCP server that pushes events into your running Claude Code session, so Claude can react to things that happen while you’re not at the terminal. Channels can be two-way: Claude reads the event and replies back through the same channel, like a chat bridge. Events only arrive while the session is open, so for an always-on setup you run Claude in a background process or persistent terminal. Unlike integrations that spawn a fresh cloud session or wait to be polled, the event arrives in the session you already have open: see how channels compare. You install a channel as a plugin and configure it with your own credentials. Telegram, Discord, and iMessage are included in the research preview. When Claude replies through a channel, you see the inbound message in your terminal but not the reply text. The terminal shows the tool call and a confirmation (like “sent”), and the actual reply appears on the other platform. This page covers: + + * Supported channels: Telegram, Discord, and iMessage setup * Install and run a channel with fakechat, a localhost demo * Who can push messages: sender allowlists and how you pair * Enable channels for your organization on Team and Enterprise @@ -21,6 +21,8 @@ * Telegram * Discord + + * iMessage View the full [Telegram plugin source](<https://github.com/anthropics/claude-plugins-official/tree/main/external_plugins/telegram>). @@ -207,6 +209,68 @@ /discord:access policy allowlist +View the full [iMessage plugin source](<https://github.com/anthropics/claude-plugins-official/tree/main/external_plugins/imessage>).The iMessage channel reads your Messages database directly and sends replies through AppleScript. It requires macOS and needs no bot token or external service. + +1 + +Grant Full Disk Access + +The Messages database at `~/Library/Messages/chat.db` is protected by macOS. The first time the server reads it, macOS prompts for access: click **Allow**. The prompt names whichever app launched Bun, such as Terminal, iTerm, or your IDE.If the prompt doesn’t appear or you clicked Don’t Allow, grant access manually under **System Settings > Privacy & Security > Full Disk Access** and add your terminal. Without this, the server exits immediately with `authorization denied`. + +2 + +Install the plugin + +In Claude Code, run: + +Report incorrect code + +Copy + +Ask AI + + /plugin install imessage@claude-plugins-official + +If Claude Code reports that the plugin is not found in any marketplace, your marketplace is either missing or outdated. Run `/plugin marketplace update claude-plugins-official` to refresh it, or `/plugin marketplace add anthropics/claude-plugins-official` if you haven’t added it before. Then retry the install. + +3 + +Restart with channels enabled + +Exit Claude Code and restart with the channel flag: + +Report incorrect code + +Copy + +Ask AI + + claude --channels plugin:imessage@claude-plugins-official + +4 + +Text yourself + +Open Messages on any device signed into your Apple ID and send a message to yourself. It reaches Claude immediately: self-chat bypasses access control with no setup. + +The first reply Claude sends triggers a macOS Automation prompt asking if your terminal can control Messages. Click **OK**. + +5 + +Allow other senders + +By default, only your own messages pass through. To let another contact reach Claude, add their handle: + +Report incorrect code + +Copy + +Ask AI + + /imessage:access allow +15551234567 + +Handles are phone numbers in `+country` format or Apple ID emails like `[[email protected]](</cdn-cgi/l/email-protection>)`. + You can also [build your own channel](</docs/en/channels-reference>) for systems that don’t have a plugin yet. ## @@ -215,7 +279,7 @@ Quickstart -Fakechat is an officially supported demo channel that runs a chat UI on localhost, with nothing to authenticate and no external service to configure. Once you install and enable fakechat, you can type in the browser and the message arrives in your Claude Code session. Claude replies, and the reply shows up back in the browser. After you’ve tested the fakechat interface, try out [Telegram](<https://github.com/anthropics/claude-plugins-official/tree/main/external_plugins/telegram>) or [Discord](<https://github.com/anthropics/claude-plugins-official/tree/main/external_plugins/discord>). To try the fakechat demo, you’ll need: +Fakechat is an officially supported demo channel that runs a chat UI on localhost, with nothing to authenticate and no external service to configure. Once you install and enable fakechat, you can type in the browser and the message arrives in your Claude Code session. Claude replies, and the reply shows up back in the browser. After you’ve tested the fakechat interface, try out [Telegram](<https://github.com/anthropics/claude-plugins-official/tree/main/external_plugins/telegram>), [Discord](<https://github.com/anthropics/claude-plugins-official/tree/main/external_plugins/discord>), or [iMessage](<https://github.com/anthropics/claude-plugins-official/tree/main/external_plugins/imessage>). To try the fakechat demo, you’ll need: * Claude Code [installed and authenticated](</docs/en/quickstart#step-1-install-claude-code>) with a claude.ai account * [Bun](<https://bun.sh>) installed. The pre-built channel plugins are Bun scripts. Check with `bun --version`; if that fails, [install Bun](<https://bun.sh/docs/installation>). @@ -271,7 +335,7 @@ The message arrives in your Claude Code session as a `<channel source="fakechat">` event. Claude reads it, does the work, and calls fakechat’s `reply` tool. The answer shows up in the chat UI. -If Claude hits a permission prompt while you’re away from the terminal, the session pauses until you respond. Channel servers that declare the [permission relay capability](</docs/en/channels-reference#relay-permission-prompts>) can forward these prompts to you so you can approve or deny remotely. For unattended use, [`--dangerously-skip-permissions`](</docs/en/permissions#permission-modes>) bypasses prompts entirely, but only use it in environments you trust. +If Claude hits a permission prompt while you’re away from the terminal, the session pauses until you respond. Channel servers that declare the [permission relay capability](</docs/en/channels-reference#relay-permission-prompts>) can forward these prompts to you so you can approve or deny remotely. For unattended use, [`--dangerously-skip-permissions`](</docs/en/permission-modes#skip-all-checks-with-bypasspermissions-mode>) bypasses prompts entirely, but only use it in environments you trust. ## @@ -286,7 +350,7 @@ 3. In your Claude Code session, approve the code when prompted 4. Your sender ID is added to the allowlist -On top of that, you control which servers are enabled each session with `--channels`, and on Team and Enterprise plans your organization controls availability with `channelsEnabled`. Being in `.mcp.json` isn’t enough to push messages: a server also has to be named in `--channels`. The allowlist also gates [permission relay](</docs/en/channels-reference#relay-permission-prompts>) if the channel declares it. Anyone who can reply through the channel can approve or deny tool use in your session, so only allowlist senders you trust with that authority. +iMessage works differently: texting yourself bypasses the gate automatically, and you add other contacts by handle with `/imessage:access allow`. On top of that, you control which servers are enabled each session with `--channels`, and on Team and Enterprise plans your organization controls availability with `channelsEnabled`. Being in `.mcp.json` isn’t enough to push messages: a server also has to be named in `--channels`. The allowlist also gates [permission relay](</docs/en/channels-reference#relay-permission-prompts>) if the channel declares it. Anyone who can reply through the channel can approve or deny tool use in your session, so only allowlist senders you trust with that authority. ## @@ -334,7 +398,7 @@ Channels fill the gap in that list by pushing events from non-Claude sources into your already-running local session. - * **Chat bridge** : ask Claude something from your phone via Telegram or Discord, and the answer comes back in the same chat while the work runs on your machine against your real files. + * **Chat bridge** : ask Claude something from your phone via Telegram, Discord, or iMessage, and the answer comes back in the same chat while the work runs on your machine against your real files. * **[Webhook receiver](</docs/en/channels-reference#example-build-a-webhook-receiver>)** : a webhook from CI, your error tracker, a deploy pipeline, or other external service arrives where Claude already has your files open and remembers what you were debugging. ##
modified Channels reference View current →
--- a/channels-reference.md +++ b/channels-reference.md @@ -11,7 +11,7 @@ * Gate inbound messages: sender checks to prevent prompt injection * Relay permission prompts: forward tool approval prompts to remote channels -To use an existing channel instead of building one, see [Channels](</docs/en/channels>). Telegram, Discord, and fakechat are included in the research preview. +To use an existing channel instead of building one, see [Channels](</docs/en/channels>). Telegram, Discord, iMessage, and fakechat are included in the research preview. ## @@ -497,7 +497,7 @@ } await mcp.notification({ ... }) -Gate on the sender’s identity, not the chat or room identity: `message.from.id` in the example, not `message.chat.id`. In group chats, these differ, and gating on the room would let anyone in an allowlisted group inject messages into the session. The [Telegram](<https://github.com/anthropics/claude-plugins-official/tree/main/external_plugins/telegram>) and [Discord](<https://github.com/anthropics/claude-plugins-official/tree/main/external_plugins/discord>) channels gate on a sender allowlist the same way. They bootstrap the list by pairing: the user DMs the bot, the bot replies with a pairing code, the user approves it in their Claude Code session, and their platform ID is added. See either implementation for the full pairing flow. +Gate on the sender’s identity, not the chat or room identity: `message.from.id` in the example, not `message.chat.id`. In group chats, these differ, and gating on the room would let anyone in an allowlisted group inject messages into the session. The [Telegram](<https://github.com/anthropics/claude-plugins-official/tree/main/external_plugins/telegram>) and [Discord](<https://github.com/anthropics/claude-plugins-official/tree/main/external_plugins/discord>) channels gate on a sender allowlist the same way. They bootstrap the list by pairing: the user DMs the bot, the bot replies with a pairing code, the user approves it in their Claude Code session, and their platform ID is added. See either implementation for the full pairing flow. The [iMessage](<https://github.com/anthropics/claude-plugins-official/tree/main/external_plugins/imessage>) channel takes a different approach: it detects the user’s own addresses from the Messages database at startup and lets them through automatically, with other senders added by handle. ## @@ -871,7 +871,7 @@ See also - * [Channels](</docs/en/channels>) to install and use Telegram, Discord, or the fakechat demo, and to enable channels for a Team or Enterprise org + * [Channels](</docs/en/channels>) to install and use Telegram, Discord, iMessage, or the fakechat demo, and to enable channels for a Team or Enterprise org * [Working channel implementations](<https://github.com/anthropics/claude-plugins-official/tree/main/external_plugins>) for complete server code with pairing flows, reply tools, and file attachments * [MCP](</docs/en/mcp>) for the underlying protocol that channel servers implement * [Plugins](</docs/en/plugins>) to package your channel so users can install it with `/plugin install`
modified CLI reference View current →
--- a/cli-reference.md +++ b/cli-reference.md @@ -20,6 +20,7 @@ `claude auth logout`| Log out from your Anthropic account| `claude auth logout` `claude auth status`| Show authentication status as JSON. Use `--text` for human-readable output. Exits with code 0 if logged in, 1 if not| `claude auth status` `claude agents`| List all configured [subagents](</docs/en/sub-agents>), grouped by source| `claude agents` +`claude auto-mode defaults`| Print the built-in [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) classifier rules as JSON. Use `claude auto-mode config` to see your effective config with settings applied| `claude auto-mode defaults > rules.json` `claude mcp`| Configure Model Context Protocol (MCP) servers| See the [Claude Code MCP documentation](</docs/en/mcp>). `claude remote-control`| Start a [Remote Control](</docs/en/remote-control>) server to control Claude Code from Claude.ai or the Claude app. Runs in server mode (no local interactive session). See [Server mode flags](</docs/en/remote-control#server-mode>)| `claude remote-control --name "My Project"` @@ -46,7 +47,7 @@ `--chrome`| Enable [Chrome browser integration](</docs/en/chrome>) for web automation and testing| `claude --chrome` `--continue`, `-c`| Load the most recent conversation in the current directory| `claude --continue` `--dangerously-load-development-channels`| Enable [channels](</docs/en/channels-reference#test-during-the-research-preview>) that are not on the approved allowlist, for local development. Accepts `plugin:<name>@<marketplace>` and `server:<name>` entries. Prompts for confirmation| `claude --dangerously-load-development-channels server:webhook` -`--dangerously-skip-permissions`| Skip permission prompts (use with caution). See [permission modes](</docs/en/permissions#permission-modes>) for what this does and does not skip| `claude --dangerously-skip-permissions` +`--dangerously-skip-permissions`| Skip permission prompts (use with caution). See [permission modes](</docs/en/permission-modes#skip-all-checks-with-bypasspermissions-mode>) for what this does and does not skip| `claude --dangerously-skip-permissions` `--debug`| Enable debug mode with optional category filtering (for example, `"api,hooks"` or `"!statsig,!file"`)| `claude --debug "api,mcp"` `--disable-slash-commands`| Disable all skills and commands for this session| `claude --disable-slash-commands` `--disallowedTools`| Tools that are removed from the model’s context and cannot be used| `"Bash(git log *)" "Bash(git diff *)" "Edit"` @@ -71,7 +72,8 @@ `--no-chrome`| Disable [Chrome browser integration](</docs/en/chrome>) for this session| `claude --no-chrome` `--no-session-persistence`| Disable session persistence so sessions are not saved to disk and cannot be resumed (print mode only)| `claude -p --no-session-persistence "query"` `--output-format`| Specify output format for print mode (options: `text`, `json`, `stream-json`)| `claude -p "query" --output-format json` -`--permission-mode`| Begin in a specified [permission mode](</docs/en/permissions#permission-modes>)| `claude --permission-mode plan` +`--enable-auto-mode`| Unlock [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) in the `Shift+Tab` cycle. Requires a Team plan (Enterprise and API support rolling out shortly) and Claude Sonnet 4.6 or Opus 4.6| `claude --enable-auto-mode` +`--permission-mode`| Begin in a specified [permission mode](</docs/en/permission-modes>)| `claude --permission-mode plan` `--permission-prompt-tool`| Specify an MCP tool to handle permission prompts in non-interactive mode| `claude -p --permission-prompt-tool mcp_auth_tool "query"` `--plugin-dir`| Load plugins from a directory for this session only. Each flag takes one path. Repeat the flag for multiple directories: `--plugin-dir A --plugin-dir B`| `claude --plugin-dir ./my-plugins` `--print`, `-p`| Print response without interactive mode (see [Agent SDK documentation](<https://platform.claude.com/docs/en/agent-sdk/overview>) for programmatic usage details)| `claude -p "query"`
modified Use Claude Code Desktop View current →
--- a/desktop.md +++ b/desktop.md @@ -53,7 +53,7 @@ The prompt box supports two ways to bring in external context: - * **@mention files** : type `@` followed by a filename to add a file to the conversation context. Claude can then read and reference that file. + * **@mention files** : type `@` followed by a filename to add a file to the conversation context. Claude can then read and reference that file. @mention is not available in remote sessions. * **Attach files** : attach images, PDFs, and other files to your prompt using the attachment button, or drag and drop files directly into the prompt. This is useful for sharing screenshots of bugs, design mockups, or reference documents. ### @@ -69,9 +69,10 @@ **Ask permissions**| `default`| Claude asks before editing files or running commands. You see a diff and can accept or reject each change. Recommended for new users. **Auto accept edits**| `acceptEdits`| Claude auto-accepts file edits but still asks before running terminal commands. Use this when you trust file changes and want faster iteration. **Plan mode**| `plan`| Claude analyzes your code and creates a plan without modifying files or running commands. Good for complex tasks where you want to review the approach first. -**Bypass permissions**| `bypassPermissions`| Claude runs without permission prompts, equivalent to `--dangerously-skip-permissions` in the CLI. Enable in your Settings → Claude Code under “Allow bypass permissions mode”. Only use this in sandboxed containers or VMs. See [permission modes](</docs/en/permissions#permission-modes>) for what is and isn’t skipped. Enterprise admins can disable this option. - -The `dontAsk` permission mode is available only in the [CLI](</docs/en/permissions#permission-modes>). +**Auto**| `auto`| Claude executes all actions with background safety checks that verify alignment with your request. Reduces permission prompts while maintaining oversight. Currently a research preview. Available on Team plans (Enterprise rolling out shortly). Requires Claude Sonnet 4.6 or Opus 4.6. Enable in your Settings → Claude Code. +**Bypass permissions**| `bypassPermissions`| Claude runs without any permission prompts, equivalent to `--dangerously-skip-permissions` in the CLI. Enable in your Settings → Claude Code under “Allow bypass permissions mode”. Only use this in sandboxed containers or VMs. Enterprise admins can disable this option. + +The `dontAsk` permission mode is available only in the [CLI](</docs/en/permission-modes#allow-only-pre-approved-tools-with-dontask-mode>). Start complex tasks in Plan mode so Claude maps out an approach before making changes. Once you approve the plan, switch to Auto accept edits or Ask permissions to execute it. See [explore first, then plan, then code](</docs/en/best-practices#explore-first-then-plan-then-code>) for more on this workflow. @@ -621,9 +622,11 @@ Key| Description ---|--- -`disableBypassPermissionsMode`| set to `"disable"` to prevent users from enabling Bypass permissions mode. See [managed settings](</docs/en/permissions#managed-only-settings>). - -For the complete list of managed-only settings including `allowManagedPermissionRulesOnly` and `allowManagedHooksOnly`, see [managed-only settings](</docs/en/permissions#managed-only-settings>). Remote managed settings uploaded through the admin console currently apply to CLI and IDE sessions only. For Desktop-specific restrictions, use the admin console controls above. +`permissions.disableBypassPermissionsMode`| set to `"disable"` to prevent users from enabling Bypass permissions mode. +`disableAutoMode`| set to `"disable"` to prevent users from enabling [Auto](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) mode. Removes Auto from the mode selector. Also accepted under `permissions`. +`autoMode`| customize what the auto mode classifier trusts and blocks across your organization. See [Configure the auto mode classifier](</docs/en/permissions#configure-the-auto-mode-classifier>). + +`permissions.disableBypassPermissionsMode` and `disableAutoMode` also work in user and project settings, but placing them in managed settings prevents users from overriding them. `autoMode` is read from user settings, `.claude/settings.local.json`, and managed settings, but not from the checked-in `.claude/settings.json`: a cloned repo cannot inject its own classifier rules. For the complete list of managed-only settings including `allowManagedPermissionRulesOnly` and `allowManagedHooksOnly`, see [managed-only settings](</docs/en/permissions#managed-only-settings>). Remote managed settings uploaded through the admin console currently apply to CLI and IDE sessions only. For Desktop-specific restrictions, use the admin console controls above. ### @@ -722,12 +725,12 @@ Feature| CLI| Desktop ---|---|--- -Permission modes| All modes including `dontAsk`| Ask permissions, Auto accept edits, Plan mode, and Bypass permissions via Settings +Permission modes| All modes including `dontAsk`| Ask permissions, Auto accept edits, Plan mode, Auto, and Bypass permissions via Settings `--dangerously-skip-permissions`| CLI flag| Bypass permissions mode. Enable in Settings → Claude Code → “Allow bypass permissions mode” [Third-party providers](</docs/en/third-party-integrations>)| Bedrock, Vertex, Foundry| Not available. Desktop connects to Anthropic’s API directly. [MCP servers](</docs/en/mcp>)| Configure in settings files| Connectors UI for local and SSH sessions, or settings files [Plugins](</docs/en/plugins>)| `/plugin` command| Plugin manager UI -@mention files| Text-based| With autocomplete +@mention files| Text-based| With autocomplete; local and SSH sessions only File attachments| Not available| Images, PDFs Session isolation| [`--worktree`](</docs/en/cli-reference>) flag| Automatic worktrees Multiple sessions| Separate terminals| Sidebar tabs
modified Hooks reference View current →
--- a/hooks.md +++ b/hooks.md @@ -518,7 +518,7 @@ `session_id`| Current session identifier `transcript_path`| Path to conversation JSON `cwd`| Current working directory when the hook is invoked -`permission_mode`| Current [permission mode](</docs/en/permissions#permission-modes>): `"default"`, `"plan"`, `"acceptEdits"`, `"dontAsk"`, or `"bypassPermissions"`. Not all events receive this field: see each event’s JSON example below to check +`permission_mode`| Current [permission mode](</docs/en/permissions#permission-modes>): `"default"`, `"plan"`, `"acceptEdits"`, `"auto"`, `"dontAsk"`, or `"bypassPermissions"`. Not all events receive this field: see each event’s JSON example below to check `hook_event_name`| Name of the event that fired When running with `--agent` or inside a subagent, two additional fields are included:
modified How Claude Code works View current →
--- a/how-claude-code-works.md +++ b/how-claude-code-works.md @@ -175,6 +175,7 @@ * **Default** : Claude asks before file edits and shell commands * **Auto-accept edits** : Claude edits files without asking, still asks for commands * **Plan mode** : Claude uses read-only tools only, creating a plan you can approve before execution + * **Auto mode** : Claude evaluates all actions with background safety checks. Currently a research preview You can also allow specific commands in `.claude/settings.json` so Claude doesn’t ask each time. This is useful for trusted commands like `npm test` or `git status`. Settings can be scoped from organization-wide policies down to personal preferences. See [Permissions](</docs/en/permissions>) for details.
modified Interactive mode View current →
--- a/interactive-mode.md +++ b/interactive-mode.md @@ -33,7 +33,7 @@ `Left/Right arrows`| Cycle through dialog tabs| Navigate between tabs in permission dialogs and menus `Up/Down arrows`| Navigate command history| Recall previous inputs `Esc` \+ `Esc`| Rewind or summarize| Restore code and/or conversation to a previous point, or summarize from a selected message -`Shift+Tab` or `Alt+M` (some configurations)| Toggle permission modes| Switch between Auto-Accept Mode, Plan Mode, and normal mode. +`Shift+Tab` or `Alt+M` (some configurations)| Cycle permission modes| Cycle through `default`, `acceptEdits`, `plan`, and any modes you have enabled, such as `auto` or `bypassPermissions`. See [permission modes](</docs/en/permission-modes>). `Option+P` (macOS) or `Alt+P` (Windows/Linux)| Switch model| Switch models without clearing your prompt `Option+T` (macOS) or `Alt+T` (Windows/Linux)| Toggle extended thinking| Enable or disable extended thinking mode. Run `/terminal-setup` first to enable this shortcut
modified Customize keyboard shortcuts View current →
--- a/keybindings.md +++ b/keybindings.md @@ -487,6 +487,7 @@ ---|--- Ctrl+C| Hardcoded interrupt/cancel Ctrl+D| Hardcoded exit +Ctrl+M| Identical to Enter in terminals (both send CR) ##
modified LLM gateway configuration View current →
--- a/llm-gateway.md +++ b/llm-gateway.md @@ -45,6 +45,12 @@ LiteLLM configuration +LiteLLM PyPI versions 1.82.7 and 1.82.8 were compromised with credential-stealing malware. Do not install these versions. If you have already installed them: + + * Remove the package + * Rotate all credentials on affected systems + * Follow the remediation steps in [BerriAI/litellm#24518](<https://github.com/BerriAI/litellm/issues/24518>) + LiteLLM is a third-party proxy service. Anthropic doesn’t endorse, maintain, or audit LiteLLM’s security or functionality. This guide is provided for informational purposes and may become outdated. Use at your own discretion. ###
modified Connect Claude Code to tools via MCP View current →
--- a/mcp.md +++ b/mcp.md @@ -199,11 +199,13 @@ Ask AI { - "database-tools": { - "command": "${CLAUDE_PLUGIN_ROOT}/servers/db-server", - "args": ["--config", "${CLAUDE_PLUGIN_ROOT}/config.json"], - "env": { - "DB_URL": "${DB_URL}" + "mcpServers": { + "database-tools": { + "command": "${CLAUDE_PLUGIN_ROOT}/servers/db-server", + "args": ["--config", "${CLAUDE_PLUGIN_ROOT}/config.json"], + "env": { + "DB_URL": "${DB_URL}" + } } } } @@ -731,6 +733,58 @@ } The URL must use `https://`. This option requires Claude Code v2.1.64 or later. + +### + +​ + +Use dynamic headers for custom authentication + +If your MCP server uses an authentication scheme other than OAuth (such as Kerberos, short-lived tokens, or an internal SSO), use `headersHelper` to generate request headers at connection time. Claude Code runs the command and merges its output into the connection headers. + +Report incorrect code + +Copy + +Ask AI + + { + "mcpServers": { + "internal-api": { + "type": "http", + "url": "https://mcp.internal.example.com", + "headersHelper": "/opt/bin/get-mcp-auth-headers.sh" + } + } + } + +The command can also be inline: + +Report incorrect code + +Copy + +Ask AI + + { + "mcpServers": { + "internal-api": { + "type": "http", + "url": "https://mcp.internal.example.com", + "headersHelper": "echo '{\"Authorization\": \"Bearer '\"$(get-token)\"'\"}'" + } + } + } + +**Requirements:** + + * The command must write a JSON object of string key-value pairs to stdout + * The command runs in a shell with a 10-second timeout + * Dynamic headers override any static `headers` with the same name + +The helper runs fresh on each connection (at session start and on reconnect). There is no caching, so your script is responsible for any token reuse. + +`headersHelper` executes arbitrary shell commands. When defined at project or local scope, it only runs after you accept the workspace trust dialog. ##
modified Claude Code overview View current →
--- a/overview.md +++ b/overview.md @@ -214,7 +214,7 @@ I want to…| Best option ---|--- Continue a local session from my phone or another device| [Remote Control](</docs/en/remote-control>) -Push events from Telegram, Discord, or my own webhooks into a session| [Channels](</docs/en/channels>) +Push events from Telegram, Discord, iMessage, or my own webhooks into a session| [Channels](</docs/en/channels>) Start a task locally, continue on mobile| [Web](</docs/en/claude-code-on-the-web>) or [Claude iOS app](<https://apps.apple.com/app/claude-by-anthropic/id6473753684>) Run Claude on a recurring schedule| [Cloud scheduled tasks](</docs/en/web-scheduled-tasks>) or [Desktop scheduled tasks](</docs/en/desktop#schedule-recurring-tasks>) Automate PR reviews and issue triage| [GitHub Actions](</docs/en/github-actions>) or [GitLab CI/CD](</docs/en/gitlab-ci-cd>)
added Choose a permission mode View current →
Show diff (341 lines)
--- a/permission-modes.md +++ b/permission-modes.md @@ -0,0 +1,338 @@ +Permission modes control whether Claude asks before acting. Different tasks call for different levels of autonomy: you might want full oversight for sensitive work, minimal interruptions for a long refactor, or read-only access while exploring a codebase. This page covers how to: + + * Switch modes during a session, at startup, or as a default + * Choose a mode based on what Claude should be able to do without asking + * Run auto mode with background safety checks, and see what it blocks by default + * Plan changes read-only before approving edits + * Restrict Claude to pre-approved tools for locked-down environments + * Skip checks entirely in isolated environments + +## + +​ + +Switch permission modes + +You can switch modes at any time during a session, at startup, or as a persistent default. The mechanism depends on where you’re running Claude Code. + + * CLI + + * JetBrains + + * VS Code + + * Desktop + + * Web and mobile + +**During a session** : press `Shift+Tab` to cycle through `default` → `acceptEdits` → `plan` → `auto`. The current mode appears in the status bar. `auto` does not appear in the cycle until you pass `--enable-auto-mode` at startup. Auto also requires a Team (or Enterprise/API once available) plan and Claude Sonnet 4.6 or Opus 4.6, so the option may remain unavailable even with the flag. If `bypassPermissions` is also enabled, it appears in the cycle between `plan` and `auto`.**At startup** : pass the mode as a CLI flag: + +Report incorrect code + +Copy + +Ask AI + + claude --permission-mode plan + +**As a default** : set `defaultMode` in your [settings file](</docs/en/settings#settings-files>): + +Report incorrect code + +Copy + +Ask AI + + { + "permissions": { + "defaultMode": "acceptEdits" + } + } + +**Non-interactively** : the same flag works with `-p` for scripted runs: + +Report incorrect code + +Copy + +Ask AI + + claude -p "refactor auth" --permission-mode acceptEdits + +`dontAsk` is never in the `Shift+Tab` cycle. `bypassPermissions` appears in the cycle only if you started the session with `--permission-mode bypassPermissions`, `--dangerously-skip-permissions`, or `--allow-dangerously-skip-permissions`. The third flag adds the mode to the cycle without activating it, so you can compose it with a different starting mode like `--permission-mode plan`. Set any of these at startup or in your settings file. + +The JetBrains plugin launches Claude Code in the IDE terminal, so switching modes works the same as in the CLI: press `Shift+Tab` to cycle, or pass `--permission-mode` when launching. + +**During a session** : click the mode indicator at the bottom of the prompt box to switch modes.**As a default** : set `claudeCode.initialPermissionMode` in VS Code settings, or use the Claude Code extension settings panel.The VS Code UI uses friendly labels that map to the settings keys below: + +UI label| Settings key +---|--- +Ask permissions| `default` +Auto accept edits| `acceptEdits` +Plan mode| `plan` +Auto| `auto` +Bypass permissions| `bypassPermissions` + +Auto and Bypass permissions appear only after you enable **Allow dangerously skip permissions** in the extension settings. Auto also requires a Team plan and Claude Sonnet 4.6 or Opus 4.6, so the option may remain unavailable even with the toggle on.See the [VS Code guide](</docs/en/vs-code>) for extension-specific details. + +**During a session** : use the mode selector next to the send button. You can change it before or during a session.The Desktop UI uses friendly labels that map to the settings keys below: + +UI label| Settings key +---|--- +Ask permissions| `default` +Auto accept edits| `acceptEdits` +Plan mode| `plan` +Auto| `auto` +Bypass permissions| `bypassPermissions` + +Auto and Bypass permissions appear in the selector only after you enable them in Desktop settings. See the [Desktop guide](</docs/en/desktop#choose-a-permission-mode>) for details. + +**During a session** : use the mode dropdown next to the prompt box on [claude.ai/code](<https://claude.ai/code>) or in the Claude mobile app.For [Claude Code on the web](</docs/en/claude-code-on-the-web>) sessions running on Anthropic’s cloud VMs, the dropdown offers Auto accept edits and Plan mode. Ask permissions and Auto are not available for cloud sessions.For [Remote Control](</docs/en/remote-control>) sessions running on your local machine, the dropdown offers Ask permissions, Auto accept edits, and Plan mode. You can also set the starting mode when you launch the local host: + +Report incorrect code + +Copy + +Ask AI + + claude remote-control --permission-mode acceptEdits + +Permission prompts appear in claude.ai for approval. + +Permission modes are set through the UI, CLI flags, or settings files. Telling Claude “stop asking for permission” in the chat does not change the mode. See [Permissions](</docs/en/permissions>) for how modes interact with allow, ask, and deny rules. + +## + +​ + +Available modes + +Each mode makes a different tradeoff between convenience and oversight. Pick the one that matches your task. + +Mode| What Claude can do without asking| Best for +---|---|--- +`default`| Read files| Getting started, sensitive work +`acceptEdits`| Read and edit files| Iterating on code you’re reviewing +`plan`| Read files| Exploring a codebase, planning a refactor +`auto`| All actions, with background safety checks| Long-running tasks, reducing prompt fatigue +`bypassPermissions`| All actions, no checks| Isolated containers and VMs only +`dontAsk`| Only pre-approved tools| Locked-down environments + +## + +​ + +Analyze before you edit with plan mode + +Plan mode tells Claude to research and propose changes without making them. Claude reads files, runs shell commands to explore, asks clarifying questions, and writes a plan file, but does not edit your source code. Permission prompts work the same as default mode: you still approve Bash commands, network requests, and other actions that would normally prompt. + +### + +​ + +When to use plan mode + +Plan mode is useful when you want Claude to research and propose an approach before making changes: + + * **Multi-step implementation** : when a feature requires edits across many files + * **Code exploration** : when you want to research the codebase before changing anything + * **Interactive development** : when you want to iterate on the direction with Claude + +### + +​ + +Start and use plan mode + +Enter plan mode for a single request by prefixing your prompt with `/plan`, or switch the whole session into plan mode by pressing `Shift+Tab` to cycle through permission modes. You can also start in plan mode from the CLI: + +Report incorrect code + +Copy + +Ask AI + + claude --permission-mode plan + +This example starts a planning session for a complex refactor: + +Report incorrect code + +Copy + +Ask AI + + I need to refactor our authentication system to use OAuth2. Create a detailed migration plan. + +Claude analyzes the current implementation and creates a plan. Refine with follow-ups: + +Report incorrect code + +Copy + +Ask AI + + What about backward compatibility? + How should we handle database migration? + +When the plan is ready, Claude presents it and asks how to proceed. From that prompt you can: + + * Approve and start in auto mode + * Approve and accept edits + * Approve and manually review each edit + * Keep planning, which sends your feedback back to Claude for another round + +Each approve option also offers to clear the planning context first. + +## + +​ + +Eliminate prompts with auto mode + +Auto mode is available on Team plans, with Enterprise and API support rolling out shortly. On Team and Enterprise, an admin must enable it in [Claude Code admin settings](<https://claude.ai/admin-settings/claude-code>) before users can turn it on. It requires Claude Sonnet 4.6 or Claude Opus 4.6, and is not available on Haiku, claude-3 models, or third-party providers (Bedrock, Vertex, Foundry). Auto mode lets Claude execute actions without showing permission prompts. Before each action runs, a separate classifier model reviews the conversation and decides whether the action matches what you asked for: it blocks actions that escalate beyond the task scope, target infrastructure the classifier doesn’t recognize as trusted, or appear to be driven by hostile content encountered in a file or web page. For a deeper look at how the classifier is designed, see the [auto mode announcement](<https://claude.com/blog/auto-mode>). + +Auto mode is a research preview. It reduces prompts but does not guarantee safety. It provides more protection than `bypassPermissions` but is not as thorough as manually reviewing each action. Use it for tasks where you trust the general direction, not as a replacement for review on sensitive operations. + +**Model** : the classifier runs on Claude Sonnet 4.6, even if your main session uses a different model. **Cost** : classifier calls count toward your token usage the same as main-session calls. Each checked action sends a portion of the conversation transcript plus the pending action to the classifier. The extra cost comes mainly from shell commands and network operations, since read-only actions and file edits in your working directory don’t trigger a classifier call. **Latency** : each classifier check adds a round-trip before the action executes. + +### + +​ + +How actions are evaluated + +Each action goes through a fixed decision order. The first matching step wins: + + 1. Actions matching your [allow or deny rules](</docs/en/permissions#manage-permissions>) resolve immediately + 2. Read-only actions and file edits in your working directory are auto-approved + 3. Everything else goes to the classifier + 4. If the classifier blocks, Claude receives the reason and attempts an alternative approach + +On entering auto mode, Claude Code drops any allow rule that is known to grant arbitrary code execution: blanket shell access like `Bash(*)`, wildcarded script interpreters like `Bash(python*)` or `Bash(node*)`, package-manager run commands, and any `Agent` allow rule. These rules would auto-approve the commands and subagent delegations most capable of causing damage before the classifier ever sees them. Narrow rules like `Bash(npm test)` carry over. The dropped rules are restored when you leave auto mode. The classifier receives user messages and tool calls as input, with Claude’s own text and tool results stripped out. It also receives your CLAUDE.md content, so actions described in your project instructions are factored into allow and block decisions. Because tool results never reach the classifier, hostile content in a file or web page cannot manipulate it directly. The classifier evaluates the pending action against a customizable set of block and allow rules, checking whether the action is an overeager escalation beyond what you asked for, a mistake about what’s safe to touch, or a sudden departure from your stated intent that suggests Claude may have been steered by something it read. Unlike your permission rules, which match tool names and argument patterns, the classifier reads prose descriptions of what to block and allow: it reasons about the action in context rather than matching syntax. + +### + +​ + +How auto mode handles subagents + +When Claude spawns a [subagent](</docs/en/sub-agents>), the classifier evaluates the delegated task before the subagent starts. A task description that looks dangerous on its own, like “delete all remote branches matching this pattern”, is blocked at spawn time. Inside the subagent, auto mode runs with the same block and allow rules as the parent session. Any `permissionMode` the subagent defines in its own frontmatter is ignored. The subagent’s own tool calls go through the classifier independently. When the subagent finishes, the classifier reviews its full action history. A subagent that was benign at spawn could have been compromised mid-run by content it read. If the return check flags a concern, a security warning is prepended to the subagent’s results so the main agent can decide how to proceed. + +### + +​ + +What the classifier blocks by default + +Out of the box, the classifier trusts your working directory and, if you’re in a git repo, that repo’s configured remotes. Everything else is treated as external: your company’s source control orgs, cloud buckets, and internal services are unknown until you tell the classifier about them. **Blocked by default** : + + * Downloading and executing code, like `curl | bash` or scripts from cloned repos + * Sending sensitive data to external endpoints + * Production deploys and migrations + * Mass deletion on cloud storage + * Granting IAM or repo permissions + * Modifying shared infrastructure + * Irreversibly destroying files that existed before the session started + * Destructive source control operations like force push or pushing directly to `main` + +**Allowed by default** : + + * Local file operations in your working directory + * Installing dependencies already declared in your lock files or manifests + * Reading `.env` and sending credentials to their matching API + * Read-only HTTP requests + * Pushing to the branch you started on or one Claude created + +To see the full default rule lists as the classifier receives them, run `claude auto-mode defaults`. If auto mode blocks something routine for your team, like pushing to your own org’s repo or writing to a company bucket, it’s because the classifier doesn’t know those are trusted. Administrators can add trusted repos, buckets, and internal services via the `autoMode.environment` setting: see [Configure the auto mode classifier](</docs/en/permissions#configure-the-auto-mode-classifier>) for the full configuration guide. + +### + +​ + +When auto mode falls back + +The fallback design keeps false positives from derailing a session: a mistaken block costs Claude a retry, not your progress. If the classifier blocks an action 3 times in a row or 20 times total in one session, auto mode pauses and Claude Code resumes prompting for each action. These thresholds are not configurable. + + * **CLI** : you see a notification in the status area. Approving the prompted action resets the denial counters, so you can continue in auto mode + * **Non-interactive mode** with the `-p` flag: aborts the session, since there is no user to prompt + +Repeated blocks usually mean one of two things: the task genuinely requires actions the classifier is built to stop, or the classifier is missing context about your trusted infrastructure and treating safe actions as risky. If the blocks look like false positives, or if the classifier misses something it should have caught, use `/feedback` to report it. If blocks are happening because the classifier doesn’t recognize your repos or services as trusted, have an administrator [configure trusted infrastructure](</docs/en/permissions#configure-the-auto-mode-classifier>) in managed settings. + +## + +​ + +Allow only pre-approved tools with dontAsk mode + +`dontAsk` mode auto-denies every tool that is not explicitly allowed. Only actions matching your `/permissions` allow rules or `permissions.allow` settings can execute. If a tool has an explicit `ask` rule, the action is also denied rather than prompting. This makes the mode fully non-interactive, suitable for CI pipelines or restricted environments where you pre-define exactly what Claude is permitted to do. + +Report incorrect code + +Copy + +Ask AI + + claude --permission-mode dontAsk + +## + +​ + +Skip all checks with bypassPermissions mode + +`bypassPermissions` mode disables all permission prompts and safety checks. Every tool call executes immediately without any verification. Only use this in isolated environments like containers, VMs, or devcontainers without internet access, where Claude Code cannot cause damage to your host system. + +Report incorrect code + +Copy + +Ask AI + + claude --permission-mode bypassPermissions + +The `--dangerously-skip-permissions` flag is equivalent to `--permission-mode bypassPermissions`: + +Report incorrect code + +Copy + +Ask AI + + claude -p "refactor the auth module" --dangerously-skip-permissions + +`bypassPermissions` mode offers no protection against prompt injection or unintended actions. For a safer alternative that still maintains background safety checks, use auto mode. Administrators can block this mode by setting `permissions.disableBypassPermissionsMode` to `"disable"` in [managed settings](</docs/en/permissions#managed-settings>). + +## + +​ + +Compare permission approaches + +The table below summarizes the key differences in how each mode handles approvals. `plan` is omitted since it restricts what Claude can do rather than how approvals work. + +| `default`| `acceptEdits`| `auto`| `dontAsk`| `bypassPermissions` +---|---|---|---|---|--- +Permission prompts| File edits and commands| Commands only| None unless fallback triggers| None, blocked unless pre-allowed| None +Safety checks| You review each action| You review commands| Classifier reviews commands| Your pre-approved rules only| None +Token usage| Standard| Standard| Higher, from classifier calls| Standard| Standard + +## + +​ + +Customize permissions further + +Permission modes set the baseline approval behavior. For control over individual tools or commands, layer additional configuration on top of the active mode. **Permission rules** are the first stop. Add `allow`, `ask`, or `deny` entries to your settings file to pre-approve safe commands, force a prompt for risky ones, or block specific tools entirely. Rules apply in every mode except `bypassPermissions`, which skips the permission layer entirely, and are matched by tool name and argument pattern. See [Manage permissions](</docs/en/permissions#manage-permissions>) for syntax and examples. **Hooks** cover logic that pattern-matching rules can’t express. A [`PreToolUse` hook](</docs/en/hooks#pretooluse-decision-control>) runs before every tool call and can allow, deny, or escalate based on command content, file paths, time of day, or a response from an external policy service. A [`PermissionRequest` hook](</docs/en/hooks#permissionrequest>) intercepts the permission dialog itself and answers on your behalf. See [Hooks](</docs/en/hooks>) for configuration. + +## + +​ + +See also + + * [Permissions](</docs/en/permissions>): permission rules, syntax, managed policies + * [Hooks](</docs/en/hooks>): custom permission logic, lifecycle scripting + * [Security](</docs/en/security>): security safeguards and best practices + * [Sandboxing](</docs/en/sandboxing>): filesystem and network isolation for Bash commands + * [Non-interactive mode](</docs/en/headless>): run Claude Code programmatically with the `-p` flag
modified Configure permissions View current →
Show diff (168 lines)
--- a/permissions.md +++ b/permissions.md @@ -34,17 +34,20 @@ Permission modes -Claude Code supports several permission modes that control how tools are approved. Set the `defaultMode` in your [settings files](</docs/en/settings#settings-files>): +Claude Code supports several permission modes that control how tools are approved. See [Permission modes](</docs/en/permission-modes>) for when to use each one. Set the `defaultMode` in your [settings files](</docs/en/settings#settings-files>): Mode| Description ---|--- `default`| Standard behavior: prompts for permission on first use of each tool `acceptEdits`| Automatically accepts file edit permissions for the session `plan`| Plan Mode: Claude can analyze but not modify files or execute commands +`auto`| Auto-approves tool calls with background safety checks that verify actions align with your request. Currently a research preview `dontAsk`| Auto-denies tools unless pre-approved via `/permissions` or `permissions.allow` rules `bypassPermissions`| Skips permission prompts except for writes to protected directories (see warning below) `bypassPermissions` mode skips permission prompts. Writes to `.git`, `.claude`, `.vscode`, and `.idea` directories still prompt for confirmation to prevent accidental corruption of repository state and local configuration. Writes to `.claude/commands`, `.claude/agents`, and `.claude/skills` are exempt and do not prompt, because Claude routinely writes there when creating skills, subagents, and commands. Only use this mode in isolated environments like containers or VMs where Claude Code cannot cause damage. Administrators can prevent this mode by setting `disableBypassPermissionsMode` to `"disable"` in managed settings. + +To prevent `bypassPermissions` or `auto` mode from being used, set `permissions.disableBypassPermissionsMode` or `disableAutoMode` to `"disable"` in any [settings file](</docs/en/settings#settings-files>). These are most useful in managed settings where they cannot be overridden. ## @@ -289,7 +292,6 @@ Setting| Description ---|--- -`disableBypassPermissionsMode`| Set to `"disable"` to prevent `bypassPermissions` mode and the `--dangerously-skip-permissions` flag `allowManagedPermissionRulesOnly`| When `true`, prevents user and project settings from defining `allow`, `ask`, or `deny` permission rules. Only rules in managed settings apply `allowManagedHooksOnly`| When `true`, prevents loading of user, project, and plugin hooks. Only managed hooks and SDK hooks are allowed `allowManagedMcpServersOnly`| When `true`, only `allowedMcpServers` from managed settings are respected. `deniedMcpServers` still merges from all sources. See [Managed MCP configuration](</docs/en/mcp#managed-mcp-configuration>) @@ -304,6 +306,135 @@ ​ +Configure the auto mode classifier + +[Auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) uses a classifier model to decide whether each action is safe to run without prompting. Out of the box it trusts only the working directory and, if present, the current repo’s remotes. Actions like pushing to your company’s source control org or writing to a team cloud bucket will be blocked as potential data exfiltration. The `autoMode` settings block lets you tell the classifier which infrastructure your organization trusts. The classifier reads `autoMode` from user settings, `.claude/settings.local.json`, and managed settings. It does not read from shared project settings in `.claude/settings.json`, because a checked-in repo could otherwise inject its own allow rules. + +Scope| File| Use for +---|---|--- +One developer| `~/.claude/settings.json`| Personal trusted infrastructure +One project, one developer| `.claude/settings.local.json`| Per-project trusted buckets or services, gitignored +Organization-wide| Managed settings| Trusted infrastructure enforced for all developers + +Entries from each scope are combined. A developer can extend `environment`, `allow`, and `soft_deny` with personal entries but cannot remove entries that managed settings provide. Because allow rules act as exceptions to block rules inside the classifier, a developer-added `allow` entry can override an organization `soft_deny` entry: the combination is additive, not a hard policy boundary. If you need a rule that developers cannot work around, use `permissions.deny` in managed settings instead, which blocks actions before the classifier is consulted. + +### + +​ + +Define trusted infrastructure + +For most organizations, `autoMode.environment` is the only field you need to set. It tells the classifier which repos, buckets, and domains are trusted, without touching the built-in block and allow rules. The classifier uses `environment` to decide what “external” means: any destination not listed is a potential exfiltration target. + +Report incorrect code + +Copy + +Ask AI + + { + "autoMode": { + "environment": [ + "Source control: github.example.com/acme-corp and all repos under it", + "Trusted cloud buckets: s3://acme-build-artifacts, gs://acme-ml-datasets", + "Trusted internal domains: *.corp.example.com, api.internal.example.com", + "Key internal services: Jenkins at ci.example.com, Artifactory at artifacts.example.com" + ] + } + } + +Entries are prose, not regex or tool patterns. The classifier reads them as natural-language rules. Write them the way you would describe your infrastructure to a new engineer. A thorough environment section covers: + + * **Organization** : your company name and what Claude Code is primarily used for, like software development, infrastructure automation, or data engineering + * **Source control** : every GitHub, GitLab, or Bitbucket org your developers push to + * **Cloud providers and trusted buckets** : bucket names or prefixes that Claude should be able to read from and write to + * **Trusted internal domains** : hostnames for APIs, dashboards, and services inside your network, like `*.internal.example.com` + * **Key internal services** : CI, artifact registries, internal package indexes, incident tooling + * **Additional context** : regulated-industry constraints, multi-tenant infrastructure, or compliance requirements that affect what the classifier should treat as risky + +A useful starting template: fill in the bracketed fields and remove any lines that don’t apply: + +Report incorrect code + +Copy + +Ask AI + + { + "autoMode": { + "environment": [ + "Organization: {COMPANY_NAME}. Primary use: {PRIMARY_USE_CASE, e.g. software development, infrastructure automation}", + "Source control: {SOURCE_CONTROL, e.g. GitHub org github.example.com/acme-corp}", + "Cloud provider(s): {CLOUD_PROVIDERS, e.g. AWS, GCP, Azure}", + "Trusted cloud buckets: {TRUSTED_BUCKETS, e.g. s3://acme-builds, gs://acme-datasets}", + "Trusted internal domains: {TRUSTED_DOMAINS, e.g. *.internal.example.com, api.example.com}", + "Key internal services: {SERVICES, e.g. Jenkins at ci.example.com, Artifactory at artifacts.example.com}", + "Additional context: {EXTRA, e.g. regulated industry, multi-tenant infrastructure, compliance requirements}" + ] + } + } + +The more specific context you give, the better the classifier can distinguish routine internal operations from exfiltration attempts. You don’t need to fill everything in at once. A reasonable rollout: start with the defaults and add your source control org and key internal services, which resolves the most common false positives like pushing to your own repos. Add trusted domains and cloud buckets next. Fill the rest as blocks come up. + +### + +​ + +Override the block and allow rules + +Two additional fields let you replace the classifier’s built-in rule lists: `autoMode.soft_deny` controls what gets blocked, and `autoMode.allow` controls which exceptions apply. Each is an array of prose descriptions, read as natural-language rules. Inside the classifier, the precedence is: `soft_deny` rules block first, then `allow` rules override as exceptions, then explicit user intent overrides both. If the user’s message directly and specifically describes the exact action Claude is about to take, the classifier allows it even if a `soft_deny` rule matches. General requests don’t count: asking Claude to “clean up the repo” does not authorize force-pushing, but asking Claude to “force-push this branch” does. To loosen: remove rules from `soft_deny` when the defaults block something your pipeline already guards against with PR review, CI, or staging environments, or add to `allow` when the classifier repeatedly flags a routine pattern the default exceptions don’t cover. To tighten: add to `soft_deny` for risks specific to your environment that the defaults miss, or remove from `allow` to hold a default exception to the block rules. In all cases, run `claude auto-mode defaults` to get the full default lists, then copy and edit: never start from an empty list. + +Report incorrect code + +Copy + +Ask AI + + { + "autoMode": { + "environment": [ + "Source control: github.example.com/acme-corp and all repos under it" + ], + "allow": [ + "Deploying to the staging namespace is allowed: staging is isolated from production and resets nightly", + "Writing to s3://acme-scratch/ is allowed: ephemeral bucket with a 7-day lifecycle policy" + ], + "soft_deny": [ + "Never run database migrations outside the migrations CLI, even against dev databases", + "Never modify files under infra/terraform/prod/: production infrastructure changes go through the review workflow", + "...copy full default soft_deny list here first, then add your rules..." + ] + } + } + +Setting `allow` or `soft_deny` replaces the entire default list for that section. If you set `soft_deny` with a single entry, every built-in block rule is discarded: force push, data exfiltration, `curl | bash`, production deploys, and all other default block rules become allowed. To customize safely, run `claude auto-mode defaults` to print the built-in rules, copy them into your settings file, then review each rule against your own pipeline and risk tolerance. Only remove rules for risks your infrastructure already mitigates. + +The three sections are evaluated independently, so setting `environment` alone leaves the default `allow` and `soft_deny` lists intact. + +### + +​ + +Inspect the defaults and your effective config + +Because setting `allow` or `soft_deny` replaces the defaults, start any customization by copying the full default lists. Three CLI subcommands help you inspect and validate: + +Report incorrect code + +Copy + +Ask AI + + claude auto-mode defaults # the built-in environment, allow, and soft_deny rules + claude auto-mode config # what the classifier actually uses: your settings where set, defaults otherwise + claude auto-mode critique # get AI feedback on your custom allow and soft_deny rules + +Save the output of `claude auto-mode defaults` to a file, edit the lists to match your policy, and paste the result into your settings file. After saving, run `claude auto-mode config` to confirm the effective rules are what you expect. If you’ve written custom rules, `claude auto-mode critique` reviews them and flags entries that are ambiguous, redundant, or likely to cause false positives. + +## + +​ + Settings precedence Permission rules follow the same [settings precedence](</docs/en/settings#settings-precedence>) as all other Claude Code settings:
modified Continue local sessions from any device with Remote Control View current →
--- a/remote-control.md +++ b/remote-control.md @@ -235,7 +235,7 @@ Related resources * [Claude Code on the web](</docs/en/claude-code-on-the-web>): run sessions in Anthropic-managed cloud environments instead of on your machine - * [Channels](</docs/en/channels>): forward Telegram or Discord into a session so Claude reacts to messages while you’re away + * [Channels](</docs/en/channels>): forward Telegram, Discord, or iMessage into a session so Claude reacts to messages while you’re away * [Dispatch](</docs/en/desktop#sessions-from-dispatch>): message a task from your phone and it can spawn a Desktop session to handle it * [Authentication](</docs/en/authentication>): set up `/login` and manage credentials for claude.ai * [CLI reference](</docs/en/cli-reference>): full list of flags and commands including `claude remote-control`
modified Configure server-managed settings (public beta) View current →
--- a/server-managed-settings.md +++ b/server-managed-settings.md @@ -45,7 +45,7 @@ Define your settings -Add your configuration as JSON. All [settings available in `settings.json`](</docs/en/settings#available-settings>) are supported, including [hooks](</docs/en/hooks>), [environment variables](</docs/en/env-vars>), and [managed-only settings](</docs/en/permissions#managed-only-settings>) like `disableBypassPermissionsMode`.This example enforces a permission deny list and prevents users from bypassing permissions: +Add your configuration as JSON. All [settings available in `settings.json`](</docs/en/settings#available-settings>) are supported, including [hooks](</docs/en/hooks>), [environment variables](</docs/en/env-vars>), and [managed-only settings](</docs/en/permissions#managed-only-settings>) like `allowManagedPermissionRulesOnly`.This example enforces a permission deny list and prevents users from bypassing permissions: Report incorrect code @@ -86,7 +86,25 @@ } } -Because hooks execute shell commands, users see a security approval dialog before they’re applied. +To configure the [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) classifier so it knows which repos, buckets, and domains your organization trusts: + +Report incorrect code + +Copy + +Ask AI + + { + "autoMode": { + "environment": [ + "Source control: github.example.com/acme-corp and all repos under it", + "Trusted cloud buckets: s3://acme-build-artifacts, gs://acme-ml-datasets", + "Trusted internal domains: *.corp.example.com" + ] + } + } + +Because hooks execute shell commands, users see a security approval dialog before they’re applied. See [Configure the auto mode classifier](</docs/en/permissions#configure-the-auto-mode-classifier>) for how the `autoMode` entries affect what the classifier blocks and important warnings about the `allow` and `soft_deny` fields. 3
modified Claude Code settings View current →
--- a/settings.md +++ b/settings.md @@ -175,6 +175,8 @@ `includeCoAuthoredBy`| **Deprecated** : Use `attribution` instead. Whether to include the `co-authored-by Claude` byline in git commits and pull requests (default: `true`)| `false` `includeGitInstructions`| Include built-in commit and PR workflow instructions and the git status snapshot in Claude’s system prompt (default: `true`). Set to `false` to remove both, for example when using your own git workflow skills. The `CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS` environment variable takes precedence over this setting when set| `false` `permissions`| See table below for structure of permissions.| +`autoMode`| Customize what the [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) classifier blocks and allows. Contains `environment`, `allow`, and `soft_deny` arrays of prose rules. See [Configure the auto mode classifier](</docs/en/permissions#configure-the-auto-mode-classifier>). Not read from shared project settings| `{"environment": ["Trusted repo: github.example.com/acme"]}` +`disableAutoMode`| Set to `"disable"` to prevent [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) from being activated. Removes `auto` from the `Shift+Tab` cycle and rejects `--permission-mode auto` at startup. Most useful in [managed settings](</docs/en/permissions#managed-settings>) where users cannot override it| `"disable"` `hooks`| Configure custom commands to run at lifecycle events. See [hooks documentation](</docs/en/hooks>) for format| See [hooks](</docs/en/hooks>) `disableAllHooks`| Disable all [hooks](</docs/en/hooks>) and any custom [status line](</docs/en/statusline>)| `true` `allowManagedHooksOnly`| (Managed settings only) Prevent loading of user, project, and plugin hooks. Only allows managed hooks and SDK hooks. See Hook configuration| `true` @@ -260,8 +262,8 @@ `ask`| Array of permission rules to ask for confirmation upon tool use. See Permission rule syntax below| `[ "Bash(git push *)" ]` `deny`| Array of permission rules to deny tool use. Use this to exclude sensitive files from Claude Code access. See Permission rule syntax and [Bash permission limitations](</docs/en/permissions#tool-specific-permission-rules>)| `[ "WebFetch", "Bash(curl *)", "Read(./.env)", "Read(./secrets/**)" ]` `additionalDirectories`| Additional [working directories](</docs/en/permissions#working-directories>) that Claude has access to| `[ "../docs/" ]` -`defaultMode`| Default [permission mode](</docs/en/permissions#permission-modes>) when opening Claude Code| `"acceptEdits"` -`disableBypassPermissionsMode`| Set to `"disable"` to prevent `bypassPermissions` mode from being activated. This disables the `--dangerously-skip-permissions` command-line flag. See [managed settings](</docs/en/permissions#managed-only-settings>)| `"disable"` +`defaultMode`| Default [permission mode](</docs/en/permission-modes>) when opening Claude Code| `"acceptEdits"` +`disableBypassPermissionsMode`| Set to `"disable"` to prevent `bypassPermissions` mode from being activated. Disables the `--dangerously-skip-permissions` flag. Most useful in [managed settings](</docs/en/permissions#managed-settings>) where users cannot override it| `"disable"` ### @@ -521,7 +523,7 @@ 5. **User settings** (`~/.claude/settings.json`) * Personal global settings -This hierarchy ensures that organizational policies are always enforced while still allowing teams and individuals to customize their experience. For example, if your user settings allow `Bash(npm run *)` but a project’s shared settings deny it, the project setting takes precedence and the command is blocked. +This hierarchy ensures that organizational policies are always enforced while still allowing teams and individuals to customize their experience. The same precedence applies whether you run Claude Code from the CLI, the [VS Code extension](</docs/en/vs-code>), or a [JetBrains IDE](</docs/en/jetbrains>). For example, if your user settings allow `Bash(npm run *)` but a project’s shared settings deny it, the project setting takes precedence and the command is blocked. **Array settings merge across scopes.** When the same array-valued setting (such as `sandbox.filesystem.allowWrite` or `permissions.allow`) appears in multiple scopes, the arrays are **concatenated and deduplicated** , not replaced. This means lower-priority scopes can add entries without overriding those set by higher-priority scopes, and vice versa. For example, if managed settings set `allowWrite` to `["/opt/company-tools"]` and a user adds `["~/.kube"]`, both paths are included in the final configuration.
modified Create custom subagents View current →
--- a/sub-agents.md +++ b/sub-agents.md @@ -393,7 +393,7 @@ Permission modes -The `permissionMode` field controls how the subagent handles permission prompts. Subagents inherit the permission context from the main conversation but can override the mode. +The `permissionMode` field controls how the subagent handles permission prompts. Subagents inherit the permission context from the main conversation and can override the mode, except when the parent mode takes precedence as described below. Mode| Behavior ---|--- @@ -403,9 +403,9 @@ `bypassPermissions`| Skip permission prompts `plan`| Plan mode (read-only exploration) -Use `bypassPermissions` with caution. It skips permission prompts, allowing the subagent to execute operations without approval. Writes to `.git`, `.claude`, `.vscode`, and `.idea` directories still prompt for confirmation, except for `.claude/commands`, `.claude/agents`, and `.claude/skills`. See [permission modes](</docs/en/permissions#permission-modes>) for details. - -If the parent uses `bypassPermissions`, this takes precedence and cannot be overridden. +Use `bypassPermissions` with caution. It skips permission prompts, allowing the subagent to execute operations without approval. Writes to `.git`, `.claude`, `.vscode`, and `.idea` directories still prompt for confirmation, except for `.claude/commands`, `.claude/agents`, and `.claude/skills`. See [permission modes](</docs/en/permission-modes#skip-all-checks-with-bypasspermissions-mode>) for details. + +If the parent uses `bypassPermissions`, this takes precedence and cannot be overridden. If the parent uses [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>), the subagent inherits auto mode and any `permissionMode` in its frontmatter is ignored: the classifier evaluates the subagent’s tool calls with the same block and allow rules as the parent session. ####
modified Use Claude Code in VS Code View current →
--- a/vs-code.md +++ b/vs-code.md @@ -283,7 +283,7 @@ ---|---|--- `selectedModel`| `default`| Model for new conversations. Change per-session with `/model`. `useTerminal`| `false`| Launch Claude in terminal mode instead of graphical panel -`initialPermissionMode`| `default`| Controls approval prompts: `default` (ask each time), `plan`, `acceptEdits`, or `bypassPermissions` +`initialPermissionMode`| `default`| Controls approval prompts for new conversations: `default`, `plan`, `acceptEdits`, `auto`, or `bypassPermissions`. See [permission modes](</docs/en/permission-modes>). `preferredLocation`| `panel`| Where Claude opens: `sidebar` (right) or `panel` (new tab) `autosave`| `true`| Auto-save files before Claude reads or writes them `useCtrlEnterToSend`| `false`| Use Ctrl/Cmd+Enter instead of Enter to send prompts @@ -292,7 +292,7 @@ `respectGitIgnore`| `true`| Exclude .gitignore patterns from file searches `environmentVariables`| `[]`| Set environment variables for the Claude process. Use Claude Code settings instead for shared config. `disableLoginPrompt`| `false`| Skip authentication prompts (for third-party provider setups) -`allowDangerouslySkipPermissions`| `false`| Bypass permission prompts. **Use with extreme caution.** See [permission modes](</docs/en/permissions#permission-modes>) +`allowDangerouslySkipPermissions`| `false`| Adds [Auto](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) and Bypass permissions to the mode selector. Auto requires a Team plan and Claude Sonnet 4.6 or Opus 4.6, so the option may remain unavailable even with this toggle on. Use Bypass permissions only in sandboxes with no internet access. `claudeProcessWrapper`| -| Executable path used to launch the Claude process ##