4 4
5Claude Code offers a variety of settings to configure its behavior to meet your needs. You can configure Claude Code by running the `/config` command when using the interactive REPL, which opens a tabbed Settings interface where you can view status information and modify configuration options.5Claude Code offers a variety of settings to configure its behavior to meet your needs. You can configure Claude Code by running the `/config` command when using the interactive REPL, which opens a tabbed Settings interface where you can view status information and modify configuration options.
6 6
7## Configuration scopes
8
9Claude Code uses a **scope system** to determine where configurations apply and who they're shared with. Understanding scopes helps you decide how to configure Claude Code for personal use, team collaboration, or enterprise deployment.
10
11### Available scopes
12
13| Scope | Location | Who it affects | Shared with team? |
14| :---------- | :----------------------------------- | :----------------------------------- | :--------------------- |
15| **Managed** | System-level `managed-settings.json` | All users on the machine | Yes (deployed by IT) |
16| **User** | `~/.claude/` directory | You, across all projects | No |
17| **Project** | `.claude/` in repository | All collaborators on this repository | Yes (committed to git) |
18| **Local** | `.claude/*.local.*` files | You, in this repository only | No (gitignored) |
19
20### When to use each scope
21
22**Managed scope** is for:
23
24* Security policies that must be enforced organization-wide
25* Compliance requirements that can't be overridden
26* Standardized configurations deployed by IT/DevOps
27
28**User scope** is best for:
29
30* Personal preferences you want everywhere (themes, editor settings)
31* Tools and plugins you use across all projects
32* API keys and authentication (stored securely)
33
34**Project scope** is best for:
35
36* Team-shared settings (permissions, hooks, MCP servers)
37* Plugins the whole team should have
38* Standardizing tooling across collaborators
39
40**Local scope** is best for:
41
42* Personal overrides for a specific project
43* Testing configurations before sharing with the team
44* Machine-specific settings that won't work for others
45
46### How scopes interact
47
48When the same setting is configured in multiple scopes, more specific scopes take precedence:
49
501. **Managed** (highest) - can't be overridden by anything
512. **Command line arguments** - temporary session overrides
523. **Local** - overrides project and user settings
534. **Project** - overrides user settings
545. **User** (lowest) - applies when nothing else specifies the setting
55
56For example, if a permission is allowed in user settings but denied in project settings, the project setting takes precedence and the permission is blocked.
57
58### What uses scopes
59
60Scopes apply to many Claude Code features:
61
62| Feature | User location | Project location | Local location |
63| :-------------- | :------------------------ | :--------------------------------- | :----------------------------- |
64| **Settings** | `~/.claude/settings.json` | `.claude/settings.json` | `.claude/settings.local.json` |
65| **Subagents** | `~/.claude/agents/` | `.claude/agents/` | — |
66| **MCP servers** | `~/.claude.json` | `.mcp.json` | `~/.claude.json` (per-project) |
67| **Plugins** | `~/.claude/settings.json` | `.claude/settings.json` | `.claude/settings.local.json` |
68| **CLAUDE.md** | `~/.claude/CLAUDE.md` | `CLAUDE.md` or `.claude/CLAUDE.md` | `CLAUDE.local.md` |
69
70***
71
7## Settings files72## Settings files
8 73
9The `settings.json` file is our official mechanism for configuring Claude74The `settings.json` file is our official mechanism for configuring Claude
14* **Project settings** are saved in your project directory:79* **Project settings** are saved in your project directory:
15 * `.claude/settings.json` for settings that are checked into source control and shared with your team80 * `.claude/settings.json` for settings that are checked into source control and shared with your team
16 * `.claude/settings.local.json` for settings that are not checked in, useful for personal preferences and experimentation. Claude Code will configure git to ignore `.claude/settings.local.json` when it is created.81 * `.claude/settings.local.json` for settings that are not checked in, useful for personal preferences and experimentation. Claude Code will configure git to ignore `.claude/settings.local.json` when it is created.
17* For enterprise deployments of Claude Code, we also support **enterprise82* **Managed settings**: For organizations that need centralized control, Claude Code supports `managed-settings.json` and `managed-mcp.json` files that can be deployed to system directories:
18 managed policy settings**. These take precedence over user and project83
19 settings. System administrators can deploy policies to:84 * macOS: `/Library/Application Support/ClaudeCode/`
20 * macOS: `/Library/Application Support/ClaudeCode/managed-settings.json`85 * Linux and WSL: `/etc/claude-code/`
21 * Linux and WSL: `/etc/claude-code/managed-settings.json`86 * Windows: `C:\Program Files\ClaudeCode\`
22 * Windows: `C:\ProgramData\ClaudeCode\managed-settings.json`87
23* Enterprise deployments can also configure **managed MCP servers** that override88 <Note>
24 user-configured servers. See [Enterprise MCP configuration](/en/mcp#enterprise-mcp-configuration):89 These are system-wide paths (not user home directories like `~/Library/...`) that require administrator privileges. They are designed to be deployed by IT administrators.
25 * macOS: `/Library/Application Support/ClaudeCode/managed-mcp.json`90 </Note>
26 * Linux and WSL: `/etc/claude-code/managed-mcp.json`91
27 * Windows: `C:\ProgramData\ClaudeCode\managed-mcp.json`92 See [Managed settings](/en/iam#managed-settings) and [Managed MCP configuration](/en/mcp#managed-mcp-configuration) for details.
93
94 <Note>
95 Managed deployments can also restrict **plugin marketplace additions** using
96 `strictKnownMarketplaces`. For more information, see [Managed marketplace restrictions](/en/plugin-marketplaces#managed-marketplace-restrictions).
97 </Note>
98* **Other configuration** is stored in `~/.claude.json`. This file contains your preferences (theme, notification settings, editor mode), OAuth session, [MCP server](/en/mcp) configurations for user and local scopes, per-project state (allowed tools, trust settings), and various caches. Project-scoped MCP servers are stored separately in `.mcp.json`.
28 99
29```JSON Example settings.json theme={null}100```JSON Example settings.json theme={null}
30{101{
58`settings.json` supports a number of options:129`settings.json` supports a number of options:
59 130
60| Key | Description | Example |131| Key | Description | Example |
61| :--------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------- |132| :--------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :---------------------------------------------------------------------- |
62| `apiKeyHelper` | Custom script, to be executed in `/bin/sh`, to generate an auth value. This value will be sent as `X-Api-Key` and `Authorization: Bearer` headers for model requests | `/bin/generate_temp_api_key.sh` |133| `apiKeyHelper` | Custom script, to be executed in `/bin/sh`, to generate an auth value. This value will be sent as `X-Api-Key` and `Authorization: Bearer` headers for model requests | `/bin/generate_temp_api_key.sh` |
63| `cleanupPeriodDays` | How long to locally retain chat transcripts based on last activity date (default: 30 days) | `20` |134| `cleanupPeriodDays` | Sessions inactive for longer than this period are deleted at startup. Setting to `0` immediately deletes all sessions. (default: 30 days) | `20` |
64| `companyAnnouncements` | Announcement to display to users at startup. If multiple announcements are provided, they will be cycled through at random. | `["Welcome to Acme Corp! Review our code guidelines at docs.acme.com"]` |135| `companyAnnouncements` | Announcement to display to users at startup. If multiple announcements are provided, they will be cycled through at random. | `["Welcome to Acme Corp! Review our code guidelines at docs.acme.com"]` |
65| `env` | Environment variables that will be applied to every session | `{"FOO": "bar"}` |136| `env` | Environment variables that will be applied to every session | `{"FOO": "bar"}` |
66| `includeCoAuthoredBy` | Whether to include the `co-authored-by Claude` byline in git commits and pull requests (default: `true`) | `false` |137| `attribution` | Customize attribution for git commits and pull requests. See [Attribution settings](#attribution-settings) | `{"commit": "🤖 Generated with Claude Code", "pr": ""}` |
138| `includeCoAuthoredBy` | **Deprecated**: Use `attribution` instead. Whether to include the `co-authored-by Claude` byline in git commits and pull requests (default: `true`) | `false` |
67| `permissions` | See table below for structure of permissions. | |139| `permissions` | See table below for structure of permissions. | |
68| `hooks` | Configure custom commands to run before or after tool executions. See [hooks documentation](/en/hooks) | `{"PreToolUse": {"Bash": "echo 'Running command...'"}}` |140| `hooks` | Configure custom commands to run before or after tool executions. See [hooks documentation](/en/hooks) | `{"PreToolUse": {"Bash": "echo 'Running command...'"}}` |
69| `disableAllHooks` | Disable all [hooks](/en/hooks) | `true` |141| `disableAllHooks` | Disable all [hooks](/en/hooks) | `true` |
142| `allowManagedHooksOnly` | (Managed settings only) Prevent loading of user, project, and plugin hooks. Only allows managed hooks and SDK hooks. See [Hook configuration](#hook-configuration) | `true` |
70| `model` | Override the default model to use for Claude Code | `"claude-sonnet-4-5-20250929"` |143| `model` | Override the default model to use for Claude Code | `"claude-sonnet-4-5-20250929"` |
71| `statusLine` | Configure a custom status line to display context. See [statusLine documentation](/en/statusline) | `{"type": "command", "command": "~/.claude/statusline.sh"}` |144| `otelHeadersHelper` | Script to generate dynamic OpenTelemetry headers. Runs at startup and periodically (see [Dynamic headers](/en/monitoring-usage#dynamic-headers)) | `/bin/generate_otel_headers.sh` |
145| `statusLine` | Configure a custom status line to display context. See [`statusLine` documentation](/en/statusline) | `{"type": "command", "command": "~/.claude/statusline.sh"}` |
146| `fileSuggestion` | Configure a custom script for `@` file autocomplete. See [File suggestion settings](#file-suggestion-settings) | `{"type": "command", "command": "~/.claude/file-suggestion.sh"}` |
147| `respectGitignore` | Control whether the `@` file picker respects `.gitignore` patterns. When `true` (default), files matching `.gitignore` patterns are excluded from suggestions | `false` |
72| `outputStyle` | Configure an output style to adjust the system prompt. See [output styles documentation](/en/output-styles) | `"Explanatory"` |148| `outputStyle` | Configure an output style to adjust the system prompt. See [output styles documentation](/en/output-styles) | `"Explanatory"` |
73| `forceLoginMethod` | Use `claudeai` to restrict login to Claude.ai accounts, `console` to restrict login to Claude Console (API usage billing) accounts | `claudeai` |149| `forceLoginMethod` | Use `claudeai` to restrict login to Claude.ai accounts, `console` to restrict login to Claude Console (API usage billing) accounts | `claudeai` |
74| `forceLoginOrgUUID` | Specify the UUID of an organization to automatically select it during login, bypassing the organization selection step. Requires `forceLoginMethod` to be set | `"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"` |150| `forceLoginOrgUUID` | Specify the UUID of an organization to automatically select it during login, bypassing the organization selection step. Requires `forceLoginMethod` to be set | `"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"` |
75| `enableAllProjectMcpServers` | Automatically approve all MCP servers defined in project `.mcp.json` files | `true` |151| `enableAllProjectMcpServers` | Automatically approve all MCP servers defined in project `.mcp.json` files | `true` |
76| `enabledMcpjsonServers` | List of specific MCP servers from `.mcp.json` files to approve | `["memory", "github"]` |152| `enabledMcpjsonServers` | List of specific MCP servers from `.mcp.json` files to approve | `["memory", "github"]` |
77| `disabledMcpjsonServers` | List of specific MCP servers from `.mcp.json` files to reject | `["filesystem"]` |153| `disabledMcpjsonServers` | List of specific MCP servers from `.mcp.json` files to reject | `["filesystem"]` |
78| `allowedMcpServers` | When set in managed-settings.json, allowlist of MCP servers users can configure. Undefined = no restrictions, empty array = lockdown. Applies to all scopes. Denylist takes precedence. See [Enterprise MCP configuration](/en/mcp#enterprise-mcp-configuration) | `[{ "serverName": "github" }]` |154| `allowedMcpServers` | When set in managed-settings.json, allowlist of MCP servers users can configure. Undefined = no restrictions, empty array = lockdown. Applies to all scopes. Denylist takes precedence. See [Managed MCP configuration](/en/mcp#managed-mcp-configuration) | `[{ "serverName": "github" }]` |
79| `deniedMcpServers` | When set in managed-settings.json, denylist of MCP servers that are explicitly blocked. Applies to all scopes including enterprise servers. Denylist takes precedence over allowlist. See [Enterprise MCP configuration](/en/mcp#enterprise-mcp-configuration) | `[{ "serverName": "filesystem" }]` |155| `deniedMcpServers` | When set in managed-settings.json, denylist of MCP servers that are explicitly blocked. Applies to all scopes including managed servers. Denylist takes precedence over allowlist. See [Managed MCP configuration](/en/mcp#managed-mcp-configuration) | `[{ "serverName": "filesystem" }]` |
156| `strictKnownMarketplaces` | When set in managed-settings.json, allowlist of plugin marketplaces users can add. Undefined = no restrictions, empty array = lockdown. Applies to marketplace additions only. See [Managed marketplace restrictions](/en/plugin-marketplaces#managed-marketplace-restrictions) | `[{ "source": "github", "repo": "acme-corp/plugins" }]` |
80| `awsAuthRefresh` | Custom script that modifies the `.aws` directory (see [advanced credential configuration](/en/amazon-bedrock#advanced-credential-configuration)) | `aws sso login --profile myprofile` |157| `awsAuthRefresh` | Custom script that modifies the `.aws` directory (see [advanced credential configuration](/en/amazon-bedrock#advanced-credential-configuration)) | `aws sso login --profile myprofile` |
81| `awsCredentialExport` | Custom script that outputs JSON with AWS credentials (see [advanced credential configuration](/en/amazon-bedrock#advanced-credential-configuration)) | `/bin/generate_aws_grant.sh` |158| `awsCredentialExport` | Custom script that outputs JSON with AWS credentials (see [advanced credential configuration](/en/amazon-bedrock#advanced-credential-configuration)) | `/bin/generate_aws_grant.sh` |
159| `alwaysThinkingEnabled` | Enable [extended thinking](/en/common-workflows#use-extended-thinking) by default for all sessions. Typically configured via the `/config` command rather than editing directly | `true` |
160| `plansDirectory` | Customize where plan files are stored. Path is relative to project root. Default: `~/.claude/plans` | `"./plans"` |
161| `showTurnDuration` | Show turn duration messages after responses (e.g., "Cooked for 1m 6s"). Set to `false` to hide these messages | `true` |
162| `language` | Configure Claude's preferred response language (e.g., `"japanese"`, `"spanish"`, `"french"`). Claude will respond in this language by default | `"japanese"` |
163| `autoUpdatesChannel` | Release channel to follow for updates. Use `"stable"` for a version that is typically about one week old and skips versions with major regressions, or `"latest"` (default) for the most recent release | `"stable"` |
164| `spinnerTipsEnabled` | Show tips in the spinner while Claude is working. Set to `false` to disable tips (default: `true`) | `false` |
165| `terminalProgressBarEnabled` | Enable the terminal progress bar that shows progress in supported terminals like Windows Terminal and iTerm2 (default: `true`) | `false` |
82 166
83### Permission settings167### Permission settings
84 168
85| Keys | Description | Example |169| Keys | Description | Example |
86| :----------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :--------------------------------------------------------------------- |170| :----------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------- |
87| `allow` | Array of [permission rules](/en/iam#configuring-permissions) to allow tool use. **Note:** Bash rules use prefix matching, not regex | `[ "Bash(git diff:*)" ]` |171| `allow` | Array of permission rules to allow tool use. See [Permission rule syntax](#permission-rule-syntax) below for pattern matching details | `[ "Bash(git diff:*)" ]` |
88| `ask` | Array of [permission rules](/en/iam#configuring-permissions) to ask for confirmation upon tool use. | `[ "Bash(git push:*)" ]` |172| `ask` | Array of permission rules to ask for confirmation upon tool use. See [Permission rule syntax](#permission-rule-syntax) below | `[ "Bash(git push:*)" ]` |
89| `deny` | Array of [permission rules](/en/iam#configuring-permissions) to deny tool use. Use this to also exclude sensitive files from Claude Code access. **Note:** Bash patterns are prefix matches and can be bypassed (see [Bash permission limitations](/en/iam#tool-specific-permission-rules)) | `[ "WebFetch", "Bash(curl:*)", "Read(./.env)", "Read(./secrets/**)" ]` |173| `deny` | Array of permission rules to deny tool use. Use this to exclude sensitive files from Claude Code access. See [Permission rule syntax](#permission-rule-syntax) and [Bash permission limitations](/en/iam#tool-specific-permission-rules) | `[ "WebFetch", "Bash(curl:*)", "Read(./.env)", "Read(./secrets/**)" ]` |
90| `additionalDirectories` | Additional [working directories](/en/iam#working-directories) that Claude has access to | `[ "../docs/" ]` |174| `additionalDirectories` | Additional [working directories](/en/iam#working-directories) that Claude has access to | `[ "../docs/" ]` |
91| `defaultMode` | Default [permission mode](/en/iam#permission-modes) when opening Claude Code | `"acceptEdits"` |175| `defaultMode` | Default [permission mode](/en/iam#permission-modes) when opening Claude Code | `"acceptEdits"` |
92| `disableBypassPermissionsMode` | Set to `"disable"` to prevent `bypassPermissions` mode from being activated. This disables the `--dangerously-skip-permissions` command-line flag. See [managed policy settings](/en/iam#enterprise-managed-policy-settings) | `"disable"` |176| `disableBypassPermissionsMode` | Set to `"disable"` to prevent `bypassPermissions` mode from being activated. This disables the `--dangerously-skip-permissions` command-line flag. See [managed settings](/en/iam#managed-settings) | `"disable"` |
177
178### Permission rule syntax
179
180Permission rules follow the format `Tool` or `Tool(specifier)`. Understanding the syntax helps you write rules that match exactly what you intend.
181
182#### Rule evaluation order
183
184When multiple rules could match the same tool use, rules are evaluated in this order:
185
1861. **Deny** rules are checked first
1872. **Ask** rules are checked second
1883. **Allow** rules are checked last
189
190The first matching rule determines the behavior. This means deny rules always take precedence over allow rules, even if both match the same command.
191
192#### Matching all uses of a tool
193
194To match all uses of a tool, use just the tool name without parentheses:
195
196| Rule | Effect |
197| :--------- | :--------------------------------- |
198| `Bash` | Matches **all** Bash commands |
199| `WebFetch` | Matches **all** web fetch requests |
200| `Read` | Matches **all** file reads |
201
202<Warning>
203 `Bash(*)` does **not** match all Bash commands. The `*` wildcard only matches within the specifier context. To allow or deny all uses of a tool, use just the tool name: `Bash`, not `Bash(*)`.
204</Warning>
205
206#### Using specifiers for fine-grained control
207
208Add a specifier in parentheses to match specific tool uses:
209
210| Rule | Effect |
211| :----------------------------- | :------------------------------------------------------- |
212| `Bash(npm run build)` | Matches the exact command `npm run build` |
213| `Read(./.env)` | Matches reading the `.env` file in the current directory |
214| `WebFetch(domain:example.com)` | Matches fetch requests to example.com |
215
216#### Wildcard patterns
217
218Two wildcard syntaxes are available for Bash rules:
219
220| Wildcard | Position | Behavior | Example |
221| :------- | :------------------ | :---------------------------------------------------------------------- | :-------------------------------------------------------- |
222| `:*` | End of pattern only | **Prefix matching** - matches commands starting with the prefix | `Bash(npm run:*)` matches `npm run test`, `npm run build` |
223| `*` | Anywhere in pattern | **Glob matching** - matches any sequence of characters at that position | `Bash(* install)` matches `npm install`, `yarn install` |
224
225**Prefix matching with `:*`**
226
227The `:*` suffix matches any command that starts with the specified prefix. This works with multi-word commands. The following configuration allows npm and git commit commands while blocking git push and rm -rf:
228
229```json theme={null}
230{
231 "permissions": {
232 "allow": [
233 "Bash(npm run:*)",
234 "Bash(git commit:*)",
235 "Bash(docker compose:*)"
236 ],
237 "deny": [
238 "Bash(git push:*)",
239 "Bash(rm -rf:*)"
240 ]
241 }
242}
243```
244
245**Glob matching with `*`**
246
247The `*` wildcard can appear at the beginning, middle, or end of a pattern. The following configuration allows any git command targeting main (like `git checkout main`, `git merge main`) and any version check command (like `node --version`, `npm --version`):
248
249```json theme={null}
250{
251 "permissions": {
252 "allow": [
253 "Bash(git * main)",
254 "Bash(* --version)"
255 ]
256 }
257}
258```
259
260<Warning>
261 Bash permission rules use pattern matching and can be bypassed using shell features like command flags, variables, or redirects. For example, `Bash(curl:*)` can be bypassed with `curl -X GET` reordered to `curl http://example.com -X GET`. Do not rely on Bash deny rules as a security boundary.
262</Warning>
263
264For detailed information about tool-specific permission patterns—including Read, Edit, WebFetch, MCP, Task rules, and Bash permission limitations—see [Tool-specific permission rules](/en/iam#tool-specific-permission-rules).
93 265
94### Sandbox settings266### Sandbox settings
95 267
104| `excludedCommands` | Commands that should run outside of the sandbox | `["git", "docker"]` |276| `excludedCommands` | Commands that should run outside of the sandbox | `["git", "docker"]` |
105| `allowUnsandboxedCommands` | Allow commands to run outside the sandbox via the `dangerouslyDisableSandbox` parameter. When set to `false`, the `dangerouslyDisableSandbox` escape hatch is completely disabled and all commands must run sandboxed (or be in `excludedCommands`). Useful for enterprise policies that require strict sandboxing. Default: true | `false` |277| `allowUnsandboxedCommands` | Allow commands to run outside the sandbox via the `dangerouslyDisableSandbox` parameter. When set to `false`, the `dangerouslyDisableSandbox` escape hatch is completely disabled and all commands must run sandboxed (or be in `excludedCommands`). Useful for enterprise policies that require strict sandboxing. Default: true | `false` |
106| `network.allowUnixSockets` | Unix socket paths accessible in sandbox (for SSH agents, etc.) | `["~/.ssh/agent-socket"]` |278| `network.allowUnixSockets` | Unix socket paths accessible in sandbox (for SSH agents, etc.) | `["~/.ssh/agent-socket"]` |
107| `network.allowLocalBinding` | Allow binding to localhost ports (MacOS only). Default: false | `true` |279| `network.allowLocalBinding` | Allow binding to localhost ports (macOS only). Default: false | `true` |
108| `network.httpProxyPort` | HTTP proxy port used if you wish to bring your own proxy. If not specified, Claude will run its own proxy. | `8080` |280| `network.httpProxyPort` | HTTP proxy port used if you wish to bring your own proxy. If not specified, Claude will run its own proxy. | `8080` |
109| `network.socksProxyPort` | SOCKS5 proxy port used if you wish to bring your own proxy. If not specified, Claude will run its own proxy. | `8081` |281| `network.socksProxyPort` | SOCKS5 proxy port used if you wish to bring your own proxy. If not specified, Claude will run its own proxy. | `8081` |
110| `enableWeakerNestedSandbox` | Enable weaker sandbox for unprivileged Docker environments (Linux only). **Reduces security.** Default: false | `true` |282| `enableWeakerNestedSandbox` | Enable weaker sandbox for unprivileged Docker environments (Linux only). **Reduces security.** Default: false | `true` |
133}305}
134```306```
135 307
136**Filesystem access** is controlled via Read/Edit permissions:308**Filesystem and network restrictions** use standard permission rules:
309
310* Use `Read` deny rules to block Claude from reading specific files or directories
311* Use `Edit` allow rules to let Claude write to directories beyond the current working directory
312* Use `Edit` deny rules to block writes to specific paths
313* Use `WebFetch` allow/deny rules to control which network domains Claude can access
314
315### Attribution settings
137 316
138* Read deny rules block file reads in sandbox317Claude Code adds attribution to git commits and pull requests. These are configured separately:
139* Edit allow rules permit file writes (in addition to the defaults, e.g. the current working directory)
140* Edit deny rules block writes within allowed paths
141 318
142**Network access** is controlled via WebFetch permissions:319* Commits use [git trailers](https://git-scm.com/docs/git-interpret-trailers) (like `Co-Authored-By`) by default, which can be customized or disabled
320* Pull request descriptions are plain text
143 321
144* WebFetch allow rules permit network domains322| Keys | Description |
145* WebFetch deny rules block network domains323| :------- | :----------------------------------------------------------------------------------------- |
324| `commit` | Attribution for git commits, including any trailers. Empty string hides commit attribution |
325| `pr` | Attribution for pull request descriptions. Empty string hides pull request attribution |
326
327**Default commit attribution:**
328
329```
330🤖 Generated with [Claude Code](https://claude.com/claude-code)
331
332 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
333```
334
335**Default pull request attribution:**
336
337```
338🤖 Generated with [Claude Code](https://claude.com/claude-code)
339```
340
341**Example:**
342
343```json theme={null}
344{
345 "attribution": {
346 "commit": "Generated with AI\n\nCo-Authored-By: AI <ai@example.com>",
347 "pr": ""
348 }
349}
350```
351
352<Note>
353 The `attribution` setting takes precedence over the deprecated `includeCoAuthoredBy` setting. To hide all attribution, set `commit` and `pr` to empty strings.
354</Note>
355
356### File suggestion settings
357
358Configure a custom command for `@` file path autocomplete. The built-in file suggestion uses fast filesystem traversal, but large monorepos may benefit from project-specific indexing such as a pre-built file index or custom tooling.
359
360```json theme={null}
361{
362 "fileSuggestion": {
363 "type": "command",
364 "command": "~/.claude/file-suggestion.sh"
365 }
366}
367```
368
369The command runs with the same environment variables as [hooks](/en/hooks), including `CLAUDE_PROJECT_DIR`. It receives JSON via stdin with a `query` field:
370
371```json theme={null}
372{"query": "src/comp"}
373```
374
375Output newline-separated file paths to stdout (currently limited to 15):
376
377```
378src/components/Button.tsx
379src/components/Modal.tsx
380src/components/Form.tsx
381```
382
383**Example:**
384
385```bash theme={null}
386#!/bin/bash
387query=$(cat | jq -r '.query')
388your-repo-file-index --query "$query" | head -20
389```
390
391### Hook configuration
392
393**Managed settings only**: Controls which hooks are allowed to run. This setting can only be configured in [managed settings](#settings-files) and provides administrators with strict control over hook execution.
394
395**Behavior when `allowManagedHooksOnly` is `true`:**
396
397* Managed hooks and SDK hooks are loaded
398* User hooks, project hooks, and plugin hooks are blocked
399
400**Configuration:**
401
402```json theme={null}
403{
404 "allowManagedHooksOnly": true
405}
406```
146 407
147### Settings precedence408### Settings precedence
148 409
149Settings are applied in order of precedence (highest to lowest):410Settings apply in order of precedence. From highest to lowest:
150 411
1511. **Enterprise managed policies** (`managed-settings.json`)4121. **Managed settings** (`managed-settings.json`)
152 * Deployed by IT/DevOps413 * Policies deployed by IT/DevOps to system directories
153 * Cannot be overridden414 * Cannot be overridden by user or project settings
154 415
1552. **Command line arguments**4162. **Command line arguments**
156 * Temporary overrides for a specific session417 * Temporary overrides for a specific session
1645. **User settings** (`~/.claude/settings.json`)4255. **User settings** (`~/.claude/settings.json`)
165 * Personal global settings426 * Personal global settings
166 427
167This hierarchy ensures that enterprise security policies are always enforced while still allowing teams and individuals to customize their experience.428This hierarchy ensures that organizational policies are always enforced while still allowing teams and individuals to customize their experience.
429
430For 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.
168 431
169### Key points about the configuration system432### Key points about the configuration system
170 433
171* **Memory files (CLAUDE.md)**: Contain instructions and context that Claude loads at startup434* **Memory files (`CLAUDE.md`)**: Contain instructions and context that Claude loads at startup
172* **Settings files (JSON)**: Configure permissions, environment variables, and tool behavior435* **Settings files (JSON)**: Configure permissions, environment variables, and tool behavior
173* **Slash commands**: Custom commands that can be invoked during a session with `/command-name`436* **Slash commands**: Custom commands that can be invoked during a session with `/command-name`
174* **MCP servers**: Extend Claude Code with additional tools and integrations437* **MCP servers**: Extend Claude Code with additional tools and integrations
175* **Precedence**: Higher-level configurations (Enterprise) override lower-level ones (User/Project)438* **Precedence**: Higher-level configurations (Managed) override lower-level ones (User/Project)
176* **Inheritance**: Settings are merged, with more specific settings adding to or overriding broader ones439* **Inheritance**: Settings are merged, with more specific settings adding to or overriding broader ones
177 440
178### System prompt availability441### System prompt
179 442
180<Note>443Claude Code's internal system prompt is not published. To add custom instructions, use `CLAUDE.md` files or the `--append-system-prompt` flag.
181 Unlike for claude.ai, we do not publish Claude Code's internal system prompt on this website. Use CLAUDE.md files or `--append-system-prompt` to add custom instructions to Claude Code's behavior.
182</Note>
183 444
184### Excluding sensitive files445### Excluding sensitive files
185 446
186To prevent Claude Code from accessing files containing sensitive information (e.g., API keys, secrets, environment files), use the `permissions.deny` setting in your `.claude/settings.json` file:447To prevent Claude Code from accessing files containing sensitive information like API keys, secrets, and environment files, use the `permissions.deny` setting in your `.claude/settings.json` file:
187 448
188```json theme={null}449```json theme={null}
189{450{
221```json theme={null}482```json theme={null}
222{483{
223 "enabledPlugins": {484 "enabledPlugins": {
224 "formatter@company-tools": true,485 "formatter@acme-tools": true,
225 "deployer@company-tools": true,486 "deployer@acme-tools": true,
226 "analyzer@security-plugins": false487 "analyzer@security-plugins": false
227 },488 },
228 "extraKnownMarketplaces": {489 "extraKnownMarketplaces": {
229 "company-tools": {490 "acme-tools": {
230 "source": "github",491 "source": "github",
231 "repo": "company/claude-plugins"492 "repo": "acme-corp/claude-plugins"
232 }493 }
233 }494 }
234}495}
272```json theme={null}533```json theme={null}
273{534{
274 "extraKnownMarketplaces": {535 "extraKnownMarketplaces": {
275 "company-tools": {536 "acme-tools": {
276 "source": {537 "source": {
277 "source": "github",538 "source": "github",
278 "repo": "company-org/claude-plugins"539 "repo": "acme-corp/claude-plugins"
279 }540 }
280 },541 },
281 "security-plugins": {542 "security-plugins": {
282 "source": {543 "source": {
283 "source": "git",544 "source": "git",
284 "url": "https://git.company.com/security/plugins.git"545 "url": "https://git.example.com/security/plugins.git"
285 }546 }
286 }547 }
287 }548 }
294* `git`: Any git URL (uses `url`)555* `git`: Any git URL (uses `url`)
295* `directory`: Local filesystem path (uses `path`, for development only)556* `directory`: Local filesystem path (uses `path`, for development only)
296 557
558#### `strictKnownMarketplaces`
559
560**Managed settings only**: Controls which plugin marketplaces users are allowed to add. This setting can only be configured in [`managed-settings.json`](/en/iam#managed-settings) and provides administrators with strict control over marketplace sources.
561
562**Managed settings file locations**:
563
564* **macOS**: `/Library/Application Support/ClaudeCode/managed-settings.json`
565* **Linux and WSL**: `/etc/claude-code/managed-settings.json`
566* **Windows**: `C:\Program Files\ClaudeCode\managed-settings.json`
567
568**Key characteristics**:
569
570* Only available in managed settings (`managed-settings.json`)
571* Cannot be overridden by user or project settings (highest precedence)
572* Enforced BEFORE network/filesystem operations (blocked sources never execute)
573* Uses exact matching for source specifications (including `ref`, `path` for git sources)
574
575**Allowlist behavior**:
576
577* `undefined` (default): No restrictions - users can add any marketplace
578* Empty array `[]`: Complete lockdown - users cannot add any new marketplaces
579* List of sources: Users can only add marketplaces that match exactly
580
581**All supported source types**:
582
583The allowlist supports six marketplace source types. Each source must match exactly for a user's marketplace addition to be allowed.
584
5851. **GitHub repositories**:
586
587```json theme={null}
588{ "source": "github", "repo": "acme-corp/approved-plugins" }
589{ "source": "github", "repo": "acme-corp/security-tools", "ref": "v2.0" }
590{ "source": "github", "repo": "acme-corp/plugins", "ref": "main", "path": "marketplace" }
591```
592
593Fields: `repo` (required), `ref` (optional: branch/tag/SHA), `path` (optional: subdirectory)
594
5952. **Git repositories**:
596
597```json theme={null}
598{ "source": "git", "url": "https://gitlab.example.com/tools/plugins.git" }
599{ "source": "git", "url": "https://bitbucket.org/acme-corp/plugins.git", "ref": "production" }
600{ "source": "git", "url": "ssh://git@git.example.com/plugins.git", "ref": "v3.1", "path": "approved" }
601```
602
603Fields: `url` (required), `ref` (optional: branch/tag/SHA), `path` (optional: subdirectory)
604
6053. **URL-based marketplaces**:
606
607```json theme={null}
608{ "source": "url", "url": "https://plugins.example.com/marketplace.json" }
609{ "source": "url", "url": "https://cdn.example.com/marketplace.json", "headers": { "Authorization": "Bearer ${TOKEN}" } }
610```
611
612Fields: `url` (required), `headers` (optional: HTTP headers for authenticated access)
613
614<Note>
615 URL-based marketplaces only download the `marketplace.json` file. They do not download plugin files from the server. Plugins in URL-based marketplaces must use external sources (GitHub, npm, or git URLs) rather than relative paths. For plugins with relative paths, use a Git-based marketplace instead. See [Troubleshooting](/en/plugin-marketplaces#plugins-with-relative-paths-fail-in-url-based-marketplaces) for details.
616</Note>
617
6184. **NPM packages**:
619
620```json theme={null}
621{ "source": "npm", "package": "@acme-corp/claude-plugins" }
622{ "source": "npm", "package": "@acme-corp/approved-marketplace" }
623```
624
625Fields: `package` (required, supports scoped packages)
626
6275. **File paths**:
628
629```json theme={null}
630{ "source": "file", "path": "/usr/local/share/claude/acme-marketplace.json" }
631{ "source": "file", "path": "/opt/acme-corp/plugins/marketplace.json" }
632```
633
634Fields: `path` (required: absolute path to marketplace.json file)
635
6366. **Directory paths**:
637
638```json theme={null}
639{ "source": "directory", "path": "/usr/local/share/claude/acme-plugins" }
640{ "source": "directory", "path": "/opt/acme-corp/approved-marketplaces" }
641```
642
643Fields: `path` (required: absolute path to directory containing `.claude-plugin/marketplace.json`)
644
645**Configuration examples**:
646
647Example - Allow specific marketplaces only:
648
649```json theme={null}
650{
651 "strictKnownMarketplaces": [
652 {
653 "source": "github",
654 "repo": "acme-corp/approved-plugins"
655 },
656 {
657 "source": "github",
658 "repo": "acme-corp/security-tools",
659 "ref": "v2.0"
660 },
661 {
662 "source": "url",
663 "url": "https://plugins.example.com/marketplace.json"
664 },
665 {
666 "source": "npm",
667 "package": "@acme-corp/compliance-plugins"
668 }
669 ]
670}
671```
672
673Example - Disable all marketplace additions:
674
675```json theme={null}
676{
677 "strictKnownMarketplaces": []
678}
679```
680
681**Exact matching requirements**:
682
683Marketplace sources must match **exactly** for a user's addition to be allowed. For git-based sources (`github` and `git`), this includes all optional fields:
684
685* The `repo` or `url` must match exactly
686* The `ref` field must match exactly (or both be undefined)
687* The `path` field must match exactly (or both be undefined)
688
689Examples of sources that **do NOT match**:
690
691```json theme={null}
692// These are DIFFERENT sources:
693{ "source": "github", "repo": "acme-corp/plugins" }
694{ "source": "github", "repo": "acme-corp/plugins", "ref": "main" }
695
696// These are also DIFFERENT:
697{ "source": "github", "repo": "acme-corp/plugins", "path": "marketplace" }
698{ "source": "github", "repo": "acme-corp/plugins" }
699```
700
701**Comparison with `extraKnownMarketplaces`**:
702
703| Aspect | `strictKnownMarketplaces` | `extraKnownMarketplaces` |
704| --------------------- | ------------------------------------ | ------------------------------------ |
705| **Purpose** | Organizational policy enforcement | Team convenience |
706| **Settings file** | `managed-settings.json` only | Any settings file |
707| **Behavior** | Blocks non-allowlisted additions | Auto-installs missing marketplaces |
708| **When enforced** | Before network/filesystem operations | After user trust prompt |
709| **Can be overridden** | No (highest precedence) | Yes (by higher precedence settings) |
710| **Source format** | Direct source object | Named marketplace with nested source |
711| **Use case** | Compliance, security restrictions | Onboarding, standardization |
712
713**Format difference**:
714
715`strictKnownMarketplaces` uses direct source objects:
716
717```json theme={null}
718{
719 "strictKnownMarketplaces": [
720 { "source": "github", "repo": "acme-corp/plugins" }
721 ]
722}
723```
724
725`extraKnownMarketplaces` requires named marketplaces:
726
727```json theme={null}
728{
729 "extraKnownMarketplaces": {
730 "acme-tools": {
731 "source": { "source": "github", "repo": "acme-corp/plugins" }
732 }
733 }
734}
735```
736
737**Important notes**:
738
739* Restrictions are checked BEFORE any network requests or filesystem operations
740* When blocked, users see clear error messages indicating the source is blocked by managed policy
741* The restriction applies only to adding NEW marketplaces; previously installed marketplaces remain accessible
742* Managed settings have the highest precedence and cannot be overridden
743
744See [Managed marketplace restrictions](/en/plugin-marketplaces#managed-marketplace-restrictions) for user-facing documentation.
745
297### Managing plugins746### Managing plugins
298 747
299Use the `/plugin` command to manage plugins interactively:748Use the `/plugin` command to manage plugins interactively:
315</Note>764</Note>
316 765
317| Variable | Purpose |766| Variable | Purpose |
318| :----------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |767| :-------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
319| `ANTHROPIC_API_KEY` | API key sent as `X-Api-Key` header, typically for the Claude SDK (for interactive usage, run `/login`) |768| `ANTHROPIC_API_KEY` | API key sent as `X-Api-Key` header, typically for the Claude SDK (for interactive usage, run `/login`) |
320| `ANTHROPIC_AUTH_TOKEN` | Custom value for the `Authorization` header (the value you set here will be prefixed with `Bearer `) |769| `ANTHROPIC_AUTH_TOKEN` | Custom value for the `Authorization` header (the value you set here will be prefixed with `Bearer `) |
321| `ANTHROPIC_CUSTOM_HEADERS` | Custom headers you want to add to the request (in `Name: Value` format) |770| `ANTHROPIC_CUSTOM_HEADERS` | Custom headers you want to add to the request (in `Name: Value` format) |
330| `BASH_DEFAULT_TIMEOUT_MS` | Default timeout for long-running bash commands |779| `BASH_DEFAULT_TIMEOUT_MS` | Default timeout for long-running bash commands |
331| `BASH_MAX_OUTPUT_LENGTH` | Maximum number of characters in bash outputs before they are middle-truncated |780| `BASH_MAX_OUTPUT_LENGTH` | Maximum number of characters in bash outputs before they are middle-truncated |
332| `BASH_MAX_TIMEOUT_MS` | Maximum timeout the model can set for long-running bash commands |781| `BASH_MAX_TIMEOUT_MS` | Maximum timeout the model can set for long-running bash commands |
782| `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` | Set the percentage of context capacity (1-100) at which auto-compaction triggers. By default, auto-compaction triggers at approximately 95% capacity. Use lower values like `50` to compact earlier. Values above the default threshold have no effect. Applies to both main conversations and subagents. This percentage aligns with the `context_window.used_percentage` field available in [status line](/en/statusline) |
333| `CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR` | Return to the original working directory after each Bash command |783| `CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR` | Return to the original working directory after each Bash command |
334| `CLAUDE_CODE_API_KEY_HELPER_TTL_MS` | Interval in milliseconds at which credentials should be refreshed (when using `apiKeyHelper`) |784| `CLAUDE_CODE_API_KEY_HELPER_TTL_MS` | Interval in milliseconds at which credentials should be refreshed (when using `apiKeyHelper`) |
335| `CLAUDE_CODE_CLIENT_CERT` | Path to client certificate file for mTLS authentication |785| `CLAUDE_CODE_CLIENT_CERT` | Path to client certificate file for mTLS authentication |
336| `CLAUDE_CODE_CLIENT_KEY_PASSPHRASE` | Passphrase for encrypted CLAUDE\_CODE\_CLIENT\_KEY (optional) |786| `CLAUDE_CODE_CLIENT_KEY_PASSPHRASE` | Passphrase for encrypted CLAUDE\_CODE\_CLIENT\_KEY (optional) |
337| `CLAUDE_CODE_CLIENT_KEY` | Path to client private key file for mTLS authentication |787| `CLAUDE_CODE_CLIENT_KEY` | Path to client private key file for mTLS authentication |
338| `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS` | Set to `1` to disable Anthropic API-specific `anthropic-beta` headers. Use this if experiencing issues like "Unexpected value(s) for the `anthropic-beta` header" when using an LLM gateway with third-party providers |788| `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS` | Set to `1` to disable Anthropic API-specific `anthropic-beta` headers. Use this if experiencing issues like "Unexpected value(s) for the `anthropic-beta` header" when using an LLM gateway with third-party providers |
789| `CLAUDE_CODE_DISABLE_BACKGROUND_TASKS` | Set to `1` to disable all background task functionality, including the `run_in_background` parameter on Bash and subagent tools, auto-backgrounding, and the Ctrl+B shortcut |
790| `CLAUDE_CODE_EXIT_AFTER_STOP_DELAY` | Time in milliseconds to wait after the query loop becomes idle before automatically exiting. Useful for automated workflows and scripts using SDK mode |
791| `CLAUDE_CODE_PROXY_RESOLVES_HOSTS` | Set to `true` to allow the proxy to perform DNS resolution instead of the caller. Opt-in for environments where the proxy should handle hostname resolution |
792| `CLAUDE_CODE_TMPDIR` | Override the temp directory used for internal temp files. Claude Code appends `/claude/` to this path. Default: `/tmp` on Unix/macOS, `os.tmpdir()` on Windows |
339| `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` | Equivalent of setting `DISABLE_AUTOUPDATER`, `DISABLE_BUG_COMMAND`, `DISABLE_ERROR_REPORTING`, and `DISABLE_TELEMETRY` |793| `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` | Equivalent of setting `DISABLE_AUTOUPDATER`, `DISABLE_BUG_COMMAND`, `DISABLE_ERROR_REPORTING`, and `DISABLE_TELEMETRY` |
340| `CLAUDE_CODE_DISABLE_TERMINAL_TITLE` | Set to `1` to disable automatic terminal title updates based on conversation context |794| `CLAUDE_CODE_DISABLE_TERMINAL_TITLE` | Set to `1` to disable automatic terminal title updates based on conversation context |
795| `CLAUDE_CODE_FILE_READ_MAX_OUTPUT_TOKENS` | Override the default token limit for file reads. Useful when you need to read larger files in full |
796| `CLAUDE_CODE_HIDE_ACCOUNT_INFO` | Set to `1` to hide your email address and organization name from the Claude Code UI. Useful when streaming or recording |
341| `CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL` | Skip auto-installation of IDE extensions |797| `CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL` | Skip auto-installation of IDE extensions |
342| `CLAUDE_CODE_MAX_OUTPUT_TOKENS` | Set the maximum number of output tokens for most requests |798| `CLAUDE_CODE_MAX_OUTPUT_TOKENS` | Set the maximum number of output tokens for most requests. Default: 32,000. Maximum: 64,000. Increasing this value reduces the effective context window available before [auto-compaction](/en/costs#reduce-token-usage) triggers. |
343| `CLAUDE_CODE_SKIP_BEDROCK_AUTH` | Skip AWS authentication for Bedrock (e.g. when using an LLM gateway) |799| `CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS` | Interval for refreshing dynamic OpenTelemetry headers in milliseconds (default: 1740000 / 29 minutes). See [Dynamic headers](/en/monitoring-usage#dynamic-headers) |
344| `CLAUDE_CODE_SKIP_FOUNDRY_AUTH` | Skip Azure authentication for Microsoft Foundry (e.g. when using an LLM gateway) |800| `CLAUDE_CODE_SHELL` | Override automatic shell detection. Useful when your login shell differs from your preferred working shell (for example, `bash` vs `zsh`) |
345| `CLAUDE_CODE_SKIP_VERTEX_AUTH` | Skip Google authentication for Vertex (e.g. when using an LLM gateway) |801| `CLAUDE_CODE_SHELL_PREFIX` | Command prefix to wrap all bash commands (for example, for logging or auditing). Example: `/path/to/logger.sh` will execute `/path/to/logger.sh <command>` |
802| `CLAUDE_CODE_SKIP_BEDROCK_AUTH` | Skip AWS authentication for Bedrock (for example, when using an LLM gateway) |
803| `CLAUDE_CODE_SKIP_FOUNDRY_AUTH` | Skip Azure authentication for Microsoft Foundry (for example, when using an LLM gateway) |
804| `CLAUDE_CODE_SKIP_VERTEX_AUTH` | Skip Google authentication for Vertex (for example, when using an LLM gateway) |
346| `CLAUDE_CODE_SUBAGENT_MODEL` | See [Model configuration](/en/model-config) |805| `CLAUDE_CODE_SUBAGENT_MODEL` | See [Model configuration](/en/model-config) |
347| `CLAUDE_CODE_USE_BEDROCK` | Use [Bedrock](/en/amazon-bedrock) |806| `CLAUDE_CODE_USE_BEDROCK` | Use [Bedrock](/en/amazon-bedrock) |
348| `CLAUDE_CODE_USE_FOUNDRY` | Use [Microsoft Foundry](/en/microsoft-foundry) |807| `CLAUDE_CODE_USE_FOUNDRY` | Use [Microsoft Foundry](/en/microsoft-foundry) |
349| `CLAUDE_CODE_USE_VERTEX` | Use [Vertex](/en/google-vertex-ai) |808| `CLAUDE_CODE_USE_VERTEX` | Use [Vertex](/en/google-vertex-ai) |
809| `CLAUDE_CONFIG_DIR` | Customize where Claude Code stores its configuration and data files |
350| `DISABLE_AUTOUPDATER` | Set to `1` to disable automatic updates. |810| `DISABLE_AUTOUPDATER` | Set to `1` to disable automatic updates. |
351| `DISABLE_BUG_COMMAND` | Set to `1` to disable the `/bug` command |811| `DISABLE_BUG_COMMAND` | Set to `1` to disable the `/bug` command |
352| `DISABLE_COST_WARNINGS` | Set to `1` to disable cost warning messages |812| `DISABLE_COST_WARNINGS` | Set to `1` to disable cost warning messages |
357| `DISABLE_PROMPT_CACHING_OPUS` | Set to `1` to disable prompt caching for Opus models |817| `DISABLE_PROMPT_CACHING_OPUS` | Set to `1` to disable prompt caching for Opus models |
358| `DISABLE_PROMPT_CACHING_SONNET` | Set to `1` to disable prompt caching for Sonnet models |818| `DISABLE_PROMPT_CACHING_SONNET` | Set to `1` to disable prompt caching for Sonnet models |
359| `DISABLE_TELEMETRY` | Set to `1` to opt out of Statsig telemetry (note that Statsig events do not include user data like code, file paths, or bash commands) |819| `DISABLE_TELEMETRY` | Set to `1` to opt out of Statsig telemetry (note that Statsig events do not include user data like code, file paths, or bash commands) |
820| `ENABLE_TOOL_SEARCH` | Controls [MCP tool search](/en/mcp#scale-with-mcp-tool-search). Values: `auto` (default, enables at 10% context), `auto:N` (custom threshold, e.g., `auto:5` for 5%), `true` (always on), `false` (disabled) |
821| `FORCE_AUTOUPDATE_PLUGINS` | Set to `true` to force plugin auto-updates even when the main auto-updater is disabled via `DISABLE_AUTOUPDATER` |
360| `HTTP_PROXY` | Specify HTTP proxy server for network connections |822| `HTTP_PROXY` | Specify HTTP proxy server for network connections |
361| `HTTPS_PROXY` | Specify HTTPS proxy server for network connections |823| `HTTPS_PROXY` | Specify HTTPS proxy server for network connections |
824| `IS_DEMO` | Set to `true` to enable demo mode: hides email and organization from the UI, skips onboarding, and hides internal commands. Useful for streaming or recording sessions |
362| `MAX_MCP_OUTPUT_TOKENS` | Maximum number of tokens allowed in MCP tool responses. Claude Code displays a warning when output exceeds 10,000 tokens (default: 25000) |825| `MAX_MCP_OUTPUT_TOKENS` | Maximum number of tokens allowed in MCP tool responses. Claude Code displays a warning when output exceeds 10,000 tokens (default: 25000) |
363| `MAX_THINKING_TOKENS` | Enable [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) and set the token budget for the thinking process. Extended thinking improves performance on complex reasoning and coding tasks but impacts [prompt caching efficiency](https://docs.claude.com/en/docs/build-with-claude/prompt-caching#caching-with-thinking-blocks). Disabled by default. |826| `MAX_THINKING_TOKENS` | Override the [extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) token budget. Thinking is enabled at max budget (31,999 tokens) by default. Use this to limit the budget (for example, `MAX_THINKING_TOKENS=10000`) or disable thinking entirely (`MAX_THINKING_TOKENS=0`). Extended thinking improves performance on complex reasoning and coding tasks but impacts [prompt caching efficiency](https://docs.claude.com/en/docs/build-with-claude/prompt-caching#caching-with-thinking-blocks). |
364| `MCP_TIMEOUT` | Timeout in milliseconds for MCP server startup |827| `MCP_TIMEOUT` | Timeout in milliseconds for MCP server startup |
365| `MCP_TOOL_TIMEOUT` | Timeout in milliseconds for MCP tool execution |828| `MCP_TOOL_TIMEOUT` | Timeout in milliseconds for MCP tool execution |
366| `NO_PROXY` | List of domains and IPs to which requests will be directly issued, bypassing proxy |829| `NO_PROXY` | List of domains and IPs to which requests will be directly issued, bypassing proxy |
367| `SLASH_COMMAND_TOOL_CHAR_BUDGET` | Maximum number of characters for slash command metadata shown to [SlashCommand tool](/en/slash-commands#slashcommand-tool) (default: 15000) |830| `SLASH_COMMAND_TOOL_CHAR_BUDGET` | Maximum number of characters for slash command metadata shown to the [Skill tool](/en/slash-commands#skill-tool) (default: 15000) |
368| `USE_BUILTIN_RIPGREP` | Set to `0` to use system-installed `rg` intead of `rg` included with Claude Code |831| `USE_BUILTIN_RIPGREP` | Set to `0` to use system-installed `rg` instead of `rg` included with Claude Code |
369| `VERTEX_REGION_CLAUDE_3_5_HAIKU` | Override region for Claude 3.5 Haiku when using Vertex AI |832| `VERTEX_REGION_CLAUDE_3_5_HAIKU` | Override region for Claude 3.5 Haiku when using Vertex AI |
370| `VERTEX_REGION_CLAUDE_3_7_SONNET` | Override region for Claude 3.7 Sonnet when using Vertex AI |833| `VERTEX_REGION_CLAUDE_3_7_SONNET` | Override region for Claude 3.7 Sonnet when using Vertex AI |
371| `VERTEX_REGION_CLAUDE_4_0_OPUS` | Override region for Claude 4.0 Opus when using Vertex AI |834| `VERTEX_REGION_CLAUDE_4_0_OPUS` | Override region for Claude 4.0 Opus when using Vertex AI |
377Claude Code has access to a set of powerful tools that help it understand and modify your codebase:840Claude Code has access to a set of powerful tools that help it understand and modify your codebase:
378 841
379| Tool | Description | Permission Required |842| Tool | Description | Permission Required |
380| :------------------ | :--------------------------------------------------------------------------------- | :------------------ |843| :------------------ | :------------------------------------------------------------------------------------------------- | :------------------ |
381| **AskUserQuestion** | Asks the user multiple choice questions to gather information or clarify ambiguity | No |844| **AskUserQuestion** | Asks multiple-choice questions to gather requirements or clarify ambiguity | No |
382| **Bash** | Executes shell commands in your environment | Yes |845| **Bash** | Executes shell commands in your environment (see [Bash tool behavior](#bash-tool-behavior) below) | Yes |
383| **BashOutput** | Retrieves output from a background bash shell | No |846| **TaskOutput** | Retrieves output from a background task (bash shell or subagent) | No |
384| **Edit** | Makes targeted edits to specific files | Yes |847| **Edit** | Makes targeted edits to specific files | Yes |
385| **ExitPlanMode** | Prompts the user to exit plan mode and start coding | Yes |848| **ExitPlanMode** | Prompts the user to exit plan mode and start coding | Yes |
386| **Glob** | Finds files based on pattern matching | No |849| **Glob** | Finds files based on pattern matching | No |
387| **Grep** | Searches for patterns in file contents | No |850| **Grep** | Searches for patterns in file contents | No |
388| **KillShell** | Kills a running background bash shell by its ID | No |851| **KillShell** | Kills a running background bash shell by its ID | No |
852| **MCPSearch** | Searches for and loads MCP tools when [tool search](/en/mcp#scale-with-mcp-tool-search) is enabled | No |
389| **NotebookEdit** | Modifies Jupyter notebook cells | Yes |853| **NotebookEdit** | Modifies Jupyter notebook cells | Yes |
390| **Read** | Reads the contents of files | No |854| **Read** | Reads the contents of files | No |
391| **Skill** | Executes a skill within the main conversation | Yes |855| **Skill** | Executes a [skill or slash command](/en/slash-commands#skill-tool) within the main conversation | Yes |
392| **SlashCommand** | Runs a [custom slash command](/en/slash-commands#slashcommand-tool) | Yes |
393| **Task** | Runs a sub-agent to handle complex, multi-step tasks | No |856| **Task** | Runs a sub-agent to handle complex, multi-step tasks | No |
394| **TodoWrite** | Creates and manages structured task lists | No |857| **TodoWrite** | Creates and manages structured task lists | No |
395| **WebFetch** | Fetches content from a specified URL | Yes |858| **WebFetch** | Fetches content from a specified URL | Yes |
398 861
399Permission rules can be configured using `/allowed-tools` or in [permission settings](/en/settings#available-settings). Also see [Tool-specific permission rules](/en/iam#tool-specific-permission-rules).862Permission rules can be configured using `/allowed-tools` or in [permission settings](/en/settings#available-settings). Also see [Tool-specific permission rules](/en/iam#tool-specific-permission-rules).
400 863
864### Bash tool behavior
865
866The Bash tool executes shell commands with the following persistence behavior:
867
868* **Working directory persists**: When Claude changes the working directory (for example, `cd /path/to/dir`), subsequent Bash commands will execute in that directory. You can use `CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR=1` to reset to the project directory after each command.
869* **Environment variables do NOT persist**: Environment variables set in one Bash command (for example, `export MY_VAR=value`) are **not** available in subsequent Bash commands. Each Bash command runs in a fresh shell environment.
870
871To make environment variables available in Bash commands, you have **three options**:
872
873**Option 1: Activate environment before starting Claude Code** (simplest approach)
874
875Activate your virtual environment in your terminal before launching Claude Code:
876
877```bash theme={null}
878conda activate myenv
879# or: source /path/to/venv/bin/activate
880claude
881```
882
883This works for shell environments but environment variables set within Claude's Bash commands will not persist between commands.
884
885**Option 2: Set CLAUDE\_ENV\_FILE before starting Claude Code** (persistent environment setup)
886
887Export the path to a shell script containing your environment setup:
888
889```bash theme={null}
890export CLAUDE_ENV_FILE=/path/to/env-setup.sh
891claude
892```
893
894Where `/path/to/env-setup.sh` contains:
895
896```bash theme={null}
897conda activate myenv
898# or: source /path/to/venv/bin/activate
899# or: export MY_VAR=value
900```
901
902Claude Code will source this file before each Bash command, making the environment persistent across all commands.
903
904**Option 3: Use a SessionStart hook** (project-specific configuration)
905
906Configure in `.claude/settings.json`:
907
908```json theme={null}
909{
910 "hooks": {
911 "SessionStart": [{
912 "matcher": "startup",
913 "hooks": [{
914 "type": "command",
915 "command": "echo 'conda activate myenv' >> \"$CLAUDE_ENV_FILE\""
916 }]
917 }]
918 }
919}
920```
921
922The hook writes to `$CLAUDE_ENV_FILE`, which is then sourced before each Bash command. This is ideal for team-shared project configurations.
923
924See [SessionStart hooks](/en/hooks#persisting-environment-variables) for more details on Option 3.
925
401### Extending tools with hooks926### Extending tools with hooks
402 927
403You can run custom commands before or after any tool executes using928You can run custom commands before or after any tool executes using
409 934
410## See also935## See also
411 936
412* [Identity and Access Management](/en/iam#configuring-permissions) - Learn about Claude Code's permission system937* [Identity and Access Management](/en/iam#configuring-permissions) - Permission system overview and how allow/ask/deny rules interact
413* [IAM and access control](/en/iam#enterprise-managed-policy-settings) - Enterprise policy management938* [Tool-specific permission rules](/en/iam#tool-specific-permission-rules) - Detailed patterns for Bash, Read, Edit, WebFetch, MCP, and Task tools, including security limitations
939* [Managed settings](/en/iam#managed-settings) - Managed policy configuration for organizations
414* [Troubleshooting](/en/troubleshooting#auto-updater-issues) - Solutions for common configuration issues940* [Troubleshooting](/en/troubleshooting#auto-updater-issues) - Solutions for common configuration issues
941
942
943---
944
945> To find navigation and other pages in this documentation, fetch the llms.txt file at: https://code.claude.com/docs/llms.txt