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/docs/claude-code/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{
44 "env": {115 "env": {
45 "CLAUDE_CODE_ENABLE_TELEMETRY": "1",116 "CLAUDE_CODE_ENABLE_TELEMETRY": "1",
46 "OTEL_METRICS_EXPORTER": "otlp"117 "OTEL_METRICS_EXPORTER": "otlp"
47 }118 },
119 "companyAnnouncements": [
120 "Welcome to Acme Corp! Review our code guidelines at docs.acme.com",
121 "Reminder: Code reviews required for all PRs",
122 "New security policy in effect"
123 ]
48}124}
49```125```
50 126
53`settings.json` supports a number of options:129`settings.json` supports a number of options:
54 130
55| Key | Description | Example |131| Key | Description | Example |
56| :--------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------- |132| :--------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :---------------------------------------------------------------------- |
57| `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` |
58| `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` |
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"]` |
59| `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"}` |
60| `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` |
61| `permissions` | See table below for structure of permissions. | |139| `permissions` | See table below for structure of permissions. | |
62| `hooks` | Configure custom commands to run before or after tool executions. See [hooks documentation](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...'"}}` |
63| `disableAllHooks` | Disable all [hooks](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` |
64| `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"` |
65| `statusLine` | Configure a custom status line to display context. See [statusLine documentation](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` |
66| `outputStyle` | Configure an output style to adjust the system prompt. See [output styles documentation](output-styles) | `"Explanatory"` |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` |
148| `outputStyle` | Configure an output style to adjust the system prompt. See [output styles documentation](/en/output-styles) | `"Explanatory"` |
67| `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` |
68| `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"` |
69| `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` |
70| `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"]` |
71| `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"]` |
72| `useEnterpriseMcpConfigOnly` | When set in managed-settings.json, restricts MCP servers to only those defined in managed-mcp.json. See [Enterprise MCP configuration](/en/docs/claude-code/mcp#enterprise-mcp-configuration) | `true` |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" }]` |
73| `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/docs/claude-code/mcp#enterprise-mcp-configuration) | `[{ "serverName": "github" }]` |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" }]` |
74| `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/docs/claude-code/mcp#enterprise-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" }]` |
75| `awsAuthRefresh` | Custom script that modifies the `.aws` directory (see [advanced credential configuration](/en/docs/claude-code/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` |
76| `awsCredentialExport` | Custom script that outputs JSON with AWS credentials (see [advanced credential configuration](/en/docs/claude-code/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-thinking-mode) 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` |
77 166
78### Permission settings167### Permission settings
79 168
80| Keys | Description | Example |169| Keys | Description | Example |
81| :----------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------- |170| :----------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------- |
82| `allow` | Array of [permission rules](/en/docs/claude-code/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:*)" ]` |
83| `ask` | Array of [permission rules](/en/docs/claude-code/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:*)" ]` |
84| `deny` | Array of [permission rules](/en/docs/claude-code/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/docs/claude-code/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/**)" ]` |
85| `additionalDirectories` | Additional [working directories](iam#working-directories) that Claude has access to | `[ "../docs/" ]` |174| `additionalDirectories` | Additional [working directories](/en/iam#working-directories) that Claude has access to | `[ "../docs/" ]` |
86| `defaultMode` | Default [permission mode](iam#permission-modes) when opening Claude Code | `"acceptEdits"` |175| `defaultMode` | Default [permission mode](/en/iam#permission-modes) when opening Claude Code | `"acceptEdits"` |
87| `disableBypassPermissionsMode` | Set to `"disable"` to prevent `bypassPermissions` mode from being activated. This disables the `--dangerously-skip-permissions` command-line flag. See [managed policy settings](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** with word boundary. The prefix must be followed by a space or end-of-string. | `Bash(ls:*)` matches `ls -la` but not `lsof` |
223| `*` | Anywhere in pattern | **Glob matching** with no word boundary. Matches any sequence of characters at that position. | `Bash(ls*)` matches both `ls -la` and `lsof` |
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 patterns that try to constrain command arguments are fragile. For example, `Bash(curl http://github.com/:*)` intends to restrict curl to GitHub URLs, but won't match `curl -X GET http://github.com/...` (flags before URL), `curl https://github.com/...` (different protocol), or commands using shell variables. Do not rely on argument-constraining patterns as a security boundary. See [Bash permission limitations](/en/iam#tool-specific-permission-rules) for alternatives.
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).
88 265
89### Sandbox settings266### Sandbox settings
90 267
91Configure advanced sandboxing behavior. Sandboxing isolates bash commands from your filesystem and network. See [Sandboxing](/en/docs/claude-code/sandboxing) for details.268Configure advanced sandboxing behavior. Sandboxing isolates bash commands from your filesystem and network. See [Sandboxing](/en/sandboxing) for details.
92 269
93**Filesystem and network restrictions** are configured via Read, Edit, and WebFetch permission rules, not via these sandbox settings.270**Filesystem and network restrictions** are configured via Read, Edit, and WebFetch permission rules, not via these sandbox settings.
94 271
95| Keys | Description | Example |272| Keys | Description | Example |
96| :-------------------------- | :------------------------------------------------------------------------------------------------------------ | :------------------------ |273| :-------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------ |
97| `enabled` | Enable bash sandboxing (macOS/Linux only). Default: false | `true` |274| `enabled` | Enable bash sandboxing (macOS/Linux only). Default: false | `true` |
98| `autoAllowBashIfSandboxed` | Auto-approve bash commands when sandboxed. Default: true | `true` |275| `autoAllowBashIfSandboxed` | Auto-approve bash commands when sandboxed. Default: true | `true` |
99| `excludedCommands` | Commands that should run outside of the sandbox | `["git", "docker"]` |276| `excludedCommands` | Commands that should run outside of the sandbox | `["git", "docker"]` |
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` |
100| `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"]` |
101| `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` |
102| `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` |
103| `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` |
104| `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` |
127}305}
128```306```
129 307
130**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
316
317Claude Code adds attribution to git commits and pull requests. These are configured separately:
318
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
321
322| Keys | Description |
323| :------- | :----------------------------------------------------------------------------------------- |
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)
131 331
132* Read deny rules block file reads in sandbox332 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
133* Edit allow rules permit file writes (in addition to the defaults, e.g. the current working directory)333```
134* Edit deny rules block writes within allowed paths334
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>
135 355
136**Network access** is controlled via WebFetch permissions:356### File suggestion settings
137 357
138* WebFetch allow rules permit network domains358Configure 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.
139* WebFetch deny rules block network domains359
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```
140 407
141### Settings precedence408### Settings precedence
142 409
143Settings are applied in order of precedence (highest to lowest):410Settings apply in order of precedence. From highest to lowest:
144 411
1451. **Enterprise managed policies** (`managed-settings.json`)4121. **Managed settings** (`managed-settings.json`)
146 * Deployed by IT/DevOps413 * Policies deployed by IT/DevOps to system directories
147 * Cannot be overridden414 * Cannot be overridden by user or project settings
148 415
1492. **Command line arguments**4162. **Command line arguments**
150 * Temporary overrides for a specific session417 * Temporary overrides for a specific session
1585. **User settings** (`~/.claude/settings.json`)4255. **User settings** (`~/.claude/settings.json`)
159 * Personal global settings426 * Personal global settings
160 427
161This 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.
162 431
163### Key points about the configuration system432### Key points about the configuration system
164 433
165* **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
166* **Settings files (JSON)**: Configure permissions, environment variables, and tool behavior435* **Settings files (JSON)**: Configure permissions, environment variables, and tool behavior
167* **Slash commands**: Custom commands that can be invoked during a session with `/command-name`436* **Skills**: Custom prompts that can be invoked with `/skill-name` or loaded by Claude automatically
168* **MCP servers**: Extend Claude Code with additional tools and integrations437* **MCP servers**: Extend Claude Code with additional tools and integrations
169* **Precedence**: Higher-level configurations (Enterprise) override lower-level ones (User/Project)438* **Precedence**: Higher-level configurations (Managed) override lower-level ones (User/Project)
170* **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
171 440
172### System prompt availability441### System prompt
173 442
174<Note>443Claude Code's internal system prompt is not published. To add custom instructions, use `CLAUDE.md` files or the `--append-system-prompt` flag.
175 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.
176</Note>
177 444
178### Excluding sensitive files445### Excluding sensitive files
179 446
180To 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:
181 448
182```json theme={null}449```json theme={null}
183{450{
202* **User subagents**: `~/.claude/agents/` - Available across all your projects469* **User subagents**: `~/.claude/agents/` - Available across all your projects
203* **Project subagents**: `.claude/agents/` - Specific to your project and can be shared with your team470* **Project subagents**: `.claude/agents/` - Specific to your project and can be shared with your team
204 471
205Subagent files define specialized AI assistants with custom prompts and tool permissions. Learn more about creating and using subagents in the [subagents documentation](/en/docs/claude-code/sub-agents).472Subagent files define specialized AI assistants with custom prompts and tool permissions. Learn more about creating and using subagents in the [subagents documentation](/en/sub-agents).
206 473
207## Plugin configuration474## Plugin configuration
208 475
209Claude Code supports a plugin system that lets you extend functionality with custom commands, agents, hooks, and MCP servers. Plugins are distributed through marketplaces and can be configured at both user and repository levels.476Claude Code supports a plugin system that lets you extend functionality with skills, agents, hooks, and MCP servers. Plugins are distributed through marketplaces and can be configured at both user and repository levels.
210 477
211### Plugin settings478### Plugin settings
212 479
215```json theme={null}482```json theme={null}
216{483{
217 "enabledPlugins": {484 "enabledPlugins": {
218 "formatter@company-tools": true,485 "formatter@acme-tools": true,
219 "deployer@company-tools": true,486 "deployer@acme-tools": true,
220 "analyzer@security-plugins": false487 "analyzer@security-plugins": false
221 },488 },
222 "extraKnownMarketplaces": {489 "extraKnownMarketplaces": {
223 "company-tools": {490 "acme-tools": {
224 "source": "github",491 "source": "github",
225 "repo": "company/claude-plugins"492 "repo": "acme-corp/claude-plugins"
226 }493 }
227 }494 }
228}495}
266```json theme={null}533```json theme={null}
267{534{
268 "extraKnownMarketplaces": {535 "extraKnownMarketplaces": {
269 "company-tools": {536 "acme-tools": {
270 "source": {537 "source": {
271 "source": "github",538 "source": "github",
272 "repo": "company-org/claude-plugins"539 "repo": "acme-corp/claude-plugins"
273 }540 }
274 },541 },
275 "security-plugins": {542 "security-plugins": {
276 "source": {543 "source": {
277 "source": "git",544 "source": "git",
278 "url": "https://git.company.com/security/plugins.git"545 "url": "https://git.example.com/security/plugins.git"
279 }546 }
280 }547 }
281 }548 }
288* `git`: Any git URL (uses `url`)555* `git`: Any git URL (uses `url`)
289* `directory`: Local filesystem path (uses `path`, for development only)556* `directory`: Local filesystem path (uses `path`, for development only)
290 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
291### Managing plugins746### Managing plugins
292 747
293Use the `/plugin` command to manage plugins interactively:748Use the `/plugin` command to manage plugins interactively:
298* View plugin details (commands, agents, hooks provided)753* View plugin details (commands, agents, hooks provided)
299* Add/remove marketplaces754* Add/remove marketplaces
300 755
301Learn more about the plugin system in the [plugins documentation](/en/docs/claude-code/plugins).756Learn more about the plugin system in the [plugins documentation](/en/plugins).
302 757
303## Environment variables758## Environment variables
304 759
309</Note>764</Note>
310 765
311| Variable | Purpose |766| Variable | Purpose |
312| :----------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |767| :-------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
313| `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`) |
314| `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 `) |
315| `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) |
316| `ANTHROPIC_DEFAULT_HAIKU_MODEL` | See [Model configuration](/en/docs/claude-code/model-config#environment-variables) |771| `ANTHROPIC_DEFAULT_HAIKU_MODEL` | See [Model configuration](/en/model-config#environment-variables) |
317| `ANTHROPIC_DEFAULT_OPUS_MODEL` | See [Model configuration](/en/docs/claude-code/model-config#environment-variables) |772| `ANTHROPIC_DEFAULT_OPUS_MODEL` | See [Model configuration](/en/model-config#environment-variables) |
318| `ANTHROPIC_DEFAULT_SONNET_MODEL` | See [Model configuration](/en/docs/claude-code/model-config#environment-variables) |773| `ANTHROPIC_DEFAULT_SONNET_MODEL` | See [Model configuration](/en/model-config#environment-variables) |
319| `ANTHROPIC_MODEL` | Name of the model setting to use (see [Model Configuration](/en/docs/claude-code/model-config#environment-variables)) |774| `ANTHROPIC_FOUNDRY_API_KEY` | API key for Microsoft Foundry authentication (see [Microsoft Foundry](/en/microsoft-foundry)) |
320| `ANTHROPIC_SMALL_FAST_MODEL` | \[DEPRECATED] Name of [Haiku-class model for background tasks](/en/docs/claude-code/costs) |775| `ANTHROPIC_MODEL` | Name of the model setting to use (see [Model Configuration](/en/model-config#environment-variables)) |
776| `ANTHROPIC_SMALL_FAST_MODEL` | \[DEPRECATED] Name of [Haiku-class model for background tasks](/en/costs) |
321| `ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION` | Override AWS region for the Haiku-class model when using Bedrock |777| `ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION` | Override AWS region for the Haiku-class model when using Bedrock |
322| `AWS_BEARER_TOKEN_BEDROCK` | Bedrock API key for authentication (see [Bedrock API keys](https://aws.amazon.com/blogs/machine-learning/accelerate-ai-development-with-amazon-bedrock-api-keys/)) |778| `AWS_BEARER_TOKEN_BEDROCK` | Bedrock API key for authentication (see [Bedrock API keys](https://aws.amazon.com/blogs/machine-learning/accelerate-ai-development-with-amazon-bedrock-api-keys/)) |
323| `BASH_DEFAULT_TIMEOUT_MS` | Default timeout for long-running bash commands |779| `BASH_DEFAULT_TIMEOUT_MS` | Default timeout for long-running bash commands |
324| `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 |
325| `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) |
326| `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 |
327| `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`) |
328| `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 |
329| `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) |
330| `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 |
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 |
331| `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` |
332| `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 |
333| `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 |
334| `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. |
335| `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) |
336| `CLAUDE_CODE_SKIP_VERTEX_AUTH` | Skip Google authentication for Vertex (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`) |
337| `CLAUDE_CODE_SUBAGENT_MODEL` | See [Model configuration](/en/docs/claude-code/model-config) |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>` |
338| `CLAUDE_CODE_USE_BEDROCK` | Use [Bedrock](/en/docs/claude-code/amazon-bedrock) |802| `CLAUDE_CODE_SKIP_BEDROCK_AUTH` | Skip AWS authentication for Bedrock (for example, when using an LLM gateway) |
339| `CLAUDE_CODE_USE_VERTEX` | Use [Vertex](/en/docs/claude-code/google-vertex-ai) |803| `CLAUDE_CODE_SKIP_FOUNDRY_AUTH` | Skip Azure authentication for Microsoft Foundry (for example, when using an LLM gateway) |
340| `DISABLE_AUTOUPDATER` | Set to `1` to disable automatic updates. This takes precedence over the `autoUpdates` configuration setting. |804| `CLAUDE_CODE_SKIP_VERTEX_AUTH` | Skip Google authentication for Vertex (for example, when using an LLM gateway) |
805| `CLAUDE_CODE_SUBAGENT_MODEL` | See [Model configuration](/en/model-config) |
806| `CLAUDE_CODE_USE_BEDROCK` | Use [Bedrock](/en/amazon-bedrock) |
807| `CLAUDE_CODE_USE_FOUNDRY` | Use [Microsoft Foundry](/en/microsoft-foundry) |
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 |
810| `DISABLE_AUTOUPDATER` | Set to `1` to disable automatic updates. |
341| `DISABLE_BUG_COMMAND` | Set to `1` to disable the `/bug` command |811| `DISABLE_BUG_COMMAND` | Set to `1` to disable the `/bug` command |
342| `DISABLE_COST_WARNINGS` | Set to `1` to disable cost warning messages |812| `DISABLE_COST_WARNINGS` | Set to `1` to disable cost warning messages |
343| `DISABLE_ERROR_REPORTING` | Set to `1` to opt out of Sentry error reporting |813| `DISABLE_ERROR_REPORTING` | Set to `1` to opt out of Sentry error reporting |
347| `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 |
348| `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 |
349| `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` |
350| `HTTP_PROXY` | Specify HTTP proxy server for network connections |822| `HTTP_PROXY` | Specify HTTP proxy server for network connections |
351| `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 |
352| `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) |
353| `MAX_THINKING_TOKENS` | Enable [extended thinking](/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](/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). |
354| `MCP_TIMEOUT` | Timeout in milliseconds for MCP server startup |827| `MCP_TIMEOUT` | Timeout in milliseconds for MCP server startup |
355| `MCP_TOOL_TIMEOUT` | Timeout in milliseconds for MCP tool execution |828| `MCP_TOOL_TIMEOUT` | Timeout in milliseconds for MCP tool execution |
356| `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 |
357| `SLASH_COMMAND_TOOL_CHAR_BUDGET` | Maximum number of characters for slash command metadata shown to [SlashCommand tool](/en/docs/claude-code/slash-commands#slashcommand-tool) (default: 15000) |830| `SLASH_COMMAND_TOOL_CHAR_BUDGET` | Maximum number of characters for skill metadata shown to the [Skill tool](/en/skills#control-who-invokes-a-skill) (default: 15000). Legacy name kept for backwards compatibility. |
358| `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 |
359| `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 |
360| `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 |
361| `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 |
367Claude 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:
368 841
369| Tool | Description | Permission Required |842| Tool | Description | Permission Required |
370| :--------------- | :----------------------------------------------------------------------------------- | :------------------ |843| :------------------ | :------------------------------------------------------------------------------------------------- | :------------------ |
371| **Bash** | Executes shell commands in your environment | Yes |844| **AskUserQuestion** | Asks multiple-choice questions to gather requirements or clarify ambiguity | No |
845| **Bash** | Executes shell commands in your environment (see [Bash tool behavior](#bash-tool-behavior) below) | Yes |
846| **TaskOutput** | Retrieves output from a background task (bash shell or subagent) | No |
372| **Edit** | Makes targeted edits to specific files | Yes |847| **Edit** | Makes targeted edits to specific files | Yes |
848| **ExitPlanMode** | Prompts the user to exit plan mode and start coding | Yes |
373| **Glob** | Finds files based on pattern matching | No |849| **Glob** | Finds files based on pattern matching | No |
374| **Grep** | Searches for patterns in file contents | No |850| **Grep** | Searches for patterns in file contents | 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 |
375| **NotebookEdit** | Modifies Jupyter notebook cells | Yes |853| **NotebookEdit** | Modifies Jupyter notebook cells | Yes |
376| **NotebookRead** | Reads and displays Jupyter notebook contents | No |
377| **Read** | Reads the contents of files | No |854| **Read** | Reads the contents of files | No |
378| **SlashCommand** | Runs a [custom slash command](/en/docs/claude-code/slash-commands#slashcommand-tool) | Yes |855| **Skill** | Executes a [skill](/en/skills#control-who-invokes-a-skill) within the main conversation | Yes |
379| **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 |
380| **TodoWrite** | Creates and manages structured task lists | No |857| **TodoWrite** | Creates and manages structured task lists | No |
381| **WebFetch** | Fetches content from a specified URL | Yes |858| **WebFetch** | Fetches content from a specified URL | Yes |
382| **WebSearch** | Performs web searches with domain filtering | Yes |859| **WebSearch** | Performs web searches with domain filtering | Yes |
383| **Write** | Creates or overwrites files | Yes |860| **Write** | Creates or overwrites files | Yes |
384 861
385Permission rules can be configured using `/allowed-tools` or in [permission settings](/en/docs/claude-code/settings#available-settings). Also see [Tool-specific permission rules](/en/docs/claude-code/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).
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.
386 925
387### Extending tools with hooks926### Extending tools with hooks
388 927
389You can run custom commands before or after any tool executes using928You can run custom commands before or after any tool executes using
390[Claude Code hooks](/en/docs/claude-code/hooks-guide).929[Claude Code hooks](/en/hooks-guide).
391 930
392For example, you could automatically run a Python formatter after Claude931For example, you could automatically run a Python formatter after Claude
393modifies Python files, or prevent modifications to production configuration932modifies Python files, or prevent modifications to production configuration
395 934
396## See also935## See also
397 936
398* [Identity and Access Management](/en/docs/claude-code/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
399* [IAM and access control](/en/docs/claude-code/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
400* [Troubleshooting](/en/docs/claude-code/troubleshooting#auto-updater-issues) - Solutions for common configuration issues939* [Managed settings](/en/iam#managed-settings) - Managed policy configuration for organizations
940* [Troubleshooting](/en/troubleshooting) - 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