modified
Show diff (109 lines)
--- a/env-vars.md +++ b/env-vars.md @@ -154,14 +154,14 @@ `CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS`| Set to `1` to disable all built-in [subagent](</docs/en/sub-agents>) types such as Explore and Plan. Only applies in non-interactive mode (the `-p` flag). Useful for SDK users who want a blank slate. This also removes `general-purpose`, the subagent Claude Code runs when an Agent tool call omits `subagent_type`. Such a call then fails with [`subagent_type is required`](</docs/en/errors#subagent-type-is-required>) `CLAUDE_AGENT_SDK_MCP_NO_PREFIX`| Set to `1` to skip the `mcp__<server>__` prefix on tool names from SDK-created MCP servers. Tools use their original names. SDK usage only `CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS`| Stall timeout in milliseconds for subagents. Also covers [workflow agents](</docs/en/workflows#when-an-agent-stalls-and-restarts>) on Claude Code v2.1.286 or later. Default `600000` (10 minutes); if you raise `CLAUDE_STREAM_IDLE_TIMEOUT_MS` while the stream watchdog is on, the default rises with it, as [Handle slow or stalled API responses](</docs/en/agent-sdk/typescript#handle-slow-or-stalled-api-responses>) describes -`CLAUDE_AUTOCOMPACT_PCT_OVERRIDE`| Set the percentage (1-100) of the auto-compact window at which auto-compaction triggers. Use lower values like `50` to compact earlier; the variable can’t raise the threshold, so values above the default percentage are ignored. It applies only in sessions that [compact before the model’s context limit](</docs/en/model-config#context-window-and-auto-compaction>). Applies to both main conversations and subagents +`CLAUDE_AUTOCOMPACT_PCT_OVERRIDE`| Set the percentage (1-100) of the auto-compact window at which auto-compaction triggers. Lower values compact earlier in that window, and higher ones stop at its default threshold. It applies only in sessions that [compact before the model’s context limit](</docs/en/model-config#context-window-and-auto-compaction>). On [native 1M models](</docs/en/model-config#default-auto-compact-thresholds>) outside cloud sessions, it makes the default window 1M. Applies to both main conversations and subagents `CLAUDE_AUTO_BACKGROUND_TASKS`| Set to `1` to force-enable automatic backgrounding of long-running agent tasks. When enabled, a [subagent](</docs/en/sub-agents#run-subagents-in-foreground-or-background>) moves to the background after running for approximately two minutes. If Claude queued a tool call such as a file edit behind the subagent, the subagent finishes in the foreground before that call starts. Also enables [automatic backgrounding of long MCP tool calls](</docs/en/mcp#automatic-backgrounding-of-long-tool-calls>) in non-interactive mode on Claude Code v2.1.212 or later `CLAUDE_AX_PREPARK_MS`| In [screen reader mode](</docs/en/accessibility>), how many milliseconds Claude Code waits before it writes a new or changed line. Default `0`, so Claude Code doesn’t wait. Before v2.1.287, the default was `50`. Claude Code caps the wait at `5000`. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). Requires Claude Code v2.1.233 or later `CLAUDE_AX_SCREEN_READER`| Set to `1` to render screen-reader friendly output: flat text without decorative borders or animations. Set to `0` to force screen-reader mode off even when [`axScreenReader`](</docs/en/settings-reference#axscreenreader>) is `true`. The [`--ax-screen-reader`](</docs/en/cli-reference#cli-flags>) flag takes precedence. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). Requires Claude Code v2.1.181 or later `CLAUDE_AX_STARTUP_QUIET_MS`| In [screen reader mode](</docs/en/accessibility>), how many milliseconds Claude Code holds the first interface render after the startup confirmation line. Your screen reader can then speak the line in full before new output interrupts it. Default `3000`. Set `0` to render immediately. Claude Code caps the hold at `600000` (10 minutes). Your first keystroke ends the hold early. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). Requires Claude Code v2.1.217 or later `CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR`| Return to the original working directory after each Bash or PowerShell command in the main session `CLAUDE_BYTE_STREAM_IDLE_TIMEOUT_MS`| Timeout in milliseconds for the byte-level streaming idle watchdog; when set, it takes precedence over `CLAUDE_STREAM_IDLE_TIMEOUT_MS` for that watchdog and leaves the event-level watchdog unchanged. Claude Code clamps this variable to between 10 seconds and 30 minutes. Requires Claude Code v2.1.210 or later -`CLAUDE_CLIENT_PRESENCE_FILE`| Path to a file that an external tool, such as a screen-lock listener, creates when you unlock your screen and deletes when you lock it. While the file exists, Claude Code skips [Remote Control mobile push notifications](</docs/en/remote-control#mobile-push-notifications>), so you stop getting pushes while you are actively using the computer. When the file is absent or unreadable, notifications are sent as normal. Claude Code checks the file once per push-triggering event rather than polling it. Requires Claude Code v2.1.181 or later +`CLAUDE_CLIENT_PRESENCE_FILE`| Path to a file that an external tool, such as a screen-lock listener, creates when you unlock your screen and deletes when you lock it. While the file exists, Claude Code skips [Remote Control mobile push notifications](</docs/en/remote-control#mobile-push-notifications>) for permission prompts and questions, except in [server mode](</docs/en/remote-control#start-a-remote-control-session>). Requires Claude Code v2.1.181 or later `CLAUDE_CODE_ACCESSIBILITY`| Set to `1` to keep the native terminal cursor visible and disable the inverted-text cursor indicator. Allows screen magnifiers like macOS Zoom to track cursor position `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD`| Set to `1` to load memory files from directories specified with `--add-dir`. Loads `CLAUDE.md`, `.claude/CLAUDE.md`, `.claude/rules/*.md`, and `CLAUDE.local.md`. By default, additional directories do not load memory files `CLAUDE_CODE_ALT_SCREEN_FULL_REPAINT`| Set to `1` to repaint the entire screen on every frame in [fullscreen rendering](</docs/en/fullscreen>) instead of sending incremental updates. Use this if fullscreen mode shows stale or misplaced text fragments. Claude Code enables this automatically for background sessions and [agent view](</docs/en/agent-view>) on Windows @@ -172,6 +172,7 @@ `CLAUDE_CODE_ARTIFACT_COMMENTS_AUTOREACT`| Set to `0` to stop Claude [replying on its own to comments sent to it](</docs/en/artifacts#let-claude-reply-to-comments-on-its-own>). Requires Claude Code v2.1.228 or later `CLAUDE_CODE_ARTIFACT_PUBLISH_EDITS`| Set to `0` to stop Claude from [applying small changes](</docs/en/artifacts#turn-off-one-step-artifact-updates>) to an artifact’s local file as part of publishing it. Requires Claude Code v2.1.300 or later `CLAUDE_CODE_ATTRIBUTION_HEADER`| Set to `0` to omit the [attribution block](</docs/en/llm-gateway-protocol#system-prompt-attribution-block>), which carries the client version and a prompt fingerprint, from the start of the system prompt. Caching on a direct connection to the Anthropic API is unaffected either way. In some direct-connection setups, Claude Code keeps the block on [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) classifier requests even when you set `0`. In [System prompt attribution block](</docs/en/llm-gateway-protocol#system-prompt-attribution-block>), check which connections and credentials this covers. Before v2.1.181 the block included a per-request token on custom base URLs and Microsoft Foundry connections, so on those versions set it to `0` when your LLM gateway caches on the request body or forwards requests to a third-party provider, or when you connect to Microsoft Foundry directly +`CLAUDE_CODE_ATTRIBUTION_PROJECT`| Name the claude.ai Project your usage is reported under: its UUID or ID. Set it in the launch environment. Takes precedence over [`attributionProject`](</docs/en/settings-reference#attributionproject>) and your organization’s default, and is sent under the same conditions. Requires Claude Code v2.1.305 or later `CLAUDE_CODE_AUTO_BACKGROUND_WORKER_CHECKIN_SECONDS`| Removed in v2.1.283. Use `CLAUDE_CODE_WORKER_CHECKIN_SCHEDULE` instead `CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the auto-compact window, which is how full the context gets before compaction, to a token count of `100000` or more. Suffixed values such as `200k` require v2.1.304 or later. For precedence over the other ways to set the window and the effect on the status line’s `used_percentage`, see [Set the auto-compact window](</docs/en/model-config#set-the-auto-compact-window>) `CLAUDE_CODE_AUTO_CONNECT_IDE`| Override automatic [IDE connection](</docs/en/vs-code>). By default, Claude Code connects automatically when launched inside a supported IDE’s integrated terminal. Set to `false` to prevent this. Set to `true` to force a connection attempt when auto-detection fails, such as when tmux obscures the parent terminal. Takes precedence over the [`autoConnectIde`](</docs/en/settings-reference#autoconnectide>) global config setting @@ -231,18 +232,19 @@ `CLAUDE_CODE_DISABLE_MTLS_RELOAD_ON_STALE_CONNECTION`| Set to `1` to stop Claude Code from re-reading the [mTLS client certificate and key](</docs/en/network-config#mtls-authentication>) when an API request fails with a connection-level error, such as a connection reset or a TLS handshake error. With the reload disabled, Claude Code loads rotated files only when it next applies settings or at the next startup. Requires Claude Code v2.1.232 or later `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`| Set to any non-empty value, such as `1`, to disable nonessential network traffic: auto-updates, telemetry, error reporting, the `/feedback` command, [Claude-drafted feedback](</docs/en/tools-reference#sendfeedback-tool-behavior>), release notes, the [PR and MR status badge](</docs/en/interactive-mode#pr-review-status>) checks, and availability checks such as the [fast mode](</docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways>) check. It also stops the [background runs of plugin `command` sources](</docs/en/plugins/loading#when-a-command-source-re-runs>), which are local commands rather than network traffic, because they can trigger dependency installs. **Setting it to`0` or `false` still disables this traffic**, unlike most on/off variables; unset the variable to allow it again. Also disables feature-flag fetching, which makes [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable. Official plugin marketplace auto-install isn’t covered; disable it with `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL`. Doesn’t affect [gateway model discovery](</docs/en/llm-gateway-connect#add-gateway-models-to-the-model-picker>), which has its own opt-in `CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK`| Set to `1` to disable the non-streaming fallback when a streaming request fails mid-stream. Useful when a proxy or gateway causes the fallback to produce duplicate tool execution -`CLAUDE_CODE_DISABLE_NOTIFICATION_PRESENCE_CHECK`| Set to `1` to send the `PushNotification` tool’s desktop notification even while you are typing in or focused on the terminal. By default the tool skips both the desktop notification and the [mobile push](</docs/en/remote-control#mobile-push-notifications>) when it detects recent keyboard activity or terminal focus. This variable disables only that local check, so the server can still suppress the mobile push when it detects that you are active. Requires Claude Code v2.1.193 or later +`CLAUDE_CODE_DISABLE_NOTIFICATION_PRESENCE_CHECK`| Set to `1` to keep receiving the `PushNotification` tool’s desktop notification while you are typing in or focused on the terminal. Anthropic’s servers can still suppress the tool’s [mobile push](</docs/en/remote-control#mobile-push-notifications>) when they detect that you are active. Requires Claude Code v2.1.193 or later `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL`| Set to `1` to disable automatic registration of the official plugin marketplace. Claude Code reads the variable when it is about to register the marketplace, usually during a machine’s first interactive launch. If the variable is set at that point, Claude Code skips the registration permanently. Unsetting the variable later doesn’t undo the skip. Run `claude plugin marketplace add anthropics/claude-plugins-official` to register the marketplace at any time `CLAUDE_CODE_DISABLE_PERMISSION_PROMPT_NOTIFY_HOOKS`| Set to `1` to stop Claude Code from running your [`Notification` hooks for unanswered permission requests](</docs/en/hooks#notification>) in sessions where Claude Code sends them to the Agent SDK’s `canUseTool` callback, which is how Claude Desktop and the VS Code extension host Claude Code. Has no effect in terminal sessions. Requires Claude Code v2.1.233 or later `CLAUDE_CODE_DISABLE_POLICY_SKILLS`| Set to `1` to skip loading skills from the system-wide managed skills directory. Useful for container or CI sessions that should not load operator-provisioned skills `CLAUDE_CODE_DISABLE_POWERSHELL_CMD_RM_DENY`| Set to `1` to turn off the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) check that denies the `cmd` built-ins `rd`, `rmdir`, `del`, and `erase` on a [system path](</docs/en/permission-modes#remove-item-in-powershell>), such as a drive root or your home directory. Claude Code ignores this variable in a settings file’s `env` block. Requires Claude Code v2.1.283 or later `CLAUDE_CODE_DISABLE_PROXY_SCHEME_REPAIR`| Set to `1` to have Claude Code stop at startup on a plain `host:port` in `HTTPS_PROXY` or `https_proxy` even when it starts with no terminal. Claude Code ignores it in project and local settings. Requires Claude Code v2.1.327 or later `CLAUDE_CODE_DISABLE_REFUSAL_FALLBACK`| Set to `1` to turn off the [automatic model switch when a safety classifier flags a request](</docs/en/model-config#automatic-model-fallback>), the behavior the [`switchModelsOnFlag`](</docs/en/settings-reference#switchmodelsonflag>) setting controls +`CLAUDE_CODE_DISABLE_REPLAYED_THINKING_PROBE`| Except on a direct connection to the Claude API, Claude Code can [retry a request twice](</docs/en/llm-gateway-protocol#retry-unchanged-then-without-earlier-thinking>) after a `400` or `422` that it doesn’t recognize. The first retry is unchanged, and the second omits the thinking blocks from earlier turns. Set to `1` to turn off both retries. Requires Claude Code v2.1.334 or later `CLAUDE_CODE_DISABLE_RESPONSE_COMPRESSION`| Set to `1` to request uncompressed model responses if your [proxy](</docs/en/network-config#proxy-configuration>) leaves compressed ones unfinished. Not recommended for self-hosted runners or Remote Control. Ignored in project and local settings. Requires Claude Code v2.1.331 or later `CLAUDE_CODE_DISABLE_SHELL_HEAD_START`| Set to `1` to turn off the head start that can run your shell startup files while Claude writes the session’s first Bash command, before that command’s permission prompt. Requires Claude Code v2.1.327 or later `CLAUDE_CODE_DISABLE_SHIP`| Set to `1` to turn off [`/ship` and `/steward`](</docs/en/ship-command#turn-off-%2Fship-and-%2Fsteward-for-your-organization>). Requires Claude Code v2.1.331 or later `CLAUDE_CODE_DISABLE_STRUCTURED_OUTPUTS`| Set to `1` to stop Claude Code from sending the structured-output `output_config.format` field and the `anthropic-beta` value that pairs with it, for an [LLM gateway](</docs/en/llm-gateway-protocol#feature-pass-through>) whose upstream rejects them. This leaves on the other pre-release capabilities that [`CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`](</docs/en/llm-gateway-protocol#disable-pre-release-capabilities>) turns off. Requires Claude Code v2.1.288 or later -`CLAUDE_CODE_DISABLE_SUBSTITUTION_RM_PROMPT`| Set to `1` to turn off the [critical-path](</docs/en/permission-modes#critical-paths>) check for a recursive `rm` whose target is entirely the output of a command substitution, such as `rm -rf "$(pwd)"`. The other critical-path checks keep running. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.281 or later +`CLAUDE_CODE_DISABLE_SUBSTITUTION_RM_PROMPT`| Set to `1` to turn off the [critical-path](</docs/en/permission-modes#critical-paths>) check for a recursive `rm` whose target is entirely the output of a command substitution, such as `rm -rf "$(cat target.txt)"`. The other critical-path checks keep running. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.281 or later `CLAUDE_CODE_DISABLE_TERMINAL_TITLE`| Set to `1` to disable automatic terminal title updates based on conversation context. This also skips the background small/fast-model request that [generates a session title](</docs/en/sessions#name-your-sessions>), and turns off [status reports to your terminal](</docs/en/terminal-config#see-session-status-in-your-terminal>) `CLAUDE_CODE_DISABLE_THINKING`| Set to `1` to omit the `thinking` parameter from the API requests for the main conversation’s turns, subagent turns, and the compaction summary. This is a compatibility option for proxies and gateways that reject the parameter. On models that think by default, the model may still think. To explicitly disable [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) on the Anthropic API, use `MAX_THINKING_TOKENS=0` instead. See [where you can’t turn thinking off](</docs/en/model-config#where-you-cant-turn-thinking-off>) `CLAUDE_CODE_DISABLE_ULTRAREVIEW_TRUST_CHECK`| Set to `1` so [`claude ultrareview`](</docs/en/ultrareview#trust-the-folder-before-the-review-runs>) doesn’t exit with `Error: Workspace not trusted` when run without a terminal or with `CI=true`. `claude ultrareview` still asks when it can. From v2.1.314, the variable also skips the trust check in `/ultrareview` and `/code-review ultra`. Set it in the launch environment, not a settings `env` block, and only where every review starts in a folder you trust. Requires Claude Code v2.1.309 or later @@ -295,7 +297,7 @@ `CLAUDE_CODE_IDE_SKIP_VALID_CHECK`| Set to `1` to skip validation of IDE lockfile entries during connection. Use when auto-connect fails to find your IDE despite it running `CLAUDE_CODE_IDLE_COMPACT_MIN_TOKENS`| Context size, in tokens, at which [idle compaction](</docs/en/settings-reference#idlecompaction>) applies to a conversation (default: `200000`). Accepts a positive whole number, and anything else is ignored. Values below `100000` are raised to `100000`, the lowest threshold. Idle compaction is on by default for conversations that meet its conditions. To turn it off, set `idleCompaction` to `false`. Requires Claude Code v2.1.290 or later `CLAUDE_CODE_LOOP_KEEPALIVE`| Set to `1` to run one extra iteration of an interactive [self-paced `/loop`](</docs/en/scheduled-tasks#stop-a-loop>) when its second or later iteration ends with nothing scheduled -`CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS`| How many [subagents](</docs/en/sub-agents#concurrent-subagent-limit>) can be running in one session before the Agent tool refuses to spawn another (default: 20). Accepts a positive whole number in plain digits; anything else is ignored, so the variable can adjust the cap but can’t disable it. Requires Claude Code v2.1.217 or later +`CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS`| How many [subagents](</docs/en/sub-agents#concurrent-subagent-limit>) can be running in one session before the Agent tool refuses to spawn another (default: at least 20). Accepts a positive whole number in plain digits; anything else is ignored, so the variable can adjust the cap but can’t disable it. Requires Claude Code v2.1.217 or later `CLAUDE_CODE_MAX_CONTEXT_TOKENS`| Override the context window size Claude Code assumes for the active model. As of v2.1.193, how it applies depends on how Claude Code resolves the model ID; see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>). Use this when routing to a model through `ANTHROPIC_BASE_URL` whose context window does not match the built-in size for its name `CLAUDE_CODE_MAX_MCP_DESCRIPTION_LENGTH`| Maximum length in characters of MCP tool descriptions and MCP server instructions that Claude Code sends to the model. The value you set replaces both [default limits](</docs/en/mcp#for-mcp-server-authors>): 4096, and 16384 for the description of a tool that Claude loads through tool search. Accepts a positive whole number in plain digits. Anything else is ignored and the defaults apply. Requires Claude Code v2.1.280 or later `CLAUDE_CODE_MAX_OUTPUT_TOKENS`| Set the maximum number of output tokens for most requests. Defaults and caps vary by model; see [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>). Claude Code lowers a value above a model’s cap to the cap. For a model ID Claude Code [can’t resolve to a model it knows](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>), the default is 32000 and the cap is 128000 @@ -323,7 +325,7 @@ `CLAUDE_CODE_OTEL_DIAG_STDERR`| Set to `1` to write OpenTelemetry exporter diagnostic errors to stderr. By default these errors only appear with `--debug`, so a misconfigured exporter such as a Prometheus port collision otherwise fails silently. Requires Claude Code v2.1.179 or later. See [Monitoring](</docs/en/monitoring-usage>) `CLAUDE_CODE_OTEL_FLUSH_TIMEOUT_MS`| Timeout in milliseconds for flushing pending OpenTelemetry spans (default: 5000). See [Monitoring](</docs/en/monitoring-usage>) `CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS`| Interval for refreshing dynamic OpenTelemetry headers in milliseconds (default: 1740000 / 29 minutes). See [Dynamic headers](</docs/en/monitoring-usage#dynamic-headers>) -`CLAUDE_CODE_OTEL_SHUTDOWN_TIMEOUT_MS`| Timeout in milliseconds for the OpenTelemetry exporter to finish on shutdown (default: 2000). Increase if metrics are dropped at exit. See [Monitoring](</docs/en/monitoring-usage>) +`CLAUDE_CODE_OTEL_SHUTDOWN_TIMEOUT_MS`| Timeout in milliseconds for the OpenTelemetry exporter to finish on shutdown (default: 2000). See [Monitoring](</docs/en/monitoring-usage>) `CLAUDE_CODE_OVERLOADED_RETRY_BASE_DELAY_MS`| Starting delay in milliseconds of the backoff between retries of a request that the API rejects with a `529` overloaded error (default: 500). Raise it to spread the retries over a longer window when the API is at capacity. Give whole milliseconds from 500 to 32000 in plain digits; Claude Code treats any other value as unset. See [when it has no effect](</docs/en/errors#tune-retry-behavior>). Requires Claude Code v2.1.292 or later `CLAUDE_CODE_OVERLOADED_RETRY_MAX_DELAY_MS`| Ceiling in milliseconds on the backoff between retries of a request that the API rejects with a `529` overloaded error (default: 32000). Raise it so that later retries keep spreading apart. Give whole milliseconds from 32000 to 300000 in plain digits; Claude Code treats any other value as unset. Values above 64000 require v2.1.323 or later. See [when it has no effect](</docs/en/errors#tune-retry-behavior>). Requires Claude Code v2.1.296 or later `CLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATE`| Set to `1` to let Claude Code run your package manager’s upgrade command in the background when a new version is available. Applies to Homebrew and WinGet installations. Other package managers continue to show the upgrade command without running it. See [Auto updates](</docs/en/setup#auto-updates>) @@ -354,7 +356,7 @@ `CLAUDE_CODE_RETRY_WATCHDOG`| Set to `1` for unattended sessions. Keeps retrying `429` and `529` capacity errors past `CLAUDE_CODE_MAX_RETRIES`. Spend limits and exhausted usage credits [can end the retries](</docs/en/errors#when-the-retry-watchdog-stops-retrying>). See [retry limits](</docs/en/errors#tune-retry-behavior>) and [fast mode](</docs/en/fast-mode#handle-rate-limits>). Requires Claude Code v2.1.186 or later `CLAUDE_CODE_RETRY_WATCHDOG_MAX_WAIT_MS`| Maximum time in milliseconds that each API request spends waiting out `429` and `529` errors when `CLAUDE_CODE_RETRY_WATCHDOG` is set. Once that time is spent, the next such error ends the request. Give a positive whole number in plain digits, such as `1800000` for 30 minutes. When unset, the wait has no limit. Requires Claude Code v2.1.295 or later `CLAUDE_CODE_RETRY_WATCHDOG_USAGE_LIMIT_RECHECK_MS`| Minimum interval in milliseconds between checks of whether a [usage limit](</docs/en/errors#youve-hit-your-session-limit>) was already lifted, while a request waits for that limit to reset with `CLAUDE_CODE_RETRY_WATCHDOG` set. When a check finds the limit lifted, the request goes out at once. Give a whole number in plain digits from `60000`, one minute, to `10800000`, three hours. Checks are made only for a claude.ai subscription’s session or weekly limit while usage credits aren’t in use, and not while `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` is set. When this variable is unset or its value is outside that range, no checks are made. Requires Claude Code v2.1.305 or later -`CLAUDE_CODE_SAFE_MODE`| Set to `1` to start in safe mode: CLAUDE.md, skills, plugins, hooks, MCP servers, custom commands and agents, output styles, workflows, custom themes, custom keybindings, status line and file-suggestion commands, LSP servers, and auto memory do not load, for troubleshooting a broken configuration. Managed settings policy still applies, including policy-configured hooks, status line, and file-suggestion commands; managed plugins, managed skills, managed CLAUDE.md, and policy-configured MCP servers do not. Equivalent to passing [`--safe-mode`](</docs/en/cli-reference#cli-flags>). Directly spawned child processes inherit the variable +`CLAUDE_CODE_SAFE_MODE`| Set to `1` to start in safe mode and troubleshoot a broken configuration. With `--bg`, pass [`--safe-mode`](</docs/en/cli-reference#cli-flags>) instead. [Some managed configuration stays on](</docs/en/debug-your-config#test-against-a-clean-configuration>) `CLAUDE_CODE_SCRIPT_CAPS`| JSON object limiting how many times specific scripts may be invoked per session when `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB` is set. Keys are substrings matched against the command text; values are integer call limits. For example, `{"deploy.sh": 2}` allows `deploy.sh` to be called at most twice. Matching is substring-based so shell-expansion tricks like `./scripts/deploy.sh $(evil)` still count against the cap. Runtime fan-out via `xargs` or `find -exec` is not detected; this is a defense-in-depth control `CLAUDE_CODE_SCROLL_SPEED`| Set the mouse wheel scroll multiplier in [fullscreen rendering](</docs/en/fullscreen#mouse-wheel-scrolling>). Accepts any positive value up to 20, including fractional values below 1 such as `0.5` to slow accelerated trackpad and wheel scrolling in terminals that already amplify wheel events. Set to `3` to match `vim` if your terminal sends one wheel event per notch without amplification. Ignored in the JetBrains IDE terminal, where Claude Code uses its own scroll handling `CLAUDE_CODE_SEND_FEEDBACK`| Set to `0` to turn off [Claude-drafted feedback](</docs/en/tools-reference#sendfeedback-tool-behavior>) for a session. Set to `1` to turn it on where your account already has access; the variable can’t grant access itself, and the other switches that turn feedback off, such as `DISABLE_FEEDBACK_COMMAND` and the [`feedbackDrafts`](</docs/en/settings-reference#feedbackdrafts>) setting’s `off` value, still apply @@ -396,7 +398,7 @@ `CLAUDE_CODE_TOOL_MEMORY_CGROUP_EXCLUDE`| On Linux and WSL, set to a comma-separated list of the kinds of processes Claude Code [excludes from the tool memory cap](</docs/en/tools-reference#memory-limit-on-linux-and-wsl>), such as `mcp` or `lsp`. Set `none` to cap every kind, or `all-new` to cap only Bash, PowerShell, and Monitor tool commands. Claude Code keeps Bash, PowerShell, and Monitor tool commands under the cap whatever you list. Requires Claude Code v2.1.246 or later `CLAUDE_CODE_TOOL_MEMORY_LIMIT`| On Linux and WSL, set to a size such as `4G` to [cap the memory that Bash and PowerShell tool commands can use](</docs/en/tools-reference#memory-limit-on-linux-and-wsl>), and Monitor tool commands on v2.1.246 or later. Write the size in plain digits, alone for a number of bytes or with a `K`, `M`, `G`, or `T` suffix. Set `0` or `off` to turn the cap off. Once the first process Claude Code starts has turned the cap on or off, a changed value takes effect the next time you launch `claude`. Requires Claude Code v2.1.233 or later `CLAUDE_CODE_TRANSCRIPT_LOCAL_GC`| Set to `1` to limit how large the [transcript file](</docs/en/sessions#where-transcripts-are-stored>) of a long `-p` or Agent SDK session grows. After each compaction, once the file is larger than 5 MB, Claude Code removes the history from before that compaction. On v2.1.296 or later, the file stays as it is when removing that history would shrink it by less than 10%. Resuming the session restores the same conversation whether or not the file was trimmed. Set it in the environment you start Claude Code from, since a settings `env` block can’t turn it on. Requires Claude Code v2.1.287 or later -`CLAUDE_CODE_USER_DIALOG_TIMEOUT_MS`| Deadline in milliseconds for the dialogs that [`dialogExpiry`](</docs/en/settings-reference#dialogexpiry>) covers. Overrides that setting. For held cross-session messages, see [Control inbound messages](</docs/en/cross-session-messaging#control-inbound-messages>) and [non-interactive sessions](</docs/en/cross-session-messaging#non-interactive-sessions>). `0` or a negative value disables the deadline. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) +`CLAUDE_CODE_USER_DIALOG_TIMEOUT_MS`| Deadline in milliseconds for the dialogs that [`dialogExpiry`](</docs/en/settings-reference#dialogexpiry>) covers. Overrides that setting. `0` or a negative value disables the deadline. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) `CLAUDE_CODE_USE_ANTHROPIC_AWS`| Use [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) `CLAUDE_CODE_USE_ANTHROPIC_GOOGLE_CLOUD`| Use [Claude Models on Google Cloud (Anthropic managed)](</docs/en/claude-models-on-google-cloud-anthropic-managed>) `CLAUDE_CODE_USE_BEDROCK`| Use [Amazon Bedrock](</docs/en/amazon-bedrock>) @@ -427,10 +429,10 @@ `CLAUDE_SUBAGENT_BG_SHELL_MAX_MS`| Removed in v2.1.260 and now a no-op. Previously capped how long a [background shell command](</docs/en/interactive-mode#background-bash-commands>) that a [subagent](</docs/en/sub-agents>) started could run, in milliseconds, with a 60-minute default. See [the background command lifetime rules](</docs/en/tools-reference#background-commands>) `DEBUG`| Set to `1` to enable debug mode, equivalent to launching with [`--debug`](</docs/en/cli-reference#cli-flags>). Debug logs are written to `~/.claude/debug/<session-id>.txt`, or to the path set by `CLAUDE_CODE_DEBUG_LOGS_DIR`. Only the truthy values `1`, `true`, `yes`, and `on` enable debug mode, so namespace patterns like `DEBUG=express:*` set for other tools do not trigger it `DISABLE_AUTOUPDATER`| Set to `1` to disable automatic background updates. Manual `claude update` still works. Use `DISABLE_UPDATES` to block both -`DISABLE_AUTO_COMPACT`| Set to `1` to disable automatic compaction when approaching the context limit, along with [idle compaction](</docs/en/settings-reference#idlecompaction>). The manual `/compact` command remains available. Use when you want explicit control over when compaction occurs. Overrides the [`autoCompactEnabled`](</docs/en/settings-reference#autocompactenabled>) setting +`DISABLE_AUTO_COMPACT`| Set to `1` to disable automatic compaction, along with [idle compaction](</docs/en/settings-reference#idlecompaction>). The manual `/compact` command remains available. Use when you want explicit control over when compaction occurs. Overrides the [`autoCompactEnabled`](</docs/en/settings-reference#autocompactenabled>) setting `DISABLE_COMPACT`| Set to `1` to disable all compaction, including `/compact` and the [rewind menu’s summarize options](</docs/en/checkpointing#rewind-and-summarize>) `DISABLE_COST_WARNINGS`| Set to `1` to disable cost warning messages -`DISABLE_DOCTOR_COMMAND`| Set to `1` to hide the [`/doctor`](</docs/en/commands#all-commands>) setup checkup skill and its `/checkup` alias. Useful for managed deployments where users shouldn’t run setup diagnostics from a session. Doesn’t affect the `claude doctor` terminal command. Before v2.1.205, this variable hid the `/doctor` diagnostics screen command +`DISABLE_DOCTOR_COMMAND`| Set to `1` to hide the [`/doctor`](</docs/en/commands#all-commands>) setup checkup skill and its `/checkup` alias. Useful for managed deployments where users shouldn’t run setup diagnostics from a session. The `claude doctor` terminal command still runs. Before v2.1.205, this variable hid the `/doctor` diagnostics screen command `DISABLE_ERROR_REPORTING`| Set to any non-empty value, such as `1`, to opt out of error reporting. **Setting it to`0` or `false` still opts out**, unlike most on/off variables; unset the variable to turn error reporting back on `DISABLE_EXTRA_USAGE_COMMAND`| Set to `1` to hide the `/usage-credits` command that lets users purchase additional usage beyond rate limits `DISABLE_FEEDBACK_COMMAND`| Set to `1` to disable the `/feedback` command and [Claude-drafted feedback](</docs/en/tools-reference#sendfeedback-tool-behavior>). Also disables `/bug` and `/share`, which report through the same path; before v2.1.212 they were aliases of `/feedback`, so the command was disabled under every name. The older name `DISABLE_BUG_COMMAND` is also accepted @@ -559,8 +561,9 @@ * Use [the advisor tool](</docs/en/advisor#requirements>), except with Claude Code v2.1.300 or later on Claude Platform on AWS or [Claude Models on Google Cloud (Anthropic managed)](</docs/en/feature-availability#availability-by-model-provider>) * Use [MCP tasks](</docs/en/mcp#requirements-for-mcp-tasks>) outside an interactive terminal session, or from a subagent * Use [skills from MCP servers](</docs/en/mcp#use-skills-from-mcp-servers>) + * Run [`claude mcp add --web`](</docs/en/mcp#add-a-connector-from-your-terminal>) * Have Claude read [another organization’s public artifact](</docs/en/artifacts#read-an-artifact-shared-with-you>) - * Publish a design system as an artifact with [`/design-sync`](</docs/en/artifacts#design-sync-requirements>) + * Publish a design system as an artifact with `/design-sync`, unless you’re on v2.1.334 or later and turned fetching off with `DISABLE_TELEMETRY`, `DO_NOT_TRACK`, or `CLAUDE_CODE_DISABLE_FEATURE_FLAGS`. In that case, check the other [`/design-sync` requirements](</docs/en/artifacts#design-sync-requirements>) * Get the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) by default for claude.ai and Console accounts on Windows with Git Bash installed; Claude Code routes shell commands through Git Bash unless you set `CLAUDE_CODE_USE_POWERSHELL_TOOL=1`. On Windows without Git Bash, the tool stays on * Get [Claude-drafted feedback](</docs/en/tools-reference#sendfeedback-tool-behavior>), which Claude Code turns on through a fetched flag
modified
--- a/env-vars.md +++ b/env-vars.md @@ -275,9 +275,9 @@ `CLAUDE_CODE_EXTRA_BODY`| JSON object to merge into the top level of model request bodies except on some requests outside the conversation, such as `/model` checks. Useful for passing provider-specific parameters that Claude Code doesn’t expose directly. A value exported in your shell also applies to the [background sessions](</docs/en/agent-view>) you dispatch with `claude agents` or `--bg`. Before v2.1.206, background sessions ignored a shell-exported value and used whatever copy the background supervisor process inherited `CLAUDE_CODE_FILE_READ_MAX_OUTPUT_TOKENS`| Override the default token limit for [file reads](</docs/en/tools-reference#large-files>), which is 25,000 tokens. Useful when you need to read larger files in full. A read that Claude makes with the `allow_large` parameter can go past this limit when the context window has room `CLAUDE_CODE_FORCE_SESSION_PERSISTENCE`| Set to `1` to force transcript persistence, prompt history, and `claude agents` registration even when this `claude` was launched from inside another Claude Code session. Use when an inherited `CLAUDE_CODE_CHILD_SESSION` value, for example from a `screen` session or a background launcher first started by Claude Code’s Bash tool, causes a genuine top-level session to be misclassified as nested. As of v2.1.178, Claude Code detects the tmux case automatically and ignores the inherited marker, so tmux no longer needs this variable. Also honored on v2.1.169 and earlier; has no effect on v2.1.170 and v2.1.171, where the nested-session detection it overrides was removed -`CLAUDE_CODE_FORCE_STRIKETHROUGH`| Set to `1` to force strikethrough rendering for `~~text~~` in Claude’s responses when your terminal supports it but is not auto-detected, such as over SSH without `TERM_PROGRAM` forwarded. Without this, undetected terminals show the literal `~~` markers instead of rendering the text as strikethrough. Requires Claude Code v2.1.186 or later +`CLAUDE_CODE_FORCE_STRIKETHROUGH`| Set to `1` to force strikethrough rendering for `~~text~~` in Claude’s responses when your terminal supports it but is not auto-detected, such as over SSH without `TERM_PROGRAM` forwarded. Without this, undetected terminals show the literal `~~` markers instead of rendering the text as strikethrough `CLAUDE_CODE_FORCE_SYNC_OUTPUT`| Set to `1` to force-enable DEC private mode 2026 [synchronized output](<https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036>) when your terminal supports it but is not auto-detected. Useful for emulators such as Emacs `eat` that implement BSU/ESU but do not reply to the capability probe. Has no effect under tmux. Unlike `CLAUDE_CODE_NO_FLICKER`, which switches to [fullscreen rendering](</docs/en/fullscreen>), this doesn’t change the renderer -`CLAUDE_CODE_FORCE_TERMINAL_IMAGES`| Set to `1` to draw [mod `Image` elements](</docs/en/plugins/mods/reference#elements>) as pictures when your terminal draws kitty graphics protocol images with Unicode placeholders and you still see an `Image`’s dimmed `alt` text. See [which terminals draw an `Image` and where not to set this variable](</docs/en/plugins/mods/gallery#image-and-client>) +`CLAUDE_CODE_FORCE_TERMINAL_IMAGES`| Set to `1` to draw [mod `Image` elements](</docs/en/plugins/mods/interface#build-a-tree-from-elements>) as pictures when your terminal draws kitty graphics protocol images with Unicode placeholders and you still see an `Image`’s dimmed `alt` text. See [which terminals draw an `Image` and where not to set this variable](</docs/en/plugins/mods/gallery#image-and-client>) `CLAUDE_CODE_FORK_SUBAGENT`| Controls fork mode, which is on by default and lets Claude start [forks](</docs/en/sub-agents#fork-the-current-conversation>) on its own. Set to `0` to turn fork mode off, for example to [let Claude wait for a subagent](</docs/en/sub-agents#let-claude-wait-for-a-subagent>). For versions, see [Turn fork mode off](</docs/en/sub-agents#turn-fork-mode-on-or-off>) `CLAUDE_CODE_FORWARD_SUBAGENT_TEXT`| Set to `1` to emit [subagent](</docs/en/sub-agents>) text and thinking blocks in `claude -p --output-format stream-json` output, the same behavior as the [`--forward-subagent-text`](</docs/en/cli-reference#cli-flags>) flag. Use the variable when a harness invokes `claude` and can’t pass the flag itself. Unlike the flag, which exits with an error outside non-interactive mode with stream-json output, the variable is ignored there so that nested invocations keep working when it’s set process-wide. Requires Claude Code v2.1.211 or later `CLAUDE_CODE_FULL_SIGN_IN_LINK`| Set to `1` to print the full login URL. Use it when a short login URL shows an error or your script reads values from the URL. Set it in your shell or user settings. Requires Claude Code v2.1.330 or later @@ -330,7 +330,7 @@ `CLAUDE_CODE_PERFORCE_MODE`| Set to `1` to enable Perforce-aware write protection. When set, Edit, Write, and NotebookEdit fail with a `p4 edit <file>` hint if the target file lacks the owner-write bit, which Perforce clears on synced files until `p4 edit` opens them. This prevents Claude Code from bypassing Perforce change tracking `CLAUDE_CODE_PLUGIN_CACHE_DIR`| Override the plugins root directory. Despite the name, this sets the parent directory, not the cache itself: marketplaces and the plugin cache live in subdirectories under this path. Defaults to `~/.claude/plugins` `CLAUDE_CODE_PLUGIN_DIRS`| Plugin directories to load for the session, each loaded the way a [`--plugin-dir`](</docs/en/plugins/cli-reference#flags-that-load-a-plugin-for-one-session>) flag loads it. Separate multiple paths with `:` on Unix or `;` on Windows. Give each path as an absolute path or start it with `~`, because Claude Code skips relative paths. Requires Claude Code v2.1.280 or later. See [Load a plugin for one session](</docs/en/plugins/create#load-a-directory-or-archive-for-one-session>) -`CLAUDE_CODE_PLUGIN_DIR_WATCH`| Controls whether a [mod](</docs/en/plugins/mods/overview>) reloads when its files change. By default, mods in [skills directories](</docs/en/plugins/org#keep-skills-directory-plugins-loading>) reload in any session that takes more than one prompt, [non-interactive](</docs/en/headless>) included. Mods in `--plugin-dir` directories reload only in interactive terminal sessions. Set to `1` to reload them as skills-directory mods do, or `0` to turn reloading off everywhere. Requires Claude Code v2.1.287 or later +`CLAUDE_CODE_PLUGIN_DIR_WATCH`| Controls whether a [mod](</docs/en/plugins/mods/overview>) reloads when its code changes. By default, mods in [skills directories](</docs/en/plugins/org#keep-skills-directory-plugins-loading>) reload in any session that takes more than one prompt, [non-interactive](</docs/en/headless>) included. Mods in `--plugin-dir` directories reload only in interactive terminal sessions. Set to `1` to reload them as skills-directory mods do, or `0` to turn reloading off everywhere. Requires Claude Code v2.1.287 or later `CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS`| Timeout in milliseconds for cloning or refreshing a plugin marketplace (default: 120000). Increase this value for large repositories or slow network connections. See [Git clone timed out](</docs/en/plugins/troubleshooting#git-clone-timed-out-after-120s>) `CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE`| Set to `1` to skip the re-clone attempt and keep using the existing marketplace checkout when a marketplace refresh can’t reach or authenticate to the remote. Useful in offline or airgapped environments where re-cloning would fail the same way. See [Marketplace updates fail in offline environments](</docs/en/plugins/troubleshooting#marketplace-updates-keep-failing-offline>) `CLAUDE_CODE_PLUGIN_PREFER_HTTPS`| Set to `1` to clone GitHub `owner/repo` shorthand sources over HTTPS instead of SSH. Applies to plugin install and update, and to `/plugin marketplace add` and `update`. Useful in CI runners, containers, or any environment without a configured SSH key for `github.com` @@ -509,9 +509,9 @@ `VERTEX_REGION_CLAUDE_4_8_OPUS`| Override region for Claude Opus 4.8 when using Google Cloud’s Agent Platform `VERTEX_REGION_CLAUDE_5_5_OPUS`| Override region for Claude Opus 5.5 when using Google Cloud’s Agent Platform. Added in v2.1.280 `VERTEX_REGION_CLAUDE_5_5_SONNET`| Override region for Claude Sonnet 5.5 when using Google Cloud’s Agent Platform. Added in v2.1.284 -`VERTEX_REGION_CLAUDE_5_OPUS`| Override region for Claude Opus 5 when using Google Cloud’s Agent Platform. Added in v2.1.219 -`VERTEX_REGION_CLAUDE_5_SONNET`| Override region for Claude Sonnet 5 when using Google Cloud’s Agent Platform. Added in v2.1.197 -`VERTEX_REGION_CLAUDE_FABLE_5`| Override region for Claude Fable 5 when using Google Cloud’s Agent Platform. Added in v2.1.170 +`VERTEX_REGION_CLAUDE_5_OPUS`| Override region for Claude Opus 5 when using Google Cloud’s Agent Platform +`VERTEX_REGION_CLAUDE_5_SONNET`| Override region for Claude Sonnet 5 when using Google Cloud’s Agent Platform +`VERTEX_REGION_CLAUDE_FABLE_5`| Override region for Claude Fable 5 when using Google Cloud’s Agent Platform `VERTEX_REGION_CLAUDE_FABLE_5_1`| Override region for Claude Fable 5.1 when using Google Cloud’s Agent Platform. Added in v2.1.257 `VERTEX_REGION_CLAUDE_FABLE_5_2`| Override region for Claude Fable 5.2 when using Google Cloud’s Agent Platform. Added in v2.1.321 `VERTEX_REGION_CLAUDE_HAIKU_4_5`| Override region for Claude Haiku 4.5 when using Google Cloud’s Agent Platform
modified
--- a/env-vars.md +++ b/env-vars.md @@ -396,7 +396,7 @@ `CLAUDE_CODE_TOOL_MEMORY_CGROUP_EXCLUDE`| On Linux and WSL, set to a comma-separated list of the kinds of processes Claude Code [excludes from the tool memory cap](</docs/en/tools-reference#memory-limit-on-linux-and-wsl>), such as `mcp` or `lsp`. Set `none` to cap every kind, or `all-new` to cap only Bash, PowerShell, and Monitor tool commands. Claude Code keeps Bash, PowerShell, and Monitor tool commands under the cap whatever you list. Requires Claude Code v2.1.246 or later `CLAUDE_CODE_TOOL_MEMORY_LIMIT`| On Linux and WSL, set to a size such as `4G` to [cap the memory that Bash and PowerShell tool commands can use](</docs/en/tools-reference#memory-limit-on-linux-and-wsl>), and Monitor tool commands on v2.1.246 or later. Write the size in plain digits, alone for a number of bytes or with a `K`, `M`, `G`, or `T` suffix. Set `0` or `off` to turn the cap off. Once the first process Claude Code starts has turned the cap on or off, a changed value takes effect the next time you launch `claude`. Requires Claude Code v2.1.233 or later `CLAUDE_CODE_TRANSCRIPT_LOCAL_GC`| Set to `1` to limit how large the [transcript file](</docs/en/sessions#where-transcripts-are-stored>) of a long `-p` or Agent SDK session grows. After each compaction, once the file is larger than 5 MB, Claude Code removes the history from before that compaction. On v2.1.296 or later, the file stays as it is when removing that history would shrink it by less than 10%. Resuming the session restores the same conversation whether or not the file was trimmed. Set it in the environment you start Claude Code from, since a settings `env` block can’t turn it on. Requires Claude Code v2.1.287 or later -`CLAUDE_CODE_USER_DIALOG_TIMEOUT_MS`| Deadline in milliseconds before Claude Code cancels a dialog it forwards to a remote client such as a [Remote Control](</docs/en/remote-control>) or SDK host, or the approval dialog for a [held cross-session message](</docs/en/cross-session-messaging#control-inbound-messages>); permission prompts and `AskUserQuestion` questions use their own flows and aren’t governed by it. On Claude Code v2.1.236 or later, it also bounds the mid-session [Fable usage-credits consent prompt](</docs/en/model-config#fable-and-usage-credits>) in a session that may be running unattended. [Control inbound messages](</docs/en/cross-session-messaging#control-inbound-messages>) and [non-interactive sessions](</docs/en/cross-session-messaging#non-interactive-sessions>) cover the full held-message expiry rules, including the cases where the deadline doesn’t apply. Overrides the [`dialogExpiry`](</docs/en/settings-reference#dialogexpiry>) setting. `0` or a negative value disables the deadline. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) +`CLAUDE_CODE_USER_DIALOG_TIMEOUT_MS`| Deadline in milliseconds for the dialogs that [`dialogExpiry`](</docs/en/settings-reference#dialogexpiry>) covers. Overrides that setting. For held cross-session messages, see [Control inbound messages](</docs/en/cross-session-messaging#control-inbound-messages>) and [non-interactive sessions](</docs/en/cross-session-messaging#non-interactive-sessions>). `0` or a negative value disables the deadline. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) `CLAUDE_CODE_USE_ANTHROPIC_AWS`| Use [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) `CLAUDE_CODE_USE_ANTHROPIC_GOOGLE_CLOUD`| Use [Claude Models on Google Cloud (Anthropic managed)](</docs/en/claude-models-on-google-cloud-anthropic-managed>) `CLAUDE_CODE_USE_BEDROCK`| Use [Amazon Bedrock](</docs/en/amazon-bedrock>) @@ -554,12 +554,13 @@ * Run [`/restart`](</docs/en/commands>) on Pro, Max, and Ultra plans * Run [`/ship` or `/steward`](</docs/en/ship-command>), except with Claude Code v2.1.331 or later on a third-party provider or in a Claude apps gateway session * Run [`/claude-approvals`](</docs/en/commands>) - * Sync the [skills](</docs/en/skills#where-synced-skills-load>) and [plugins](</docs/en/plugins/loading#synced-plugins>) enabled for your claude.ai account into your terminal sessions + * Automatically sync the [skills](</docs/en/skills#where-synced-skills-load>) and [plugins](</docs/en/plugins/loading#synced-plugins>) enabled for your claude.ai account into your terminal sessions * Turn on the [You should know mod](</docs/en/interactive-mode#you-should-know-suggestions>) * Use [the advisor tool](</docs/en/advisor#requirements>), except with Claude Code v2.1.300 or later on Claude Platform on AWS or [Claude Models on Google Cloud (Anthropic managed)](</docs/en/feature-availability#availability-by-model-provider>) * Use [MCP tasks](</docs/en/mcp#requirements-for-mcp-tasks>) outside an interactive terminal session, or from a subagent * Use [skills from MCP servers](</docs/en/mcp#use-skills-from-mcp-servers>) * Have Claude read [another organization’s public artifact](</docs/en/artifacts#read-an-artifact-shared-with-you>) + * Publish a design system as an artifact with [`/design-sync`](</docs/en/artifacts#design-sync-requirements>) * Get the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) by default for claude.ai and Console accounts on Windows with Git Bash installed; Claude Code routes shell commands through Git Bash unless you set `CLAUDE_CODE_USE_POWERSHELL_TOOL=1`. On Windows without Git Bash, the tool stays on * Get [Claude-drafted feedback](</docs/en/tools-reference#sendfeedback-tool-behavior>), which Claude Code turns on through a fetched flag
modified
--- a/env-vars.md +++ b/env-vars.md @@ -168,9 +168,9 @@ `CLAUDE_CODE_ALWAYS_ENABLE_EFFORT`| Set to `1` to send the [effort](</docs/en/model-config#adjust-effort-level>) parameter with every request, even when Claude Code does not recognize the model ID as effort-capable. Use this when routing through an [LLM gateway](</docs/en/llm-gateway>) or third-party provider that serves models under custom identifiers. Models that reject the effort parameter at the API, including Claude Opus 4.1, Claude Sonnet 4.5, Claude Haiku 4.5, and earlier models, are still excluded so requests do not fail `CLAUDE_CODE_API_KEY_HELPER_TTL_MS`| Interval in milliseconds at which credentials should be refreshed (when using [`apiKeyHelper`](</docs/en/settings-reference#apikeyhelper>)) `CLAUDE_CODE_ARTIFACT_AUTO_OPEN`| Set to `0` to stop Claude Code from opening the browser automatically when a new [artifact](</docs/en/artifacts#create-an-artifact>) is published -`CLAUDE_CODE_ARTIFACT_COMMENTS`| Set to `0` to stop Claude reading and replying to [comments on an artifact](</docs/en/artifacts#collect-comments-on-an-artifact>). Has no effect when `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` has [turned artifacts off](</docs/en/artifacts#availability>). Requires Claude Code v2.1.221 or later +`CLAUDE_CODE_ARTIFACT_COMMENTS`| Set to `0` to stop the [`Artifact` tool](</docs/en/tools-reference>) from reading and replying to [comments on an artifact](</docs/en/artifacts#collect-comments-on-an-artifact>). Has no effect when `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` has [turned artifacts off](</docs/en/artifacts#availability>). Requires Claude Code v2.1.221 or later `CLAUDE_CODE_ARTIFACT_COMMENTS_AUTOREACT`| Set to `0` to stop Claude [replying on its own to comments sent to it](</docs/en/artifacts#let-claude-reply-to-comments-on-its-own>). Requires Claude Code v2.1.228 or later -`CLAUDE_CODE_ARTIFACT_PUBLISH_EDITS`| Set to `0` to stop Claude from [applying small changes](</docs/en/artifacts#turn-off-one-step-artifact-updates>) to an artifact’s file as part of publishing it. Claude then edits the file with its file-editing tools and publishes it as a separate step. Requires Claude Code v2.1.300 or later +`CLAUDE_CODE_ARTIFACT_PUBLISH_EDITS`| Set to `0` to stop Claude from [applying small changes](</docs/en/artifacts#turn-off-one-step-artifact-updates>) to an artifact’s local file as part of publishing it. Requires Claude Code v2.1.300 or later `CLAUDE_CODE_ATTRIBUTION_HEADER`| Set to `0` to omit the [attribution block](</docs/en/llm-gateway-protocol#system-prompt-attribution-block>), which carries the client version and a prompt fingerprint, from the start of the system prompt. Caching on a direct connection to the Anthropic API is unaffected either way. In some direct-connection setups, Claude Code keeps the block on [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) classifier requests even when you set `0`. In [System prompt attribution block](</docs/en/llm-gateway-protocol#system-prompt-attribution-block>), check which connections and credentials this covers. Before v2.1.181 the block included a per-request token on custom base URLs and Microsoft Foundry connections, so on those versions set it to `0` when your LLM gateway caches on the request body or forwards requests to a third-party provider, or when you connect to Microsoft Foundry directly `CLAUDE_CODE_AUTO_BACKGROUND_WORKER_CHECKIN_SECONDS`| Removed in v2.1.283. Use `CLAUDE_CODE_WORKER_CHECKIN_SCHEDULE` instead `CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the auto-compact window, which is how full the context gets before compaction, to a token count of `100000` or more. Suffixed values such as `200k` require v2.1.304 or later. For precedence over the other ways to set the window and the effect on the status line’s `used_percentage`, see [Set the auto-compact window](</docs/en/model-config#set-the-auto-compact-window>) @@ -238,7 +238,9 @@ `CLAUDE_CODE_DISABLE_POWERSHELL_CMD_RM_DENY`| Set to `1` to turn off the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) check that denies the `cmd` built-ins `rd`, `rmdir`, `del`, and `erase` on a [system path](</docs/en/permission-modes#remove-item-in-powershell>), such as a drive root or your home directory. Claude Code ignores this variable in a settings file’s `env` block. Requires Claude Code v2.1.283 or later `CLAUDE_CODE_DISABLE_PROXY_SCHEME_REPAIR`| Set to `1` to have Claude Code stop at startup on a plain `host:port` in `HTTPS_PROXY` or `https_proxy` even when it starts with no terminal. Claude Code ignores it in project and local settings. Requires Claude Code v2.1.327 or later `CLAUDE_CODE_DISABLE_REFUSAL_FALLBACK`| Set to `1` to turn off the [automatic model switch when a safety classifier flags a request](</docs/en/model-config#automatic-model-fallback>), the behavior the [`switchModelsOnFlag`](</docs/en/settings-reference#switchmodelsonflag>) setting controls +`CLAUDE_CODE_DISABLE_RESPONSE_COMPRESSION`| Set to `1` to request uncompressed model responses if your [proxy](</docs/en/network-config#proxy-configuration>) leaves compressed ones unfinished. Not recommended for self-hosted runners or Remote Control. Ignored in project and local settings. Requires Claude Code v2.1.331 or later `CLAUDE_CODE_DISABLE_SHELL_HEAD_START`| Set to `1` to turn off the head start that can run your shell startup files while Claude writes the session’s first Bash command, before that command’s permission prompt. Requires Claude Code v2.1.327 or later +`CLAUDE_CODE_DISABLE_SHIP`| Set to `1` to turn off [`/ship` and `/steward`](</docs/en/ship-command#turn-off-%2Fship-and-%2Fsteward-for-your-organization>). Requires Claude Code v2.1.331 or later `CLAUDE_CODE_DISABLE_STRUCTURED_OUTPUTS`| Set to `1` to stop Claude Code from sending the structured-output `output_config.format` field and the `anthropic-beta` value that pairs with it, for an [LLM gateway](</docs/en/llm-gateway-protocol#feature-pass-through>) whose upstream rejects them. This leaves on the other pre-release capabilities that [`CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`](</docs/en/llm-gateway-protocol#disable-pre-release-capabilities>) turns off. Requires Claude Code v2.1.288 or later `CLAUDE_CODE_DISABLE_SUBSTITUTION_RM_PROMPT`| Set to `1` to turn off the [critical-path](</docs/en/permission-modes#critical-paths>) check for a recursive `rm` whose target is entirely the output of a command substitution, such as `rm -rf "$(pwd)"`. The other critical-path checks keep running. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.281 or later `CLAUDE_CODE_DISABLE_TERMINAL_TITLE`| Set to `1` to disable automatic terminal title updates based on conversation context. This also skips the background small/fast-model request that [generates a session title](</docs/en/sessions#name-your-sessions>), and turns off [status reports to your terminal](</docs/en/terminal-config#see-session-status-in-your-terminal>) @@ -426,7 +428,7 @@ `DEBUG`| Set to `1` to enable debug mode, equivalent to launching with [`--debug`](</docs/en/cli-reference#cli-flags>). Debug logs are written to `~/.claude/debug/<session-id>.txt`, or to the path set by `CLAUDE_CODE_DEBUG_LOGS_DIR`. Only the truthy values `1`, `true`, `yes`, and `on` enable debug mode, so namespace patterns like `DEBUG=express:*` set for other tools do not trigger it `DISABLE_AUTOUPDATER`| Set to `1` to disable automatic background updates. Manual `claude update` still works. Use `DISABLE_UPDATES` to block both `DISABLE_AUTO_COMPACT`| Set to `1` to disable automatic compaction when approaching the context limit, along with [idle compaction](</docs/en/settings-reference#idlecompaction>). The manual `/compact` command remains available. Use when you want explicit control over when compaction occurs. Overrides the [`autoCompactEnabled`](</docs/en/settings-reference#autocompactenabled>) setting -`DISABLE_COMPACT`| Set to `1` to disable all compaction: both automatic compaction and the manual `/compact` command +`DISABLE_COMPACT`| Set to `1` to disable all compaction, including `/compact` and the [rewind menu’s summarize options](</docs/en/checkpointing#rewind-and-summarize>) `DISABLE_COST_WARNINGS`| Set to `1` to disable cost warning messages `DISABLE_DOCTOR_COMMAND`| Set to `1` to hide the [`/doctor`](</docs/en/commands#all-commands>) setup checkup skill and its `/checkup` alias. Useful for managed deployments where users shouldn’t run setup diagnostics from a session. Doesn’t affect the `claude doctor` terminal command. Before v2.1.205, this variable hid the `/doctor` diagnostics screen command `DISABLE_ERROR_REPORTING`| Set to any non-empty value, such as `1`, to opt out of error reporting. **Setting it to`0` or `false` still opts out**, unlike most on/off variables; unset the variable to turn error reporting back on @@ -479,7 +481,7 @@ `OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`| Standard OpenTelemetry SDK limit on attribute value length. Claude Code caps content-bearing telemetry attributes at the smaller of this and `CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH`, so the truncation marker stays within the SDK limit. Claude Code reads the `OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT` and `OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT` variants the same way, and the smallest set value applies to all signals. Requires Claude Code v2.1.214 or later. See [Monitoring](</docs/en/monitoring-usage#common-configuration-variables>) `OTEL_LOG_ASSISTANT_RESPONSES`| Set to `1` to include the model’s response text on `assistant_response` OpenTelemetry log events. When unset, Claude Code uses the value of `OTEL_LOG_USER_PROMPTS` instead. Set to `0` to keep responses redacted even when `OTEL_LOG_USER_PROMPTS` is set. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). Requires Claude Code v2.1.193 or later. See [Monitoring](</docs/en/monitoring-usage#assistant-response-event>) `OTEL_LOG_MANAGED_SETTINGS`| Set to `1` to add the redacted managed settings, and a SHA-256 digest of the settings before redaction, to `managed_settings_resolved` OpenTelemetry log events. Disabled by default. Set it in your shell, user settings, or managed settings; a value in project or local settings doesn’t turn it on. Requires Claude Code v2.1.274 or later. See [Monitoring](</docs/en/monitoring-usage#managed-settings-resolved-event>) -`OTEL_LOG_RAW_API_BODIES`| Emit Anthropic Messages API request and response JSON as `api_request_body` / `api_response_body` log events. Set to `1` for inline bodies truncated at the content limit, or `file:<dir>` to write untruncated bodies to disk and emit a `body_ref` path instead. `CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH` configures the content limit, 60 KB by default. Disabled by default; bodies include the entire conversation history. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). See [Monitoring](</docs/en/monitoring-usage#api-request-body-event>) +`OTEL_LOG_RAW_API_BODIES`| Emit Anthropic Messages API request and response JSON as `api_request_body` / `api_response_body` log events. Set to `1` for inline bodies truncated at the [content limit](</docs/en/monitoring-usage#common-configuration-variables>), or `file:<dir>` to write untruncated bodies to disk and emit a `body_ref` path instead. Disabled by default; bodies can include the entire conversation history. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). See [Monitoring](</docs/en/monitoring-usage#api-request-body-event>) `OTEL_LOG_TOOL_CONTENT`| Set to `1` to include tool content in the `tool.output` OpenTelemetry span event. Span attributes carry tool content under [their own gates](</docs/en/monitoring-usage#new-context-gates>). Requires [tracing](</docs/en/monitoring-usage#traces-beta>). Disabled by default to protect sensitive data. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>), apart from the off values that section describes. See [Monitoring](</docs/en/monitoring-usage#tool-output-span-event>) `OTEL_LOG_TOOL_DETAILS`| Set to `1` to include tool input arguments; MCP server names; user-authored workflow names; raw error strings on tool failures; the refusal `category` on `api_refusal` events; real agent, skill, plugin, and MCP server names on [cost and token metrics](</docs/en/monitoring-usage#cost-counter>); and other tool details in OpenTelemetry metrics, traces, and logs. Disabled by default to protect PII. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>), apart from the off values that section describes. See [Monitoring](</docs/en/monitoring-usage>) `OTEL_LOG_USER_PROMPTS`| Set to `1` to include user prompt text in OpenTelemetry traces and logs. Disabled by default (prompts are redacted). Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>), apart from the off values that section describes. See [Monitoring](</docs/en/monitoring-usage>) @@ -550,7 +552,8 @@ * Run [`claude import` or the `/import` command](</docs/en/cli-reference#cli-commands>) * Run [`/skill-doctor`](</docs/en/skills#find-unused-skills>) or open its report in the `/plugin` **Stats** tab * Run [`/restart`](</docs/en/commands>) on Pro, Max, and Ultra plans - * Run [`/ship` or `/steward`](</docs/en/ship-command>) + * Run [`/ship` or `/steward`](</docs/en/ship-command>), except with Claude Code v2.1.331 or later on a third-party provider or in a Claude apps gateway session + * Run [`/claude-approvals`](</docs/en/commands>) * Sync the [skills](</docs/en/skills#where-synced-skills-load>) and [plugins](</docs/en/plugins/loading#synced-plugins>) enabled for your claude.ai account into your terminal sessions * Turn on the [You should know mod](</docs/en/interactive-mode#you-should-know-suggestions>) * Use [the advisor tool](</docs/en/advisor#requirements>), except with Claude Code v2.1.300 or later on Claude Platform on AWS or [Claude Models on Google Cloud (Anthropic managed)](</docs/en/feature-availability#availability-by-model-provider>)
modified
--- a/env-vars.md +++ b/env-vars.md @@ -223,7 +223,7 @@ `CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS`| Set to `1` to remove built-in commit and PR workflow instructions and the git status snapshot from Claude’s context. Useful when using your own git workflow skills. Takes precedence over the [`includeGitInstructions`](</docs/en/settings-reference#includegitinstructions>) setting when set `CLAUDE_CODE_DISABLE_INLINE_SHELL_RM_PROMPT`| Set to `1` to stop Claude Code from reading scripts passed to a shell with `-c`, such as `bash -c 'rm -rf ~'`, for [critical-path](</docs/en/permission-modes#removals-inside-nested-commands-and-inline-scripts>) removals. Claude Code still checks the shell variable and positional parameter targets in those scripts, and the other critical-path checks keep running. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.288 or later `CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP`| Set to `1` to prevent automatic remapping of Opus 4 and Opus 4.1 to the current Opus version on the Anthropic API. The remap doesn’t run on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry -`CLAUDE_CODE_DISABLE_MCP_TASK_BACKGROUND`| Set to `1` so that Claude waits for the result of an [MCP task](</docs/en/mcp#make-claude-wait-for-the-result-of-an-mcp-task>) in an interactive session. While [automatic backgrounding](</docs/en/mcp#automatic-backgrounding-of-long-tool-calls>) is on, it still moves the call to the background after two minutes by default. Requires Claude Code v2.1.304 or later +`CLAUDE_CODE_DISABLE_MCP_TASK_BACKGROUND`| Set to `1` so that Claude waits for the result of an [MCP task](</docs/en/mcp#make-claude-wait-for-the-result-of-an-mcp-task>) in an interactive terminal session. While [automatic backgrounding](</docs/en/mcp#automatic-backgrounding-of-long-tool-calls>) is on, it still moves the call to the background after two minutes by default. Requires Claude Code v2.1.304 or later `CLAUDE_CODE_DISABLE_MODEL_ACCESS_FALLBACK`| Set to `1` to stop Claude Code on [Amazon Bedrock](</docs/en/amazon-bedrock#when-a-model-is-disabled-mid-session>) and [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai#when-a-model-is-disabled-mid-session>) from switching to an older model when your account loses access to a session’s model mid-session; the refused request fails at once instead. A [fallback model chain](</docs/en/model-config#fallback-model-chains>) you configure still switches on that refusal, and the [startup model checks](</docs/en/amazon-bedrock#startup-model-checks>) still fall back at launch. Requires Claude Code v2.1.285 or later `CLAUDE_CODE_DISABLE_MOUNTED_DRIVE_RM_PROMPT`| Set to `1` to turn off the [mounted drive prompt](</docs/en/permission-modes#the-mounted-drive-prompt>) for paths such as `/Volumes/USB`. Set it in the environment that launches Claude Code, because Claude Code [ignores it in a settings `env` block](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). Requires Claude Code v2.1.304 or later `CLAUDE_CODE_DISABLE_MOUSE`| Set to `1` to disable mouse tracking in [fullscreen rendering](</docs/en/fullscreen>). Keyboard scrolling with `PgUp` and `PgDn` still works. Use this to keep your terminal’s native copy-on-select behavior @@ -303,7 +303,7 @@ `CLAUDE_CODE_MAX_TURNS`| Cap the number of agentic turns when no explicit limit is passed. Equivalent to passing [`--max-turns`](</docs/en/cli-reference#cli-flags>), which takes precedence when both are set. A value that is not a positive integer is rejected at startup with an error rather than treated as no cap `CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSION`| Cap on [WebSearch](</docs/en/tools-reference#session-search-limit>) calls (default: 200). When Claude reaches the cap, further WebSearch calls return a notice telling it to continue with the information it already gathered and say so in its answer. Accepts a positive whole number with no upper bound. Anything else is ignored and the default applies, so the cap can be raised but not turned off. Requires Claude Code v2.1.212 or later `CLAUDE_CODE_MCP_ALLOWLIST_ENV`| Set to `1` to spawn stdio MCP servers with only a safe baseline environment plus the server’s configured `env`, instead of inheriting your shell environment -`CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS`| Elapsed time in milliseconds before a still-running MCP tool call [moves to a background task](</docs/en/mcp#automatic-backgrounding-of-long-tool-calls>) (default: 120000, or 2 minutes). Set to `0` to turn automatic backgrounding off and, in an interactive session, to make Claude wait for [MCP tasks](</docs/en/mcp#make-claude-wait-for-the-result-of-an-mcp-task>). Requires Claude Code v2.1.212 or later +`CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS`| Elapsed time in milliseconds before a still-running MCP tool call [moves to a background task](</docs/en/mcp#automatic-backgrounding-of-long-tool-calls>) (default: 120000, or 2 minutes). Set to `0` to turn automatic backgrounding off. In an interactive terminal session, `0` also makes Claude wait for [MCP tasks](</docs/en/mcp#make-claude-wait-for-the-result-of-an-mcp-task>). Requires Claude Code v2.1.212 or later `CLAUDE_CODE_MCP_STARTUP_WAIT_MS`| How long in milliseconds the first turn of a [non-interactive](</docs/en/headless>) session waits for MCP servers that are still connecting, in place of the default [first-turn wait](</docs/en/agent-sdk/mcp#connection-timing>). In a [self-hosted environment](</docs/en/self-hosted-environments-configuration#connection-timing>), it changes only how long the wait lasts. Some servers keep a wait of their own regardless of the value; [Connection timing](</docs/en/agent-sdk/mcp#connection-timing>) lists them. Set to `0` to skip the wait for every other server. Requires Claude Code v2.1.274 or later `CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT`| Idle timeout in milliseconds for MCP tool calls. When a stdio, HTTP, SSE, WebSocket, or [claude.ai connector](</docs/en/mcp#use-mcp-servers-from-claude-ai>) MCP server sends no response and no progress notification for this long, the tool call aborts with an error instead of waiting for the overall `MCP_TOOL_TIMEOUT`. Overrides the per-transport defaults of 300000 (5 minutes) for network servers and 1800000 (30 minutes) for stdio servers. Set to `0` to disable the idle check. Values below 1000 are raised to one second, and the value is capped at the effective `MCP_TOOL_TIMEOUT`. A per-server `timeout` in `.mcp.json` of at least 1000 raises that server’s idle window to at least the `timeout` value. Doesn’t apply to IDE servers or SDK in-process servers. Requires Claude Code v2.1.187 or later. Before v2.1.203, stdio servers were exempt from the idle timeout `CLAUDE_CODE_MESSAGING_SOCKET`| Set by Claude Code, not by you: in sessions that bind an [inbox socket](</docs/en/cross-session-messaging#the-sessions-inbox-socket>), Claude Code exports that socket’s path to hooks and Bash commands when it binds the socket. In a session that starts with messaging on, Claude Code binds the socket before any hook runs. Other sessions on the machine deliver messages to this path. Each session exports its own socket rather than one inherited from a parent, and messages arriving on it go through the session’s [inbound controls](</docs/en/cross-session-messaging#control-inbound-messages>). Settings `env` blocks can’t set it. Requires Claude Code v2.1.224 or later @@ -349,7 +349,7 @@ `CLAUDE_CODE_RESUME_INTERRUPTED_TURN_MAX_AGE_MS`| Maximum age in milliseconds of the last transcript message for a session that ended mid-turn to continue automatically on resume. When the last message is older than this bound, Claude Code skips the `CLAUDE_CODE_RESUME_INTERRUPTED_TURN` automatic resume and its `CLAUDE_CODE_RESUME_PROMPT` continuation message, and the session starts idle so you continue explicitly. Unset or `0` sets no bound, except that some turns resume only within six hours of their last message, such as one that ended with an API error. A positive value bounds every turn, including those; a negative or non-numeric value applies a one-hour bound. Spawn scripts for long-running agents can set this so a restart against an old transcript doesn’t re-run a stale prompt. Claude Code sets a one-hour bound itself when it restarts a crashed [agent view](</docs/en/agent-view>) session that inherited its conversation from an interactive session. Requires Claude Code v2.1.211 or later `CLAUDE_CODE_RESUME_PROMPT`| Override the continuation message Claude Code sends to Claude when `CLAUDE_CODE_RESUME_INTERRUPTED_TURN` continues an interrupted turn instead of resending its prompt, or when you resume a [deferred tool call](</docs/en/hooks#defer-a-tool-call-for-later>) with `-p`. Defaults to `Continue from where you left off.`. An empty string uses the default `CLAUDE_CODE_RESUME_SHOWS_CUT_OFF_CALLS`| Set to `1` to keep [interrupted tool calls](</docs/en/sessions#what-a-resumed-session-restores>), marked as cut off, in a turn that `CLAUDE_CODE_RESUME_INTERRUPTED_TURN` continues. When unset, those calls are dropped before the turn continues. Some calls stay dropped, such as calls to subagents, skills, workflows, and tools that wait on a person. For the VS Code chat panel, see [Continue conversations after a reload](</docs/en/vs-code#continue-conversations-after-a-reload>). Requires Claude Code v2.1.309 or later -`CLAUDE_CODE_RETRY_WATCHDOG`| Set to `1` for unattended sessions such as eval harnesses, CI jobs, or remote workers. Retries `429` and `529` capacity errors indefinitely instead of failing after `CLAUDE_CODE_MAX_RETRIES` attempts. Claude Code fails at once when a standard-speed request gets a `429` that reports a spend limit or exhausted usage credits, even one from a [gateway spend cap](</docs/en/errors#spend-limit-reached>) that resets on a schedule. Before v2.1.239, the watchdog retried these indefinitely. For fast mode requests, see [Handle rate limits](</docs/en/fast-mode#handle-rate-limits>). The watchdog backs off up to 5 minutes between attempts, or until the limit resets when the response carries a rate-limit reset time, so a session that hits a usage limit waits out the remaining window. On v2.1.199 or later it also raises the default retry count for other transient errors, such as server errors, timeouts, and dropped connections, to 300, roughly three hours of backoff, and removes the cap of 15 on `CLAUDE_CODE_MAX_RETRIES` if you set that variable explicitly. Requires Claude Code v2.1.186 or later +`CLAUDE_CODE_RETRY_WATCHDOG`| Set to `1` for unattended sessions. Keeps retrying `429` and `529` capacity errors past `CLAUDE_CODE_MAX_RETRIES`. Spend limits and exhausted usage credits [can end the retries](</docs/en/errors#when-the-retry-watchdog-stops-retrying>). See [retry limits](</docs/en/errors#tune-retry-behavior>) and [fast mode](</docs/en/fast-mode#handle-rate-limits>). Requires Claude Code v2.1.186 or later `CLAUDE_CODE_RETRY_WATCHDOG_MAX_WAIT_MS`| Maximum time in milliseconds that each API request spends waiting out `429` and `529` errors when `CLAUDE_CODE_RETRY_WATCHDOG` is set. Once that time is spent, the next such error ends the request. Give a positive whole number in plain digits, such as `1800000` for 30 minutes. When unset, the wait has no limit. Requires Claude Code v2.1.295 or later `CLAUDE_CODE_RETRY_WATCHDOG_USAGE_LIMIT_RECHECK_MS`| Minimum interval in milliseconds between checks of whether a [usage limit](</docs/en/errors#youve-hit-your-session-limit>) was already lifted, while a request waits for that limit to reset with `CLAUDE_CODE_RETRY_WATCHDOG` set. When a check finds the limit lifted, the request goes out at once. Give a whole number in plain digits from `60000`, one minute, to `10800000`, three hours. Checks are made only for a claude.ai subscription’s session or weekly limit while usage credits aren’t in use, and not while `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` is set. When this variable is unset or its value is outside that range, no checks are made. Requires Claude Code v2.1.305 or later `CLAUDE_CODE_SAFE_MODE`| Set to `1` to start in safe mode: CLAUDE.md, skills, plugins, hooks, MCP servers, custom commands and agents, output styles, workflows, custom themes, custom keybindings, status line and file-suggestion commands, LSP servers, and auto memory do not load, for troubleshooting a broken configuration. Managed settings policy still applies, including policy-configured hooks, status line, and file-suggestion commands; managed plugins, managed skills, managed CLAUDE.md, and policy-configured MCP servers do not. Equivalent to passing [`--safe-mode`](</docs/en/cli-reference#cli-flags>). Directly spawned child processes inherit the variable @@ -554,7 +554,8 @@ * Sync the [skills](</docs/en/skills#where-synced-skills-load>) and [plugins](</docs/en/plugins/loading#synced-plugins>) enabled for your claude.ai account into your terminal sessions * Turn on the [You should know mod](</docs/en/interactive-mode#you-should-know-suggestions>) * Use [the advisor tool](</docs/en/advisor#requirements>), except with Claude Code v2.1.300 or later on Claude Platform on AWS or [Claude Models on Google Cloud (Anthropic managed)](</docs/en/feature-availability#availability-by-model-provider>) - * Use [MCP tasks](</docs/en/mcp#mcp-tasks-that-run-on-the-server>) + * Use [MCP tasks](</docs/en/mcp#requirements-for-mcp-tasks>) outside an interactive terminal session, or from a subagent + * Use [skills from MCP servers](</docs/en/mcp#use-skills-from-mcp-servers>) * Have Claude read [another organization’s public artifact](</docs/en/artifacts#read-an-artifact-shared-with-you>) * Get the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) by default for claude.ai and Console accounts on Windows with Git Bash installed; Claude Code routes shell commands through Git Bash unless you set `CLAUDE_CODE_USE_POWERSHELL_TOOL=1`. On Windows without Git Bash, the tool stays on * Get [Claude-drafted feedback](</docs/en/tools-reference#sendfeedback-tool-behavior>), which Claude Code turns on through a fetched flag
modified
--- a/env-vars.md +++ b/env-vars.md @@ -238,6 +238,7 @@ `CLAUDE_CODE_DISABLE_POWERSHELL_CMD_RM_DENY`| Set to `1` to turn off the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) check that denies the `cmd` built-ins `rd`, `rmdir`, `del`, and `erase` on a [system path](</docs/en/permission-modes#remove-item-in-powershell>), such as a drive root or your home directory. Claude Code ignores this variable in a settings file’s `env` block. Requires Claude Code v2.1.283 or later `CLAUDE_CODE_DISABLE_PROXY_SCHEME_REPAIR`| Set to `1` to have Claude Code stop at startup on a plain `host:port` in `HTTPS_PROXY` or `https_proxy` even when it starts with no terminal. Claude Code ignores it in project and local settings. Requires Claude Code v2.1.327 or later `CLAUDE_CODE_DISABLE_REFUSAL_FALLBACK`| Set to `1` to turn off the [automatic model switch when a safety classifier flags a request](</docs/en/model-config#automatic-model-fallback>), the behavior the [`switchModelsOnFlag`](</docs/en/settings-reference#switchmodelsonflag>) setting controls +`CLAUDE_CODE_DISABLE_SHELL_HEAD_START`| Set to `1` to turn off the head start that can run your shell startup files while Claude writes the session’s first Bash command, before that command’s permission prompt. Requires Claude Code v2.1.327 or later `CLAUDE_CODE_DISABLE_STRUCTURED_OUTPUTS`| Set to `1` to stop Claude Code from sending the structured-output `output_config.format` field and the `anthropic-beta` value that pairs with it, for an [LLM gateway](</docs/en/llm-gateway-protocol#feature-pass-through>) whose upstream rejects them. This leaves on the other pre-release capabilities that [`CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`](</docs/en/llm-gateway-protocol#disable-pre-release-capabilities>) turns off. Requires Claude Code v2.1.288 or later `CLAUDE_CODE_DISABLE_SUBSTITUTION_RM_PROMPT`| Set to `1` to turn off the [critical-path](</docs/en/permission-modes#critical-paths>) check for a recursive `rm` whose target is entirely the output of a command substitution, such as `rm -rf "$(pwd)"`. The other critical-path checks keep running. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.281 or later `CLAUDE_CODE_DISABLE_TERMINAL_TITLE`| Set to `1` to disable automatic terminal title updates based on conversation context. This also skips the background small/fast-model request that [generates a session title](</docs/en/sessions#name-your-sessions>), and turns off [status reports to your terminal](</docs/en/terminal-config#see-session-status-in-your-terminal>) @@ -277,7 +278,7 @@ `CLAUDE_CODE_FORCE_TERMINAL_IMAGES`| Set to `1` to draw [mod `Image` elements](</docs/en/plugins/mods/reference#elements>) as pictures when your terminal draws kitty graphics protocol images with Unicode placeholders and you still see an `Image`’s dimmed `alt` text. See [which terminals draw an `Image` and where not to set this variable](</docs/en/plugins/mods/gallery#image-and-client>) `CLAUDE_CODE_FORK_SUBAGENT`| Controls fork mode, which is on by default and lets Claude start [forks](</docs/en/sub-agents#fork-the-current-conversation>) on its own. Set to `0` to turn fork mode off, for example to [let Claude wait for a subagent](</docs/en/sub-agents#let-claude-wait-for-a-subagent>). For versions, see [Turn fork mode off](</docs/en/sub-agents#turn-fork-mode-on-or-off>) `CLAUDE_CODE_FORWARD_SUBAGENT_TEXT`| Set to `1` to emit [subagent](</docs/en/sub-agents>) text and thinking blocks in `claude -p --output-format stream-json` output, the same behavior as the [`--forward-subagent-text`](</docs/en/cli-reference#cli-flags>) flag. Use the variable when a harness invokes `claude` and can’t pass the flag itself. Unlike the flag, which exits with an error outside non-interactive mode with stream-json output, the variable is ignored there so that nested invocations keep working when it’s set process-wide. Requires Claude Code v2.1.211 or later -`CLAUDE_CODE_FULL_SIGN_IN_LINK`| Set to `1` to print the full claude.ai login URL instead of a short one. Use it when the short URL shows an error or your script reads values from the URL. Set it in your shell or user settings. Requires Claude Code v2.1.330 or later +`CLAUDE_CODE_FULL_SIGN_IN_LINK`| Set to `1` to print the full login URL. Use it when a short login URL shows an error or your script reads values from the URL. Set it in your shell or user settings. Requires Claude Code v2.1.330 or later `CLAUDE_CODE_GATEWAY_HINT_HEADERS`| Set to `1` to send the [gateway hint headers](</docs/en/llm-gateway-protocol#gateway-hint-headers>), such as `x-claude-code-request-class` and `x-claude-code-compaction`, on a custom proxy or a third-party provider such as Amazon Bedrock or Claude Platform on AWS. Set to `0` to stop sending them on every connection, including a direct connection to the Anthropic API, where Claude Code sends them by default. Requires Claude Code v2.1.273 or later `CLAUDE_CODE_GATEWAY_MODEL_DISCOVERY_TIMEOUT_MS`| Timeout in milliseconds for the [gateway model discovery](</docs/en/llm-gateway-protocol#model-discovery>) request that `CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY` turns on (default: `3000`). Raise it when your gateway needs longer than three seconds to answer `/v1/models` at startup. Takes plain digits only; `0`, negative values, and other spellings keep the default. Requires Claude Code v2.1.269 or later `CLAUDE_CODE_GIT_BASH_PATH`| Windows only: path to the Git Bash executable (`bash.exe`). Use when Git Bash is installed but not in your PATH. If the path doesn’t exist or the file isn’t named `bash.exe`, `sh.exe`, `bash`, or `sh`, Claude Code ignores the variable and auto-detects Git Bash as if it were unset, logging a warning visible with `--debug`. Before v2.1.219, Claude Code exited at startup when the path didn’t exist, and used any existing file as the shell without checking that it was bash or sh. See [Windows setup](</docs/en/setup#set-up-on-windows>) @@ -549,18 +550,18 @@ * Run [`claude import` or the `/import` command](</docs/en/cli-reference#cli-commands>) * Run [`/skill-doctor`](</docs/en/skills#find-unused-skills>) or open its report in the `/plugin` **Stats** tab * Run [`/restart`](</docs/en/commands>) on Pro, Max, and Ultra plans + * Run [`/ship` or `/steward`](</docs/en/ship-command>) * Sync the [skills](</docs/en/skills#where-synced-skills-load>) and [plugins](</docs/en/plugins/loading#synced-plugins>) enabled for your claude.ai account into your terminal sessions * Turn on the [You should know mod](</docs/en/interactive-mode#you-should-know-suggestions>) * Use [the advisor tool](</docs/en/advisor#requirements>), except with Claude Code v2.1.300 or later on Claude Platform on AWS or [Claude Models on Google Cloud (Anthropic managed)](</docs/en/feature-availability#availability-by-model-provider>) * Use [MCP tasks](</docs/en/mcp#mcp-tasks-that-run-on-the-server>) - * Turn on [Code Mode](</docs/en/code-mode#requirements>) * Have Claude read [another organization’s public artifact](</docs/en/artifacts#read-an-artifact-shared-with-you>) * Get the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) by default for claude.ai and Console accounts on Windows with Git Bash installed; Claude Code routes shell commands through Git Bash unless you set `CLAUDE_CODE_USE_POWERSHELL_TOOL=1`. On Windows without Git Bash, the tool stays on * Get [Claude-drafted feedback](</docs/en/tools-reference#sendfeedback-tool-behavior>), which Claude Code turns on through a fetched flag ### First session after an install or upgrade -In your first session after you install Claude Code, or upgrade to a version that adds a feature, a flag-gated feature can be missing. When Claude Code fetches its feature flags during that session, it saves them on the machine, so your next session on that machine has the feature. In setups such as these, sessions after the first also start without freshly fetched flags: +In your first session after you install Claude Code, or upgrade to a version that adds a feature, a flag-gated feature can be missing. The same holds in your first session after Anthropic turns a feature on. When Claude Code fetches its feature flags during that session, it saves them on the machine, so you have the feature the next time you start Claude Code there. In setups such as these, sessions after the first also start without freshly fetched flags: * **A clean environment on every run** : if each run starts in a CI container, or any other environment without the flags an earlier session saved, every run is a first session * **A gateway token with no API key** : if you authenticate with `ANTHROPIC_AUTH_TOKEN` and no API key, and `ANTHROPIC_BASE_URL` points at a host other than Anthropic’s, such as an [LLM gateway](</docs/en/llm-gateway>), Claude Code has no credential to fetch the flags with
modified
--- a/env-vars.md +++ b/env-vars.md @@ -275,7 +275,7 @@ `CLAUDE_CODE_FORCE_STRIKETHROUGH`| Set to `1` to force strikethrough rendering for `~~text~~` in Claude’s responses when your terminal supports it but is not auto-detected, such as over SSH without `TERM_PROGRAM` forwarded. Without this, undetected terminals show the literal `~~` markers instead of rendering the text as strikethrough. Requires Claude Code v2.1.186 or later `CLAUDE_CODE_FORCE_SYNC_OUTPUT`| Set to `1` to force-enable DEC private mode 2026 [synchronized output](<https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036>) when your terminal supports it but is not auto-detected. Useful for emulators such as Emacs `eat` that implement BSU/ESU but do not reply to the capability probe. Has no effect under tmux. Unlike `CLAUDE_CODE_NO_FLICKER`, which switches to [fullscreen rendering](</docs/en/fullscreen>), this doesn’t change the renderer `CLAUDE_CODE_FORCE_TERMINAL_IMAGES`| Set to `1` to draw [mod `Image` elements](</docs/en/plugins/mods/reference#elements>) as pictures when your terminal draws kitty graphics protocol images with Unicode placeholders and you still see an `Image`’s dimmed `alt` text. See [which terminals draw an `Image` and where not to set this variable](</docs/en/plugins/mods/gallery#image-and-client>) -`CLAUDE_CODE_FORK_SUBAGENT`| Controls fork mode, which is on by default and lets Claude start [forks](</docs/en/sub-agents#fork-the-current-conversation>) on its own. While fork mode is on, Claude also can’t [wait for a subagent](</docs/en/sub-agents#run-subagents-in-foreground-or-background>) in interactive terminal, VS Code, or desktop sessions on your machine. Set to `0` to turn fork mode off. For versions, see [Turn fork mode off](</docs/en/sub-agents#turn-fork-mode-on-or-off>) +`CLAUDE_CODE_FORK_SUBAGENT`| Controls fork mode, which is on by default and lets Claude start [forks](</docs/en/sub-agents#fork-the-current-conversation>) on its own. Set to `0` to turn fork mode off, for example to [let Claude wait for a subagent](</docs/en/sub-agents#let-claude-wait-for-a-subagent>). For versions, see [Turn fork mode off](</docs/en/sub-agents#turn-fork-mode-on-or-off>) `CLAUDE_CODE_FORWARD_SUBAGENT_TEXT`| Set to `1` to emit [subagent](</docs/en/sub-agents>) text and thinking blocks in `claude -p --output-format stream-json` output, the same behavior as the [`--forward-subagent-text`](</docs/en/cli-reference#cli-flags>) flag. Use the variable when a harness invokes `claude` and can’t pass the flag itself. Unlike the flag, which exits with an error outside non-interactive mode with stream-json output, the variable is ignored there so that nested invocations keep working when it’s set process-wide. Requires Claude Code v2.1.211 or later `CLAUDE_CODE_FULL_SIGN_IN_LINK`| Set to `1` to print the full claude.ai login URL instead of a short one. Use it when the short URL shows an error or your script reads values from the URL. Set it in your shell or user settings. Requires Claude Code v2.1.330 or later `CLAUDE_CODE_GATEWAY_HINT_HEADERS`| Set to `1` to send the [gateway hint headers](</docs/en/llm-gateway-protocol#gateway-hint-headers>), such as `x-claude-code-request-class` and `x-claude-code-compaction`, on a custom proxy or a third-party provider such as Amazon Bedrock or Claude Platform on AWS. Set to `0` to stop sending them on every connection, including a direct connection to the Anthropic API, where Claude Code sends them by default. Requires Claude Code v2.1.273 or later @@ -403,7 +403,7 @@ `CLAUDE_CODE_USE_VERTEX`| Use [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>) `CLAUDE_CODE_WARN_DISK_FREE_GIB`| Set to a whole number of GiB, such as `10`, to have Claude Code warn Claude when free space on the working directory’s filesystem falls below that amount. The warning is a system reminder saying how much is free. The reminder is off when the variable is unset, `0`, or not plain digits. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.304 or later `CLAUDE_CODE_WARN_MEMORY_FREE_GIB`| On Linux and WSL, set to a whole number of GiB such as `4` to have Claude Code warn Claude when available memory falls below that amount. The warning is a system reminder saying how much is available. The reminder is off when the variable is unset, `0`, or not plain digits. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.304 or later -`CLAUDE_CODE_WEBFETCH_CACHE_TTL_MS`| Set to the number of milliseconds [WebFetch](</docs/en/tools-reference#webfetch-tool-behavior>) keeps each fetched URL’s response cached. The default is `900000`, which is 15 minutes. Takes plain digits only; `0`, a decimal, or any other spelling keeps the default. Claude Code reads the value once per launch, so a change in a settings `env` block applies when you next launch `claude`. Requires Claude Code v2.1.233 or later +`CLAUDE_CODE_WEBFETCH_CACHE_TTL_MS`| Set to the number of milliseconds [WebFetch](</docs/en/tools-reference#webfetch-tool-behavior>) keeps each fetched page cached. The default is `900000`, which is 15 minutes. Takes plain digits only; `0`, a decimal, or any other spelling keeps the default. Claude Code reads the value once per launch, so a change in a settings `env` block applies when you next launch `claude`. Requires Claude Code v2.1.233 or later `CLAUDE_CODE_WEBFETCH_DEADLINE_MS`| Upper bound in milliseconds on how long [WebFetch](</docs/en/tools-reference#webfetch-tool-behavior>) waits for a page to download, including any redirects it follows. A download that hasn’t completed by then fails with a deadline error. The default is `300000`, which is five minutes. Set to `0` to remove the limit. Takes plain digits only; a decimal or any other spelling keeps the default. Requires Claude Code v2.1.268 or later `CLAUDE_CODE_WEB_SEARCH_REFILLS_PER_HOUR`| Rate at which a session’s [WebSearch limit](</docs/en/tools-reference#session-search-limit>) refills, in calls per hour. The default is `100` in an interactive terminal session. In a [non-interactive](</docs/en/headless>) session the default is `0`, which turns refill off. Takes plain digits only; any other spelling reads as unset. Requires Claude Code v2.1.290 or later `CLAUDE_CODE_WORKER_CHECKIN_SCHEDULE`| When `CLAUDE_AUTO_BACKGROUND_TASKS` is set to `1`, how long Claude Code waits before each reminder to Claude to check on [background subagents](</docs/en/sub-agents#run-subagents-in-foreground-or-background>) that are still running. Takes one or more comma-separated waits in whole seconds from `1` to `86400`, such as `600` or `600,1800,3600`. Each value is the wait before the next reminder, and the last value repeats. Takes plain digits only; any other value or spelling reads as unset. When unset, there are no reminders. Requires Claude Code v2.1.283 or later
modified
--- a/env-vars.md +++ b/env-vars.md @@ -277,6 +277,7 @@ `CLAUDE_CODE_FORCE_TERMINAL_IMAGES`| Set to `1` to draw [mod `Image` elements](</docs/en/plugins/mods/reference#elements>) as pictures when your terminal draws kitty graphics protocol images with Unicode placeholders and you still see an `Image`’s dimmed `alt` text. See [which terminals draw an `Image` and where not to set this variable](</docs/en/plugins/mods/gallery#image-and-client>) `CLAUDE_CODE_FORK_SUBAGENT`| Controls fork mode, which is on by default and lets Claude start [forks](</docs/en/sub-agents#fork-the-current-conversation>) on its own. While fork mode is on, Claude also can’t [wait for a subagent](</docs/en/sub-agents#run-subagents-in-foreground-or-background>) in interactive terminal, VS Code, or desktop sessions on your machine. Set to `0` to turn fork mode off. For versions, see [Turn fork mode off](</docs/en/sub-agents#turn-fork-mode-on-or-off>) `CLAUDE_CODE_FORWARD_SUBAGENT_TEXT`| Set to `1` to emit [subagent](</docs/en/sub-agents>) text and thinking blocks in `claude -p --output-format stream-json` output, the same behavior as the [`--forward-subagent-text`](</docs/en/cli-reference#cli-flags>) flag. Use the variable when a harness invokes `claude` and can’t pass the flag itself. Unlike the flag, which exits with an error outside non-interactive mode with stream-json output, the variable is ignored there so that nested invocations keep working when it’s set process-wide. Requires Claude Code v2.1.211 or later +`CLAUDE_CODE_FULL_SIGN_IN_LINK`| Set to `1` to print the full claude.ai login URL instead of a short one. Use it when the short URL shows an error or your script reads values from the URL. Set it in your shell or user settings. Requires Claude Code v2.1.330 or later `CLAUDE_CODE_GATEWAY_HINT_HEADERS`| Set to `1` to send the [gateway hint headers](</docs/en/llm-gateway-protocol#gateway-hint-headers>), such as `x-claude-code-request-class` and `x-claude-code-compaction`, on a custom proxy or a third-party provider such as Amazon Bedrock or Claude Platform on AWS. Set to `0` to stop sending them on every connection, including a direct connection to the Anthropic API, where Claude Code sends them by default. Requires Claude Code v2.1.273 or later `CLAUDE_CODE_GATEWAY_MODEL_DISCOVERY_TIMEOUT_MS`| Timeout in milliseconds for the [gateway model discovery](</docs/en/llm-gateway-protocol#model-discovery>) request that `CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY` turns on (default: `3000`). Raise it when your gateway needs longer than three seconds to answer `/v1/models` at startup. Takes plain digits only; `0`, negative values, and other spellings keep the default. Requires Claude Code v2.1.269 or later `CLAUDE_CODE_GIT_BASH_PATH`| Windows only: path to the Git Bash executable (`bash.exe`). Use when Git Bash is installed but not in your PATH. If the path doesn’t exist or the file isn’t named `bash.exe`, `sh.exe`, `bash`, or `sh`, Claude Code ignores the variable and auto-detects Git Bash as if it were unset, logging a warning visible with `--debug`. Before v2.1.219, Claude Code exited at startup when the path didn’t exist, and used any existing file as the shell without checking that it was bash or sh. See [Windows setup](</docs/en/setup#set-up-on-windows>) @@ -553,7 +554,6 @@ * Use [the advisor tool](</docs/en/advisor#requirements>), except with Claude Code v2.1.300 or later on Claude Platform on AWS or [Claude Models on Google Cloud (Anthropic managed)](</docs/en/feature-availability#availability-by-model-provider>) * Use [MCP tasks](</docs/en/mcp#mcp-tasks-that-run-on-the-server>) * Turn on [Code Mode](</docs/en/code-mode#requirements>) - * Read or reply to [comments on an artifact](</docs/en/artifacts#collect-comments-on-an-artifact>) * Have Claude read [another organization’s public artifact](</docs/en/artifacts#read-an-artifact-shared-with-you>) * Get the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) by default for claude.ai and Console accounts on Windows with Git Bash installed; Claude Code routes shell commands through Git Bash unless you set `CLAUDE_CODE_USE_POWERSHELL_TOOL=1`. On Windows without Git Bash, the tool stays on * Get [Claude-drafted feedback](</docs/en/tools-reference#sendfeedback-tool-behavior>), which Claude Code turns on through a fetched flag
modified
--- a/env-vars.md +++ b/env-vars.md @@ -206,12 +206,13 @@ `CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_GUARD`| Set to `1` to skip the check that an [Amazon Bedrock](</docs/en/amazon-bedrock>) streaming response carries the `application/vnd.amazon.eventstream` content-type. Without this variable, when a response carries a different content-type, Claude Code fails the request with an error naming that type, which means a [gateway or proxy is transforming the response](</docs/en/amazon-bedrock#streaming-errors-behind-a-gateway-or-proxy>). Configure the gateway to forward the `Content-Type` header and body unmodified rather than setting this variable. Requires Claude Code v2.1.208 or later `CLAUDE_CODE_DISABLE_BG_EXIT_HANDOFF`| Set to `1` to stop a [background session’s](</docs/en/agent-view>) in-flight work when the [supervisor](</docs/en/agent-view#the-supervisor-process>) stops, restarts, or updates that session’s process, instead of handing it to the session’s next process. That work is the session’s running background shell commands, plus background subagents as of v2.1.198. Affects only that handoff: backgrounding a session with `←` or [`/background`](</docs/en/agent-view#from-inside-a-session>) still carries in-flight background work over. Requires Claude Code v2.1.196 or later `CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP`| Set to `1` to stop Claude Code from terminating [background shell commands](</docs/en/interactive-mode#background-bash-commands>) under memory pressure. By default, on macOS and Linux, Claude Code terminates background shells when the operating system reports critical memory pressure and the session has been idle for 30 minutes with no turn or subagent running. Windows has no memory-pressure signal, so this variable has no effect there. Requires Claude Code v2.1.193 or later -`CLAUDE_CODE_DISABLE_BG_STABLE_PATH`| On macOS with the native installer, set to `1` to run each [background session’s](</docs/en/agent-view>) host process from the installed binary, not `~/.local/share/claude/ClaudeCode.app`. macOS may then ask again for permissions such as [folder access](</docs/en/agent-view#background-sessions-can%E2%80%99t-read-desktop-documents-or-downloads-on-macos>), including after each update. Set it in the `env` block of user settings, a managed settings file, or an MDM policy, not your shell. To remove `ClaudeCode.app`, delete it yourself. Requires Claude Code v2.1.295 or later +`CLAUDE_CODE_DISABLE_BG_STABLE_PATH`| On macOS with the native installer, set to `1` to run each [background session’s](</docs/en/agent-view>) host process from the installed binary, not `~/.local/share/claude/ClaudeCode.app`. macOS may then ask again for permissions such as [folder access](</docs/en/agent-view#background-sessions-can%E2%80%99t-read-desktop-documents-or-downloads-on-macos>), including after each update. Set it in the `env` block of user settings, a managed settings file, or an MDM policy, not your shell. Requires Claude Code v2.1.295 or later `CLAUDE_CODE_DISABLE_BUNDLED_SKILLS`| Set to `1` to disable the [skills](</docs/en/skills>) and workflows included with Claude Code: bundled skills and workflows are removed entirely, while built-in commands like `/init` stay typable but are hidden from the model. `/doctor` stays typable like the built-in commands; hide it with `DISABLE_DOCTOR_COMMAND` instead. Skills from plugins, `.claude/skills/`, and `.claude/commands/` are unaffected. Equivalent to the [`disableBundledSkills`](</docs/en/settings-reference#disablebundledskills>) setting `CLAUDE_CODE_DISABLE_CFC_PROMPT`| For hosts that embed Claude Code and supply their own browser guidance. Set to `1` to keep the [Claude in Chrome](</docs/en/chrome>) browser tools available while omitting the Chrome section of the system prompt and the `/claude-in-chrome` [bundled skill](</docs/en/skills#bundled-skills>). In VS Code, the extension at v2.1.314 or later also leaves the Claude in Chrome instructions out of a session’s messages. Requires Claude Code v2.1.257 or later `CLAUDE_CODE_DISABLE_CLAUDE_MDS`| Set to `1` to prevent loading any CLAUDE.md memory files into context, including user, project, and auto memory files `CLAUDE_CODE_DISABLE_CRON`| Set to `1` to disable [session-scoped scheduled tasks](</docs/en/scheduled-tasks#disable-scheduled-tasks>). The `/loop` skill and `CronCreate` become unavailable and any already-scheduled tasks stop firing, including tasks that are already running mid-session `CLAUDE_CODE_DISABLE_DANGEROUS_RM_TIMEOUT`| Set to `1` to turn off the `auto` and `bypassPermissions` [time limit and denials](</docs/en/permission-modes#time-limits-and-denials-in-auto-and-bypasspermissions-modes>) on critical-path removals. These removals then go to the classifier in `auto` mode, and get an untimed prompt in `bypassPermissions` mode wherever Claude Code can show one. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.281 or later +`CLAUDE_CODE_DISABLE_DEFERRED_TOOL_RESUME`| Set to `1` to skip a [deferred tool call](</docs/en/hooks#defer-a-tool-call-for-later>) when you resume or continue with `-p`. Claude can still repeat the call. Ignored in a settings `env` block. Requires Claude Code v2.1.328 or later `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`| Set to `1` to strip pre-release `anthropic-beta` request headers, the body fields that pair with them, and beta tool-schema fields such as `defer_loading` and `eager_input_streaming` from API requests. Use this when a proxy gateway rejects requests with an `Unexpected value(s)` error for the `anthropic-beta` header or an `Extra inputs are not permitted` error. [Disable pre-release capabilities](</docs/en/llm-gateway-protocol#disable-pre-release-capabilities>) lists what the variable removes, including [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>), and what Claude Code keeps sending `CLAUDE_CODE_DISABLE_EXPLORE_PLAN_AGENTS`| Set to `1` to disable the built-in [Explore and Plan subagents](</docs/en/sub-agents#built-in-subagents>). Claude explores with its search tools or the general-purpose subagent instead, and [plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>) reads files directly rather than launching Explore and Plan agents. Custom subagents named `Explore` or `Plan` are unaffected. To remove every built-in subagent type in the Agent SDK or non-interactive mode, use `CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS` instead. Requires Claude Code v2.1.198 or later `CLAUDE_CODE_DISABLE_FAST_MODE`| Set to `1` to disable [fast mode](</docs/en/fast-mode>) @@ -240,7 +241,7 @@ `CLAUDE_CODE_DISABLE_STRUCTURED_OUTPUTS`| Set to `1` to stop Claude Code from sending the structured-output `output_config.format` field and the `anthropic-beta` value that pairs with it, for an [LLM gateway](</docs/en/llm-gateway-protocol#feature-pass-through>) whose upstream rejects them. This leaves on the other pre-release capabilities that [`CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`](</docs/en/llm-gateway-protocol#disable-pre-release-capabilities>) turns off. Requires Claude Code v2.1.288 or later `CLAUDE_CODE_DISABLE_SUBSTITUTION_RM_PROMPT`| Set to `1` to turn off the [critical-path](</docs/en/permission-modes#critical-paths>) check for a recursive `rm` whose target is entirely the output of a command substitution, such as `rm -rf "$(pwd)"`. The other critical-path checks keep running. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.281 or later `CLAUDE_CODE_DISABLE_TERMINAL_TITLE`| Set to `1` to disable automatic terminal title updates based on conversation context. This also skips the background small/fast-model request that [generates a session title](</docs/en/sessions#name-your-sessions>), and turns off [status reports to your terminal](</docs/en/terminal-config#see-session-status-in-your-terminal>) -`CLAUDE_CODE_DISABLE_THINKING`| Set to `1` to omit the `thinking` parameter from API requests entirely. This is a compatibility option for proxies and gateways that reject the parameter. On models that think by default, omitting the parameter means the model may still think. To explicitly disable [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) on the Anthropic API, use `MAX_THINKING_TOKENS=0` instead. Neither variable turns thinking off on Opus 5.5, Sonnet 5.5, Haiku 5.5, or the Fable models, which can’t have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `MAX_THINKING_TOKENS=0` likewise omits the parameter, so the two variables behave the same there +`CLAUDE_CODE_DISABLE_THINKING`| Set to `1` to omit the `thinking` parameter from the API requests for the main conversation’s turns, subagent turns, and the compaction summary. This is a compatibility option for proxies and gateways that reject the parameter. On models that think by default, the model may still think. To explicitly disable [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) on the Anthropic API, use `MAX_THINKING_TOKENS=0` instead. See [where you can’t turn thinking off](</docs/en/model-config#where-you-cant-turn-thinking-off>) `CLAUDE_CODE_DISABLE_ULTRAREVIEW_TRUST_CHECK`| Set to `1` so [`claude ultrareview`](</docs/en/ultrareview#trust-the-folder-before-the-review-runs>) doesn’t exit with `Error: Workspace not trusted` when run without a terminal or with `CI=true`. `claude ultrareview` still asks when it can. From v2.1.314, the variable also skips the trust check in `/ultrareview` and `/code-review ultra`. Set it in the launch environment, not a settings `env` block, and only where every review starts in a folder you trust. Requires Claude Code v2.1.309 or later `CLAUDE_CODE_DISABLE_ULTRATHINK`| Set to `1` to turn the [`ultrathink`](</docs/en/model-config#use-ultrathink-for-one-off-deep-reasoning>) keyword off. Requires Claude Code v2.1.316 or later `CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT`| Set to `1` to skip proactive [auto-compaction](</docs/en/costs#reduce-token-usage>) when Claude Code doesn’t recognize the model ID, such as an [LLM gateway](</docs/en/llm-gateway>) alias. Without this variable, Claude Code compacts at the context window it assumes for the ID. `CLAUDE_CODE_MAX_CONTEXT_TOKENS` can correct the assumed window instead; see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>) for when each variable applies. Requires Claude Code v2.1.223 or later @@ -289,6 +290,7 @@ `CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL`| Set to `1` to stop `/ide` from installing the IDE extension. Equivalent to setting [`autoInstallIdeExtension`](</docs/en/settings-reference#autoinstallideextension>) to `false`. Claude Code versions before v2.1.318 also install or update the extension when you start `claude` in a VS Code, Cursor, or Devin Desktop terminal. This variable stops that too `CLAUDE_CODE_IDE_SKIP_VALID_CHECK`| Set to `1` to skip validation of IDE lockfile entries during connection. Use when auto-connect fails to find your IDE despite it running `CLAUDE_CODE_IDLE_COMPACT_MIN_TOKENS`| Context size, in tokens, at which [idle compaction](</docs/en/settings-reference#idlecompaction>) applies to a conversation (default: `200000`). Accepts a positive whole number, and anything else is ignored. Values below `100000` are raised to `100000`, the lowest threshold. Idle compaction is on by default for conversations that meet its conditions. To turn it off, set `idleCompaction` to `false`. Requires Claude Code v2.1.290 or later +`CLAUDE_CODE_LOOP_KEEPALIVE`| Set to `1` to run one extra iteration of an interactive [self-paced `/loop`](</docs/en/scheduled-tasks#stop-a-loop>) when its second or later iteration ends with nothing scheduled `CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS`| How many [subagents](</docs/en/sub-agents#concurrent-subagent-limit>) can be running in one session before the Agent tool refuses to spawn another (default: 20). Accepts a positive whole number in plain digits; anything else is ignored, so the variable can adjust the cap but can’t disable it. Requires Claude Code v2.1.217 or later `CLAUDE_CODE_MAX_CONTEXT_TOKENS`| Override the context window size Claude Code assumes for the active model. As of v2.1.193, how it applies depends on how Claude Code resolves the model ID; see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>). Use this when routing to a model through `ANTHROPIC_BASE_URL` whose context window does not match the built-in size for its name `CLAUDE_CODE_MAX_MCP_DESCRIPTION_LENGTH`| Maximum length in characters of MCP tool descriptions and MCP server instructions that Claude Code sends to the model. The value you set replaces both [default limits](</docs/en/mcp#for-mcp-server-authors>): 4096, and 16384 for the description of a tool that Claude loads through tool search. Accepts a positive whole number in plain digits. Anything else is ignored and the defaults apply. Requires Claude Code v2.1.280 or later @@ -372,6 +374,8 @@ `CLAUDE_CODE_STARTUP_FAILURE_RESULTS`| Set to `1` to have a session started with `--output-format stream-json` write a [result message naming why Claude Code refused to start](</docs/en/agent-sdk/typescript#startup_failure_reason>) for startup failures that otherwise end with stderr alone. Requires Claude Code v2.1.274 or later `CLAUDE_CODE_STOP_HOOK_BLOCK_CAP`| Maximum number of consecutive times a [Stop](</docs/en/hooks#stop>) or [SubagentStop](</docs/en/hooks#subagentstop>) hook may block the turn from ending before Claude Code overrides it and ends the turn anyway (default: 8). Set to `0` to disable the cap. Raise this if your hook legitimately needs more iterations to resolve `CLAUDE_CODE_STRICT_INLINE_SHELL_RM_PROMPT`| Set to `1` to flag more of the [`-c` scripts](</docs/en/permission-modes#removals-inside-nested-commands-and-inline-scripts>) that Claude Code can’t check, including ones that name neither `rm` nor `rmdir`. Set it in the environment that launches Claude Code, not a settings `env` block. Has no effect when `CLAUDE_CODE_DISABLE_INLINE_SHELL_RM_PROMPT` is `1`. Requires Claude Code v2.1.299 or later +`CLAUDE_CODE_SUBAGENT_EFFORT`| The default [effort level](</docs/en/model-config#adjust-effort-level>) for [subagents](</docs/en/sub-agents#choose-an-effort-level>) and [workflow](</docs/en/workflows>) agents: `low`, `medium`, `high`, `xhigh`, or `max`. It doesn’t apply to forks, forked skills, or teammates. Requires Claude Code v2.1.315 or later +`CLAUDE_CODE_SUBAGENT_HISTORY`| Set to `0` to remove the `/tasks` row where you [reopen subagents that have ended](</docs/en/sub-agents#finished-subagents-in-the-panel-and-task-list>) `CLAUDE_CODE_SUBAGENT_MODEL`| The default model for [subagents](</docs/en/sub-agents#choose-a-model>), [agent team](</docs/en/agent-teams#specify-teammates-and-models>) teammates, and [workflow](</docs/en/workflows>) agents that aren’t assigned a model another way. Accepts an alias such as `haiku` or a full model name. Two sources take precedence over it: a model Claude passes when it spawns the agent, and a `model` field in the agent’s definition, including `inherit`. To change that, set [`CLAUDE_CODE_SUBAGENT_MODEL_FORCE`](</docs/en/sub-agents#run-every-subagent-on-one-model>). See [Choose a model](</docs/en/sub-agents#choose-a-model>) for the full order. Setting it to `inherit` is the same as leaving it unset. Before v2.1.251, this variable overrode both the per-invocation model and the definition’s `model` field `CLAUDE_CODE_SUBAGENT_MODEL_FORCE`| Set to `1` to force one model onto subagents, teammates, and workflow agents. [Run every subagent on one model](</docs/en/sub-agents#run-every-subagent-on-one-model>) says which model that is. Requires Claude Code v2.1.257 or later `CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL`| Set `5m` or `1h`, the only values Claude Code accepts, to choose the [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) for requests outside the main conversation, such as [subagents](</docs/en/sub-agents>), workflows, and background work. Takes precedence over the `subagentPromptCacheTtl` setting and over `ENABLE_PROMPT_CACHING_1H`, and `FORCE_PROMPT_CACHING_5M` overrides it. The API bills 1-hour cache writes at a higher rate. Requires Claude Code v2.1.242 or later @@ -553,8 +557,6 @@ * Have Claude read [another organization’s public artifact](</docs/en/artifacts#read-an-artifact-shared-with-you>) * Get the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) by default for claude.ai and Console accounts on Windows with Git Bash installed; Claude Code routes shell commands through Git Bash unless you set `CLAUDE_CODE_USE_POWERSHELL_TOOL=1`. On Windows without Git Bash, the tool stays on * Get [Claude-drafted feedback](</docs/en/tools-reference#sendfeedback-tool-behavior>), which Claude Code turns on through a fetched flag - * Have Claude [treat large pastes as pasted rather than typed text](</docs/en/terminal-config#how-claude-treats-pasted-text>); the content behind a `[Pasted text #N]` placeholder reaches Claude unmarked - * Have Claude Code [exclude MCP tools whose input schema the API would reject](</docs/en/mcp#tools-with-invalid-input-schemas>) ### First session after an install or upgrade
modified
--- a/env-vars.md +++ b/env-vars.md @@ -125,7 +125,7 @@ `ANTHROPIC_DEFAULT_SONNET_MODEL_DESCRIPTION`| Display description for the pinned Sonnet model in the `/model` picker. When not set, the row shows a default description that begins `Custom Sonnet model`. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) `ANTHROPIC_DEFAULT_SONNET_MODEL_NAME`| Display name for the pinned Sonnet model in the `/model` picker. When not set, the row shows the model’s name if Claude Code recognizes the pinned ID, and the pinned ID otherwise. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) `ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES`| Comma-separated list of [capabilities](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) the pinned Sonnet model supports, for example `effort,thinking`. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) -`ANTHROPIC_FEDERATION_RULE_ID`| Federation rule ID for [Workload Identity Federation](<https://platform.claude.com/docs/en/manage-claude/workload-identity-federation>). When you set it together with `ANTHROPIC_ORGANIZATION_ID`, Claude Code selects federation credentials, which rank above your `/login` credential. See [authentication precedence](</docs/en/authentication#authentication-precedence>) +`ANTHROPIC_FEDERATION_RULE_ID`| Federation rule ID for [Workload Identity Federation](<https://platform.claude.com/docs/en/manage-claude/workload-identity-federation>). Set it together with `ANTHROPIC_ORGANIZATION_ID`. See [authentication precedence](</docs/en/authentication#authentication-precedence>) `ANTHROPIC_FOUNDRY_API_KEY`| API key for Microsoft Foundry authentication (see [Microsoft Foundry](</docs/en/microsoft-foundry>)) `ANTHROPIC_FOUNDRY_AUTH_TOKEN`| Bearer token for Microsoft Foundry authentication, such as a Microsoft Entra access token. Claude Code sends it as the `Authorization: Bearer` header. Takes precedence over `ANTHROPIC_FOUNDRY_API_KEY` and over the Azure default credential chain. See [Microsoft Foundry](</docs/en/microsoft-foundry>). Requires Claude Code v2.1.203 or later `ANTHROPIC_FOUNDRY_BASE_URL`| Full base URL for the Microsoft Foundry resource (for example, `https://my-resource.services.ai.azure.com/anthropic`). Alternative to `ANTHROPIC_FOUNDRY_RESOURCE` (see [Microsoft Foundry](</docs/en/microsoft-foundry>)) @@ -173,7 +173,7 @@ `CLAUDE_CODE_ARTIFACT_PUBLISH_EDITS`| Set to `0` to stop Claude from [applying small changes](</docs/en/artifacts#turn-off-one-step-artifact-updates>) to an artifact’s file as part of publishing it. Claude then edits the file with its file-editing tools and publishes it as a separate step. Requires Claude Code v2.1.300 or later `CLAUDE_CODE_ATTRIBUTION_HEADER`| Set to `0` to omit the [attribution block](</docs/en/llm-gateway-protocol#system-prompt-attribution-block>), which carries the client version and a prompt fingerprint, from the start of the system prompt. Caching on a direct connection to the Anthropic API is unaffected either way. In some direct-connection setups, Claude Code keeps the block on [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) classifier requests even when you set `0`. In [System prompt attribution block](</docs/en/llm-gateway-protocol#system-prompt-attribution-block>), check which connections and credentials this covers. Before v2.1.181 the block included a per-request token on custom base URLs and Microsoft Foundry connections, so on those versions set it to `0` when your LLM gateway caches on the request body or forwards requests to a third-party provider, or when you connect to Microsoft Foundry directly `CLAUDE_CODE_AUTO_BACKGROUND_WORKER_CHECKIN_SECONDS`| Removed in v2.1.283. Use `CLAUDE_CODE_WORKER_CHECKIN_SCHEDULE` instead -`CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the auto-compact window, how full the context gets before compaction, from `100000` to `1000000` tokens. Suffixed values such as `200k` require v2.1.304 or later. For precedence over the other ways to set the window and the effect on the status line’s `used_percentage`, see [Set the auto-compact window](</docs/en/model-config#set-the-auto-compact-window>) +`CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the auto-compact window, which is how full the context gets before compaction, to a token count of `100000` or more. Suffixed values such as `200k` require v2.1.304 or later. For precedence over the other ways to set the window and the effect on the status line’s `used_percentage`, see [Set the auto-compact window](</docs/en/model-config#set-the-auto-compact-window>) `CLAUDE_CODE_AUTO_CONNECT_IDE`| Override automatic [IDE connection](</docs/en/vs-code>). By default, Claude Code connects automatically when launched inside a supported IDE’s integrated terminal. Set to `false` to prevent this. Set to `true` to force a connection attempt when auto-detection fails, such as when tmux obscures the parent terminal. Takes precedence over the [`autoConnectIde`](</docs/en/settings-reference#autoconnectide>) global config setting `CLAUDE_CODE_AUTO_MODE_MODEL`| Sets the model for the classifier requests Claude Code sends in [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>). Use a full model ID such as `claude-sonnet-4-6`. For the cases where Claude Code ignores it, see [Choose the classifier model](</docs/en/permission-modes#choose-the-classifier-model>). Requires Claude Code v2.1.302 or later `CLAUDE_CODE_AUTO_MODE_SERVER`| Controls whether Claude Code asks the server to [review auto mode actions](</docs/en/permission-modes#server-side-classifier-review>). Set to `0` to use Claude Code’s own classifier requests instead. On a direct connection to the Anthropic API, requires v2.1.281 or later. The linked section lists which sessions ask the server when the variable is unset, and from which version. Requires Claude Code v2.1.271 or later @@ -235,12 +235,13 @@ `CLAUDE_CODE_DISABLE_PERMISSION_PROMPT_NOTIFY_HOOKS`| Set to `1` to stop Claude Code from running your [`Notification` hooks for unanswered permission requests](</docs/en/hooks#notification>) in sessions where Claude Code sends them to the Agent SDK’s `canUseTool` callback, which is how Claude Desktop and the VS Code extension host Claude Code. Has no effect in terminal sessions. Requires Claude Code v2.1.233 or later `CLAUDE_CODE_DISABLE_POLICY_SKILLS`| Set to `1` to skip loading skills from the system-wide managed skills directory. Useful for container or CI sessions that should not load operator-provisioned skills `CLAUDE_CODE_DISABLE_POWERSHELL_CMD_RM_DENY`| Set to `1` to turn off the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) check that denies the `cmd` built-ins `rd`, `rmdir`, `del`, and `erase` on a [system path](</docs/en/permission-modes#remove-item-in-powershell>), such as a drive root or your home directory. Claude Code ignores this variable in a settings file’s `env` block. Requires Claude Code v2.1.283 or later +`CLAUDE_CODE_DISABLE_PROXY_SCHEME_REPAIR`| Set to `1` to have Claude Code stop at startup on a plain `host:port` in `HTTPS_PROXY` or `https_proxy` even when it starts with no terminal. Claude Code ignores it in project and local settings. Requires Claude Code v2.1.327 or later `CLAUDE_CODE_DISABLE_REFUSAL_FALLBACK`| Set to `1` to turn off the [automatic model switch when a safety classifier flags a request](</docs/en/model-config#automatic-model-fallback>), the behavior the [`switchModelsOnFlag`](</docs/en/settings-reference#switchmodelsonflag>) setting controls `CLAUDE_CODE_DISABLE_STRUCTURED_OUTPUTS`| Set to `1` to stop Claude Code from sending the structured-output `output_config.format` field and the `anthropic-beta` value that pairs with it, for an [LLM gateway](</docs/en/llm-gateway-protocol#feature-pass-through>) whose upstream rejects them. This leaves on the other pre-release capabilities that [`CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`](</docs/en/llm-gateway-protocol#disable-pre-release-capabilities>) turns off. Requires Claude Code v2.1.288 or later `CLAUDE_CODE_DISABLE_SUBSTITUTION_RM_PROMPT`| Set to `1` to turn off the [critical-path](</docs/en/permission-modes#critical-paths>) check for a recursive `rm` whose target is entirely the output of a command substitution, such as `rm -rf "$(pwd)"`. The other critical-path checks keep running. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.281 or later `CLAUDE_CODE_DISABLE_TERMINAL_TITLE`| Set to `1` to disable automatic terminal title updates based on conversation context. This also skips the background small/fast-model request that [generates a session title](</docs/en/sessions#name-your-sessions>), and turns off [status reports to your terminal](</docs/en/terminal-config#see-session-status-in-your-terminal>) `CLAUDE_CODE_DISABLE_THINKING`| Set to `1` to omit the `thinking` parameter from API requests entirely. This is a compatibility option for proxies and gateways that reject the parameter. On models that think by default, omitting the parameter means the model may still think. To explicitly disable [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) on the Anthropic API, use `MAX_THINKING_TOKENS=0` instead. Neither variable turns thinking off on Opus 5.5, Sonnet 5.5, Haiku 5.5, or the Fable models, which can’t have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `MAX_THINKING_TOKENS=0` likewise omits the parameter, so the two variables behave the same there -`CLAUDE_CODE_DISABLE_ULTRAREVIEW_TRUST_CHECK`| Set to `1` so that [`claude ultrareview`](</docs/en/ultrareview#trust-the-folder-before-the-review-runs>) doesn’t exit with `Error: Workspace not trusted` in a folder you haven’t trusted when it can’t ask you to trust it, such as in CI. Set it in the environment that launches Claude Code, not a settings `env` block, and only where every such run starts in a folder you trust. Runs that can ask still ask. Requires Claude Code v2.1.309 or later +`CLAUDE_CODE_DISABLE_ULTRAREVIEW_TRUST_CHECK`| Set to `1` so [`claude ultrareview`](</docs/en/ultrareview#trust-the-folder-before-the-review-runs>) doesn’t exit with `Error: Workspace not trusted` when run without a terminal or with `CI=true`. `claude ultrareview` still asks when it can. From v2.1.314, the variable also skips the trust check in `/ultrareview` and `/code-review ultra`. Set it in the launch environment, not a settings `env` block, and only where every review starts in a folder you trust. Requires Claude Code v2.1.309 or later `CLAUDE_CODE_DISABLE_ULTRATHINK`| Set to `1` to turn the [`ultrathink`](</docs/en/model-config#use-ultrathink-for-one-off-deep-reasoning>) keyword off. Requires Claude Code v2.1.316 or later `CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT`| Set to `1` to skip proactive [auto-compaction](</docs/en/costs#reduce-token-usage>) when Claude Code doesn’t recognize the model ID, such as an [LLM gateway](</docs/en/llm-gateway>) alias. Without this variable, Claude Code compacts at the context window it assumes for the ID. `CLAUDE_CODE_MAX_CONTEXT_TOKENS` can correct the assumed window instead; see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>) for when each variable applies. Requires Claude Code v2.1.223 or later `CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL`| Set to `1` to disable virtual scrolling in [fullscreen rendering](</docs/en/fullscreen>) and render every message in the transcript. Use this if scrolling in fullscreen mode shows blank regions where messages should appear @@ -370,6 +371,7 @@ `CLAUDE_CODE_SKIP_VERTEX_AUTH`| Skip Google authentication for Google Cloud’s Agent Platform (for example, when using an LLM gateway) `CLAUDE_CODE_STARTUP_FAILURE_RESULTS`| Set to `1` to have a session started with `--output-format stream-json` write a [result message naming why Claude Code refused to start](</docs/en/agent-sdk/typescript#startup_failure_reason>) for startup failures that otherwise end with stderr alone. Requires Claude Code v2.1.274 or later `CLAUDE_CODE_STOP_HOOK_BLOCK_CAP`| Maximum number of consecutive times a [Stop](</docs/en/hooks#stop>) or [SubagentStop](</docs/en/hooks#subagentstop>) hook may block the turn from ending before Claude Code overrides it and ends the turn anyway (default: 8). Set to `0` to disable the cap. Raise this if your hook legitimately needs more iterations to resolve +`CLAUDE_CODE_STRICT_INLINE_SHELL_RM_PROMPT`| Set to `1` to flag more of the [`-c` scripts](</docs/en/permission-modes#removals-inside-nested-commands-and-inline-scripts>) that Claude Code can’t check, including ones that name neither `rm` nor `rmdir`. Set it in the environment that launches Claude Code, not a settings `env` block. Has no effect when `CLAUDE_CODE_DISABLE_INLINE_SHELL_RM_PROMPT` is `1`. Requires Claude Code v2.1.299 or later `CLAUDE_CODE_SUBAGENT_MODEL`| The default model for [subagents](</docs/en/sub-agents#choose-a-model>), [agent team](</docs/en/agent-teams#specify-teammates-and-models>) teammates, and [workflow](</docs/en/workflows>) agents that aren’t assigned a model another way. Accepts an alias such as `haiku` or a full model name. Two sources take precedence over it: a model Claude passes when it spawns the agent, and a `model` field in the agent’s definition, including `inherit`. To change that, set [`CLAUDE_CODE_SUBAGENT_MODEL_FORCE`](</docs/en/sub-agents#run-every-subagent-on-one-model>). See [Choose a model](</docs/en/sub-agents#choose-a-model>) for the full order. Setting it to `inherit` is the same as leaving it unset. Before v2.1.251, this variable overrode both the per-invocation model and the definition’s `model` field `CLAUDE_CODE_SUBAGENT_MODEL_FORCE`| Set to `1` to force one model onto subagents, teammates, and workflow agents. [Run every subagent on one model](</docs/en/sub-agents#run-every-subagent-on-one-model>) says which model that is. Requires Claude Code v2.1.257 or later `CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL`| Set `5m` or `1h`, the only values Claude Code accepts, to choose the [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) for requests outside the main conversation, such as [subagents](</docs/en/sub-agents>), workflows, and background work. Takes precedence over the `subagentPromptCacheTtl` setting and over `ENABLE_PROMPT_CACHING_1H`, and `FORCE_PROMPT_CACHING_5M` overrides it. The API bills 1-hour cache writes at a higher rate. Requires Claude Code v2.1.242 or later @@ -481,6 +483,7 @@ `OTEL_METRICS_INCLUDE_RESOURCE_ATTRIBUTES`| As of v2.1.161, Claude Code attaches `OTEL_RESOURCE_ATTRIBUTES` keys to metric datapoint labels. Set to `false` to exclude them (default: included). See [Monitoring](</docs/en/monitoring-usage#multi-team-organization-support>) `OTEL_METRICS_INCLUDE_SESSION_ID`| Set to `false` to exclude session ID from metric and event attributes (default: included). See [Monitoring](</docs/en/monitoring-usage>) `OTEL_METRICS_INCLUDE_VERSION`| Set to `true` to include Claude Code version in metric and event attributes (default: excluded). See [Monitoring](</docs/en/monitoring-usage>) +`OTEL_RESOURCE_INCLUDE_HOST`| Set to `1` to add the machine’s name and ID to OpenTelemetry resource attributes as `host.name` and `host.id` (default: excluded). Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). Requires Claude Code v2.1.326 or later. See [Identify the machine a session ran on](</docs/en/monitoring-usage#identify-the-machine-a-session-ran-on>) `SLASH_COMMAND_TOOL_CHAR_BUDGET`| Override the character budget for skill metadata shown to the [Skill tool](</docs/en/skills#control-who-invokes-a-skill>). The budget scales dynamically at 1% of the context window, with a fallback of 8,000 characters. Legacy name kept for backwards compatibility `TASK_MAX_OUTPUT_LENGTH`| Removed in v2.1.277 and now a no-op, together with the `TaskOutput` tool it sized. Previously set the maximum number of characters of a [background task’s](</docs/en/tools-reference#background-commands>) output that the `TaskOutput` tool kept. Claude reads a background task’s output file with `Read` instead `USE_BUILTIN_RIPGREP`| Set to `0` to use system-installed `rg` instead of `rg` included with Claude Code
modified
--- a/env-vars.md +++ b/env-vars.md @@ -355,7 +355,7 @@ `CLAUDE_CODE_SESSION_ID`| Set automatically to the current session ID in Bash and PowerShell tool subprocesses, [hook command](</docs/en/hooks>) subprocesses, and stdio [MCP server](</docs/en/mcp>) subprocesses. For Bash, PowerShell, and hooks this matches the `session_id` field in the hook JSON input and is updated on `/clear`. An MCP server subprocess retains the ID it was spawned with. On `--resume <session-id>` it receives the resumed ID, matching hooks and Bash. On `--continue` or `--resume` without an explicit ID it may receive the initial startup ID instead. Use to correlate scripts and external tools with the Claude Code session that launched them `CLAUDE_CODE_SHELL`| Set the shell Claude Code uses to run Bash tool commands. Accepts a path to a `bash` or `zsh` binary, for example `/opt/homebrew/bin/bash`. Other shells such as `fish` are not supported. If the value is not a working `bash` or `zsh` path, Claude Code ignores it and falls back to auto-detection. Auto-detection uses your `$SHELL` when it points to `bash` or `zsh`, otherwise it picks the first working `zsh` then `bash` found on your `PATH` and standard install locations `CLAUDE_CODE_SHELL_PREFIX`| Command prefix that wraps shell commands Claude Code spawns: Bash tool calls, [hook](</docs/en/hooks>) commands, [status line](</docs/en/statusline>) commands, and stdio [MCP server](</docs/en/mcp>) startup commands. PowerShell hooks and exec-form hooks run without the prefix. Useful for logging or auditing. Setting a bare executable path such as `/path/to/logger.sh` runs each command as `/path/to/logger.sh '<command>'`. The wrapper receives the command line as a single shell-quoted argument in `$1`, so the wrapper must re-evaluate `$1` with a shell, for example `exec bash -c "$1"`. Treating `$1` as a bare executable path breaks stdio MCP servers that pass arguments such as `npx -y <package>`. For Bash tool calls, `$1` contains the full shell invocation Claude Code assembles, including environment setup, not only the command Claude ran -`CLAUDE_CODE_SIMPLE`| Set to `1` to run with a minimal system prompt and only the Bash, file read, and file edit tools. MCP tools from `--mcp-config` are still available. Disables auto-discovery of hooks, skills, custom commands, subagents, installed plugins, MCP servers, auto memory, and CLAUDE.md. Skills in a directory you pass with `--add-dir` still load. OAuth tokens and keychain credentials are not read, so Anthropic authentication must come from `ANTHROPIC_API_KEY` or an `apiKeyHelper` in `--settings`. Equivalent to passing [`--bare`](</docs/en/headless#start-faster-with-bare-mode>) +`CLAUDE_CODE_SIMPLE`| Set to `1` to run with a minimal system prompt and the Bash, file read, and file edit tools. MCP tools from `--mcp-config` are still available. OAuth tokens and keychain credentials aren’t read, so for the Anthropic API, set `ANTHROPIC_API_KEY` or an `apiKeyHelper` in `--settings`. Equivalent to passing [`--bare`](</docs/en/headless#start-faster-with-bare-mode>) `CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT`| Choose between Claude Code’s full system prompt and a shorter one with abbreviated tool descriptions. When unset, Haiku 4.5, Sonnet 5, Opus 4.7, and earlier models in those families use the full prompt by default, and newer models use the shorter one. Set to `1` to use the shorter prompt on any model. Set to `0`, `false`, `no`, or `off` to use the full prompt on any model, even where an experiment or server configuration would otherwise select the shorter one. Either prompt keeps the full tool set, hooks, MCP servers, and CLAUDE.md discovery `CLAUDE_CODE_SKIP_ANTHROPIC_AWS_AUTH`| Skip client-side authentication for [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), for gateways that sign requests themselves `CLAUDE_CODE_SKIP_ANTHROPIC_GOOGLE_CLOUD_AUTH`| Skip Google Cloud authentication for [Claude Models on Google Cloud (Anthropic managed)](</docs/en/claude-models-on-google-cloud-anthropic-managed>), for gateways that attach the credentials themselves
modified
--- a/env-vars.md +++ b/env-vars.md @@ -291,7 +291,7 @@ `CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS`| How many [subagents](</docs/en/sub-agents#concurrent-subagent-limit>) can be running in one session before the Agent tool refuses to spawn another (default: 20). Accepts a positive whole number in plain digits; anything else is ignored, so the variable can adjust the cap but can’t disable it. Requires Claude Code v2.1.217 or later `CLAUDE_CODE_MAX_CONTEXT_TOKENS`| Override the context window size Claude Code assumes for the active model. As of v2.1.193, how it applies depends on how Claude Code resolves the model ID; see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>). Use this when routing to a model through `ANTHROPIC_BASE_URL` whose context window does not match the built-in size for its name `CLAUDE_CODE_MAX_MCP_DESCRIPTION_LENGTH`| Maximum length in characters of MCP tool descriptions and MCP server instructions that Claude Code sends to the model. The value you set replaces both [default limits](</docs/en/mcp#for-mcp-server-authors>): 4096, and 16384 for the description of a tool that Claude loads through tool search. Accepts a positive whole number in plain digits. Anything else is ignored and the defaults apply. Requires Claude Code v2.1.280 or later -`CLAUDE_CODE_MAX_OUTPUT_TOKENS`| Set the maximum number of output tokens for most requests. Defaults and caps vary by model; see [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>). Claude Code lowers a value above a model’s cap to the cap. For a model ID Claude Code can’t resolve to a model it knows, the default is 32000 and the cap is 128000. Increasing this value reduces the effective context window available before [auto-compaction](</docs/en/costs#reduce-token-usage>) triggers +`CLAUDE_CODE_MAX_OUTPUT_TOKENS`| Set the maximum number of output tokens for most requests. Defaults and caps vary by model; see [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>). Claude Code lowers a value above a model’s cap to the cap. For a model ID Claude Code [can’t resolve to a model it knows](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>), the default is 32000 and the cap is 128000 `CLAUDE_CODE_MAX_RETRIES`| Override the number of times to retry failed API requests (default: 10). Retrying can stop earlier on `529` overloaded errors. For example, with an API key on an Opus model, it stops at the third `529` and shows [Repeated 529 Overloaded errors](</docs/en/errors#api-error-repeated-529-overloaded-errors>). If you set a [fallback model](</docs/en/settings-reference#fallbackmodel>), Claude Code switches to that model rather than showing the error. Capped at 15 as of v2.1.186; as of v2.1.199, `CLAUDE_CODE_RETRY_WATCHDOG` raises the default and removes the cap. For unattended sessions that need to wait through longer outages, set `CLAUDE_CODE_RETRY_WATCHDOG` instead `CLAUDE_CODE_MAX_SUBAGENTS_PER_SESSION`| Removed in v2.1.224 and now a no-op. Previously capped the total number of [subagents](</docs/en/sub-agents>) Claude could spawn with the Agent tool in one session (default: 200); spawning past the cap failed with `Subagent spawn limit reached`. The [concurrent subagent limit](</docs/en/sub-agents#concurrent-subagent-limit>) and the [depth limit](</docs/en/sub-agents#let-subagents-spawn-their-own-subagents>) still apply `CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH`| Number of [subagent layers](</docs/en/sub-agents#let-subagents-spawn-their-own-subagents>) allowed below the main conversation (default: 3). At the default, subagents can spawn their own subagents, and a subagent at the third layer can’t spawn further; set `1` to turn nesting off. In v2.1.217 through v2.1.218, the default was 1, so a subagent couldn’t spawn its own unless you raised the limit; v2.1.219 raised the default to 3. Accepts a positive whole number in plain digits; anything else is ignored, so the limit can be adjusted but not removed. Requires Claude Code v2.1.217 or later @@ -308,7 +308,7 @@ `CLAUDE_CODE_NONBLOCKING_STDOUT`| Set to `1` to write terminal output through a second non-blocking file descriptor, so a terminal that stops reading, such as a paused tmux control-mode pane or a stalled SSH connection, can’t freeze Claude Code mid-session. Applies on macOS, Linux, and WSL when stdout is a terminal. Requires Claude Code v2.1.261 or later `CLAUDE_CODE_NONSTREAMING_TIMEOUT_RETRIES`| Limit how many times Claude Code re-sends a [non-streaming request](</docs/en/errors#streaming-response-ended-before-any-complete-data-was-received>) that times out. With `0`, the request fails on the first timeout. See [Tune retry behavior](</docs/en/errors#tune-retry-behavior>) for the timeout. Requires Claude Code v2.1.285 or later `CLAUDE_CODE_NO_FLICKER`| Set to `1` to enable [fullscreen rendering](</docs/en/fullscreen>), a research preview that reduces flicker and keeps memory flat in long conversations. Overrides the [`tui`](</docs/en/settings-reference#tui>) setting; you can also switch with `/tui fullscreen` -`CLAUDE_CODE_OAUTH_REFRESH_TOKEN`| OAuth refresh token for claude.ai authentication. When set, `claude auth login` exchanges this token directly instead of opening a browser. Requires `CLAUDE_CODE_OAUTH_SCOPES`. Useful for provisioning authentication in automated environments. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) +`CLAUDE_CODE_OAUTH_REFRESH_TOKEN`| OAuth refresh token for claude.ai authentication. When set, `claude auth login` exchanges this token directly instead of opening a browser. Requires `CLAUDE_CODE_OAUTH_SCOPES`. A refresh token works once, because the exchange replaces it. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) `CLAUDE_CODE_OAUTH_SCOPES`| Space-separated OAuth scopes the refresh token was issued with, such as `"user:profile user:inference user:sessions:claude_code"`. Required when `CLAUDE_CODE_OAUTH_REFRESH_TOKEN` is set. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) `CLAUDE_CODE_OAUTH_TOKEN`| OAuth access token for claude.ai authentication. Alternative to `/login` for SDK and automated environments. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). Takes precedence over keychain-stored credentials. Generate one with [`claude setup-token`](</docs/en/authentication#generate-a-long-lived-token>). Unless you run [`/login`](</docs/en/authentication#authentication-precedence>), Claude Code uses the token you set for the whole session. To replace an expired token, generate a new one and restart `CLAUDE_CODE_OPUS_4_6_FAST_MODE_OVERRIDE`| Removed in v2.1.160 and now a no-op. Previously pinned [fast mode](</docs/en/fast-mode>) to Claude Opus 4.6 instead of the current default. Opus 4.6 no longer supports fast mode
modified
--- a/env-vars.md +++ b/env-vars.md @@ -229,7 +229,7 @@ `CLAUDE_CODE_DISABLE_MOUSE_CLICKS`| Set to `1` to disable click, drag, and hover handling in [fullscreen rendering](</docs/en/fullscreen>) while keeping mouse-wheel scrolling. Use this when you want wheel scroll to work inside Claude Code but don’t want clicks to position the cursor, expand tool output, or open links. `CLAUDE_CODE_DISABLE_MOUSE` takes precedence when both are set. Requires Claude Code v2.1.195 or later `CLAUDE_CODE_DISABLE_MTLS_RELOAD_ON_STALE_CONNECTION`| Set to `1` to stop Claude Code from re-reading the [mTLS client certificate and key](</docs/en/network-config#mtls-authentication>) when an API request fails with a connection-level error, such as a connection reset or a TLS handshake error. With the reload disabled, Claude Code loads rotated files only when it next applies settings or at the next startup. Requires Claude Code v2.1.232 or later `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`| Set to any non-empty value, such as `1`, to disable nonessential network traffic: auto-updates, telemetry, error reporting, the `/feedback` command, [Claude-drafted feedback](</docs/en/tools-reference#sendfeedback-tool-behavior>), release notes, the [PR and MR status badge](</docs/en/interactive-mode#pr-review-status>) checks, and availability checks such as the [fast mode](</docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways>) check. It also stops the [background runs of plugin `command` sources](</docs/en/plugins/loading#when-a-command-source-re-runs>), which are local commands rather than network traffic, because they can trigger dependency installs. **Setting it to`0` or `false` still disables this traffic**, unlike most on/off variables; unset the variable to allow it again. Also disables feature-flag fetching, which makes [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable. Official plugin marketplace auto-install isn’t covered; disable it with `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL`. Doesn’t affect [gateway model discovery](</docs/en/llm-gateway-connect#add-gateway-models-to-the-model-picker>), which has its own opt-in -`CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK`| Set to `1` to disable the non-streaming fallback when a streaming request fails mid-stream. Streaming errors propagate to the retry layer instead. Useful when a proxy or gateway causes the fallback to produce duplicate tool execution +`CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK`| Set to `1` to disable the non-streaming fallback when a streaming request fails mid-stream. Useful when a proxy or gateway causes the fallback to produce duplicate tool execution `CLAUDE_CODE_DISABLE_NOTIFICATION_PRESENCE_CHECK`| Set to `1` to send the `PushNotification` tool’s desktop notification even while you are typing in or focused on the terminal. By default the tool skips both the desktop notification and the [mobile push](</docs/en/remote-control#mobile-push-notifications>) when it detects recent keyboard activity or terminal focus. This variable disables only that local check, so the server can still suppress the mobile push when it detects that you are active. Requires Claude Code v2.1.193 or later `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL`| Set to `1` to disable automatic registration of the official plugin marketplace. Claude Code reads the variable when it is about to register the marketplace, usually during a machine’s first interactive launch. If the variable is set at that point, Claude Code skips the registration permanently. Unsetting the variable later doesn’t undo the skip. Run `claude plugin marketplace add anthropics/claude-plugins-official` to register the marketplace at any time `CLAUDE_CODE_DISABLE_PERMISSION_PROMPT_NOTIFY_HOOKS`| Set to `1` to stop Claude Code from running your [`Notification` hooks for unanswered permission requests](</docs/en/hooks#notification>) in sessions where Claude Code sends them to the Agent SDK’s `canUseTool` callback, which is how Claude Desktop and the VS Code extension host Claude Code. Has no effect in terminal sessions. Requires Claude Code v2.1.233 or later
modified
Show diff (107 lines)
--- a/env-vars.md +++ b/env-vars.md @@ -130,6 +130,10 @@ `ANTHROPIC_FOUNDRY_AUTH_TOKEN`| Bearer token for Microsoft Foundry authentication, such as a Microsoft Entra access token. Claude Code sends it as the `Authorization: Bearer` header. Takes precedence over `ANTHROPIC_FOUNDRY_API_KEY` and over the Azure default credential chain. See [Microsoft Foundry](</docs/en/microsoft-foundry>). Requires Claude Code v2.1.203 or later `ANTHROPIC_FOUNDRY_BASE_URL`| Full base URL for the Microsoft Foundry resource (for example, `https://my-resource.services.ai.azure.com/anthropic`). Alternative to `ANTHROPIC_FOUNDRY_RESOURCE` (see [Microsoft Foundry](</docs/en/microsoft-foundry>)) `ANTHROPIC_FOUNDRY_RESOURCE`| Microsoft Foundry resource name (for example, `my-resource`). Claude Code [refuses a URL or host name](</docs/en/errors#anthropic-foundry-resource-must-be-a-foundry-resource-name>). Required if `ANTHROPIC_FOUNDRY_BASE_URL` is not set (see [Microsoft Foundry](</docs/en/microsoft-foundry>)) +`ANTHROPIC_GOOGLE_CLOUD_BASE_URL`| Override the [Claude Models on Google Cloud (Anthropic managed)](</docs/en/claude-models-on-google-cloud-anthropic-managed>) endpoint URL, for example when routing through an [LLM gateway](</docs/en/llm-gateway>) +`ANTHROPIC_GOOGLE_CLOUD_LOCATION`| Google Cloud location that Claude Code puts in the [Claude Models on Google Cloud (Anthropic managed)](</docs/en/claude-models-on-google-cloud-anthropic-managed>) request URL. Defaults to `global` +`ANTHROPIC_GOOGLE_CLOUD_PROJECT`| Google Cloud project ID for [Claude Models on Google Cloud (Anthropic managed)](</docs/en/claude-models-on-google-cloud-anthropic-managed>) +`ANTHROPIC_GOOGLE_CLOUD_WORKSPACE_ID`| Workspace ID for [Claude Models on Google Cloud (Anthropic managed)](</docs/en/claude-models-on-google-cloud-anthropic-managed>). Required, unless you’re on v2.1.307 or later and `ANTHROPIC_GOOGLE_CLOUD_BASE_URL` is set `ANTHROPIC_MODEL`| Name of the model setting to use (see [Model Configuration](</docs/en/model-config#environment-variables>)) `ANTHROPIC_ORGANIZATION_ID`| Organization ID for [Workload Identity Federation](<https://platform.claude.com/docs/en/manage-claude/workload-identity-federation>). Set it together with `ANTHROPIC_FEDERATION_RULE_ID`. See [authentication precedence](</docs/en/authentication#authentication-precedence>) `ANTHROPIC_PROFILE`| Name of the Anthropic profile to authenticate with, such as one created by [`ant auth login`](<https://platform.claude.com/docs/en/cli-sdks-libraries/cli/authentication>) or by [signing in to a Console account without an API key](</docs/en/authentication#sign-in-without-an-api-key>). See [authentication precedence](</docs/en/authentication#authentication-precedence>) @@ -173,6 +177,7 @@ `CLAUDE_CODE_AUTO_CONNECT_IDE`| Override automatic [IDE connection](</docs/en/vs-code>). By default, Claude Code connects automatically when launched inside a supported IDE’s integrated terminal. Set to `false` to prevent this. Set to `true` to force a connection attempt when auto-detection fails, such as when tmux obscures the parent terminal. Takes precedence over the [`autoConnectIde`](</docs/en/settings-reference#autoconnectide>) global config setting `CLAUDE_CODE_AUTO_MODE_MODEL`| Sets the model for the classifier requests Claude Code sends in [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>). Use a full model ID such as `claude-sonnet-4-6`. For the cases where Claude Code ignores it, see [Choose the classifier model](</docs/en/permission-modes#choose-the-classifier-model>). Requires Claude Code v2.1.302 or later `CLAUDE_CODE_AUTO_MODE_SERVER`| Controls whether Claude Code asks the server to [review auto mode actions](</docs/en/permission-modes#server-side-classifier-review>). Set to `0` to use Claude Code’s own classifier requests instead. On a direct connection to the Anthropic API, requires v2.1.281 or later. The linked section lists which sessions ask the server when the variable is unset, and from which version. Requires Claude Code v2.1.271 or later +`CLAUDE_CODE_AUTOMOUNT_ROOTS`| Automount root folders for Claude Code to skip when it looks in the folders above your working directory for files such as `CLAUDE.md`, skills, and `.mcp.json`. Set it when those lookups wait on your automounter. Separate multiple paths with `:` on Unix or `;` on Windows, and give each as an absolute path with no symlink in it. Requires Claude Code v2.1.323 or later `CLAUDE_CODE_AWS_CHAIN_RESOLVE_TIMEOUT_MS`| Time in milliseconds Claude Code waits for the AWS default credential provider chain to produce credentials before the request fails with [`AWS default-chain credential resolve timed out`](</docs/en/errors#aws-default-chain-credential-resolve-timed-out>) (default: `60000`). Raise it when a step in your chain legitimately needs longer, such as a browser-based SSO sign-in with MFA through a wrapper like `aws-vault`. Applies on Amazon Bedrock, [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), and the [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>). See [credential caching and resolution timeout](</docs/en/amazon-bedrock#credential-caching-and-resolution-timeout>). Requires Claude Code v2.1.207 or later `CLAUDE_CODE_BASH_EDIT_DIFF`| Set to `0` to turn off the [diff of the files that changed while a Bash command ran](</docs/en/hooks#bash>), or `1` to record it in every permission mode. Takes precedence over the [`bashEditDiffEnabled`](</docs/en/settings-reference#basheditdiffenabled>) setting. Requires Claude Code v2.1.269 or later `CLAUDE_CODE_BG_TASKS_REPORT_RUNNING`| Set to `0` to make a non-interactive session report an idle status to its host at every turn end, even while background work is still running. By default, the session keeps reporting a running status past turn end while background work such as a background agent or a [workflow](</docs/en/workflows>) run is still live. This keeps a host that watches the status, such as a remote session list, from announcing that Claude is waiting for your input mid-work. Background shell commands, such as a dev server, don’t hold the running status. The running-status default and the `0` opt-out require Claude Code v2.1.269 or later; on earlier versions, set `1` to hold the running status @@ -216,7 +221,7 @@ `CLAUDE_CODE_DISABLE_FILE_MENTIONS`| Set to `1` to stop Claude Code from expanding [`@` mentions](</docs/en/common-workflows#reference-files-and-directories>) of files and directories. Claude instead gets the mentioned paths with a note to read them using its file tools. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). Requires Claude Code v2.1.299 or later `CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS`| Set to `1` to remove built-in commit and PR workflow instructions and the git status snapshot from Claude’s context. Useful when using your own git workflow skills. Takes precedence over the [`includeGitInstructions`](</docs/en/settings-reference#includegitinstructions>) setting when set `CLAUDE_CODE_DISABLE_INLINE_SHELL_RM_PROMPT`| Set to `1` to stop Claude Code from reading scripts passed to a shell with `-c`, such as `bash -c 'rm -rf ~'`, for [critical-path](</docs/en/permission-modes#removals-inside-nested-commands-and-inline-scripts>) removals. Claude Code still checks the shell variable and positional parameter targets in those scripts, and the other critical-path checks keep running. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.288 or later -`CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP`| Set to `1` to prevent automatic remapping of Opus 4 and Opus 4.1 to the current Opus version on the Anthropic API. Use when you intentionally want to pin an older model. The remap does not run on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry +`CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP`| Set to `1` to prevent automatic remapping of Opus 4 and Opus 4.1 to the current Opus version on the Anthropic API. The remap doesn’t run on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry `CLAUDE_CODE_DISABLE_MCP_TASK_BACKGROUND`| Set to `1` so that Claude waits for the result of an [MCP task](</docs/en/mcp#make-claude-wait-for-the-result-of-an-mcp-task>) in an interactive session. While [automatic backgrounding](</docs/en/mcp#automatic-backgrounding-of-long-tool-calls>) is on, it still moves the call to the background after two minutes by default. Requires Claude Code v2.1.304 or later `CLAUDE_CODE_DISABLE_MODEL_ACCESS_FALLBACK`| Set to `1` to stop Claude Code on [Amazon Bedrock](</docs/en/amazon-bedrock#when-a-model-is-disabled-mid-session>) and [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai#when-a-model-is-disabled-mid-session>) from switching to an older model when your account loses access to a session’s model mid-session; the refused request fails at once instead. A [fallback model chain](</docs/en/model-config#fallback-model-chains>) you configure still switches on that refusal, and the [startup model checks](</docs/en/amazon-bedrock#startup-model-checks>) still fall back at launch. Requires Claude Code v2.1.285 or later `CLAUDE_CODE_DISABLE_MOUNTED_DRIVE_RM_PROMPT`| Set to `1` to turn off the [mounted drive prompt](</docs/en/permission-modes#the-mounted-drive-prompt>) for paths such as `/Volumes/USB`. Set it in the environment that launches Claude Code, because Claude Code [ignores it in a settings `env` block](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). Requires Claude Code v2.1.304 or later @@ -236,6 +241,7 @@ `CLAUDE_CODE_DISABLE_TERMINAL_TITLE`| Set to `1` to disable automatic terminal title updates based on conversation context. This also skips the background small/fast-model request that [generates a session title](</docs/en/sessions#name-your-sessions>), and turns off [status reports to your terminal](</docs/en/terminal-config#see-session-status-in-your-terminal>) `CLAUDE_CODE_DISABLE_THINKING`| Set to `1` to omit the `thinking` parameter from API requests entirely. This is a compatibility option for proxies and gateways that reject the parameter. On models that think by default, omitting the parameter means the model may still think. To explicitly disable [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) on the Anthropic API, use `MAX_THINKING_TOKENS=0` instead. Neither variable turns thinking off on Opus 5.5, Sonnet 5.5, Haiku 5.5, or the Fable models, which can’t have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `MAX_THINKING_TOKENS=0` likewise omits the parameter, so the two variables behave the same there `CLAUDE_CODE_DISABLE_ULTRAREVIEW_TRUST_CHECK`| Set to `1` so that [`claude ultrareview`](</docs/en/ultrareview#trust-the-folder-before-the-review-runs>) doesn’t exit with `Error: Workspace not trusted` in a folder you haven’t trusted when it can’t ask you to trust it, such as in CI. Set it in the environment that launches Claude Code, not a settings `env` block, and only where every such run starts in a folder you trust. Runs that can ask still ask. Requires Claude Code v2.1.309 or later +`CLAUDE_CODE_DISABLE_ULTRATHINK`| Set to `1` to turn the [`ultrathink`](</docs/en/model-config#use-ultrathink-for-one-off-deep-reasoning>) keyword off. Requires Claude Code v2.1.316 or later `CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT`| Set to `1` to skip proactive [auto-compaction](</docs/en/costs#reduce-token-usage>) when Claude Code doesn’t recognize the model ID, such as an [LLM gateway](</docs/en/llm-gateway>) alias. Without this variable, Claude Code compacts at the context window it assumes for the ID. `CLAUDE_CODE_MAX_CONTEXT_TOKENS` can correct the assumed window instead; see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>) for when each variable applies. Requires Claude Code v2.1.223 or later `CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL`| Set to `1` to disable virtual scrolling in [fullscreen rendering](</docs/en/fullscreen>) and render every message in the transcript. Use this if scrolling in fullscreen mode shows blank regions where messages should appear `CLAUDE_CODE_DISABLE_WEB_FETCH`| Set to `1` to turn off the [WebFetch](</docs/en/tools-reference#webfetch-tool-behavior>) tool. The [WebSearch](</docs/en/tools-reference#websearch-tool-behavior>) tool stays available. Requires Claude Code v2.1.285 or later @@ -260,6 +266,7 @@ `CLAUDE_CODE_EVEN_MORE_DANGEROUSLY_SKIP_PERMISSIONS`| Set to `1` to [run dangerous `rm` commands with no prompt](</docs/en/permission-modes#turn-off-the-critical-path-removal-prompt-in-bypasspermissions-mode>) in `bypassPermissions` mode, which removes a safety prompt for destructive deletes. The linked section lists where it has no effect. Set it in the environment that launches Claude Code, because Claude Code [ignores it in a settings `env` block](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). Requires Claude Code v2.1.311 or later `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 `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS`| Set to `1` to enable [agent teams](</docs/en/agent-teams>). Agent teams are experimental and disabled by default +`CLAUDE_CODE_EXPERIMENTAL_CODE_MODE`| Set to `1` to start sessions in [Code Mode](</docs/en/code-mode>), an experimental feature. Set to `0` to keep it off, or in managed settings to [block it for an organization](</docs/en/code-mode#block-code-mode-for-your-organization>). The variable [doesn’t count in every settings file](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). See the [version and account requirements](</docs/en/code-mode#requirements>) `CLAUDE_CODE_EXTRA_BODY`| JSON object to merge into the top level of model request bodies except on some requests outside the conversation, such as `/model` checks. Useful for passing provider-specific parameters that Claude Code doesn’t expose directly. A value exported in your shell also applies to the [background sessions](</docs/en/agent-view>) you dispatch with `claude agents` or `--bg`. Before v2.1.206, background sessions ignored a shell-exported value and used whatever copy the background supervisor process inherited `CLAUDE_CODE_FILE_READ_MAX_OUTPUT_TOKENS`| Override the default token limit for [file reads](</docs/en/tools-reference#large-files>), which is 25,000 tokens. Useful when you need to read larger files in full. A read that Claude makes with the `allow_large` parameter can go past this limit when the context window has room `CLAUDE_CODE_FORCE_SESSION_PERSISTENCE`| Set to `1` to force transcript persistence, prompt history, and `claude agents` registration even when this `claude` was launched from inside another Claude Code session. Use when an inherited `CLAUDE_CODE_CHILD_SESSION` value, for example from a `screen` session or a background launcher first started by Claude Code’s Bash tool, causes a genuine top-level session to be misclassified as nested. As of v2.1.178, Claude Code detects the tmux case automatically and ignores the inherited marker, so tmux no longer needs this variable. Also honored on v2.1.169 and earlier; has no effect on v2.1.170 and v2.1.171, where the nested-session detection it overrides was removed @@ -310,13 +317,13 @@ `CLAUDE_CODE_OTEL_FLUSH_TIMEOUT_MS`| Timeout in milliseconds for flushing pending OpenTelemetry spans (default: 5000). See [Monitoring](</docs/en/monitoring-usage>) `CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS`| Interval for refreshing dynamic OpenTelemetry headers in milliseconds (default: 1740000 / 29 minutes). See [Dynamic headers](</docs/en/monitoring-usage#dynamic-headers>) `CLAUDE_CODE_OTEL_SHUTDOWN_TIMEOUT_MS`| Timeout in milliseconds for the OpenTelemetry exporter to finish on shutdown (default: 2000). Increase if metrics are dropped at exit. See [Monitoring](</docs/en/monitoring-usage>) -`CLAUDE_CODE_OVERLOADED_RETRY_BASE_DELAY_MS`| Starting delay in milliseconds, in place of the default 500, of the exponential backoff between [automatic retries](</docs/en/errors#tune-retry-behavior>) of a request that the API rejects with a `529` overloaded error. Raise it to spread the retries over a longer window when the API is at capacity. Give whole milliseconds from 500 to 32000 in plain digits; Claude Code treats any other value as unset. Has no effect when `CLAUDE_CODE_RETRY_WATCHDOG` is set to `1`, or when the rejected request was sent in [fast mode](</docs/en/fast-mode#handle-rate-limits>). Requires Claude Code v2.1.292 or later -`CLAUDE_CODE_OVERLOADED_RETRY_MAX_DELAY_MS`| Ceiling in milliseconds, in place of the default 32000, on the exponential backoff between [automatic retries](</docs/en/errors#tune-retry-behavior>) of a request that the API rejects with a `529` overloaded error. Raise it so that later retries keep spreading apart when the API is at capacity. Give whole milliseconds from 32000 to 64000 in plain digits; Claude Code treats any other value as unset. Has no effect when `CLAUDE_CODE_RETRY_WATCHDOG` is set to `1`, or when the rejected request was sent in [fast mode](</docs/en/fast-mode#handle-rate-limits>). Requires Claude Code v2.1.296 or later +`CLAUDE_CODE_OVERLOADED_RETRY_BASE_DELAY_MS`| Starting delay in milliseconds of the backoff between retries of a request that the API rejects with a `529` overloaded error (default: 500). Raise it to spread the retries over a longer window when the API is at capacity. Give whole milliseconds from 500 to 32000 in plain digits; Claude Code treats any other value as unset. See [when it has no effect](</docs/en/errors#tune-retry-behavior>). Requires Claude Code v2.1.292 or later +`CLAUDE_CODE_OVERLOADED_RETRY_MAX_DELAY_MS`| Ceiling in milliseconds on the backoff between retries of a request that the API rejects with a `529` overloaded error (default: 32000). Raise it so that later retries keep spreading apart. Give whole milliseconds from 32000 to 300000 in plain digits; Claude Code treats any other value as unset. Values above 64000 require v2.1.323 or later. See [when it has no effect](</docs/en/errors#tune-retry-behavior>). Requires Claude Code v2.1.296 or later `CLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATE`| Set to `1` to let Claude Code run your package manager’s upgrade command in the background when a new version is available. Applies to Homebrew and WinGet installations. Other package managers continue to show the upgrade command without running it. See [Auto updates](</docs/en/setup#auto-updates>) `CLAUDE_CODE_PERFORCE_MODE`| Set to `1` to enable Perforce-aware write protection. When set, Edit, Write, and NotebookEdit fail with a `p4 edit <file>` hint if the target file lacks the owner-write bit, which Perforce clears on synced files until `p4 edit` opens them. This prevents Claude Code from bypassing Perforce change tracking `CLAUDE_CODE_PLUGIN_CACHE_DIR`| Override the plugins root directory. Despite the name, this sets the parent directory, not the cache itself: marketplaces and the plugin cache live in subdirectories under this path. Defaults to `~/.claude/plugins` `CLAUDE_CODE_PLUGIN_DIRS`| Plugin directories to load for the session, each loaded the way a [`--plugin-dir`](</docs/en/plugins/cli-reference#flags-that-load-a-plugin-for-one-session>) flag loads it. Separate multiple paths with `:` on Unix or `;` on Windows. Give each path as an absolute path or start it with `~`, because Claude Code skips relative paths. Requires Claude Code v2.1.280 or later. See [Load a plugin for one session](</docs/en/plugins/create#load-a-directory-or-archive-for-one-session>) -`CLAUDE_CODE_PLUGIN_DIR_WATCH`| Controls whether Claude Code reloads a [mod](</docs/en/plugins/mods/overview>) when the mod’s files change. Reloading applies to a mod you load from a directory with `--plugin-dir`, and it’s on by default in interactive sessions. Set to `1` to turn it on in non-interactive sessions as well, or `0` to turn it off in every session. Requires Claude Code v2.1.287 or later. See [mod settings and environment variables](</docs/en/plugins/mods/reference#settings-and-environment-variables>) +`CLAUDE_CODE_PLUGIN_DIR_WATCH`| Controls whether a [mod](</docs/en/plugins/mods/overview>) reloads when its files change. By default, mods in [skills directories](</docs/en/plugins/org#keep-skills-directory-plugins-loading>) reload in any session that takes more than one prompt, [non-interactive](</docs/en/headless>) included. Mods in `--plugin-dir` directories reload only in interactive terminal sessions. Set to `1` to reload them as skills-directory mods do, or `0` to turn reloading off everywhere. Requires Claude Code v2.1.287 or later `CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS`| Timeout in milliseconds for cloning or refreshing a plugin marketplace (default: 120000). Increase this value for large repositories or slow network connections. See [Git clone timed out](</docs/en/plugins/troubleshooting#git-clone-timed-out-after-120s>) `CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE`| Set to `1` to skip the re-clone attempt and keep using the existing marketplace checkout when a marketplace refresh can’t reach or authenticate to the remote. Useful in offline or airgapped environments where re-cloning would fail the same way. See [Marketplace updates fail in offline environments](</docs/en/plugins/troubleshooting#marketplace-updates-keep-failing-offline>) `CLAUDE_CODE_PLUGIN_PREFER_HTTPS`| Set to `1` to clone GitHub `owner/repo` shorthand sources over HTTPS instead of SSH. Applies to plugin install and update, and to `/plugin marketplace add` and `update`. Useful in CI runners, containers, or any environment without a configured SSH key for `github.com` @@ -332,6 +339,7 @@ `CLAUDE_CODE_REMOTE`| Set automatically to `true` when Claude Code is running as a [cloud session](</docs/en/claude-code-on-the-web>). Read this from a hook or setup script to detect whether you are in a cloud session `CLAUDE_CODE_REMOTE_SESSION_ID`| Set automatically in [cloud sessions](</docs/en/claude-code-on-the-web>) to the current session’s ID. Read this to construct a link back to the session transcript. See [Link output back to the session](</docs/en/cloud-environments#link-output-back-to-the-session>) `CLAUDE_CODE_RESTRICTED`| Set to `1` to start the session in restricted mode, the same as passing [`--restricted`](</docs/en/cli-reference#cli-flags>). Claude Code ignores this variable in a settings file’s `env` block. Requires Claude Code v2.1.248 or later +`CLAUDE_CODE_RESUME_HINT_COMMAND`| In a wrapper script that starts Claude Code, set this to the name you type to run the wrapper, such as `mytool`. A local session then prints `mytool --resume <session-id>` at exit in place of `claude --resume <session-id>`. Claude Code ignores a name that doesn’t match `^\w[\w-]*$`. It also ignores the variable in a settings file’s `env` block. Requires Claude Code v2.1.323 or later `CLAUDE_CODE_RESUME_INTERRUPTED_TURN`| Set to `1` to automatically resume if the previous session ended mid-turn. Used in SDK mode so the model continues without requiring the SDK to re-send the prompt. To turn this off, unset the variable or set it to `0`. For the VS Code chat panel, see [Continue conversations after a reload](</docs/en/vs-code#continue-conversations-after-a-reload>) `CLAUDE_CODE_RESUME_INTERRUPTED_TURN_MAX_AGE_MS`| Maximum age in milliseconds of the last transcript message for a session that ended mid-turn to continue automatically on resume. When the last message is older than this bound, Claude Code skips the `CLAUDE_CODE_RESUME_INTERRUPTED_TURN` automatic resume and its `CLAUDE_CODE_RESUME_PROMPT` continuation message, and the session starts idle so you continue explicitly. Unset or `0` sets no bound, except that some turns resume only within six hours of their last message, such as one that ended with an API error. A positive value bounds every turn, including those; a negative or non-numeric value applies a one-hour bound. Spawn scripts for long-running agents can set this so a restart against an old transcript doesn’t re-run a stale prompt. Claude Code sets a one-hour bound itself when it restarts a crashed [agent view](</docs/en/agent-view>) session that inherited its conversation from an interactive session. Requires Claude Code v2.1.211 or later `CLAUDE_CODE_RESUME_PROMPT`| Override the continuation message Claude Code sends to Claude when `CLAUDE_CODE_RESUME_INTERRUPTED_TURN` continues an interrupted turn instead of resending its prompt, or when you resume a [deferred tool call](</docs/en/hooks#defer-a-tool-call-for-later>) with `-p`. Defaults to `Continue from where you left off.`. An empty string uses the default @@ -350,6 +358,7 @@ `CLAUDE_CODE_SIMPLE`| Set to `1` to run with a minimal system prompt and only the Bash, file read, and file edit tools. MCP tools from `--mcp-config` are still available. Disables auto-discovery of hooks, skills, custom commands, subagents, installed plugins, MCP servers, auto memory, and CLAUDE.md. Skills in a directory you pass with `--add-dir` still load. OAuth tokens and keychain credentials are not read, so Anthropic authentication must come from `ANTHROPIC_API_KEY` or an `apiKeyHelper` in `--settings`. Equivalent to passing [`--bare`](</docs/en/headless#start-faster-with-bare-mode>) `CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT`| Choose between Claude Code’s full system prompt and a shorter one with abbreviated tool descriptions. When unset, Haiku 4.5, Sonnet 5, Opus 4.7, and earlier models in those families use the full prompt by default, and newer models use the shorter one. Set to `1` to use the shorter prompt on any model. Set to `0`, `false`, `no`, or `off` to use the full prompt on any model, even where an experiment or server configuration would otherwise select the shorter one. Either prompt keeps the full tool set, hooks, MCP servers, and CLAUDE.md discovery `CLAUDE_CODE_SKIP_ANTHROPIC_AWS_AUTH`| Skip client-side authentication for [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), for gateways that sign requests themselves +`CLAUDE_CODE_SKIP_ANTHROPIC_GOOGLE_CLOUD_AUTH`| Skip Google Cloud authentication for [Claude Models on Google Cloud (Anthropic managed)](</docs/en/claude-models-on-google-cloud-anthropic-managed>), for gateways that attach the credentials themselves `CLAUDE_CODE_SKIP_AWS_CRED_CACHE`| Set to `1` to turn off the in-process cache of credentials resolved from the AWS default credential provider chain, so Claude Code resolves the chain on every API request. With the cache off, an SSO-backed profile requests credentials from IAM Identity Center on every request. See [credential caching and resolution timeout](</docs/en/amazon-bedrock#credential-caching-and-resolution-timeout>). Requires Claude Code v2.1.207 or later `CLAUDE_CODE_SKIP_BEDROCK_AUTH`| Skip AWS authentication for Amazon Bedrock (for example, when using an LLM gateway) `CLAUDE_CODE_SKIP_FAST_MODE_NETWORK_ERRORS`| Set to `1` to treat a failed [fast mode](</docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways>) availability check as available, for networks that block the check’s direct request to `api.anthropic.com`. Claude Code still honors a “disabled by your organization” response @@ -367,7 +376,7 @@ `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB`| Set to `1` to strip credentials from the environments of the subprocesses Claude Code starts, such as Bash commands, hooks, and stdio MCP servers. The scrub recognizes a credential by its variable name or its value, and it leaves GitHub tokens and proxy settings in place. See What the subprocess environment scrub removes. `claude-code-action` sets this automatically when `allowed_non_write_users` is configured `CLAUDE_CODE_SYNC_PLUGIN_INSTALL`| Set to `1` in non-interactive mode (the `-p` flag) to wait for plugin installation to complete before the first query. Without this, plugins install in the background and may not be available on the first turn. Combine with `CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS` to bound the wait `CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS`| Timeout in milliseconds for synchronous plugin installation. When exceeded, Claude Code proceeds without plugins and logs an error. No default: without this variable, synchronous installation waits until complete -`CLAUDE_CODE_SYNC_SKILLS`| Set to `1` in non-interactive mode with the `-p` flag to make Claude Code download the skills enabled for your claude.ai account in that run and wait for the list of them, up to `CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS`, before it runs the first query. Requires claude.ai authentication. Terminal sessions where you sign in with your claude.ai account [sync these skills](</docs/en/skills#where-synced-skills-load>) without this variable, so set it only when a `-p` run needs your current skills on its first query +`CLAUDE_CODE_SYNC_SKILLS`| Set to `1` to make Claude Code download the skills enabled for your claude.ai account. In non-interactive mode with the `-p` flag, Claude Code also waits up to `CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS` for the list of skills before it runs the first query. Requires claude.ai authentication. Terminal sessions where you sign in with your claude.ai account [sync these skills](</docs/en/skills#where-synced-skills-load>) without this variable. In an interactive session, the variable requires v2.1.323 or later `CLAUDE_CODE_SYNC_SKILLS_INSTALL_TIMEOUT_MS`| Timeout in milliseconds for the skills resync that runs mid-session when an app built on the [Agent SDK](</docs/en/agent-sdk/typescript#query-object>) reloads skills (default: 30000). When exceeded, the reload continues with whichever skills have arrived, and the remaining downloads finish in the background `CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS`| Timeout in milliseconds for the first query to wait for the initial skill list when `CLAUDE_CODE_SYNC_SKILLS` is set (default: 5000). When exceeded, the first query runs with whichever skills have arrived. The downloads finish in the background either way, and Claude waits for a skill’s download when it invokes that skill `CLAUDE_CODE_SYNTAX_HIGHLIGHT`| Set to `false` to disable syntax highlighting in diff output. Useful when colors interfere with your terminal setup. To also disable highlighting in code blocks and file previews, use the [`syntaxHighlightingDisabled`](</docs/en/settings-reference#syntaxhighlightingdisabled>) setting @@ -379,6 +388,7 @@ `CLAUDE_CODE_TRANSCRIPT_LOCAL_GC`| Set to `1` to limit how large the [transcript file](</docs/en/sessions#where-transcripts-are-stored>) of a long `-p` or Agent SDK session grows. After each compaction, once the file is larger than 5 MB, Claude Code removes the history from before that compaction. On v2.1.296 or later, the file stays as it is when removing that history would shrink it by less than 10%. Resuming the session restores the same conversation whether or not the file was trimmed. Set it in the environment you start Claude Code from, since a settings `env` block can’t turn it on. Requires Claude Code v2.1.287 or later `CLAUDE_CODE_USER_DIALOG_TIMEOUT_MS`| Deadline in milliseconds before Claude Code cancels a dialog it forwards to a remote client such as a [Remote Control](</docs/en/remote-control>) or SDK host, or the approval dialog for a [held cross-session message](</docs/en/cross-session-messaging#control-inbound-messages>); permission prompts and `AskUserQuestion` questions use their own flows and aren’t governed by it. On Claude Code v2.1.236 or later, it also bounds the mid-session [Fable usage-credits consent prompt](</docs/en/model-config#fable-and-usage-credits>) in a session that may be running unattended. [Control inbound messages](</docs/en/cross-session-messaging#control-inbound-messages>) and [non-interactive sessions](</docs/en/cross-session-messaging#non-interactive-sessions>) cover the full held-message expiry rules, including the cases where the deadline doesn’t apply. Overrides the [`dialogExpiry`](</docs/en/settings-reference#dialogexpiry>) setting. `0` or a negative value disables the deadline. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) `CLAUDE_CODE_USE_ANTHROPIC_AWS`| Use [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) +`CLAUDE_CODE_USE_ANTHROPIC_GOOGLE_CLOUD`| Use [Claude Models on Google Cloud (Anthropic managed)](</docs/en/claude-models-on-google-cloud-anthropic-managed>) `CLAUDE_CODE_USE_BEDROCK`| Use [Amazon Bedrock](</docs/en/amazon-bedrock>) `CLAUDE_CODE_USE_FOUNDRY`| Use [Microsoft Foundry](</docs/en/microsoft-foundry>) `CLAUDE_CODE_USE_MANTLE`| Use the Amazon Bedrock [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>) @@ -533,8 +543,9 @@ * Run [`/restart`](</docs/en/commands>) on Pro, Max, and Ultra plans * Sync the [skills](</docs/en/skills#where-synced-skills-load>) and [plugins](</docs/en/plugins/loading#synced-plugins>) enabled for your claude.ai account into your terminal sessions * Turn on the [You should know mod](</docs/en/interactive-mode#you-should-know-suggestions>) - * Use [the advisor tool](</docs/en/advisor#requirements>), except on Claude Platform on AWS with Claude Code v2.1.300 or later + * Use [the advisor tool](</docs/en/advisor#requirements>), except with Claude Code v2.1.300 or later on Claude Platform on AWS or [Claude Models on Google Cloud (Anthropic managed)](</docs/en/feature-availability#availability-by-model-provider>) * Use [MCP tasks](</docs/en/mcp#mcp-tasks-that-run-on-the-server>) + * Turn on [Code Mode](</docs/en/code-mode#requirements>) * Read or reply to [comments on an artifact](</docs/en/artifacts#collect-comments-on-an-artifact>) * Have Claude read [another organization’s public artifact](</docs/en/artifacts#read-an-artifact-shared-with-you>) * Get the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) by default for claude.ai and Console accounts on Windows with Git Bash installed; Claude Code routes shell commands through Git Bash unless you set `CLAUDE_CODE_USE_POWERSHELL_TOOL=1`. On Windows without Git Bash, the tool stays on
modified
Show diff (110 lines)
--- a/env-vars.md +++ b/env-vars.md @@ -5,19 +5,11 @@ * Look up the variables Claude Code reads * See which features stop working when a variable turns feature-flag fetching off -## - -​ - -Set environment variables +## Set environment variables A variable you set in your shell lasts for that terminal session, while a variable in a settings file applies every time `claude` runs. -### - -​ - -Set variables in your shell +### Set variables in your shell Set the variable before launching `claude`: @@ -56,11 +48,7 @@ echo %API_TIMEOUT_MS% -### - -​ - -Set variables in settings files +### Set variables in settings files Add variables under the `env` key in a `settings.json` file, creating the file if it doesn’t exist. Claude Code reads them directly from the file, so they take effect no matter how `claude` was launched. A running session applies new and changed values to its environment when you save the file, but a feature that reads its variables once at startup, such as [OpenTelemetry monitoring](</docs/en/monitoring-usage>), keeps its startup values until you relaunch. Removing a variable from the file doesn’t unset it in a running session; the removal takes effect the next time you launch `claude`. @@ -84,19 +72,11 @@ See [Settings files](</docs/en/settings#where-settings-live>) for where each file lives and [Settings precedence](</docs/en/settings#settings-precedence>) for how they combine when more than one sets the same variable. -## - -​ - -Precedence +## Precedence Some behaviors have both an environment variable and a dedicated settings key, and which one Claude Code reads first differs per key. For `ANTHROPIC_MODEL` and `CLAUDE_CODE_AUTO_CONNECT_IDE`, Claude Code reads the variable first and uses the `model` or `autoConnectIde` setting only when the variable is unset. For the pair you’re setting, check the variable’s row below and the key’s entry on the [settings reference](</docs/en/settings-reference>). When the same variable is set in both your shell and a settings file `env` block, the settings file value applies in most sessions. Claude Code writes each `env` entry into the process environment, replacing the value inherited from the shell. [How `env` values interact with your shell](</docs/en/settings-reference#how-env-values-interact-with-your-shell>) covers the sessions that keep the inherited value instead, and the [`env` setting](</docs/en/settings-reference#when-claude-code-applies-env-values>) says when it applies them. A few variables are special-cased; the [`env` setting](</docs/en/settings-reference#env>) lists the exceptions. In a settings file you can set a variable but you can’t remove one. To override a variable you can’t unset, such as a stale `CLAUDE_CODE_USE_VERTEX` exported by a shell profile you don’t control, set it to an empty string in the `env` block: `"CLAUDE_CODE_USE_VERTEX": ""`. Claude Code treats the empty value as unset for provider selection. Subprocesses still inherit the empty value. Between settings files, `env` values follow [settings precedence](</docs/en/settings#settings-precedence>), so a managed settings entry overrides the same variable in user or project settings. Project and local settings can’t set some variables, such as `CLAUDE_CONFIG_DIR` and the OpenTelemetry exporter variables. [Variables Claude Code ignores in `env`](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) lists them, along with the OpenTelemetry off values that still apply. How an environment variable interacts with CLI flags and in-session commands varies per feature: `--model` and `/model` override `ANTHROPIC_MODEL`, while `CLAUDE_CODE_EFFORT_LEVEL` overrides `--effort` and `/effort`. When a variable interacts with another configuration source, its row in the Variables list states the precedence or links to the page that documents it. Claude Code reads shell environment variables at startup, so changes to them take effect the next time you launch `claude`. Variables set under the `env` key in settings files are reapplied to a running session when the file changes, with the startup-only exception described in Set variables in settings files. -## - -​ - -Variables +## Variables Numeric variables such as timeouts, token budgets, and retry counts accept scientific notation and digit-separator spellings in addition to plain digits, except where a variable’s row notes it takes plain digits only. For example, Claude Code reads `2e3` as 2000 and `64_000` as 64000. Before v2.1.211, these spellings could silently set a much smaller value, such as `1e6` setting a timeout to 1. @@ -518,11 +498,7 @@ Standard OpenTelemetry exporter variables (`OTEL_METRICS_EXPORTER`, `OTEL_LOGS_EXPORTER`, `OTEL_EXPORTER_OTLP_ENDPOINT`, `OTEL_EXPORTER_OTLP_PROTOCOL`, `OTEL_EXPORTER_OTLP_HEADERS`, `OTEL_METRIC_EXPORT_INTERVAL`, `OTEL_RESOURCE_ATTRIBUTES`, and signal-specific variants) are also supported. See [Monitoring](</docs/en/monitoring-usage>) for configuration details. Set `CLAUDE_CODE_ENABLE_TELEMETRY` and the OpenTelemetry variables that turn on export, choose its destination, or capture content in your shell, user settings, or managed settings. Claude Code [ignores them in project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>), apart from the off values that section describes. `OTEL_RESOURCE_ATTRIBUTES` and the export interval, timeout, and compression variables, such as `OTEL_METRIC_EXPORT_INTERVAL`, still apply from project and local settings. -## - -​ - -What the subprocess environment scrub removes +## What the subprocess environment scrub removes When you set `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB` to `1`, Claude Code removes credentials from the environments of the subprocesses it starts, such as Bash commands, hooks, and stdio MCP servers. This reduces what a prompt injection attack can read. The Claude Code process keeps the credentials for its own API calls. The scrub recognizes a credential by its variable name or by the shape of its value, so use it as one layer alongside narrow [permission rules](</docs/en/permissions>) rather than as the only control. The table shows what the scrub does to example variables: @@ -540,11 +516,7 @@ Because the scrub leaves `GITHUB_TOKEN` in place, give a GitHub Actions job the narrowest `permissions` it needs. To remove a GitHub token from sandboxed Bash commands, add a `deny` entry under [`sandbox.credentials`](</docs/en/sandboxing#protect-credentials>). Leave the scrub unset if a subprocess needs one of the removed variables. On Linux, the scrub also runs Bash subprocesses in an isolated PID namespace so they can’t read host process environments through `/proc`. As a side effect, `ps`, `pgrep`, and `kill` can’t see or signal host processes. Before v2.1.251, the scrub removed `ANTHROPIC_API_KEY` and `AWS_SECRET_ACCESS_KEY` and left the table’s other example variables unchanged. -## - -​ - -Features that need feature-flag fetching +## Features that need feature-flag fetching Claude Code turns some features on through feature flags it fetches from Anthropic. Claude Code skips that fetch in these sessions: @@ -570,22 +542,14 @@ * Have Claude [treat large pastes as pasted rather than typed text](</docs/en/terminal-config#how-claude-treats-pasted-text>); the content behind a `[Pasted text #N]` placeholder reaches Claude unmarked * Have Claude Code [exclude MCP tools whose input schema the API would reject](</docs/en/mcp#tools-with-invalid-input-schemas>) -### - -​ - -First session after an install or upgrade +### First session after an install or upgrade In your first session after you install Claude Code, or upgrade to a version that adds a feature, a flag-gated feature can be missing. When Claude Code fetches its feature flags during that session, it saves them on the machine, so your next session on that machine has the feature. In setups such as these, sessions after the first also start without freshly fetched flags: * **A clean environment on every run** : if each run starts in a CI container, or any other environment without the flags an earlier session saved, every run is a first session * **A gateway token with no API key** : if you authenticate with `ANTHROPIC_AUTH_TOKEN` and no API key, and `ANTHROPIC_BASE_URL` points at a host other than Anthropic’s, such as an [LLM gateway](</docs/en/llm-gateway>), Claude Code has no credential to fetch the flags with -## - -​ - -See also +## See also * [Settings](</docs/en/settings>): all `settings.json` configuration, including the `env` key * [CLI reference](</docs/en/cli-reference>): launch-time flags
modified
--- a/env-vars.md +++ b/env-vars.md @@ -186,7 +186,7 @@ `CLAUDE_CODE_ARTIFACT_AUTO_OPEN`| Set to `0` to stop Claude Code from opening the browser automatically when a new [artifact](</docs/en/artifacts#create-an-artifact>) is published `CLAUDE_CODE_ARTIFACT_COMMENTS`| Set to `0` to stop Claude reading and replying to [comments on an artifact](</docs/en/artifacts#collect-comments-on-an-artifact>). Has no effect when `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` has [turned artifacts off](</docs/en/artifacts#availability>). Requires Claude Code v2.1.221 or later `CLAUDE_CODE_ARTIFACT_COMMENTS_AUTOREACT`| Set to `0` to stop Claude [replying on its own to comments sent to it](</docs/en/artifacts#let-claude-reply-to-comments-on-its-own>). Requires Claude Code v2.1.228 or later -`CLAUDE_CODE_ARTIFACT_PUBLISH_EDITS`| Set to `0` to stop Claude from applying small changes to an [artifact’s](</docs/en/artifacts#update-an-artifact>) file as part of publishing it. Claude then edits the file with its file-editing tools and publishes it as a separate step. Requires Claude Code v2.1.300 or later +`CLAUDE_CODE_ARTIFACT_PUBLISH_EDITS`| Set to `0` to stop Claude from [applying small changes](</docs/en/artifacts#turn-off-one-step-artifact-updates>) to an artifact’s file as part of publishing it. Claude then edits the file with its file-editing tools and publishes it as a separate step. Requires Claude Code v2.1.300 or later `CLAUDE_CODE_ATTRIBUTION_HEADER`| Set to `0` to omit the [attribution block](</docs/en/llm-gateway-protocol#system-prompt-attribution-block>), which carries the client version and a prompt fingerprint, from the start of the system prompt. Caching on a direct connection to the Anthropic API is unaffected either way. In some direct-connection setups, Claude Code keeps the block on [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) classifier requests even when you set `0`. In [System prompt attribution block](</docs/en/llm-gateway-protocol#system-prompt-attribution-block>), check which connections and credentials this covers. Before v2.1.181 the block included a per-request token on custom base URLs and Microsoft Foundry connections, so on those versions set it to `0` when your LLM gateway caches on the request body or forwards requests to a third-party provider, or when you connect to Microsoft Foundry directly `CLAUDE_CODE_AUTO_BACKGROUND_WORKER_CHECKIN_SECONDS`| Removed in v2.1.283. Use `CLAUDE_CODE_WORKER_CHECKIN_SCHEDULE` instead `CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the auto-compact window, how full the context gets before compaction, from `100000` to `1000000` tokens. Suffixed values such as `200k` require v2.1.304 or later. For precedence over the other ways to set the window and the effect on the status line’s `used_percentage`, see [Set the auto-compact window](</docs/en/model-config#set-the-auto-compact-window>) @@ -225,11 +225,12 @@ `CLAUDE_CODE_DISABLE_BUNDLED_SKILLS`| Set to `1` to disable the [skills](</docs/en/skills>) and workflows included with Claude Code: bundled skills and workflows are removed entirely, while built-in commands like `/init` stay typable but are hidden from the model. `/doctor` stays typable like the built-in commands; hide it with `DISABLE_DOCTOR_COMMAND` instead. Skills from plugins, `.claude/skills/`, and `.claude/commands/` are unaffected. Equivalent to the [`disableBundledSkills`](</docs/en/settings-reference#disablebundledskills>) setting `CLAUDE_CODE_DISABLE_CFC_PROMPT`| For hosts that embed Claude Code and supply their own browser guidance. Set to `1` to keep the [Claude in Chrome](</docs/en/chrome>) browser tools available while omitting the Chrome section of the system prompt and the `/claude-in-chrome` [bundled skill](</docs/en/skills#bundled-skills>). In VS Code, the extension at v2.1.314 or later also leaves the Claude in Chrome instructions out of a session’s messages. Requires Claude Code v2.1.257 or later `CLAUDE_CODE_DISABLE_CLAUDE_MDS`| Set to `1` to prevent loading any CLAUDE.md memory files into context, including user, project, and auto memory files -`CLAUDE_CODE_DISABLE_CRON`| Set to `1` to disable [session-scoped scheduled tasks](</docs/en/scheduled-tasks>). The `/loop` skill and cron tools become unavailable and any already-scheduled tasks stop firing, including tasks that are already running mid-session +`CLAUDE_CODE_DISABLE_CRON`| Set to `1` to disable [session-scoped scheduled tasks](</docs/en/scheduled-tasks#disable-scheduled-tasks>). The `/loop` skill and `CronCreate` become unavailable and any already-scheduled tasks stop firing, including tasks that are already running mid-session `CLAUDE_CODE_DISABLE_DANGEROUS_RM_TIMEOUT`| Set to `1` to turn off the `auto` and `bypassPermissions` [time limit and denials](</docs/en/permission-modes#time-limits-and-denials-in-auto-and-bypasspermissions-modes>) on critical-path removals. These removals then go to the classifier in `auto` mode, and get an untimed prompt in `bypassPermissions` mode wherever Claude Code can show one. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.281 or later `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`| Set to `1` to strip pre-release `anthropic-beta` request headers, the body fields that pair with them, and beta tool-schema fields such as `defer_loading` and `eager_input_streaming` from API requests. Use this when a proxy gateway rejects requests with an `Unexpected value(s)` error for the `anthropic-beta` header or an `Extra inputs are not permitted` error. [Disable pre-release capabilities](</docs/en/llm-gateway-protocol#disable-pre-release-capabilities>) lists what the variable removes, including [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>), and what Claude Code keeps sending `CLAUDE_CODE_DISABLE_EXPLORE_PLAN_AGENTS`| Set to `1` to disable the built-in [Explore and Plan subagents](</docs/en/sub-agents#built-in-subagents>). Claude explores with its search tools or the general-purpose subagent instead, and [plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>) reads files directly rather than launching Explore and Plan agents. Custom subagents named `Explore` or `Plan` are unaffected. To remove every built-in subagent type in the Agent SDK or non-interactive mode, use `CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS` instead. Requires Claude Code v2.1.198 or later `CLAUDE_CODE_DISABLE_FAST_MODE`| Set to `1` to disable [fast mode](</docs/en/fast-mode>) +`CLAUDE_CODE_DISABLE_FEATURE_FLAGS`| Set to `1` to turn off feature-flag fetching. Requires Claude Code v2.1.319 or later. With this variable set, [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching are unavailable. Telemetry event logging stays on unless `DISABLE_TELEMETRY` is also set. The older name, `DISABLE_GROWTHBOOK`, still works, and it is the only one that v2.1.124 through v2.1.318 read `CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY`| Set to `1` to disable the “How is Claude doing?” session quality surveys. Surveys are also disabled when `DISABLE_TELEMETRY`, `DO_NOT_TRACK`, or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` is set, unless `CLAUDE_CODE_ENABLE_FEEDBACK_SURVEY_FOR_OTEL` opts back in. To set a sample rate instead of disabling outright, use the [`feedbackSurveyRate`](</docs/en/settings-reference#feedbacksurveyrate>) setting. See [Session quality surveys](</docs/en/data-usage#session-quality-surveys>) `CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING`| Set to `1` to disable file [checkpointing](</docs/en/checkpointing>). The `/rewind` command will not be able to restore code changes. Overrides the [`fileCheckpointingEnabled`](</docs/en/settings-reference#filecheckpointingenabled>) setting `CLAUDE_CODE_DISABLE_FILE_MENTIONS`| Set to `1` to stop Claude Code from expanding [`@` mentions](</docs/en/common-workflows#reference-files-and-directories>) of files and directories. Claude instead gets the mentioned paths with a note to read them using its file tools. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). Requires Claude Code v2.1.299 or later @@ -433,7 +434,7 @@ `DISABLE_ERROR_REPORTING`| Set to any non-empty value, such as `1`, to opt out of error reporting. **Setting it to`0` or `false` still opts out**, unlike most on/off variables; unset the variable to turn error reporting back on `DISABLE_EXTRA_USAGE_COMMAND`| Set to `1` to hide the `/usage-credits` command that lets users purchase additional usage beyond rate limits `DISABLE_FEEDBACK_COMMAND`| Set to `1` to disable the `/feedback` command and [Claude-drafted feedback](</docs/en/tools-reference#sendfeedback-tool-behavior>). Also disables `/bug` and `/share`, which report through the same path; before v2.1.212 they were aliases of `/feedback`, so the command was disabled under every name. The older name `DISABLE_BUG_COMMAND` is also accepted -`DISABLE_GROWTHBOOK`| Set to `1` or `true` to disable feature-flag fetching and use code defaults for every flag. This makes [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable. Setting it to `0` or `false` leaves fetching on. Telemetry event logging stays on unless `DISABLE_TELEMETRY` is also set +`DISABLE_GROWTHBOOK`| Set to `1` to turn off feature-flag fetching. Requires Claude Code v2.1.124 or later. Superseded by `CLAUDE_CODE_DISABLE_FEATURE_FLAGS`, which requires v2.1.319 or later: use that name unless a machine on v2.1.318 or earlier reads the configuration. This name still works `DISABLE_INSTALLATION_CHECKS`| Set to `1` to disable installation warnings. Use only when manually managing the installation location, as this can mask issues with standard installations `DISABLE_INSTALL_GITHUB_APP_COMMAND`| Set to `1` to hide the `/install-github-app` command. Already hidden when using third-party providers (Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry) `DISABLE_INTERLEAVED_THINKING`| Set to `1` to prevent sending the interleaved-thinking beta header. Useful when your LLM gateway or provider does not support [interleaved thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking#interleaved-thinking>) @@ -547,20 +548,20 @@ Claude Code turns some features on through feature flags it fetches from Anthropic. Claude Code skips that fetch in these sessions: - * A session where you set `DISABLE_GROWTHBOOK`, `DISABLE_TELEMETRY`, `DO_NOT_TRACK`, or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`; each variable’s row in the variables table says which values turn fetching off + * A session where you set `CLAUDE_CODE_DISABLE_FEATURE_FLAGS`, `DISABLE_TELEMETRY`, `DO_NOT_TRACK`, or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`; each variable’s row in the variables table says which values turn fetching off * A session on a [third-party provider](</docs/en/third-party-integrations>), such as Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, or Microsoft Foundry, unless a host platform that embeds Claude Code sets `CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST` * A [Claude apps gateway](</docs/en/claude-apps-gateway>) session With fetching off, you can’t: - * Use [Remote Control](</docs/en/remote-control>) with `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` or `DISABLE_GROWTHBOOK` set. For `DISABLE_TELEMETRY` and `DO_NOT_TRACK`, see the [Remote Control requirements](</docs/en/remote-control#requirements>) + * Use [Remote Control](</docs/en/remote-control>) with `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` or `CLAUDE_CODE_DISABLE_FEATURE_FLAGS` set. For `DISABLE_TELEMETRY` and `DO_NOT_TRACK`, see the [Remote Control requirements](</docs/en/remote-control#requirements>) * [Message sessions beyond this machine](</docs/en/cross-session-messaging#message-sessions-on-other-machines>) when [Remote Control](</docs/en/remote-control#requirements>) is unavailable. Messaging between sessions on this machine works with fetching off * Run [`claude import` or the `/import` command](</docs/en/cli-reference#cli-commands>) * Run [`/skill-doctor`](</docs/en/skills#find-unused-skills>) or open its report in the `/plugin` **Stats** tab * Run [`/restart`](</docs/en/commands>) on Pro, Max, and Ultra plans * Sync the [skills](</docs/en/skills#where-synced-skills-load>) and [plugins](</docs/en/plugins/loading#synced-plugins>) enabled for your claude.ai account into your terminal sessions * Turn on the [You should know mod](</docs/en/interactive-mode#you-should-know-suggestions>) - * Use [the advisor tool](</docs/en/advisor#requirements>) + * Use [the advisor tool](</docs/en/advisor#requirements>), except on Claude Platform on AWS with Claude Code v2.1.300 or later * Use [MCP tasks](</docs/en/mcp#mcp-tasks-that-run-on-the-server>) * Read or reply to [comments on an artifact](</docs/en/artifacts#collect-comments-on-an-artifact>) * Have Claude read [another organization’s public artifact](</docs/en/artifacts#read-an-artifact-shared-with-you>)
modified
--- a/env-vars.md +++ b/env-vars.md @@ -347,7 +347,7 @@ `CLAUDE_CODE_PROMPT_CACHE_TTL`| Set `5m` or `1h`, the only values Claude Code accepts, to choose the [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) for the main conversation: your interactive, `-p`, and SDK turns, plus the helpers that run inline with them. Takes precedence over the `promptCacheTtl` setting and over `ENABLE_PROMPT_CACHING_1H`, and `FORCE_PROMPT_CACHING_5M` overrides it. The API bills 1-hour cache writes at a higher rate. Requires Claude Code v2.1.242 or later `CLAUDE_CODE_PROPAGATE_TRACEPARENT`| Set to `1` to propagate W3C trace context when `ANTHROPIC_BASE_URL` points at a custom proxy. Propagation covers the `traceparent` header on model and HTTP MCP requests and the `TRACEPARENT` environment variable for Bash, PowerShell, and hook subprocesses. By default, propagation is enabled only when connected directly to the Anthropic API. Added in v2.1.152. See [Traces (beta)](</docs/en/monitoring-usage#traces-beta>) `CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`| Set by host platforms that embed Claude Code and manage model provider routing on its behalf. When set, Claude Code ignores provider-selection, endpoint, and authentication variables such as `CLAUDE_CODE_USE_BEDROCK`, `ANTHROPIC_BASE_URL`, and `ANTHROPIC_API_KEY` in settings files, so user settings can’t override the host’s routing. Claude Code also ignores model-selection keys such as `model`, `fallbackModel`, and `modelOverrides` in [managed settings](</docs/en/managed-settings>), whichever managed source delivers them, so the host’s model configuration takes precedence over an out-of-date managed model pin. Claude Code also ignores model-selection variables such as `ANTHROPIC_MODEL` and the `ANTHROPIC_DEFAULT_*_MODEL` family in a managed `env` block; an [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist in managed settings still applies unless the host supplies its own. Claude Code also skips the automatic telemetry opt-out it otherwise applies on third-party providers such as Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, and Microsoft Foundry, so telemetry follows the standard `DISABLE_TELEMETRY` opt-out. See [Default behaviors by API provider](</docs/en/data-usage#default-behaviors-by-api-provider>) -`CLAUDE_CODE_PROXY_RESOLVES_HOSTS`| Set to `1` to allow the proxy to perform DNS resolution instead of the caller. Opt-in for environments where the proxy should handle hostname resolution +`CLAUDE_CODE_PROXY_RESOLVES_HOSTS`| Set to `1` to allow the proxy to perform DNS resolution instead of the caller. Opt-in for environments where the proxy should handle hostname resolution. When `CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST` is set, set this in the environment of the process that starts Claude Code `CLAUDE_CODE_REMOTE`| Set automatically to `true` when Claude Code is running as a [cloud session](</docs/en/claude-code-on-the-web>). Read this from a hook or setup script to detect whether you are in a cloud session `CLAUDE_CODE_REMOTE_SESSION_ID`| Set automatically in [cloud sessions](</docs/en/claude-code-on-the-web>) to the current session’s ID. Read this to construct a link back to the session transcript. See [Link output back to the session](</docs/en/cloud-environments#link-output-back-to-the-session>) `CLAUDE_CODE_RESTRICTED`| Set to `1` to start the session in restricted mode, the same as passing [`--restricted`](</docs/en/cli-reference#cli-flags>). Claude Code ignores this variable in a settings file’s `env` block. Requires Claude Code v2.1.248 or later @@ -484,12 +484,12 @@ `OTEL_LOG_TOOL_CONTENT`| Set to `1` to include tool content in the `tool.output` OpenTelemetry span event. Span attributes carry tool content under [their own gates](</docs/en/monitoring-usage#new-context-gates>). Requires [tracing](</docs/en/monitoring-usage#traces-beta>). Disabled by default to protect sensitive data. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>), apart from the off values that section describes. See [Monitoring](</docs/en/monitoring-usage#tool-output-span-event>) `OTEL_LOG_TOOL_DETAILS`| Set to `1` to include tool input arguments; MCP server names; user-authored workflow names; raw error strings on tool failures; the refusal `category` on `api_refusal` events; real agent, skill, plugin, and MCP server names on [cost and token metrics](</docs/en/monitoring-usage#cost-counter>); and other tool details in OpenTelemetry metrics, traces, and logs. Disabled by default to protect PII. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>), apart from the off values that section describes. See [Monitoring](</docs/en/monitoring-usage>) `OTEL_LOG_USER_PROMPTS`| Set to `1` to include user prompt text in OpenTelemetry traces and logs. Disabled by default (prompts are redacted). Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>), apart from the off values that section describes. See [Monitoring](</docs/en/monitoring-usage>) -`OTEL_METRICS_INCLUDE_ACCOUNT_UUID`| Set to `false` to exclude account UUID from metrics attributes (default: included). See [Monitoring](</docs/en/monitoring-usage>) -`OTEL_METRICS_INCLUDE_ENTRYPOINT`| Set to `true` to include the session entrypoint in metrics attributes (default: excluded). Added in v2.1.152. See [Monitoring](</docs/en/monitoring-usage>) +`OTEL_METRICS_INCLUDE_ACCOUNT_UUID`| Set to `false` to exclude account UUID from metric and event attributes (default: included). See [Monitoring](</docs/en/monitoring-usage>) +`OTEL_METRICS_INCLUDE_ENTRYPOINT`| Set to `true` to include the session entrypoint in metric and event attributes (default: excluded). Added in v2.1.152. See [Monitoring](</docs/en/monitoring-usage>) `OTEL_METRICS_INCLUDE_REPOSITORY`| Set to `true` to tag OpenTelemetry metrics and events with `vcs.*` attributes identifying the session’s repository (default: excluded). Requires Claude Code v2.1.269 or later. See [Repository attributes](</docs/en/monitoring-usage#repository-attributes>) `OTEL_METRICS_INCLUDE_RESOURCE_ATTRIBUTES`| As of v2.1.161, Claude Code attaches `OTEL_RESOURCE_ATTRIBUTES` keys to metric datapoint labels. Set to `false` to exclude them (default: included). See [Monitoring](</docs/en/monitoring-usage#multi-team-organization-support>) -`OTEL_METRICS_INCLUDE_SESSION_ID`| Set to `false` to exclude session ID from metrics attributes (default: included). See [Monitoring](</docs/en/monitoring-usage>) -`OTEL_METRICS_INCLUDE_VERSION`| Set to `true` to include Claude Code version in metrics attributes (default: excluded). See [Monitoring](</docs/en/monitoring-usage>) +`OTEL_METRICS_INCLUDE_SESSION_ID`| Set to `false` to exclude session ID from metric and event attributes (default: included). See [Monitoring](</docs/en/monitoring-usage>) +`OTEL_METRICS_INCLUDE_VERSION`| Set to `true` to include Claude Code version in metric and event attributes (default: excluded). See [Monitoring](</docs/en/monitoring-usage>) `SLASH_COMMAND_TOOL_CHAR_BUDGET`| Override the character budget for skill metadata shown to the [Skill tool](</docs/en/skills#control-who-invokes-a-skill>). The budget scales dynamically at 1% of the context window, with a fallback of 8,000 characters. Legacy name kept for backwards compatibility `TASK_MAX_OUTPUT_LENGTH`| Removed in v2.1.277 and now a no-op, together with the `TaskOutput` tool it sized. Previously set the maximum number of characters of a [background task’s](</docs/en/tools-reference#background-commands>) output that the `TaskOutput` tool kept. Claude reads a background task’s output file with `Read` instead `USE_BUILTIN_RIPGREP`| Set to `0` to use system-installed `rg` instead of `rg` included with Claude Code
modified
--- a/env-vars.md +++ b/env-vars.md @@ -511,6 +511,7 @@ `VERTEX_REGION_CLAUDE_5_SONNET`| Override region for Claude Sonnet 5 when using Google Cloud’s Agent Platform. Added in v2.1.197 `VERTEX_REGION_CLAUDE_FABLE_5`| Override region for Claude Fable 5 when using Google Cloud’s Agent Platform. Added in v2.1.170 `VERTEX_REGION_CLAUDE_FABLE_5_1`| Override region for Claude Fable 5.1 when using Google Cloud’s Agent Platform. Added in v2.1.257 +`VERTEX_REGION_CLAUDE_FABLE_5_2`| Override region for Claude Fable 5.2 when using Google Cloud’s Agent Platform. Added in v2.1.321 `VERTEX_REGION_CLAUDE_HAIKU_4_5`| Override region for Claude Haiku 4.5 when using Google Cloud’s Agent Platform `VERTEX_REGION_CLAUDE_HAIKU_5_5`| Override region for Claude Haiku 5.5 when using Google Cloud’s Agent Platform. Added in v2.1.293
modified
--- a/env-vars.md +++ b/env-vars.md @@ -203,6 +203,7 @@ `CLAUDE_CODE_CLIENT_CERT`| Path to client certificate file for mTLS authentication `CLAUDE_CODE_CLIENT_KEY`| Path to client private key file for mTLS authentication `CLAUDE_CODE_CLIENT_KEY_PASSPHRASE`| Passphrase for encrypted CLAUDE_CODE_CLIENT_KEY (optional) +`CLAUDE_CODE_CONFIG_LOCK_WAIT_MS`| Milliseconds that a command adding or removing a `user` or `local` scope MCP server, such as `claude mcp add`, keeps trying for the lock on `~/.claude.json` before it [fails](</docs/en/errors#mcp-server-was-not-saved-or-removed>). With it unset, the command waits about 10 to 20 seconds, and a shorter value changes nothing. Requires Claude Code v2.1.318 or later `CLAUDE_CODE_CONNECT_TIMEOUT_MS`| Removed in v2.1.186 and now a no-op. Previously set a separate timeout for the connect, TLS, and response-header phase of a streaming API request. Use `API_TIMEOUT_MS` instead. For the response-header phase of a streaming request, see `CLAUDE_STREAM_FIRST_BYTE_TIMEOUT_MS` `CLAUDE_CODE_DEBUG_LOGS_DIR`| Override the debug log file path. Despite the name, this is a file path, not a directory. Requires debug mode to be enabled separately via `--debug`, `/debug`, or the `DEBUG` environment variable: setting this variable alone does not enable logging. The [`--debug-file`](</docs/en/cli-reference#cli-flags>) flag does both at once. Defaults to `~/.claude/debug/<session-id>.txt` `CLAUDE_CODE_DEBUG_LOG_LEVEL`| Minimum log level written to the debug log file. Values: `verbose`, `debug` (default), `info`, `warn`, `error`. Set to `verbose` to include high-volume diagnostics like full status line command output, or raise to `error` to reduce noise @@ -259,6 +260,7 @@ `CLAUDE_CODE_DISABLE_WEB_FETCH`| Set to `1` to turn off the [WebFetch](</docs/en/tools-reference#webfetch-tool-behavior>) tool. The [WebSearch](</docs/en/tools-reference#websearch-tool-behavior>) tool stays available. Requires Claude Code v2.1.285 or later `CLAUDE_CODE_DISABLE_WINDOWS_SHELL_LAUNCHER`| Set to `1` to start [PowerShell tool](</docs/en/tools-reference#powershell-tool>) commands on Windows directly instead of through the `cmd.exe` launcher. By default, the launcher lets a PowerShell command [running in the background](</docs/en/tools-reference#background-commands>) [carry over to the session’s next process](</docs/en/agent-view#the-supervisor-process>), such as when you [background the session](</docs/en/agent-view#from-inside-a-session>). If you set the variable, a backgrounded PowerShell command stops when the session’s process exits. Bash commands aren’t affected. Requires Claude Code v2.1.269 or later `CLAUDE_CODE_DISABLE_WORKFLOWS`| Set to `1` to disable [workflows](</docs/en/workflows#turn-workflows-off>). Equivalent to the [`disableWorkflows`](</docs/en/settings-reference#disableworkflows>) setting +`CLAUDE_CODE_DROP_UNAVAILABLE_DEFERRED_TOOL`| Set to `1` to drop a [deferred tool call](</docs/en/hooks#resume-when-a-deferred-tool-is-unavailable>) whose tool isn’t available when you resume with `-p`. Without this variable, the call stays pending and a prompt you send doesn’t reach Claude. Requires Claude Code v2.1.319 or later `CLAUDE_CODE_EFFORT_LEVEL`| Set the effort level for supported models. Values: `low`, `medium`, `high`, `xhigh`, or `max`. Available levels depend on the model. Takes precedence over `--effort`, `/effort`, and the `modelSettings` and `effortLevel` settings. A [`maxEffortLevel`](</docs/en/settings-reference#maxeffortlevel>) cap still applies. Set it to `auto` or `unset` to have Claude Code [send no effort level](</docs/en/model-config#send-no-effort-level>), so that the API applies its own default for the model. See [Adjust effort level](</docs/en/model-config#adjust-effort-level>) `CLAUDE_CODE_EMIT_SESSION_STATE_EVENTS`| Set to `1` to add [`session_state_changed`](</docs/en/agent-sdk/typescript#sdksessionstatechangedmessage>) messages, which carry the session’s state, to the message stream. Requires either the [Agent SDK](</docs/en/agent-sdk/overview>) or `--print`, `--output-format stream-json`, and `--verbose` `CLAUDE_CODE_ENABLE_AUTO_MODE`| Accepted for compatibility with older releases and has no effect. Auto mode is available by default on every provider, including Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and signed-in [Claude apps gateway](</docs/en/claude-apps-gateway>) sessions. In v2.1.158 through v2.1.206, setting this to `1` was required to make [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) available on those providers @@ -468,7 +470,7 @@ `MCP_DISCOVERY_CACHE_STRIKES`| At a start where a [discovery-cache](</docs/en/mcp#server-status-detail>) entry is older than `MCP_DISCOVERY_CACHE_TTL_S`, Claude Code refreshes it in the background. This variable sets how many refreshes in a row can fail before Claude Code discards the entry and connects the server at the next start instead (default: 1). Raise it if your network connection drops occasionally, so that one failed refresh doesn’t discard the entry. Requires Claude Code v2.1.238 or later `MCP_DISCOVERY_CACHE_TTL_S`| Seconds for which Claude Code uses a [discovery-cache](</docs/en/mcp#server-status-detail>) entry without refreshing it (default: 900). At a start where the entry is older than that, Claude Code still uses it but refreshes it in the background. Once the entry is older than `MCP_DISCOVERY_CACHE_MAX_STALE_S`, Claude Code discards it instead. Claude Code caps the value at `MCP_DISCOVERY_CACHE_MAX_STALE_S`, which is 4 hours by default. Before v2.1.238, Claude Code didn’t cap the value `MCP_OAUTH_CALLBACK_PORT`| Fixed port for the OAuth redirect callback, as an alternative to `--callback-port` when adding an MCP server with [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>) -`MCP_PROTOCOL_NEGOTIATION`| On the [v2 MCP client runtime](</docs/en/mcp#mcp-client-runtimes>) only, controls whether Claude Code probes servers for MCP protocol revision 2026-07-28. Set `legacy` to skip the probe, so that every server connects with the handshake from before that revision. Set `auto` to probe the server kinds that support the probe: HTTP and stdio servers, claude.ai connectors, and the connectors of cloud and Remote Control sessions. With the variable unset, Claude Code probes those same kinds by default; see [MCP client runtimes](</docs/en/mcp#mcp-client-runtimes>). Any other value is ignored with a warning in the debug log. Requires Claude Code v2.1.221 or later +`MCP_PROTOCOL_NEGOTIATION`| On the [v2 MCP client runtime](</docs/en/mcp#mcp-client-runtimes>) only, controls whether Claude Code probes servers for MCP protocol revision 2026-07-28. Set `legacy` to keep every server on the earlier handshake, or `auto` to probe the server kinds that support it. Unset, Claude Code probes them but can [skip some servers](</docs/en/mcp#mcp-client-runtimes>). Any other value is ignored with a warning in the debug log. Requires Claude Code v2.1.221 or later `MCP_REMOTE_SERVER_CONNECTION_BATCH_SIZE`| Maximum number of remote MCP servers (HTTP/SSE) to connect in parallel during startup (default: 20) `MCP_SDK_GENERATION`| Pin which [MCP client runtime](</docs/en/mcp#mcp-client-runtimes>) this process connects to MCP servers with: `v1`, built on MCP TypeScript SDK 1.x, or `v2`, built on [MCP TypeScript SDK 2.0](<https://ts.sdk.modelcontextprotocol.io/v2/>). Without the variable, Claude Code uses v2, starting with the versions listed in that section. On Claude Code v2.1.221 or later, the v2 runtime checks the issuer an MCP OAuth server returns in its authorization response and fails the sign-in with an error that begins `Issuer mismatch in authorization response` when it doesn’t match. The v1 runtime doesn’t run this check. If you set an unrecognized value, Claude Code ignores it and writes a warning to the debug log. Claude Code reads the value once per process. Requires Claude Code v2.1.218 or later `MCP_SERVER_CONNECTION_BATCH_SIZE`| Maximum number of local MCP servers (stdio) to connect in parallel during startup (default: 3)
modified
--- a/env-vars.md +++ b/env-vars.md @@ -277,7 +277,7 @@ `CLAUDE_CODE_EVEN_MORE_DANGEROUSLY_SKIP_PERMISSIONS`| Set to `1` to [run dangerous `rm` commands with no prompt](</docs/en/permission-modes#turn-off-the-critical-path-removal-prompt-in-bypasspermissions-mode>) in `bypassPermissions` mode, which removes a safety prompt for destructive deletes. The linked section lists where it has no effect. Set it in the environment that launches Claude Code, because Claude Code [ignores it in a settings `env` block](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). Requires Claude Code v2.1.311 or later `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 `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS`| Set to `1` to enable [agent teams](</docs/en/agent-teams>). Agent teams are experimental and disabled by default -`CLAUDE_CODE_EXTRA_BODY`| JSON object to merge into the top level of every API request body. Useful for passing provider-specific parameters that Claude Code doesn’t expose directly. A value exported in your shell also applies to the [background sessions](</docs/en/agent-view>) you dispatch with `claude agents` or `--bg`. Before v2.1.206, background sessions ignored a shell-exported value and used whatever copy the background supervisor process inherited +`CLAUDE_CODE_EXTRA_BODY`| JSON object to merge into the top level of model request bodies except on some requests outside the conversation, such as `/model` checks. Useful for passing provider-specific parameters that Claude Code doesn’t expose directly. A value exported in your shell also applies to the [background sessions](</docs/en/agent-view>) you dispatch with `claude agents` or `--bg`. Before v2.1.206, background sessions ignored a shell-exported value and used whatever copy the background supervisor process inherited `CLAUDE_CODE_FILE_READ_MAX_OUTPUT_TOKENS`| Override the default token limit for [file reads](</docs/en/tools-reference#large-files>), which is 25,000 tokens. Useful when you need to read larger files in full. A read that Claude makes with the `allow_large` parameter can go past this limit when the context window has room `CLAUDE_CODE_FORCE_SESSION_PERSISTENCE`| Set to `1` to force transcript persistence, prompt history, and `claude agents` registration even when this `claude` was launched from inside another Claude Code session. Use when an inherited `CLAUDE_CODE_CHILD_SESSION` value, for example from a `screen` session or a background launcher first started by Claude Code’s Bash tool, causes a genuine top-level session to be misclassified as nested. As of v2.1.178, Claude Code detects the tmux case automatically and ignores the inherited marker, so tmux no longer needs this variable. Also honored on v2.1.169 and earlier; has no effect on v2.1.170 and v2.1.171, where the nested-session detection it overrides was removed `CLAUDE_CODE_FORCE_STRIKETHROUGH`| Set to `1` to force strikethrough rendering for `~~text~~` in Claude’s responses when your terminal supports it but is not auto-detected, such as over SSH without `TERM_PROGRAM` forwarded. Without this, undetected terminals show the literal `~~` markers instead of rendering the text as strikethrough. Requires Claude Code v2.1.186 or later @@ -295,7 +295,7 @@ `CLAUDE_CODE_GZIP_REQUEST_BODIES`| Set to `0` to turn off gzip compression of Claude API, telemetry, and [artifact](</docs/en/artifacts>) publish request bodies sent to `api.anthropic.com`. By default, Claude Code compresses large request bodies on direct connections and skips compression when you send requests through a proxy, configure a client certificate, or set `NODE_EXTRA_CA_CERTS`. Use `0` if a [TLS-inspecting proxy](</docs/en/network-config#ca-certificate-store>) that Claude Code can’t detect mishandles compressed requests `CLAUDE_CODE_HIDE_CWD`| Set to `1` to hide the working directory in the startup logo. Useful for screenshares or recordings where the path exposes your OS username `CLAUDE_CODE_IDE_HOST_OVERRIDE`| Override the host address used to connect to the IDE extension. By default Claude Code auto-detects the correct address, including WSL-to-Windows routing -`CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL`| Set to `1` to stop `/ide` from installing the IDE extension. Equivalent to setting [`autoInstallIdeExtension`](</docs/en/settings-reference#autoinstallideextension>) to `false` +`CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL`| Set to `1` to stop `/ide` from installing the IDE extension. Equivalent to setting [`autoInstallIdeExtension`](</docs/en/settings-reference#autoinstallideextension>) to `false`. Claude Code versions before v2.1.318 also install or update the extension when you start `claude` in a VS Code, Cursor, or Devin Desktop terminal. This variable stops that too `CLAUDE_CODE_IDE_SKIP_VALID_CHECK`| Set to `1` to skip validation of IDE lockfile entries during connection. Use when auto-connect fails to find your IDE despite it running `CLAUDE_CODE_IDLE_COMPACT_MIN_TOKENS`| Context size, in tokens, at which [idle compaction](</docs/en/settings-reference#idlecompaction>) applies to a conversation (default: `200000`). Accepts a positive whole number, and anything else is ignored. Values below `100000` are raised to `100000`, the lowest threshold. Idle compaction is on by default for conversations that meet its conditions. To turn it off, set `idleCompaction` to `false`. Requires Claude Code v2.1.290 or later `CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS`| How many [subagents](</docs/en/sub-agents#concurrent-subagent-limit>) can be running in one session before the Agent tool refuses to spawn another (default: 20). Accepts a positive whole number in plain digits; anything else is ignored, so the variable can adjust the cap but can’t disable it. Requires Claude Code v2.1.217 or later
modified
--- a/env-vars.md +++ b/env-vars.md @@ -121,7 +121,7 @@ `ANTHROPIC_BEDROCK_BASE_URL`| Override the Amazon Bedrock endpoint URL. Use for custom Amazon Bedrock endpoints or when routing through an [LLM gateway](</docs/en/llm-gateway>). See [Amazon Bedrock](</docs/en/amazon-bedrock>) `ANTHROPIC_BEDROCK_MANTLE_BASE_URL`| Override the Amazon Bedrock Mantle endpoint URL. See [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>) `ANTHROPIC_BEDROCK_REGION_PREFIX`| Cross-region inference profile prefix (`us`, `eu`, `apac`, `jp`, `au`, or `global`) Claude Code tries first instead of the one derived from the AWS region. Ignored in AWS GovCloud regions. Requires Claude Code v2.1.224 or later. See [Amazon Bedrock](</docs/en/amazon-bedrock#cross-region-inference-profile-prefixes>) -`ANTHROPIC_BEDROCK_SERVICE_TIER`| Amazon Bedrock [service tier](<https://docs.aws.amazon.com/bedrock/latest/userguide/service-tiers-inference.html>) (`default`, `flex`, or `priority`). Sent as the `X-Amzn-Bedrock-Service-Tier` header. See [Amazon Bedrock](</docs/en/amazon-bedrock#service-tiers>) +`ANTHROPIC_BEDROCK_SERVICE_TIER`| Amazon Bedrock [service tier](<https://docs.aws.amazon.com/bedrock/latest/userguide/service-tiers-inference.html>) (`default`, `flex`, or `priority`). See [Amazon Bedrock](</docs/en/amazon-bedrock#service-tiers>) `ANTHROPIC_BETAS`| Comma-separated list of additional `anthropic-beta` header values to include in API requests. Claude Code already sends the beta headers it needs; use this to opt into an [Anthropic API beta](<https://platform.claude.com/docs/en/api/beta-headers>) before Claude Code adds native support. Unlike the [`--betas` flag](</docs/en/cli-reference#cli-flags>), which requires API key authentication, this variable works with all auth methods including Claude.ai subscription `ANTHROPIC_CUSTOM_HEADERS`| Custom headers to add to requests (`Name: Value` format, newline-separated for multiple headers). If a name or value contains a character an HTTP header can’t carry, such as a curly quote or a zero-width space, the request fails with an error that identifies the pair by position. Requires Claude Code v2.1.227 or later. [Invalid request header value](</docs/en/errors#invalid-request-header-value>) lists the exact character set and where the check runs. A value that sets a credential, org or tenant, routing, or API-behavior header, such as `Authorization` or `Host`, counts as a [setting that needs approval](</docs/en/server-managed-settings#environment-variables-and-the-approval-dialog>) when server-managed settings deliver it. From project or local settings, such a value follows the [rules for when `env` values apply](</docs/en/settings-reference#when-claude-code-applies-env-values>) `ANTHROPIC_CUSTOM_MODEL_OPTION`| Model ID to add as a custom entry in the `/model` picker. Use this to make a non-standard or gateway-specific model selectable without replacing built-in aliases. See [Model configuration](</docs/en/model-config#add-a-custom-model-option>) @@ -220,6 +220,7 @@ `CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_GUARD`| Set to `1` to skip the check that an [Amazon Bedrock](</docs/en/amazon-bedrock>) streaming response carries the `application/vnd.amazon.eventstream` content-type. Without this variable, when a response carries a different content-type, Claude Code fails the request with an error naming that type, which means a [gateway or proxy is transforming the response](</docs/en/amazon-bedrock#streaming-errors-behind-a-gateway-or-proxy>). Configure the gateway to forward the `Content-Type` header and body unmodified rather than setting this variable. Requires Claude Code v2.1.208 or later `CLAUDE_CODE_DISABLE_BG_EXIT_HANDOFF`| Set to `1` to stop a [background session’s](</docs/en/agent-view>) in-flight work when the [supervisor](</docs/en/agent-view#the-supervisor-process>) stops, restarts, or updates that session’s process, instead of handing it to the session’s next process. That work is the session’s running background shell commands, plus background subagents as of v2.1.198. Affects only that handoff: backgrounding a session with `←` or [`/background`](</docs/en/agent-view#from-inside-a-session>) still carries in-flight background work over. Requires Claude Code v2.1.196 or later `CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP`| Set to `1` to stop Claude Code from terminating [background shell commands](</docs/en/interactive-mode#background-bash-commands>) under memory pressure. By default, on macOS and Linux, Claude Code terminates background shells when the operating system reports critical memory pressure and the session has been idle for 30 minutes with no turn or subagent running. Windows has no memory-pressure signal, so this variable has no effect there. Requires Claude Code v2.1.193 or later +`CLAUDE_CODE_DISABLE_BG_STABLE_PATH`| On macOS with the native installer, set to `1` to run each [background session’s](</docs/en/agent-view>) host process from the installed binary, not `~/.local/share/claude/ClaudeCode.app`. macOS may then ask again for permissions such as [folder access](</docs/en/agent-view#background-sessions-can%E2%80%99t-read-desktop-documents-or-downloads-on-macos>), including after each update. Set it in the `env` block of user settings, a managed settings file, or an MDM policy, not your shell. To remove `ClaudeCode.app`, delete it yourself. Requires Claude Code v2.1.295 or later `CLAUDE_CODE_DISABLE_BUNDLED_SKILLS`| Set to `1` to disable the [skills](</docs/en/skills>) and workflows included with Claude Code: bundled skills and workflows are removed entirely, while built-in commands like `/init` stay typable but are hidden from the model. `/doctor` stays typable like the built-in commands; hide it with `DISABLE_DOCTOR_COMMAND` instead. Skills from plugins, `.claude/skills/`, and `.claude/commands/` are unaffected. Equivalent to the [`disableBundledSkills`](</docs/en/settings-reference#disablebundledskills>) setting `CLAUDE_CODE_DISABLE_CFC_PROMPT`| For hosts that embed Claude Code and supply their own browser guidance. Set to `1` to keep the [Claude in Chrome](</docs/en/chrome>) browser tools available while omitting the Chrome section of the system prompt and the `/claude-in-chrome` [bundled skill](</docs/en/skills#bundled-skills>). In VS Code, the extension at v2.1.314 or later also leaves the Claude in Chrome instructions out of a session’s messages. Requires Claude Code v2.1.257 or later `CLAUDE_CODE_DISABLE_CLAUDE_MDS`| Set to `1` to prevent loading any CLAUDE.md memory files into context, including user, project, and auto memory files
modified
--- a/env-vars.md +++ b/env-vars.md @@ -294,7 +294,7 @@ `CLAUDE_CODE_GZIP_REQUEST_BODIES`| Set to `0` to turn off gzip compression of Claude API, telemetry, and [artifact](</docs/en/artifacts>) publish request bodies sent to `api.anthropic.com`. By default, Claude Code compresses large request bodies on direct connections and skips compression when you send requests through a proxy, configure a client certificate, or set `NODE_EXTRA_CA_CERTS`. Use `0` if a [TLS-inspecting proxy](</docs/en/network-config#ca-certificate-store>) that Claude Code can’t detect mishandles compressed requests `CLAUDE_CODE_HIDE_CWD`| Set to `1` to hide the working directory in the startup logo. Useful for screenshares or recordings where the path exposes your OS username `CLAUDE_CODE_IDE_HOST_OVERRIDE`| Override the host address used to connect to the IDE extension. By default Claude Code auto-detects the correct address, including WSL-to-Windows routing -`CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL`| Set to `1` to skip auto-installation of IDE extensions. Equivalent to setting [`autoInstallIdeExtension`](</docs/en/settings-reference#autoinstallideextension>) to `false` +`CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL`| Set to `1` to stop `/ide` from installing the IDE extension. Equivalent to setting [`autoInstallIdeExtension`](</docs/en/settings-reference#autoinstallideextension>) to `false` `CLAUDE_CODE_IDE_SKIP_VALID_CHECK`| Set to `1` to skip validation of IDE lockfile entries during connection. Use when auto-connect fails to find your IDE despite it running `CLAUDE_CODE_IDLE_COMPACT_MIN_TOKENS`| Context size, in tokens, at which [idle compaction](</docs/en/settings-reference#idlecompaction>) applies to a conversation (default: `200000`). Accepts a positive whole number, and anything else is ignored. Values below `100000` are raised to `100000`, the lowest threshold. Idle compaction is on by default for conversations that meet its conditions. To turn it off, set `idleCompaction` to `false`. Requires Claude Code v2.1.290 or later `CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS`| How many [subagents](</docs/en/sub-agents#concurrent-subagent-limit>) can be running in one session before the Agent tool refuses to spawn another (default: 20). Accepts a positive whole number in plain digits; anything else is ignored, so the variable can adjust the cap but can’t disable it. Requires Claude Code v2.1.217 or later
modified
--- a/env-vars.md +++ b/env-vars.md @@ -108,7 +108,7 @@ * `CLAUDE_CODE_TMUX_TRUECOLOR` * `IS_DEMO` -One other variable has its own rule: `FORCE_HYPERLINK` reads a number, so only `0` turns it off. Each variable’s row also states its own rule. +Each variable’s row also states its own rule. Variable| Purpose ---|--- @@ -221,7 +221,7 @@ `CLAUDE_CODE_DISABLE_BG_EXIT_HANDOFF`| Set to `1` to stop a [background session’s](</docs/en/agent-view>) in-flight work when the [supervisor](</docs/en/agent-view#the-supervisor-process>) stops, restarts, or updates that session’s process, instead of handing it to the session’s next process. That work is the session’s running background shell commands, plus background subagents as of v2.1.198. Affects only that handoff: backgrounding a session with `←` or [`/background`](</docs/en/agent-view#from-inside-a-session>) still carries in-flight background work over. Requires Claude Code v2.1.196 or later `CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP`| Set to `1` to stop Claude Code from terminating [background shell commands](</docs/en/interactive-mode#background-bash-commands>) under memory pressure. By default, on macOS and Linux, Claude Code terminates background shells when the operating system reports critical memory pressure and the session has been idle for 30 minutes with no turn or subagent running. Windows has no memory-pressure signal, so this variable has no effect there. Requires Claude Code v2.1.193 or later `CLAUDE_CODE_DISABLE_BUNDLED_SKILLS`| Set to `1` to disable the [skills](</docs/en/skills>) and workflows included with Claude Code: bundled skills and workflows are removed entirely, while built-in commands like `/init` stay typable but are hidden from the model. `/doctor` stays typable like the built-in commands; hide it with `DISABLE_DOCTOR_COMMAND` instead. Skills from plugins, `.claude/skills/`, and `.claude/commands/` are unaffected. Equivalent to the [`disableBundledSkills`](</docs/en/settings-reference#disablebundledskills>) setting -`CLAUDE_CODE_DISABLE_CFC_PROMPT`| Set to `1` to keep the [Claude in Chrome](</docs/en/chrome>) browser tools available while omitting the Chrome section of the system prompt and the `/claude-in-chrome` [bundled skill](</docs/en/skills#bundled-skills>). For hosts that embed Claude Code and supply their own browser guidance. Requires Claude Code v2.1.257 or later +`CLAUDE_CODE_DISABLE_CFC_PROMPT`| For hosts that embed Claude Code and supply their own browser guidance. Set to `1` to keep the [Claude in Chrome](</docs/en/chrome>) browser tools available while omitting the Chrome section of the system prompt and the `/claude-in-chrome` [bundled skill](</docs/en/skills#bundled-skills>). In VS Code, the extension at v2.1.314 or later also leaves the Claude in Chrome instructions out of a session’s messages. Requires Claude Code v2.1.257 or later `CLAUDE_CODE_DISABLE_CLAUDE_MDS`| Set to `1` to prevent loading any CLAUDE.md memory files into context, including user, project, and auto memory files `CLAUDE_CODE_DISABLE_CRON`| Set to `1` to disable [session-scoped scheduled tasks](</docs/en/scheduled-tasks>). The `/loop` skill and cron tools become unavailable and any already-scheduled tasks stop firing, including tasks that are already running mid-session `CLAUDE_CODE_DISABLE_DANGEROUS_RM_TIMEOUT`| Set to `1` to turn off the `auto` and `bypassPermissions` [time limit and denials](</docs/en/permission-modes#time-limits-and-denials-in-auto-and-bypasspermissions-modes>) on critical-path removals. These removals then go to the classifier in `auto` mode, and get an untimed prompt in `bypassPermissions` mode wherever Claude Code can show one. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.281 or later @@ -289,7 +289,7 @@ `CLAUDE_CODE_GIT_BASH_PATH`| Windows only: path to the Git Bash executable (`bash.exe`). Use when Git Bash is installed but not in your PATH. If the path doesn’t exist or the file isn’t named `bash.exe`, `sh.exe`, `bash`, or `sh`, Claude Code ignores the variable and auto-detects Git Bash as if it were unset, logging a warning visible with `--debug`. Before v2.1.219, Claude Code exited at startup when the path didn’t exist, and used any existing file as the shell without checking that it was bash or sh. See [Windows setup](</docs/en/setup#set-up-on-windows>) `CLAUDE_CODE_GLOB_HIDDEN`| Set to `false` to exclude dotfiles from results when Claude invokes the [Glob tool](</docs/en/tools-reference#glob-tool-behavior>). Included by default. Does not affect `@` file autocomplete, `ls`, Grep, or Read `CLAUDE_CODE_GLOB_NO_IGNORE`| Set to `false` to make the [Glob tool](</docs/en/tools-reference#glob-tool-behavior>) respect `.gitignore` patterns. By default, Glob returns all matching files including gitignored ones. Does not affect `@` file autocomplete, which has its own [`respectGitignore` setting](</docs/en/settings-reference#respectgitignore>) -`CLAUDE_CODE_GLOB_TIMEOUT_SECONDS`| Timeout in seconds for Glob tool file discovery. Defaults to 20 seconds on most platforms and 60 seconds on WSL +`CLAUDE_CODE_GLOB_TIMEOUT_SECONDS`| Timeout in seconds for [Glob](</docs/en/tools-reference#glob-tool-behavior>) and Grep tool searches. Defaults to 20 seconds on most platforms and 60 seconds on WSL `CLAUDE_CODE_GOAL_CHECKIN_MINUTES`| How many minutes background work can keep an active goal waiting before Claude Code [asks Claude to check on it](</docs/en/goal#background-work-defers-evaluation>). Default `30`. Set `0` to turn check-ins off. Give whole minutes in plain digits, at most `10080`, which is one week. Claude Code treats any other value as unset and uses the default. Requires Claude Code v2.1.234 or later `CLAUDE_CODE_GZIP_REQUEST_BODIES`| Set to `0` to turn off gzip compression of Claude API, telemetry, and [artifact](</docs/en/artifacts>) publish request bodies sent to `api.anthropic.com`. By default, Claude Code compresses large request bodies on direct connections and skips compression when you send requests through a proxy, configure a client certificate, or set `NODE_EXTRA_CA_CERTS`. Use `0` if a [TLS-inspecting proxy](</docs/en/network-config#ca-certificate-store>) that Claude Code can’t detect mishandles compressed requests `CLAUDE_CODE_HIDE_CWD`| Set to `1` to hide the working directory in the startup logo. Useful for screenshares or recordings where the path exposes your OS username @@ -317,9 +317,9 @@ `CLAUDE_CODE_NONBLOCKING_STDOUT`| Set to `1` to write terminal output through a second non-blocking file descriptor, so a terminal that stops reading, such as a paused tmux control-mode pane or a stalled SSH connection, can’t freeze Claude Code mid-session. Applies on macOS, Linux, and WSL when stdout is a terminal. Requires Claude Code v2.1.261 or later `CLAUDE_CODE_NONSTREAMING_TIMEOUT_RETRIES`| Limit how many times Claude Code re-sends a [non-streaming request](</docs/en/errors#streaming-response-ended-before-any-complete-data-was-received>) that times out. With `0`, the request fails on the first timeout. See [Tune retry behavior](</docs/en/errors#tune-retry-behavior>) for the timeout. Requires Claude Code v2.1.285 or later `CLAUDE_CODE_NO_FLICKER`| Set to `1` to enable [fullscreen rendering](</docs/en/fullscreen>), a research preview that reduces flicker and keeps memory flat in long conversations. Overrides the [`tui`](</docs/en/settings-reference#tui>) setting; you can also switch with `/tui fullscreen` -`CLAUDE_CODE_OAUTH_REFRESH_TOKEN`| OAuth refresh token for Claude.ai authentication. When set, `claude auth login` exchanges this token directly instead of opening a browser. Requires `CLAUDE_CODE_OAUTH_SCOPES`. Useful for provisioning authentication in automated environments -`CLAUDE_CODE_OAUTH_SCOPES`| Space-separated OAuth scopes the refresh token was issued with, such as `"user:profile user:inference user:sessions:claude_code"`. Required when `CLAUDE_CODE_OAUTH_REFRESH_TOKEN` is set -`CLAUDE_CODE_OAUTH_TOKEN`| OAuth access token for claude.ai authentication. Alternative to `/login` for SDK and automated environments. Takes precedence over keychain-stored credentials. Generate one with [`claude setup-token`](</docs/en/authentication#generate-a-long-lived-token>). Unless you run [`/login`](</docs/en/authentication#authentication-precedence>), Claude Code uses the token you set for the whole session. To replace an expired token, generate a new one and restart +`CLAUDE_CODE_OAUTH_REFRESH_TOKEN`| OAuth refresh token for claude.ai authentication. When set, `claude auth login` exchanges this token directly instead of opening a browser. Requires `CLAUDE_CODE_OAUTH_SCOPES`. Useful for provisioning authentication in automated environments. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) +`CLAUDE_CODE_OAUTH_SCOPES`| Space-separated OAuth scopes the refresh token was issued with, such as `"user:profile user:inference user:sessions:claude_code"`. Required when `CLAUDE_CODE_OAUTH_REFRESH_TOKEN` is set. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) +`CLAUDE_CODE_OAUTH_TOKEN`| OAuth access token for claude.ai authentication. Alternative to `/login` for SDK and automated environments. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). Takes precedence over keychain-stored credentials. Generate one with [`claude setup-token`](</docs/en/authentication#generate-a-long-lived-token>). Unless you run [`/login`](</docs/en/authentication#authentication-precedence>), Claude Code uses the token you set for the whole session. To replace an expired token, generate a new one and restart `CLAUDE_CODE_OPUS_4_6_FAST_MODE_OVERRIDE`| Removed in v2.1.160 and now a no-op. Previously pinned [fast mode](</docs/en/fast-mode>) to Claude Opus 4.6 instead of the current default. Opus 4.6 no longer supports fast mode `CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH`| Maximum length of content-bearing OpenTelemetry attributes (model responses, tool content, system prompts, raw API bodies), truncation marker included, in UTF-16 code units (default: 61440, i.e. 60 KB). Raise it only if your telemetry backend accepts attribute values larger than 64 KB, or lower it to cut telemetry volume. Requires Claude Code v2.1.214 or later. See [Monitoring](</docs/en/monitoring-usage>) `CLAUDE_CODE_OTEL_DIAG_STDERR`| Set to `1` to write OpenTelemetry exporter diagnostic errors to stderr. By default these errors only appear with `--debug`, so a misconfigured exporter such as a Prometheus port collision otherwise fails silently. Requires Claude Code v2.1.179 or later. See [Monitoring](</docs/en/monitoring-usage>) @@ -451,7 +451,7 @@ `ENABLE_PROMPT_CACHING_1H_BEDROCK`| Deprecated. Use `ENABLE_PROMPT_CACHING_1H` instead. Has no effect on [Claude apps gateway](</docs/en/claude-apps-gateway>) sessions, even when the gateway routes to Amazon Bedrock `ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset or `true` defers MCP tools, except in the [cases that keep tool search off](</docs/en/mcp#configure-tool-search>). `auto` turns tool search on once definitions reach 10% of the context window. `auto:N` sets a custom threshold, such as `auto:5` for 5%. `false` loads all tools upfront. If a gateway rejects tool search, see [Tool search through an LLM gateway](</docs/en/mcp#tool-search-through-a-gateway>) `FORCE_AUTOUPDATE_PLUGINS`| Set to `1` to force plugin auto-updates even when the main auto-updater is disabled via `DISABLE_AUTOUPDATER` -`FORCE_HYPERLINK`| Set to `1` to enable clickable OSC 8 hyperlinks when your terminal supports them but isn’t auto-detected, or `0` to disable them. When unset, Claude Code enables hyperlinks only when it detects terminal support. Claude Code parses this value as a number, not a Boolean, so a value such as `false`, `no`, or `off` enables hyperlinks rather than disabling them. The footer [PR or merge request badge](</docs/en/interactive-mode#pr-review-status>) renders as a hyperlink even when Claude Code can’t detect terminal support, such as over SSH. Set `0` to render the badge as plain text +`FORCE_HYPERLINK`| Set to `1` to enable clickable OSC 8 hyperlinks when your terminal supports them but isn’t auto-detected. When unset, Claude Code enables most hyperlinks only when it detects terminal support. The footer [PR or merge request badge](</docs/en/interactive-mode#pr-review-status>) and long sign-in URLs are links either way. Set `0`, `false`, `no`, or `off` to render all of them as plain text. Before v2.1.314, `false`, `no`, and `off` enabled hyperlinks instead `FORCE_PROMPT_CACHING_5M`| Set to `1` to force the 5-minute prompt cache TTL even when 1-hour TTL would otherwise apply. Overrides `CLAUDE_CODE_PROMPT_CACHE_TTL`, `CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL`, `ENABLE_PROMPT_CACHING_1H`, and the `promptCacheTtl` and `subagentPromptCacheTtl` settings `HTTP_PROXY`| Specify HTTP proxy server for network connections `HTTPS_PROXY`| Specify HTTPS proxy server for network connections @@ -564,7 +564,6 @@ * Get [Claude-drafted feedback](</docs/en/tools-reference#sendfeedback-tool-behavior>), which Claude Code turns on through a fetched flag * Have Claude [treat large pastes as pasted rather than typed text](</docs/en/terminal-config#how-claude-treats-pasted-text>); the content behind a `[Pasted text #N]` placeholder reaches Claude unmarked * Have Claude Code [exclude MCP tools whose input schema the API would reject](</docs/en/mcp#tools-with-invalid-input-schemas>) - * Have Claude Code [compact a long conversation while your terminal session is idle](</docs/en/settings-reference#idlecompaction>), shortly before a one-hour prompt cache expires ###
modified
--- a/env-vars.md +++ b/env-vars.md @@ -112,7 +112,7 @@ Variable| Purpose ---|--- -`ANTHROPIC_API_KEY`| API key sent as `X-Api-Key` header. When set, this key is used instead of your Claude Pro, Max, Team, or Enterprise subscription even if you are logged in. In non-interactive mode (`-p`), the key is always used when present. In interactive mode, you are prompted to approve the key once before it overrides your subscription. To use your subscription instead, run `unset ANTHROPIC_API_KEY` +`ANTHROPIC_API_KEY`| API key sent as `X-Api-Key` header. When set, this key is used instead of your Claude Pro, Max, Ultra, Team, or Enterprise subscription even if you are logged in. In non-interactive mode (`-p`), the key is always used when present. In interactive mode, you are prompted to approve the key once before it overrides your subscription. To use your subscription instead, run `unset ANTHROPIC_API_KEY` `ANTHROPIC_AUTH_TOKEN`| Custom value for the `Authorization` header (the value you set here will be prefixed with `Bearer `) `ANTHROPIC_AWS_API_KEY`| Workspace API key for [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), generated in the AWS Console. Sent as `x-api-key` and takes precedence over AWS SigV4 `ANTHROPIC_AWS_BASE_URL`| Override the [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) endpoint URL. Use for custom regions or when routing through an [LLM gateway](</docs/en/llm-gateway>). Defaults to `https://aws-external-anthropic.{region}.api.aws`. Claude Code resolves the region with the [same precedence as on Amazon Bedrock](</docs/en/amazon-bedrock#3-configure-claude-code>) @@ -553,7 +553,7 @@ * [Message sessions beyond this machine](</docs/en/cross-session-messaging#message-sessions-on-other-machines>) when [Remote Control](</docs/en/remote-control#requirements>) is unavailable. Messaging between sessions on this machine works with fetching off * Run [`claude import` or the `/import` command](</docs/en/cli-reference#cli-commands>) * Run [`/skill-doctor`](</docs/en/skills#find-unused-skills>) or open its report in the `/plugin` **Stats** tab - * Run [`/restart`](</docs/en/commands>) on Pro and Max plans + * Run [`/restart`](</docs/en/commands>) on Pro, Max, and Ultra plans * Sync the [skills](</docs/en/skills#where-synced-skills-load>) and [plugins](</docs/en/plugins/loading#synced-plugins>) enabled for your claude.ai account into your terminal sessions * Turn on the [You should know mod](</docs/en/interactive-mode#you-should-know-suggestions>) * Use [the advisor tool](</docs/en/advisor#requirements>)
modified
--- a/env-vars.md +++ b/env-vars.md @@ -410,7 +410,7 @@ `CLAUDE_CODE_WORKFLOW_PREFIX_STAGGER_MS`| Upper bound in milliseconds on how long a [workflow](</docs/en/workflows>) agent waits for a same-prefix sibling’s first response to begin before sending its own first request. When a fan-out starts several agents that share a [prompt-cache prefix](</docs/en/workflows#prompt-caching-in-a-fan-out>), Claude Code holds all but the first agent for up to this long so the rest read the cached prefix instead of each processing it uncached. Default `5000`. Set to `0` to disable the wait. When `DISABLE_PROMPT_CACHING` is set, agents never wait. Requires Claude Code v2.1.229 or later `CLAUDE_CODE_YOU_SHOULD_KNOW_DEBUG`| Set to `1` to show, above the prompt, a line for each of the last three checks the [You should know mod](</docs/en/interactive-mode#you-should-know-suggestions>) made in this session. Use it to confirm the mod is checking when no notes appear. Requires Claude Code v2.1.287 or later `CLAUDE_CONFIG_DIR`| Override the configuration directory (default: `~/.claude`). All settings, session history, and plugins are stored under this path. For credentials, see [where Claude Code stores credentials](</docs/en/authentication#credential-management>). Useful for running multiple accounts side by side: for example, `alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'`. Set it in your shell, user settings, or managed settings. In a settings file, write the absolute path. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) -`CLAUDE_EFFORT`| Set automatically in Bash tool subprocesses and hook commands to the [effort level](</docs/en/model-config#adjust-effort-level>) in effect when the subprocess starts: `low`, `medium`, `high`, `xhigh`, or `max`. Matches the `effort.level` field passed to [hooks](</docs/en/hooks>). Only set when the current model supports the effort parameter +`CLAUDE_EFFORT`| Set automatically in Bash tool subprocesses and hook commands to the [effort level](</docs/en/model-config#adjust-effort-level>) setting when the subprocess starts: `low`, `medium`, `high`, `xhigh`, or `max`. Matches the `effort.level` field passed to [hooks](</docs/en/hooks>). Only set when the current model supports the effort parameter `CLAUDE_ENABLE_BYTE_WATCHDOG`| Set to `1` to force-enable the byte-level streaming idle watchdog, or set to `0` to force-disable it. `0` also turns off the [first-byte deadline](</docs/en/network-config#streaming-idle-watchdogs>) on the connections where that deadline runs. When unset, the watchdog is enabled by default for direct Anthropic API and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) connections, and for streaming responses on [gateway](</docs/en/gateways>) connections reached through `ANTHROPIC_BASE_URL` or `ANTHROPIC_AWS_BASE_URL`; before v2.1.222 it didn’t run on those gateway connections, so the event-level watchdog could report a stall there even while keep-alive pings were arriving. For timeouts and how the timers interact, see [Streaming idle watchdogs](</docs/en/network-config#streaming-idle-watchdogs>) `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK`| Set to `1` to enable the byte-level streaming idle watchdog on Amazon Bedrock `vnd.amazon.eventstream` responses, which also enables the [first-byte deadline](</docs/en/network-config#streaming-idle-watchdogs>) on Bedrock streaming requests. Off by default. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS` `CLAUDE_ENABLE_STREAM_WATCHDOG`| Set to `0` to force-disable the event-level streaming idle watchdog, or set to `1` to force-enable it. When unset, the watchdog is on by default for all providers. Before v2.1.196, the unset default was server-controlled on the direct Anthropic API and off on other providers. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS`; for the other stall timers that run alongside this one, see [Streaming idle watchdogs](</docs/en/network-config#streaming-idle-watchdogs>) @@ -553,6 +553,7 @@ * [Message sessions beyond this machine](</docs/en/cross-session-messaging#message-sessions-on-other-machines>) when [Remote Control](</docs/en/remote-control#requirements>) is unavailable. Messaging between sessions on this machine works with fetching off * Run [`claude import` or the `/import` command](</docs/en/cli-reference#cli-commands>) * Run [`/skill-doctor`](</docs/en/skills#find-unused-skills>) or open its report in the `/plugin` **Stats** tab + * Run [`/restart`](</docs/en/commands>) on Pro and Max plans * Sync the [skills](</docs/en/skills#where-synced-skills-load>) and [plugins](</docs/en/plugins/loading#synced-plugins>) enabled for your claude.ai account into your terminal sessions * Turn on the [You should know mod](</docs/en/interactive-mode#you-should-know-suggestions>) * Use [the advisor tool](</docs/en/advisor#requirements>)
modified
--- a/env-vars.md +++ b/env-vars.md @@ -215,7 +215,7 @@ `CLAUDE_CODE_DISABLE_ATTACHMENTS`| Set to `1` to disable attachment processing. File mentions with `@` syntax are sent as plain text instead of being expanded into file content. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) `CLAUDE_CODE_DISABLE_AUTH_REFRESH_LOCK`| Set to `1` to make a Claude Code process run its [`gcpAuthRefresh`](</docs/en/settings-reference#gcpauthrefresh>) or [`awsAuthRefresh`](</docs/en/settings-reference#awsauthrefresh>) command itself instead of waiting while another process runs it. Requires Claude Code v2.1.286 or later `CLAUDE_CODE_DISABLE_AUTO_MEMORY`| Set to `1` to disable [auto memory](</docs/en/memory#auto-memory>). Set to `0` to force auto memory on even when `--bare` mode or [`autoMemoryEnabled: false`](</docs/en/settings-reference#automemoryenabled>) would otherwise disable it. When disabled, Claude does not create or load auto memory files -`CLAUDE_CODE_DISABLE_BACKGROUND_TASKS`| Set to `1` to remove the `run_in_background` parameter from the Bash, PowerShell, and subagent tools and to turn off the Ctrl+B shortcut and background runs of [forked skills](</docs/en/skills#run-skills-in-a-subagent>). Claude Code then also stops moving subagents, long MCP tool calls, and timed-out shell commands to the background automatically. [MCP tasks](</docs/en/mcp#make-claude-wait-for-the-result-of-an-mcp-task>) and the [Monitor tool](</docs/en/tools-reference#monitor-tool>) still run in the background +`CLAUDE_CODE_DISABLE_BACKGROUND_TASKS`| Set to `1` to remove the `run_in_background` parameter from the Bash, PowerShell, and subagent tools and to turn off the Ctrl+B shortcut and background runs of [forked skills](</docs/en/skills#run-skills-in-a-subagent>). Claude Code then also stops moving subagents, long MCP tool calls, and timed-out shell commands to the background automatically. [MCP tasks](</docs/en/mcp#make-claude-wait-for-the-result-of-an-mcp-task>) and the [Monitor tool](</docs/en/tools-reference#monitor-tool>) still run in the background. To turn off [background sessions](</docs/en/agent-view#turn-off-agent-view>) too, set `CLAUDE_CODE_DISABLE_AGENT_VIEW` to `1` `CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_DEFAULT`| Set to `1` to stop Claude Code from treating an [Amazon Bedrock](</docs/en/amazon-bedrock>) streaming response with a missing or empty `Content-Type` header as Amazon Bedrock’s binary event stream. By default, Claude Code assumes a gateway dropped the header from an otherwise unmodified response, so it decodes the body and streaming keeps working. Set this only for a gateway that also re-emits the stream as server-sent events; Claude Code then reads the header-less body as server-sent events instead. Requires Claude Code v2.1.239 or later `CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_GUARD`| Set to `1` to skip the check that an [Amazon Bedrock](</docs/en/amazon-bedrock>) streaming response carries the `application/vnd.amazon.eventstream` content-type. Without this variable, when a response carries a different content-type, Claude Code fails the request with an error naming that type, which means a [gateway or proxy is transforming the response](</docs/en/amazon-bedrock#streaming-errors-behind-a-gateway-or-proxy>). Configure the gateway to forward the `Content-Type` header and body unmodified rather than setting this variable. Requires Claude Code v2.1.208 or later `CLAUDE_CODE_DISABLE_BG_EXIT_HANDOFF`| Set to `1` to stop a [background session’s](</docs/en/agent-view>) in-flight work when the [supervisor](</docs/en/agent-view#the-supervisor-process>) stops, restarts, or updates that session’s process, instead of handing it to the session’s next process. That work is the session’s running background shell commands, plus background subagents as of v2.1.198. Affects only that handoff: backgrounding a session with `←` or [`/background`](</docs/en/agent-view#from-inside-a-session>) still carries in-flight background work over. Requires Claude Code v2.1.196 or later @@ -258,7 +258,7 @@ `CLAUDE_CODE_DISABLE_WEB_FETCH`| Set to `1` to turn off the [WebFetch](</docs/en/tools-reference#webfetch-tool-behavior>) tool. The [WebSearch](</docs/en/tools-reference#websearch-tool-behavior>) tool stays available. Requires Claude Code v2.1.285 or later `CLAUDE_CODE_DISABLE_WINDOWS_SHELL_LAUNCHER`| Set to `1` to start [PowerShell tool](</docs/en/tools-reference#powershell-tool>) commands on Windows directly instead of through the `cmd.exe` launcher. By default, the launcher lets a PowerShell command [running in the background](</docs/en/tools-reference#background-commands>) [carry over to the session’s next process](</docs/en/agent-view#the-supervisor-process>), such as when you [background the session](</docs/en/agent-view#from-inside-a-session>). If you set the variable, a backgrounded PowerShell command stops when the session’s process exits. Bash commands aren’t affected. Requires Claude Code v2.1.269 or later `CLAUDE_CODE_DISABLE_WORKFLOWS`| Set to `1` to disable [workflows](</docs/en/workflows#turn-workflows-off>). Equivalent to the [`disableWorkflows`](</docs/en/settings-reference#disableworkflows>) setting -`CLAUDE_CODE_EFFORT_LEVEL`| Set the effort level for supported models. Values: `low`, `medium`, `high`, `xhigh`, `max`, or `auto` to use the model default. Available levels depend on the model. Takes precedence over `--effort`, `/effort`, and the `modelSettings` and `effortLevel` settings. A [`maxEffortLevel`](</docs/en/settings-reference#maxeffortlevel>) cap still applies. See [Adjust effort level](</docs/en/model-config#adjust-effort-level>) +`CLAUDE_CODE_EFFORT_LEVEL`| Set the effort level for supported models. Values: `low`, `medium`, `high`, `xhigh`, or `max`. Available levels depend on the model. Takes precedence over `--effort`, `/effort`, and the `modelSettings` and `effortLevel` settings. A [`maxEffortLevel`](</docs/en/settings-reference#maxeffortlevel>) cap still applies. Set it to `auto` or `unset` to have Claude Code [send no effort level](</docs/en/model-config#send-no-effort-level>), so that the API applies its own default for the model. See [Adjust effort level](</docs/en/model-config#adjust-effort-level>) `CLAUDE_CODE_EMIT_SESSION_STATE_EVENTS`| Set to `1` to add [`session_state_changed`](</docs/en/agent-sdk/typescript#sdksessionstatechangedmessage>) messages, which carry the session’s state, to the message stream. Requires either the [Agent SDK](</docs/en/agent-sdk/overview>) or `--print`, `--output-format stream-json`, and `--verbose` `CLAUDE_CODE_ENABLE_AUTO_MODE`| Accepted for compatibility with older releases and has no effect. Auto mode is available by default on every provider, including Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and signed-in [Claude apps gateway](</docs/en/claude-apps-gateway>) sessions. In v2.1.158 through v2.1.206, setting this to `1` was required to make [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) available on those providers `CLAUDE_CODE_ENABLE_AWAY_SUMMARY`| Override [session recap](</docs/en/interactive-mode#session-recap>) availability. Set to `0` to force recaps off regardless of the `/config` toggle. Set to `1` to force recaps on when [`awaySummaryEnabled`](</docs/en/settings-reference#awaysummaryenabled>) is `false`. Takes precedence over the setting and `/config` toggle @@ -562,7 +562,7 @@ * Get the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) by default for claude.ai and Console accounts on Windows with Git Bash installed; Claude Code routes shell commands through Git Bash unless you set `CLAUDE_CODE_USE_POWERSHELL_TOOL=1`. On Windows without Git Bash, the tool stays on * Get [Claude-drafted feedback](</docs/en/tools-reference#sendfeedback-tool-behavior>), which Claude Code turns on through a fetched flag * Have Claude [treat large pastes as pasted rather than typed text](</docs/en/terminal-config#how-claude-treats-pasted-text>); the content behind a `[Pasted text #N]` placeholder reaches Claude unmarked - * Have Claude Code [exclude MCP tools whose input schema the API would reject](</docs/en/mcp#tools-with-invalid-input-schemas>); it sends the schema anyway, and a request that includes it fails with [a 400 error naming the tool by its position](</docs/en/errors#tool-input-schema-is-invalid>) + * Have Claude Code [exclude MCP tools whose input schema the API would reject](</docs/en/mcp#tools-with-invalid-input-schemas>) * Have Claude Code [compact a long conversation while your terminal session is idle](</docs/en/settings-reference#idlecompaction>), shortly before a one-hour prompt cache expires ###
modified
--- a/env-vars.md +++ b/env-vars.md @@ -273,6 +273,7 @@ `CLAUDE_CODE_ENABLE_TASKS`| Selects which task-tracking tools Claude Code provides in [sessions that have them](</docs/en/tools-reference#task-tool-availability>). By default, Claude Code provides the Task tools `TaskCreate`, `TaskUpdate`, `TaskGet`, and `TaskList`. Set to `0` to get the legacy `TodoWrite` tool instead. See [Task list](</docs/en/interactive-mode#task-list>) `CLAUDE_CODE_ENABLE_TELEMETRY`| Set to `1` to enable OpenTelemetry data collection for metrics and logging. Required before configuring OTel exporters. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). See [Monitoring](</docs/en/monitoring-usage>) `CLAUDE_CODE_ENABLE_TODO_TOOLS`| Set to `1` to get the task-tracking tools on every model. Without it, Claude Code provides them by default only on the models listed under [Task tool availability](</docs/en/tools-reference#task-tool-availability>). `CLAUDE_CODE_ENABLE_TASKS` still selects the Task tools or `TodoWrite`. Requires Claude Code v2.1.233 or later +`CLAUDE_CODE_EVEN_MORE_DANGEROUSLY_SKIP_PERMISSIONS`| Set to `1` to [run dangerous `rm` commands with no prompt](</docs/en/permission-modes#turn-off-the-critical-path-removal-prompt-in-bypasspermissions-mode>) in `bypassPermissions` mode, which removes a safety prompt for destructive deletes. The linked section lists where it has no effect. Set it in the environment that launches Claude Code, because Claude Code [ignores it in a settings `env` block](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). Requires Claude Code v2.1.311 or later `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 `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS`| Set to `1` to enable [agent teams](</docs/en/agent-teams>). Agent teams are experimental and disabled by default `CLAUDE_CODE_EXTRA_BODY`| JSON object to merge into the top level of every API request body. Useful for passing provider-specific parameters that Claude Code doesn’t expose directly. A value exported in your shell also applies to the [background sessions](</docs/en/agent-view>) you dispatch with `claude agents` or `--bg`. Before v2.1.206, background sessions ignored a shell-exported value and used whatever copy the background supervisor process inherited @@ -350,6 +351,7 @@ `CLAUDE_CODE_RESUME_INTERRUPTED_TURN`| Set to `1` to automatically resume if the previous session ended mid-turn. Used in SDK mode so the model continues without requiring the SDK to re-send the prompt. To turn this off, unset the variable or set it to `0`. For the VS Code chat panel, see [Continue conversations after a reload](</docs/en/vs-code#continue-conversations-after-a-reload>) `CLAUDE_CODE_RESUME_INTERRUPTED_TURN_MAX_AGE_MS`| Maximum age in milliseconds of the last transcript message for a session that ended mid-turn to continue automatically on resume. When the last message is older than this bound, Claude Code skips the `CLAUDE_CODE_RESUME_INTERRUPTED_TURN` automatic resume and its `CLAUDE_CODE_RESUME_PROMPT` continuation message, and the session starts idle so you continue explicitly. Unset or `0` sets no bound, except that some turns resume only within six hours of their last message, such as one that ended with an API error. A positive value bounds every turn, including those; a negative or non-numeric value applies a one-hour bound. Spawn scripts for long-running agents can set this so a restart against an old transcript doesn’t re-run a stale prompt. Claude Code sets a one-hour bound itself when it restarts a crashed [agent view](</docs/en/agent-view>) session that inherited its conversation from an interactive session. Requires Claude Code v2.1.211 or later `CLAUDE_CODE_RESUME_PROMPT`| Override the continuation message Claude Code sends to Claude when `CLAUDE_CODE_RESUME_INTERRUPTED_TURN` continues an interrupted turn instead of resending its prompt, or when you resume a [deferred tool call](</docs/en/hooks#defer-a-tool-call-for-later>) with `-p`. Defaults to `Continue from where you left off.`. An empty string uses the default +`CLAUDE_CODE_RESUME_SHOWS_CUT_OFF_CALLS`| Set to `1` to keep [interrupted tool calls](</docs/en/sessions#what-a-resumed-session-restores>), marked as cut off, in a turn that `CLAUDE_CODE_RESUME_INTERRUPTED_TURN` continues. When unset, those calls are dropped before the turn continues. Some calls stay dropped, such as calls to subagents, skills, workflows, and tools that wait on a person. For the VS Code chat panel, see [Continue conversations after a reload](</docs/en/vs-code#continue-conversations-after-a-reload>). Requires Claude Code v2.1.309 or later `CLAUDE_CODE_RETRY_WATCHDOG`| Set to `1` for unattended sessions such as eval harnesses, CI jobs, or remote workers. Retries `429` and `529` capacity errors indefinitely instead of failing after `CLAUDE_CODE_MAX_RETRIES` attempts. Claude Code fails at once when a standard-speed request gets a `429` that reports a spend limit or exhausted usage credits, even one from a [gateway spend cap](</docs/en/errors#spend-limit-reached>) that resets on a schedule. Before v2.1.239, the watchdog retried these indefinitely. For fast mode requests, see [Handle rate limits](</docs/en/fast-mode#handle-rate-limits>). The watchdog backs off up to 5 minutes between attempts, or until the limit resets when the response carries a rate-limit reset time, so a session that hits a usage limit waits out the remaining window. On v2.1.199 or later it also raises the default retry count for other transient errors, such as server errors, timeouts, and dropped connections, to 300, roughly three hours of backoff, and removes the cap of 15 on `CLAUDE_CODE_MAX_RETRIES` if you set that variable explicitly. Requires Claude Code v2.1.186 or later `CLAUDE_CODE_RETRY_WATCHDOG_MAX_WAIT_MS`| Maximum time in milliseconds that each API request spends waiting out `429` and `529` errors when `CLAUDE_CODE_RETRY_WATCHDOG` is set. Once that time is spent, the next such error ends the request. Give a positive whole number in plain digits, such as `1800000` for 30 minutes. When unset, the wait has no limit. Requires Claude Code v2.1.295 or later `CLAUDE_CODE_RETRY_WATCHDOG_USAGE_LIMIT_RECHECK_MS`| Minimum interval in milliseconds between checks of whether a [usage limit](</docs/en/errors#youve-hit-your-session-limit>) was already lifted, while a request waits for that limit to reset with `CLAUDE_CODE_RETRY_WATCHDOG` set. When a check finds the limit lifted, the request goes out at once. Give a whole number in plain digits from `60000`, one minute, to `10800000`, three hours. Checks are made only for a claude.ai subscription’s session or weekly limit while usage credits aren’t in use, and not while `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` is set. When this variable is unset or its value is outside that range, no checks are made. Requires Claude Code v2.1.305 or later
modified
--- a/env-vars.md +++ b/env-vars.md @@ -218,13 +218,13 @@ `CLAUDE_CODE_DISABLE_BACKGROUND_TASKS`| Set to `1` to remove the `run_in_background` parameter from the Bash, PowerShell, and subagent tools and to turn off the Ctrl+B shortcut and background runs of [forked skills](</docs/en/skills#run-skills-in-a-subagent>). Claude Code then also stops moving subagents, long MCP tool calls, and timed-out shell commands to the background automatically. [MCP tasks](</docs/en/mcp#make-claude-wait-for-the-result-of-an-mcp-task>) and the [Monitor tool](</docs/en/tools-reference#monitor-tool>) still run in the background `CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_DEFAULT`| Set to `1` to stop Claude Code from treating an [Amazon Bedrock](</docs/en/amazon-bedrock>) streaming response with a missing or empty `Content-Type` header as Amazon Bedrock’s binary event stream. By default, Claude Code assumes a gateway dropped the header from an otherwise unmodified response, so it decodes the body and streaming keeps working. Set this only for a gateway that also re-emits the stream as server-sent events; Claude Code then reads the header-less body as server-sent events instead. Requires Claude Code v2.1.239 or later `CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_GUARD`| Set to `1` to skip the check that an [Amazon Bedrock](</docs/en/amazon-bedrock>) streaming response carries the `application/vnd.amazon.eventstream` content-type. Without this variable, when a response carries a different content-type, Claude Code fails the request with an error naming that type, which means a [gateway or proxy is transforming the response](</docs/en/amazon-bedrock#streaming-errors-behind-a-gateway-or-proxy>). Configure the gateway to forward the `Content-Type` header and body unmodified rather than setting this variable. Requires Claude Code v2.1.208 or later -`CLAUDE_CODE_DISABLE_BG_EXIT_HANDOFF`| Set to `1` to stop a [background session’s](</docs/en/agent-view>) in-flight work when the [supervisor](</docs/en/agent-view#the-supervisor-process>) stops, restarts, or updates that session’s process, instead of handing it to the session’s next process. That work is the session’s running background shell commands and dynamic workflows, plus background subagents as of v2.1.198. Affects only that handoff: backgrounding a session with `←` or [`/background`](</docs/en/agent-view#from-inside-a-session>) still carries in-flight background work over. Requires Claude Code v2.1.196 or later +`CLAUDE_CODE_DISABLE_BG_EXIT_HANDOFF`| Set to `1` to stop a [background session’s](</docs/en/agent-view>) in-flight work when the [supervisor](</docs/en/agent-view#the-supervisor-process>) stops, restarts, or updates that session’s process, instead of handing it to the session’s next process. That work is the session’s running background shell commands, plus background subagents as of v2.1.198. Affects only that handoff: backgrounding a session with `←` or [`/background`](</docs/en/agent-view#from-inside-a-session>) still carries in-flight background work over. Requires Claude Code v2.1.196 or later `CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP`| Set to `1` to stop Claude Code from terminating [background shell commands](</docs/en/interactive-mode#background-bash-commands>) under memory pressure. By default, on macOS and Linux, Claude Code terminates background shells when the operating system reports critical memory pressure and the session has been idle for 30 minutes with no turn or subagent running. Windows has no memory-pressure signal, so this variable has no effect there. Requires Claude Code v2.1.193 or later `CLAUDE_CODE_DISABLE_BUNDLED_SKILLS`| Set to `1` to disable the [skills](</docs/en/skills>) and workflows included with Claude Code: bundled skills and workflows are removed entirely, while built-in commands like `/init` stay typable but are hidden from the model. `/doctor` stays typable like the built-in commands; hide it with `DISABLE_DOCTOR_COMMAND` instead. Skills from plugins, `.claude/skills/`, and `.claude/commands/` are unaffected. Equivalent to the [`disableBundledSkills`](</docs/en/settings-reference#disablebundledskills>) setting `CLAUDE_CODE_DISABLE_CFC_PROMPT`| Set to `1` to keep the [Claude in Chrome](</docs/en/chrome>) browser tools available while omitting the Chrome section of the system prompt and the `/claude-in-chrome` [bundled skill](</docs/en/skills#bundled-skills>). For hosts that embed Claude Code and supply their own browser guidance. Requires Claude Code v2.1.257 or later `CLAUDE_CODE_DISABLE_CLAUDE_MDS`| Set to `1` to prevent loading any CLAUDE.md memory files into context, including user, project, and auto memory files `CLAUDE_CODE_DISABLE_CRON`| Set to `1` to disable [session-scoped scheduled tasks](</docs/en/scheduled-tasks>). The `/loop` skill and cron tools become unavailable and any already-scheduled tasks stop firing, including tasks that are already running mid-session -`CLAUDE_CODE_DISABLE_DANGEROUS_RM_TIMEOUT`| Set to `1` to turn off the time limit on [critical-path removal](</docs/en/permission-modes#critical-paths>) prompts. In `auto` mode Claude Code then sends these removals to the classifier instead, and in `bypassPermissions` mode the prompt waits for your answer. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.281 or later +`CLAUDE_CODE_DISABLE_DANGEROUS_RM_TIMEOUT`| Set to `1` to turn off the `auto` and `bypassPermissions` [time limit and denials](</docs/en/permission-modes#time-limits-and-denials-in-auto-and-bypasspermissions-modes>) on critical-path removals. These removals then go to the classifier in `auto` mode, and get an untimed prompt in `bypassPermissions` mode wherever Claude Code can show one. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.281 or later `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`| Set to `1` to strip pre-release `anthropic-beta` request headers, the body fields that pair with them, and beta tool-schema fields such as `defer_loading` and `eager_input_streaming` from API requests. Use this when a proxy gateway rejects requests with an `Unexpected value(s)` error for the `anthropic-beta` header or an `Extra inputs are not permitted` error. [Disable pre-release capabilities](</docs/en/llm-gateway-protocol#disable-pre-release-capabilities>) lists what the variable removes, including [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>), and what Claude Code keeps sending `CLAUDE_CODE_DISABLE_EXPLORE_PLAN_AGENTS`| Set to `1` to disable the built-in [Explore and Plan subagents](</docs/en/sub-agents#built-in-subagents>). Claude explores with its search tools or the general-purpose subagent instead, and [plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>) reads files directly rather than launching Explore and Plan agents. Custom subagents named `Explore` or `Plan` are unaffected. To remove every built-in subagent type in the Agent SDK or non-interactive mode, use `CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS` instead. Requires Claude Code v2.1.198 or later `CLAUDE_CODE_DISABLE_FAST_MODE`| Set to `1` to disable [fast mode](</docs/en/fast-mode>)
modified
--- a/env-vars.md +++ b/env-vars.md @@ -280,7 +280,7 @@ `CLAUDE_CODE_FORCE_SESSION_PERSISTENCE`| Set to `1` to force transcript persistence, prompt history, and `claude agents` registration even when this `claude` was launched from inside another Claude Code session. Use when an inherited `CLAUDE_CODE_CHILD_SESSION` value, for example from a `screen` session or a background launcher first started by Claude Code’s Bash tool, causes a genuine top-level session to be misclassified as nested. As of v2.1.178, Claude Code detects the tmux case automatically and ignores the inherited marker, so tmux no longer needs this variable. Also honored on v2.1.169 and earlier; has no effect on v2.1.170 and v2.1.171, where the nested-session detection it overrides was removed `CLAUDE_CODE_FORCE_STRIKETHROUGH`| Set to `1` to force strikethrough rendering for `~~text~~` in Claude’s responses when your terminal supports it but is not auto-detected, such as over SSH without `TERM_PROGRAM` forwarded. Without this, undetected terminals show the literal `~~` markers instead of rendering the text as strikethrough. Requires Claude Code v2.1.186 or later `CLAUDE_CODE_FORCE_SYNC_OUTPUT`| Set to `1` to force-enable DEC private mode 2026 [synchronized output](<https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036>) when your terminal supports it but is not auto-detected. Useful for emulators such as Emacs `eat` that implement BSU/ESU but do not reply to the capability probe. Has no effect under tmux. Unlike `CLAUDE_CODE_NO_FLICKER`, which switches to [fullscreen rendering](</docs/en/fullscreen>), this doesn’t change the renderer -`CLAUDE_CODE_FORCE_TERMINAL_IMAGES`| Set to `1` to draw [mod `Image` elements](</docs/en/plugins/mods/reference#elements>) as pictures when your terminal draws kitty graphics protocol images with Unicode placeholders and you still see an `Image`’s dimmed `alt` text. See [which terminals draw an `Image`](</docs/en/plugins/mods/gallery#image-and-client>) and why this variable doesn’t help inside tmux or screen +`CLAUDE_CODE_FORCE_TERMINAL_IMAGES`| Set to `1` to draw [mod `Image` elements](</docs/en/plugins/mods/reference#elements>) as pictures when your terminal draws kitty graphics protocol images with Unicode placeholders and you still see an `Image`’s dimmed `alt` text. See [which terminals draw an `Image` and where not to set this variable](</docs/en/plugins/mods/gallery#image-and-client>) `CLAUDE_CODE_FORK_SUBAGENT`| Controls fork mode, which is on by default and lets Claude start [forks](</docs/en/sub-agents#fork-the-current-conversation>) on its own. While fork mode is on, Claude also can’t [wait for a subagent](</docs/en/sub-agents#run-subagents-in-foreground-or-background>) in interactive terminal, VS Code, or desktop sessions on your machine. Set to `0` to turn fork mode off. For versions, see [Turn fork mode off](</docs/en/sub-agents#turn-fork-mode-on-or-off>) `CLAUDE_CODE_FORWARD_SUBAGENT_TEXT`| Set to `1` to emit [subagent](</docs/en/sub-agents>) text and thinking blocks in `claude -p --output-format stream-json` output, the same behavior as the [`--forward-subagent-text`](</docs/en/cli-reference#cli-flags>) flag. Use the variable when a harness invokes `claude` and can’t pass the flag itself. Unlike the flag, which exits with an error outside non-interactive mode with stream-json output, the variable is ignored there so that nested invocations keep working when it’s set process-wide. Requires Claude Code v2.1.211 or later `CLAUDE_CODE_GATEWAY_HINT_HEADERS`| Set to `1` to send the [gateway hint headers](</docs/en/llm-gateway-protocol#gateway-hint-headers>), such as `x-claude-code-request-class` and `x-claude-code-compaction`, on a custom proxy or a third-party provider such as Amazon Bedrock or Claude Platform on AWS. Set to `0` to stop sending them on every connection, including a direct connection to the Anthropic API, where Claude Code sends them by default. Requires Claude Code v2.1.273 or later
modified
--- a/env-vars.md +++ b/env-vars.md @@ -215,7 +215,7 @@ `CLAUDE_CODE_DISABLE_ATTACHMENTS`| Set to `1` to disable attachment processing. File mentions with `@` syntax are sent as plain text instead of being expanded into file content. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) `CLAUDE_CODE_DISABLE_AUTH_REFRESH_LOCK`| Set to `1` to make a Claude Code process run its [`gcpAuthRefresh`](</docs/en/settings-reference#gcpauthrefresh>) or [`awsAuthRefresh`](</docs/en/settings-reference#awsauthrefresh>) command itself instead of waiting while another process runs it. Requires Claude Code v2.1.286 or later `CLAUDE_CODE_DISABLE_AUTO_MEMORY`| Set to `1` to disable [auto memory](</docs/en/memory#auto-memory>). Set to `0` to force auto memory on even when `--bare` mode or [`autoMemoryEnabled: false`](</docs/en/settings-reference#automemoryenabled>) would otherwise disable it. When disabled, Claude does not create or load auto memory files -`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 +`CLAUDE_CODE_DISABLE_BACKGROUND_TASKS`| Set to `1` to remove the `run_in_background` parameter from the Bash, PowerShell, and subagent tools and to turn off the Ctrl+B shortcut and background runs of [forked skills](</docs/en/skills#run-skills-in-a-subagent>). Claude Code then also stops moving subagents, long MCP tool calls, and timed-out shell commands to the background automatically. [MCP tasks](</docs/en/mcp#make-claude-wait-for-the-result-of-an-mcp-task>) and the [Monitor tool](</docs/en/tools-reference#monitor-tool>) still run in the background `CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_DEFAULT`| Set to `1` to stop Claude Code from treating an [Amazon Bedrock](</docs/en/amazon-bedrock>) streaming response with a missing or empty `Content-Type` header as Amazon Bedrock’s binary event stream. By default, Claude Code assumes a gateway dropped the header from an otherwise unmodified response, so it decodes the body and streaming keeps working. Set this only for a gateway that also re-emits the stream as server-sent events; Claude Code then reads the header-less body as server-sent events instead. Requires Claude Code v2.1.239 or later `CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_GUARD`| Set to `1` to skip the check that an [Amazon Bedrock](</docs/en/amazon-bedrock>) streaming response carries the `application/vnd.amazon.eventstream` content-type. Without this variable, when a response carries a different content-type, Claude Code fails the request with an error naming that type, which means a [gateway or proxy is transforming the response](</docs/en/amazon-bedrock#streaming-errors-behind-a-gateway-or-proxy>). Configure the gateway to forward the `Content-Type` header and body unmodified rather than setting this variable. Requires Claude Code v2.1.208 or later `CLAUDE_CODE_DISABLE_BG_EXIT_HANDOFF`| Set to `1` to stop a [background session’s](</docs/en/agent-view>) in-flight work when the [supervisor](</docs/en/agent-view#the-supervisor-process>) stops, restarts, or updates that session’s process, instead of handing it to the session’s next process. That work is the session’s running background shell commands and dynamic workflows, plus background subagents as of v2.1.198. Affects only that handoff: backgrounding a session with `←` or [`/background`](</docs/en/agent-view#from-inside-a-session>) still carries in-flight background work over. Requires Claude Code v2.1.196 or later @@ -234,6 +234,7 @@ `CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS`| Set to `1` to remove built-in commit and PR workflow instructions and the git status snapshot from Claude’s context. Useful when using your own git workflow skills. Takes precedence over the [`includeGitInstructions`](</docs/en/settings-reference#includegitinstructions>) setting when set `CLAUDE_CODE_DISABLE_INLINE_SHELL_RM_PROMPT`| Set to `1` to stop Claude Code from reading scripts passed to a shell with `-c`, such as `bash -c 'rm -rf ~'`, for [critical-path](</docs/en/permission-modes#removals-inside-nested-commands-and-inline-scripts>) removals. Claude Code still checks the shell variable and positional parameter targets in those scripts, and the other critical-path checks keep running. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.288 or later `CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP`| Set to `1` to prevent automatic remapping of Opus 4 and Opus 4.1 to the current Opus version on the Anthropic API. Use when you intentionally want to pin an older model. The remap does not run on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry +`CLAUDE_CODE_DISABLE_MCP_TASK_BACKGROUND`| Set to `1` so that Claude waits for the result of an [MCP task](</docs/en/mcp#make-claude-wait-for-the-result-of-an-mcp-task>) in an interactive session. While [automatic backgrounding](</docs/en/mcp#automatic-backgrounding-of-long-tool-calls>) is on, it still moves the call to the background after two minutes by default. Requires Claude Code v2.1.304 or later `CLAUDE_CODE_DISABLE_MODEL_ACCESS_FALLBACK`| Set to `1` to stop Claude Code on [Amazon Bedrock](</docs/en/amazon-bedrock#when-a-model-is-disabled-mid-session>) and [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai#when-a-model-is-disabled-mid-session>) from switching to an older model when your account loses access to a session’s model mid-session; the refused request fails at once instead. A [fallback model chain](</docs/en/model-config#fallback-model-chains>) you configure still switches on that refusal, and the [startup model checks](</docs/en/amazon-bedrock#startup-model-checks>) still fall back at launch. Requires Claude Code v2.1.285 or later `CLAUDE_CODE_DISABLE_MOUNTED_DRIVE_RM_PROMPT`| Set to `1` to turn off the [mounted drive prompt](</docs/en/permission-modes#the-mounted-drive-prompt>) for paths such as `/Volumes/USB`. Set it in the environment that launches Claude Code, because Claude Code [ignores it in a settings `env` block](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). Requires Claude Code v2.1.304 or later `CLAUDE_CODE_DISABLE_MOUSE`| Set to `1` to disable mouse tracking in [fullscreen rendering](</docs/en/fullscreen>). Keyboard scrolling with `PgUp` and `PgDn` still works. Use this to keep your terminal’s native copy-on-select behavior @@ -305,7 +306,7 @@ `CLAUDE_CODE_MAX_TURNS`| Cap the number of agentic turns when no explicit limit is passed. Equivalent to passing [`--max-turns`](</docs/en/cli-reference#cli-flags>), which takes precedence when both are set. A value that is not a positive integer is rejected at startup with an error rather than treated as no cap `CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSION`| Cap on [WebSearch](</docs/en/tools-reference#session-search-limit>) calls (default: 200). When Claude reaches the cap, further WebSearch calls return a notice telling it to continue with the information it already gathered and say so in its answer. Accepts a positive whole number with no upper bound. Anything else is ignored and the default applies, so the cap can be raised but not turned off. Requires Claude Code v2.1.212 or later `CLAUDE_CODE_MCP_ALLOWLIST_ENV`| Set to `1` to spawn stdio MCP servers with only a safe baseline environment plus the server’s configured `env`, instead of inheriting your shell environment -`CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS`| Elapsed time in milliseconds before a still-running MCP tool call [moves to a background task](</docs/en/mcp#automatic-backgrounding-of-long-tool-calls>) (default: 120000, or 2 minutes). Set to `0` to turn automatic backgrounding off. Requires Claude Code v2.1.212 or later +`CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS`| Elapsed time in milliseconds before a still-running MCP tool call [moves to a background task](</docs/en/mcp#automatic-backgrounding-of-long-tool-calls>) (default: 120000, or 2 minutes). Set to `0` to turn automatic backgrounding off and, in an interactive session, to make Claude wait for [MCP tasks](</docs/en/mcp#make-claude-wait-for-the-result-of-an-mcp-task>). Requires Claude Code v2.1.212 or later `CLAUDE_CODE_MCP_STARTUP_WAIT_MS`| How long in milliseconds the first turn of a [non-interactive](</docs/en/headless>) session waits for MCP servers that are still connecting, in place of the default [first-turn wait](</docs/en/agent-sdk/mcp#connection-timing>). In a [self-hosted environment](</docs/en/self-hosted-environments-configuration#connection-timing>), it changes only how long the wait lasts. Some servers keep a wait of their own regardless of the value; [Connection timing](</docs/en/agent-sdk/mcp#connection-timing>) lists them. Set to `0` to skip the wait for every other server. Requires Claude Code v2.1.274 or later `CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT`| Idle timeout in milliseconds for MCP tool calls. When a stdio, HTTP, SSE, WebSocket, or [claude.ai connector](</docs/en/mcp#use-mcp-servers-from-claude-ai>) MCP server sends no response and no progress notification for this long, the tool call aborts with an error instead of waiting for the overall `MCP_TOOL_TIMEOUT`. Overrides the per-transport defaults of 300000 (5 minutes) for network servers and 1800000 (30 minutes) for stdio servers. Set to `0` to disable the idle check. Values below 1000 are raised to one second, and the value is capped at the effective `MCP_TOOL_TIMEOUT`. A per-server `timeout` in `.mcp.json` of at least 1000 raises that server’s idle window to at least the `timeout` value. Doesn’t apply to IDE servers or SDK in-process servers. Requires Claude Code v2.1.187 or later. Before v2.1.203, stdio servers were exempt from the idle timeout `CLAUDE_CODE_MESSAGING_SOCKET`| Set by Claude Code, not by you: in sessions that bind an [inbox socket](</docs/en/cross-session-messaging#the-sessions-inbox-socket>), Claude Code exports that socket’s path to hooks and Bash commands when it binds the socket. In a session that starts with messaging on, Claude Code binds the socket before any hook runs. Other sessions on the machine deliver messages to this path. Each session exports its own socket rather than one inherited from a parent, and messages arriving on it go through the session’s [inbound controls](</docs/en/cross-session-messaging#control-inbound-messages>). Settings `env` blocks can’t set it. Requires Claude Code v2.1.224 or later @@ -553,6 +554,7 @@ * Sync the [skills](</docs/en/skills#where-synced-skills-load>) and [plugins](</docs/en/plugins/loading#synced-plugins>) enabled for your claude.ai account into your terminal sessions * Turn on the [You should know mod](</docs/en/interactive-mode#you-should-know-suggestions>) * Use [the advisor tool](</docs/en/advisor#requirements>) + * Use [MCP tasks](</docs/en/mcp#mcp-tasks-that-run-on-the-server>) * Read or reply to [comments on an artifact](</docs/en/artifacts#collect-comments-on-an-artifact>) * Have Claude read [another organization’s public artifact](</docs/en/artifacts#read-an-artifact-shared-with-you>) * Get the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) by default for claude.ai and Console accounts on Windows with Git Bash installed; Claude Code routes shell commands through Git Bash unless you set `CLAUDE_CODE_USE_POWERSHELL_TOOL=1`. On Windows without Git Bash, the tool stays on
modified
--- a/env-vars.md +++ b/env-vars.md @@ -172,9 +172,9 @@ `CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS`| Stall timeout in milliseconds for subagents. Also covers [workflow agents](</docs/en/workflows#when-an-agent-stalls-and-restarts>) on Claude Code v2.1.286 or later. Default `600000` (10 minutes); if you raise `CLAUDE_STREAM_IDLE_TIMEOUT_MS` while the stream watchdog is on, the default rises with it, as [Handle slow or stalled API responses](</docs/en/agent-sdk/typescript#handle-slow-or-stalled-api-responses>) describes `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE`| Set the percentage (1-100) of the auto-compact window at which auto-compaction triggers. Use lower values like `50` to compact earlier; the variable can’t raise the threshold, so values above the default percentage are ignored. It applies only in sessions that [compact before the model’s context limit](</docs/en/model-config#context-window-and-auto-compaction>). Applies to both main conversations and subagents `CLAUDE_AUTO_BACKGROUND_TASKS`| Set to `1` to force-enable automatic backgrounding of long-running agent tasks. When enabled, a [subagent](</docs/en/sub-agents#run-subagents-in-foreground-or-background>) moves to the background after running for approximately two minutes. If Claude queued a tool call such as a file edit behind the subagent, the subagent finishes in the foreground before that call starts. Also enables [automatic backgrounding of long MCP tool calls](</docs/en/mcp#automatic-backgrounding-of-long-tool-calls>) in non-interactive mode on Claude Code v2.1.212 or later -`CLAUDE_AX_PREPARK_MS`| In [screen reader mode](</docs/en/accessibility>), how many milliseconds Claude Code waits before it writes a new or changed line. Default `0`, so Claude Code doesn’t wait. Before v2.1.287, the default was `50`. Claude Code caps the wait at `5000`. Requires Claude Code v2.1.233 or later -`CLAUDE_AX_SCREEN_READER`| Set to `1` to render screen-reader friendly output: flat text without decorative borders or animations. Set to `0` to force screen-reader mode off even when [`axScreenReader`](</docs/en/settings-reference#axscreenreader>) is `true`. The [`--ax-screen-reader`](</docs/en/cli-reference#cli-flags>) flag takes precedence. Requires Claude Code v2.1.181 or later -`CLAUDE_AX_STARTUP_QUIET_MS`| In [screen reader mode](</docs/en/accessibility>), how many milliseconds Claude Code holds the first interface render after the startup confirmation line, so your screen reader can speak the line in full before new output interrupts it. Default `3000`. Set `0` to render immediately. Claude Code caps the hold at `600000` (10 minutes). Your first keystroke ends the hold early. Requires Claude Code v2.1.217 or later +`CLAUDE_AX_PREPARK_MS`| In [screen reader mode](</docs/en/accessibility>), how many milliseconds Claude Code waits before it writes a new or changed line. Default `0`, so Claude Code doesn’t wait. Before v2.1.287, the default was `50`. Claude Code caps the wait at `5000`. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). Requires Claude Code v2.1.233 or later +`CLAUDE_AX_SCREEN_READER`| Set to `1` to render screen-reader friendly output: flat text without decorative borders or animations. Set to `0` to force screen-reader mode off even when [`axScreenReader`](</docs/en/settings-reference#axscreenreader>) is `true`. The [`--ax-screen-reader`](</docs/en/cli-reference#cli-flags>) flag takes precedence. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). Requires Claude Code v2.1.181 or later +`CLAUDE_AX_STARTUP_QUIET_MS`| In [screen reader mode](</docs/en/accessibility>), how many milliseconds Claude Code holds the first interface render after the startup confirmation line. Your screen reader can then speak the line in full before new output interrupts it. Default `3000`. Set `0` to render immediately. Claude Code caps the hold at `600000` (10 minutes). Your first keystroke ends the hold early. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). Requires Claude Code v2.1.217 or later `CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR`| Return to the original working directory after each Bash or PowerShell command in the main session `CLAUDE_BYTE_STREAM_IDLE_TIMEOUT_MS`| Timeout in milliseconds for the byte-level streaming idle watchdog; when set, it takes precedence over `CLAUDE_STREAM_IDLE_TIMEOUT_MS` for that watchdog and leaves the event-level watchdog unchanged. Claude Code clamps this variable to between 10 seconds and 30 minutes. Requires Claude Code v2.1.210 or later `CLAUDE_CLIENT_PRESENCE_FILE`| Path to a file that an external tool, such as a screen-lock listener, creates when you unlock your screen and deletes when you lock it. While the file exists, Claude Code skips [Remote Control mobile push notifications](</docs/en/remote-control#mobile-push-notifications>), so you stop getting pushes while you are actively using the computer. When the file is absent or unreadable, notifications are sent as normal. Claude Code checks the file once per push-triggering event rather than polling it. Requires Claude Code v2.1.181 or later @@ -251,6 +251,7 @@ `CLAUDE_CODE_DISABLE_SUBSTITUTION_RM_PROMPT`| Set to `1` to turn off the [critical-path](</docs/en/permission-modes#critical-paths>) check for a recursive `rm` whose target is entirely the output of a command substitution, such as `rm -rf "$(pwd)"`. The other critical-path checks keep running. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.281 or later `CLAUDE_CODE_DISABLE_TERMINAL_TITLE`| Set to `1` to disable automatic terminal title updates based on conversation context. This also skips the background small/fast-model request that [generates a session title](</docs/en/sessions#name-your-sessions>), and turns off [status reports to your terminal](</docs/en/terminal-config#see-session-status-in-your-terminal>) `CLAUDE_CODE_DISABLE_THINKING`| Set to `1` to omit the `thinking` parameter from API requests entirely. This is a compatibility option for proxies and gateways that reject the parameter. On models that think by default, omitting the parameter means the model may still think. To explicitly disable [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) on the Anthropic API, use `MAX_THINKING_TOKENS=0` instead. Neither variable turns thinking off on Opus 5.5, Sonnet 5.5, Haiku 5.5, or the Fable models, which can’t have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `MAX_THINKING_TOKENS=0` likewise omits the parameter, so the two variables behave the same there +`CLAUDE_CODE_DISABLE_ULTRAREVIEW_TRUST_CHECK`| Set to `1` so that [`claude ultrareview`](</docs/en/ultrareview#trust-the-folder-before-the-review-runs>) doesn’t exit with `Error: Workspace not trusted` in a folder you haven’t trusted when it can’t ask you to trust it, such as in CI. Set it in the environment that launches Claude Code, not a settings `env` block, and only where every such run starts in a folder you trust. Runs that can ask still ask. Requires Claude Code v2.1.309 or later `CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT`| Set to `1` to skip proactive [auto-compaction](</docs/en/costs#reduce-token-usage>) when Claude Code doesn’t recognize the model ID, such as an [LLM gateway](</docs/en/llm-gateway>) alias. Without this variable, Claude Code compacts at the context window it assumes for the ID. `CLAUDE_CODE_MAX_CONTEXT_TOKENS` can correct the assumed window instead; see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>) for when each variable applies. Requires Claude Code v2.1.223 or later `CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL`| Set to `1` to disable virtual scrolling in [fullscreen rendering](</docs/en/fullscreen>) and render every message in the transcript. Use this if scrolling in fullscreen mode shows blank regions where messages should appear `CLAUDE_CODE_DISABLE_WEB_FETCH`| Set to `1` to turn off the [WebFetch](</docs/en/tools-reference#webfetch-tool-behavior>) tool. The [WebSearch](</docs/en/tools-reference#websearch-tool-behavior>) tool stays available. Requires Claude Code v2.1.285 or later @@ -267,6 +268,7 @@ `CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY`| Set to `1` to populate the `/model` picker from your gateway’s `/v1/models` endpoint when `ANTHROPIC_BASE_URL` points at an Anthropic-compatible gateway such as LiteLLM, Kong, or an internal proxy. Off by default because gateways backed by a shared API key would otherwise show every user every model the key can access. Discovered models are still filtered by an [`availableModels`](</docs/en/settings-reference#availablemodels>) allowlist the session receives; deliver the list through [MDM or a managed settings file](</docs/en/managed-settings#delivery-mechanisms>), since [server-managed delivery is not available on gateway configurations](</docs/en/server-managed-settings#platform-availability>) `CLAUDE_CODE_ENABLE_OPUS_4_7_FAST_MODE`| Removed in v2.1.142, when the [fast mode](</docs/en/fast-mode>) default moved from Opus 4.6 to Opus 4.7 `CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION`| Set to `false` to turn off prompt suggestions, the grayed-out predictions that appear in your prompt input. Takes precedence over the [`promptSuggestionEnabled`](</docs/en/settings-reference#promptsuggestionenabled>) setting, which is what the **Prompt suggestions** toggle in `/config` writes. Claude Code also [pauses suggestions while your account is close to or at its usage limit](</docs/en/interactive-mode#when-claude-code-skips-suggestions>). Set to `true` to keep that pause from applying until you reach the limit. Requires Claude Code v2.1.238 or later. See [Prompt suggestions](</docs/en/interactive-mode#prompt-suggestions>) +`CLAUDE_CODE_ENABLE_SHARE_BUNDLE`| Set to `1` to make [`/share`](</docs/en/commands#all-commands>) save its report and the whole session transcript to a [local archive under `~/.claude/feedback-bundles/`](</docs/en/data-usage#telemetry-services>) instead of sending the report to Anthropic. If your organization’s policy turns off `/share`, you can’t turn it back on with this variable. Requires Claude Code v2.1.299 or later `CLAUDE_CODE_ENABLE_TASKS`| Selects which task-tracking tools Claude Code provides in [sessions that have them](</docs/en/tools-reference#task-tool-availability>). By default, Claude Code provides the Task tools `TaskCreate`, `TaskUpdate`, `TaskGet`, and `TaskList`. Set to `0` to get the legacy `TodoWrite` tool instead. See [Task list](</docs/en/interactive-mode#task-list>) `CLAUDE_CODE_ENABLE_TELEMETRY`| Set to `1` to enable OpenTelemetry data collection for metrics and logging. Required before configuring OTel exporters. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). See [Monitoring](</docs/en/monitoring-usage>) `CLAUDE_CODE_ENABLE_TODO_TOOLS`| Set to `1` to get the task-tracking tools on every model. Without it, Claude Code provides them by default only on the models listed under [Task tool availability](</docs/en/tools-reference#task-tool-availability>). `CLAUDE_CODE_ENABLE_TASKS` still selects the Task tools or `TodoWrite`. Requires Claude Code v2.1.233 or later @@ -395,6 +397,8 @@ `CLAUDE_CODE_USE_MANTLE`| Use the Amazon Bedrock [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>) `CLAUDE_CODE_USE_POWERSHELL_TOOL`| Controls the PowerShell tool. On Windows without Git Bash, the tool is enabled automatically; set to `0` to disable it. On Windows with Git Bash installed, the tool is on by default for claude.ai and Console accounts; set to `1` to enable it in Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry sessions, or `0` to turn it off. On Linux, macOS, and WSL, set to `1` to enable it, which requires `pwsh` on your `PATH`. When enabled on Windows, Claude can run PowerShell commands natively instead of routing through Git Bash. See [PowerShell tool](</docs/en/tools-reference#powershell-tool>) `CLAUDE_CODE_USE_VERTEX`| Use [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>) +`CLAUDE_CODE_WARN_DISK_FREE_GIB`| Set to a whole number of GiB, such as `10`, to have Claude Code warn Claude when free space on the working directory’s filesystem falls below that amount. The warning is a system reminder saying how much is free. The reminder is off when the variable is unset, `0`, or not plain digits. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.304 or later +`CLAUDE_CODE_WARN_MEMORY_FREE_GIB`| On Linux and WSL, set to a whole number of GiB such as `4` to have Claude Code warn Claude when available memory falls below that amount. The warning is a system reminder saying how much is available. The reminder is off when the variable is unset, `0`, or not plain digits. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.304 or later `CLAUDE_CODE_WEBFETCH_CACHE_TTL_MS`| Set to the number of milliseconds [WebFetch](</docs/en/tools-reference#webfetch-tool-behavior>) keeps each fetched URL’s response cached. The default is `900000`, which is 15 minutes. Takes plain digits only; `0`, a decimal, or any other spelling keeps the default. Claude Code reads the value once per launch, so a change in a settings `env` block applies when you next launch `claude`. Requires Claude Code v2.1.233 or later `CLAUDE_CODE_WEBFETCH_DEADLINE_MS`| Upper bound in milliseconds on how long [WebFetch](</docs/en/tools-reference#webfetch-tool-behavior>) waits for a page to download, including any redirects it follows. A download that hasn’t completed by then fails with a deadline error. The default is `300000`, which is five minutes. Set to `0` to remove the limit. Takes plain digits only; a decimal or any other spelling keeps the default. Requires Claude Code v2.1.268 or later `CLAUDE_CODE_WEB_SEARCH_REFILLS_PER_HOUR`| Rate at which a session’s [WebSearch limit](</docs/en/tools-reference#session-search-limit>) refills, in calls per hour. The default is `100` in an interactive terminal session. In a [non-interactive](</docs/en/headless>) session the default is `0`, which turns refill off. Takes plain digits only; any other spelling reads as unset. Requires Claude Code v2.1.290 or later @@ -423,7 +427,7 @@ `DISABLE_ERROR_REPORTING`| Set to any non-empty value, such as `1`, to opt out of error reporting. **Setting it to`0` or `false` still opts out**, unlike most on/off variables; unset the variable to turn error reporting back on `DISABLE_EXTRA_USAGE_COMMAND`| Set to `1` to hide the `/usage-credits` command that lets users purchase additional usage beyond rate limits `DISABLE_FEEDBACK_COMMAND`| Set to `1` to disable the `/feedback` command and [Claude-drafted feedback](</docs/en/tools-reference#sendfeedback-tool-behavior>). Also disables `/bug` and `/share`, which report through the same path; before v2.1.212 they were aliases of `/feedback`, so the command was disabled under every name. The older name `DISABLE_BUG_COMMAND` is also accepted -`DISABLE_GROWTHBOOK`| Set to `1` or `true` to disable GrowthBook feature-flag fetching and use code defaults for every flag. This makes [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable. Setting it to `0` or `false` leaves fetching on. Telemetry event logging stays on unless `DISABLE_TELEMETRY` is also set +`DISABLE_GROWTHBOOK`| Set to `1` or `true` to disable feature-flag fetching and use code defaults for every flag. This makes [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable. Setting it to `0` or `false` leaves fetching on. Telemetry event logging stays on unless `DISABLE_TELEMETRY` is also set `DISABLE_INSTALLATION_CHECKS`| Set to `1` to disable installation warnings. Use only when manually managing the installation location, as this can mask issues with standard installations `DISABLE_INSTALL_GITHUB_APP_COMMAND`| Set to `1` to hide the `/install-github-app` command. Already hidden when using third-party providers (Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry) `DISABLE_INTERLEAVED_THINKING`| Set to `1` to prevent sending the interleaved-thinking beta header. Useful when your LLM gateway or provider does not support [interleaved thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking#interleaved-thinking>) @@ -460,7 +464,7 @@ `MCP_DISCOVERY_CACHE_STRIKES`| At a start where a [discovery-cache](</docs/en/mcp#server-status-detail>) entry is older than `MCP_DISCOVERY_CACHE_TTL_S`, Claude Code refreshes it in the background. This variable sets how many refreshes in a row can fail before Claude Code discards the entry and connects the server at the next start instead (default: 1). Raise it if your network connection drops occasionally, so that one failed refresh doesn’t discard the entry. Requires Claude Code v2.1.238 or later `MCP_DISCOVERY_CACHE_TTL_S`| Seconds for which Claude Code uses a [discovery-cache](</docs/en/mcp#server-status-detail>) entry without refreshing it (default: 900). At a start where the entry is older than that, Claude Code still uses it but refreshes it in the background. Once the entry is older than `MCP_DISCOVERY_CACHE_MAX_STALE_S`, Claude Code discards it instead. Claude Code caps the value at `MCP_DISCOVERY_CACHE_MAX_STALE_S`, which is 4 hours by default. Before v2.1.238, Claude Code didn’t cap the value `MCP_OAUTH_CALLBACK_PORT`| Fixed port for the OAuth redirect callback, as an alternative to `--callback-port` when adding an MCP server with [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>) -`MCP_PROTOCOL_NEGOTIATION`| On the [v2 MCP client runtime](</docs/en/mcp#mcp-client-runtimes>) only, whether Claude Code probes servers for MCP protocol revision 2026-07-28. Set `auto` to probe HTTP, claude.ai connector, and stdio servers, or `legacy` to probe none. With the variable unset, Claude Code probes the servers described under [MCP client runtimes](</docs/en/mcp#mcp-client-runtimes>). Any other value is ignored with a warning in the debug log. Requires Claude Code v2.1.221 or later +`MCP_PROTOCOL_NEGOTIATION`| On the [v2 MCP client runtime](</docs/en/mcp#mcp-client-runtimes>) only, controls whether Claude Code probes servers for MCP protocol revision 2026-07-28. Set `legacy` to skip the probe, so that every server connects with the handshake from before that revision. Set `auto` to probe the server kinds that support the probe: HTTP and stdio servers, claude.ai connectors, and the connectors of cloud and Remote Control sessions. With the variable unset, Claude Code probes those same kinds by default; see [MCP client runtimes](</docs/en/mcp#mcp-client-runtimes>). Any other value is ignored with a warning in the debug log. Requires Claude Code v2.1.221 or later `MCP_REMOTE_SERVER_CONNECTION_BATCH_SIZE`| Maximum number of remote MCP servers (HTTP/SSE) to connect in parallel during startup (default: 20) `MCP_SDK_GENERATION`| Pin which [MCP client runtime](</docs/en/mcp#mcp-client-runtimes>) this process connects to MCP servers with: `v1`, built on MCP TypeScript SDK 1.x, or `v2`, built on [MCP TypeScript SDK 2.0](<https://ts.sdk.modelcontextprotocol.io/v2/>). Without the variable, Claude Code uses v2, starting with the versions listed in that section. On Claude Code v2.1.221 or later, the v2 runtime checks the issuer an MCP OAuth server returns in its authorization response and fails the sign-in with an error that begins `Issuer mismatch in authorization response` when it doesn’t match. The v1 runtime doesn’t run this check. If you set an unrecognized value, Claude Code ignores it and writes a warning to the debug log. Claude Code reads the value once per process. Requires Claude Code v2.1.218 or later `MCP_SERVER_CONNECTION_BATCH_SIZE`| Maximum number of local MCP servers (stdio) to connect in parallel during startup (default: 3)
modified
--- a/env-vars.md +++ b/env-vars.md @@ -387,7 +387,7 @@ `CLAUDE_CODE_TMUX_TRUECOLOR`| Set to any non-empty value, such as `1`, to allow 24-bit truecolor output inside tmux. **Setting it to`0` or `false` still allows truecolor**, unlike most on/off variables; unset the variable to restore the 256-color clamp. By default, Claude Code clamps to 256 colors when `$TMUX` is set because tmux does not pass through truecolor escape sequences unless configured to. Set this after adding `set -ga terminal-overrides ',*:Tc'` to your `~/.tmux.conf`. See [Terminal configuration](</docs/en/terminal-config>) for other tmux settings `CLAUDE_CODE_TOOL_MEMORY_CGROUP_EXCLUDE`| On Linux and WSL, set to a comma-separated list of the kinds of processes Claude Code [excludes from the tool memory cap](</docs/en/tools-reference#memory-limit-on-linux-and-wsl>), such as `mcp` or `lsp`. Set `none` to cap every kind, or `all-new` to cap only Bash, PowerShell, and Monitor tool commands. Claude Code keeps Bash, PowerShell, and Monitor tool commands under the cap whatever you list. Requires Claude Code v2.1.246 or later `CLAUDE_CODE_TOOL_MEMORY_LIMIT`| On Linux and WSL, set to a size such as `4G` to [cap the memory that Bash and PowerShell tool commands can use](</docs/en/tools-reference#memory-limit-on-linux-and-wsl>), and Monitor tool commands on v2.1.246 or later. Write the size in plain digits, alone for a number of bytes or with a `K`, `M`, `G`, or `T` suffix. Set `0` or `off` to turn the cap off. Once the first process Claude Code starts has turned the cap on or off, a changed value takes effect the next time you launch `claude`. Requires Claude Code v2.1.233 or later -`CLAUDE_CODE_TRANSCRIPT_LOCAL_GC`| Set to `1` to limit how large the [transcript file](</docs/en/sessions#where-transcripts-are-stored>) of a long `-p` or Agent SDK session grows. After each compaction, once the file is larger than 5 MB, Claude Code removes the history from before that compaction. Resuming the session restores the same conversation whether or not the file was trimmed. Set it in the environment you start Claude Code from, since a settings `env` block can’t turn it on. Requires Claude Code v2.1.287 or later +`CLAUDE_CODE_TRANSCRIPT_LOCAL_GC`| Set to `1` to limit how large the [transcript file](</docs/en/sessions#where-transcripts-are-stored>) of a long `-p` or Agent SDK session grows. After each compaction, once the file is larger than 5 MB, Claude Code removes the history from before that compaction. On v2.1.296 or later, the file stays as it is when removing that history would shrink it by less than 10%. Resuming the session restores the same conversation whether or not the file was trimmed. Set it in the environment you start Claude Code from, since a settings `env` block can’t turn it on. Requires Claude Code v2.1.287 or later `CLAUDE_CODE_USER_DIALOG_TIMEOUT_MS`| Deadline in milliseconds before Claude Code cancels a dialog it forwards to a remote client such as a [Remote Control](</docs/en/remote-control>) or SDK host, or the approval dialog for a [held cross-session message](</docs/en/cross-session-messaging#control-inbound-messages>); permission prompts and `AskUserQuestion` questions use their own flows and aren’t governed by it. On Claude Code v2.1.236 or later, it also bounds the mid-session [Fable usage-credits consent prompt](</docs/en/model-config#fable-and-usage-credits>) in a session that may be running unattended. [Control inbound messages](</docs/en/cross-session-messaging#control-inbound-messages>) and [non-interactive sessions](</docs/en/cross-session-messaging#non-interactive-sessions>) cover the full held-message expiry rules, including the cases where the deadline doesn’t apply. Overrides the [`dialogExpiry`](</docs/en/settings-reference#dialogexpiry>) setting. `0` or a negative value disables the deadline. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) `CLAUDE_CODE_USE_ANTHROPIC_AWS`| Use [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) `CLAUDE_CODE_USE_BEDROCK`| Use [Amazon Bedrock](</docs/en/amazon-bedrock>) @@ -441,7 +441,7 @@ `ENABLE_BETA_TRACING_DETAILED`| Set to `1`, and set `BETA_TRACING_ENDPOINT` to your OTLP/HTTP collector endpoint, to turn on [detailed beta tracing](</docs/en/monitoring-usage#traces-beta>), which adds content-bearing span attributes and the `claude_code.hook` span. Interactive CLI sessions also require your organization to be allowlisted for the beta. Both variables are ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) `ENABLE_CLAUDEAI_MCP_SERVERS`| Set to `false` to stop Claude Code from fetching [claude.ai MCP servers](</docs/en/mcp#use-mcp-servers-from-claude-ai>). Enabled by default for logged-in users. To disable per-project or per-org, set [`disableClaudeAiConnectors`](</docs/en/settings-reference#disableclaudeaiconnectors>) in settings instead `ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) instead of the default 5 minutes. Intended for API key, [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), [Microsoft Foundry](</docs/en/microsoft-foundry>), and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) users. For subscription users within included usage, Claude Code requests the 1-hour TTL automatically on the [main conversation](</docs/en/prompt-caching#which-ttl-each-request-gets>). Subscription users drawing on [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>) can set it to keep the 1-hour TTL. 1-hour cache writes are billed at a higher rate. To choose the TTL separately for the main conversation and for requests outside it, use `CLAUDE_CODE_PROMPT_CACHE_TTL` and `CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL`, which take precedence over this variable -`ENABLE_PROMPT_CACHING_1H_BEDROCK`| Deprecated. Use `ENABLE_PROMPT_CACHING_1H` instead +`ENABLE_PROMPT_CACHING_1H_BEDROCK`| Deprecated. Use `ENABLE_PROMPT_CACHING_1H` instead. Has no effect on [Claude apps gateway](</docs/en/claude-apps-gateway>) sessions, even when the gateway routes to Amazon Bedrock `ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset or `true` defers MCP tools, except in the [cases that keep tool search off](</docs/en/mcp#configure-tool-search>). `auto` turns tool search on once definitions reach 10% of the context window. `auto:N` sets a custom threshold, such as `auto:5` for 5%. `false` loads all tools upfront. If a gateway rejects tool search, see [Tool search through an LLM gateway](</docs/en/mcp#tool-search-through-a-gateway>) `FORCE_AUTOUPDATE_PLUGINS`| Set to `1` to force plugin auto-updates even when the main auto-updater is disabled via `DISABLE_AUTOUPDATER` `FORCE_HYPERLINK`| Set to `1` to enable clickable OSC 8 hyperlinks when your terminal supports them but isn’t auto-detected, or `0` to disable them. When unset, Claude Code enables hyperlinks only when it detects terminal support. Claude Code parses this value as a number, not a Boolean, so a value such as `false`, `no`, or `off` enables hyperlinks rather than disabling them. The footer [PR or merge request badge](</docs/en/interactive-mode#pr-review-status>) renders as a hyperlink even when Claude Code can’t detect terminal support, such as over SSH. Set `0` to render the badge as plain text
modified
Show diff (134 lines)
--- a/env-vars.md +++ b/env-vars.md @@ -106,7 +106,6 @@ * `DISABLE_TELEMETRY` * `DISABLE_ERROR_REPORTING` * `CLAUDE_CODE_TMUX_TRUECOLOR` - * `FALLBACK_FOR_ALL_PRIMARY_MODELS` * `IS_DEMO` One other variable has its own rule: `FORCE_HYPERLINK` reads a number, so only `0` turns it off. Each variable’s row also states its own rule. @@ -118,7 +117,7 @@ `ANTHROPIC_AWS_API_KEY`| Workspace API key for [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), generated in the AWS Console. Sent as `x-api-key` and takes precedence over AWS SigV4 `ANTHROPIC_AWS_BASE_URL`| Override the [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) endpoint URL. Use for custom regions or when routing through an [LLM gateway](</docs/en/llm-gateway>). Defaults to `https://aws-external-anthropic.{region}.api.aws`. Claude Code resolves the region with the [same precedence as on Amazon Bedrock](</docs/en/amazon-bedrock#3-configure-claude-code>) `ANTHROPIC_AWS_WORKSPACE_ID`| Required for [Claude Platform on AWS](</docs/en/claude-platform-on-aws>). Sent on every request as the `anthropic-workspace-id` header -`ANTHROPIC_BASE_URL`| Override the API endpoint to route requests through a proxy or gateway. When set to a non-first-party host, [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) is disabled by default. Set `ENABLE_TOOL_SEARCH=true` if your proxy forwards `tool_reference` blocks. As of v2.1.196, [Remote Control](</docs/en/remote-control#requirements>) is disabled when this points at a host other than `api.anthropic.com`, matching its behavior on Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry +`ANTHROPIC_BASE_URL`| Override the API endpoint to route requests through a proxy or gateway. For what happens when that gateway rejects MCP tool search, see [Tool search through an LLM gateway](</docs/en/mcp#tool-search-through-a-gateway>). As of v2.1.196, [Remote Control](</docs/en/remote-control#requirements>) is disabled when this points at a host other than `api.anthropic.com`, matching its behavior on Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry `ANTHROPIC_BEDROCK_BASE_URL`| Override the Amazon Bedrock endpoint URL. Use for custom Amazon Bedrock endpoints or when routing through an [LLM gateway](</docs/en/llm-gateway>). See [Amazon Bedrock](</docs/en/amazon-bedrock>) `ANTHROPIC_BEDROCK_MANTLE_BASE_URL`| Override the Amazon Bedrock Mantle endpoint URL. See [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>) `ANTHROPIC_BEDROCK_REGION_PREFIX`| Cross-region inference profile prefix (`us`, `eu`, `apac`, `jp`, `au`, or `global`) Claude Code tries first instead of the one derived from the AWS region. Ignored in AWS GovCloud regions. Requires Claude Code v2.1.224 or later. See [Amazon Bedrock](</docs/en/amazon-bedrock#cross-region-inference-profile-prefixes>) @@ -160,7 +159,7 @@ `ANTHROPIC_VERTEX_PROJECT_ID`| GCP project ID that Google Cloud’s Agent Platform requests are addressed to. See [Configure GCP credentials](</docs/en/google-vertex-ai#3-configure-gcp-credentials>) `ANTHROPIC_WORKSPACE_ID`| Workspace ID for [workload identity federation](<https://platform.claude.com/docs/en/manage-claude/workload-identity-federation>). Set this when your federation rule is scoped to more than one workspace so the token exchange knows which workspace to target `API_FORCE_IDLE_TIMEOUT`| Override the 5-minute body idle timeout that aborts a streaming model response when no bytes arrive. Set to `0` to turn the timeout off, for example when a slow [gateway](</docs/en/llm-gateway>) or local model pauses longer than 5 minutes between chunks, or `1` to keep it on for every provider. When unset, the timeout is active on providers other than the direct Anthropic API, [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), and Amazon Bedrock with `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK=1` set. The [stream watchdogs](</docs/en/network-config#streaming-idle-watchdogs>) run independently of it and abort a long silent pause even when you set `0` here -`API_TIMEOUT_MS`| Time in milliseconds that each API request attempt has to receive its response headers (default: 600000, or 10 minutes; maximum: 2147483647). It doesn’t limit how long a streaming response runs after that. When you set a positive value, each attempt at a [non-streaming request](</docs/en/errors#streaming-response-ended-before-any-complete-data-was-received>) has to finish within it. Increase this when requests time out on slow networks or when routing through a proxy +`API_TIMEOUT_MS`| Time in milliseconds that each API request attempt has to receive its response headers. It doesn’t limit how long a streaming response runs after that. The default is 600000, or 10 minutes, and the maximum is 2147483647. When you set a positive value, each attempt at a [non-streaming request](</docs/en/errors#streaming-response-ended-before-any-complete-data-was-received>) has to finish within it. Increase this when requests time out on slow networks or when routing through a proxy. Set to `0` to remove this limit, which requires Claude Code v2.1.305 or later. With `0`, a non-streaming attempt still times out after 300 seconds in a local session `AWS_BEARER_TOKEN_BEDROCK`| Amazon Bedrock API key for authentication (see [Amazon Bedrock API keys](<https://aws.amazon.com/blogs/machine-learning/accelerate-ai-development-with-amazon-bedrock-api-keys/>)) `BASH_DEFAULT_TIMEOUT_MS`| Default timeout for a foreground Bash or PowerShell tool command, in milliseconds (default: 120000, or 2 minutes). A value above the [default time limit for background commands](</docs/en/tools-reference#time-limit-for-background-commands>) replaces that default in unattended sessions. The background time limit requires Claude Code v2.1.285 or later `BASH_MAX_OUTPUT_LENGTH`| Maximum number of characters of bash output that Claude Code reads back into a command’s result (default: 30000; maximum: 150000). If you set the [`bashOutputMaxChars`](</docs/en/settings-reference#bashoutputmaxchars>) setting, Claude Code ignores this variable. See [Output limits](</docs/en/tools-reference#output-limits>) @@ -168,8 +167,6 @@ `BETA_TRACING_ENDPOINT`| OTLP/HTTP endpoint for [detailed beta tracing](</docs/en/monitoring-usage#traces-beta>): with `ENABLE_BETA_TRACING_DETAILED=1`, logs and traces go there instead of to the configured exporters. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) `CCR_FORCE_BUNDLE`| Set to `1` to force [`claude --cloud`](</docs/en/claude-code-on-the-web#send-local-repositories-without-github>) to bundle and upload your local repository instead of cloning from its remote `CLAUDECODE`| Set to `1` in subprocesses Claude Code spawns (Bash and PowerShell tools, tmux sessions, [hook](</docs/en/hooks>) commands, [status line](</docs/en/statusline>) commands, stdio [MCP server](</docs/en/mcp>) subprocesses). IDE extensions also set this in their integrated terminals. Use to detect when a script is running inside a subprocess spawned by Claude Code. To check whether the current process was spawned directly by a tool call or hook, rather than inside a stdio MCP server that Claude Code started, use `CLAUDE_CODE_CHILD_SESSION` instead -`CLAUDE_AFK_COUNTDOWN_MS`| How many milliseconds before auto-continue the on-screen countdown appears on an unanswered [`AskUserQuestion`](</docs/en/tools-reference>) dialog. Default `20000` (20 seconds), capped at the auto-continue timeout. Has no effect unless auto-continue is on; see the [`askUserQuestionTimeout`](</docs/en/settings-reference#askuserquestiontimeout>) setting and `CLAUDE_AFK_TIMEOUT_MS`. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). Requires Claude Code v2.1.198 or later -`CLAUDE_AFK_TIMEOUT_MS`| How many milliseconds of idle time before an unanswered [`AskUserQuestion`](</docs/en/tools-reference>) dialog auto-continues without you. Auto-continue is off by default; opt in with the [`askUserQuestionTimeout`](</docs/en/settings-reference#askuserquestiontimeout>) setting. This variable is an override for demos and automated tests: when set, it takes precedence over that setting and turns auto-continue on even when the setting is unset or `never`. Setting `0` doesn’t turn the timeout off; it closes the dialog immediately. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). Before v2.1.200, auto-continue was on by default with a `60000` (60 seconds) timeout. Requires Claude Code v2.1.198 or later `CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS`| Set to `1` to disable all built-in [subagent](</docs/en/sub-agents>) types such as Explore and Plan. Only applies in non-interactive mode (the `-p` flag). Useful for SDK users who want a blank slate. This also removes `general-purpose`, the subagent Claude Code runs when an Agent tool call omits `subagent_type`. Such a call then fails with [`subagent_type is required`](</docs/en/errors#subagent-type-is-required>) `CLAUDE_AGENT_SDK_MCP_NO_PREFIX`| Set to `1` to skip the `mcp__<server>__` prefix on tool names from SDK-created MCP servers. Tools use their original names. SDK usage only `CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS`| Stall timeout in milliseconds for subagents. Also covers [workflow agents](</docs/en/workflows#when-an-agent-stalls-and-restarts>) on Claude Code v2.1.286 or later. Default `600000` (10 minutes); if you raise `CLAUDE_STREAM_IDLE_TIMEOUT_MS` while the stream watchdog is on, the default rises with it, as [Handle slow or stalled API responses](</docs/en/agent-sdk/typescript#handle-slow-or-stalled-api-responses>) describes @@ -211,7 +208,6 @@ `CLAUDE_CODE_DEBUG_LOG_LEVEL`| Minimum log level written to the debug log file. Values: `verbose`, `debug` (default), `info`, `warn`, `error`. Set to `verbose` to include high-volume diagnostics like full status line command output, or raise to `error` to reduce noise `CLAUDE_CODE_DISABLE_1M_CONTEXT`| Set to `1` to turn off [1M context window](</docs/en/model-config#extended-context>) support. Claude Code removes `[1m]` model variants from the model picker and holds models that run with the 1M window by default to a 200K window. See [Turn off 1M context](</docs/en/model-config#turn-off-1m-context>). Useful for enterprise environments with compliance requirements. For its role in correcting the window for an unrecognized `[1m]` model ID, see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>) `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING`| Set to `1` to disable [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) on Opus 4.6 and Sonnet 4.6 and fall back to the fixed thinking budget controlled by `MAX_THINKING_TOKENS`. Has no effect on [Fable models](</docs/en/model-config#extended-thinking>), Sonnet 5 and later, Haiku 5.5, or Opus 4.7 and later, which always use adaptive reasoning -`CLAUDE_CODE_DISABLE_ADMIN_ENV_UNION`| Set to `1` to stop Claude Code from merging [managed settings](</docs/en/managed-settings#precedence-within-the-managed-tier>) `env` blocks per key across admin sources, so only the highest-priority source’s whole `env` block applies, as before v2.1.223. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.223 or later `CLAUDE_CODE_DISABLE_ADVISOR_TOOL`| Set to `1` to disable the [advisor tool](</docs/en/advisor>). The `/advisor` command becomes unavailable, any configured `advisorModel` is ignored, and the `--advisor` flag is accepted but has no effect, so existing scripts that pass it continue to work without errors `CLAUDE_CODE_DISABLE_AGENT_VIEW`| Set to `1` to turn off [background agents and agent view](</docs/en/agent-view>): `claude agents`, `--bg`, `/background`, and the on-demand supervisor. Equivalent to the [`disableAgentView`](</docs/en/settings-reference#disableagentview>) setting `CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN`| Set to `1` to disable [fullscreen rendering](</docs/en/fullscreen>) and use the classic main-screen renderer. The conversation stays in your terminal’s native scrollback so `Cmd+f` and tmux copy mode work as usual. Takes precedence over `CLAUDE_CODE_NO_FLICKER` and the [`tui`](</docs/en/settings-reference#tui>) setting. You can also switch with `/tui default`. Does not apply to background sessions opened from [agent view](</docs/en/agent-view>), which always use fullscreen rendering @@ -222,7 +218,7 @@ `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 `CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_DEFAULT`| Set to `1` to stop Claude Code from treating an [Amazon Bedrock](</docs/en/amazon-bedrock>) streaming response with a missing or empty `Content-Type` header as Amazon Bedrock’s binary event stream. By default, Claude Code assumes a gateway dropped the header from an otherwise unmodified response, so it decodes the body and streaming keeps working. Set this only for a gateway that also re-emits the stream as server-sent events; Claude Code then reads the header-less body as server-sent events instead. Requires Claude Code v2.1.239 or later `CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_GUARD`| Set to `1` to skip the check that an [Amazon Bedrock](</docs/en/amazon-bedrock>) streaming response carries the `application/vnd.amazon.eventstream` content-type. Without this variable, when a response carries a different content-type, Claude Code fails the request with an error naming that type, which means a [gateway or proxy is transforming the response](</docs/en/amazon-bedrock#streaming-errors-behind-a-gateway-or-proxy>). Configure the gateway to forward the `Content-Type` header and body unmodified rather than setting this variable. Requires Claude Code v2.1.208 or later -`CLAUDE_CODE_DISABLE_BG_EXIT_HANDOFF`| Set to `1` to stop a [background session’s](</docs/en/agent-view>) running background shell commands, dynamic workflows, and, as of v2.1.198, background subagents when the [supervisor](</docs/en/agent-view#the-supervisor-process>) stops, restarts, or updates that session’s process, instead of handing them to the session’s next process. Affects only that handoff: backgrounding a session with `←` or [`/background`](</docs/en/agent-view#from-inside-a-session>) still carries in-flight background work over, and `CLAUDE_DISABLE_ADOPT` turns off both. Requires Claude Code v2.1.196 or later +`CLAUDE_CODE_DISABLE_BG_EXIT_HANDOFF`| Set to `1` to stop a [background session’s](</docs/en/agent-view>) in-flight work when the [supervisor](</docs/en/agent-view#the-supervisor-process>) stops, restarts, or updates that session’s process, instead of handing it to the session’s next process. That work is the session’s running background shell commands and dynamic workflows, plus background subagents as of v2.1.198. Affects only that handoff: backgrounding a session with `←` or [`/background`](</docs/en/agent-view#from-inside-a-session>) still carries in-flight background work over. Requires Claude Code v2.1.196 or later `CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP`| Set to `1` to stop Claude Code from terminating [background shell commands](</docs/en/interactive-mode#background-bash-commands>) under memory pressure. By default, on macOS and Linux, Claude Code terminates background shells when the operating system reports critical memory pressure and the session has been idle for 30 minutes with no turn or subagent running. Windows has no memory-pressure signal, so this variable has no effect there. Requires Claude Code v2.1.193 or later `CLAUDE_CODE_DISABLE_BUNDLED_SKILLS`| Set to `1` to disable the [skills](</docs/en/skills>) and workflows included with Claude Code: bundled skills and workflows are removed entirely, while built-in commands like `/init` stay typable but are hidden from the model. `/doctor` stays typable like the built-in commands; hide it with `DISABLE_DOCTOR_COMMAND` instead. Skills from plugins, `.claude/skills/`, and `.claude/commands/` are unaffected. Equivalent to the [`disableBundledSkills`](</docs/en/settings-reference#disablebundledskills>) setting `CLAUDE_CODE_DISABLE_CFC_PROMPT`| Set to `1` to keep the [Claude in Chrome](</docs/en/chrome>) browser tools available while omitting the Chrome section of the system prompt and the `/claude-in-chrome` [bundled skill](</docs/en/skills#bundled-skills>). For hosts that embed Claude Code and supply their own browser guidance. Requires Claude Code v2.1.257 or later @@ -281,7 +277,7 @@ `CLAUDE_CODE_FORCE_SESSION_PERSISTENCE`| Set to `1` to force transcript persistence, prompt history, and `claude agents` registration even when this `claude` was launched from inside another Claude Code session. Use when an inherited `CLAUDE_CODE_CHILD_SESSION` value, for example from a `screen` session or a background launcher first started by Claude Code’s Bash tool, causes a genuine top-level session to be misclassified as nested. As of v2.1.178, Claude Code detects the tmux case automatically and ignores the inherited marker, so tmux no longer needs this variable. Also honored on v2.1.169 and earlier; has no effect on v2.1.170 and v2.1.171, where the nested-session detection it overrides was removed `CLAUDE_CODE_FORCE_STRIKETHROUGH`| Set to `1` to force strikethrough rendering for `~~text~~` in Claude’s responses when your terminal supports it but is not auto-detected, such as over SSH without `TERM_PROGRAM` forwarded. Without this, undetected terminals show the literal `~~` markers instead of rendering the text as strikethrough. Requires Claude Code v2.1.186 or later `CLAUDE_CODE_FORCE_SYNC_OUTPUT`| Set to `1` to force-enable DEC private mode 2026 [synchronized output](<https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036>) when your terminal supports it but is not auto-detected. Useful for emulators such as Emacs `eat` that implement BSU/ESU but do not reply to the capability probe. Has no effect under tmux. Unlike `CLAUDE_CODE_NO_FLICKER`, which switches to [fullscreen rendering](</docs/en/fullscreen>), this doesn’t change the renderer -`CLAUDE_CODE_FORCE_TERMINAL_IMAGES`| Set to `1` to draw [mod `Image` elements](</docs/en/plugins/mods/reference#elements>) as pictures when your terminal draws kitty graphics protocol images with Unicode placeholders but is not auto-detected. See [which terminals Claude Code detects](</docs/en/plugins/mods/gallery#image-and-client>) and why it doesn’t help inside tmux or screen +`CLAUDE_CODE_FORCE_TERMINAL_IMAGES`| Set to `1` to draw [mod `Image` elements](</docs/en/plugins/mods/reference#elements>) as pictures when your terminal draws kitty graphics protocol images with Unicode placeholders and you still see an `Image`’s dimmed `alt` text. See [which terminals draw an `Image`](</docs/en/plugins/mods/gallery#image-and-client>) and why this variable doesn’t help inside tmux or screen `CLAUDE_CODE_FORK_SUBAGENT`| Controls fork mode, which is on by default and lets Claude start [forks](</docs/en/sub-agents#fork-the-current-conversation>) on its own. While fork mode is on, Claude also can’t [wait for a subagent](</docs/en/sub-agents#run-subagents-in-foreground-or-background>) in interactive terminal, VS Code, or desktop sessions on your machine. Set to `0` to turn fork mode off. For versions, see [Turn fork mode off](</docs/en/sub-agents#turn-fork-mode-on-or-off>) `CLAUDE_CODE_FORWARD_SUBAGENT_TEXT`| Set to `1` to emit [subagent](</docs/en/sub-agents>) text and thinking blocks in `claude -p --output-format stream-json` output, the same behavior as the [`--forward-subagent-text`](</docs/en/cli-reference#cli-flags>) flag. Use the variable when a harness invokes `claude` and can’t pass the flag itself. Unlike the flag, which exits with an error outside non-interactive mode with stream-json output, the variable is ignored there so that nested invocations keep working when it’s set process-wide. Requires Claude Code v2.1.211 or later `CLAUDE_CODE_GATEWAY_HINT_HEADERS`| Set to `1` to send the [gateway hint headers](</docs/en/llm-gateway-protocol#gateway-hint-headers>), such as `x-claude-code-request-class` and `x-claude-code-compaction`, on a custom proxy or a third-party provider such as Amazon Bedrock or Claude Platform on AWS. Set to `0` to stop sending them on every connection, including a direct connection to the Anthropic API, where Claude Code sends them by default. Requires Claude Code v2.1.273 or later @@ -301,15 +297,14 @@ `CLAUDE_CODE_MAX_CONTEXT_TOKENS`| Override the context window size Claude Code assumes for the active model. As of v2.1.193, how it applies depends on how Claude Code resolves the model ID; see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>). Use this when routing to a model through `ANTHROPIC_BASE_URL` whose context window does not match the built-in size for its name `CLAUDE_CODE_MAX_MCP_DESCRIPTION_LENGTH`| Maximum length in characters of MCP tool descriptions and MCP server instructions that Claude Code sends to the model. The value you set replaces both [default limits](</docs/en/mcp#for-mcp-server-authors>): 4096, and 16384 for the description of a tool that Claude loads through tool search. Accepts a positive whole number in plain digits. Anything else is ignored and the defaults apply. Requires Claude Code v2.1.280 or later `CLAUDE_CODE_MAX_OUTPUT_TOKENS`| Set the maximum number of output tokens for most requests. Defaults and caps vary by model; see [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>). Claude Code lowers a value above a model’s cap to the cap. For a model ID Claude Code can’t resolve to a model it knows, the default is 32000 and the cap is 128000. Increasing this value reduces the effective context window available before [auto-compaction](</docs/en/costs#reduce-token-usage>) triggers -`CLAUDE_CODE_MAX_RETRIES`| Override the number of times to retry failed API requests (default: 10). Capped at 15 as of v2.1.186; as of v2.1.199, `CLAUDE_CODE_RETRY_WATCHDOG` raises the default and removes the cap. For unattended sessions that need to wait through longer outages, set `CLAUDE_CODE_RETRY_WATCHDOG` instead +`CLAUDE_CODE_MAX_RETRIES`| Override the number of times to retry failed API requests (default: 10). Retrying can stop earlier on `529` overloaded errors. For example, with an API key on an Opus model, it stops at the third `529` and shows [Repeated 529 Overloaded errors](</docs/en/errors#api-error-repeated-529-overloaded-errors>). If you set a [fallback model](</docs/en/settings-reference#fallbackmodel>), Claude Code switches to that model rather than showing the error. Capped at 15 as of v2.1.186; as of v2.1.199, `CLAUDE_CODE_RETRY_WATCHDOG` raises the default and removes the cap. For unattended sessions that need to wait through longer outages, set `CLAUDE_CODE_RETRY_WATCHDOG` instead `CLAUDE_CODE_MAX_SUBAGENTS_PER_SESSION`| Removed in v2.1.224 and now a no-op. Previously capped the total number of [subagents](</docs/en/sub-agents>) Claude could spawn with the Agent tool in one session (default: 200); spawning past the cap failed with `Subagent spawn limit reached`. The [concurrent subagent limit](</docs/en/sub-agents#concurrent-subagent-limit>) and the [depth limit](</docs/en/sub-agents#let-subagents-spawn-their-own-subagents>) still apply `CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH`| Number of [subagent layers](</docs/en/sub-agents#let-subagents-spawn-their-own-subagents>) allowed below the main conversation (default: 3). At the default, subagents can spawn their own subagents, and a subagent at the third layer can’t spawn further; set `1` to turn nesting off. In v2.1.217 through v2.1.218, the default was 1, so a subagent couldn’t spawn its own unless you raised the limit; v2.1.219 raised the default to 3. Accepts a positive whole number in plain digits; anything else is ignored, so the limit can be adjusted but not removed. Requires Claude Code v2.1.217 or later -`CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY`| Maximum number of read-only tools and subagents that can execute in parallel (default: 10). Higher values increase parallelism but consume more resources `CLAUDE_CODE_MAX_TURNS`| Cap the number of agentic turns when no explicit limit is passed. Equivalent to passing [`--max-turns`](</docs/en/cli-reference#cli-flags>), which takes precedence when both are set. A value that is not a positive integer is rejected at startup with an error rather than treated as no cap `CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSION`| Cap on [WebSearch](</docs/en/tools-reference#session-search-limit>) calls (default: 200). When Claude reaches the cap, further WebSearch calls return a notice telling it to continue with the information it already gathered and say so in its answer. Accepts a positive whole number with no upper bound. Anything else is ignored and the default applies, so the cap can be raised but not turned off. Requires Claude Code v2.1.212 or later `CLAUDE_CODE_MCP_ALLOWLIST_ENV`| Set to `1` to spawn stdio MCP servers with only a safe baseline environment plus the server’s configured `env`, instead of inheriting your shell environment `CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS`| Elapsed time in milliseconds before a still-running MCP tool call [moves to a background task](</docs/en/mcp#automatic-backgrounding-of-long-tool-calls>) (default: 120000, or 2 minutes). Set to `0` to turn automatic backgrounding off. Requires Claude Code v2.1.212 or later -`CLAUDE_CODE_MCP_STARTUP_WAIT_MS`| How long in milliseconds the first turn of a [non-interactive](</docs/en/headless>) session waits for MCP servers that are still connecting, in place of the default [first-turn wait](</docs/en/agent-sdk/mcp#connection-timing>). When set, the wait covers every pending server; in a [self-hosted environment](</docs/en/self-hosted-environments-configuration#connection-timing>), it changes only how long the wait lasts. Set to `0` to skip the wait. A [`--permission-prompt-tool`](</docs/en/cli-reference#cli-flags>) server keeps its own `MCP_TIMEOUT` wait regardless of the value. Requires Claude Code v2.1.274 or later +`CLAUDE_CODE_MCP_STARTUP_WAIT_MS`| How long in milliseconds the first turn of a [non-interactive](</docs/en/headless>) session waits for MCP servers that are still connecting, in place of the default [first-turn wait](</docs/en/agent-sdk/mcp#connection-timing>). In a [self-hosted environment](</docs/en/self-hosted-environments-configuration#connection-timing>), it changes only how long the wait lasts. Some servers keep a wait of their own regardless of the value; [Connection timing](</docs/en/agent-sdk/mcp#connection-timing>) lists them. Set to `0` to skip the wait for every other server. Requires Claude Code v2.1.274 or later `CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT`| Idle timeout in milliseconds for MCP tool calls. When a stdio, HTTP, SSE, WebSocket, or [claude.ai connector](</docs/en/mcp#use-mcp-servers-from-claude-ai>) MCP server sends no response and no progress notification for this long, the tool call aborts with an error instead of waiting for the overall `MCP_TOOL_TIMEOUT`. Overrides the per-transport defaults of 300000 (5 minutes) for network servers and 1800000 (30 minutes) for stdio servers. Set to `0` to disable the idle check. Values below 1000 are raised to one second, and the value is capped at the effective `MCP_TOOL_TIMEOUT`. A per-server `timeout` in `.mcp.json` of at least 1000 raises that server’s idle window to at least the `timeout` value. Doesn’t apply to IDE servers or SDK in-process servers. Requires Claude Code v2.1.187 or later. Before v2.1.203, stdio servers were exempt from the idle timeout `CLAUDE_CODE_MESSAGING_SOCKET`| Set by Claude Code, not by you: in sessions that bind an [inbox socket](</docs/en/cross-session-messaging#the-sessions-inbox-socket>), Claude Code exports that socket’s path to hooks and Bash commands when it binds the socket. In a session that starts with messaging on, Claude Code binds the socket before any hook runs. Other sessions on the machine deliver messages to this path. Each session exports its own socket rather than one inherited from a parent, and messages arriving on it go through the session’s [inbound controls](</docs/en/cross-session-messaging#control-inbound-messages>). Settings `env` blocks can’t set it. Requires Claude Code v2.1.224 or later `CLAUDE_CODE_MESSAGING_TOKEN`| Set by Claude Code, not by you: in sessions that bind an [inbox socket](</docs/en/cross-session-messaging#the-sessions-inbox-socket>), Claude Code exports this per-session token to hooks and Bash commands alongside `CLAUDE_CODE_MESSAGING_SOCKET`. A script posting to the socket can send `{"type":"auth","token":"<token>"}` as its first line to prove it belongs to the session. On native Windows, Claude Code requires this line and closes any connection that doesn’t open with a valid one. The [own-child rules](</docs/en/cross-session-messaging#the-sessions-inbox-socket>) say when Claude Code consults the token. Each session exports its own token, never one inherited from a parent session. Settings `env` blocks can’t set it. Requires Claude Code v2.1.228 or later @@ -354,6 +349,7 @@ `CLAUDE_CODE_RESUME_PROMPT`| Override the continuation message Claude Code sends to Claude when `CLAUDE_CODE_RESUME_INTERRUPTED_TURN` continues an interrupted turn instead of resending its prompt, or when you resume a [deferred tool call](</docs/en/hooks#defer-a-tool-call-for-later>) with `-p`. Defaults to `Continue from where you left off.`. An empty string uses the default `CLAUDE_CODE_RETRY_WATCHDOG`| Set to `1` for unattended sessions such as eval harnesses, CI jobs, or remote workers. Retries `429` and `529` capacity errors indefinitely instead of failing after `CLAUDE_CODE_MAX_RETRIES` attempts. Claude Code fails at once when a standard-speed request gets a `429` that reports a spend limit or exhausted usage credits, even one from a [gateway spend cap](</docs/en/errors#spend-limit-reached>) that resets on a schedule. Before v2.1.239, the watchdog retried these indefinitely. For fast mode requests, see [Handle rate limits](</docs/en/fast-mode#handle-rate-limits>). The watchdog backs off up to 5 minutes between attempts, or until the limit resets when the response carries a rate-limit reset time, so a session that hits a usage limit waits out the remaining window. On v2.1.199 or later it also raises the default retry count for other transient errors, such as server errors, timeouts, and dropped connections, to 300, roughly three hours of backoff, and removes the cap of 15 on `CLAUDE_CODE_MAX_RETRIES` if you set that variable explicitly. Requires Claude Code v2.1.186 or later `CLAUDE_CODE_RETRY_WATCHDOG_MAX_WAIT_MS`| Maximum time in milliseconds that each API request spends waiting out `429` and `529` errors when `CLAUDE_CODE_RETRY_WATCHDOG` is set. Once that time is spent, the next such error ends the request. Give a positive whole number in plain digits, such as `1800000` for 30 minutes. When unset, the wait has no limit. Requires Claude Code v2.1.295 or later +`CLAUDE_CODE_RETRY_WATCHDOG_USAGE_LIMIT_RECHECK_MS`| Minimum interval in milliseconds between checks of whether a [usage limit](</docs/en/errors#youve-hit-your-session-limit>) was already lifted, while a request waits for that limit to reset with `CLAUDE_CODE_RETRY_WATCHDOG` set. When a check finds the limit lifted, the request goes out at once. Give a whole number in plain digits from `60000`, one minute, to `10800000`, three hours. Checks are made only for a claude.ai subscription’s session or weekly limit while usage credits aren’t in use, and not while `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` is set. When this variable is unset or its value is outside that range, no checks are made. Requires Claude Code v2.1.305 or later `CLAUDE_CODE_SAFE_MODE`| Set to `1` to start in safe mode: CLAUDE.md, skills, plugins, hooks, MCP servers, custom commands and agents, output styles, workflows, custom themes, custom keybindings, status line and file-suggestion commands, LSP servers, and auto memory do not load, for troubleshooting a broken configuration. Managed settings policy still applies, including policy-configured hooks, status line, and file-suggestion commands; managed plugins, managed skills, managed CLAUDE.md, and policy-configured MCP servers do not. Equivalent to passing [`--safe-mode`](</docs/en/cli-reference#cli-flags>). Directly spawned child processes inherit the variable `CLAUDE_CODE_SCRIPT_CAPS`| JSON object limiting how many times specific scripts may be invoked per session when `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB` is set. Keys are substrings matched against the command text; values are integer call limits. For example, `{"deploy.sh": 2}` allows `deploy.sh` to be called at most twice. Matching is substring-based so shell-expansion tricks like `./scripts/deploy.sh $(evil)` still count against the cap. Runtime fan-out via `xargs` or `find -exec` is not detected; this is a defense-in-depth control `CLAUDE_CODE_SCROLL_SPEED`| Set the mouse wheel scroll multiplier in [fullscreen rendering](</docs/en/fullscreen#mouse-wheel-scrolling>). Accepts any positive value up to 20, including fractional values below 1 such as `0.5` to slow accelerated trackpad and wheel scrolling in terminals that already amplify wheel events. Set to `3` to match `vim` if your terminal sends one wheel event per notch without amplification. Ignored in the JetBrains IDE terminal, where Claude Code uses its own scroll handling @@ -387,7 +383,6 @@ `CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS`| Timeout in milliseconds for the first query to wait for the initial skill list when `CLAUDE_CODE_SYNC_SKILLS` is set (default: 5000). When exceeded, the first query runs with whichever skills have arrived. The downloads finish in the background either way, and Claude waits for a skill’s download when it invokes that skill `CLAUDE_CODE_SYNTAX_HIGHLIGHT`| Set to `false` to disable syntax highlighting in diff output. Useful when colors interfere with your terminal setup. To also disable highlighting in code blocks and file previews, use the [`syntaxHighlightingDisabled`](</docs/en/settings-reference#syntaxhighlightingdisabled>) setting `CLAUDE_CODE_TASK_LIST_ID`| Share a task list across sessions. Set the same ID in multiple Claude Code instances to coordinate on a shared task list, in [sessions that have the Task tools](</docs/en/tools-reference#task-tool-availability>). See [Task list](</docs/en/interactive-mode#task-list>) -`CLAUDE_CODE_TEAM_TEARDOWN_PARK_TIMEOUT_MS`| Override, in milliseconds, how long a non-interactive session waits at exit for its [agent team](</docs/en/agent-teams>) to finish tearing down. Accepts 1000 to 60000; an out-of-range value is ignored and the default of 10000 applies. Requires Claude Code v2.1.206 or later `CLAUDE_CODE_TMPDIR`| Override the temp directory used for internal temp files. Claude Code appends `/claude-{uid}/` to this path on Unix, or `/claude/` on Windows. Default: `/tmp` on macOS, `os.tmpdir()` on Linux and Windows. On macOS and Linux, [sandboxed](</docs/en/sandboxing>) Bash subprocesses receive a short fallback `$TMPDIR` under the system default when your override is a long path, since some tools fail when temp paths get too long. Unsandboxed Bash commands inherit your shell’s `$TMPDIR` when it is set. On native Windows, when your shell doesn’t set `$TMPDIR`, a Bash command that references `$TMPDIR` receives your override, or `%TEMP%` when you haven’t set one. Claude Code’s own temp files always use your override. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) `CLAUDE_CODE_TMUX_TRUECOLOR`| Set to any non-empty value, such as `1`, to allow 24-bit truecolor output inside tmux. **Setting it to`0` or `false` still allows truecolor**, unlike most on/off variables; unset the variable to restore the 256-color clamp. By default, Claude Code clamps to 256 colors when `$TMUX` is set because tmux does not pass through truecolor escape sequences unless configured to. Set this after adding `set -ga terminal-overrides ',*:Tc'` to your `~/.tmux.conf`. See [Terminal configuration](</docs/en/terminal-config>) for other tmux settings `CLAUDE_CODE_TOOL_MEMORY_CGROUP_EXCLUDE`| On Linux and WSL, set to a comma-separated list of the kinds of processes Claude Code [excludes from the tool memory cap](</docs/en/tools-reference#memory-limit-on-linux-and-wsl>), such as `mcp` or `lsp`. Set `none` to cap every kind, or `all-new` to cap only Bash, PowerShell, and Monitor tool commands. Claude Code keeps Bash, PowerShell, and Monitor tool commands under the cap whatever you list. Requires Claude Code v2.1.246 or later @@ -398,7 +393,6 @@ `CLAUDE_CODE_USE_BEDROCK`| Use [Amazon Bedrock](</docs/en/amazon-bedrock>) `CLAUDE_CODE_USE_FOUNDRY`| Use [Microsoft Foundry](</docs/en/microsoft-foundry>) `CLAUDE_CODE_USE_MANTLE`| Use the Amazon Bedrock [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>) -`CLAUDE_CODE_USE_NATIVE_FILE_SEARCH`| Set to `1` to discover custom commands, subagents, and output styles using Node.js file APIs instead of ripgrep. Set this if the bundled ripgrep binary is unavailable or blocked in your environment. Does not affect the Grep or file search tools `CLAUDE_CODE_USE_POWERSHELL_TOOL`| Controls the PowerShell tool. On Windows without Git Bash, the tool is enabled automatically; set to `0` to disable it. On Windows with Git Bash installed, the tool is on by default for claude.ai and Console accounts; set to `1` to enable it in Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry sessions, or `0` to turn it off. On Linux, macOS, and WSL, set to `1` to enable it, which requires `pwsh` on your `PATH`. When enabled on Windows, Claude can run PowerShell commands natively instead of routing through Git Bash. See [PowerShell tool](</docs/en/tools-reference#powershell-tool>) `CLAUDE_CODE_USE_VERTEX`| Use [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>) `CLAUDE_CODE_WEBFETCH_CACHE_TTL_MS`| Set to the number of milliseconds [WebFetch](</docs/en/tools-reference#webfetch-tool-behavior>) keeps each fetched URL’s response cached. The default is `900000`, which is 15 minutes. Takes plain digits only; `0`, a decimal, or any other spelling keeps the default. Claude Code reads the value once per launch, so a change in a settings `env` block applies when you next launch `claude`. Requires Claude Code v2.1.233 or later @@ -409,7 +403,6 @@ `CLAUDE_CODE_WORKFLOW_PREFIX_STAGGER_MS`| Upper bound in milliseconds on how long a [workflow](</docs/en/workflows>) agent waits for a same-prefix sibling’s first response to begin before sending its own first request. When a fan-out starts several agents that share a [prompt-cache prefix](</docs/en/workflows#prompt-caching-in-a-fan-out>), Claude Code holds all but the first agent for up to this long so the rest read the cached prefix instead of each processing it uncached. Default `5000`. Set to `0` to disable the wait. When `DISABLE_PROMPT_CACHING` is set, agents never wait. Requires Claude Code v2.1.229 or later `CLAUDE_CODE_YOU_SHOULD_KNOW_DEBUG`| Set to `1` to show, above the prompt, a line for each of the last three checks the [You should know mod](</docs/en/interactive-mode#you-should-know-suggestions>) made in this session. Use it to confirm the mod is checking when no notes appear. Requires Claude Code v2.1.287 or later `CLAUDE_CONFIG_DIR`| Override the configuration directory (default: `~/.claude`). All settings, session history, and plugins are stored under this path. For credentials, see [where Claude Code stores credentials](</docs/en/authentication#credential-management>). Useful for running multiple accounts side by side: for example, `alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'`. Set it in your shell, user settings, or managed settings. In a settings file, write the absolute path. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) -`CLAUDE_DISABLE_ADOPT`| Set to `1` to stop in-flight background work instead of carrying it over when you background a session by pressing `←` or with [`/background`](</docs/en/agent-view#from-inside-a-session>). Claude Code asks you to confirm before backgrounding, then stops the tasks that would otherwise carry over. Requires Claude Code v2.1.195 or later `CLAUDE_EFFORT`| Set automatically in Bash tool subprocesses and hook commands to the [effort level](</docs/en/model-config#adjust-effort-level>) in effect when the subprocess starts: `low`, `medium`, `high`, `xhigh`, or `max`. Matches the `effort.level` field passed to [hooks](</docs/en/hooks>). Only set when the current model supports the effort parameter `CLAUDE_ENABLE_BYTE_WATCHDOG`| Set to `1` to force-enable the byte-level streaming idle watchdog, or set to `0` to force-disable it. `0` also turns off the [first-byte deadline](</docs/en/network-config#streaming-idle-watchdogs>) on the connections where that deadline runs. When unset, the watchdog is enabled by default for direct Anthropic API and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) connections, and for streaming responses on [gateway](</docs/en/gateways>) connections reached through `ANTHROPIC_BASE_URL` or `ANTHROPIC_AWS_BASE_URL`; before v2.1.222 it didn’t run on those gateway connections, so the event-level watchdog could report a stall there even while keep-alive pings were arriving. For timeouts and how the timers interact, see [Streaming idle watchdogs](</docs/en/network-config#streaming-idle-watchdogs>) `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK`| Set to `1` to enable the byte-level streaming idle watchdog on Amazon Bedrock `vnd.amazon.eventstream` responses, which also enables the [first-byte deadline](</docs/en/network-config#streaming-idle-watchdogs>) on Bedrock streaming requests. Off by default. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS` @@ -447,10 +440,9 @@ `DO_NOT_TRACK`| Set to `1` to opt out of telemetry, with the same effect as `DISABLE_TELEMETRY`, including on feature-flag fetching. Claude Code reads this variable as a standard boolean, so `0` leaves telemetry on, and honors it as the cross-tool convention recognized by many developer CLIs `ENABLE_BETA_TRACING_DETAILED`| Set to `1`, and set `BETA_TRACING_ENDPOINT` to your OTLP/HTTP collector endpoint, to turn on [detailed beta tracing](</docs/en/monitoring-usage#traces-beta>), which adds content-bearing span attributes and the `claude_code.hook` span. Interactive CLI sessions also require your organization to be allowlisted for the beta. Both variables are ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) `ENABLE_CLAUDEAI_MCP_SERVERS`| Set to `false` to stop Claude Code from fetching [claude.ai MCP servers](</docs/en/mcp#use-mcp-servers-from-claude-ai>). Enabled by default for logged-in users. To disable per-project or per-org, set [`disableClaudeAiConnectors`](</docs/en/settings-reference#disableclaudeaiconnectors>) in settings instead -`ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) instead of the default 5 minutes. Intended for API key, [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), [Microsoft Foundry](</docs/en/microsoft-foundry>), and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) users. Subscription users within included usage receive the 1-hour TTL automatically on the [main conversation](</docs/en/prompt-caching#which-ttl-each-request-gets>). Subscription users drawing on [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>) can set it to keep the 1-hour TTL. 1-hour cache writes are billed at a higher rate. To choose the TTL per request bucket instead, use `CLAUDE_CODE_PROMPT_CACHE_TTL` and `CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL`, which take precedence over this variable +`ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) instead of the default 5 minutes. Intended for API key, [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), [Microsoft Foundry](</docs/en/microsoft-foundry>), and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) users. For subscription users within included usage, Claude Code requests the 1-hour TTL automatically on the [main conversation](</docs/en/prompt-caching#which-ttl-each-request-gets>). Subscription users drawing on [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>) can set it to keep the 1-hour TTL. 1-hour cache writes are billed at a higher rate. To choose the TTL separately for the main conversation and for requests outside it, use `CLAUDE_CODE_PROMPT_CACHE_TTL` and `CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL`, which take precedence over this variable `ENABLE_PROMPT_CACHING_1H_BEDROCK`| Deprecated. Use `ENABLE_PROMPT_CACHING_1H` instead -`ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset, Claude Code defers all MCP tools by default, and loads them upfront instead when `ANTHROPIC_BASE_URL` points to a non-first-party host. `true` keeps them deferred on such a host too. `auto` loads upfront when tool definitions fit within 10% of context. `auto:N` sets a custom threshold, such as `auto:5` for 5%. `false` loads all tools upfront. For the models and deployments that load every tool upfront whatever this value is, see [Configure tool search](</docs/en/mcp#configure-tool-search>) -`FALLBACK_FOR_ALL_PRIMARY_MODELS`| Set to any non-empty value, such as `1`, to make Claude Code stop retrying on repeated overload errors for every model when no fallback model is configured. **Setting it to`0` or `false` still enables this**, unlike most on/off variables; unset the variable to restore the default retry behavior. Without it, Claude Code stops retrying this way on models it recognizes as Opus, Fable, or Mythos models when you authenticate with an API key or a [third-party provider](</docs/en/third-party-integrations>) rather than a Claude subscription. On Claude Code v2.1.160 or later, Claude Code switches to your configured [fallback model chain](</docs/en/model-config#fallback-model-chains>) on repeated overload errors for any primary model, so this variable doesn’t affect switching to a fallback model +`ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset or `true` defers MCP tools, except in the [cases that keep tool search off](</docs/en/mcp#configure-tool-search>). `auto` turns tool search on once definitions reach 10% of the context window. `auto:N` sets a custom threshold, such as `auto:5` for 5%. `false` loads all tools upfront. If a gateway rejects tool search, see [Tool search through an LLM gateway](</docs/en/mcp#tool-search-through-a-gateway>) `FORCE_AUTOUPDATE_PLUGINS`| Set to `1` to force plugin auto-updates even when the main auto-updater is disabled via `DISABLE_AUTOUPDATER` `FORCE_HYPERLINK`| Set to `1` to enable clickable OSC 8 hyperlinks when your terminal supports them but isn’t auto-detected, or `0` to disable them. When unset, Claude Code enables hyperlinks only when it detects terminal support. Claude Code parses this value as a number, not a Boolean, so a value such as `false`, `no`, or `off` enables hyperlinks rather than disabling them. The footer [PR or merge request badge](</docs/en/interactive-mode#pr-review-status>) renders as a hyperlink even when Claude Code can’t detect terminal support, such as over SSH. Set `0` to render the badge as plain text `FORCE_PROMPT_CACHING_5M`| Set to `1` to force the 5-minute prompt cache TTL even when 1-hour TTL would otherwise apply. Overrides `CLAUDE_CODE_PROMPT_CACHE_TTL`, `CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL`, `ENABLE_PROMPT_CACHING_1H`, and the `promptCacheTtl` and `subagentPromptCacheTtl` settings @@ -550,7 +542,6 @@ With fetching off, you can’t: - * Run [`/auto-mode-setup`](</docs/en/auto-mode-config#generate-environment-entries>) to draft `autoMode.environment` entries * Use [Remote Control](</docs/en/remote-control>) with `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` or `DISABLE_GROWTHBOOK` set. For `DISABLE_TELEMETRY` and `DO_NOT_TRACK`, see the [Remote Control requirements](</docs/en/remote-control#requirements>) * [Message sessions beyond this machine](</docs/en/cross-session-messaging#message-sessions-on-other-machines>) when [Remote Control](</docs/en/remote-control#requirements>) is unavailable. Messaging between sessions on this machine works with fetching off * Run [`claude import` or the `/import` command](</docs/en/cli-reference#cli-commands>)
modified
--- a/env-vars.md +++ b/env-vars.md @@ -160,7 +160,7 @@ `ANTHROPIC_VERTEX_PROJECT_ID`| GCP project ID that Google Cloud’s Agent Platform requests are addressed to. See [Configure GCP credentials](</docs/en/google-vertex-ai#3-configure-gcp-credentials>) `ANTHROPIC_WORKSPACE_ID`| Workspace ID for [workload identity federation](<https://platform.claude.com/docs/en/manage-claude/workload-identity-federation>). Set this when your federation rule is scoped to more than one workspace so the token exchange knows which workspace to target `API_FORCE_IDLE_TIMEOUT`| Override the 5-minute body idle timeout that aborts a streaming model response when no bytes arrive. Set to `0` to turn the timeout off, for example when a slow [gateway](</docs/en/llm-gateway>) or local model pauses longer than 5 minutes between chunks, or `1` to keep it on for every provider. When unset, the timeout is active on providers other than the direct Anthropic API, [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), and Amazon Bedrock with `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK=1` set. The [stream watchdogs](</docs/en/network-config#streaming-idle-watchdogs>) run independently of it and abort a long silent pause even when you set `0` here -`API_TIMEOUT_MS`| Timeout for API requests in milliseconds (default: 600000, or 10 minutes; maximum: 2147483647). A streaming request has to receive its response headers within it. Increase this when requests time out on slow networks or when routing through a proxy +`API_TIMEOUT_MS`| Time in milliseconds that each API request attempt has to receive its response headers (default: 600000, or 10 minutes; maximum: 2147483647). It doesn’t limit how long a streaming response runs after that. When you set a positive value, each attempt at a [non-streaming request](</docs/en/errors#streaming-response-ended-before-any-complete-data-was-received>) has to finish within it. Increase this when requests time out on slow networks or when routing through a proxy `AWS_BEARER_TOKEN_BEDROCK`| Amazon Bedrock API key for authentication (see [Amazon Bedrock API keys](<https://aws.amazon.com/blogs/machine-learning/accelerate-ai-development-with-amazon-bedrock-api-keys/>)) `BASH_DEFAULT_TIMEOUT_MS`| Default timeout for a foreground Bash or PowerShell tool command, in milliseconds (default: 120000, or 2 minutes). A value above the [default time limit for background commands](</docs/en/tools-reference#time-limit-for-background-commands>) replaces that default in unattended sessions. The background time limit requires Claude Code v2.1.285 or later `BASH_MAX_OUTPUT_LENGTH`| Maximum number of characters of bash output that Claude Code reads back into a command’s result (default: 30000; maximum: 150000). If you set the [`bashOutputMaxChars`](</docs/en/settings-reference#bashoutputmaxchars>) setting, Claude Code ignores this variable. See [Output limits](</docs/en/tools-reference#output-limits>) @@ -192,8 +192,9 @@ `CLAUDE_CODE_ARTIFACT_PUBLISH_EDITS`| Set to `0` to stop Claude from applying small changes to an [artifact’s](</docs/en/artifacts#update-an-artifact>) file as part of publishing it. Claude then edits the file with its file-editing tools and publishes it as a separate step. Requires Claude Code v2.1.300 or later `CLAUDE_CODE_ATTRIBUTION_HEADER`| Set to `0` to omit the [attribution block](</docs/en/llm-gateway-protocol#system-prompt-attribution-block>), which carries the client version and a prompt fingerprint, from the start of the system prompt. Caching on a direct connection to the Anthropic API is unaffected either way. In some direct-connection setups, Claude Code keeps the block on [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) classifier requests even when you set `0`. In [System prompt attribution block](</docs/en/llm-gateway-protocol#system-prompt-attribution-block>), check which connections and credentials this covers. Before v2.1.181 the block included a per-request token on custom base URLs and Microsoft Foundry connections, so on those versions set it to `0` when your LLM gateway caches on the request body or forwards requests to a third-party provider, or when you connect to Microsoft Foundry directly `CLAUDE_CODE_AUTO_BACKGROUND_WORKER_CHECKIN_SECONDS`| Removed in v2.1.283. Use `CLAUDE_CODE_WORKER_CHECKIN_SCHEDULE` instead -`CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the [auto-compact window](</docs/en/model-config#set-the-auto-compact-window>) in tokens, from `100000` to `1000000`. Accepts a plain integer such as `500000` only: a value like `500k` reads as `500` and clamps to the 100K minimum. The effective window is also capped at the model’s context window. Takes precedence over the `/autocompact` command, the `--autocompact` flag, and the `autoCompactWindow` setting. The status line’s `used_percentage` always measures against the model’s full context window, so once this variable is set, that percentage no longer indicates when compaction will run +`CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the auto-compact window, how full the context gets before compaction, from `100000` to `1000000` tokens. Suffixed values such as `200k` require v2.1.304 or later. For precedence over the other ways to set the window and the effect on the status line’s `used_percentage`, see [Set the auto-compact window](</docs/en/model-config#set-the-auto-compact-window>) `CLAUDE_CODE_AUTO_CONNECT_IDE`| Override automatic [IDE connection](</docs/en/vs-code>). By default, Claude Code connects automatically when launched inside a supported IDE’s integrated terminal. Set to `false` to prevent this. Set to `true` to force a connection attempt when auto-detection fails, such as when tmux obscures the parent terminal. Takes precedence over the [`autoConnectIde`](</docs/en/settings-reference#autoconnectide>) global config setting +`CLAUDE_CODE_AUTO_MODE_MODEL`| Sets the model for the classifier requests Claude Code sends in [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>). Use a full model ID such as `claude-sonnet-4-6`. For the cases where Claude Code ignores it, see [Choose the classifier model](</docs/en/permission-modes#choose-the-classifier-model>). Requires Claude Code v2.1.302 or later `CLAUDE_CODE_AUTO_MODE_SERVER`| Controls whether Claude Code asks the server to [review auto mode actions](</docs/en/permission-modes#server-side-classifier-review>). Set to `0` to use Claude Code’s own classifier requests instead. On a direct connection to the Anthropic API, requires v2.1.281 or later. The linked section lists which sessions ask the server when the variable is unset, and from which version. Requires Claude Code v2.1.271 or later `CLAUDE_CODE_AWS_CHAIN_RESOLVE_TIMEOUT_MS`| Time in milliseconds Claude Code waits for the AWS default credential provider chain to produce credentials before the request fails with [`AWS default-chain credential resolve timed out`](</docs/en/errors#aws-default-chain-credential-resolve-timed-out>) (default: `60000`). Raise it when a step in your chain legitimately needs longer, such as a browser-based SSO sign-in with MFA through a wrapper like `aws-vault`. Applies on Amazon Bedrock, [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), and the [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>). See [credential caching and resolution timeout](</docs/en/amazon-bedrock#credential-caching-and-resolution-timeout>). Requires Claude Code v2.1.207 or later `CLAUDE_CODE_BASH_EDIT_DIFF`| Set to `0` to turn off the [diff of the files that changed while a Bash command ran](</docs/en/hooks#bash>), or `1` to record it in every permission mode. Takes precedence over the [`bashEditDiffEnabled`](</docs/en/settings-reference#basheditdiffenabled>) setting. Requires Claude Code v2.1.269 or later @@ -205,7 +206,7 @@ `CLAUDE_CODE_CLIENT_CERT`| Path to client certificate file for mTLS authentication `CLAUDE_CODE_CLIENT_KEY`| Path to client private key file for mTLS authentication `CLAUDE_CODE_CLIENT_KEY_PASSPHRASE`| Passphrase for encrypted CLAUDE_CODE_CLIENT_KEY (optional) -`CLAUDE_CODE_CONNECT_TIMEOUT_MS`| Removed in v2.1.186 and now a no-op. Previously set a separate timeout for the connect, TLS, and response-header phase of a streaming API request. Use `API_TIMEOUT_MS` for the per-request timeout. For the response-header phase of a streaming request, see `CLAUDE_STREAM_FIRST_BYTE_TIMEOUT_MS` +`CLAUDE_CODE_CONNECT_TIMEOUT_MS`| Removed in v2.1.186 and now a no-op. Previously set a separate timeout for the connect, TLS, and response-header phase of a streaming API request. Use `API_TIMEOUT_MS` instead. For the response-header phase of a streaming request, see `CLAUDE_STREAM_FIRST_BYTE_TIMEOUT_MS` `CLAUDE_CODE_DEBUG_LOGS_DIR`| Override the debug log file path. Despite the name, this is a file path, not a directory. Requires debug mode to be enabled separately via `--debug`, `/debug`, or the `DEBUG` environment variable: setting this variable alone does not enable logging. The [`--debug-file`](</docs/en/cli-reference#cli-flags>) flag does both at once. Defaults to `~/.claude/debug/<session-id>.txt` `CLAUDE_CODE_DEBUG_LOG_LEVEL`| Minimum log level written to the debug log file. Values: `verbose`, `debug` (default), `info`, `warn`, `error`. Set to `verbose` to include high-volume diagnostics like full status line command output, or raise to `error` to reduce noise `CLAUDE_CODE_DISABLE_1M_CONTEXT`| Set to `1` to turn off [1M context window](</docs/en/model-config#extended-context>) support. Claude Code removes `[1m]` model variants from the model picker and holds models that run with the 1M window by default to a 200K window. See [Turn off 1M context](</docs/en/model-config#turn-off-1m-context>). Useful for enterprise environments with compliance requirements. For its role in correcting the window for an unrecognized `[1m]` model ID, see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>) @@ -226,7 +227,7 @@ `CLAUDE_CODE_DISABLE_BUNDLED_SKILLS`| Set to `1` to disable the [skills](</docs/en/skills>) and workflows included with Claude Code: bundled skills and workflows are removed entirely, while built-in commands like `/init` stay typable but are hidden from the model. `/doctor` stays typable like the built-in commands; hide it with `DISABLE_DOCTOR_COMMAND` instead. Skills from plugins, `.claude/skills/`, and `.claude/commands/` are unaffected. Equivalent to the [`disableBundledSkills`](</docs/en/settings-reference#disablebundledskills>) setting `CLAUDE_CODE_DISABLE_CFC_PROMPT`| Set to `1` to keep the [Claude in Chrome](</docs/en/chrome>) browser tools available while omitting the Chrome section of the system prompt and the `/claude-in-chrome` [bundled skill](</docs/en/skills#bundled-skills>). For hosts that embed Claude Code and supply their own browser guidance. Requires Claude Code v2.1.257 or later `CLAUDE_CODE_DISABLE_CLAUDE_MDS`| Set to `1` to prevent loading any CLAUDE.md memory files into context, including user, project, and auto memory files -`CLAUDE_CODE_DISABLE_CRON`| Set to `1` to disable [scheduled tasks](</docs/en/scheduled-tasks>). The `/loop` skill and cron tools become unavailable and any already-scheduled tasks stop firing, including tasks that are already running mid-session +`CLAUDE_CODE_DISABLE_CRON`| Set to `1` to disable [session-scoped scheduled tasks](</docs/en/scheduled-tasks>). The `/loop` skill and cron tools become unavailable and any already-scheduled tasks stop firing, including tasks that are already running mid-session `CLAUDE_CODE_DISABLE_DANGEROUS_RM_TIMEOUT`| Set to `1` to turn off the time limit on [critical-path removal](</docs/en/permission-modes#critical-paths>) prompts. In `auto` mode Claude Code then sends these removals to the classifier instead, and in `bypassPermissions` mode the prompt waits for your answer. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.281 or later `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`| Set to `1` to strip pre-release `anthropic-beta` request headers, the body fields that pair with them, and beta tool-schema fields such as `defer_loading` and `eager_input_streaming` from API requests. Use this when a proxy gateway rejects requests with an `Unexpected value(s)` error for the `anthropic-beta` header or an `Extra inputs are not permitted` error. [Disable pre-release capabilities](</docs/en/llm-gateway-protocol#disable-pre-release-capabilities>) lists what the variable removes, including [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>), and what Claude Code keeps sending `CLAUDE_CODE_DISABLE_EXPLORE_PLAN_AGENTS`| Set to `1` to disable the built-in [Explore and Plan subagents](</docs/en/sub-agents#built-in-subagents>). Claude explores with its search tools or the general-purpose subagent instead, and [plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>) reads files directly rather than launching Explore and Plan agents. Custom subagents named `Explore` or `Plan` are unaffected. To remove every built-in subagent type in the Agent SDK or non-interactive mode, use `CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS` instead. Requires Claude Code v2.1.198 or later @@ -238,6 +239,7 @@ `CLAUDE_CODE_DISABLE_INLINE_SHELL_RM_PROMPT`| Set to `1` to stop Claude Code from reading scripts passed to a shell with `-c`, such as `bash -c 'rm -rf ~'`, for [critical-path](</docs/en/permission-modes#removals-inside-nested-commands-and-inline-scripts>) removals. Claude Code still checks the shell variable and positional parameter targets in those scripts, and the other critical-path checks keep running. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.288 or later `CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP`| Set to `1` to prevent automatic remapping of Opus 4 and Opus 4.1 to the current Opus version on the Anthropic API. Use when you intentionally want to pin an older model. The remap does not run on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry `CLAUDE_CODE_DISABLE_MODEL_ACCESS_FALLBACK`| Set to `1` to stop Claude Code on [Amazon Bedrock](</docs/en/amazon-bedrock#when-a-model-is-disabled-mid-session>) and [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai#when-a-model-is-disabled-mid-session>) from switching to an older model when your account loses access to a session’s model mid-session; the refused request fails at once instead. A [fallback model chain](</docs/en/model-config#fallback-model-chains>) you configure still switches on that refusal, and the [startup model checks](</docs/en/amazon-bedrock#startup-model-checks>) still fall back at launch. Requires Claude Code v2.1.285 or later +`CLAUDE_CODE_DISABLE_MOUNTED_DRIVE_RM_PROMPT`| Set to `1` to turn off the [mounted drive prompt](</docs/en/permission-modes#the-mounted-drive-prompt>) for paths such as `/Volumes/USB`. Set it in the environment that launches Claude Code, because Claude Code [ignores it in a settings `env` block](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). Requires Claude Code v2.1.304 or later `CLAUDE_CODE_DISABLE_MOUSE`| Set to `1` to disable mouse tracking in [fullscreen rendering](</docs/en/fullscreen>). Keyboard scrolling with `PgUp` and `PgDn` still works. Use this to keep your terminal’s native copy-on-select behavior `CLAUDE_CODE_DISABLE_MOUSE_CLICKS`| Set to `1` to disable click, drag, and hover handling in [fullscreen rendering](</docs/en/fullscreen>) while keeping mouse-wheel scrolling. Use this when you want wheel scroll to work inside Claude Code but don’t want clicks to position the cursor, expand tool output, or open links. `CLAUDE_CODE_DISABLE_MOUSE` takes precedence when both are set. Requires Claude Code v2.1.195 or later `CLAUDE_CODE_DISABLE_MTLS_RELOAD_ON_STALE_CONNECTION`| Set to `1` to stop Claude Code from re-reading the [mTLS client certificate and key](</docs/en/network-config#mtls-authentication>) when an API request fails with a connection-level error, such as a connection reset or a TLS handshake error. With the reload disabled, Claude Code loads rotated files only when it next applies settings or at the next startup. Requires Claude Code v2.1.232 or later @@ -268,7 +270,7 @@ `CLAUDE_CODE_ENABLE_FINE_GRAINED_TOOL_STREAMING`| Controls whether tool call inputs stream from the API as Claude generates them. With this off, a large tool input such as a long file write arrives only after Claude finishes generating it, which can look like it’s hanging. Enabled by default on the Anthropic API. On Amazon Bedrock and Google Cloud’s Agent Platform, enabled per model where the deployed container supports it. Set to `0` to opt out. Set to `1` to force on when routing through a proxy via `ANTHROPIC_BASE_URL`, `ANTHROPIC_VERTEX_BASE_URL`, or `ANTHROPIC_BEDROCK_BASE_URL`. Off by default on Microsoft Foundry and [gateway](</docs/en/llm-gateway>) connections `CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY`| Set to `1` to populate the `/model` picker from your gateway’s `/v1/models` endpoint when `ANTHROPIC_BASE_URL` points at an Anthropic-compatible gateway such as LiteLLM, Kong, or an internal proxy. Off by default because gateways backed by a shared API key would otherwise show every user every model the key can access. Discovered models are still filtered by an [`availableModels`](</docs/en/settings-reference#availablemodels>) allowlist the session receives; deliver the list through [MDM or a managed settings file](</docs/en/managed-settings#delivery-mechanisms>), since [server-managed delivery is not available on gateway configurations](</docs/en/server-managed-settings#platform-availability>) `CLAUDE_CODE_ENABLE_OPUS_4_7_FAST_MODE`| Removed in v2.1.142, when the [fast mode](</docs/en/fast-mode>) default moved from Opus 4.6 to Opus 4.7 -`CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION`| Set to `false` to turn off prompt suggestions, the grayed-out predictions that appear in your prompt input. Takes precedence over the [`promptSuggestionEnabled`](</docs/en/settings-reference#promptsuggestionenabled>) setting, which is what the **Prompt suggestions** toggle in `/config` writes. Claude Code also [pauses suggestions while your account is close to or at its usage limit](</docs/en/interactive-mode#when-claude-code-skips-suggestions>). Set to `true` to keep them on until you reach the limit. Requires Claude Code v2.1.238 or later. See [Prompt suggestions](</docs/en/interactive-mode#prompt-suggestions>) +`CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION`| Set to `false` to turn off prompt suggestions, the grayed-out predictions that appear in your prompt input. Takes precedence over the [`promptSuggestionEnabled`](</docs/en/settings-reference#promptsuggestionenabled>) setting, which is what the **Prompt suggestions** toggle in `/config` writes. Claude Code also [pauses suggestions while your account is close to or at its usage limit](</docs/en/interactive-mode#when-claude-code-skips-suggestions>). Set to `true` to keep that pause from applying until you reach the limit. Requires Claude Code v2.1.238 or later. See [Prompt suggestions](</docs/en/interactive-mode#prompt-suggestions>) `CLAUDE_CODE_ENABLE_TASKS`| Selects which task-tracking tools Claude Code provides in [sessions that have them](</docs/en/tools-reference#task-tool-availability>). By default, Claude Code provides the Task tools `TaskCreate`, `TaskUpdate`, `TaskGet`, and `TaskList`. Set to `0` to get the legacy `TodoWrite` tool instead. See [Task list](</docs/en/interactive-mode#task-list>) `CLAUDE_CODE_ENABLE_TELEMETRY`| Set to `1` to enable OpenTelemetry data collection for metrics and logging. Required before configuring OTel exporters. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). See [Monitoring](</docs/en/monitoring-usage>) `CLAUDE_CODE_ENABLE_TODO_TOOLS`| Set to `1` to get the task-tracking tools on every model. Without it, Claude Code provides them by default only on the models listed under [Task tool availability](</docs/en/tools-reference#task-tool-availability>). `CLAUDE_CODE_ENABLE_TASKS` still selects the Task tools or `TodoWrite`. Requires Claude Code v2.1.233 or later @@ -280,7 +282,7 @@ `CLAUDE_CODE_FORCE_STRIKETHROUGH`| Set to `1` to force strikethrough rendering for `~~text~~` in Claude’s responses when your terminal supports it but is not auto-detected, such as over SSH without `TERM_PROGRAM` forwarded. Without this, undetected terminals show the literal `~~` markers instead of rendering the text as strikethrough. Requires Claude Code v2.1.186 or later `CLAUDE_CODE_FORCE_SYNC_OUTPUT`| Set to `1` to force-enable DEC private mode 2026 [synchronized output](<https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036>) when your terminal supports it but is not auto-detected. Useful for emulators such as Emacs `eat` that implement BSU/ESU but do not reply to the capability probe. Has no effect under tmux. Unlike `CLAUDE_CODE_NO_FLICKER`, which switches to [fullscreen rendering](</docs/en/fullscreen>), this doesn’t change the renderer `CLAUDE_CODE_FORCE_TERMINAL_IMAGES`| Set to `1` to draw [mod `Image` elements](</docs/en/plugins/mods/reference#elements>) as pictures when your terminal draws kitty graphics protocol images with Unicode placeholders but is not auto-detected. See [which terminals Claude Code detects](</docs/en/plugins/mods/gallery#image-and-client>) and why it doesn’t help inside tmux or screen -`CLAUDE_CODE_FORK_SUBAGENT`| Controls [fork mode](</docs/en/sub-agents#turn-fork-mode-on-or-off>), which lets Claude spawn [forked subagents](</docs/en/sub-agents#fork-the-current-conversation>) itself and is on by default in interactive sessions only. Set to `1` to turn it on in `claude -p` and the Agent SDK as well, or `0` to turn it off in every kind of session. You can run `/subtask` whether or not fork mode is on. The interactive default requires Claude Code v2.1.232 or later; on earlier versions, set the variable to `1` to turn fork mode on +`CLAUDE_CODE_FORK_SUBAGENT`| Controls fork mode, which is on by default and lets Claude start [forks](</docs/en/sub-agents#fork-the-current-conversation>) on its own. While fork mode is on, Claude also can’t [wait for a subagent](</docs/en/sub-agents#run-subagents-in-foreground-or-background>) in interactive terminal, VS Code, or desktop sessions on your machine. Set to `0` to turn fork mode off. For versions, see [Turn fork mode off](</docs/en/sub-agents#turn-fork-mode-on-or-off>) `CLAUDE_CODE_FORWARD_SUBAGENT_TEXT`| Set to `1` to emit [subagent](</docs/en/sub-agents>) text and thinking blocks in `claude -p --output-format stream-json` output, the same behavior as the [`--forward-subagent-text`](</docs/en/cli-reference#cli-flags>) flag. Use the variable when a harness invokes `claude` and can’t pass the flag itself. Unlike the flag, which exits with an error outside non-interactive mode with stream-json output, the variable is ignored there so that nested invocations keep working when it’s set process-wide. Requires Claude Code v2.1.211 or later `CLAUDE_CODE_GATEWAY_HINT_HEADERS`| Set to `1` to send the [gateway hint headers](</docs/en/llm-gateway-protocol#gateway-hint-headers>), such as `x-claude-code-request-class` and `x-claude-code-compaction`, on a custom proxy or a third-party provider such as Amazon Bedrock or Claude Platform on AWS. Set to `0` to stop sending them on every connection, including a direct connection to the Anthropic API, where Claude Code sends them by default. Requires Claude Code v2.1.273 or later `CLAUDE_CODE_GATEWAY_MODEL_DISCOVERY_TIMEOUT_MS`| Timeout in milliseconds for the [gateway model discovery](</docs/en/llm-gateway-protocol#model-discovery>) request that `CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY` turns on (default: `3000`). Raise it when your gateway needs longer than three seconds to answer `/v1/models` at startup. Takes plain digits only; `0`, negative values, and other spellings keep the default. Requires Claude Code v2.1.269 or later @@ -304,7 +306,7 @@ `CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH`| Number of [subagent layers](</docs/en/sub-agents#let-subagents-spawn-their-own-subagents>) allowed below the main conversation (default: 3). At the default, subagents can spawn their own subagents, and a subagent at the third layer can’t spawn further; set `1` to turn nesting off. In v2.1.217 through v2.1.218, the default was 1, so a subagent couldn’t spawn its own unless you raised the limit; v2.1.219 raised the default to 3. Accepts a positive whole number in plain digits; anything else is ignored, so the limit can be adjusted but not removed. Requires Claude Code v2.1.217 or later `CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY`| Maximum number of read-only tools and subagents that can execute in parallel (default: 10). Higher values increase parallelism but consume more resources `CLAUDE_CODE_MAX_TURNS`| Cap the number of agentic turns when no explicit limit is passed. Equivalent to passing [`--max-turns`](</docs/en/cli-reference#cli-flags>), which takes precedence when both are set. A value that is not a positive integer is rejected at startup with an error rather than treated as no cap -`CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSION`| Cap on [WebSearch](</docs/en/tools-reference#session-search-limit>) calls (default: 200). When Claude reaches the cap, further WebSearch calls return a notice telling it to continue with the information it already gathered. Accepts a positive whole number with no upper bound. Anything else is ignored and the default applies, so the cap can be raised but not turned off. Requires Claude Code v2.1.212 or later +`CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSION`| Cap on [WebSearch](</docs/en/tools-reference#session-search-limit>) calls (default: 200). When Claude reaches the cap, further WebSearch calls return a notice telling it to continue with the information it already gathered and say so in its answer. Accepts a positive whole number with no upper bound. Anything else is ignored and the default applies, so the cap can be raised but not turned off. Requires Claude Code v2.1.212 or later `CLAUDE_CODE_MCP_ALLOWLIST_ENV`| Set to `1` to spawn stdio MCP servers with only a safe baseline environment plus the server’s configured `env`, instead of inheriting your shell environment `CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS`| Elapsed time in milliseconds before a still-running MCP tool call [moves to a background task](</docs/en/mcp#automatic-backgrounding-of-long-tool-calls>) (default: 120000, or 2 minutes). Set to `0` to turn automatic backgrounding off. Requires Claude Code v2.1.212 or later `CLAUDE_CODE_MCP_STARTUP_WAIT_MS`| How long in milliseconds the first turn of a [non-interactive](</docs/en/headless>) session waits for MCP servers that are still connecting, in place of the default [first-turn wait](</docs/en/agent-sdk/mcp#connection-timing>). When set, the wait covers every pending server; in a [self-hosted environment](</docs/en/self-hosted-environments-configuration#connection-timing>), it changes only how long the wait lasts. Set to `0` to skip the wait. A [`--permission-prompt-tool`](</docs/en/cli-reference#cli-flags>) server keeps its own `MCP_TIMEOUT` wait regardless of the value. Requires Claude Code v2.1.274 or later @@ -555,7 +557,6 @@ * Run [`/skill-doctor`](</docs/en/skills#find-unused-skills>) or open its report in the `/plugin` **Stats** tab * Sync the [skills](</docs/en/skills#where-synced-skills-load>) and [plugins](</docs/en/plugins/loading#synced-plugins>) enabled for your claude.ai account into your terminal sessions * Turn on the [You should know mod](</docs/en/interactive-mode#you-should-know-suggestions>) - * See what a [mod](</docs/en/plugins/mods/overview#where-mods-run>) draws in the VS Code extension’s chat panel; the mod’s hooks still run * Use [the advisor tool](</docs/en/advisor#requirements>) * Read or reply to [comments on an artifact](</docs/en/artifacts#collect-comments-on-an-artifact>) * Have Claude read [another organization’s public artifact](</docs/en/artifacts#read-an-artifact-shared-with-you>) @@ -571,12 +572,10 @@ First session after an install or upgrade -In your first session after you install Claude Code, or upgrade to a version that adds a feature, a flag-gated feature can be missing. That session can also start in a different [permission mode](</docs/en/permission-modes#which-mode-a-session-starts-in>) than your later sessions do. When Claude Code fetches the flags during that session, it saves them on the machine, so your next session on that machine has the feature and the usual starting permission mode. After a fresh install, in a non-interactive session such as `claude -p`, the Agent SDK, or the VS Code extension, Claude Code can pick the flags up before it [chooses the starting permission mode](</docs/en/permission-modes#which-mode-a-session-starts-in>), but it doesn’t always wait for them. In setups such as these, sessions after the first also start without freshly fetched flags: +In your first session after you install Claude Code, or upgrade to a version that adds a feature, a flag-gated feature can be missing. When Claude Code fetches its feature flags during that session, it saves them on the machine, so your next session on that machine has the feature. In setups such as these, sessions after the first also start without freshly fetched flags: * **A clean environment on every run** : if each run starts in a CI container, or any other environment without the flags an earlier session saved, every run is a first session * **A gateway token with no API key** : if you authenticate with `ANTHROPIC_AUTH_TOKEN` and no API key, and `ANTHROPIC_BASE_URL` points at a host other than Anthropic’s, such as an [LLM gateway](</docs/en/llm-gateway>), Claude Code has no credential to fetch the flags with - -To choose the permission mode that sessions in these setups start in, see [Start in a different permission mode](</docs/en/permission-modes#start-in-a-different-mode>). ##
modified
--- a/env-vars.md +++ b/env-vars.md @@ -160,7 +160,7 @@ `ANTHROPIC_VERTEX_PROJECT_ID`| GCP project ID that Google Cloud’s Agent Platform requests are addressed to. See [Configure GCP credentials](</docs/en/google-vertex-ai#3-configure-gcp-credentials>) `ANTHROPIC_WORKSPACE_ID`| Workspace ID for [workload identity federation](<https://platform.claude.com/docs/en/manage-claude/workload-identity-federation>). Set this when your federation rule is scoped to more than one workspace so the token exchange knows which workspace to target `API_FORCE_IDLE_TIMEOUT`| Override the 5-minute body idle timeout that aborts a streaming model response when no bytes arrive. Set to `0` to turn the timeout off, for example when a slow [gateway](</docs/en/llm-gateway>) or local model pauses longer than 5 minutes between chunks, or `1` to keep it on for every provider. When unset, the timeout is active on providers other than the direct Anthropic API, [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), and Amazon Bedrock with `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK=1` set. The [stream watchdogs](</docs/en/network-config#streaming-idle-watchdogs>) run independently of it and abort a long silent pause even when you set `0` here -`API_TIMEOUT_MS`| Timeout for API requests in milliseconds (default: 600000, or 10 minutes; maximum: 2147483647). Increase this when requests time out on slow networks or when routing through a proxy. Values above the maximum overflow the underlying timer and cause requests to fail immediately +`API_TIMEOUT_MS`| Timeout for API requests in milliseconds (default: 600000, or 10 minutes; maximum: 2147483647). A streaming request has to receive its response headers within it. Increase this when requests time out on slow networks or when routing through a proxy `AWS_BEARER_TOKEN_BEDROCK`| Amazon Bedrock API key for authentication (see [Amazon Bedrock API keys](<https://aws.amazon.com/blogs/machine-learning/accelerate-ai-development-with-amazon-bedrock-api-keys/>)) `BASH_DEFAULT_TIMEOUT_MS`| Default timeout for a foreground Bash or PowerShell tool command, in milliseconds (default: 120000, or 2 minutes). A value above the [default time limit for background commands](</docs/en/tools-reference#time-limit-for-background-commands>) replaces that default in unattended sessions. The background time limit requires Claude Code v2.1.285 or later `BASH_MAX_OUTPUT_LENGTH`| Maximum number of characters of bash output that Claude Code reads back into a command’s result (default: 30000; maximum: 150000). If you set the [`bashOutputMaxChars`](</docs/en/settings-reference#bashoutputmaxchars>) setting, Claude Code ignores this variable. See [Output limits](</docs/en/tools-reference#output-limits>)
modified
--- a/env-vars.md +++ b/env-vars.md @@ -297,7 +297,7 @@ `CLAUDE_CODE_IDLE_COMPACT_MIN_TOKENS`| Context size, in tokens, at which [idle compaction](</docs/en/settings-reference#idlecompaction>) applies to a conversation (default: `200000`). Accepts a positive whole number, and anything else is ignored. Values below `100000` are raised to `100000`, the lowest threshold. Idle compaction is on by default for conversations that meet its conditions. To turn it off, set `idleCompaction` to `false`. Requires Claude Code v2.1.290 or later `CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS`| How many [subagents](</docs/en/sub-agents#concurrent-subagent-limit>) can be running in one session before the Agent tool refuses to spawn another (default: 20). Accepts a positive whole number in plain digits; anything else is ignored, so the variable can adjust the cap but can’t disable it. Requires Claude Code v2.1.217 or later `CLAUDE_CODE_MAX_CONTEXT_TOKENS`| Override the context window size Claude Code assumes for the active model. As of v2.1.193, how it applies depends on how Claude Code resolves the model ID; see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>). Use this when routing to a model through `ANTHROPIC_BASE_URL` whose context window does not match the built-in size for its name -`CLAUDE_CODE_MAX_MCP_DESCRIPTION_LENGTH`| Maximum length in characters of each MCP tool description and each MCP server’s instructions that Claude Code sends to the model. The value you set replaces both [default limits](</docs/en/mcp#for-mcp-server-authors>): 4096, and 16384 for the description of a tool that Claude loads through tool search. Claude Code truncates longer text. Accepts a positive whole number in plain digits. Anything else is ignored and the defaults apply. Requires Claude Code v2.1.280 or later +`CLAUDE_CODE_MAX_MCP_DESCRIPTION_LENGTH`| Maximum length in characters of MCP tool descriptions and MCP server instructions that Claude Code sends to the model. The value you set replaces both [default limits](</docs/en/mcp#for-mcp-server-authors>): 4096, and 16384 for the description of a tool that Claude loads through tool search. Accepts a positive whole number in plain digits. Anything else is ignored and the defaults apply. Requires Claude Code v2.1.280 or later `CLAUDE_CODE_MAX_OUTPUT_TOKENS`| Set the maximum number of output tokens for most requests. Defaults and caps vary by model; see [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>). Claude Code lowers a value above a model’s cap to the cap. For a model ID Claude Code can’t resolve to a model it knows, the default is 32000 and the cap is 128000. Increasing this value reduces the effective context window available before [auto-compaction](</docs/en/costs#reduce-token-usage>) triggers `CLAUDE_CODE_MAX_RETRIES`| Override the number of times to retry failed API requests (default: 10). Capped at 15 as of v2.1.186; as of v2.1.199, `CLAUDE_CODE_RETRY_WATCHDOG` raises the default and removes the cap. For unattended sessions that need to wait through longer outages, set `CLAUDE_CODE_RETRY_WATCHDOG` instead `CLAUDE_CODE_MAX_SUBAGENTS_PER_SESSION`| Removed in v2.1.224 and now a no-op. Previously capped the total number of [subagents](</docs/en/sub-agents>) Claude could spawn with the Agent tool in one session (default: 200); spawning past the cap failed with `Subagent spawn limit reached`. The [concurrent subagent limit](</docs/en/sub-agents#concurrent-subagent-limit>) and the [depth limit](</docs/en/sub-agents#let-subagents-spawn-their-own-subagents>) still apply @@ -555,6 +555,7 @@ * Run [`/skill-doctor`](</docs/en/skills#find-unused-skills>) or open its report in the `/plugin` **Stats** tab * Sync the [skills](</docs/en/skills#where-synced-skills-load>) and [plugins](</docs/en/plugins/loading#synced-plugins>) enabled for your claude.ai account into your terminal sessions * Turn on the [You should know mod](</docs/en/interactive-mode#you-should-know-suggestions>) + * See what a [mod](</docs/en/plugins/mods/overview#where-mods-run>) draws in the VS Code extension’s chat panel; the mod’s hooks still run * Use [the advisor tool](</docs/en/advisor#requirements>) * Read or reply to [comments on an artifact](</docs/en/artifacts#collect-comments-on-an-artifact>) * Have Claude read [another organization’s public artifact](</docs/en/artifacts#read-an-artifact-shared-with-you>)
modified
--- a/env-vars.md +++ b/env-vars.md @@ -189,6 +189,7 @@ `CLAUDE_CODE_ARTIFACT_AUTO_OPEN`| Set to `0` to stop Claude Code from opening the browser automatically when a new [artifact](</docs/en/artifacts#create-an-artifact>) is published `CLAUDE_CODE_ARTIFACT_COMMENTS`| Set to `0` to stop Claude reading and replying to [comments on an artifact](</docs/en/artifacts#collect-comments-on-an-artifact>). Has no effect when `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` has [turned artifacts off](</docs/en/artifacts#availability>). Requires Claude Code v2.1.221 or later `CLAUDE_CODE_ARTIFACT_COMMENTS_AUTOREACT`| Set to `0` to stop Claude [replying on its own to comments sent to it](</docs/en/artifacts#let-claude-reply-to-comments-on-its-own>). Requires Claude Code v2.1.228 or later +`CLAUDE_CODE_ARTIFACT_PUBLISH_EDITS`| Set to `0` to stop Claude from applying small changes to an [artifact’s](</docs/en/artifacts#update-an-artifact>) file as part of publishing it. Claude then edits the file with its file-editing tools and publishes it as a separate step. Requires Claude Code v2.1.300 or later `CLAUDE_CODE_ATTRIBUTION_HEADER`| Set to `0` to omit the [attribution block](</docs/en/llm-gateway-protocol#system-prompt-attribution-block>), which carries the client version and a prompt fingerprint, from the start of the system prompt. Caching on a direct connection to the Anthropic API is unaffected either way. In some direct-connection setups, Claude Code keeps the block on [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) classifier requests even when you set `0`. In [System prompt attribution block](</docs/en/llm-gateway-protocol#system-prompt-attribution-block>), check which connections and credentials this covers. Before v2.1.181 the block included a per-request token on custom base URLs and Microsoft Foundry connections, so on those versions set it to `0` when your LLM gateway caches on the request body or forwards requests to a third-party provider, or when you connect to Microsoft Foundry directly `CLAUDE_CODE_AUTO_BACKGROUND_WORKER_CHECKIN_SECONDS`| Removed in v2.1.283. Use `CLAUDE_CODE_WORKER_CHECKIN_SCHEDULE` instead `CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the [auto-compact window](</docs/en/model-config#set-the-auto-compact-window>) in tokens, from `100000` to `1000000`. Accepts a plain integer such as `500000` only: a value like `500k` reads as `500` and clamps to the 100K minimum. The effective window is also capped at the model’s context window. Takes precedence over the `/autocompact` command, the `--autocompact` flag, and the `autoCompactWindow` setting. The status line’s `used_percentage` always measures against the model’s full context window, so once this variable is set, that percentage no longer indicates when compaction will run @@ -347,7 +348,7 @@ `CLAUDE_CODE_REMOTE_SESSION_ID`| Set automatically in [cloud sessions](</docs/en/claude-code-on-the-web>) to the current session’s ID. Read this to construct a link back to the session transcript. See [Link output back to the session](</docs/en/cloud-environments#link-output-back-to-the-session>) `CLAUDE_CODE_RESTRICTED`| Set to `1` to start the session in restricted mode, the same as passing [`--restricted`](</docs/en/cli-reference#cli-flags>). Claude Code ignores this variable in a settings file’s `env` block. Requires Claude Code v2.1.248 or later `CLAUDE_CODE_RESUME_INTERRUPTED_TURN`| Set to `1` to automatically resume if the previous session ended mid-turn. Used in SDK mode so the model continues without requiring the SDK to re-send the prompt. To turn this off, unset the variable or set it to `0`. For the VS Code chat panel, see [Continue conversations after a reload](</docs/en/vs-code#continue-conversations-after-a-reload>) -`CLAUDE_CODE_RESUME_INTERRUPTED_TURN_MAX_AGE_MS`| Maximum age in milliseconds of the last transcript message for a session that ended mid-turn to continue automatically on resume. When the last message is older than this bound, Claude Code skips the `CLAUDE_CODE_RESUME_INTERRUPTED_TURN` automatic resume and its `CLAUDE_CODE_RESUME_PROMPT` continuation message, and the session starts idle so you continue explicitly. Unset or `0` means no bound, except that a turn whose last request failed with an API error resumes only while that error is less than six hours old. A positive value bounds every turn, including those; a negative or non-numeric value applies a one-hour bound. Spawn scripts for long-running agents can set this so a restart against an old transcript doesn’t re-run a stale prompt. Claude Code sets a one-hour bound itself when it restarts a crashed [agent view](</docs/en/agent-view>) session that inherited its conversation from an interactive session. Requires Claude Code v2.1.211 or later +`CLAUDE_CODE_RESUME_INTERRUPTED_TURN_MAX_AGE_MS`| Maximum age in milliseconds of the last transcript message for a session that ended mid-turn to continue automatically on resume. When the last message is older than this bound, Claude Code skips the `CLAUDE_CODE_RESUME_INTERRUPTED_TURN` automatic resume and its `CLAUDE_CODE_RESUME_PROMPT` continuation message, and the session starts idle so you continue explicitly. Unset or `0` sets no bound, except that some turns resume only within six hours of their last message, such as one that ended with an API error. A positive value bounds every turn, including those; a negative or non-numeric value applies a one-hour bound. Spawn scripts for long-running agents can set this so a restart against an old transcript doesn’t re-run a stale prompt. Claude Code sets a one-hour bound itself when it restarts a crashed [agent view](</docs/en/agent-view>) session that inherited its conversation from an interactive session. Requires Claude Code v2.1.211 or later `CLAUDE_CODE_RESUME_PROMPT`| Override the continuation message Claude Code sends to Claude when `CLAUDE_CODE_RESUME_INTERRUPTED_TURN` continues an interrupted turn instead of resending its prompt, or when you resume a [deferred tool call](</docs/en/hooks#defer-a-tool-call-for-later>) with `-p`. Defaults to `Continue from where you left off.`. An empty string uses the default `CLAUDE_CODE_RETRY_WATCHDOG`| Set to `1` for unattended sessions such as eval harnesses, CI jobs, or remote workers. Retries `429` and `529` capacity errors indefinitely instead of failing after `CLAUDE_CODE_MAX_RETRIES` attempts. Claude Code fails at once when a standard-speed request gets a `429` that reports a spend limit or exhausted usage credits, even one from a [gateway spend cap](</docs/en/errors#spend-limit-reached>) that resets on a schedule. Before v2.1.239, the watchdog retried these indefinitely. For fast mode requests, see [Handle rate limits](</docs/en/fast-mode#handle-rate-limits>). The watchdog backs off up to 5 minutes between attempts, or until the limit resets when the response carries a rate-limit reset time, so a session that hits a usage limit waits out the remaining window. On v2.1.199 or later it also raises the default retry count for other transient errors, such as server errors, timeouts, and dropped connections, to 300, roughly three hours of backoff, and removes the cap of 15 on `CLAUDE_CODE_MAX_RETRIES` if you set that variable explicitly. Requires Claude Code v2.1.186 or later `CLAUDE_CODE_RETRY_WATCHDOG_MAX_WAIT_MS`| Maximum time in milliseconds that each API request spends waiting out `429` and `529` errors when `CLAUDE_CODE_RETRY_WATCHDOG` is set. Once that time is spent, the next such error ends the request. Give a positive whole number in plain digits, such as `1800000` for 30 minutes. When unset, the wait has no limit. Requires Claude Code v2.1.295 or later
modified
--- a/env-vars.md +++ b/env-vars.md @@ -232,6 +232,7 @@ `CLAUDE_CODE_DISABLE_FAST_MODE`| Set to `1` to disable [fast mode](</docs/en/fast-mode>) `CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY`| Set to `1` to disable the “How is Claude doing?” session quality surveys. Surveys are also disabled when `DISABLE_TELEMETRY`, `DO_NOT_TRACK`, or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` is set, unless `CLAUDE_CODE_ENABLE_FEEDBACK_SURVEY_FOR_OTEL` opts back in. To set a sample rate instead of disabling outright, use the [`feedbackSurveyRate`](</docs/en/settings-reference#feedbacksurveyrate>) setting. See [Session quality surveys](</docs/en/data-usage#session-quality-surveys>) `CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING`| Set to `1` to disable file [checkpointing](</docs/en/checkpointing>). The `/rewind` command will not be able to restore code changes. Overrides the [`fileCheckpointingEnabled`](</docs/en/settings-reference#filecheckpointingenabled>) setting +`CLAUDE_CODE_DISABLE_FILE_MENTIONS`| Set to `1` to stop Claude Code from expanding [`@` mentions](</docs/en/common-workflows#reference-files-and-directories>) of files and directories. Claude instead gets the mentioned paths with a note to read them using its file tools. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). Requires Claude Code v2.1.299 or later `CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS`| Set to `1` to remove built-in commit and PR workflow instructions and the git status snapshot from Claude’s context. Useful when using your own git workflow skills. Takes precedence over the [`includeGitInstructions`](</docs/en/settings-reference#includegitinstructions>) setting when set `CLAUDE_CODE_DISABLE_INLINE_SHELL_RM_PROMPT`| Set to `1` to stop Claude Code from reading scripts passed to a shell with `-c`, such as `bash -c 'rm -rf ~'`, for [critical-path](</docs/en/permission-modes#removals-inside-nested-commands-and-inline-scripts>) removals. Claude Code still checks the shell variable and positional parameter targets in those scripts, and the other critical-path checks keep running. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.288 or later `CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP`| Set to `1` to prevent automatic remapping of Opus 4 and Opus 4.1 to the current Opus version on the Anthropic API. Use when you intentionally want to pin an older model. The remap does not run on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry @@ -292,9 +293,10 @@ `CLAUDE_CODE_IDE_HOST_OVERRIDE`| Override the host address used to connect to the IDE extension. By default Claude Code auto-detects the correct address, including WSL-to-Windows routing `CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL`| Set to `1` to skip auto-installation of IDE extensions. Equivalent to setting [`autoInstallIdeExtension`](</docs/en/settings-reference#autoinstallideextension>) to `false` `CLAUDE_CODE_IDE_SKIP_VALID_CHECK`| Set to `1` to skip validation of IDE lockfile entries during connection. Use when auto-connect fails to find your IDE despite it running +`CLAUDE_CODE_IDLE_COMPACT_MIN_TOKENS`| Context size, in tokens, at which [idle compaction](</docs/en/settings-reference#idlecompaction>) applies to a conversation (default: `200000`). Accepts a positive whole number, and anything else is ignored. Values below `100000` are raised to `100000`, the lowest threshold. Idle compaction is on by default for conversations that meet its conditions. To turn it off, set `idleCompaction` to `false`. Requires Claude Code v2.1.290 or later `CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS`| How many [subagents](</docs/en/sub-agents#concurrent-subagent-limit>) can be running in one session before the Agent tool refuses to spawn another (default: 20). Accepts a positive whole number in plain digits; anything else is ignored, so the variable can adjust the cap but can’t disable it. Requires Claude Code v2.1.217 or later `CLAUDE_CODE_MAX_CONTEXT_TOKENS`| Override the context window size Claude Code assumes for the active model. As of v2.1.193, how it applies depends on how Claude Code resolves the model ID; see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>). Use this when routing to a model through `ANTHROPIC_BASE_URL` whose context window does not match the built-in size for its name -`CLAUDE_CODE_MAX_MCP_DESCRIPTION_LENGTH`| Maximum length in characters of each MCP tool description and each MCP server’s instructions that Claude Code sends to the model (default: 2048). Claude Code [truncates longer text](</docs/en/mcp#for-mcp-server-authors>). Accepts a positive whole number in plain digits. Anything else is ignored and the default applies. Requires Claude Code v2.1.280 or later +`CLAUDE_CODE_MAX_MCP_DESCRIPTION_LENGTH`| Maximum length in characters of each MCP tool description and each MCP server’s instructions that Claude Code sends to the model. The value you set replaces both [default limits](</docs/en/mcp#for-mcp-server-authors>): 4096, and 16384 for the description of a tool that Claude loads through tool search. Claude Code truncates longer text. Accepts a positive whole number in plain digits. Anything else is ignored and the defaults apply. Requires Claude Code v2.1.280 or later `CLAUDE_CODE_MAX_OUTPUT_TOKENS`| Set the maximum number of output tokens for most requests. Defaults and caps vary by model; see [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>). Claude Code lowers a value above a model’s cap to the cap. For a model ID Claude Code can’t resolve to a model it knows, the default is 32000 and the cap is 128000. Increasing this value reduces the effective context window available before [auto-compaction](</docs/en/costs#reduce-token-usage>) triggers `CLAUDE_CODE_MAX_RETRIES`| Override the number of times to retry failed API requests (default: 10). Capped at 15 as of v2.1.186; as of v2.1.199, `CLAUDE_CODE_RETRY_WATCHDOG` raises the default and removes the cap. For unattended sessions that need to wait through longer outages, set `CLAUDE_CODE_RETRY_WATCHDOG` instead `CLAUDE_CODE_MAX_SUBAGENTS_PER_SESSION`| Removed in v2.1.224 and now a no-op. Previously capped the total number of [subagents](</docs/en/sub-agents>) Claude could spawn with the Agent tool in one session (default: 200); spawning past the cap failed with `Subagent spawn limit reached`. The [concurrent subagent limit](</docs/en/sub-agents#concurrent-subagent-limit>) and the [depth limit](</docs/en/sub-agents#let-subagents-spawn-their-own-subagents>) still apply @@ -323,6 +325,7 @@ `CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS`| Interval for refreshing dynamic OpenTelemetry headers in milliseconds (default: 1740000 / 29 minutes). See [Dynamic headers](</docs/en/monitoring-usage#dynamic-headers>) `CLAUDE_CODE_OTEL_SHUTDOWN_TIMEOUT_MS`| Timeout in milliseconds for the OpenTelemetry exporter to finish on shutdown (default: 2000). Increase if metrics are dropped at exit. See [Monitoring](</docs/en/monitoring-usage>) `CLAUDE_CODE_OVERLOADED_RETRY_BASE_DELAY_MS`| Starting delay in milliseconds, in place of the default 500, of the exponential backoff between [automatic retries](</docs/en/errors#tune-retry-behavior>) of a request that the API rejects with a `529` overloaded error. Raise it to spread the retries over a longer window when the API is at capacity. Give whole milliseconds from 500 to 32000 in plain digits; Claude Code treats any other value as unset. Has no effect when `CLAUDE_CODE_RETRY_WATCHDOG` is set to `1`, or when the rejected request was sent in [fast mode](</docs/en/fast-mode#handle-rate-limits>). Requires Claude Code v2.1.292 or later +`CLAUDE_CODE_OVERLOADED_RETRY_MAX_DELAY_MS`| Ceiling in milliseconds, in place of the default 32000, on the exponential backoff between [automatic retries](</docs/en/errors#tune-retry-behavior>) of a request that the API rejects with a `529` overloaded error. Raise it so that later retries keep spreading apart when the API is at capacity. Give whole milliseconds from 32000 to 64000 in plain digits; Claude Code treats any other value as unset. Has no effect when `CLAUDE_CODE_RETRY_WATCHDOG` is set to `1`, or when the rejected request was sent in [fast mode](</docs/en/fast-mode#handle-rate-limits>). Requires Claude Code v2.1.296 or later `CLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATE`| Set to `1` to let Claude Code run your package manager’s upgrade command in the background when a new version is available. Applies to Homebrew and WinGet installations. Other package managers continue to show the upgrade command without running it. See [Auto updates](</docs/en/setup#auto-updates>) `CLAUDE_CODE_PERFORCE_MODE`| Set to `1` to enable Perforce-aware write protection. When set, Edit, Write, and NotebookEdit fail with a `p4 edit <file>` hint if the target file lacks the owner-write bit, which Perforce clears on synced files until `p4 edit` opens them. This prevents Claude Code from bypassing Perforce change tracking `CLAUDE_CODE_PLUGIN_CACHE_DIR`| Override the plugins root directory. Despite the name, this sets the parent directory, not the cache itself: marketplaces and the plugin cache live in subdirectories under this path. Defaults to `~/.claude/plugins` @@ -401,6 +404,7 @@ `CLAUDE_CODE_WORKER_CHECKIN_SCHEDULE`| When `CLAUDE_AUTO_BACKGROUND_TASKS` is set to `1`, how long Claude Code waits before each reminder to Claude to check on [background subagents](</docs/en/sub-agents#run-subagents-in-foreground-or-background>) that are still running. Takes one or more comma-separated waits in whole seconds from `1` to `86400`, such as `600` or `600,1800,3600`. Each value is the wait before the next reminder, and the last value repeats. Takes plain digits only; any other value or spelling reads as unset. When unset, there are no reminders. Requires Claude Code v2.1.283 or later `CLAUDE_CODE_WORKFLOW_MAX_CONCURRENT_AGENTS`| How many agents a single [workflow](</docs/en/workflows>) run executes at once, from `1` to `256`. By default, a run executes up to 16 agents at once, fewer when Claude Code has fewer CPUs available; queued `agent()` calls wait for a free slot. Each running agent’s transcript stays in Claude Code’s memory, so higher values raise memory use. Takes plain digits only; out-of-range values and other spellings keep the default. Requires Claude Code v2.1.269 or later `CLAUDE_CODE_WORKFLOW_PREFIX_STAGGER_MS`| Upper bound in milliseconds on how long a [workflow](</docs/en/workflows>) agent waits for a same-prefix sibling’s first response to begin before sending its own first request. When a fan-out starts several agents that share a [prompt-cache prefix](</docs/en/workflows#prompt-caching-in-a-fan-out>), Claude Code holds all but the first agent for up to this long so the rest read the cached prefix instead of each processing it uncached. Default `5000`. Set to `0` to disable the wait. When `DISABLE_PROMPT_CACHING` is set, agents never wait. Requires Claude Code v2.1.229 or later +`CLAUDE_CODE_YOU_SHOULD_KNOW_DEBUG`| Set to `1` to show, above the prompt, a line for each of the last three checks the [You should know mod](</docs/en/interactive-mode#you-should-know-suggestions>) made in this session. Use it to confirm the mod is checking when no notes appear. Requires Claude Code v2.1.287 or later `CLAUDE_CONFIG_DIR`| Override the configuration directory (default: `~/.claude`). All settings, session history, and plugins are stored under this path. For credentials, see [where Claude Code stores credentials](</docs/en/authentication#credential-management>). Useful for running multiple accounts side by side: for example, `alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'`. Set it in your shell, user settings, or managed settings. In a settings file, write the absolute path. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) `CLAUDE_DISABLE_ADOPT`| Set to `1` to stop in-flight background work instead of carrying it over when you background a session by pressing `←` or with [`/background`](</docs/en/agent-view#from-inside-a-session>). Claude Code asks you to confirm before backgrounding, then stops the tasks that would otherwise carry over. Requires Claude Code v2.1.195 or later `CLAUDE_EFFORT`| Set automatically in Bash tool subprocesses and hook commands to the [effort level](</docs/en/model-config#adjust-effort-level>) in effect when the subprocess starts: `low`, `medium`, `high`, `xhigh`, or `max`. Matches the `effort.level` field passed to [hooks](</docs/en/hooks>). Only set when the current model supports the effort parameter @@ -416,7 +420,7 @@ `CLAUDE_SUBAGENT_BG_SHELL_MAX_MS`| Removed in v2.1.260 and now a no-op. Previously capped how long a [background shell command](</docs/en/interactive-mode#background-bash-commands>) that a [subagent](</docs/en/sub-agents>) started could run, in milliseconds, with a 60-minute default. See [the background command lifetime rules](</docs/en/tools-reference#background-commands>) `DEBUG`| Set to `1` to enable debug mode, equivalent to launching with [`--debug`](</docs/en/cli-reference#cli-flags>). Debug logs are written to `~/.claude/debug/<session-id>.txt`, or to the path set by `CLAUDE_CODE_DEBUG_LOGS_DIR`. Only the truthy values `1`, `true`, `yes`, and `on` enable debug mode, so namespace patterns like `DEBUG=express:*` set for other tools do not trigger it `DISABLE_AUTOUPDATER`| Set to `1` to disable automatic background updates. Manual `claude update` still works. Use `DISABLE_UPDATES` to block both -`DISABLE_AUTO_COMPACT`| Set to `1` to disable automatic compaction when approaching the context limit. The manual `/compact` command remains available. Use when you want explicit control over when compaction occurs. Overrides the [`autoCompactEnabled`](</docs/en/settings-reference#autocompactenabled>) setting +`DISABLE_AUTO_COMPACT`| Set to `1` to disable automatic compaction when approaching the context limit, along with [idle compaction](</docs/en/settings-reference#idlecompaction>). The manual `/compact` command remains available. Use when you want explicit control over when compaction occurs. Overrides the [`autoCompactEnabled`](</docs/en/settings-reference#autocompactenabled>) setting `DISABLE_COMPACT`| Set to `1` to disable all compaction: both automatic compaction and the manual `/compact` command `DISABLE_COST_WARNINGS`| Set to `1` to disable cost warning messages `DISABLE_DOCTOR_COMMAND`| Set to `1` to hide the [`/doctor`](</docs/en/commands#all-commands>) setup checkup skill and its `/checkup` alias. Useful for managed deployments where users shouldn’t run setup diagnostics from a session. Doesn’t affect the `claude doctor` terminal command. Before v2.1.205, this variable hid the `/doctor` diagnostics screen command @@ -442,7 +446,7 @@ `ENABLE_CLAUDEAI_MCP_SERVERS`| Set to `false` to stop Claude Code from fetching [claude.ai MCP servers](</docs/en/mcp#use-mcp-servers-from-claude-ai>). Enabled by default for logged-in users. To disable per-project or per-org, set [`disableClaudeAiConnectors`](</docs/en/settings-reference#disableclaudeaiconnectors>) in settings instead `ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) instead of the default 5 minutes. Intended for API key, [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), [Microsoft Foundry](</docs/en/microsoft-foundry>), and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) users. Subscription users within included usage receive the 1-hour TTL automatically on the [main conversation](</docs/en/prompt-caching#which-ttl-each-request-gets>). Subscription users drawing on [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>) can set it to keep the 1-hour TTL. 1-hour cache writes are billed at a higher rate. To choose the TTL per request bucket instead, use `CLAUDE_CODE_PROMPT_CACHE_TTL` and `CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL`, which take precedence over this variable `ENABLE_PROMPT_CACHING_1H_BEDROCK`| Deprecated. Use `ENABLE_PROMPT_CACHING_1H` instead -`ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset, Claude Code defers all MCP tools by default. It still loads them upfront on Google Cloud’s Agent Platform models earlier than the Claude 4.5 generation, on a Microsoft Foundry deployment hosted on Azure, and when `ANTHROPIC_BASE_URL` points to a non-first-party host. `true` always defers and sends the beta header, except on those same Agent Platform models and Microsoft Foundry deployments; requests fail on proxies that don’t support `tool_reference`. `auto` loads upfront when tool definitions fit within 10% of context. `auto:N` sets a custom threshold, such as `auto:5` for 5%. `false` loads all tools upfront. A value you set yourself is ignored when `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS` is set. Before v2.1.221, Claude Code disabled tool search for all models on Google Cloud’s Agent Platform unless you set this variable to `true` +`ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset, Claude Code defers all MCP tools by default, and loads them upfront instead when `ANTHROPIC_BASE_URL` points to a non-first-party host. `true` keeps them deferred on such a host too. `auto` loads upfront when tool definitions fit within 10% of context. `auto:N` sets a custom threshold, such as `auto:5` for 5%. `false` loads all tools upfront. For the models and deployments that load every tool upfront whatever this value is, see [Configure tool search](</docs/en/mcp#configure-tool-search>) `FALLBACK_FOR_ALL_PRIMARY_MODELS`| Set to any non-empty value, such as `1`, to make Claude Code stop retrying on repeated overload errors for every model when no fallback model is configured. **Setting it to`0` or `false` still enables this**, unlike most on/off variables; unset the variable to restore the default retry behavior. Without it, Claude Code stops retrying this way on models it recognizes as Opus, Fable, or Mythos models when you authenticate with an API key or a [third-party provider](</docs/en/third-party-integrations>) rather than a Claude subscription. On Claude Code v2.1.160 or later, Claude Code switches to your configured [fallback model chain](</docs/en/model-config#fallback-model-chains>) on repeated overload errors for any primary model, so this variable doesn’t affect switching to a fallback model `FORCE_AUTOUPDATE_PLUGINS`| Set to `1` to force plugin auto-updates even when the main auto-updater is disabled via `DISABLE_AUTOUPDATER` `FORCE_HYPERLINK`| Set to `1` to enable clickable OSC 8 hyperlinks when your terminal supports them but isn’t auto-detected, or `0` to disable them. When unset, Claude Code enables hyperlinks only when it detects terminal support. Claude Code parses this value as a number, not a Boolean, so a value such as `false`, `no`, or `off` enables hyperlinks rather than disabling them. The footer [PR or merge request badge](</docs/en/interactive-mode#pr-review-status>) renders as a hyperlink even when Claude Code can’t detect terminal support, such as over SSH. Set `0` to render the badge as plain text @@ -549,6 +553,7 @@ * Run [`claude import` or the `/import` command](</docs/en/cli-reference#cli-commands>) * Run [`/skill-doctor`](</docs/en/skills#find-unused-skills>) or open its report in the `/plugin` **Stats** tab * Sync the [skills](</docs/en/skills#where-synced-skills-load>) and [plugins](</docs/en/plugins/loading#synced-plugins>) enabled for your claude.ai account into your terminal sessions + * Turn on the [You should know mod](</docs/en/interactive-mode#you-should-know-suggestions>) * Use [the advisor tool](</docs/en/advisor#requirements>) * Read or reply to [comments on an artifact](</docs/en/artifacts#collect-comments-on-an-artifact>) * Have Claude read [another organization’s public artifact](</docs/en/artifacts#read-an-artifact-shared-with-you>) @@ -556,6 +561,7 @@ * Get [Claude-drafted feedback](</docs/en/tools-reference#sendfeedback-tool-behavior>), which Claude Code turns on through a fetched flag * Have Claude [treat large pastes as pasted rather than typed text](</docs/en/terminal-config#how-claude-treats-pasted-text>); the content behind a `[Pasted text #N]` placeholder reaches Claude unmarked * Have Claude Code [exclude MCP tools whose input schema the API would reject](</docs/en/mcp#tools-with-invalid-input-schemas>); it sends the schema anyway, and a request that includes it fails with [a 400 error naming the tool by its position](</docs/en/errors#tool-input-schema-is-invalid>) + * Have Claude Code [compact a long conversation while your terminal session is idle](</docs/en/settings-reference#idlecompaction>), shortly before a one-hour prompt cache expires ###
modified
--- a/env-vars.md +++ b/env-vars.md @@ -184,7 +184,7 @@ `CLAUDE_CODE_ACCESSIBILITY`| Set to `1` to keep the native terminal cursor visible and disable the inverted-text cursor indicator. Allows screen magnifiers like macOS Zoom to track cursor position `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD`| Set to `1` to load memory files from directories specified with `--add-dir`. Loads `CLAUDE.md`, `.claude/CLAUDE.md`, `.claude/rules/*.md`, and `CLAUDE.local.md`. By default, additional directories do not load memory files `CLAUDE_CODE_ALT_SCREEN_FULL_REPAINT`| Set to `1` to repaint the entire screen on every frame in [fullscreen rendering](</docs/en/fullscreen>) instead of sending incremental updates. Use this if fullscreen mode shows stale or misplaced text fragments. Claude Code enables this automatically for background sessions and [agent view](</docs/en/agent-view>) on Windows -`CLAUDE_CODE_ALWAYS_ENABLE_EFFORT`| Set to `1` to send the [effort](</docs/en/model-config#adjust-effort-level>) parameter with every request, even when Claude Code does not recognize the model ID as effort-capable. Use this when routing through an [LLM gateway](</docs/en/llm-gateway>) or third-party provider that serves models under custom identifiers. Models that reject the effort parameter at the API, including Claude 3 models, Sonnet 4.0 and 4.5, Opus 4.0 and 4.1, and Haiku 4.5, are still excluded so requests do not fail +`CLAUDE_CODE_ALWAYS_ENABLE_EFFORT`| Set to `1` to send the [effort](</docs/en/model-config#adjust-effort-level>) parameter with every request, even when Claude Code does not recognize the model ID as effort-capable. Use this when routing through an [LLM gateway](</docs/en/llm-gateway>) or third-party provider that serves models under custom identifiers. Models that reject the effort parameter at the API, including Claude Opus 4.1, Claude Sonnet 4.5, Claude Haiku 4.5, and earlier models, are still excluded so requests do not fail `CLAUDE_CODE_API_KEY_HELPER_TTL_MS`| Interval in milliseconds at which credentials should be refreshed (when using [`apiKeyHelper`](</docs/en/settings-reference#apikeyhelper>)) `CLAUDE_CODE_ARTIFACT_AUTO_OPEN`| Set to `0` to stop Claude Code from opening the browser automatically when a new [artifact](</docs/en/artifacts#create-an-artifact>) is published `CLAUDE_CODE_ARTIFACT_COMMENTS`| Set to `0` to stop Claude reading and replying to [comments on an artifact](</docs/en/artifacts#collect-comments-on-an-artifact>). Has no effect when `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` has [turned artifacts off](</docs/en/artifacts#availability>). Requires Claude Code v2.1.221 or later @@ -234,7 +234,7 @@ `CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING`| Set to `1` to disable file [checkpointing](</docs/en/checkpointing>). The `/rewind` command will not be able to restore code changes. Overrides the [`fileCheckpointingEnabled`](</docs/en/settings-reference#filecheckpointingenabled>) setting `CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS`| Set to `1` to remove built-in commit and PR workflow instructions and the git status snapshot from Claude’s context. Useful when using your own git workflow skills. Takes precedence over the [`includeGitInstructions`](</docs/en/settings-reference#includegitinstructions>) setting when set `CLAUDE_CODE_DISABLE_INLINE_SHELL_RM_PROMPT`| Set to `1` to stop Claude Code from reading scripts passed to a shell with `-c`, such as `bash -c 'rm -rf ~'`, for [critical-path](</docs/en/permission-modes#removals-inside-nested-commands-and-inline-scripts>) removals. Claude Code still checks the shell variable and positional parameter targets in those scripts, and the other critical-path checks keep running. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.288 or later -`CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP`| Set to `1` to prevent automatic remapping of Opus 4.0 and 4.1 to the current Opus version on the Anthropic API. Use when you intentionally want to pin an older model. The remap does not run on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry +`CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP`| Set to `1` to prevent automatic remapping of Opus 4 and Opus 4.1 to the current Opus version on the Anthropic API. Use when you intentionally want to pin an older model. The remap does not run on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry `CLAUDE_CODE_DISABLE_MODEL_ACCESS_FALLBACK`| Set to `1` to stop Claude Code on [Amazon Bedrock](</docs/en/amazon-bedrock#when-a-model-is-disabled-mid-session>) and [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai#when-a-model-is-disabled-mid-session>) from switching to an older model when your account loses access to a session’s model mid-session; the refused request fails at once instead. A [fallback model chain](</docs/en/model-config#fallback-model-chains>) you configure still switches on that refusal, and the [startup model checks](</docs/en/amazon-bedrock#startup-model-checks>) still fall back at launch. Requires Claude Code v2.1.285 or later `CLAUDE_CODE_DISABLE_MOUSE`| Set to `1` to disable mouse tracking in [fullscreen rendering](</docs/en/fullscreen>). Keyboard scrolling with `PgUp` and `PgDn` still works. Use this to keep your terminal’s native copy-on-select behavior `CLAUDE_CODE_DISABLE_MOUSE_CLICKS`| Set to `1` to disable click, drag, and hover handling in [fullscreen rendering](</docs/en/fullscreen>) while keeping mouse-wheel scrolling. Use this when you want wheel scroll to work inside Claude Code but don’t want clicks to position the cursor, expand tool output, or open links. `CLAUDE_CODE_DISABLE_MOUSE` takes precedence when both are set. Requires Claude Code v2.1.195 or later @@ -487,9 +487,9 @@ `VERTEX_REGION_CLAUDE_3_5_HAIKU`| Override region for Claude 3.5 Haiku when using Google Cloud’s Agent Platform `VERTEX_REGION_CLAUDE_3_5_SONNET`| Override region for Claude 3.5 Sonnet when using Google Cloud’s Agent Platform `VERTEX_REGION_CLAUDE_3_7_SONNET`| Override region for Claude 3.7 Sonnet when using Google Cloud’s Agent Platform -`VERTEX_REGION_CLAUDE_4_0_OPUS`| Override region for Claude 4.0 Opus when using Google Cloud’s Agent Platform -`VERTEX_REGION_CLAUDE_4_0_SONNET`| Override region for Claude 4.0 Sonnet when using Google Cloud’s Agent Platform -`VERTEX_REGION_CLAUDE_4_1_OPUS`| Override region for Claude 4.1 Opus when using Google Cloud’s Agent Platform +`VERTEX_REGION_CLAUDE_4_0_OPUS`| Override region for Claude Opus 4 when using Google Cloud’s Agent Platform +`VERTEX_REGION_CLAUDE_4_0_SONNET`| Override region for Claude Sonnet 4 when using Google Cloud’s Agent Platform +`VERTEX_REGION_CLAUDE_4_1_OPUS`| Override region for Claude Opus 4.1 when using Google Cloud’s Agent Platform `VERTEX_REGION_CLAUDE_4_5_OPUS`| Override region for Claude Opus 4.5 when using Google Cloud’s Agent Platform `VERTEX_REGION_CLAUDE_4_5_SONNET`| Override region for Claude Sonnet 4.5 when using Google Cloud’s Agent Platform `VERTEX_REGION_CLAUDE_4_6_OPUS`| Override region for Claude Opus 4.6 when using Google Cloud’s Agent Platform
modified
--- a/env-vars.md +++ b/env-vars.md @@ -174,7 +174,7 @@ `CLAUDE_AGENT_SDK_MCP_NO_PREFIX`| Set to `1` to skip the `mcp__<server>__` prefix on tool names from SDK-created MCP servers. Tools use their original names. SDK usage only `CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS`| Stall timeout in milliseconds for subagents. Also covers [workflow agents](</docs/en/workflows#when-an-agent-stalls-and-restarts>) on Claude Code v2.1.286 or later. Default `600000` (10 minutes); if you raise `CLAUDE_STREAM_IDLE_TIMEOUT_MS` while the stream watchdog is on, the default rises with it, as [Handle slow or stalled API responses](</docs/en/agent-sdk/typescript#handle-slow-or-stalled-api-responses>) describes `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE`| Set the percentage (1-100) of the auto-compact window at which auto-compaction triggers. Use lower values like `50` to compact earlier; the variable can’t raise the threshold, so values above the default percentage are ignored. It applies only in sessions that [compact before the model’s context limit](</docs/en/model-config#context-window-and-auto-compaction>). Applies to both main conversations and subagents -`CLAUDE_AUTO_BACKGROUND_TASKS`| Set to `1` to force-enable automatic backgrounding of long-running agent tasks. When enabled, subagents are moved to the background after running for approximately two minutes. Also enables [automatic backgrounding of long MCP tool calls](</docs/en/mcp#automatic-backgrounding-of-long-tool-calls>) in non-interactive mode on Claude Code v2.1.212 or later +`CLAUDE_AUTO_BACKGROUND_TASKS`| Set to `1` to force-enable automatic backgrounding of long-running agent tasks. When enabled, a [subagent](</docs/en/sub-agents#run-subagents-in-foreground-or-background>) moves to the background after running for approximately two minutes. If Claude queued a tool call such as a file edit behind the subagent, the subagent finishes in the foreground before that call starts. Also enables [automatic backgrounding of long MCP tool calls](</docs/en/mcp#automatic-backgrounding-of-long-tool-calls>) in non-interactive mode on Claude Code v2.1.212 or later `CLAUDE_AX_PREPARK_MS`| In [screen reader mode](</docs/en/accessibility>), how many milliseconds Claude Code waits before it writes a new or changed line. Default `0`, so Claude Code doesn’t wait. Before v2.1.287, the default was `50`. Claude Code caps the wait at `5000`. Requires Claude Code v2.1.233 or later `CLAUDE_AX_SCREEN_READER`| Set to `1` to render screen-reader friendly output: flat text without decorative borders or animations. Set to `0` to force screen-reader mode off even when [`axScreenReader`](</docs/en/settings-reference#axscreenreader>) is `true`. The [`--ax-screen-reader`](</docs/en/cli-reference#cli-flags>) flag takes precedence. Requires Claude Code v2.1.181 or later `CLAUDE_AX_STARTUP_QUIET_MS`| In [screen reader mode](</docs/en/accessibility>), how many milliseconds Claude Code holds the first interface render after the startup confirmation line, so your screen reader can speak the line in full before new output interrupts it. Default `3000`. Set `0` to render immediately. Claude Code caps the hold at `600000` (10 minutes). Your first keystroke ends the hold early. Requires Claude Code v2.1.217 or later @@ -220,7 +220,7 @@ `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 `CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_DEFAULT`| Set to `1` to stop Claude Code from treating an [Amazon Bedrock](</docs/en/amazon-bedrock>) streaming response with a missing or empty `Content-Type` header as Amazon Bedrock’s binary event stream. By default, Claude Code assumes a gateway dropped the header from an otherwise unmodified response, so it decodes the body and streaming keeps working. Set this only for a gateway that also re-emits the stream as server-sent events; Claude Code then reads the header-less body as server-sent events instead. Requires Claude Code v2.1.239 or later `CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_GUARD`| Set to `1` to skip the check that an [Amazon Bedrock](</docs/en/amazon-bedrock>) streaming response carries the `application/vnd.amazon.eventstream` content-type. Without this variable, when a response carries a different content-type, Claude Code fails the request with an error naming that type, which means a [gateway or proxy is transforming the response](</docs/en/amazon-bedrock#streaming-errors-behind-a-gateway-or-proxy>). Configure the gateway to forward the `Content-Type` header and body unmodified rather than setting this variable. Requires Claude Code v2.1.208 or later -`CLAUDE_CODE_DISABLE_BG_EXIT_HANDOFF`| Set to `1` to stop a [background session’s](</docs/en/agent-view>) running background shell commands, dynamic workflows, and, as of v2.1.198, background subagents when the [supervisor](</docs/en/agent-view#the-supervisor-process>) stops, restarts, or updates that session’s process, instead of handing them to the session’s next process. Affects only that handoff: backgrounding a session with `←` or [`/background`](</docs/en/agent-view#from-inside-a-session>) still carries in-flight work over, and `CLAUDE_DISABLE_ADOPT` turns off both. Requires Claude Code v2.1.196 or later +`CLAUDE_CODE_DISABLE_BG_EXIT_HANDOFF`| Set to `1` to stop a [background session’s](</docs/en/agent-view>) running background shell commands, dynamic workflows, and, as of v2.1.198, background subagents when the [supervisor](</docs/en/agent-view#the-supervisor-process>) stops, restarts, or updates that session’s process, instead of handing them to the session’s next process. Affects only that handoff: backgrounding a session with `←` or [`/background`](</docs/en/agent-view#from-inside-a-session>) still carries in-flight background work over, and `CLAUDE_DISABLE_ADOPT` turns off both. Requires Claude Code v2.1.196 or later `CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP`| Set to `1` to stop Claude Code from terminating [background shell commands](</docs/en/interactive-mode#background-bash-commands>) under memory pressure. By default, on macOS and Linux, Claude Code terminates background shells when the operating system reports critical memory pressure and the session has been idle for 30 minutes with no turn or subagent running. Windows has no memory-pressure signal, so this variable has no effect there. Requires Claude Code v2.1.193 or later `CLAUDE_CODE_DISABLE_BUNDLED_SKILLS`| Set to `1` to disable the [skills](</docs/en/skills>) and workflows included with Claude Code: bundled skills and workflows are removed entirely, while built-in commands like `/init` stay typable but are hidden from the model. `/doctor` stays typable like the built-in commands; hide it with `DISABLE_DOCTOR_COMMAND` instead. Skills from plugins, `.claude/skills/`, and `.claude/commands/` are unaffected. Equivalent to the [`disableBundledSkills`](</docs/en/settings-reference#disablebundledskills>) setting `CLAUDE_CODE_DISABLE_CFC_PROMPT`| Set to `1` to keep the [Claude in Chrome](</docs/en/chrome>) browser tools available while omitting the Chrome section of the system prompt and the `/claude-in-chrome` [bundled skill](</docs/en/skills#bundled-skills>). For hosts that embed Claude Code and supply their own browser guidance. Requires Claude Code v2.1.257 or later @@ -249,7 +249,7 @@ `CLAUDE_CODE_DISABLE_REFUSAL_FALLBACK`| Set to `1` to turn off the [automatic model switch when a safety classifier flags a request](</docs/en/model-config#automatic-model-fallback>), the behavior the [`switchModelsOnFlag`](</docs/en/settings-reference#switchmodelsonflag>) setting controls `CLAUDE_CODE_DISABLE_STRUCTURED_OUTPUTS`| Set to `1` to stop Claude Code from sending the structured-output `output_config.format` field and the `anthropic-beta` value that pairs with it, for an [LLM gateway](</docs/en/llm-gateway-protocol#feature-pass-through>) whose upstream rejects them. This leaves on the other pre-release capabilities that [`CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`](</docs/en/llm-gateway-protocol#disable-pre-release-capabilities>) turns off. Requires Claude Code v2.1.288 or later `CLAUDE_CODE_DISABLE_SUBSTITUTION_RM_PROMPT`| Set to `1` to turn off the [critical-path](</docs/en/permission-modes#critical-paths>) check for a recursive `rm` whose target is entirely the output of a command substitution, such as `rm -rf "$(pwd)"`. The other critical-path checks keep running. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.281 or later -`CLAUDE_CODE_DISABLE_TERMINAL_TITLE`| Set to `1` to disable automatic terminal title updates based on conversation context. This also skips the background small/fast-model request that [generates a session title](</docs/en/sessions#name-your-sessions>) +`CLAUDE_CODE_DISABLE_TERMINAL_TITLE`| Set to `1` to disable automatic terminal title updates based on conversation context. This also skips the background small/fast-model request that [generates a session title](</docs/en/sessions#name-your-sessions>), and turns off [status reports to your terminal](</docs/en/terminal-config#see-session-status-in-your-terminal>) `CLAUDE_CODE_DISABLE_THINKING`| Set to `1` to omit the `thinking` parameter from API requests entirely. This is a compatibility option for proxies and gateways that reject the parameter. On models that think by default, omitting the parameter means the model may still think. To explicitly disable [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) on the Anthropic API, use `MAX_THINKING_TOKENS=0` instead. Neither variable turns thinking off on Opus 5.5, Sonnet 5.5, Haiku 5.5, or the Fable models, which can’t have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `MAX_THINKING_TOKENS=0` likewise omits the parameter, so the two variables behave the same there `CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT`| Set to `1` to skip proactive [auto-compaction](</docs/en/costs#reduce-token-usage>) when Claude Code doesn’t recognize the model ID, such as an [LLM gateway](</docs/en/llm-gateway>) alias. Without this variable, Claude Code compacts at the context window it assumes for the ID. `CLAUDE_CODE_MAX_CONTEXT_TOKENS` can correct the assumed window instead; see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>) for when each variable applies. Requires Claude Code v2.1.223 or later `CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL`| Set to `1` to disable virtual scrolling in [fullscreen rendering](</docs/en/fullscreen>) and render every message in the transcript. Use this if scrolling in fullscreen mode shows blank regions where messages should appear @@ -273,7 +273,7 @@ `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 `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS`| Set to `1` to enable [agent teams](</docs/en/agent-teams>). Agent teams are experimental and disabled by default `CLAUDE_CODE_EXTRA_BODY`| JSON object to merge into the top level of every API request body. Useful for passing provider-specific parameters that Claude Code doesn’t expose directly. A value exported in your shell also applies to the [background sessions](</docs/en/agent-view>) you dispatch with `claude agents` or `--bg`. Before v2.1.206, background sessions ignored a shell-exported value and used whatever copy the background supervisor process inherited -`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 +`CLAUDE_CODE_FILE_READ_MAX_OUTPUT_TOKENS`| Override the default token limit for [file reads](</docs/en/tools-reference#large-files>), which is 25,000 tokens. Useful when you need to read larger files in full. A read that Claude makes with the `allow_large` parameter can go past this limit when the context window has room `CLAUDE_CODE_FORCE_SESSION_PERSISTENCE`| Set to `1` to force transcript persistence, prompt history, and `claude agents` registration even when this `claude` was launched from inside another Claude Code session. Use when an inherited `CLAUDE_CODE_CHILD_SESSION` value, for example from a `screen` session or a background launcher first started by Claude Code’s Bash tool, causes a genuine top-level session to be misclassified as nested. As of v2.1.178, Claude Code detects the tmux case automatically and ignores the inherited marker, so tmux no longer needs this variable. Also honored on v2.1.169 and earlier; has no effect on v2.1.170 and v2.1.171, where the nested-session detection it overrides was removed `CLAUDE_CODE_FORCE_STRIKETHROUGH`| Set to `1` to force strikethrough rendering for `~~text~~` in Claude’s responses when your terminal supports it but is not auto-detected, such as over SSH without `TERM_PROGRAM` forwarded. Without this, undetected terminals show the literal `~~` markers instead of rendering the text as strikethrough. Requires Claude Code v2.1.186 or later `CLAUDE_CODE_FORCE_SYNC_OUTPUT`| Set to `1` to force-enable DEC private mode 2026 [synchronized output](<https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036>) when your terminal supports it but is not auto-detected. Useful for emulators such as Emacs `eat` that implement BSU/ESU but do not reply to the capability probe. Has no effect under tmux. Unlike `CLAUDE_CODE_NO_FLICKER`, which switches to [fullscreen rendering](</docs/en/fullscreen>), this doesn’t change the renderer @@ -407,7 +407,7 @@ `CLAUDE_ENABLE_BYTE_WATCHDOG`| Set to `1` to force-enable the byte-level streaming idle watchdog, or set to `0` to force-disable it. `0` also turns off the [first-byte deadline](</docs/en/network-config#streaming-idle-watchdogs>) on the connections where that deadline runs. When unset, the watchdog is enabled by default for direct Anthropic API and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) connections, and for streaming responses on [gateway](</docs/en/gateways>) connections reached through `ANTHROPIC_BASE_URL` or `ANTHROPIC_AWS_BASE_URL`; before v2.1.222 it didn’t run on those gateway connections, so the event-level watchdog could report a stall there even while keep-alive pings were arriving. For timeouts and how the timers interact, see [Streaming idle watchdogs](</docs/en/network-config#streaming-idle-watchdogs>) `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK`| Set to `1` to enable the byte-level streaming idle watchdog on Amazon Bedrock `vnd.amazon.eventstream` responses, which also enables the [first-byte deadline](</docs/en/network-config#streaming-idle-watchdogs>) on Bedrock streaming requests. Off by default. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS` `CLAUDE_ENABLE_STREAM_WATCHDOG`| Set to `0` to force-disable the event-level streaming idle watchdog, or set to `1` to force-enable it. When unset, the watchdog is on by default for all providers. Before v2.1.196, the unset default was server-controlled on the direct Anthropic API and off on other providers. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS`; for the other stall timers that run alongside this one, see [Streaming idle watchdogs](</docs/en/network-config#streaming-idle-watchdogs>) -`CLAUDE_ENV_FILE`| Path to a shell script whose contents Claude Code runs before each Bash command in the same shell process, so exports in the file are visible to the command. Use to persist virtualenv or conda activation across commands. Also populated dynamically by [SessionStart](</docs/en/hooks#persist-environment-variables>), [Setup](</docs/en/hooks#setup>), [CwdChanged](</docs/en/hooks#cwdchanged>), and [FileChanged](</docs/en/hooks#filechanged>) hooks +`CLAUDE_ENV_FILE`| Path to a shell script whose contents Claude Code runs before each Bash command in the same shell process, so exports in the file are visible to the command. Use to persist virtualenv or conda activation across commands. PowerShell commands receive its variables too, in v2.1.296 or later, under the conditions in [Persisted variables in PowerShell commands](</docs/en/hooks#persisted-variables-in-powershell-commands>). Also populated dynamically by [SessionStart](</docs/en/hooks#persist-environment-variables>), [Setup](</docs/en/hooks#setup>), [CwdChanged](</docs/en/hooks#cwdchanged>), and [FileChanged](</docs/en/hooks#filechanged>) hooks `CLAUDE_JOB_DIR`| Set by Claude Code in each [background session](</docs/en/agent-view>) to that session’s `~/.claude/jobs/<id>` directory. Shell commands that the session runs inherit it. Write scratch files to [`$CLAUDE_JOB_DIR/tmp`](</docs/en/agent-view#where-state-is-stored>). Claude’s `Write` and `Edit` calls there don’t prompt for permission, and the directory is removed when the session is deleted `CLAUDE_PID`| Claude Code sets this to its own process ID in the subprocesses it spawns: Bash and PowerShell tool commands and hook commands. On Linux, the Bash tool’s shell integration uses it to refuse a `pkill` pattern that would match the Claude Code process itself; see [the error reference](</docs/en/errors#pkill-pattern-matches-the-claude-code-process>). Read it from your own scripts to identify or signal the parent Claude Code process deliberately. Requires Claude Code v2.1.214 or later `CLAUDE_REMOTE_CONTROL_SESSION_NAME_PREFIX`| Prefix for auto-generated [Remote Control](</docs/en/remote-control>) session names when no explicit name is provided. Defaults to your machine’s hostname, producing names like `myhost-graceful-unicorn`. The `--remote-control-session-name-prefix` CLI flag sets the same value for a single invocation
modified
--- a/env-vars.md +++ b/env-vars.md @@ -17,7 +17,7 @@ ​ -In your shell +Set variables in your shell Set the variable before launching `claude`: @@ -60,7 +60,7 @@ ​ -In settings files +Set variables in settings files Add variables under the `env` key in a `settings.json` file, creating the file if it doesn’t exist. Claude Code reads them directly from the file, so they take effect no matter how `claude` was launched. A running session applies new and changed values to its environment when you save the file, but a feature that reads its variables once at startup, such as [OpenTelemetry monitoring](</docs/en/monitoring-usage>), keeps its startup values until you relaunch. Removing a variable from the file doesn’t unset it in a running session; the removal takes effect the next time you launch `claude`. @@ -90,7 +90,7 @@ Precedence -Some behaviors have both an environment variable and a dedicated settings key, and which one Claude Code reads first differs per key. For `ANTHROPIC_MODEL` and `CLAUDE_CODE_AUTO_CONNECT_IDE`, Claude Code reads the variable first and uses the `model` or `autoConnectIde` setting only when the variable is unset. For the pair you’re setting, check the variable’s row below and the key’s entry on the [settings reference](</docs/en/settings-reference>). When the same variable is set in both your shell and a settings file `env` block, the settings file value applies in most sessions. Claude Code writes each `env` entry into the process environment, replacing the value inherited from the shell. [How `env` values interact with your shell](</docs/en/settings-reference#how-env-values-interact-with-your-shell>) covers the sessions that keep the inherited value instead, and the [`env` setting](</docs/en/settings-reference#when-claude-code-applies-env-values>) says when it applies them. A few variables are special-cased; the [`env` setting](</docs/en/settings-reference#env>) lists the exceptions. In a settings file you can set a variable but you can’t remove one. To override a variable you can’t unset, such as a stale `CLAUDE_CODE_USE_VERTEX` exported by a shell profile you don’t control, set it to an empty string in the `env` block: `"CLAUDE_CODE_USE_VERTEX": ""`. Claude Code treats the empty value as unset for provider selection. Subprocesses still inherit the empty value. Between settings files, `env` values follow [settings precedence](</docs/en/settings#settings-precedence>), so a managed settings entry overrides the same variable in user or project settings. Project and local settings can’t set some variables, such as `CLAUDE_CONFIG_DIR` and the OpenTelemetry exporter variables. [Variables Claude Code ignores in `env`](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) lists them, along with the OpenTelemetry off values that still apply. How an environment variable interacts with CLI flags and in-session commands varies per feature: `--model` and `/model` override `ANTHROPIC_MODEL`, while `CLAUDE_CODE_EFFORT_LEVEL` overrides `--effort` and `/effort`. When a variable interacts with another configuration source, its row in the Variables list states the precedence or links to the page that documents it. Claude Code reads shell environment variables at startup, so changes to them take effect the next time you launch `claude`. Variables set under the `env` key in settings files are reapplied to a running session when the file changes, with the startup-only exception described in In settings files. +Some behaviors have both an environment variable and a dedicated settings key, and which one Claude Code reads first differs per key. For `ANTHROPIC_MODEL` and `CLAUDE_CODE_AUTO_CONNECT_IDE`, Claude Code reads the variable first and uses the `model` or `autoConnectIde` setting only when the variable is unset. For the pair you’re setting, check the variable’s row below and the key’s entry on the [settings reference](</docs/en/settings-reference>). When the same variable is set in both your shell and a settings file `env` block, the settings file value applies in most sessions. Claude Code writes each `env` entry into the process environment, replacing the value inherited from the shell. [How `env` values interact with your shell](</docs/en/settings-reference#how-env-values-interact-with-your-shell>) covers the sessions that keep the inherited value instead, and the [`env` setting](</docs/en/settings-reference#when-claude-code-applies-env-values>) says when it applies them. A few variables are special-cased; the [`env` setting](</docs/en/settings-reference#env>) lists the exceptions. In a settings file you can set a variable but you can’t remove one. To override a variable you can’t unset, such as a stale `CLAUDE_CODE_USE_VERTEX` exported by a shell profile you don’t control, set it to an empty string in the `env` block: `"CLAUDE_CODE_USE_VERTEX": ""`. Claude Code treats the empty value as unset for provider selection. Subprocesses still inherit the empty value. Between settings files, `env` values follow [settings precedence](</docs/en/settings#settings-precedence>), so a managed settings entry overrides the same variable in user or project settings. Project and local settings can’t set some variables, such as `CLAUDE_CONFIG_DIR` and the OpenTelemetry exporter variables. [Variables Claude Code ignores in `env`](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) lists them, along with the OpenTelemetry off values that still apply. How an environment variable interacts with CLI flags and in-session commands varies per feature: `--model` and `/model` override `ANTHROPIC_MODEL`, while `CLAUDE_CODE_EFFORT_LEVEL` overrides `--effort` and `/effort`. When a variable interacts with another configuration source, its row in the Variables list states the precedence or links to the page that documents it. Claude Code reads shell environment variables at startup, so changes to them take effect the next time you launch `claude`. Variables set under the `env` key in settings files are reapplied to a running session when the file changes, with the startup-only exception described in Set variables in settings files. ## @@ -261,6 +261,7 @@ `CLAUDE_CODE_ENABLE_AUTO_MODE`| Accepted for compatibility with older releases and has no effect. Auto mode is available by default on every provider, including Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and signed-in [Claude apps gateway](</docs/en/claude-apps-gateway>) sessions. In v2.1.158 through v2.1.206, setting this to `1` was required to make [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) available on those providers `CLAUDE_CODE_ENABLE_AWAY_SUMMARY`| Override [session recap](</docs/en/interactive-mode#session-recap>) availability. Set to `0` to force recaps off regardless of the `/config` toggle. Set to `1` to force recaps on when [`awaySummaryEnabled`](</docs/en/settings-reference#awaysummaryenabled>) is `false`. Takes precedence over the setting and `/config` toggle `CLAUDE_CODE_ENABLE_BACKGROUND_PLUGIN_REFRESH`| Set to `1` to refresh plugin state at turn boundaries in [non-interactive mode](</docs/en/headless>) after a background install completes. Off by default because the refresh changes the system prompt mid-session, which invalidates [prompt caching](</docs/en/prompt-caching>) for that turn +`CLAUDE_CODE_ENABLE_CFC`| Set to `1` to start a CLI session with [Chrome integration](</docs/en/chrome>) on, or `0` to start with it off. Takes precedence over the [`claudeInChromeDefaultEnabled`](</docs/en/settings-reference#claudeinchromedefaultenabled>) setting. The `--chrome` and `--no-chrome` flags take precedence over both. Claude Code [ignores `1` in project and local settings](</docs/en/chrome#project-settings-can%E2%80%99t-turn-on-chrome>) `CLAUDE_CODE_ENABLE_FEEDBACK_SURVEY_FOR_OTEL`| Set to `1` to route the “How is Claude doing?” session quality survey to your own [OpenTelemetry collector](</docs/en/monitoring-usage>) when Anthropic-bound nonessential traffic is blocked. Survey ratings are emitted only as OTEL events to your configured collector. No survey data is sent to Anthropic in this mode. Applies when `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`, `DISABLE_TELEMETRY`, or `DO_NOT_TRACK` is set, and has no effect otherwise. `CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY` and the organization product feedback policy take precedence `CLAUDE_CODE_ENABLE_FINE_GRAINED_TOOL_STREAMING`| Controls whether tool call inputs stream from the API as Claude generates them. With this off, a large tool input such as a long file write arrives only after Claude finishes generating it, which can look like it’s hanging. Enabled by default on the Anthropic API. On Amazon Bedrock and Google Cloud’s Agent Platform, enabled per model where the deployed container supports it. Set to `0` to opt out. Set to `1` to force on when routing through a proxy via `ANTHROPIC_BASE_URL`, `ANTHROPIC_VERTEX_BASE_URL`, or `ANTHROPIC_BEDROCK_BASE_URL`. Off by default on Microsoft Foundry and [gateway](</docs/en/llm-gateway>) connections `CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY`| Set to `1` to populate the `/model` picker from your gateway’s `/v1/models` endpoint when `ANTHROPIC_BASE_URL` points at an Anthropic-compatible gateway such as LiteLLM, Kong, or an internal proxy. Off by default because gateways backed by a shared API key would otherwise show every user every model the key can access. Discovered models are still filtered by an [`availableModels`](</docs/en/settings-reference#availablemodels>) allowlist the session receives; deliver the list through [MDM or a managed settings file](</docs/en/managed-settings#delivery-mechanisms>), since [server-managed delivery is not available on gateway configurations](</docs/en/server-managed-settings#platform-availability>) @@ -303,7 +304,7 @@ `CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSION`| Cap on [WebSearch](</docs/en/tools-reference#session-search-limit>) calls (default: 200). When Claude reaches the cap, further WebSearch calls return a notice telling it to continue with the information it already gathered. Accepts a positive whole number with no upper bound. Anything else is ignored and the default applies, so the cap can be raised but not turned off. Requires Claude Code v2.1.212 or later `CLAUDE_CODE_MCP_ALLOWLIST_ENV`| Set to `1` to spawn stdio MCP servers with only a safe baseline environment plus the server’s configured `env`, instead of inheriting your shell environment `CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS`| Elapsed time in milliseconds before a still-running MCP tool call [moves to a background task](</docs/en/mcp#automatic-backgrounding-of-long-tool-calls>) (default: 120000, or 2 minutes). Set to `0` to turn automatic backgrounding off. Requires Claude Code v2.1.212 or later -`CLAUDE_CODE_MCP_STARTUP_WAIT_MS`| How long in milliseconds the first turn of a [non-interactive](</docs/en/headless>) session waits for MCP servers that are still connecting, in place of the default [first-turn wait](</docs/en/agent-sdk/mcp#connection-timing>). When set, the wait covers every pending server. Set to `0` to skip the wait. A [`--permission-prompt-tool`](</docs/en/cli-reference#cli-flags>) server keeps its own `MCP_TIMEOUT` wait regardless of the value. Requires Claude Code v2.1.274 or later +`CLAUDE_CODE_MCP_STARTUP_WAIT_MS`| How long in milliseconds the first turn of a [non-interactive](</docs/en/headless>) session waits for MCP servers that are still connecting, in place of the default [first-turn wait](</docs/en/agent-sdk/mcp#connection-timing>). When set, the wait covers every pending server; in a [self-hosted environment](</docs/en/self-hosted-environments-configuration#connection-timing>), it changes only how long the wait lasts. Set to `0` to skip the wait. A [`--permission-prompt-tool`](</docs/en/cli-reference#cli-flags>) server keeps its own `MCP_TIMEOUT` wait regardless of the value. Requires Claude Code v2.1.274 or later `CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT`| Idle timeout in milliseconds for MCP tool calls. When a stdio, HTTP, SSE, WebSocket, or [claude.ai connector](</docs/en/mcp#use-mcp-servers-from-claude-ai>) MCP server sends no response and no progress notification for this long, the tool call aborts with an error instead of waiting for the overall `MCP_TOOL_TIMEOUT`. Overrides the per-transport defaults of 300000 (5 minutes) for network servers and 1800000 (30 minutes) for stdio servers. Set to `0` to disable the idle check. Values below 1000 are raised to one second, and the value is capped at the effective `MCP_TOOL_TIMEOUT`. A per-server `timeout` in `.mcp.json` of at least 1000 raises that server’s idle window to at least the `timeout` value. Doesn’t apply to IDE servers or SDK in-process servers. Requires Claude Code v2.1.187 or later. Before v2.1.203, stdio servers were exempt from the idle timeout `CLAUDE_CODE_MESSAGING_SOCKET`| Set by Claude Code, not by you: in sessions that bind an [inbox socket](</docs/en/cross-session-messaging#the-sessions-inbox-socket>), Claude Code exports that socket’s path to hooks and Bash commands when it binds the socket. In a session that starts with messaging on, Claude Code binds the socket before any hook runs. Other sessions on the machine deliver messages to this path. Each session exports its own socket rather than one inherited from a parent, and messages arriving on it go through the session’s [inbound controls](</docs/en/cross-session-messaging#control-inbound-messages>). Settings `env` blocks can’t set it. Requires Claude Code v2.1.224 or later `CLAUDE_CODE_MESSAGING_TOKEN`| Set by Claude Code, not by you: in sessions that bind an [inbox socket](</docs/en/cross-session-messaging#the-sessions-inbox-socket>), Claude Code exports this per-session token to hooks and Bash commands alongside `CLAUDE_CODE_MESSAGING_SOCKET`. A script posting to the socket can send `{"type":"auth","token":"<token>"}` as its first line to prove it belongs to the session. On native Windows, Claude Code requires this line and closes any connection that doesn’t open with a valid one. The [own-child rules](</docs/en/cross-session-messaging#the-sessions-inbox-socket>) say when Claude Code consults the token. Each session exports its own token, never one inherited from a parent session. Settings `env` blocks can’t set it. Requires Claude Code v2.1.228 or later
modified
--- a/env-vars.md +++ b/env-vars.md @@ -162,17 +162,17 @@ `API_FORCE_IDLE_TIMEOUT`| Override the 5-minute body idle timeout that aborts a streaming model response when no bytes arrive. Set to `0` to turn the timeout off, for example when a slow [gateway](</docs/en/llm-gateway>) or local model pauses longer than 5 minutes between chunks, or `1` to keep it on for every provider. When unset, the timeout is active on providers other than the direct Anthropic API, [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), and Amazon Bedrock with `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK=1` set. The [stream watchdogs](</docs/en/network-config#streaming-idle-watchdogs>) run independently of it and abort a long silent pause even when you set `0` here `API_TIMEOUT_MS`| Timeout for API requests in milliseconds (default: 600000, or 10 minutes; maximum: 2147483647). Increase this when requests time out on slow networks or when routing through a proxy. Values above the maximum overflow the underlying timer and cause requests to fail immediately `AWS_BEARER_TOKEN_BEDROCK`| Amazon Bedrock API key for authentication (see [Amazon Bedrock API keys](<https://aws.amazon.com/blogs/machine-learning/accelerate-ai-development-with-amazon-bedrock-api-keys/>)) -`BASH_DEFAULT_TIMEOUT_MS`| Default timeout for a foreground Bash or PowerShell tool command, in milliseconds (default: 120000, or 2 minutes). A default longer than 30 minutes also becomes the default [time limit for background commands](</docs/en/tools-reference#time-limit-for-background-commands>) in unattended sessions. The background time limit requires Claude Code v2.1.285 or later +`BASH_DEFAULT_TIMEOUT_MS`| Default timeout for a foreground Bash or PowerShell tool command, in milliseconds (default: 120000, or 2 minutes). A value above the [default time limit for background commands](</docs/en/tools-reference#time-limit-for-background-commands>) replaces that default in unattended sessions. The background time limit requires Claude Code v2.1.285 or later `BASH_MAX_OUTPUT_LENGTH`| Maximum number of characters of bash output that Claude Code reads back into a command’s result (default: 30000; maximum: 150000). If you set the [`bashOutputMaxChars`](</docs/en/settings-reference#bashoutputmaxchars>) setting, Claude Code ignores this variable. See [Output limits](</docs/en/tools-reference#output-limits>) `BASH_MAX_TIMEOUT_MS`| Maximum timeout the model can set for a foreground Bash or PowerShell tool command, in milliseconds (default: 600000, or 10 minutes). The effective ceiling is the larger of this and `BASH_DEFAULT_TIMEOUT_MS`. An effective ceiling longer than 2 hours also becomes the maximum [time limit for background commands](</docs/en/tools-reference#time-limit-for-background-commands>) in unattended sessions. The background time limit requires Claude Code v2.1.285 or later `BETA_TRACING_ENDPOINT`| OTLP/HTTP endpoint for [detailed beta tracing](</docs/en/monitoring-usage#traces-beta>): with `ENABLE_BETA_TRACING_DETAILED=1`, logs and traces go there instead of to the configured exporters. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) `CCR_FORCE_BUNDLE`| Set to `1` to force [`claude --cloud`](</docs/en/claude-code-on-the-web#send-local-repositories-without-github>) to bundle and upload your local repository instead of cloning from its remote `CLAUDECODE`| Set to `1` in subprocesses Claude Code spawns (Bash and PowerShell tools, tmux sessions, [hook](</docs/en/hooks>) commands, [status line](</docs/en/statusline>) commands, stdio [MCP server](</docs/en/mcp>) subprocesses). IDE extensions also set this in their integrated terminals. Use to detect when a script is running inside a subprocess spawned by Claude Code. To check whether the current process was spawned directly by a tool call or hook, rather than inside a stdio MCP server that Claude Code started, use `CLAUDE_CODE_CHILD_SESSION` instead -`CLAUDE_AFK_COUNTDOWN_MS`| How many milliseconds before auto-continue the on-screen countdown appears on an unanswered [`AskUserQuestion`](</docs/en/tools-reference>) dialog. Default `20000` (20 seconds), capped at the auto-continue timeout. Has no effect unless auto-continue is on; see the [`askUserQuestionTimeout`](</docs/en/settings-reference#askuserquestiontimeout>) setting and `CLAUDE_AFK_TIMEOUT_MS`. Requires Claude Code v2.1.198 or later -`CLAUDE_AFK_TIMEOUT_MS`| How many milliseconds of idle time before an unanswered [`AskUserQuestion`](</docs/en/tools-reference>) dialog auto-continues without you. Auto-continue is off by default; opt in with the [`askUserQuestionTimeout`](</docs/en/settings-reference#askuserquestiontimeout>) setting. This variable is an override for demos and automated tests: when set, it takes precedence over that setting and turns auto-continue on even when the setting is unset or `never`. Setting `0` doesn’t turn the timeout off; it closes the dialog immediately. In v2.1.198 and v2.1.199, auto-continue was on by default with a `60000` (60 seconds) timeout. Requires Claude Code v2.1.198 or later +`CLAUDE_AFK_COUNTDOWN_MS`| How many milliseconds before auto-continue the on-screen countdown appears on an unanswered [`AskUserQuestion`](</docs/en/tools-reference>) dialog. Default `20000` (20 seconds), capped at the auto-continue timeout. Has no effect unless auto-continue is on; see the [`askUserQuestionTimeout`](</docs/en/settings-reference#askuserquestiontimeout>) setting and `CLAUDE_AFK_TIMEOUT_MS`. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). Requires Claude Code v2.1.198 or later +`CLAUDE_AFK_TIMEOUT_MS`| How many milliseconds of idle time before an unanswered [`AskUserQuestion`](</docs/en/tools-reference>) dialog auto-continues without you. Auto-continue is off by default; opt in with the [`askUserQuestionTimeout`](</docs/en/settings-reference#askuserquestiontimeout>) setting. This variable is an override for demos and automated tests: when set, it takes precedence over that setting and turns auto-continue on even when the setting is unset or `never`. Setting `0` doesn’t turn the timeout off; it closes the dialog immediately. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). Before v2.1.200, auto-continue was on by default with a `60000` (60 seconds) timeout. Requires Claude Code v2.1.198 or later `CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS`| Set to `1` to disable all built-in [subagent](</docs/en/sub-agents>) types such as Explore and Plan. Only applies in non-interactive mode (the `-p` flag). Useful for SDK users who want a blank slate. This also removes `general-purpose`, the subagent Claude Code runs when an Agent tool call omits `subagent_type`. Such a call then fails with [`subagent_type is required`](</docs/en/errors#subagent-type-is-required>) `CLAUDE_AGENT_SDK_MCP_NO_PREFIX`| Set to `1` to skip the `mcp__<server>__` prefix on tool names from SDK-created MCP servers. Tools use their original names. SDK usage only -`CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS`| Stall timeout in milliseconds for subagents. Default `600000` (10 minutes); if you raise `CLAUDE_STREAM_IDLE_TIMEOUT_MS` while the stream watchdog is on, the default rises with it, as [Handle slow or stalled API responses](</docs/en/agent-sdk/typescript#handle-slow-or-stalled-api-responses>) describes. The timer resets on each streaming progress event; if no progress arrives within the window, Claude Code aborts the subagent and reports the stall to the parent +`CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS`| Stall timeout in milliseconds for subagents. Also covers [workflow agents](</docs/en/workflows#when-an-agent-stalls-and-restarts>) on Claude Code v2.1.286 or later. Default `600000` (10 minutes); if you raise `CLAUDE_STREAM_IDLE_TIMEOUT_MS` while the stream watchdog is on, the default rises with it, as [Handle slow or stalled API responses](</docs/en/agent-sdk/typescript#handle-slow-or-stalled-api-responses>) describes `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE`| Set the percentage (1-100) of the auto-compact window at which auto-compaction triggers. Use lower values like `50` to compact earlier; the variable can’t raise the threshold, so values above the default percentage are ignored. It applies only in sessions that [compact before the model’s context limit](</docs/en/model-config#context-window-and-auto-compaction>). Applies to both main conversations and subagents `CLAUDE_AUTO_BACKGROUND_TASKS`| Set to `1` to force-enable automatic backgrounding of long-running agent tasks. When enabled, subagents are moved to the background after running for approximately two minutes. Also enables [automatic backgrounding of long MCP tool calls](</docs/en/mcp#automatic-backgrounding-of-long-tool-calls>) in non-interactive mode on Claude Code v2.1.212 or later `CLAUDE_AX_PREPARK_MS`| In [screen reader mode](</docs/en/accessibility>), how many milliseconds Claude Code waits before it writes a new or changed line. Default `0`, so Claude Code doesn’t wait. Before v2.1.287, the default was `50`. Claude Code caps the wait at `5000`. Requires Claude Code v2.1.233 or later @@ -207,14 +207,14 @@ `CLAUDE_CODE_CONNECT_TIMEOUT_MS`| Removed in v2.1.186 and now a no-op. Previously set a separate timeout for the connect, TLS, and response-header phase of a streaming API request. Use `API_TIMEOUT_MS` for the per-request timeout. For the response-header phase of a streaming request, see `CLAUDE_STREAM_FIRST_BYTE_TIMEOUT_MS` `CLAUDE_CODE_DEBUG_LOGS_DIR`| Override the debug log file path. Despite the name, this is a file path, not a directory. Requires debug mode to be enabled separately via `--debug`, `/debug`, or the `DEBUG` environment variable: setting this variable alone does not enable logging. The [`--debug-file`](</docs/en/cli-reference#cli-flags>) flag does both at once. Defaults to `~/.claude/debug/<session-id>.txt` `CLAUDE_CODE_DEBUG_LOG_LEVEL`| Minimum log level written to the debug log file. Values: `verbose`, `debug` (default), `info`, `warn`, `error`. Set to `verbose` to include high-volume diagnostics like full status line command output, or raise to `error` to reduce noise -`CLAUDE_CODE_DISABLE_1M_CONTEXT`| Set to `1` to disable [1M context window](</docs/en/model-config#extended-context>) support. When set, 1M model variants are unavailable in the model picker, and Claude Code holds sessions on models with a native 1M window, such as [Sonnet 5.5](</docs/en/model-config#sonnet-5-5-and-sonnet-5-context-window>) and the Fable models, to a 200K window; see [Extended context](</docs/en/model-config#extended-context>) for how the hold is enforced. Useful for enterprise environments with compliance requirements. For its role in correcting the window for an unrecognized `[1m]` model ID, see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>) +`CLAUDE_CODE_DISABLE_1M_CONTEXT`| Set to `1` to turn off [1M context window](</docs/en/model-config#extended-context>) support. Claude Code removes `[1m]` model variants from the model picker and holds models that run with the 1M window by default to a 200K window. See [Turn off 1M context](</docs/en/model-config#turn-off-1m-context>). Useful for enterprise environments with compliance requirements. For its role in correcting the window for an unrecognized `[1m]` model ID, see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>) `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING`| Set to `1` to disable [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) on Opus 4.6 and Sonnet 4.6 and fall back to the fixed thinking budget controlled by `MAX_THINKING_TOKENS`. Has no effect on [Fable models](</docs/en/model-config#extended-thinking>), Sonnet 5 and later, Haiku 5.5, or Opus 4.7 and later, which always use adaptive reasoning `CLAUDE_CODE_DISABLE_ADMIN_ENV_UNION`| Set to `1` to stop Claude Code from merging [managed settings](</docs/en/managed-settings#precedence-within-the-managed-tier>) `env` blocks per key across admin sources, so only the highest-priority source’s whole `env` block applies, as before v2.1.223. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.223 or later `CLAUDE_CODE_DISABLE_ADVISOR_TOOL`| Set to `1` to disable the [advisor tool](</docs/en/advisor>). The `/advisor` command becomes unavailable, any configured `advisorModel` is ignored, and the `--advisor` flag is accepted but has no effect, so existing scripts that pass it continue to work without errors `CLAUDE_CODE_DISABLE_AGENT_VIEW`| Set to `1` to turn off [background agents and agent view](</docs/en/agent-view>): `claude agents`, `--bg`, `/background`, and the on-demand supervisor. Equivalent to the [`disableAgentView`](</docs/en/settings-reference#disableagentview>) setting `CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN`| Set to `1` to disable [fullscreen rendering](</docs/en/fullscreen>) and use the classic main-screen renderer. The conversation stays in your terminal’s native scrollback so `Cmd+f` and tmux copy mode work as usual. Takes precedence over `CLAUDE_CODE_NO_FLICKER` and the [`tui`](</docs/en/settings-reference#tui>) setting. You can also switch with `/tui default`. Does not apply to background sessions opened from [agent view](</docs/en/agent-view>), which always use fullscreen rendering `CLAUDE_CODE_DISABLE_ARTIFACT`| Set to `1` to turn off the [Artifact](</docs/en/artifacts>) tool, which publishes session output as a private web page on claude.ai. Once you set it, no settings file turns the tool back on. To turn the tool off from a settings file instead, set [`enableArtifact`](</docs/en/settings-reference#enableartifact>) to `false`; the deprecated [`disableArtifact`](</docs/en/settings-reference#disableartifact>) key also turns it off -`CLAUDE_CODE_DISABLE_ATTACHMENTS`| Set to `1` to disable attachment processing. File mentions with `@` syntax are sent as plain text instead of being expanded into file content +`CLAUDE_CODE_DISABLE_ATTACHMENTS`| Set to `1` to disable attachment processing. File mentions with `@` syntax are sent as plain text instead of being expanded into file content. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) `CLAUDE_CODE_DISABLE_AUTH_REFRESH_LOCK`| Set to `1` to make a Claude Code process run its [`gcpAuthRefresh`](</docs/en/settings-reference#gcpauthrefresh>) or [`awsAuthRefresh`](</docs/en/settings-reference#awsauthrefresh>) command itself instead of waiting while another process runs it. Requires Claude Code v2.1.286 or later `CLAUDE_CODE_DISABLE_AUTO_MEMORY`| Set to `1` to disable [auto memory](</docs/en/memory#auto-memory>). Set to `0` to force auto memory on even when `--bare` mode or [`autoMemoryEnabled: false`](</docs/en/settings-reference#automemoryenabled>) would otherwise disable it. When disabled, Claude does not create or load auto memory files `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 @@ -310,7 +310,7 @@ `CLAUDE_CODE_NATIVE_CURSOR`| Set to `1` to show the terminal’s own cursor at the input caret instead of a drawn block. The cursor respects the terminal’s blink, shape, and focus settings. Setting `0` reads the same as leaving the variable unset, so it doesn’t bring the drawn block back in a session where the terminal’s own cursor is already on `CLAUDE_CODE_NEW_INIT`| Set to `1` to make `/init` run an interactive setup flow. The flow asks which files to generate, including CLAUDE.md, skills, and hooks, before exploring the codebase and writing them. Without this variable, `/init` generates a CLAUDE.md automatically without prompting `CLAUDE_CODE_NONBLOCKING_STDOUT`| Set to `1` to write terminal output through a second non-blocking file descriptor, so a terminal that stops reading, such as a paused tmux control-mode pane or a stalled SSH connection, can’t freeze Claude Code mid-session. Applies on macOS, Linux, and WSL when stdout is a terminal. Requires Claude Code v2.1.261 or later -`CLAUDE_CODE_NONSTREAMING_TIMEOUT_RETRIES`| Limit how many times Claude Code re-sends a [non-streaming request](</docs/en/errors#streaming-response-ended-before-any-complete-data-was-received>) that times out. With `0`, the request fails on the first timeout. Unset by default, so `CLAUDE_CODE_MAX_RETRIES` limits these re-sends. See [Tune retry behavior](</docs/en/errors#tune-retry-behavior>) for the timeout. Requires Claude Code v2.1.285 or later +`CLAUDE_CODE_NONSTREAMING_TIMEOUT_RETRIES`| Limit how many times Claude Code re-sends a [non-streaming request](</docs/en/errors#streaming-response-ended-before-any-complete-data-was-received>) that times out. With `0`, the request fails on the first timeout. See [Tune retry behavior](</docs/en/errors#tune-retry-behavior>) for the timeout. Requires Claude Code v2.1.285 or later `CLAUDE_CODE_NO_FLICKER`| Set to `1` to enable [fullscreen rendering](</docs/en/fullscreen>), a research preview that reduces flicker and keeps memory flat in long conversations. Overrides the [`tui`](</docs/en/settings-reference#tui>) setting; you can also switch with `/tui fullscreen` `CLAUDE_CODE_OAUTH_REFRESH_TOKEN`| OAuth refresh token for Claude.ai authentication. When set, `claude auth login` exchanges this token directly instead of opening a browser. Requires `CLAUDE_CODE_OAUTH_SCOPES`. Useful for provisioning authentication in automated environments `CLAUDE_CODE_OAUTH_SCOPES`| Space-separated OAuth scopes the refresh token was issued with, such as `"user:profile user:inference user:sessions:claude_code"`. Required when `CLAUDE_CODE_OAUTH_REFRESH_TOKEN` is set @@ -321,6 +321,7 @@ `CLAUDE_CODE_OTEL_FLUSH_TIMEOUT_MS`| Timeout in milliseconds for flushing pending OpenTelemetry spans (default: 5000). See [Monitoring](</docs/en/monitoring-usage>) `CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS`| Interval for refreshing dynamic OpenTelemetry headers in milliseconds (default: 1740000 / 29 minutes). See [Dynamic headers](</docs/en/monitoring-usage#dynamic-headers>) `CLAUDE_CODE_OTEL_SHUTDOWN_TIMEOUT_MS`| Timeout in milliseconds for the OpenTelemetry exporter to finish on shutdown (default: 2000). Increase if metrics are dropped at exit. See [Monitoring](</docs/en/monitoring-usage>) +`CLAUDE_CODE_OVERLOADED_RETRY_BASE_DELAY_MS`| Starting delay in milliseconds, in place of the default 500, of the exponential backoff between [automatic retries](</docs/en/errors#tune-retry-behavior>) of a request that the API rejects with a `529` overloaded error. Raise it to spread the retries over a longer window when the API is at capacity. Give whole milliseconds from 500 to 32000 in plain digits; Claude Code treats any other value as unset. Has no effect when `CLAUDE_CODE_RETRY_WATCHDOG` is set to `1`, or when the rejected request was sent in [fast mode](</docs/en/fast-mode#handle-rate-limits>). Requires Claude Code v2.1.292 or later `CLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATE`| Set to `1` to let Claude Code run your package manager’s upgrade command in the background when a new version is available. Applies to Homebrew and WinGet installations. Other package managers continue to show the upgrade command without running it. See [Auto updates](</docs/en/setup#auto-updates>) `CLAUDE_CODE_PERFORCE_MODE`| Set to `1` to enable Perforce-aware write protection. When set, Edit, Write, and NotebookEdit fail with a `p4 edit <file>` hint if the target file lacks the owner-write bit, which Perforce clears on synced files until `p4 edit` opens them. This prevents Claude Code from bypassing Perforce change tracking `CLAUDE_CODE_PLUGIN_CACHE_DIR`| Override the plugins root directory. Despite the name, this sets the parent directory, not the cache itself: marketplaces and the plugin cache live in subdirectories under this path. Defaults to `~/.claude/plugins` @@ -331,7 +332,7 @@ `CLAUDE_CODE_PLUGIN_PREFER_HTTPS`| Set to `1` to clone GitHub `owner/repo` shorthand sources over HTTPS instead of SSH. Applies to plugin install and update, and to `/plugin marketplace add` and `update`. Useful in CI runners, containers, or any environment without a configured SSH key for `github.com` `CLAUDE_CODE_PLUGIN_SEED_DIR`| Path to one or more read-only plugin seed directories, separated by `:` on Unix or `;` on Windows. Use this to bundle a pre-populated plugins directory into a container image. Claude Code registers marketplaces from these directories at startup and uses pre-cached plugins without re-cloning. See [Pre-populate plugins for containers](</docs/en/plugins/org#seed-containers-and-ci>) `CLAUDE_CODE_POWERSHELL_RESPECT_EXECUTION_POLICY`| Set to `1` to stop Claude Code from passing `-ExecutionPolicy Bypass` when spawning PowerShell for tool calls, hooks, and status line commands, and respect the machine’s effective execution policy instead. By default Claude Code bypasses execution policy at process scope so `.ps1` scripts and module imports work on default-Restricted Windows installs. Process-scope bypass never overrides Group Policy `MachinePolicy` or `UserPolicy` regardless of this setting -`CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS`| Ceiling in milliseconds on idle waiting for background work, such as subagents and workflows, after the final turn in [non-interactive mode](</docs/en/headless#background-tasks-at-exit>) with the `-p` flag. Idle waiting starts over each time Claude takes a turn to handle a background result. Default: `600000`, or 10 minutes. When idle waiting reaches the ceiling, Claude Code stops waiting for the remaining background tasks and exits. Set to `0` to wait indefinitely. This cap is separate from the five-second grace period that applies to plain background shells. Requires Claude Code v2.1.182 or later +`CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS`| Ceiling in milliseconds on idle waiting for background work, such as subagents and workflows, after the final turn in [non-interactive mode](</docs/en/headless#background-tasks-at-exit>) with the `-p` flag. Idle waiting starts over each time Claude takes a turn to handle a background result. Default: `600000`, or 10 minutes. When idle waiting reaches the ceiling, Claude Code stops waiting for the remaining background tasks. A running background command that the main conversation started holds the run open past it. Set to `0` to wait indefinitely. Requires Claude Code v2.1.182 or later `CLAUDE_CODE_PROCESS_WRAPPER`| Launch the processes Claude Code starts from its own binary, such as the background service that hosts [agent view](</docs/en/agent-view>) sessions, through a corporate launcher given as an argv prefix like `/opt/corp/launcher`. Set it in the `env` block of user or [managed settings](</docs/en/managed-settings>), not as a shell export, so the detached background service inherits it; project and local settings can’t set it. Equivalent to the [`processWrapper` setting](</docs/en/settings-reference#processwrapper>), which requires Claude Code v2.1.210 or later; this variable takes precedence when both are set. The VS Code extension configures its own launcher separately through its `claudeProcessWrapper` setting. Ignored on Windows. See [Run Claude Code behind a corporate launcher](</docs/en/corporate-launcher>) for the value format, what the launcher covers, and the contract the launcher must satisfy. Requires Claude Code v2.1.208 or later `CLAUDE_CODE_PROJECT_DIR_NAME`| Set together with `CLAUDE_CONFIG_DIR` to choose the `projects/` directory name Claude Code stores that session’s transcripts and auto memory under, in place of one derived from the working directory path. For example, starting Claude Code with `CLAUDE_CONFIG_DIR=/srv/tenant-a CLAUDE_CODE_PROJECT_DIR_NAME=work claude` stores them under `/srv/tenant-a/projects/work/`. Claude Code ignores this variable when `CLAUDE_CONFIG_DIR` is unset, and reads it only from the environment you start `claude` from, never from a settings file `env` block. See [Name the project directory yourself](</docs/en/sessions#name-the-project-directory-yourself>). Requires Claude Code v2.1.234 or later `CLAUDE_CODE_PROMPT_CACHE_TTL`| Set `5m` or `1h`, the only values Claude Code accepts, to choose the [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) for the main conversation: your interactive, `-p`, and SDK turns, plus the helpers that run inline with them. Takes precedence over the `promptCacheTtl` setting and over `ENABLE_PROMPT_CACHING_1H`, and `FORCE_PROMPT_CACHING_5M` overrides it. The API bills 1-hour cache writes at a higher rate. Requires Claude Code v2.1.242 or later @@ -345,6 +346,7 @@ `CLAUDE_CODE_RESUME_INTERRUPTED_TURN_MAX_AGE_MS`| Maximum age in milliseconds of the last transcript message for a session that ended mid-turn to continue automatically on resume. When the last message is older than this bound, Claude Code skips the `CLAUDE_CODE_RESUME_INTERRUPTED_TURN` automatic resume and its `CLAUDE_CODE_RESUME_PROMPT` continuation message, and the session starts idle so you continue explicitly. Unset or `0` means no bound, except that a turn whose last request failed with an API error resumes only while that error is less than six hours old. A positive value bounds every turn, including those; a negative or non-numeric value applies a one-hour bound. Spawn scripts for long-running agents can set this so a restart against an old transcript doesn’t re-run a stale prompt. Claude Code sets a one-hour bound itself when it restarts a crashed [agent view](</docs/en/agent-view>) session that inherited its conversation from an interactive session. Requires Claude Code v2.1.211 or later `CLAUDE_CODE_RESUME_PROMPT`| Override the continuation message Claude Code sends to Claude when `CLAUDE_CODE_RESUME_INTERRUPTED_TURN` continues an interrupted turn instead of resending its prompt, or when you resume a [deferred tool call](</docs/en/hooks#defer-a-tool-call-for-later>) with `-p`. Defaults to `Continue from where you left off.`. An empty string uses the default `CLAUDE_CODE_RETRY_WATCHDOG`| Set to `1` for unattended sessions such as eval harnesses, CI jobs, or remote workers. Retries `429` and `529` capacity errors indefinitely instead of failing after `CLAUDE_CODE_MAX_RETRIES` attempts. Claude Code fails at once when a standard-speed request gets a `429` that reports a spend limit or exhausted usage credits, even one from a [gateway spend cap](</docs/en/errors#spend-limit-reached>) that resets on a schedule. Before v2.1.239, the watchdog retried these indefinitely. For fast mode requests, see [Handle rate limits](</docs/en/fast-mode#handle-rate-limits>). The watchdog backs off up to 5 minutes between attempts, or until the limit resets when the response carries a rate-limit reset time, so a session that hits a usage limit waits out the remaining window. On v2.1.199 or later it also raises the default retry count for other transient errors, such as server errors, timeouts, and dropped connections, to 300, roughly three hours of backoff, and removes the cap of 15 on `CLAUDE_CODE_MAX_RETRIES` if you set that variable explicitly. Requires Claude Code v2.1.186 or later +`CLAUDE_CODE_RETRY_WATCHDOG_MAX_WAIT_MS`| Maximum time in milliseconds that each API request spends waiting out `429` and `529` errors when `CLAUDE_CODE_RETRY_WATCHDOG` is set. Once that time is spent, the next such error ends the request. Give a positive whole number in plain digits, such as `1800000` for 30 minutes. When unset, the wait has no limit. Requires Claude Code v2.1.295 or later `CLAUDE_CODE_SAFE_MODE`| Set to `1` to start in safe mode: CLAUDE.md, skills, plugins, hooks, MCP servers, custom commands and agents, output styles, workflows, custom themes, custom keybindings, status line and file-suggestion commands, LSP servers, and auto memory do not load, for troubleshooting a broken configuration. Managed settings policy still applies, including policy-configured hooks, status line, and file-suggestion commands; managed plugins, managed skills, managed CLAUDE.md, and policy-configured MCP servers do not. Equivalent to passing [`--safe-mode`](</docs/en/cli-reference#cli-flags>). Directly spawned child processes inherit the variable `CLAUDE_CODE_SCRIPT_CAPS`| JSON object limiting how many times specific scripts may be invoked per session when `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB` is set. Keys are substrings matched against the command text; values are integer call limits. For example, `{"deploy.sh": 2}` allows `deploy.sh` to be called at most twice. Matching is substring-based so shell-expansion tricks like `./scripts/deploy.sh $(evil)` still count against the cap. Runtime fan-out via `xargs` or `find -exec` is not detected; this is a defense-in-depth control `CLAUDE_CODE_SCROLL_SPEED`| Set the mouse wheel scroll multiplier in [fullscreen rendering](</docs/en/fullscreen#mouse-wheel-scrolling>). Accepts any positive value up to 20, including fractional values below 1 such as `0.5` to slow accelerated trackpad and wheel scrolling in terminals that already amplify wheel events. Set to `3` to match `vim` if your terminal sends one wheel event per notch without amplification. Ignored in the JetBrains IDE terminal, where Claude Code uses its own scroll handling @@ -384,7 +386,7 @@ `CLAUDE_CODE_TOOL_MEMORY_CGROUP_EXCLUDE`| On Linux and WSL, set to a comma-separated list of the kinds of processes Claude Code [excludes from the tool memory cap](</docs/en/tools-reference#memory-limit-on-linux-and-wsl>), such as `mcp` or `lsp`. Set `none` to cap every kind, or `all-new` to cap only Bash, PowerShell, and Monitor tool commands. Claude Code keeps Bash, PowerShell, and Monitor tool commands under the cap whatever you list. Requires Claude Code v2.1.246 or later `CLAUDE_CODE_TOOL_MEMORY_LIMIT`| On Linux and WSL, set to a size such as `4G` to [cap the memory that Bash and PowerShell tool commands can use](</docs/en/tools-reference#memory-limit-on-linux-and-wsl>), and Monitor tool commands on v2.1.246 or later. Write the size in plain digits, alone for a number of bytes or with a `K`, `M`, `G`, or `T` suffix. Set `0` or `off` to turn the cap off. Once the first process Claude Code starts has turned the cap on or off, a changed value takes effect the next time you launch `claude`. Requires Claude Code v2.1.233 or later `CLAUDE_CODE_TRANSCRIPT_LOCAL_GC`| Set to `1` to limit how large the [transcript file](</docs/en/sessions#where-transcripts-are-stored>) of a long `-p` or Agent SDK session grows. After each compaction, once the file is larger than 5 MB, Claude Code removes the history from before that compaction. Resuming the session restores the same conversation whether or not the file was trimmed. Set it in the environment you start Claude Code from, since a settings `env` block can’t turn it on. Requires Claude Code v2.1.287 or later -`CLAUDE_CODE_USER_DIALOG_TIMEOUT_MS`| Deadline in milliseconds before Claude Code cancels a dialog it forwards to a remote client such as a [Remote Control](</docs/en/remote-control>) or SDK host, or the approval dialog for a [held cross-session message](</docs/en/cross-session-messaging#control-inbound-messages>); permission prompts and `AskUserQuestion` questions use their own flows and aren’t governed by it. On Claude Code v2.1.236 or later, it also bounds the mid-session [Fable usage-credits consent prompt](</docs/en/model-config#fable-and-usage-credits>) in a session that may be running unattended. [Control inbound messages](</docs/en/cross-session-messaging#control-inbound-messages>) and [non-interactive sessions](</docs/en/cross-session-messaging#non-interactive-sessions>) cover the full held-message expiry rules, including the cases where the deadline doesn’t apply. Overrides the [`dialogExpiry`](</docs/en/settings-reference#dialogexpiry>) setting. `0` or a negative value disables the deadline +`CLAUDE_CODE_USER_DIALOG_TIMEOUT_MS`| Deadline in milliseconds before Claude Code cancels a dialog it forwards to a remote client such as a [Remote Control](</docs/en/remote-control>) or SDK host, or the approval dialog for a [held cross-session message](</docs/en/cross-session-messaging#control-inbound-messages>); permission prompts and `AskUserQuestion` questions use their own flows and aren’t governed by it. On Claude Code v2.1.236 or later, it also bounds the mid-session [Fable usage-credits consent prompt](</docs/en/model-config#fable-and-usage-credits>) in a session that may be running unattended. [Control inbound messages](</docs/en/cross-session-messaging#control-inbound-messages>) and [non-interactive sessions](</docs/en/cross-session-messaging#non-interactive-sessions>) cover the full held-message expiry rules, including the cases where the deadline doesn’t apply. Overrides the [`dialogExpiry`](</docs/en/settings-reference#dialogexpiry>) setting. `0` or a negative value disables the deadline. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) `CLAUDE_CODE_USE_ANTHROPIC_AWS`| Use [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) `CLAUDE_CODE_USE_BEDROCK`| Use [Amazon Bedrock](</docs/en/amazon-bedrock>) `CLAUDE_CODE_USE_FOUNDRY`| Use [Microsoft Foundry](</docs/en/microsoft-foundry>) @@ -549,7 +551,6 @@ * Use [the advisor tool](</docs/en/advisor#requirements>) * Read or reply to [comments on an artifact](</docs/en/artifacts#collect-comments-on-an-artifact>) * Have Claude read [another organization’s public artifact](</docs/en/artifacts#read-an-artifact-shared-with-you>) - * Have Claude Code probe claude.ai connector servers for [MCP protocol revision 2026-07-28](</docs/en/mcp#mcp-client-runtimes>) unless you set `MCP_PROTOCOL_NEGOTIATION=auto` * Get the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) by default for claude.ai and Console accounts on Windows with Git Bash installed; Claude Code routes shell commands through Git Bash unless you set `CLAUDE_CODE_USE_POWERSHELL_TOOL=1`. On Windows without Git Bash, the tool stays on * Get [Claude-drafted feedback](</docs/en/tools-reference#sendfeedback-tool-behavior>), which Claude Code turns on through a fetched flag * Have Claude [treat large pastes as pasted rather than typed text](</docs/en/terminal-config#how-claude-treats-pasted-text>); the content behind a `[Pasted text #N]` placeholder reaches Claude unmarked
modified
Show diff (120 lines)
--- a/env-vars.md +++ b/env-vars.md @@ -73,7 +73,7 @@ } } -The file you choose controls who the variables apply to: +Claude Code copies these values into its environment as written. No shell processes them, so shorthand such as `~` or `$HOME` stays as typed. For a variable that takes a path, such as `CLAUDE_CONFIG_DIR`, write the absolute path: `"CLAUDE_CONFIG_DIR": "/home/you/.claude-work"`. The file you choose controls who the variables apply to: File| Applies to ---|--- @@ -194,7 +194,7 @@ `CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the [auto-compact window](</docs/en/model-config#set-the-auto-compact-window>) in tokens, from `100000` to `1000000`. Accepts a plain integer such as `500000` only: a value like `500k` reads as `500` and clamps to the 100K minimum. The effective window is also capped at the model’s context window. Takes precedence over the `/autocompact` command, the `--autocompact` flag, and the `autoCompactWindow` setting. The status line’s `used_percentage` always measures against the model’s full context window, so once this variable is set, that percentage no longer indicates when compaction will run `CLAUDE_CODE_AUTO_CONNECT_IDE`| Override automatic [IDE connection](</docs/en/vs-code>). By default, Claude Code connects automatically when launched inside a supported IDE’s integrated terminal. Set to `false` to prevent this. Set to `true` to force a connection attempt when auto-detection fails, such as when tmux obscures the parent terminal. Takes precedence over the [`autoConnectIde`](</docs/en/settings-reference#autoconnectide>) global config setting `CLAUDE_CODE_AUTO_MODE_SERVER`| Controls whether Claude Code asks the server to [review auto mode actions](</docs/en/permission-modes#server-side-classifier-review>). Set to `0` to use Claude Code’s own classifier requests instead. On a direct connection to the Anthropic API, requires v2.1.281 or later. The linked section lists which sessions ask the server when the variable is unset, and from which version. Requires Claude Code v2.1.271 or later -`CLAUDE_CODE_AWS_CHAIN_RESOLVE_TIMEOUT_MS`| Time in milliseconds Claude Code waits for the AWS default credential provider chain to produce credentials before the request fails with [`AWS default-chain credential resolve timed out`](</docs/en/errors#aws-default-chain-credential-resolve-timed-out>) (default: `60000`). Raise it when a step in your chain legitimately needs longer, such as a browser-based SSO sign-in with MFA through a wrapper like `aws-vault`. Applies wherever Claude Code signs with the default chain: [Amazon Bedrock](</docs/en/amazon-bedrock#credential-caching-and-resolution-timeout>), [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), and the [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>). Requires Claude Code v2.1.207 or later +`CLAUDE_CODE_AWS_CHAIN_RESOLVE_TIMEOUT_MS`| Time in milliseconds Claude Code waits for the AWS default credential provider chain to produce credentials before the request fails with [`AWS default-chain credential resolve timed out`](</docs/en/errors#aws-default-chain-credential-resolve-timed-out>) (default: `60000`). Raise it when a step in your chain legitimately needs longer, such as a browser-based SSO sign-in with MFA through a wrapper like `aws-vault`. Applies on Amazon Bedrock, [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), and the [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>). See [credential caching and resolution timeout](</docs/en/amazon-bedrock#credential-caching-and-resolution-timeout>). Requires Claude Code v2.1.207 or later `CLAUDE_CODE_BASH_EDIT_DIFF`| Set to `0` to turn off the [diff of the files that changed while a Bash command ran](</docs/en/hooks#bash>), or `1` to record it in every permission mode. Takes precedence over the [`bashEditDiffEnabled`](</docs/en/settings-reference#basheditdiffenabled>) setting. Requires Claude Code v2.1.269 or later `CLAUDE_CODE_BG_TASKS_REPORT_RUNNING`| Set to `0` to make a non-interactive session report an idle status to its host at every turn end, even while background work is still running. By default, the session keeps reporting a running status past turn end while background work such as a background agent or a [workflow](</docs/en/workflows>) run is still live. This keeps a host that watches the status, such as a remote session list, from announcing that Claude is waiting for your input mid-work. Background shell commands, such as a dev server, don’t hold the running status. The running-status default and the `0` opt-out require Claude Code v2.1.269 or later; on earlier versions, set `1` to hold the running status `CLAUDE_CODE_BRIDGE_SESSION_ID`| Set automatically in Bash tool and [hook command](</docs/en/hooks>) subprocesses while the session has an active [Remote Control](</docs/en/remote-control>) connection, and removed when the connection ends. The value is the session’s ID in `session_` form, the same identifier that appears in the session’s `claude.ai/code` URL, so a script can link back to the session that ran it. Requires Claude Code v2.1.199 or later. In [cloud sessions](</docs/en/claude-code-on-the-web>), read `CLAUDE_CODE_REMOTE_SESSION_ID` instead @@ -208,7 +208,7 @@ `CLAUDE_CODE_DEBUG_LOGS_DIR`| Override the debug log file path. Despite the name, this is a file path, not a directory. Requires debug mode to be enabled separately via `--debug`, `/debug`, or the `DEBUG` environment variable: setting this variable alone does not enable logging. The [`--debug-file`](</docs/en/cli-reference#cli-flags>) flag does both at once. Defaults to `~/.claude/debug/<session-id>.txt` `CLAUDE_CODE_DEBUG_LOG_LEVEL`| Minimum log level written to the debug log file. Values: `verbose`, `debug` (default), `info`, `warn`, `error`. Set to `verbose` to include high-volume diagnostics like full status line command output, or raise to `error` to reduce noise `CLAUDE_CODE_DISABLE_1M_CONTEXT`| Set to `1` to disable [1M context window](</docs/en/model-config#extended-context>) support. When set, 1M model variants are unavailable in the model picker, and Claude Code holds sessions on models with a native 1M window, such as [Sonnet 5.5](</docs/en/model-config#sonnet-5-5-and-sonnet-5-context-window>) and the Fable models, to a 200K window; see [Extended context](</docs/en/model-config#extended-context>) for how the hold is enforced. Useful for enterprise environments with compliance requirements. For its role in correcting the window for an unrecognized `[1m]` model ID, see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>) -`CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING`| Set to `1` to disable [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) on Opus 4.6 and Sonnet 4.6 and fall back to the fixed thinking budget controlled by `MAX_THINKING_TOKENS`. Has no effect on [Fable models](</docs/en/model-config#extended-thinking>), Sonnet 5 and later, or Opus 4.7 and later, which always use adaptive reasoning +`CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING`| Set to `1` to disable [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) on Opus 4.6 and Sonnet 4.6 and fall back to the fixed thinking budget controlled by `MAX_THINKING_TOKENS`. Has no effect on [Fable models](</docs/en/model-config#extended-thinking>), Sonnet 5 and later, Haiku 5.5, or Opus 4.7 and later, which always use adaptive reasoning `CLAUDE_CODE_DISABLE_ADMIN_ENV_UNION`| Set to `1` to stop Claude Code from merging [managed settings](</docs/en/managed-settings#precedence-within-the-managed-tier>) `env` blocks per key across admin sources, so only the highest-priority source’s whole `env` block applies, as before v2.1.223. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.223 or later `CLAUDE_CODE_DISABLE_ADVISOR_TOOL`| Set to `1` to disable the [advisor tool](</docs/en/advisor>). The `/advisor` command becomes unavailable, any configured `advisorModel` is ignored, and the `--advisor` flag is accepted but has no effect, so existing scripts that pass it continue to work without errors `CLAUDE_CODE_DISABLE_AGENT_VIEW`| Set to `1` to turn off [background agents and agent view](</docs/en/agent-view>): `claude agents`, `--bg`, `/background`, and the on-demand supervisor. Equivalent to the [`disableAgentView`](</docs/en/settings-reference#disableagentview>) setting @@ -250,7 +250,7 @@ `CLAUDE_CODE_DISABLE_STRUCTURED_OUTPUTS`| Set to `1` to stop Claude Code from sending the structured-output `output_config.format` field and the `anthropic-beta` value that pairs with it, for an [LLM gateway](</docs/en/llm-gateway-protocol#feature-pass-through>) whose upstream rejects them. This leaves on the other pre-release capabilities that [`CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`](</docs/en/llm-gateway-protocol#disable-pre-release-capabilities>) turns off. Requires Claude Code v2.1.288 or later `CLAUDE_CODE_DISABLE_SUBSTITUTION_RM_PROMPT`| Set to `1` to turn off the [critical-path](</docs/en/permission-modes#critical-paths>) check for a recursive `rm` whose target is entirely the output of a command substitution, such as `rm -rf "$(pwd)"`. The other critical-path checks keep running. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.281 or later `CLAUDE_CODE_DISABLE_TERMINAL_TITLE`| Set to `1` to disable automatic terminal title updates based on conversation context. This also skips the background small/fast-model request that [generates a session title](</docs/en/sessions#name-your-sessions>) -`CLAUDE_CODE_DISABLE_THINKING`| Set to `1` to omit the `thinking` parameter from API requests entirely. This is a compatibility option for proxies and gateways that reject the parameter. On models that think by default, omitting the parameter means the model may still think. To explicitly disable [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) on the Anthropic API, use `MAX_THINKING_TOKENS=0` instead. Neither variable turns thinking off on Opus 5.5, Sonnet 5.5, or the Fable models, which can’t have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `MAX_THINKING_TOKENS=0` likewise omits the parameter, so the two variables behave the same there +`CLAUDE_CODE_DISABLE_THINKING`| Set to `1` to omit the `thinking` parameter from API requests entirely. This is a compatibility option for proxies and gateways that reject the parameter. On models that think by default, omitting the parameter means the model may still think. To explicitly disable [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) on the Anthropic API, use `MAX_THINKING_TOKENS=0` instead. Neither variable turns thinking off on Opus 5.5, Sonnet 5.5, Haiku 5.5, or the Fable models, which can’t have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `MAX_THINKING_TOKENS=0` likewise omits the parameter, so the two variables behave the same there `CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT`| Set to `1` to skip proactive [auto-compaction](</docs/en/costs#reduce-token-usage>) when Claude Code doesn’t recognize the model ID, such as an [LLM gateway](</docs/en/llm-gateway>) alias. Without this variable, Claude Code compacts at the context window it assumes for the ID. `CLAUDE_CODE_MAX_CONTEXT_TOKENS` can correct the assumed window instead; see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>) for when each variable applies. Requires Claude Code v2.1.223 or later `CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL`| Set to `1` to disable virtual scrolling in [fullscreen rendering](</docs/en/fullscreen>) and render every message in the transcript. Use this if scrolling in fullscreen mode shows blank regions where messages should appear `CLAUDE_CODE_DISABLE_WEB_FETCH`| Set to `1` to turn off the [WebFetch](</docs/en/tools-reference#webfetch-tool-behavior>) tool. The [WebSearch](</docs/en/tools-reference#websearch-tool-behavior>) tool stays available. Requires Claude Code v2.1.285 or later @@ -276,6 +276,7 @@ `CLAUDE_CODE_FORCE_SESSION_PERSISTENCE`| Set to `1` to force transcript persistence, prompt history, and `claude agents` registration even when this `claude` was launched from inside another Claude Code session. Use when an inherited `CLAUDE_CODE_CHILD_SESSION` value, for example from a `screen` session or a background launcher first started by Claude Code’s Bash tool, causes a genuine top-level session to be misclassified as nested. As of v2.1.178, Claude Code detects the tmux case automatically and ignores the inherited marker, so tmux no longer needs this variable. Also honored on v2.1.169 and earlier; has no effect on v2.1.170 and v2.1.171, where the nested-session detection it overrides was removed `CLAUDE_CODE_FORCE_STRIKETHROUGH`| Set to `1` to force strikethrough rendering for `~~text~~` in Claude’s responses when your terminal supports it but is not auto-detected, such as over SSH without `TERM_PROGRAM` forwarded. Without this, undetected terminals show the literal `~~` markers instead of rendering the text as strikethrough. Requires Claude Code v2.1.186 or later `CLAUDE_CODE_FORCE_SYNC_OUTPUT`| Set to `1` to force-enable DEC private mode 2026 [synchronized output](<https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036>) when your terminal supports it but is not auto-detected. Useful for emulators such as Emacs `eat` that implement BSU/ESU but do not reply to the capability probe. Has no effect under tmux. Unlike `CLAUDE_CODE_NO_FLICKER`, which switches to [fullscreen rendering](</docs/en/fullscreen>), this doesn’t change the renderer +`CLAUDE_CODE_FORCE_TERMINAL_IMAGES`| Set to `1` to draw [mod `Image` elements](</docs/en/plugins/mods/reference#elements>) as pictures when your terminal draws kitty graphics protocol images with Unicode placeholders but is not auto-detected. See [which terminals Claude Code detects](</docs/en/plugins/mods/gallery#image-and-client>) and why it doesn’t help inside tmux or screen `CLAUDE_CODE_FORK_SUBAGENT`| Controls [fork mode](</docs/en/sub-agents#turn-fork-mode-on-or-off>), which lets Claude spawn [forked subagents](</docs/en/sub-agents#fork-the-current-conversation>) itself and is on by default in interactive sessions only. Set to `1` to turn it on in `claude -p` and the Agent SDK as well, or `0` to turn it off in every kind of session. You can run `/subtask` whether or not fork mode is on. The interactive default requires Claude Code v2.1.232 or later; on earlier versions, set the variable to `1` to turn fork mode on `CLAUDE_CODE_FORWARD_SUBAGENT_TEXT`| Set to `1` to emit [subagent](</docs/en/sub-agents>) text and thinking blocks in `claude -p --output-format stream-json` output, the same behavior as the [`--forward-subagent-text`](</docs/en/cli-reference#cli-flags>) flag. Use the variable when a harness invokes `claude` and can’t pass the flag itself. Unlike the flag, which exits with an error outside non-interactive mode with stream-json output, the variable is ignored there so that nested invocations keep working when it’s set process-wide. Requires Claude Code v2.1.211 or later `CLAUDE_CODE_GATEWAY_HINT_HEADERS`| Set to `1` to send the [gateway hint headers](</docs/en/llm-gateway-protocol#gateway-hint-headers>), such as `x-claude-code-request-class` and `x-claude-code-compaction`, on a custom proxy or a third-party provider such as Amazon Bedrock or Claude Platform on AWS. Set to `0` to stop sending them on every connection, including a direct connection to the Anthropic API, where Claude Code sends them by default. Requires Claude Code v2.1.273 or later @@ -299,14 +300,14 @@ `CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH`| Number of [subagent layers](</docs/en/sub-agents#let-subagents-spawn-their-own-subagents>) allowed below the main conversation (default: 3). At the default, subagents can spawn their own subagents, and a subagent at the third layer can’t spawn further; set `1` to turn nesting off. In v2.1.217 through v2.1.218, the default was 1, so a subagent couldn’t spawn its own unless you raised the limit; v2.1.219 raised the default to 3. Accepts a positive whole number in plain digits; anything else is ignored, so the limit can be adjusted but not removed. Requires Claude Code v2.1.217 or later `CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY`| Maximum number of read-only tools and subagents that can execute in parallel (default: 10). Higher values increase parallelism but consume more resources `CLAUDE_CODE_MAX_TURNS`| Cap the number of agentic turns when no explicit limit is passed. Equivalent to passing [`--max-turns`](</docs/en/cli-reference#cli-flags>), which takes precedence when both are set. A value that is not a positive integer is rejected at startup with an error rather than treated as no cap -`CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSION`| Cap on the total number of [WebSearch](</docs/en/tools-reference#websearch-tool-behavior>) calls one session can make (default: 200). When Claude reaches the cap, further WebSearch calls return a notice telling it to continue with the information it already gathered. Accepts a positive whole number with no upper bound. Anything else is ignored and the default applies, so the cap can be raised but not turned off. Requires Claude Code v2.1.212 or later +`CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSION`| Cap on [WebSearch](</docs/en/tools-reference#session-search-limit>) calls (default: 200). When Claude reaches the cap, further WebSearch calls return a notice telling it to continue with the information it already gathered. Accepts a positive whole number with no upper bound. Anything else is ignored and the default applies, so the cap can be raised but not turned off. Requires Claude Code v2.1.212 or later `CLAUDE_CODE_MCP_ALLOWLIST_ENV`| Set to `1` to spawn stdio MCP servers with only a safe baseline environment plus the server’s configured `env`, instead of inheriting your shell environment `CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS`| Elapsed time in milliseconds before a still-running MCP tool call [moves to a background task](</docs/en/mcp#automatic-backgrounding-of-long-tool-calls>) (default: 120000, or 2 minutes). Set to `0` to turn automatic backgrounding off. Requires Claude Code v2.1.212 or later `CLAUDE_CODE_MCP_STARTUP_WAIT_MS`| How long in milliseconds the first turn of a [non-interactive](</docs/en/headless>) session waits for MCP servers that are still connecting, in place of the default [first-turn wait](</docs/en/agent-sdk/mcp#connection-timing>). When set, the wait covers every pending server. Set to `0` to skip the wait. A [`--permission-prompt-tool`](</docs/en/cli-reference#cli-flags>) server keeps its own `MCP_TIMEOUT` wait regardless of the value. Requires Claude Code v2.1.274 or later `CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT`| Idle timeout in milliseconds for MCP tool calls. When a stdio, HTTP, SSE, WebSocket, or [claude.ai connector](</docs/en/mcp#use-mcp-servers-from-claude-ai>) MCP server sends no response and no progress notification for this long, the tool call aborts with an error instead of waiting for the overall `MCP_TOOL_TIMEOUT`. Overrides the per-transport defaults of 300000 (5 minutes) for network servers and 1800000 (30 minutes) for stdio servers. Set to `0` to disable the idle check. Values below 1000 are raised to one second, and the value is capped at the effective `MCP_TOOL_TIMEOUT`. A per-server `timeout` in `.mcp.json` of at least 1000 raises that server’s idle window to at least the `timeout` value. Doesn’t apply to IDE servers or SDK in-process servers. Requires Claude Code v2.1.187 or later. Before v2.1.203, stdio servers were exempt from the idle timeout `CLAUDE_CODE_MESSAGING_SOCKET`| Set by Claude Code, not by you: in sessions that bind an [inbox socket](</docs/en/cross-session-messaging#the-sessions-inbox-socket>), Claude Code exports that socket’s path to hooks and Bash commands when it binds the socket. In a session that starts with messaging on, Claude Code binds the socket before any hook runs. Other sessions on the machine deliver messages to this path. Each session exports its own socket rather than one inherited from a parent, and messages arriving on it go through the session’s [inbound controls](</docs/en/cross-session-messaging#control-inbound-messages>). Settings `env` blocks can’t set it. Requires Claude Code v2.1.224 or later `CLAUDE_CODE_MESSAGING_TOKEN`| Set by Claude Code, not by you: in sessions that bind an [inbox socket](</docs/en/cross-session-messaging#the-sessions-inbox-socket>), Claude Code exports this per-session token to hooks and Bash commands alongside `CLAUDE_CODE_MESSAGING_SOCKET`. A script posting to the socket can send `{"type":"auth","token":"<token>"}` as its first line to prove it belongs to the session. On native Windows, Claude Code requires this line and closes any connection that doesn’t open with a valid one. The [own-child rules](</docs/en/cross-session-messaging#the-sessions-inbox-socket>) say when Claude Code consults the token. Each session exports its own token, never one inherited from a parent session. Settings `env` blocks can’t set it. Requires Claude Code v2.1.228 or later -`CLAUDE_CODE_NATIVE_CURSOR`| Set to `1` to show the terminal’s own cursor at the input caret instead of a drawn block. The cursor respects the terminal’s blink, shape, and focus settings +`CLAUDE_CODE_NATIVE_CURSOR`| Set to `1` to show the terminal’s own cursor at the input caret instead of a drawn block. The cursor respects the terminal’s blink, shape, and focus settings. Setting `0` reads the same as leaving the variable unset, so it doesn’t bring the drawn block back in a session where the terminal’s own cursor is already on `CLAUDE_CODE_NEW_INIT`| Set to `1` to make `/init` run an interactive setup flow. The flow asks which files to generate, including CLAUDE.md, skills, and hooks, before exploring the codebase and writing them. Without this variable, `/init` generates a CLAUDE.md automatically without prompting `CLAUDE_CODE_NONBLOCKING_STDOUT`| Set to `1` to write terminal output through a second non-blocking file descriptor, so a terminal that stops reading, such as a paused tmux control-mode pane or a stalled SSH connection, can’t freeze Claude Code mid-session. Applies on macOS, Linux, and WSL when stdout is a terminal. Requires Claude Code v2.1.261 or later `CLAUDE_CODE_NONSTREAMING_TIMEOUT_RETRIES`| Limit how many times Claude Code re-sends a [non-streaming request](</docs/en/errors#streaming-response-ended-before-any-complete-data-was-received>) that times out. With `0`, the request fails on the first timeout. Unset by default, so `CLAUDE_CODE_MAX_RETRIES` limits these re-sends. See [Tune retry behavior](</docs/en/errors#tune-retry-behavior>) for the timeout. Requires Claude Code v2.1.285 or later @@ -353,7 +354,7 @@ `CLAUDE_CODE_SHELL`| Set the shell Claude Code uses to run Bash tool commands. Accepts a path to a `bash` or `zsh` binary, for example `/opt/homebrew/bin/bash`. Other shells such as `fish` are not supported. If the value is not a working `bash` or `zsh` path, Claude Code ignores it and falls back to auto-detection. Auto-detection uses your `$SHELL` when it points to `bash` or `zsh`, otherwise it picks the first working `zsh` then `bash` found on your `PATH` and standard install locations `CLAUDE_CODE_SHELL_PREFIX`| Command prefix that wraps shell commands Claude Code spawns: Bash tool calls, [hook](</docs/en/hooks>) commands, [status line](</docs/en/statusline>) commands, and stdio [MCP server](</docs/en/mcp>) startup commands. PowerShell hooks and exec-form hooks run without the prefix. Useful for logging or auditing. Setting a bare executable path such as `/path/to/logger.sh` runs each command as `/path/to/logger.sh '<command>'`. The wrapper receives the command line as a single shell-quoted argument in `$1`, so the wrapper must re-evaluate `$1` with a shell, for example `exec bash -c "$1"`. Treating `$1` as a bare executable path breaks stdio MCP servers that pass arguments such as `npx -y <package>`. For Bash tool calls, `$1` contains the full shell invocation Claude Code assembles, including environment setup, not only the command Claude ran `CLAUDE_CODE_SIMPLE`| Set to `1` to run with a minimal system prompt and only the Bash, file read, and file edit tools. MCP tools from `--mcp-config` are still available. Disables auto-discovery of hooks, skills, custom commands, subagents, installed plugins, MCP servers, auto memory, and CLAUDE.md. Skills in a directory you pass with `--add-dir` still load. OAuth tokens and keychain credentials are not read, so Anthropic authentication must come from `ANTHROPIC_API_KEY` or an `apiKeyHelper` in `--settings`. Equivalent to passing [`--bare`](</docs/en/headless#start-faster-with-bare-mode>) -`CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT`| Set to `1` to use a shorter system prompt and abbreviated tool descriptions on any model. Set to `0`, `false`, `no`, or `off` to opt out even on models where the experiment or server configuration would otherwise enable it. The full tool set, hooks, MCP servers, and CLAUDE.md discovery remain enabled +`CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT`| Choose between Claude Code’s full system prompt and a shorter one with abbreviated tool descriptions. When unset, Haiku 4.5, Sonnet 5, Opus 4.7, and earlier models in those families use the full prompt by default, and newer models use the shorter one. Set to `1` to use the shorter prompt on any model. Set to `0`, `false`, `no`, or `off` to use the full prompt on any model, even where an experiment or server configuration would otherwise select the shorter one. Either prompt keeps the full tool set, hooks, MCP servers, and CLAUDE.md discovery `CLAUDE_CODE_SKIP_ANTHROPIC_AWS_AUTH`| Skip client-side authentication for [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), for gateways that sign requests themselves `CLAUDE_CODE_SKIP_AWS_CRED_CACHE`| Set to `1` to turn off the in-process cache of credentials resolved from the AWS default credential provider chain, so Claude Code resolves the chain on every API request. With the cache off, an SSO-backed profile requests credentials from IAM Identity Center on every request. See [credential caching and resolution timeout](</docs/en/amazon-bedrock#credential-caching-and-resolution-timeout>). Requires Claude Code v2.1.207 or later `CLAUDE_CODE_SKIP_BEDROCK_AUTH`| Skip AWS authentication for Amazon Bedrock (for example, when using an LLM gateway) @@ -372,7 +373,7 @@ `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB`| Set to `1` to strip credentials from the environments of the subprocesses Claude Code starts, such as Bash commands, hooks, and stdio MCP servers. The scrub recognizes a credential by its variable name or its value, and it leaves GitHub tokens and proxy settings in place. See What the subprocess environment scrub removes. `claude-code-action` sets this automatically when `allowed_non_write_users` is configured `CLAUDE_CODE_SYNC_PLUGIN_INSTALL`| Set to `1` in non-interactive mode (the `-p` flag) to wait for plugin installation to complete before the first query. Without this, plugins install in the background and may not be available on the first turn. Combine with `CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS` to bound the wait `CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS`| Timeout in milliseconds for synchronous plugin installation. When exceeded, Claude Code proceeds without plugins and logs an error. No default: without this variable, synchronous installation waits until complete -`CLAUDE_CODE_SYNC_SKILLS`| Set to `1` in non-interactive mode with the `-p` flag to make Claude Code download the skills enabled for your claude.ai account in that run and wait for the list of them, up to `CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS`, before it runs the first query. The downloads themselves finish in the background, and Claude waits for a skill’s download when it invokes that skill. Requires claude.ai authentication. Terminal sessions where you sign in with your claude.ai account [download these skills](</docs/en/skills#where-synced-skills-load>) into `~/.claude/skills/synced/` and resync about every 10 minutes without this variable, so set it only when a `-p` run needs your current skills on its first query. Before v2.1.273, terminal sessions downloaded them only in a `-p` run with this variable set. The `synced` folder name is [reserved for this download](</docs/en/skills#where-skills-live>). Before v2.1.227, the skills downloaded into `~/.claude/skills/` directly. Claude Code applies [extra rules to the downloaded skills](</docs/en/skills#how-synced-skills-behave>), such as not running their `!` commands on your machine +`CLAUDE_CODE_SYNC_SKILLS`| Set to `1` in non-interactive mode with the `-p` flag to make Claude Code download the skills enabled for your claude.ai account in that run and wait for the list of them, up to `CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS`, before it runs the first query. Requires claude.ai authentication. Terminal sessions where you sign in with your claude.ai account [sync these skills](</docs/en/skills#where-synced-skills-load>) without this variable, so set it only when a `-p` run needs your current skills on its first query `CLAUDE_CODE_SYNC_SKILLS_INSTALL_TIMEOUT_MS`| Timeout in milliseconds for the skills resync that runs mid-session when an app built on the [Agent SDK](</docs/en/agent-sdk/typescript#query-object>) reloads skills (default: 30000). When exceeded, the reload continues with whichever skills have arrived, and the remaining downloads finish in the background `CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS`| Timeout in milliseconds for the first query to wait for the initial skill list when `CLAUDE_CODE_SYNC_SKILLS` is set (default: 5000). When exceeded, the first query runs with whichever skills have arrived. The downloads finish in the background either way, and Claude waits for a skill’s download when it invokes that skill `CLAUDE_CODE_SYNTAX_HIGHLIGHT`| Set to `false` to disable syntax highlighting in diff output. Useful when colors interfere with your terminal setup. To also disable highlighting in code blocks and file previews, use the [`syntaxHighlightingDisabled`](</docs/en/settings-reference#syntaxhighlightingdisabled>) setting @@ -393,10 +394,11 @@ `CLAUDE_CODE_USE_VERTEX`| Use [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>) `CLAUDE_CODE_WEBFETCH_CACHE_TTL_MS`| Set to the number of milliseconds [WebFetch](</docs/en/tools-reference#webfetch-tool-behavior>) keeps each fetched URL’s response cached. The default is `900000`, which is 15 minutes. Takes plain digits only; `0`, a decimal, or any other spelling keeps the default. Claude Code reads the value once per launch, so a change in a settings `env` block applies when you next launch `claude`. Requires Claude Code v2.1.233 or later `CLAUDE_CODE_WEBFETCH_DEADLINE_MS`| Upper bound in milliseconds on how long [WebFetch](</docs/en/tools-reference#webfetch-tool-behavior>) waits for a page to download, including any redirects it follows. A download that hasn’t completed by then fails with a deadline error. The default is `300000`, which is five minutes. Set to `0` to remove the limit. Takes plain digits only; a decimal or any other spelling keeps the default. Requires Claude Code v2.1.268 or later +`CLAUDE_CODE_WEB_SEARCH_REFILLS_PER_HOUR`| Rate at which a session’s [WebSearch limit](</docs/en/tools-reference#session-search-limit>) refills, in calls per hour. The default is `100` in an interactive terminal session. In a [non-interactive](</docs/en/headless>) session the default is `0`, which turns refill off. Takes plain digits only; any other spelling reads as unset. Requires Claude Code v2.1.290 or later `CLAUDE_CODE_WORKER_CHECKIN_SCHEDULE`| When `CLAUDE_AUTO_BACKGROUND_TASKS` is set to `1`, how long Claude Code waits before each reminder to Claude to check on [background subagents](</docs/en/sub-agents#run-subagents-in-foreground-or-background>) that are still running. Takes one or more comma-separated waits in whole seconds from `1` to `86400`, such as `600` or `600,1800,3600`. Each value is the wait before the next reminder, and the last value repeats. Takes plain digits only; any other value or spelling reads as unset. When unset, there are no reminders. Requires Claude Code v2.1.283 or later `CLAUDE_CODE_WORKFLOW_MAX_CONCURRENT_AGENTS`| How many agents a single [workflow](</docs/en/workflows>) run executes at once, from `1` to `256`. By default, a run executes up to 16 agents at once, fewer when Claude Code has fewer CPUs available; queued `agent()` calls wait for a free slot. Each running agent’s transcript stays in Claude Code’s memory, so higher values raise memory use. Takes plain digits only; out-of-range values and other spellings keep the default. Requires Claude Code v2.1.269 or later `CLAUDE_CODE_WORKFLOW_PREFIX_STAGGER_MS`| Upper bound in milliseconds on how long a [workflow](</docs/en/workflows>) agent waits for a same-prefix sibling’s first response to begin before sending its own first request. When a fan-out starts several agents that share a [prompt-cache prefix](</docs/en/workflows#prompt-caching-in-a-fan-out>), Claude Code holds all but the first agent for up to this long so the rest read the cached prefix instead of each processing it uncached. Default `5000`. Set to `0` to disable the wait. When `DISABLE_PROMPT_CACHING` is set, agents never wait. Requires Claude Code v2.1.229 or later -`CLAUDE_CONFIG_DIR`| Override the configuration directory (default: `~/.claude`). All settings, session history, and plugins are stored under this path. For credentials, see [where Claude Code stores credentials](</docs/en/authentication#credential-management>). Useful for running multiple accounts side by side: for example, `alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'`. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) +`CLAUDE_CONFIG_DIR`| Override the configuration directory (default: `~/.claude`). All settings, session history, and plugins are stored under this path. For credentials, see [where Claude Code stores credentials](</docs/en/authentication#credential-management>). Useful for running multiple accounts side by side: for example, `alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'`. Set it in your shell, user settings, or managed settings. In a settings file, write the absolute path. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) `CLAUDE_DISABLE_ADOPT`| Set to `1` to stop in-flight background work instead of carrying it over when you background a session by pressing `←` or with [`/background`](</docs/en/agent-view#from-inside-a-session>). Claude Code asks you to confirm before backgrounding, then stops the tasks that would otherwise carry over. Requires Claude Code v2.1.195 or later `CLAUDE_EFFORT`| Set automatically in Bash tool subprocesses and hook commands to the [effort level](</docs/en/model-config#adjust-effort-level>) in effect when the subprocess starts: `low`, `medium`, `high`, `xhigh`, or `max`. Matches the `effort.level` field passed to [hooks](</docs/en/hooks>). Only set when the current model supports the effort parameter `CLAUDE_ENABLE_BYTE_WATCHDOG`| Set to `1` to force-enable the byte-level streaming idle watchdog, or set to `0` to force-disable it. `0` also turns off the [first-byte deadline](</docs/en/network-config#streaming-idle-watchdogs>) on the connections where that deadline runs. When unset, the watchdog is enabled by default for direct Anthropic API and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) connections, and for streaming responses on [gateway](</docs/en/gateways>) connections reached through `ANTHROPIC_BASE_URL` or `ANTHROPIC_AWS_BASE_URL`; before v2.1.222 it didn’t run on those gateway connections, so the event-level watchdog could report a stall there even while keep-alive pings were arriving. For timeouts and how the timers interact, see [Streaming idle watchdogs](</docs/en/network-config#streaming-idle-watchdogs>) @@ -447,7 +449,7 @@ `IS_DEMO`| Set to any non-empty value, such as `1`, to enable demo mode: hides your email and organization name from the header and `/status` output, and skips onboarding. **Setting it to`0` or `false` still enables demo mode**, unlike most on/off variables; unset the variable to turn it off. Useful when streaming or recording a session `MAX_MCP_OUTPUT_TOKENS`| Maximum number of tokens allowed in MCP tool responses (default: 25000). Claude Code displays a warning when output exceeds 10,000 tokens. Tools that declare [`anthropic/maxResultSizeChars`](</docs/en/mcp#raise-the-limit-for-a-specific-tool>) use that character limit for text content instead, but image content from those tools is still subject to this variable. A successful text result longer than 50,000 characters from a tool without that annotation is [saved to a file](</docs/en/mcp#mcp-output-limits-and-warnings>) regardless of this variable `MAX_STRUCTURED_OUTPUT_RETRIES`| Number of attempts Claude Code allows when the model’s response fails validation against the [`--json-schema`](</docs/en/cli-reference#cli-flags>) in non-interactive mode with the `-p` flag; after that many failed attempts with no valid output, the run fails. The same cap applies when a [workflow](</docs/en/workflows>) subagent’s structured output fails validation. Defaults to 5, a first attempt plus four retries -`MAX_THINKING_TOKENS`| Fixed token budget for [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>). Claude Code caps it at one token below the request’s max output tokens and never below 1,024. See `CLAUDE_CODE_MAX_OUTPUT_TOKENS` for how that limit is set. When unset and thinking is enabled, models with [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) choose their own thinking depth, and other models use the cap. Set to `0` to disable thinking on the Anthropic API, except on Opus 5.5, Sonnet 5.5, and the Fable models, which can’t have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `0` omits the `thinking` parameter instead. With thinking turned off on the Anthropic API, Claude Code sends effort `high` instead of a higher level to models it knows [don’t accept that combination](</docs/en/errors#effort-isnt-available-with-thinking-turned-off>), such as Opus 5. For a positive value, Claude Code ignores the number itself on adaptive reasoning models, except when `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` turns adaptive reasoning off +`MAX_THINKING_TOKENS`| Fixed token budget for [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>). Claude Code caps it at one token below the request’s max output tokens and never below 1,024. See `CLAUDE_CODE_MAX_OUTPUT_TOKENS` for how that limit is set. When unset and thinking is enabled, models with [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) choose their own thinking depth, and other models use the cap. Set to `0` to disable thinking on the Anthropic API, except on Opus 5.5, Sonnet 5.5, Haiku 5.5, and the Fable models, which can’t have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `0` omits the `thinking` parameter instead. With thinking turned off on the Anthropic API, Claude Code sends effort `high` instead of a higher level to models it knows [don’t accept that combination](</docs/en/errors#effort-isnt-available-with-thinking-turned-off>), such as Opus 5. For a positive value, Claude Code ignores the number itself on adaptive reasoning models, except when `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` turns adaptive reasoning off `MCP_CLIENT_SECRET`| OAuth client secret for MCP servers that require [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>). Avoids the interactive prompt when adding a server with `--client-secret` `MCP_CONNECTION_NONBLOCKING`| Controls whether startup waits for MCP servers to connect before the first query. MCP startup is non-blocking by default: servers connect in the background and their tools become available as they finish. Set to `0` to make Claude Code wait for servers to connect before the first query. Servers configured with [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>) still make startup wait regardless, except when served from the [discovery cache](</docs/en/mcp#server-status-detail>), since their tools must be present when the first prompt is built. In non-interactive mode (`-p`) without `--input-format stream-json`, Claude Code also waits for still-pending servers before the first turn regardless of this variable. When you pass [`--mcp-config`](</docs/en/cli-reference#cli-flags>) explicitly, the wait has a longer deadline; see that flag’s entry for the cached-server exception `MCP_CONNECT_TIMEOUT_MS`| How long blocking MCP startup waits, in milliseconds, for the connection batch before snapshotting the tool list (default: 5000). Applies when `MCP_CONNECTION_NONBLOCKING=0` or for servers marked [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>). Servers still pending at the deadline keep connecting in the background. Distinct from `MCP_TIMEOUT`, which bounds an individual server’s connect attempt @@ -498,6 +500,7 @@ `VERTEX_REGION_CLAUDE_FABLE_5`| Override region for Claude Fable 5 when using Google Cloud’s Agent Platform. Added in v2.1.170 `VERTEX_REGION_CLAUDE_FABLE_5_1`| Override region for Claude Fable 5.1 when using Google Cloud’s Agent Platform. Added in v2.1.257 `VERTEX_REGION_CLAUDE_HAIKU_4_5`| Override region for Claude Haiku 4.5 when using Google Cloud’s Agent Platform +`VERTEX_REGION_CLAUDE_HAIKU_5_5`| Override region for Claude Haiku 5.5 when using Google Cloud’s Agent Platform. Added in v2.1.293 Standard OpenTelemetry exporter variables (`OTEL_METRICS_EXPORTER`, `OTEL_LOGS_EXPORTER`, `OTEL_EXPORTER_OTLP_ENDPOINT`, `OTEL_EXPORTER_OTLP_PROTOCOL`, `OTEL_EXPORTER_OTLP_HEADERS`, `OTEL_METRIC_EXPORT_INTERVAL`, `OTEL_RESOURCE_ATTRIBUTES`, and signal-specific variants) are also supported. See [Monitoring](</docs/en/monitoring-usage>) for configuration details. Set `CLAUDE_CODE_ENABLE_TELEMETRY` and the OpenTelemetry variables that turn on export, choose its destination, or capture content in your shell, user settings, or managed settings. Claude Code [ignores them in project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>), apart from the off values that section describes. `OTEL_RESOURCE_ATTRIBUTES` and the export interval, timeout, and compression variables, such as `OTEL_METRIC_EXPORT_INTERVAL`, still apply from project and local settings. @@ -546,7 +549,7 @@ * Use [the advisor tool](</docs/en/advisor#requirements>) * Read or reply to [comments on an artifact](</docs/en/artifacts#collect-comments-on-an-artifact>) * Have Claude read [another organization’s public artifact](</docs/en/artifacts#read-an-artifact-shared-with-you>) - * Have Claude Code probe claude.ai connector servers or stdio servers for [MCP protocol revision 2026-07-28](</docs/en/mcp#mcp-client-runtimes>) unless you set `MCP_PROTOCOL_NEGOTIATION=auto` + * Have Claude Code probe claude.ai connector servers for [MCP protocol revision 2026-07-28](</docs/en/mcp#mcp-client-runtimes>) unless you set `MCP_PROTOCOL_NEGOTIATION=auto` * Get the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) by default for claude.ai and Console accounts on Windows with Git Bash installed; Claude Code routes shell commands through Git Bash unless you set `CLAUDE_CODE_USE_POWERSHELL_TOOL=1`. On Windows without Git Bash, the tool stays on * Get [Claude-drafted feedback](</docs/en/tools-reference#sendfeedback-tool-behavior>), which Claude Code turns on through a fetched flag * Have Claude [treat large pastes as pasted rather than typed text](</docs/en/terminal-config#how-claude-treats-pasted-text>); the content behind a `[Pasted text #N]` placeholder reaches Claude unmarked
modified
--- a/env-vars.md +++ b/env-vars.md @@ -324,6 +324,7 @@ `CLAUDE_CODE_PERFORCE_MODE`| Set to `1` to enable Perforce-aware write protection. When set, Edit, Write, and NotebookEdit fail with a `p4 edit <file>` hint if the target file lacks the owner-write bit, which Perforce clears on synced files until `p4 edit` opens them. This prevents Claude Code from bypassing Perforce change tracking `CLAUDE_CODE_PLUGIN_CACHE_DIR`| Override the plugins root directory. Despite the name, this sets the parent directory, not the cache itself: marketplaces and the plugin cache live in subdirectories under this path. Defaults to `~/.claude/plugins` `CLAUDE_CODE_PLUGIN_DIRS`| Plugin directories to load for the session, each loaded the way a [`--plugin-dir`](</docs/en/plugins/cli-reference#flags-that-load-a-plugin-for-one-session>) flag loads it. Separate multiple paths with `:` on Unix or `;` on Windows. Give each path as an absolute path or start it with `~`, because Claude Code skips relative paths. Requires Claude Code v2.1.280 or later. See [Load a plugin for one session](</docs/en/plugins/create#load-a-directory-or-archive-for-one-session>) +`CLAUDE_CODE_PLUGIN_DIR_WATCH`| Controls whether Claude Code reloads a [mod](</docs/en/plugins/mods/overview>) when the mod’s files change. Reloading applies to a mod you load from a directory with `--plugin-dir`, and it’s on by default in interactive sessions. Set to `1` to turn it on in non-interactive sessions as well, or `0` to turn it off in every session. Requires Claude Code v2.1.287 or later. See [mod settings and environment variables](</docs/en/plugins/mods/reference#settings-and-environment-variables>) `CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS`| Timeout in milliseconds for cloning or refreshing a plugin marketplace (default: 120000). Increase this value for large repositories or slow network connections. See [Git clone timed out](</docs/en/plugins/troubleshooting#git-clone-timed-out-after-120s>) `CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE`| Set to `1` to skip the re-clone attempt and keep using the existing marketplace checkout when a marketplace refresh can’t reach or authenticate to the remote. Useful in offline or airgapped environments where re-cloning would fail the same way. See [Marketplace updates fail in offline environments](</docs/en/plugins/troubleshooting#marketplace-updates-keep-failing-offline>) `CLAUDE_CODE_PLUGIN_PREFER_HTTPS`| Set to `1` to clone GitHub `owner/repo` shorthand sources over HTTPS instead of SSH. Applies to plugin install and update, and to `/plugin marketplace add` and `update`. Useful in CI runners, containers, or any environment without a configured SSH key for `github.com` @@ -506,7 +507,7 @@ What the subprocess environment scrub removes -When you set `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB` to `1`, Claude Code removes credentials from the environments of the subprocesses it starts, such as Bash commands, hooks, and stdio MCP servers. This reduces what a prompt injection attack can read through shell expansion. The Claude Code process keeps the credentials for its own API calls. The scrub recognizes a credential by its variable name or by the shape of its value, so use it as one layer alongside narrow [permission rules](</docs/en/permissions>) rather than as the only control. The table shows what the scrub does to example variables: +When you set `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB` to `1`, Claude Code removes credentials from the environments of the subprocesses it starts, such as Bash commands, hooks, and stdio MCP servers. This reduces what a prompt injection attack can read. The Claude Code process keeps the credentials for its own API calls. The scrub recognizes a credential by its variable name or by the shape of its value, so use it as one layer alongside narrow [permission rules](</docs/en/permissions>) rather than as the only control. The table shows what the scrub does to example variables: Example variable| What the scrub does ---|--- @@ -514,13 +515,13 @@ `NPM_TOKEN`, `DB_PASSWORD`| Removes it, because the name looks like a credential `DATABASE_URL` that contains a password| Removes it, because the value looks like a credential `PIP_INDEX_URL` or `NPM_CONFIG_REGISTRY` that contains a password| Keeps the URL and cuts the username and password from it -`CLAUDE_CONFIG_DIR`| Removes it. Requires Claude Code v2.1.251 or later +`CLAUDE_CONFIG_DIR`| Removes it `GITHUB_TOKEN`, `GH_TOKEN`, `GH_ENTERPRISE_TOKEN`, `GITHUB_ENTERPRISE_TOKEN`| Leaves it in place, so that `gh` and scripts that call the GitHub API keep working `HTTP_PROXY`, `HTTPS_PROXY`| Leaves it in place, including a [username and password in the URL](</docs/en/network-config#basic-authentication>). The [sandbox](</docs/en/sandboxing#network-isolation>) can set these variables itself for sandboxed commands `GIT_CONFIG_COUNT`, `GIT_CONFIG_KEY_<n>`, `GIT_CONFIG_VALUE_<n>`| Leaves it in place, whatever it holds A secret whose variable name and value don’t look like a credential| Leaves it in place -Because the scrub leaves `GITHUB_TOKEN` in place, give a GitHub Actions job the narrowest `permissions` it needs. To remove a GitHub token from sandboxed Bash commands, add a `deny` entry under [`sandbox.credentials`](</docs/en/sandboxing#protect-credentials>). Leave the scrub unset if a subprocess needs one of the removed variables. On Linux, the scrub also runs Bash subprocesses in an isolated PID namespace so they can’t read host process environments through `/proc`. As a side effect, `ps`, `pgrep`, and `kill` can’t see or signal host processes. +Because the scrub leaves `GITHUB_TOKEN` in place, give a GitHub Actions job the narrowest `permissions` it needs. To remove a GitHub token from sandboxed Bash commands, add a `deny` entry under [`sandbox.credentials`](</docs/en/sandboxing#protect-credentials>). Leave the scrub unset if a subprocess needs one of the removed variables. On Linux, the scrub also runs Bash subprocesses in an isolated PID namespace so they can’t read host process environments through `/proc`. As a side effect, `ps`, `pgrep`, and `kill` can’t see or signal host processes. Before v2.1.251, the scrub removed `ANTHROPIC_API_KEY` and `AWS_SECRET_ACCESS_KEY` and left the table’s other example variables unchanged. ##
modified
--- a/env-vars.md +++ b/env-vars.md @@ -165,7 +165,7 @@ `BASH_DEFAULT_TIMEOUT_MS`| Default timeout for a foreground Bash or PowerShell tool command, in milliseconds (default: 120000, or 2 minutes). A default longer than 30 minutes also becomes the default [time limit for background commands](</docs/en/tools-reference#time-limit-for-background-commands>) in unattended sessions. The background time limit requires Claude Code v2.1.285 or later `BASH_MAX_OUTPUT_LENGTH`| Maximum number of characters of bash output that Claude Code reads back into a command’s result (default: 30000; maximum: 150000). If you set the [`bashOutputMaxChars`](</docs/en/settings-reference#bashoutputmaxchars>) setting, Claude Code ignores this variable. See [Output limits](</docs/en/tools-reference#output-limits>) `BASH_MAX_TIMEOUT_MS`| Maximum timeout the model can set for a foreground Bash or PowerShell tool command, in milliseconds (default: 600000, or 10 minutes). The effective ceiling is the larger of this and `BASH_DEFAULT_TIMEOUT_MS`. An effective ceiling longer than 2 hours also becomes the maximum [time limit for background commands](</docs/en/tools-reference#time-limit-for-background-commands>) in unattended sessions. The background time limit requires Claude Code v2.1.285 or later -`BETA_TRACING_ENDPOINT`| OTLP endpoint for [detailed beta tracing](</docs/en/monitoring-usage#traces-beta>): with `ENABLE_BETA_TRACING_DETAILED=1`, logs and traces go there instead of to the configured exporters. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) +`BETA_TRACING_ENDPOINT`| OTLP/HTTP endpoint for [detailed beta tracing](</docs/en/monitoring-usage#traces-beta>): with `ENABLE_BETA_TRACING_DETAILED=1`, logs and traces go there instead of to the configured exporters. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) `CCR_FORCE_BUNDLE`| Set to `1` to force [`claude --cloud`](</docs/en/claude-code-on-the-web#send-local-repositories-without-github>) to bundle and upload your local repository instead of cloning from its remote `CLAUDECODE`| Set to `1` in subprocesses Claude Code spawns (Bash and PowerShell tools, tmux sessions, [hook](</docs/en/hooks>) commands, [status line](</docs/en/statusline>) commands, stdio [MCP server](</docs/en/mcp>) subprocesses). IDE extensions also set this in their integrated terminals. Use to detect when a script is running inside a subprocess spawned by Claude Code. To check whether the current process was spawned directly by a tool call or hook, rather than inside a stdio MCP server that Claude Code started, use `CLAUDE_CODE_CHILD_SESSION` instead `CLAUDE_AFK_COUNTDOWN_MS`| How many milliseconds before auto-continue the on-screen countdown appears on an unanswered [`AskUserQuestion`](</docs/en/tools-reference>) dialog. Default `20000` (20 seconds), capped at the auto-continue timeout. Has no effect unless auto-continue is on; see the [`askUserQuestionTimeout`](</docs/en/settings-reference#askuserquestiontimeout>) setting and `CLAUDE_AFK_TIMEOUT_MS`. Requires Claude Code v2.1.198 or later @@ -257,6 +257,7 @@ `CLAUDE_CODE_DISABLE_WINDOWS_SHELL_LAUNCHER`| Set to `1` to start [PowerShell tool](</docs/en/tools-reference#powershell-tool>) commands on Windows directly instead of through the `cmd.exe` launcher. By default, the launcher lets a PowerShell command [running in the background](</docs/en/tools-reference#background-commands>) [carry over to the session’s next process](</docs/en/agent-view#the-supervisor-process>), such as when you [background the session](</docs/en/agent-view#from-inside-a-session>). If you set the variable, a backgrounded PowerShell command stops when the session’s process exits. Bash commands aren’t affected. Requires Claude Code v2.1.269 or later `CLAUDE_CODE_DISABLE_WORKFLOWS`| Set to `1` to disable [workflows](</docs/en/workflows#turn-workflows-off>). Equivalent to the [`disableWorkflows`](</docs/en/settings-reference#disableworkflows>) setting `CLAUDE_CODE_EFFORT_LEVEL`| Set the effort level for supported models. Values: `low`, `medium`, `high`, `xhigh`, `max`, or `auto` to use the model default. Available levels depend on the model. Takes precedence over `--effort`, `/effort`, and the `modelSettings` and `effortLevel` settings. A [`maxEffortLevel`](</docs/en/settings-reference#maxeffortlevel>) cap still applies. See [Adjust effort level](</docs/en/model-config#adjust-effort-level>) +`CLAUDE_CODE_EMIT_SESSION_STATE_EVENTS`| Set to `1` to add [`session_state_changed`](</docs/en/agent-sdk/typescript#sdksessionstatechangedmessage>) messages, which carry the session’s state, to the message stream. Requires either the [Agent SDK](</docs/en/agent-sdk/overview>) or `--print`, `--output-format stream-json`, and `--verbose` `CLAUDE_CODE_ENABLE_AUTO_MODE`| Accepted for compatibility with older releases and has no effect. Auto mode is available by default on every provider, including Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and signed-in [Claude apps gateway](</docs/en/claude-apps-gateway>) sessions. In v2.1.158 through v2.1.206, setting this to `1` was required to make [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) available on those providers `CLAUDE_CODE_ENABLE_AWAY_SUMMARY`| Override [session recap](</docs/en/interactive-mode#session-recap>) availability. Set to `0` to force recaps off regardless of the `/config` toggle. Set to `1` to force recaps on when [`awaySummaryEnabled`](</docs/en/settings-reference#awaysummaryenabled>) is `false`. Takes precedence over the setting and `/config` toggle `CLAUDE_CODE_ENABLE_BACKGROUND_PLUGIN_REFRESH`| Set to `1` to refresh plugin state at turn boundaries in [non-interactive mode](</docs/en/headless>) after a background install completes. Off by default because the refresh changes the system prompt mid-session, which invalidates [prompt caching](</docs/en/prompt-caching>) for that turn @@ -284,6 +285,7 @@ `CLAUDE_CODE_GLOB_NO_IGNORE`| Set to `false` to make the [Glob tool](</docs/en/tools-reference#glob-tool-behavior>) respect `.gitignore` patterns. By default, Glob returns all matching files including gitignored ones. Does not affect `@` file autocomplete, which has its own [`respectGitignore` setting](</docs/en/settings-reference#respectgitignore>) `CLAUDE_CODE_GLOB_TIMEOUT_SECONDS`| Timeout in seconds for Glob tool file discovery. Defaults to 20 seconds on most platforms and 60 seconds on WSL `CLAUDE_CODE_GOAL_CHECKIN_MINUTES`| How many minutes background work can keep an active goal waiting before Claude Code [asks Claude to check on it](</docs/en/goal#background-work-defers-evaluation>). Default `30`. Set `0` to turn check-ins off. Give whole minutes in plain digits, at most `10080`, which is one week. Claude Code treats any other value as unset and uses the default. Requires Claude Code v2.1.234 or later +`CLAUDE_CODE_GZIP_REQUEST_BODIES`| Set to `0` to turn off gzip compression of Claude API, telemetry, and [artifact](</docs/en/artifacts>) publish request bodies sent to `api.anthropic.com`. By default, Claude Code compresses large request bodies on direct connections and skips compression when you send requests through a proxy, configure a client certificate, or set `NODE_EXTRA_CA_CERTS`. Use `0` if a [TLS-inspecting proxy](</docs/en/network-config#ca-certificate-store>) that Claude Code can’t detect mishandles compressed requests `CLAUDE_CODE_HIDE_CWD`| Set to `1` to hide the working directory in the startup logo. Useful for screenshares or recordings where the path exposes your OS username `CLAUDE_CODE_IDE_HOST_OVERRIDE`| Override the host address used to connect to the IDE extension. By default Claude Code auto-detects the correct address, including WSL-to-Windows routing `CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL`| Set to `1` to skip auto-installation of IDE extensions. Equivalent to setting [`autoInstallIdeExtension`](</docs/en/settings-reference#autoinstallideextension>) to `false` @@ -430,7 +432,7 @@ `DISABLE_UPDATES`| Set to `1` to block all updates including manual `claude update` and `claude install`. Stricter than `DISABLE_AUTOUPDATER`. Use when distributing Claude Code through your own channels and users should not self-update `DISABLE_UPGRADE_COMMAND`| Set to `1` to hide the `/upgrade` command `DO_NOT_TRACK`| Set to `1` to opt out of telemetry, with the same effect as `DISABLE_TELEMETRY`, including on feature-flag fetching. Claude Code reads this variable as a standard boolean, so `0` leaves telemetry on, and honors it as the cross-tool convention recognized by many developer CLIs -`ENABLE_BETA_TRACING_DETAILED`| Set to `1`, together with `BETA_TRACING_ENDPOINT`, to turn on [detailed beta tracing](</docs/en/monitoring-usage#traces-beta>), which adds content-bearing span attributes and the `claude_code.hook` span. Interactive CLI sessions also require your organization to be allowlisted for the beta. Both variables are ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) +`ENABLE_BETA_TRACING_DETAILED`| Set to `1`, and set `BETA_TRACING_ENDPOINT` to your OTLP/HTTP collector endpoint, to turn on [detailed beta tracing](</docs/en/monitoring-usage#traces-beta>), which adds content-bearing span attributes and the `claude_code.hook` span. Interactive CLI sessions also require your organization to be allowlisted for the beta. Both variables are ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) `ENABLE_CLAUDEAI_MCP_SERVERS`| Set to `false` to stop Claude Code from fetching [claude.ai MCP servers](</docs/en/mcp#use-mcp-servers-from-claude-ai>). Enabled by default for logged-in users. To disable per-project or per-org, set [`disableClaudeAiConnectors`](</docs/en/settings-reference#disableclaudeaiconnectors>) in settings instead `ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) instead of the default 5 minutes. Intended for API key, [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), [Microsoft Foundry](</docs/en/microsoft-foundry>), and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) users. Subscription users within included usage receive the 1-hour TTL automatically on the [main conversation](</docs/en/prompt-caching#which-ttl-each-request-gets>). Subscription users drawing on [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>) can set it to keep the 1-hour TTL. 1-hour cache writes are billed at a higher rate. To choose the TTL per request bucket instead, use `CLAUDE_CODE_PROMPT_CACHE_TTL` and `CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL`, which take precedence over this variable `ENABLE_PROMPT_CACHING_1H_BEDROCK`| Deprecated. Use `ENABLE_PROMPT_CACHING_1H` instead
modified
--- a/env-vars.md +++ b/env-vars.md @@ -327,7 +327,7 @@ `CLAUDE_CODE_PLUGIN_PREFER_HTTPS`| Set to `1` to clone GitHub `owner/repo` shorthand sources over HTTPS instead of SSH. Applies to plugin install and update, and to `/plugin marketplace add` and `update`. Useful in CI runners, containers, or any environment without a configured SSH key for `github.com` `CLAUDE_CODE_PLUGIN_SEED_DIR`| Path to one or more read-only plugin seed directories, separated by `:` on Unix or `;` on Windows. Use this to bundle a pre-populated plugins directory into a container image. Claude Code registers marketplaces from these directories at startup and uses pre-cached plugins without re-cloning. See [Pre-populate plugins for containers](</docs/en/plugins/org#seed-containers-and-ci>) `CLAUDE_CODE_POWERSHELL_RESPECT_EXECUTION_POLICY`| Set to `1` to stop Claude Code from passing `-ExecutionPolicy Bypass` when spawning PowerShell for tool calls, hooks, and status line commands, and respect the machine’s effective execution policy instead. By default Claude Code bypasses execution policy at process scope so `.ps1` scripts and module imports work on default-Restricted Windows installs. Process-scope bypass never overrides Group Policy `MachinePolicy` or `UserPolicy` regardless of this setting -`CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS`| Ceiling in milliseconds on idle waiting for background subagents and workflows after the final turn in [non-interactive mode](</docs/en/headless#background-tasks-at-exit>) with the `-p` flag. Idle waiting starts over each time Claude takes a turn to handle a background result. Default: `600000`, or 10 minutes. When idle waiting reaches the ceiling, Claude Code stops waiting for the remaining background tasks and exits. Set to `0` to wait indefinitely. This cap is separate from the five-second grace period that applies to plain background shells. Requires Claude Code v2.1.182 or later +`CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS`| Ceiling in milliseconds on idle waiting for background work, such as subagents and workflows, after the final turn in [non-interactive mode](</docs/en/headless#background-tasks-at-exit>) with the `-p` flag. Idle waiting starts over each time Claude takes a turn to handle a background result. Default: `600000`, or 10 minutes. When idle waiting reaches the ceiling, Claude Code stops waiting for the remaining background tasks and exits. Set to `0` to wait indefinitely. This cap is separate from the five-second grace period that applies to plain background shells. Requires Claude Code v2.1.182 or later `CLAUDE_CODE_PROCESS_WRAPPER`| Launch the processes Claude Code starts from its own binary, such as the background service that hosts [agent view](</docs/en/agent-view>) sessions, through a corporate launcher given as an argv prefix like `/opt/corp/launcher`. Set it in the `env` block of user or [managed settings](</docs/en/managed-settings>), not as a shell export, so the detached background service inherits it; project and local settings can’t set it. Equivalent to the [`processWrapper` setting](</docs/en/settings-reference#processwrapper>), which requires Claude Code v2.1.210 or later; this variable takes precedence when both are set. The VS Code extension configures its own launcher separately through its `claudeProcessWrapper` setting. Ignored on Windows. See [Run Claude Code behind a corporate launcher](</docs/en/corporate-launcher>) for the value format, what the launcher covers, and the contract the launcher must satisfy. Requires Claude Code v2.1.208 or later `CLAUDE_CODE_PROJECT_DIR_NAME`| Set together with `CLAUDE_CONFIG_DIR` to choose the `projects/` directory name Claude Code stores that session’s transcripts and auto memory under, in place of one derived from the working directory path. For example, starting Claude Code with `CLAUDE_CONFIG_DIR=/srv/tenant-a CLAUDE_CODE_PROJECT_DIR_NAME=work claude` stores them under `/srv/tenant-a/projects/work/`. Claude Code ignores this variable when `CLAUDE_CONFIG_DIR` is unset, and reads it only from the environment you start `claude` from, never from a settings file `env` block. See [Name the project directory yourself](</docs/en/sessions#name-the-project-directory-yourself>). Requires Claude Code v2.1.234 or later `CLAUDE_CODE_PROMPT_CACHE_TTL`| Set `5m` or `1h`, the only values Claude Code accepts, to choose the [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) for the main conversation: your interactive, `-p`, and SDK turns, plus the helpers that run inline with them. Takes precedence over the `promptCacheTtl` setting and over `ENABLE_PROMPT_CACHING_1H`, and `FORCE_PROMPT_CACHING_5M` overrides it. The API bills 1-hour cache writes at a higher rate. Requires Claude Code v2.1.242 or later @@ -442,7 +442,7 @@ `HTTP_PROXY`| Specify HTTP proxy server for network connections `HTTPS_PROXY`| Specify HTTPS proxy server for network connections `IS_DEMO`| Set to any non-empty value, such as `1`, to enable demo mode: hides your email and organization name from the header and `/status` output, and skips onboarding. **Setting it to`0` or `false` still enables demo mode**, unlike most on/off variables; unset the variable to turn it off. Useful when streaming or recording a session -`MAX_MCP_OUTPUT_TOKENS`| Maximum number of tokens allowed in MCP tool responses. Claude Code displays a warning when output exceeds 10,000 tokens. Tools that declare [`anthropic/maxResultSizeChars`](</docs/en/mcp#raise-the-limit-for-a-specific-tool>) use that character limit for text content instead, but image content from those tools is still subject to this variable (default: 25000) +`MAX_MCP_OUTPUT_TOKENS`| Maximum number of tokens allowed in MCP tool responses (default: 25000). Claude Code displays a warning when output exceeds 10,000 tokens. Tools that declare [`anthropic/maxResultSizeChars`](</docs/en/mcp#raise-the-limit-for-a-specific-tool>) use that character limit for text content instead, but image content from those tools is still subject to this variable. A successful text result longer than 50,000 characters from a tool without that annotation is [saved to a file](</docs/en/mcp#mcp-output-limits-and-warnings>) regardless of this variable `MAX_STRUCTURED_OUTPUT_RETRIES`| Number of attempts Claude Code allows when the model’s response fails validation against the [`--json-schema`](</docs/en/cli-reference#cli-flags>) in non-interactive mode with the `-p` flag; after that many failed attempts with no valid output, the run fails. The same cap applies when a [workflow](</docs/en/workflows>) subagent’s structured output fails validation. Defaults to 5, a first attempt plus four retries `MAX_THINKING_TOKENS`| Fixed token budget for [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>). Claude Code caps it at one token below the request’s max output tokens and never below 1,024. See `CLAUDE_CODE_MAX_OUTPUT_TOKENS` for how that limit is set. When unset and thinking is enabled, models with [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) choose their own thinking depth, and other models use the cap. Set to `0` to disable thinking on the Anthropic API, except on Opus 5.5, Sonnet 5.5, and the Fable models, which can’t have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `0` omits the `thinking` parameter instead. With thinking turned off on the Anthropic API, Claude Code sends effort `high` instead of a higher level to models it knows [don’t accept that combination](</docs/en/errors#effort-isnt-available-with-thinking-turned-off>), such as Opus 5. For a positive value, Claude Code ignores the number itself on adaptive reasoning models, except when `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` turns adaptive reasoning off `MCP_CLIENT_SECRET`| OAuth client secret for MCP servers that require [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>). Avoids the interactive prompt when adding a server with `--client-secret`
modified
Show diff (104 lines)
--- a/env-vars.md +++ b/env-vars.md @@ -190,7 +190,7 @@ `CLAUDE_CODE_ARTIFACT_COMMENTS`| Set to `0` to stop Claude reading and replying to [comments on an artifact](</docs/en/artifacts#collect-comments-on-an-artifact>). Has no effect when `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` has [turned artifacts off](</docs/en/artifacts#availability>). Requires Claude Code v2.1.221 or later `CLAUDE_CODE_ARTIFACT_COMMENTS_AUTOREACT`| Set to `0` to stop Claude [replying on its own to comments sent to it](</docs/en/artifacts#let-claude-reply-to-comments-on-its-own>). Requires Claude Code v2.1.228 or later `CLAUDE_CODE_ATTRIBUTION_HEADER`| Set to `0` to omit the [attribution block](</docs/en/llm-gateway-protocol#system-prompt-attribution-block>), which carries the client version and a prompt fingerprint, from the start of the system prompt. Caching on a direct connection to the Anthropic API is unaffected either way. In some direct-connection setups, Claude Code keeps the block on [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) classifier requests even when you set `0`. In [System prompt attribution block](</docs/en/llm-gateway-protocol#system-prompt-attribution-block>), check which connections and credentials this covers. Before v2.1.181 the block included a per-request token on custom base URLs and Microsoft Foundry connections, so on those versions set it to `0` when your LLM gateway caches on the request body or forwards requests to a third-party provider, or when you connect to Microsoft Foundry directly -`CLAUDE_CODE_AUTO_BACKGROUND_WORKER_CHECKIN_SECONDS`| When `CLAUDE_AUTO_BACKGROUND_TASKS` is enabled, seconds between reminders to Claude to check on [background subagents](</docs/en/sub-agents#run-subagents-in-foreground-or-background>) that are still running. Accepts a plain integer from `1` to `86400` only; any other value or spelling reads as unset. When unset, there are no check-in reminders. Requires Claude Code v2.1.248 or later +`CLAUDE_CODE_AUTO_BACKGROUND_WORKER_CHECKIN_SECONDS`| Removed in v2.1.283. Use `CLAUDE_CODE_WORKER_CHECKIN_SCHEDULE` instead `CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the [auto-compact window](</docs/en/model-config#set-the-auto-compact-window>) in tokens, from `100000` to `1000000`. Accepts a plain integer such as `500000` only: a value like `500k` reads as `500` and clamps to the 100K minimum. The effective window is also capped at the model’s context window. Takes precedence over the `/autocompact` command, the `--autocompact` flag, and the `autoCompactWindow` setting. The status line’s `used_percentage` always measures against the model’s full context window, so once this variable is set, that percentage no longer indicates when compaction will run `CLAUDE_CODE_AUTO_CONNECT_IDE`| Override automatic [IDE connection](</docs/en/vs-code>). By default, Claude Code connects automatically when launched inside a supported IDE’s integrated terminal. Set to `false` to prevent this. Set to `true` to force a connection attempt when auto-detection fails, such as when tmux obscures the parent terminal. Takes precedence over the [`autoConnectIde`](</docs/en/settings-reference#autoconnectide>) global config setting `CLAUDE_CODE_AUTO_MODE_SERVER`| Controls whether Claude Code asks the server to [review auto mode actions](</docs/en/permission-modes#server-side-classifier-review>). Set to `0` to use Claude Code’s own classifier requests instead. On a direct connection to the Anthropic API, requires v2.1.281 or later. The linked section lists which sessions ask the server when the variable is unset, and from which version. Requires Claude Code v2.1.271 or later @@ -233,6 +233,7 @@ `CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY`| Set to `1` to disable the “How is Claude doing?” session quality surveys. Surveys are also disabled when `DISABLE_TELEMETRY`, `DO_NOT_TRACK`, or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` is set, unless `CLAUDE_CODE_ENABLE_FEEDBACK_SURVEY_FOR_OTEL` opts back in. To set a sample rate instead of disabling outright, use the [`feedbackSurveyRate`](</docs/en/settings-reference#feedbacksurveyrate>) setting. See [Session quality surveys](</docs/en/data-usage#session-quality-surveys>) `CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING`| Set to `1` to disable file [checkpointing](</docs/en/checkpointing>). The `/rewind` command will not be able to restore code changes. Overrides the [`fileCheckpointingEnabled`](</docs/en/settings-reference#filecheckpointingenabled>) setting `CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS`| Set to `1` to remove built-in commit and PR workflow instructions and the git status snapshot from Claude’s context. Useful when using your own git workflow skills. Takes precedence over the [`includeGitInstructions`](</docs/en/settings-reference#includegitinstructions>) setting when set +`CLAUDE_CODE_DISABLE_INLINE_SHELL_RM_PROMPT`| Set to `1` to stop Claude Code from reading scripts passed to a shell with `-c`, such as `bash -c 'rm -rf ~'`, for [critical-path](</docs/en/permission-modes#removals-inside-nested-commands-and-inline-scripts>) removals. Claude Code still checks the shell variable and positional parameter targets in those scripts, and the other critical-path checks keep running. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.288 or later `CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP`| Set to `1` to prevent automatic remapping of Opus 4.0 and 4.1 to the current Opus version on the Anthropic API. Use when you intentionally want to pin an older model. The remap does not run on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry `CLAUDE_CODE_DISABLE_MODEL_ACCESS_FALLBACK`| Set to `1` to stop Claude Code on [Amazon Bedrock](</docs/en/amazon-bedrock#when-a-model-is-disabled-mid-session>) and [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai#when-a-model-is-disabled-mid-session>) from switching to an older model when your account loses access to a session’s model mid-session; the refused request fails at once instead. A [fallback model chain](</docs/en/model-config#fallback-model-chains>) you configure still switches on that refusal, and the [startup model checks](</docs/en/amazon-bedrock#startup-model-checks>) still fall back at launch. Requires Claude Code v2.1.285 or later `CLAUDE_CODE_DISABLE_MOUSE`| Set to `1` to disable mouse tracking in [fullscreen rendering](</docs/en/fullscreen>). Keyboard scrolling with `PgUp` and `PgDn` still works. Use this to keep your terminal’s native copy-on-select behavior @@ -245,6 +246,7 @@ `CLAUDE_CODE_DISABLE_PERMISSION_PROMPT_NOTIFY_HOOKS`| Set to `1` to stop Claude Code from running your [`Notification` hooks for unanswered permission requests](</docs/en/hooks#notification>) in sessions where Claude Code sends them to the Agent SDK’s `canUseTool` callback, which is how Claude Desktop and the VS Code extension host Claude Code. Has no effect in terminal sessions. Requires Claude Code v2.1.233 or later `CLAUDE_CODE_DISABLE_POLICY_SKILLS`| Set to `1` to skip loading skills from the system-wide managed skills directory. Useful for container or CI sessions that should not load operator-provisioned skills `CLAUDE_CODE_DISABLE_POWERSHELL_CMD_RM_DENY`| Set to `1` to turn off the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) check that denies the `cmd` built-ins `rd`, `rmdir`, `del`, and `erase` on a [system path](</docs/en/permission-modes#remove-item-in-powershell>), such as a drive root or your home directory. Claude Code ignores this variable in a settings file’s `env` block. Requires Claude Code v2.1.283 or later +`CLAUDE_CODE_DISABLE_REFUSAL_FALLBACK`| Set to `1` to turn off the [automatic model switch when a safety classifier flags a request](</docs/en/model-config#automatic-model-fallback>), the behavior the [`switchModelsOnFlag`](</docs/en/settings-reference#switchmodelsonflag>) setting controls `CLAUDE_CODE_DISABLE_STRUCTURED_OUTPUTS`| Set to `1` to stop Claude Code from sending the structured-output `output_config.format` field and the `anthropic-beta` value that pairs with it, for an [LLM gateway](</docs/en/llm-gateway-protocol#feature-pass-through>) whose upstream rejects them. This leaves on the other pre-release capabilities that [`CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`](</docs/en/llm-gateway-protocol#disable-pre-release-capabilities>) turns off. Requires Claude Code v2.1.288 or later `CLAUDE_CODE_DISABLE_SUBSTITUTION_RM_PROMPT`| Set to `1` to turn off the [critical-path](</docs/en/permission-modes#critical-paths>) check for a recursive `rm` whose target is entirely the output of a command substitution, such as `rm -rf "$(pwd)"`. The other critical-path checks keep running. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.281 or later `CLAUDE_CODE_DISABLE_TERMINAL_TITLE`| Set to `1` to disable automatic terminal title updates based on conversation context. This also skips the background small/fast-model request that [generates a session title](</docs/en/sessions#name-your-sessions>) @@ -364,7 +366,7 @@ `CLAUDE_CODE_SUBAGENT_MODEL`| The default model for [subagents](</docs/en/sub-agents#choose-a-model>), [agent team](</docs/en/agent-teams#specify-teammates-and-models>) teammates, and [workflow](</docs/en/workflows>) agents that aren’t assigned a model another way. Accepts an alias such as `haiku` or a full model name. Two sources take precedence over it: a model Claude passes when it spawns the agent, and a `model` field in the agent’s definition, including `inherit`. To change that, set [`CLAUDE_CODE_SUBAGENT_MODEL_FORCE`](</docs/en/sub-agents#run-every-subagent-on-one-model>). See [Choose a model](</docs/en/sub-agents#choose-a-model>) for the full order. Setting it to `inherit` is the same as leaving it unset. Before v2.1.251, this variable overrode both the per-invocation model and the definition’s `model` field `CLAUDE_CODE_SUBAGENT_MODEL_FORCE`| Set to `1` to force one model onto subagents, teammates, and workflow agents. [Run every subagent on one model](</docs/en/sub-agents#run-every-subagent-on-one-model>) says which model that is. Requires Claude Code v2.1.257 or later `CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL`| Set `5m` or `1h`, the only values Claude Code accepts, to choose the [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) for requests outside the main conversation, such as [subagents](</docs/en/sub-agents>), workflows, and background work. Takes precedence over the `subagentPromptCacheTtl` setting and over `ENABLE_PROMPT_CACHING_1H`, and `FORCE_PROMPT_CACHING_5M` overrides it. The API bills 1-hour cache writes at a higher rate. Requires Claude Code v2.1.242 or later -`CLAUDE_CODE_SUBPROCESS_ENV_SCRUB`| Set to `1` to strip credentials from subprocess environments (Bash tool, hooks, MCP stdio servers): Anthropic and cloud provider credentials, any other variable that Claude Code recognizes as a credential, and credentials embedded in package registry URLs. The parent Claude process keeps these credentials for API calls, but child processes cannot read them, reducing exposure to prompt injection attacks that attempt to exfiltrate secrets via shell expansion. On v2.1.251 or later, the scrub also removes Claude Code’s own configuration-store pointer variables (such as `CLAUDE_CONFIG_DIR`), so a child process cannot locate a relocated configuration directory. Leave the scrub unset if a subprocess needs these variables. On Linux, this also runs Bash subprocesses in an isolated PID namespace so they cannot read host process environments via `/proc`; as a side effect, `ps`, `pgrep`, and `kill` cannot see or signal host processes. `claude-code-action` sets this automatically when `allowed_non_write_users` is configured +`CLAUDE_CODE_SUBPROCESS_ENV_SCRUB`| Set to `1` to strip credentials from the environments of the subprocesses Claude Code starts, such as Bash commands, hooks, and stdio MCP servers. The scrub recognizes a credential by its variable name or its value, and it leaves GitHub tokens and proxy settings in place. See What the subprocess environment scrub removes. `claude-code-action` sets this automatically when `allowed_non_write_users` is configured `CLAUDE_CODE_SYNC_PLUGIN_INSTALL`| Set to `1` in non-interactive mode (the `-p` flag) to wait for plugin installation to complete before the first query. Without this, plugins install in the background and may not be available on the first turn. Combine with `CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS` to bound the wait `CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS`| Timeout in milliseconds for synchronous plugin installation. When exceeded, Claude Code proceeds without plugins and logs an error. No default: without this variable, synchronous installation waits until complete `CLAUDE_CODE_SYNC_SKILLS`| Set to `1` in non-interactive mode with the `-p` flag to make Claude Code download the skills enabled for your claude.ai account in that run and wait for the list of them, up to `CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS`, before it runs the first query. The downloads themselves finish in the background, and Claude waits for a skill’s download when it invokes that skill. Requires claude.ai authentication. Terminal sessions where you sign in with your claude.ai account [download these skills](</docs/en/skills#where-synced-skills-load>) into `~/.claude/skills/synced/` and resync about every 10 minutes without this variable, so set it only when a `-p` run needs your current skills on its first query. Before v2.1.273, terminal sessions downloaded them only in a `-p` run with this variable set. The `synced` folder name is [reserved for this download](</docs/en/skills#where-skills-live>). Before v2.1.227, the skills downloaded into `~/.claude/skills/` directly. Claude Code applies [extra rules to the downloaded skills](</docs/en/skills#how-synced-skills-behave>), such as not running their `!` commands on your machine @@ -377,6 +379,7 @@ `CLAUDE_CODE_TMUX_TRUECOLOR`| Set to any non-empty value, such as `1`, to allow 24-bit truecolor output inside tmux. **Setting it to`0` or `false` still allows truecolor**, unlike most on/off variables; unset the variable to restore the 256-color clamp. By default, Claude Code clamps to 256 colors when `$TMUX` is set because tmux does not pass through truecolor escape sequences unless configured to. Set this after adding `set -ga terminal-overrides ',*:Tc'` to your `~/.tmux.conf`. See [Terminal configuration](</docs/en/terminal-config>) for other tmux settings `CLAUDE_CODE_TOOL_MEMORY_CGROUP_EXCLUDE`| On Linux and WSL, set to a comma-separated list of the kinds of processes Claude Code [excludes from the tool memory cap](</docs/en/tools-reference#memory-limit-on-linux-and-wsl>), such as `mcp` or `lsp`. Set `none` to cap every kind, or `all-new` to cap only Bash, PowerShell, and Monitor tool commands. Claude Code keeps Bash, PowerShell, and Monitor tool commands under the cap whatever you list. Requires Claude Code v2.1.246 or later `CLAUDE_CODE_TOOL_MEMORY_LIMIT`| On Linux and WSL, set to a size such as `4G` to [cap the memory that Bash and PowerShell tool commands can use](</docs/en/tools-reference#memory-limit-on-linux-and-wsl>), and Monitor tool commands on v2.1.246 or later. Write the size in plain digits, alone for a number of bytes or with a `K`, `M`, `G`, or `T` suffix. Set `0` or `off` to turn the cap off. Once the first process Claude Code starts has turned the cap on or off, a changed value takes effect the next time you launch `claude`. Requires Claude Code v2.1.233 or later +`CLAUDE_CODE_TRANSCRIPT_LOCAL_GC`| Set to `1` to limit how large the [transcript file](</docs/en/sessions#where-transcripts-are-stored>) of a long `-p` or Agent SDK session grows. After each compaction, once the file is larger than 5 MB, Claude Code removes the history from before that compaction. Resuming the session restores the same conversation whether or not the file was trimmed. Set it in the environment you start Claude Code from, since a settings `env` block can’t turn it on. Requires Claude Code v2.1.287 or later `CLAUDE_CODE_USER_DIALOG_TIMEOUT_MS`| Deadline in milliseconds before Claude Code cancels a dialog it forwards to a remote client such as a [Remote Control](</docs/en/remote-control>) or SDK host, or the approval dialog for a [held cross-session message](</docs/en/cross-session-messaging#control-inbound-messages>); permission prompts and `AskUserQuestion` questions use their own flows and aren’t governed by it. On Claude Code v2.1.236 or later, it also bounds the mid-session [Fable usage-credits consent prompt](</docs/en/model-config#fable-and-usage-credits>) in a session that may be running unattended. [Control inbound messages](</docs/en/cross-session-messaging#control-inbound-messages>) and [non-interactive sessions](</docs/en/cross-session-messaging#non-interactive-sessions>) cover the full held-message expiry rules, including the cases where the deadline doesn’t apply. Overrides the [`dialogExpiry`](</docs/en/settings-reference#dialogexpiry>) setting. `0` or a negative value disables the deadline `CLAUDE_CODE_USE_ANTHROPIC_AWS`| Use [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) `CLAUDE_CODE_USE_BEDROCK`| Use [Amazon Bedrock](</docs/en/amazon-bedrock>) @@ -387,6 +390,7 @@ `CLAUDE_CODE_USE_VERTEX`| Use [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>) `CLAUDE_CODE_WEBFETCH_CACHE_TTL_MS`| Set to the number of milliseconds [WebFetch](</docs/en/tools-reference#webfetch-tool-behavior>) keeps each fetched URL’s response cached. The default is `900000`, which is 15 minutes. Takes plain digits only; `0`, a decimal, or any other spelling keeps the default. Claude Code reads the value once per launch, so a change in a settings `env` block applies when you next launch `claude`. Requires Claude Code v2.1.233 or later `CLAUDE_CODE_WEBFETCH_DEADLINE_MS`| Upper bound in milliseconds on how long [WebFetch](</docs/en/tools-reference#webfetch-tool-behavior>) waits for a page to download, including any redirects it follows. A download that hasn’t completed by then fails with a deadline error. The default is `300000`, which is five minutes. Set to `0` to remove the limit. Takes plain digits only; a decimal or any other spelling keeps the default. Requires Claude Code v2.1.268 or later +`CLAUDE_CODE_WORKER_CHECKIN_SCHEDULE`| When `CLAUDE_AUTO_BACKGROUND_TASKS` is set to `1`, how long Claude Code waits before each reminder to Claude to check on [background subagents](</docs/en/sub-agents#run-subagents-in-foreground-or-background>) that are still running. Takes one or more comma-separated waits in whole seconds from `1` to `86400`, such as `600` or `600,1800,3600`. Each value is the wait before the next reminder, and the last value repeats. Takes plain digits only; any other value or spelling reads as unset. When unset, there are no reminders. Requires Claude Code v2.1.283 or later `CLAUDE_CODE_WORKFLOW_MAX_CONCURRENT_AGENTS`| How many agents a single [workflow](</docs/en/workflows>) run executes at once, from `1` to `256`. By default, a run executes up to 16 agents at once, fewer when Claude Code has fewer CPUs available; queued `agent()` calls wait for a free slot. Each running agent’s transcript stays in Claude Code’s memory, so higher values raise memory use. Takes plain digits only; out-of-range values and other spellings keep the default. Requires Claude Code v2.1.269 or later `CLAUDE_CODE_WORKFLOW_PREFIX_STAGGER_MS`| Upper bound in milliseconds on how long a [workflow](</docs/en/workflows>) agent waits for a same-prefix sibling’s first response to begin before sending its own first request. When a fan-out starts several agents that share a [prompt-cache prefix](</docs/en/workflows#prompt-caching-in-a-fan-out>), Claude Code holds all but the first agent for up to this long so the rest read the cached prefix instead of each processing it uncached. Default `5000`. Set to `0` to disable the wait. When `DISABLE_PROMPT_CACHING` is set, agents never wait. Requires Claude Code v2.1.229 or later `CLAUDE_CONFIG_DIR`| Override the configuration directory (default: `~/.claude`). All settings, session history, and plugins are stored under this path. For credentials, see [where Claude Code stores credentials](</docs/en/authentication#credential-management>). Useful for running multiple accounts side by side: for example, `alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'`. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) @@ -440,7 +444,7 @@ `IS_DEMO`| Set to any non-empty value, such as `1`, to enable demo mode: hides your email and organization name from the header and `/status` output, and skips onboarding. **Setting it to`0` or `false` still enables demo mode**, unlike most on/off variables; unset the variable to turn it off. Useful when streaming or recording a session `MAX_MCP_OUTPUT_TOKENS`| Maximum number of tokens allowed in MCP tool responses. Claude Code displays a warning when output exceeds 10,000 tokens. Tools that declare [`anthropic/maxResultSizeChars`](</docs/en/mcp#raise-the-limit-for-a-specific-tool>) use that character limit for text content instead, but image content from those tools is still subject to this variable (default: 25000) `MAX_STRUCTURED_OUTPUT_RETRIES`| Number of attempts Claude Code allows when the model’s response fails validation against the [`--json-schema`](</docs/en/cli-reference#cli-flags>) in non-interactive mode with the `-p` flag; after that many failed attempts with no valid output, the run fails. The same cap applies when a [workflow](</docs/en/workflows>) subagent’s structured output fails validation. Defaults to 5, a first attempt plus four retries -`MAX_THINKING_TOKENS`| Fixed token budget for [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>). Claude Code caps it at one token below the request’s max output tokens and never below 1,024. See `CLAUDE_CODE_MAX_OUTPUT_TOKENS` for how that limit is set. When unset and thinking is enabled, models with [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) choose their own thinking depth, and other models use the cap. Set to `0` to disable thinking on the Anthropic API, except on Opus 5.5, Sonnet 5.5, and the Fable models, which can’t have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `0` omits the `thinking` parameter instead. With thinking turned off on the Anthropic API, Claude Code sends effort `high` instead of a higher level to models it knows [don’t accept that combination](</docs/en/errors#effort-isnt-available-with-thinking-turned-off>), such as Opus 5. Claude Code ignores nonzero values on adaptive reasoning models, except on the models where `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` turns adaptive reasoning off +`MAX_THINKING_TOKENS`| Fixed token budget for [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>). Claude Code caps it at one token below the request’s max output tokens and never below 1,024. See `CLAUDE_CODE_MAX_OUTPUT_TOKENS` for how that limit is set. When unset and thinking is enabled, models with [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) choose their own thinking depth, and other models use the cap. Set to `0` to disable thinking on the Anthropic API, except on Opus 5.5, Sonnet 5.5, and the Fable models, which can’t have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `0` omits the `thinking` parameter instead. With thinking turned off on the Anthropic API, Claude Code sends effort `high` instead of a higher level to models it knows [don’t accept that combination](</docs/en/errors#effort-isnt-available-with-thinking-turned-off>), such as Opus 5. For a positive value, Claude Code ignores the number itself on adaptive reasoning models, except when `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` turns adaptive reasoning off `MCP_CLIENT_SECRET`| OAuth client secret for MCP servers that require [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>). Avoids the interactive prompt when adding a server with `--client-secret` `MCP_CONNECTION_NONBLOCKING`| Controls whether startup waits for MCP servers to connect before the first query. MCP startup is non-blocking by default: servers connect in the background and their tools become available as they finish. Set to `0` to make Claude Code wait for servers to connect before the first query. Servers configured with [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>) still make startup wait regardless, except when served from the [discovery cache](</docs/en/mcp#server-status-detail>), since their tools must be present when the first prompt is built. In non-interactive mode (`-p`) without `--input-format stream-json`, Claude Code also waits for still-pending servers before the first turn regardless of this variable. When you pass [`--mcp-config`](</docs/en/cli-reference#cli-flags>) explicitly, the wait has a longer deadline; see that flag’s entry for the cached-server exception `MCP_CONNECT_TIMEOUT_MS`| How long blocking MCP startup waits, in milliseconds, for the connection batch before snapshotting the tool list (default: 5000). Applies when `MCP_CONNECTION_NONBLOCKING=0` or for servers marked [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>). Servers still pending at the deadline keep connecting in the background. Distinct from `MCP_TIMEOUT`, which bounds an individual server’s connect attempt @@ -498,6 +502,28 @@ ​ +What the subprocess environment scrub removes + +When you set `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB` to `1`, Claude Code removes credentials from the environments of the subprocesses it starts, such as Bash commands, hooks, and stdio MCP servers. This reduces what a prompt injection attack can read through shell expansion. The Claude Code process keeps the credentials for its own API calls. The scrub recognizes a credential by its variable name or by the shape of its value, so use it as one layer alongside narrow [permission rules](</docs/en/permissions>) rather than as the only control. The table shows what the scrub does to example variables: + +Example variable| What the scrub does +---|--- +`ANTHROPIC_API_KEY`, `AWS_SECRET_ACCESS_KEY`| Removes it +`NPM_TOKEN`, `DB_PASSWORD`| Removes it, because the name looks like a credential +`DATABASE_URL` that contains a password| Removes it, because the value looks like a credential +`PIP_INDEX_URL` or `NPM_CONFIG_REGISTRY` that contains a password| Keeps the URL and cuts the username and password from it +`CLAUDE_CONFIG_DIR`| Removes it. Requires Claude Code v2.1.251 or later +`GITHUB_TOKEN`, `GH_TOKEN`, `GH_ENTERPRISE_TOKEN`, `GITHUB_ENTERPRISE_TOKEN`| Leaves it in place, so that `gh` and scripts that call the GitHub API keep working +`HTTP_PROXY`, `HTTPS_PROXY`| Leaves it in place, including a [username and password in the URL](</docs/en/network-config#basic-authentication>). The [sandbox](</docs/en/sandboxing#network-isolation>) can set these variables itself for sandboxed commands +`GIT_CONFIG_COUNT`, `GIT_CONFIG_KEY_<n>`, `GIT_CONFIG_VALUE_<n>`| Leaves it in place, whatever it holds +A secret whose variable name and value don’t look like a credential| Leaves it in place + +Because the scrub leaves `GITHUB_TOKEN` in place, give a GitHub Actions job the narrowest `permissions` it needs. To remove a GitHub token from sandboxed Bash commands, add a `deny` entry under [`sandbox.credentials`](</docs/en/sandboxing#protect-credentials>). Leave the scrub unset if a subprocess needs one of the removed variables. On Linux, the scrub also runs Bash subprocesses in an isolated PID namespace so they can’t read host process environments through `/proc`. As a side effect, `ps`, `pgrep`, and `kill` can’t see or signal host processes. + +## + +​ + Features that need feature-flag fetching Claude Code turns some features on through feature flags it fetches from Anthropic. Claude Code skips that fetch in these sessions: @@ -529,7 +555,12 @@ First session after an install or upgrade -In your first session after you install Claude Code, or upgrade to a version that adds a feature, a flag-gated feature can be missing. That session can also start in a different [permission mode](</docs/en/permission-modes#which-mode-a-session-starts-in>) than your later sessions do. Claude Code fetches the flags during that session, so your next session has the feature and the usual starting permission mode. After a fresh install, in a non-interactive session such as `claude -p`, the Agent SDK, or the VS Code extension, Claude Code can still pick the flags up before it [chooses the starting permission mode](</docs/en/permission-modes#which-mode-a-session-starts-in>). +In your first session after you install Claude Code, or upgrade to a version that adds a feature, a flag-gated feature can be missing. That session can also start in a different [permission mode](</docs/en/permission-modes#which-mode-a-session-starts-in>) than your later sessions do. When Claude Code fetches the flags during that session, it saves them on the machine, so your next session on that machine has the feature and the usual starting permission mode. After a fresh install, in a non-interactive session such as `claude -p`, the Agent SDK, or the VS Code extension, Claude Code can pick the flags up before it [chooses the starting permission mode](</docs/en/permission-modes#which-mode-a-session-starts-in>), but it doesn’t always wait for them. In setups such as these, sessions after the first also start without freshly fetched flags: + + * **A clean environment on every run** : if each run starts in a CI container, or any other environment without the flags an earlier session saved, every run is a first session + * **A gateway token with no API key** : if you authenticate with `ANTHROPIC_AUTH_TOKEN` and no API key, and `ANTHROPIC_BASE_URL` points at a host other than Anthropic’s, such as an [LLM gateway](</docs/en/llm-gateway>), Claude Code has no credential to fetch the flags with + +To choose the permission mode that sessions in these setups start in, see [Start in a different permission mode](</docs/en/permission-modes#start-in-a-different-mode>). ##
modified
--- a/env-vars.md +++ b/env-vars.md @@ -162,9 +162,9 @@ `API_FORCE_IDLE_TIMEOUT`| Override the 5-minute body idle timeout that aborts a streaming model response when no bytes arrive. Set to `0` to turn the timeout off, for example when a slow [gateway](</docs/en/llm-gateway>) or local model pauses longer than 5 minutes between chunks, or `1` to keep it on for every provider. When unset, the timeout is active on providers other than the direct Anthropic API, [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), and Amazon Bedrock with `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK=1` set. The [stream watchdogs](</docs/en/network-config#streaming-idle-watchdogs>) run independently of it and abort a long silent pause even when you set `0` here `API_TIMEOUT_MS`| Timeout for API requests in milliseconds (default: 600000, or 10 minutes; maximum: 2147483647). Increase this when requests time out on slow networks or when routing through a proxy. Values above the maximum overflow the underlying timer and cause requests to fail immediately `AWS_BEARER_TOKEN_BEDROCK`| Amazon Bedrock API key for authentication (see [Amazon Bedrock API keys](<https://aws.amazon.com/blogs/machine-learning/accelerate-ai-development-with-amazon-bedrock-api-keys/>)) -`BASH_DEFAULT_TIMEOUT_MS`| Default timeout for a foreground Bash or PowerShell tool command, in milliseconds (default: 120000, or 2 minutes). A default longer than 30 minutes also becomes the default [time limit for background commands](</docs/en/tools-reference#time-limit-for-background-commands>). The background time limit requires Claude Code v2.1.285 or later +`BASH_DEFAULT_TIMEOUT_MS`| Default timeout for a foreground Bash or PowerShell tool command, in milliseconds (default: 120000, or 2 minutes). A default longer than 30 minutes also becomes the default [time limit for background commands](</docs/en/tools-reference#time-limit-for-background-commands>) in unattended sessions. The background time limit requires Claude Code v2.1.285 or later `BASH_MAX_OUTPUT_LENGTH`| Maximum number of characters of bash output that Claude Code reads back into a command’s result (default: 30000; maximum: 150000). If you set the [`bashOutputMaxChars`](</docs/en/settings-reference#bashoutputmaxchars>) setting, Claude Code ignores this variable. See [Output limits](</docs/en/tools-reference#output-limits>) -`BASH_MAX_TIMEOUT_MS`| Maximum timeout the model can set for a foreground Bash or PowerShell tool command, in milliseconds (default: 600000, or 10 minutes). The effective ceiling is the larger of this and `BASH_DEFAULT_TIMEOUT_MS`. An effective ceiling longer than 2 hours also becomes the maximum [time limit for background commands](</docs/en/tools-reference#time-limit-for-background-commands>). The background time limit requires Claude Code v2.1.285 or later +`BASH_MAX_TIMEOUT_MS`| Maximum timeout the model can set for a foreground Bash or PowerShell tool command, in milliseconds (default: 600000, or 10 minutes). The effective ceiling is the larger of this and `BASH_DEFAULT_TIMEOUT_MS`. An effective ceiling longer than 2 hours also becomes the maximum [time limit for background commands](</docs/en/tools-reference#time-limit-for-background-commands>) in unattended sessions. The background time limit requires Claude Code v2.1.285 or later `BETA_TRACING_ENDPOINT`| OTLP endpoint for [detailed beta tracing](</docs/en/monitoring-usage#traces-beta>): with `ENABLE_BETA_TRACING_DETAILED=1`, logs and traces go there instead of to the configured exporters. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) `CCR_FORCE_BUNDLE`| Set to `1` to force [`claude --cloud`](</docs/en/claude-code-on-the-web#send-local-repositories-without-github>) to bundle and upload your local repository instead of cloning from its remote `CLAUDECODE`| Set to `1` in subprocesses Claude Code spawns (Bash and PowerShell tools, tmux sessions, [hook](</docs/en/hooks>) commands, [status line](</docs/en/statusline>) commands, stdio [MCP server](</docs/en/mcp>) subprocesses). IDE extensions also set this in their integrated terminals. Use to detect when a script is running inside a subprocess spawned by Claude Code. To check whether the current process was spawned directly by a tool call or hook, rather than inside a stdio MCP server that Claude Code started, use `CLAUDE_CODE_CHILD_SESSION` instead @@ -245,6 +245,7 @@ `CLAUDE_CODE_DISABLE_PERMISSION_PROMPT_NOTIFY_HOOKS`| Set to `1` to stop Claude Code from running your [`Notification` hooks for unanswered permission requests](</docs/en/hooks#notification>) in sessions where Claude Code sends them to the Agent SDK’s `canUseTool` callback, which is how Claude Desktop and the VS Code extension host Claude Code. Has no effect in terminal sessions. Requires Claude Code v2.1.233 or later `CLAUDE_CODE_DISABLE_POLICY_SKILLS`| Set to `1` to skip loading skills from the system-wide managed skills directory. Useful for container or CI sessions that should not load operator-provisioned skills `CLAUDE_CODE_DISABLE_POWERSHELL_CMD_RM_DENY`| Set to `1` to turn off the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) check that denies the `cmd` built-ins `rd`, `rmdir`, `del`, and `erase` on a [system path](</docs/en/permission-modes#remove-item-in-powershell>), such as a drive root or your home directory. Claude Code ignores this variable in a settings file’s `env` block. Requires Claude Code v2.1.283 or later +`CLAUDE_CODE_DISABLE_STRUCTURED_OUTPUTS`| Set to `1` to stop Claude Code from sending the structured-output `output_config.format` field and the `anthropic-beta` value that pairs with it, for an [LLM gateway](</docs/en/llm-gateway-protocol#feature-pass-through>) whose upstream rejects them. This leaves on the other pre-release capabilities that [`CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`](</docs/en/llm-gateway-protocol#disable-pre-release-capabilities>) turns off. Requires Claude Code v2.1.288 or later `CLAUDE_CODE_DISABLE_SUBSTITUTION_RM_PROMPT`| Set to `1` to turn off the [critical-path](</docs/en/permission-modes#critical-paths>) check for a recursive `rm` whose target is entirely the output of a command substitution, such as `rm -rf "$(pwd)"`. The other critical-path checks keep running. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.281 or later `CLAUDE_CODE_DISABLE_TERMINAL_TITLE`| Set to `1` to disable automatic terminal title updates based on conversation context. This also skips the background small/fast-model request that [generates a session title](</docs/en/sessions#name-your-sessions>) `CLAUDE_CODE_DISABLE_THINKING`| Set to `1` to omit the `thinking` parameter from API requests entirely. This is a compatibility option for proxies and gateways that reject the parameter. On models that think by default, omitting the parameter means the model may still think. To explicitly disable [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) on the Anthropic API, use `MAX_THINKING_TOKENS=0` instead. Neither variable turns thinking off on Opus 5.5, Sonnet 5.5, or the Fable models, which can’t have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `MAX_THINKING_TOKENS=0` likewise omits the parameter, so the two variables behave the same there @@ -304,6 +305,7 @@ `CLAUDE_CODE_NATIVE_CURSOR`| Set to `1` to show the terminal’s own cursor at the input caret instead of a drawn block. The cursor respects the terminal’s blink, shape, and focus settings `CLAUDE_CODE_NEW_INIT`| Set to `1` to make `/init` run an interactive setup flow. The flow asks which files to generate, including CLAUDE.md, skills, and hooks, before exploring the codebase and writing them. Without this variable, `/init` generates a CLAUDE.md automatically without prompting `CLAUDE_CODE_NONBLOCKING_STDOUT`| Set to `1` to write terminal output through a second non-blocking file descriptor, so a terminal that stops reading, such as a paused tmux control-mode pane or a stalled SSH connection, can’t freeze Claude Code mid-session. Applies on macOS, Linux, and WSL when stdout is a terminal. Requires Claude Code v2.1.261 or later +`CLAUDE_CODE_NONSTREAMING_TIMEOUT_RETRIES`| Limit how many times Claude Code re-sends a [non-streaming request](</docs/en/errors#streaming-response-ended-before-any-complete-data-was-received>) that times out. With `0`, the request fails on the first timeout. Unset by default, so `CLAUDE_CODE_MAX_RETRIES` limits these re-sends. See [Tune retry behavior](</docs/en/errors#tune-retry-behavior>) for the timeout. Requires Claude Code v2.1.285 or later `CLAUDE_CODE_NO_FLICKER`| Set to `1` to enable [fullscreen rendering](</docs/en/fullscreen>), a research preview that reduces flicker and keeps memory flat in long conversations. Overrides the [`tui`](</docs/en/settings-reference#tui>) setting; you can also switch with `/tui fullscreen` `CLAUDE_CODE_OAUTH_REFRESH_TOKEN`| OAuth refresh token for Claude.ai authentication. When set, `claude auth login` exchanges this token directly instead of opening a browser. Requires `CLAUDE_CODE_OAUTH_SCOPES`. Useful for provisioning authentication in automated environments `CLAUDE_CODE_OAUTH_SCOPES`| Space-separated OAuth scopes the refresh token was issued with, such as `"user:profile user:inference user:sessions:claude_code"`. Required when `CLAUDE_CODE_OAUTH_REFRESH_TOKEN` is set @@ -447,7 +449,7 @@ `MCP_DISCOVERY_CACHE_STRIKES`| At a start where a [discovery-cache](</docs/en/mcp#server-status-detail>) entry is older than `MCP_DISCOVERY_CACHE_TTL_S`, Claude Code refreshes it in the background. This variable sets how many refreshes in a row can fail before Claude Code discards the entry and connects the server at the next start instead (default: 1). Raise it if your network connection drops occasionally, so that one failed refresh doesn’t discard the entry. Requires Claude Code v2.1.238 or later `MCP_DISCOVERY_CACHE_TTL_S`| Seconds for which Claude Code uses a [discovery-cache](</docs/en/mcp#server-status-detail>) entry without refreshing it (default: 900). At a start where the entry is older than that, Claude Code still uses it but refreshes it in the background. Once the entry is older than `MCP_DISCOVERY_CACHE_MAX_STALE_S`, Claude Code discards it instead. Claude Code caps the value at `MCP_DISCOVERY_CACHE_MAX_STALE_S`, which is 4 hours by default. Before v2.1.238, Claude Code didn’t cap the value `MCP_OAUTH_CALLBACK_PORT`| Fixed port for the OAuth redirect callback, as an alternative to `--callback-port` when adding an MCP server with [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>) -`MCP_PROTOCOL_NEGOTIATION`| On the [v2 MCP client runtime](</docs/en/mcp#mcp-client-runtimes>) only, whether Claude Code probes servers for MCP protocol revision 2026-07-28. Set `auto` to probe HTTP, claude.ai connector, and stdio servers; a server that doesn’t answer the probe connects on the earlier protocol instead, as SSE and WebSocket servers always do. Set `legacy` to skip the probe for every server. Without the variable, Claude Code probes HTTP servers, and also probes claude.ai connector servers in sessions where it fetches feature flags. Any other value is ignored with a warning in the debug log. Requires Claude Code v2.1.221 or later +`MCP_PROTOCOL_NEGOTIATION`| On the [v2 MCP client runtime](</docs/en/mcp#mcp-client-runtimes>) only, whether Claude Code probes servers for MCP protocol revision 2026-07-28. Set `auto` to probe HTTP, claude.ai connector, and stdio servers, or `legacy` to probe none. With the variable unset, Claude Code probes the servers described under [MCP client runtimes](</docs/en/mcp#mcp-client-runtimes>). Any other value is ignored with a warning in the debug log. Requires Claude Code v2.1.221 or later `MCP_REMOTE_SERVER_CONNECTION_BATCH_SIZE`| Maximum number of remote MCP servers (HTTP/SSE) to connect in parallel during startup (default: 20) `MCP_SDK_GENERATION`| Pin which [MCP client runtime](</docs/en/mcp#mcp-client-runtimes>) this process connects to MCP servers with: `v1`, built on MCP TypeScript SDK 1.x, or `v2`, built on [MCP TypeScript SDK 2.0](<https://ts.sdk.modelcontextprotocol.io/v2/>). Without the variable, Claude Code uses v2, starting with the versions listed in that section. On Claude Code v2.1.221 or later, the v2 runtime checks the issuer an MCP OAuth server returns in its authorization response and fails the sign-in with an error that begins `Issuer mismatch in authorization response` when it doesn’t match. The v1 runtime doesn’t run this check. If you set an unrecognized value, Claude Code ignores it and writes a warning to the debug log. Claude Code reads the value once per process. Requires Claude Code v2.1.218 or later `MCP_SERVER_CONNECTION_BATCH_SIZE`| Maximum number of local MCP servers (stdio) to connect in parallel during startup (default: 3) @@ -515,7 +517,7 @@ * Use [the advisor tool](</docs/en/advisor#requirements>) * Read or reply to [comments on an artifact](</docs/en/artifacts#collect-comments-on-an-artifact>) * Have Claude read [another organization’s public artifact](</docs/en/artifacts#read-an-artifact-shared-with-you>) - * Have Claude Code probe claude.ai connector servers for [MCP protocol revision 2026-07-28](</docs/en/mcp#mcp-client-runtimes>) unless you set `MCP_PROTOCOL_NEGOTIATION=auto` + * Have Claude Code probe claude.ai connector servers or stdio servers for [MCP protocol revision 2026-07-28](</docs/en/mcp#mcp-client-runtimes>) unless you set `MCP_PROTOCOL_NEGOTIATION=auto` * Get the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) by default for claude.ai and Console accounts on Windows with Git Bash installed; Claude Code routes shell commands through Git Bash unless you set `CLAUDE_CODE_USE_POWERSHELL_TOOL=1`. On Windows without Git Bash, the tool stays on * Get [Claude-drafted feedback](</docs/en/tools-reference#sendfeedback-tool-behavior>), which Claude Code turns on through a fetched flag * Have Claude [treat large pastes as pasted rather than typed text](</docs/en/terminal-config#how-claude-treats-pasted-text>); the content behind a `[Pasted text #N]` placeholder reaches Claude unmarked
modified
--- a/env-vars.md +++ b/env-vars.md @@ -150,7 +150,7 @@ `ANTHROPIC_FOUNDRY_API_KEY`| API key for Microsoft Foundry authentication (see [Microsoft Foundry](</docs/en/microsoft-foundry>)) `ANTHROPIC_FOUNDRY_AUTH_TOKEN`| Bearer token for Microsoft Foundry authentication, such as a Microsoft Entra access token. Claude Code sends it as the `Authorization: Bearer` header. Takes precedence over `ANTHROPIC_FOUNDRY_API_KEY` and over the Azure default credential chain. See [Microsoft Foundry](</docs/en/microsoft-foundry>). Requires Claude Code v2.1.203 or later `ANTHROPIC_FOUNDRY_BASE_URL`| Full base URL for the Microsoft Foundry resource (for example, `https://my-resource.services.ai.azure.com/anthropic`). Alternative to `ANTHROPIC_FOUNDRY_RESOURCE` (see [Microsoft Foundry](</docs/en/microsoft-foundry>)) -`ANTHROPIC_FOUNDRY_RESOURCE`| Microsoft Foundry resource name (for example, `my-resource`). Required if `ANTHROPIC_FOUNDRY_BASE_URL` is not set (see [Microsoft Foundry](</docs/en/microsoft-foundry>)) +`ANTHROPIC_FOUNDRY_RESOURCE`| Microsoft Foundry resource name (for example, `my-resource`). Claude Code [refuses a URL or host name](</docs/en/errors#anthropic-foundry-resource-must-be-a-foundry-resource-name>). Required if `ANTHROPIC_FOUNDRY_BASE_URL` is not set (see [Microsoft Foundry](</docs/en/microsoft-foundry>)) `ANTHROPIC_MODEL`| Name of the model setting to use (see [Model Configuration](</docs/en/model-config#environment-variables>)) `ANTHROPIC_ORGANIZATION_ID`| Organization ID for [Workload Identity Federation](<https://platform.claude.com/docs/en/manage-claude/workload-identity-federation>). Set it together with `ANTHROPIC_FEDERATION_RULE_ID`. See [authentication precedence](</docs/en/authentication#authentication-precedence>) `ANTHROPIC_PROFILE`| Name of the Anthropic profile to authenticate with, such as one created by [`ant auth login`](<https://platform.claude.com/docs/en/cli-sdks-libraries/cli/authentication>) or by [signing in to a Console account without an API key](</docs/en/authentication#sign-in-without-an-api-key>). See [authentication precedence](</docs/en/authentication#authentication-precedence>) @@ -175,7 +175,7 @@ `CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS`| Stall timeout in milliseconds for subagents. Default `600000` (10 minutes); if you raise `CLAUDE_STREAM_IDLE_TIMEOUT_MS` while the stream watchdog is on, the default rises with it, as [Handle slow or stalled API responses](</docs/en/agent-sdk/typescript#handle-slow-or-stalled-api-responses>) describes. The timer resets on each streaming progress event; if no progress arrives within the window, Claude Code aborts the subagent and reports the stall to the parent `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE`| Set the percentage (1-100) of the auto-compact window at which auto-compaction triggers. Use lower values like `50` to compact earlier; the variable can’t raise the threshold, so values above the default percentage are ignored. It applies only in sessions that [compact before the model’s context limit](</docs/en/model-config#context-window-and-auto-compaction>). Applies to both main conversations and subagents `CLAUDE_AUTO_BACKGROUND_TASKS`| Set to `1` to force-enable automatic backgrounding of long-running agent tasks. When enabled, subagents are moved to the background after running for approximately two minutes. Also enables [automatic backgrounding of long MCP tool calls](</docs/en/mcp#automatic-backgrounding-of-long-tool-calls>) in non-interactive mode on Claude Code v2.1.212 or later -`CLAUDE_AX_PREPARK_MS`| In [screen reader mode](</docs/en/accessibility#what-your-screen-reader-hears>), how many milliseconds Claude Code waits, with the cursor at the start of the line, before it writes a new or changed line. Default `50`. Set `0` to write immediately. Claude Code caps the wait at `5000`. Requires Claude Code v2.1.233 or later +`CLAUDE_AX_PREPARK_MS`| In [screen reader mode](</docs/en/accessibility>), how many milliseconds Claude Code waits before it writes a new or changed line. Default `0`, so Claude Code doesn’t wait. Before v2.1.287, the default was `50`. Claude Code caps the wait at `5000`. Requires Claude Code v2.1.233 or later `CLAUDE_AX_SCREEN_READER`| Set to `1` to render screen-reader friendly output: flat text without decorative borders or animations. Set to `0` to force screen-reader mode off even when [`axScreenReader`](</docs/en/settings-reference#axscreenreader>) is `true`. The [`--ax-screen-reader`](</docs/en/cli-reference#cli-flags>) flag takes precedence. Requires Claude Code v2.1.181 or later `CLAUDE_AX_STARTUP_QUIET_MS`| In [screen reader mode](</docs/en/accessibility>), how many milliseconds Claude Code holds the first interface render after the startup confirmation line, so your screen reader can speak the line in full before new output interrupts it. Default `3000`. Set `0` to render immediately. Claude Code caps the hold at `600000` (10 minutes). Your first keystroke ends the hold early. Requires Claude Code v2.1.217 or later `CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR`| Return to the original working directory after each Bash or PowerShell command in the main session @@ -215,6 +215,7 @@ `CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN`| Set to `1` to disable [fullscreen rendering](</docs/en/fullscreen>) and use the classic main-screen renderer. The conversation stays in your terminal’s native scrollback so `Cmd+f` and tmux copy mode work as usual. Takes precedence over `CLAUDE_CODE_NO_FLICKER` and the [`tui`](</docs/en/settings-reference#tui>) setting. You can also switch with `/tui default`. Does not apply to background sessions opened from [agent view](</docs/en/agent-view>), which always use fullscreen rendering `CLAUDE_CODE_DISABLE_ARTIFACT`| Set to `1` to turn off the [Artifact](</docs/en/artifacts>) tool, which publishes session output as a private web page on claude.ai. Once you set it, no settings file turns the tool back on. To turn the tool off from a settings file instead, set [`enableArtifact`](</docs/en/settings-reference#enableartifact>) to `false`; the deprecated [`disableArtifact`](</docs/en/settings-reference#disableartifact>) key also turns it off `CLAUDE_CODE_DISABLE_ATTACHMENTS`| Set to `1` to disable attachment processing. File mentions with `@` syntax are sent as plain text instead of being expanded into file content +`CLAUDE_CODE_DISABLE_AUTH_REFRESH_LOCK`| Set to `1` to make a Claude Code process run its [`gcpAuthRefresh`](</docs/en/settings-reference#gcpauthrefresh>) or [`awsAuthRefresh`](</docs/en/settings-reference#awsauthrefresh>) command itself instead of waiting while another process runs it. Requires Claude Code v2.1.286 or later `CLAUDE_CODE_DISABLE_AUTO_MEMORY`| Set to `1` to disable [auto memory](</docs/en/memory#auto-memory>). Set to `0` to force auto memory on even when `--bare` mode or [`autoMemoryEnabled: false`](</docs/en/settings-reference#automemoryenabled>) would otherwise disable it. When disabled, Claude does not create or load auto memory files `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 `CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_DEFAULT`| Set to `1` to stop Claude Code from treating an [Amazon Bedrock](</docs/en/amazon-bedrock>) streaming response with a missing or empty `Content-Type` header as Amazon Bedrock’s binary event stream. By default, Claude Code assumes a gateway dropped the header from an otherwise unmodified response, so it decodes the body and streaming keeps working. Set this only for a gateway that also re-emits the stream as server-sent events; Claude Code then reads the header-less body as server-sent events instead. Requires Claude Code v2.1.239 or later @@ -226,7 +227,7 @@ `CLAUDE_CODE_DISABLE_CLAUDE_MDS`| Set to `1` to prevent loading any CLAUDE.md memory files into context, including user, project, and auto memory files `CLAUDE_CODE_DISABLE_CRON`| Set to `1` to disable [scheduled tasks](</docs/en/scheduled-tasks>). The `/loop` skill and cron tools become unavailable and any already-scheduled tasks stop firing, including tasks that are already running mid-session `CLAUDE_CODE_DISABLE_DANGEROUS_RM_TIMEOUT`| Set to `1` to turn off the time limit on [critical-path removal](</docs/en/permission-modes#critical-paths>) prompts. In `auto` mode Claude Code then sends these removals to the classifier instead, and in `bypassPermissions` mode the prompt waits for your answer. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.281 or later -`CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`| Set to `1` to strip Anthropic-specific `anthropic-beta` request headers and beta tool-schema fields (such as `defer_loading` and `eager_input_streaming`) from API requests. Use this when a proxy gateway rejects requests with errors like “Unexpected value(s) for the `anthropic-beta` header” or “Extra inputs are not permitted”. Standard fields (`name`, `description`, `input_schema`, `cache_control`) are preserved. [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) is disabled and all MCP tools load upfront, even when you set `ENABLE_TOOL_SEARCH`. On Claude Code v2.1.227 or later, [managed settings](</docs/en/managed-settings>) can keep tool search on. [Disable pre-release capabilities](</docs/en/llm-gateway-protocol#disable-pre-release-capabilities>) covers where the override applies +`CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`| Set to `1` to strip pre-release `anthropic-beta` request headers, the body fields that pair with them, and beta tool-schema fields such as `defer_loading` and `eager_input_streaming` from API requests. Use this when a proxy gateway rejects requests with an `Unexpected value(s)` error for the `anthropic-beta` header or an `Extra inputs are not permitted` error. [Disable pre-release capabilities](</docs/en/llm-gateway-protocol#disable-pre-release-capabilities>) lists what the variable removes, including [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>), and what Claude Code keeps sending `CLAUDE_CODE_DISABLE_EXPLORE_PLAN_AGENTS`| Set to `1` to disable the built-in [Explore and Plan subagents](</docs/en/sub-agents#built-in-subagents>). Claude explores with its search tools or the general-purpose subagent instead, and [plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>) reads files directly rather than launching Explore and Plan agents. Custom subagents named `Explore` or `Plan` are unaffected. To remove every built-in subagent type in the Agent SDK or non-interactive mode, use `CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS` instead. Requires Claude Code v2.1.198 or later `CLAUDE_CODE_DISABLE_FAST_MODE`| Set to `1` to disable [fast mode](</docs/en/fast-mode>) `CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY`| Set to `1` to disable the “How is Claude doing?” session quality surveys. Surveys are also disabled when `DISABLE_TELEMETRY`, `DO_NOT_TRACK`, or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` is set, unless `CLAUDE_CODE_ENABLE_FEEDBACK_SURVEY_FOR_OTEL` opts back in. To set a sample rate instead of disabling outright, use the [`feedbackSurveyRate`](</docs/en/settings-reference#feedbacksurveyrate>) setting. See [Session quality surveys](</docs/en/data-usage#session-quality-surveys>) @@ -249,6 +250,7 @@ `CLAUDE_CODE_DISABLE_THINKING`| Set to `1` to omit the `thinking` parameter from API requests entirely. This is a compatibility option for proxies and gateways that reject the parameter. On models that think by default, omitting the parameter means the model may still think. To explicitly disable [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) on the Anthropic API, use `MAX_THINKING_TOKENS=0` instead. Neither variable turns thinking off on Opus 5.5, Sonnet 5.5, or the Fable models, which can’t have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `MAX_THINKING_TOKENS=0` likewise omits the parameter, so the two variables behave the same there `CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT`| Set to `1` to skip proactive [auto-compaction](</docs/en/costs#reduce-token-usage>) when Claude Code doesn’t recognize the model ID, such as an [LLM gateway](</docs/en/llm-gateway>) alias. Without this variable, Claude Code compacts at the context window it assumes for the ID. `CLAUDE_CODE_MAX_CONTEXT_TOKENS` can correct the assumed window instead; see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>) for when each variable applies. Requires Claude Code v2.1.223 or later `CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL`| Set to `1` to disable virtual scrolling in [fullscreen rendering](</docs/en/fullscreen>) and render every message in the transcript. Use this if scrolling in fullscreen mode shows blank regions where messages should appear +`CLAUDE_CODE_DISABLE_WEB_FETCH`| Set to `1` to turn off the [WebFetch](</docs/en/tools-reference#webfetch-tool-behavior>) tool. The [WebSearch](</docs/en/tools-reference#websearch-tool-behavior>) tool stays available. Requires Claude Code v2.1.285 or later `CLAUDE_CODE_DISABLE_WINDOWS_SHELL_LAUNCHER`| Set to `1` to start [PowerShell tool](</docs/en/tools-reference#powershell-tool>) commands on Windows directly instead of through the `cmd.exe` launcher. By default, the launcher lets a PowerShell command [running in the background](</docs/en/tools-reference#background-commands>) [carry over to the session’s next process](</docs/en/agent-view#the-supervisor-process>), such as when you [background the session](</docs/en/agent-view#from-inside-a-session>). If you set the variable, a backgrounded PowerShell command stops when the session’s process exits. Bash commands aren’t affected. Requires Claude Code v2.1.269 or later `CLAUDE_CODE_DISABLE_WORKFLOWS`| Set to `1` to disable [workflows](</docs/en/workflows#turn-workflows-off>). Equivalent to the [`disableWorkflows`](</docs/en/settings-reference#disableworkflows>) setting `CLAUDE_CODE_EFFORT_LEVEL`| Set the effort level for supported models. Values: `low`, `medium`, `high`, `xhigh`, `max`, or `auto` to use the model default. Available levels depend on the model. Takes precedence over `--effort`, `/effort`, and the `modelSettings` and `effortLevel` settings. A [`maxEffortLevel`](</docs/en/settings-reference#maxeffortlevel>) cap still applies. See [Adjust effort level](</docs/en/model-config#adjust-effort-level>) @@ -331,7 +333,7 @@ `CLAUDE_CODE_REMOTE`| Set automatically to `true` when Claude Code is running as a [cloud session](</docs/en/claude-code-on-the-web>). Read this from a hook or setup script to detect whether you are in a cloud session `CLAUDE_CODE_REMOTE_SESSION_ID`| Set automatically in [cloud sessions](</docs/en/claude-code-on-the-web>) to the current session’s ID. Read this to construct a link back to the session transcript. See [Link output back to the session](</docs/en/cloud-environments#link-output-back-to-the-session>) `CLAUDE_CODE_RESTRICTED`| Set to `1` to start the session in restricted mode, the same as passing [`--restricted`](</docs/en/cli-reference#cli-flags>). Claude Code ignores this variable in a settings file’s `env` block. Requires Claude Code v2.1.248 or later -`CLAUDE_CODE_RESUME_INTERRUPTED_TURN`| Set to `1` to automatically resume if the previous session ended mid-turn. Used in SDK mode so the model continues without requiring the SDK to re-send the prompt. To turn this off, unset the variable or set it to `0`. Before v2.1.221, Claude Code ignored `0` and other falsy values, so setting `0` still triggered the resume in non-interactive mode and unsetting the variable was the only way to turn it off +`CLAUDE_CODE_RESUME_INTERRUPTED_TURN`| Set to `1` to automatically resume if the previous session ended mid-turn. Used in SDK mode so the model continues without requiring the SDK to re-send the prompt. To turn this off, unset the variable or set it to `0`. For the VS Code chat panel, see [Continue conversations after a reload](</docs/en/vs-code#continue-conversations-after-a-reload>) `CLAUDE_CODE_RESUME_INTERRUPTED_TURN_MAX_AGE_MS`| Maximum age in milliseconds of the last transcript message for a session that ended mid-turn to continue automatically on resume. When the last message is older than this bound, Claude Code skips the `CLAUDE_CODE_RESUME_INTERRUPTED_TURN` automatic resume and its `CLAUDE_CODE_RESUME_PROMPT` continuation message, and the session starts idle so you continue explicitly. Unset or `0` means no bound, except that a turn whose last request failed with an API error resumes only while that error is less than six hours old. A positive value bounds every turn, including those; a negative or non-numeric value applies a one-hour bound. Spawn scripts for long-running agents can set this so a restart against an old transcript doesn’t re-run a stale prompt. Claude Code sets a one-hour bound itself when it restarts a crashed [agent view](</docs/en/agent-view>) session that inherited its conversation from an interactive session. Requires Claude Code v2.1.211 or later `CLAUDE_CODE_RESUME_PROMPT`| Override the continuation message Claude Code sends to Claude when `CLAUDE_CODE_RESUME_INTERRUPTED_TURN` continues an interrupted turn instead of resending its prompt, or when you resume a [deferred tool call](</docs/en/hooks#defer-a-tool-call-for-later>) with `-p`. Defaults to `Continue from where you left off.`. An empty string uses the default `CLAUDE_CODE_RETRY_WATCHDOG`| Set to `1` for unattended sessions such as eval harnesses, CI jobs, or remote workers. Retries `429` and `529` capacity errors indefinitely instead of failing after `CLAUDE_CODE_MAX_RETRIES` attempts. Claude Code fails at once when a standard-speed request gets a `429` that reports a spend limit or exhausted usage credits, even one from a [gateway spend cap](</docs/en/errors#spend-limit-reached>) that resets on a schedule. Before v2.1.239, the watchdog retried these indefinitely. For fast mode requests, see [Handle rate limits](</docs/en/fast-mode#handle-rate-limits>). The watchdog backs off up to 5 minutes between attempts, or until the limit resets when the response carries a rate-limit reset time, so a session that hits a usage limit waits out the remaining window. On v2.1.199 or later it also raises the default retry count for other transient errors, such as server errors, timeouts, and dropped connections, to 300, roughly three hours of backoff, and removes the cap of 15 on `CLAUDE_CODE_MAX_RETRIES` if you set that variable explicitly. Requires Claude Code v2.1.186 or later @@ -512,6 +514,7 @@ * Sync the [skills](</docs/en/skills#where-synced-skills-load>) and [plugins](</docs/en/plugins/loading#synced-plugins>) enabled for your claude.ai account into your terminal sessions * Use [the advisor tool](</docs/en/advisor#requirements>) * Read or reply to [comments on an artifact](</docs/en/artifacts#collect-comments-on-an-artifact>) + * Have Claude read [another organization’s public artifact](</docs/en/artifacts#read-an-artifact-shared-with-you>) * Have Claude Code probe claude.ai connector servers for [MCP protocol revision 2026-07-28](</docs/en/mcp#mcp-client-runtimes>) unless you set `MCP_PROTOCOL_NEGOTIATION=auto` * Get the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) by default for claude.ai and Console accounts on Windows with Git Bash installed; Claude Code routes shell commands through Git Bash unless you set `CLAUDE_CODE_USE_POWERSHELL_TOOL=1`. On Windows without Git Bash, the tool stays on * Get [Claude-drafted feedback](</docs/en/tools-reference#sendfeedback-tool-behavior>), which Claude Code turns on through a fetched flag
modified
--- a/env-vars.md +++ b/env-vars.md @@ -42,7 +42,7 @@ To set it for every session, run `setx API_TIMEOUT_MS "1200000"` and open a new terminal. -The assignment line prints nothing on success, so confirm the variable is set by printing it in the same shell before you run `claude`: +The assignment line prints nothing on success. To confirm the variable is set, print it in the same shell: * macOS, Linux, WSL @@ -100,7 +100,7 @@ Numeric variables such as timeouts, token budgets, and retry counts accept scientific notation and digit-separator spellings in addition to plain digits, except where a variable’s row notes it takes plain digits only. For example, Claude Code reads `2e3` as 2000 and `64_000` as 64000. Before v2.1.211, these spellings could silently set a much smaller value, such as `1e6` setting a timeout to 1. -For variables that turn a behavior on or off, set `1` or `true` to turn it on and `0` or `false` to turn it off, in any casing.Some variables read only whether you set them at all, so any non-empty value including `0` turns the behavior on, and you turn the behavior off by unsetting the variable or setting it to an empty value. These variables work that way: +For variables that turn a behavior on or off, set `1`, `true`, `yes`, or `on` to turn it on and `0`, `false`, `no`, or `off` to turn it off, in any casing.Some variables read only whether you set them at all, so any non-empty value including `0` turns the behavior on, and you turn the behavior off by unsetting the variable or setting it to an empty value. These variables work that way: * `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` * `DISABLE_TELEMETRY` @@ -162,9 +162,9 @@ `API_FORCE_IDLE_TIMEOUT`| Override the 5-minute body idle timeout that aborts a streaming model response when no bytes arrive. Set to `0` to turn the timeout off, for example when a slow [gateway](</docs/en/llm-gateway>) or local model pauses longer than 5 minutes between chunks, or `1` to keep it on for every provider. When unset, the timeout is active on providers other than the direct Anthropic API, [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), and Amazon Bedrock with `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK=1` set. The [stream watchdogs](</docs/en/network-config#streaming-idle-watchdogs>) run independently of it and abort a long silent pause even when you set `0` here `API_TIMEOUT_MS`| Timeout for API requests in milliseconds (default: 600000, or 10 minutes; maximum: 2147483647). Increase this when requests time out on slow networks or when routing through a proxy. Values above the maximum overflow the underlying timer and cause requests to fail immediately `AWS_BEARER_TOKEN_BEDROCK`| Amazon Bedrock API key for authentication (see [Amazon Bedrock API keys](<https://aws.amazon.com/blogs/machine-learning/accelerate-ai-development-with-amazon-bedrock-api-keys/>)) -`BASH_DEFAULT_TIMEOUT_MS`| Default timeout for long-running bash commands (default: 120000, or 2 minutes) +`BASH_DEFAULT_TIMEOUT_MS`| Default timeout for a foreground Bash or PowerShell tool command, in milliseconds (default: 120000, or 2 minutes). A default longer than 30 minutes also becomes the default [time limit for background commands](</docs/en/tools-reference#time-limit-for-background-commands>). The background time limit requires Claude Code v2.1.285 or later `BASH_MAX_OUTPUT_LENGTH`| Maximum number of characters of bash output that Claude Code reads back into a command’s result (default: 30000; maximum: 150000). If you set the [`bashOutputMaxChars`](</docs/en/settings-reference#bashoutputmaxchars>) setting, Claude Code ignores this variable. See [Output limits](</docs/en/tools-reference#output-limits>) -`BASH_MAX_TIMEOUT_MS`| Maximum timeout the model can set for long-running bash commands (default: 600000, or 10 minutes). The effective ceiling is the larger of this and `BASH_DEFAULT_TIMEOUT_MS` +`BASH_MAX_TIMEOUT_MS`| Maximum timeout the model can set for a foreground Bash or PowerShell tool command, in milliseconds (default: 600000, or 10 minutes). The effective ceiling is the larger of this and `BASH_DEFAULT_TIMEOUT_MS`. An effective ceiling longer than 2 hours also becomes the maximum [time limit for background commands](</docs/en/tools-reference#time-limit-for-background-commands>). The background time limit requires Claude Code v2.1.285 or later `BETA_TRACING_ENDPOINT`| OTLP endpoint for [detailed beta tracing](</docs/en/monitoring-usage#traces-beta>): with `ENABLE_BETA_TRACING_DETAILED=1`, logs and traces go there instead of to the configured exporters. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) `CCR_FORCE_BUNDLE`| Set to `1` to force [`claude --cloud`](</docs/en/claude-code-on-the-web#send-local-repositories-without-github>) to bundle and upload your local repository instead of cloning from its remote `CLAUDECODE`| Set to `1` in subprocesses Claude Code spawns (Bash and PowerShell tools, tmux sessions, [hook](</docs/en/hooks>) commands, [status line](</docs/en/statusline>) commands, stdio [MCP server](</docs/en/mcp>) subprocesses). IDE extensions also set this in their integrated terminals. Use to detect when a script is running inside a subprocess spawned by Claude Code. To check whether the current process was spawned directly by a tool call or hook, rather than inside a stdio MCP server that Claude Code started, use `CLAUDE_CODE_CHILD_SESSION` instead @@ -233,6 +233,7 @@ `CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING`| Set to `1` to disable file [checkpointing](</docs/en/checkpointing>). The `/rewind` command will not be able to restore code changes. Overrides the [`fileCheckpointingEnabled`](</docs/en/settings-reference#filecheckpointingenabled>) setting `CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS`| Set to `1` to remove built-in commit and PR workflow instructions and the git status snapshot from Claude’s context. Useful when using your own git workflow skills. Takes precedence over the [`includeGitInstructions`](</docs/en/settings-reference#includegitinstructions>) setting when set `CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP`| Set to `1` to prevent automatic remapping of Opus 4.0 and 4.1 to the current Opus version on the Anthropic API. Use when you intentionally want to pin an older model. The remap does not run on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry +`CLAUDE_CODE_DISABLE_MODEL_ACCESS_FALLBACK`| Set to `1` to stop Claude Code on [Amazon Bedrock](</docs/en/amazon-bedrock#when-a-model-is-disabled-mid-session>) and [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai#when-a-model-is-disabled-mid-session>) from switching to an older model when your account loses access to a session’s model mid-session; the refused request fails at once instead. A [fallback model chain](</docs/en/model-config#fallback-model-chains>) you configure still switches on that refusal, and the [startup model checks](</docs/en/amazon-bedrock#startup-model-checks>) still fall back at launch. Requires Claude Code v2.1.285 or later `CLAUDE_CODE_DISABLE_MOUSE`| Set to `1` to disable mouse tracking in [fullscreen rendering](</docs/en/fullscreen>). Keyboard scrolling with `PgUp` and `PgDn` still works. Use this to keep your terminal’s native copy-on-select behavior `CLAUDE_CODE_DISABLE_MOUSE_CLICKS`| Set to `1` to disable click, drag, and hover handling in [fullscreen rendering](</docs/en/fullscreen>) while keeping mouse-wheel scrolling. Use this when you want wheel scroll to work inside Claude Code but don’t want clicks to position the cursor, expand tool output, or open links. `CLAUDE_CODE_DISABLE_MOUSE` takes precedence when both are set. Requires Claude Code v2.1.195 or later `CLAUDE_CODE_DISABLE_MTLS_RELOAD_ON_STALE_CONNECTION`| Set to `1` to stop Claude Code from re-reading the [mTLS client certificate and key](</docs/en/network-config#mtls-authentication>) when an API request fails with a connection-level error, such as a connection reset or a TLS handshake error. With the reload disabled, Claude Code loads rotated files only when it next applies settings or at the next startup. Requires Claude Code v2.1.232 or later @@ -351,6 +352,7 @@ `CLAUDE_CODE_SKIP_FAST_MODE_ORG_CHECK`| Set to `1` to skip the client-side [fast mode](</docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways>) availability check, for proxies that intercept the check’s request rather than refuse it. The API still rejects fast mode requests when your organization has fast mode disabled `CLAUDE_CODE_SKIP_FOUNDRY_AUTH`| Skip Azure authentication for Microsoft Foundry, for a proxy or gateway that injects its own `Authorization` header. Claude Code sends requests without an Azure credential and preserves the `Authorization` header you supply, for example through `ANTHROPIC_CUSTOM_HEADERS`. Ignored when `ANTHROPIC_FOUNDRY_API_KEY` or `ANTHROPIC_FOUNDRY_AUTH_TOKEN` is set. Before v2.1.203, this variable left the Microsoft Foundry client unable to send requests unless an API key was also set `CLAUDE_CODE_SKIP_MANTLE_AUTH`| Skip AWS authentication for Amazon Bedrock Mantle (for example, when using an LLM gateway) +`CLAUDE_CODE_SKIP_MODEL_ACCESS_MEMORY`| The [startup model checks](</docs/en/amazon-bedrock#startup-model-checks>) on [Amazon Bedrock](</docs/en/amazon-bedrock>) and [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>) remember on this machine which models they found your account can’t invoke, for up to a day. Set to `1` to turn that memory off. Requires Claude Code v2.1.285 or later `CLAUDE_CODE_SKIP_PROMPT_HISTORY`| Set to `1` to skip writing prompt history and session transcripts to disk. Sessions started with this variable set do not appear in `--resume`, `--continue`, or up-arrow history. Useful for ephemeral scripted sessions `CLAUDE_CODE_SKIP_VERTEX_AUTH`| Skip Google authentication for Google Cloud’s Agent Platform (for example, when using an LLM gateway) `CLAUDE_CODE_STARTUP_FAILURE_RESULTS`| Set to `1` to have a session started with `--output-format stream-json` write a [result message naming why Claude Code refused to start](</docs/en/agent-sdk/typescript#startup_failure_reason>) for startup failures that otherwise end with stderr alone. Requires Claude Code v2.1.274 or later
modified
--- a/env-vars.md +++ b/env-vars.md @@ -90,7 +90,7 @@ Precedence -Some behaviors have both an environment variable and a dedicated settings key, and which one Claude Code reads first differs per key. For `ANTHROPIC_MODEL` and `CLAUDE_CODE_AUTO_CONNECT_IDE`, Claude Code reads the variable first and uses the `model` or `autoConnectIde` setting only when the variable is unset. For the pair you’re setting, check the variable’s row below and the key’s entry on the [settings reference](</docs/en/settings-reference>). When the same variable is set in both your shell and a settings file `env` block, the settings file value applies. Claude Code writes each `env` entry into the process environment, replacing the value inherited from the shell. The [`env` setting](</docs/en/settings-reference#when-claude-code-applies-env-values>) says when it applies them. A few variables are special-cased; the [`env` setting](</docs/en/settings-reference#env>) lists the exceptions. In a settings file you can set a variable but you can’t remove one. To override a variable you can’t unset, such as a stale `CLAUDE_CODE_USE_VERTEX` exported by a shell profile you don’t control, set it to an empty string in the `env` block: `"CLAUDE_CODE_USE_VERTEX": ""`. Claude Code treats the empty value as unset for provider selection. Subprocesses still inherit the empty value. Between settings files, `env` values follow [settings precedence](</docs/en/settings#settings-precedence>), so a managed settings entry overrides the same variable in user or project settings. Project and local settings can’t set some variables, such as `CLAUDE_CONFIG_DIR` and the OpenTelemetry exporter variables. [Variables Claude Code ignores in `env`](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) lists them, along with the OpenTelemetry off values that still apply. How an environment variable interacts with CLI flags and in-session commands varies per feature: `--model` and `/model` override `ANTHROPIC_MODEL`, while `CLAUDE_CODE_EFFORT_LEVEL` overrides `--effort` and `/effort`. When a variable interacts with another configuration source, its row in the Variables list states the precedence or links to the page that documents it. Claude Code reads shell environment variables at startup, so changes to them take effect the next time you launch `claude`. Variables set under the `env` key in settings files are reapplied to a running session when the file changes, with the startup-only exception described in In settings files. +Some behaviors have both an environment variable and a dedicated settings key, and which one Claude Code reads first differs per key. For `ANTHROPIC_MODEL` and `CLAUDE_CODE_AUTO_CONNECT_IDE`, Claude Code reads the variable first and uses the `model` or `autoConnectIde` setting only when the variable is unset. For the pair you’re setting, check the variable’s row below and the key’s entry on the [settings reference](</docs/en/settings-reference>). When the same variable is set in both your shell and a settings file `env` block, the settings file value applies in most sessions. Claude Code writes each `env` entry into the process environment, replacing the value inherited from the shell. [How `env` values interact with your shell](</docs/en/settings-reference#how-env-values-interact-with-your-shell>) covers the sessions that keep the inherited value instead, and the [`env` setting](</docs/en/settings-reference#when-claude-code-applies-env-values>) says when it applies them. A few variables are special-cased; the [`env` setting](</docs/en/settings-reference#env>) lists the exceptions. In a settings file you can set a variable but you can’t remove one. To override a variable you can’t unset, such as a stale `CLAUDE_CODE_USE_VERTEX` exported by a shell profile you don’t control, set it to an empty string in the `env` block: `"CLAUDE_CODE_USE_VERTEX": ""`. Claude Code treats the empty value as unset for provider selection. Subprocesses still inherit the empty value. Between settings files, `env` values follow [settings precedence](</docs/en/settings#settings-precedence>), so a managed settings entry overrides the same variable in user or project settings. Project and local settings can’t set some variables, such as `CLAUDE_CONFIG_DIR` and the OpenTelemetry exporter variables. [Variables Claude Code ignores in `env`](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) lists them, along with the OpenTelemetry off values that still apply. How an environment variable interacts with CLI flags and in-session commands varies per feature: `--model` and `/model` override `ANTHROPIC_MODEL`, while `CLAUDE_CODE_EFFORT_LEVEL` overrides `--effort` and `/effort`. When a variable interacts with another configuration source, its row in the Variables list states the precedence or links to the page that documents it. Claude Code reads shell environment variables at startup, so changes to them take effect the next time you launch `claude`. Variables set under the `env` key in settings files are reapplied to a running session when the file changes, with the startup-only exception described in In settings files. ## @@ -159,7 +159,7 @@ `ANTHROPIC_VERTEX_BASE_URL`| Override Google Cloud’s Agent Platform endpoint URL. Use for custom Google Cloud’s Agent Platform endpoints or when routing through an [LLM gateway](</docs/en/llm-gateway>). See [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>) `ANTHROPIC_VERTEX_PROJECT_ID`| GCP project ID that Google Cloud’s Agent Platform requests are addressed to. See [Configure GCP credentials](</docs/en/google-vertex-ai#3-configure-gcp-credentials>) `ANTHROPIC_WORKSPACE_ID`| Workspace ID for [workload identity federation](<https://platform.claude.com/docs/en/manage-claude/workload-identity-federation>). Set this when your federation rule is scoped to more than one workspace so the token exchange knows which workspace to target -`API_FORCE_IDLE_TIMEOUT`| Override the 5-minute body idle timeout that aborts a streaming model response when no bytes arrive. Set to `0` to turn the timeout off, for example when a slow [gateway](</docs/en/llm-gateway>) or local model pauses longer than 5 minutes between chunks, or `1` to keep it on for every provider. When unset, the timeout is active on providers other than the direct Anthropic API and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>). The [stream watchdogs](</docs/en/network-config#streaming-idle-watchdogs>) run independently of it and abort a long silent pause even when you set `0` here +`API_FORCE_IDLE_TIMEOUT`| Override the 5-minute body idle timeout that aborts a streaming model response when no bytes arrive. Set to `0` to turn the timeout off, for example when a slow [gateway](</docs/en/llm-gateway>) or local model pauses longer than 5 minutes between chunks, or `1` to keep it on for every provider. When unset, the timeout is active on providers other than the direct Anthropic API, [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), and Amazon Bedrock with `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK=1` set. The [stream watchdogs](</docs/en/network-config#streaming-idle-watchdogs>) run independently of it and abort a long silent pause even when you set `0` here `API_TIMEOUT_MS`| Timeout for API requests in milliseconds (default: 600000, or 10 minutes; maximum: 2147483647). Increase this when requests time out on slow networks or when routing through a proxy. Values above the maximum overflow the underlying timer and cause requests to fail immediately `AWS_BEARER_TOKEN_BEDROCK`| Amazon Bedrock API key for authentication (see [Amazon Bedrock API keys](<https://aws.amazon.com/blogs/machine-learning/accelerate-ai-development-with-amazon-bedrock-api-keys/>)) `BASH_DEFAULT_TIMEOUT_MS`| Default timeout for long-running bash commands (default: 120000, or 2 minutes) @@ -285,7 +285,7 @@ `CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS`| How many [subagents](</docs/en/sub-agents#concurrent-subagent-limit>) can be running in one session before the Agent tool refuses to spawn another (default: 20). Accepts a positive whole number in plain digits; anything else is ignored, so the variable can adjust the cap but can’t disable it. Requires Claude Code v2.1.217 or later `CLAUDE_CODE_MAX_CONTEXT_TOKENS`| Override the context window size Claude Code assumes for the active model. As of v2.1.193, how it applies depends on how Claude Code resolves the model ID; see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>). Use this when routing to a model through `ANTHROPIC_BASE_URL` whose context window does not match the built-in size for its name `CLAUDE_CODE_MAX_MCP_DESCRIPTION_LENGTH`| Maximum length in characters of each MCP tool description and each MCP server’s instructions that Claude Code sends to the model (default: 2048). Claude Code [truncates longer text](</docs/en/mcp#for-mcp-server-authors>). Accepts a positive whole number in plain digits. Anything else is ignored and the default applies. Requires Claude Code v2.1.280 or later -`CLAUDE_CODE_MAX_OUTPUT_TOKENS`| Set the maximum number of output tokens for most requests. Defaults and caps vary by model; see [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>). Claude Code defaults to 32000 for model IDs it doesn’t recognize, such as gateway-specific names, and lowers values above a model’s cap to the cap. Increasing this value reduces the effective context window available before [auto-compaction](</docs/en/costs#reduce-token-usage>) triggers +`CLAUDE_CODE_MAX_OUTPUT_TOKENS`| Set the maximum number of output tokens for most requests. Defaults and caps vary by model; see [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>). Claude Code lowers a value above a model’s cap to the cap. For a model ID Claude Code can’t resolve to a model it knows, the default is 32000 and the cap is 128000. Increasing this value reduces the effective context window available before [auto-compaction](</docs/en/costs#reduce-token-usage>) triggers `CLAUDE_CODE_MAX_RETRIES`| Override the number of times to retry failed API requests (default: 10). Capped at 15 as of v2.1.186; as of v2.1.199, `CLAUDE_CODE_RETRY_WATCHDOG` raises the default and removes the cap. For unattended sessions that need to wait through longer outages, set `CLAUDE_CODE_RETRY_WATCHDOG` instead `CLAUDE_CODE_MAX_SUBAGENTS_PER_SESSION`| Removed in v2.1.224 and now a no-op. Previously capped the total number of [subagents](</docs/en/sub-agents>) Claude could spawn with the Agent tool in one session (default: 200); spawning past the cap failed with `Subagent spawn limit reached`. The [concurrent subagent limit](</docs/en/sub-agents#concurrent-subagent-limit>) and the [depth limit](</docs/en/sub-agents#let-subagents-spawn-their-own-subagents>) still apply `CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH`| Number of [subagent layers](</docs/en/sub-agents#let-subagents-spawn-their-own-subagents>) allowed below the main conversation (default: 3). At the default, subagents can spawn their own subagents, and a subagent at the third layer can’t spawn further; set `1` to turn nesting off. In v2.1.217 through v2.1.218, the default was 1, so a subagent couldn’t spawn its own unless you raised the limit; v2.1.219 raised the default to 3. Accepts a positive whole number in plain digits; anything else is ignored, so the limit can be adjusted but not removed. Requires Claude Code v2.1.217 or later @@ -367,7 +367,7 @@ `CLAUDE_CODE_SYNTAX_HIGHLIGHT`| Set to `false` to disable syntax highlighting in diff output. Useful when colors interfere with your terminal setup. To also disable highlighting in code blocks and file previews, use the [`syntaxHighlightingDisabled`](</docs/en/settings-reference#syntaxhighlightingdisabled>) setting `CLAUDE_CODE_TASK_LIST_ID`| Share a task list across sessions. Set the same ID in multiple Claude Code instances to coordinate on a shared task list, in [sessions that have the Task tools](</docs/en/tools-reference#task-tool-availability>). See [Task list](</docs/en/interactive-mode#task-list>) `CLAUDE_CODE_TEAM_TEARDOWN_PARK_TIMEOUT_MS`| Override, in milliseconds, how long a non-interactive session waits at exit for its [agent team](</docs/en/agent-teams>) to finish tearing down. Accepts 1000 to 60000; an out-of-range value is ignored and the default of 10000 applies. Requires Claude Code v2.1.206 or later -`CLAUDE_CODE_TMPDIR`| Override the temp directory used for internal temp files. Claude Code appends `/claude-{uid}/` on Unix or `/claude/` on Windows to this path. Default: `/tmp` on macOS, `os.tmpdir()` on Linux and Windows. On macOS and Linux, [sandboxed](</docs/en/sandboxing>) Bash subprocesses receive a short fallback `$TMPDIR` under the system default when your override is a long path, since some tools fail when temp paths get too long. Unsandboxed Bash commands inherit your shell’s `$TMPDIR` when it is set. Claude Code’s own temp files always use your override. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) +`CLAUDE_CODE_TMPDIR`| Override the temp directory used for internal temp files. Claude Code appends `/claude-{uid}/` to this path on Unix, or `/claude/` on Windows. Default: `/tmp` on macOS, `os.tmpdir()` on Linux and Windows. On macOS and Linux, [sandboxed](</docs/en/sandboxing>) Bash subprocesses receive a short fallback `$TMPDIR` under the system default when your override is a long path, since some tools fail when temp paths get too long. Unsandboxed Bash commands inherit your shell’s `$TMPDIR` when it is set. On native Windows, when your shell doesn’t set `$TMPDIR`, a Bash command that references `$TMPDIR` receives your override, or `%TEMP%` when you haven’t set one. Claude Code’s own temp files always use your override. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) `CLAUDE_CODE_TMUX_TRUECOLOR`| Set to any non-empty value, such as `1`, to allow 24-bit truecolor output inside tmux. **Setting it to`0` or `false` still allows truecolor**, unlike most on/off variables; unset the variable to restore the 256-color clamp. By default, Claude Code clamps to 256 colors when `$TMUX` is set because tmux does not pass through truecolor escape sequences unless configured to. Set this after adding `set -ga terminal-overrides ',*:Tc'` to your `~/.tmux.conf`. See [Terminal configuration](</docs/en/terminal-config>) for other tmux settings `CLAUDE_CODE_TOOL_MEMORY_CGROUP_EXCLUDE`| On Linux and WSL, set to a comma-separated list of the kinds of processes Claude Code [excludes from the tool memory cap](</docs/en/tools-reference#memory-limit-on-linux-and-wsl>), such as `mcp` or `lsp`. Set `none` to cap every kind, or `all-new` to cap only Bash, PowerShell, and Monitor tool commands. Claude Code keeps Bash, PowerShell, and Monitor tool commands under the cap whatever you list. Requires Claude Code v2.1.246 or later `CLAUDE_CODE_TOOL_MEMORY_LIMIT`| On Linux and WSL, set to a size such as `4G` to [cap the memory that Bash and PowerShell tool commands can use](</docs/en/tools-reference#memory-limit-on-linux-and-wsl>), and Monitor tool commands on v2.1.246 or later. Write the size in plain digits, alone for a number of bytes or with a `K`, `M`, `G`, or `T` suffix. Set `0` or `off` to turn the cap off. Once the first process Claude Code starts has turned the cap on or off, a changed value takes effect the next time you launch `claude`. Requires Claude Code v2.1.233 or later @@ -414,8 +414,8 @@ `DISABLE_PROMPT_CACHING`| Set to `1` to disable [prompt caching](</docs/en/prompt-caching#disable-prompt-caching>) for all models (takes precedence over per-model settings) `DISABLE_PROMPT_CACHING_FABLE`| Set to `1` to disable prompt caching for Fable models `DISABLE_PROMPT_CACHING_HAIKU`| Set to `1` to disable prompt caching for the [default Haiku model](</docs/en/prompt-caching#disable-prompt-caching>), wherever it runs -`DISABLE_PROMPT_CACHING_OPUS`| Set to `1` to disable prompt caching for Opus models -`DISABLE_PROMPT_CACHING_SONNET`| Set to `1` to disable prompt caching for Sonnet models +`DISABLE_PROMPT_CACHING_OPUS`| Set to `1` to disable prompt caching for the [default Opus model](</docs/en/prompt-caching#disable-prompt-caching>) +`DISABLE_PROMPT_CACHING_SONNET`| Set to `1` to disable prompt caching for the [default Sonnet model](</docs/en/prompt-caching#disable-prompt-caching>) `DISABLE_TELEMETRY`| Set to any non-empty value, such as `1`, to opt out of telemetry. **Setting it to`0` or `false` still opts out**, unlike most on/off variables; unset the variable to turn telemetry back on. Telemetry events don’t include user data like code, file paths, or Bash commands. Also disables feature-flag fetching. See [Turn telemetry off for your organization](</docs/en/managed-settings#turn-telemetry-off-for-your-organization>) `DISABLE_UPDATES`| Set to `1` to block all updates including manual `claude update` and `claude install`. Stricter than `DISABLE_AUTOUPDATER`. Use when distributing Claude Code through your own channels and users should not self-update `DISABLE_UPGRADE_COMMAND`| Set to `1` to hide the `/upgrade` command
modified
--- a/env-vars.md +++ b/env-vars.md @@ -207,8 +207,8 @@ `CLAUDE_CODE_CONNECT_TIMEOUT_MS`| Removed in v2.1.186 and now a no-op. Previously set a separate timeout for the connect, TLS, and response-header phase of a streaming API request. Use `API_TIMEOUT_MS` for the per-request timeout. For the response-header phase of a streaming request, see `CLAUDE_STREAM_FIRST_BYTE_TIMEOUT_MS` `CLAUDE_CODE_DEBUG_LOGS_DIR`| Override the debug log file path. Despite the name, this is a file path, not a directory. Requires debug mode to be enabled separately via `--debug`, `/debug`, or the `DEBUG` environment variable: setting this variable alone does not enable logging. The [`--debug-file`](</docs/en/cli-reference#cli-flags>) flag does both at once. Defaults to `~/.claude/debug/<session-id>.txt` `CLAUDE_CODE_DEBUG_LOG_LEVEL`| Minimum log level written to the debug log file. Values: `verbose`, `debug` (default), `info`, `warn`, `error`. Set to `verbose` to include high-volume diagnostics like full status line command output, or raise to `error` to reduce noise -`CLAUDE_CODE_DISABLE_1M_CONTEXT`| Set to `1` to disable [1M context window](</docs/en/model-config#extended-context>) support. When set, 1M model variants are unavailable in the model picker, and Claude Code holds sessions on models with a native 1M window, such as [Sonnet 5](</docs/en/model-config#sonnet-5-context-window>) and the Fable models, to a 200K window; see [Extended context](</docs/en/model-config#extended-context>) for how the hold is enforced. Useful for enterprise environments with compliance requirements. For its role in correcting the window for an unrecognized `[1m]` model ID, see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>) -`CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING`| Set to `1` to disable [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) on Opus 4.6 and Sonnet 4.6 and fall back to the fixed thinking budget controlled by `MAX_THINKING_TOKENS`. Has no effect on [Fable models](</docs/en/model-config#extended-thinking>), Sonnet 5, or Opus 4.7 and later, which always use adaptive reasoning +`CLAUDE_CODE_DISABLE_1M_CONTEXT`| Set to `1` to disable [1M context window](</docs/en/model-config#extended-context>) support. When set, 1M model variants are unavailable in the model picker, and Claude Code holds sessions on models with a native 1M window, such as [Sonnet 5.5](</docs/en/model-config#sonnet-5-5-and-sonnet-5-context-window>) and the Fable models, to a 200K window; see [Extended context](</docs/en/model-config#extended-context>) for how the hold is enforced. Useful for enterprise environments with compliance requirements. For its role in correcting the window for an unrecognized `[1m]` model ID, see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>) +`CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING`| Set to `1` to disable [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) on Opus 4.6 and Sonnet 4.6 and fall back to the fixed thinking budget controlled by `MAX_THINKING_TOKENS`. Has no effect on [Fable models](</docs/en/model-config#extended-thinking>), Sonnet 5 and later, or Opus 4.7 and later, which always use adaptive reasoning `CLAUDE_CODE_DISABLE_ADMIN_ENV_UNION`| Set to `1` to stop Claude Code from merging [managed settings](</docs/en/managed-settings#precedence-within-the-managed-tier>) `env` blocks per key across admin sources, so only the highest-priority source’s whole `env` block applies, as before v2.1.223. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.223 or later `CLAUDE_CODE_DISABLE_ADVISOR_TOOL`| Set to `1` to disable the [advisor tool](</docs/en/advisor>). The `/advisor` command becomes unavailable, any configured `advisorModel` is ignored, and the `--advisor` flag is accepted but has no effect, so existing scripts that pass it continue to work without errors `CLAUDE_CODE_DISABLE_AGENT_VIEW`| Set to `1` to turn off [background agents and agent view](</docs/en/agent-view>): `claude agents`, `--bg`, `/background`, and the on-demand supervisor. Equivalent to the [`disableAgentView`](</docs/en/settings-reference#disableagentview>) setting @@ -245,7 +245,7 @@ `CLAUDE_CODE_DISABLE_POWERSHELL_CMD_RM_DENY`| Set to `1` to turn off the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) check that denies the `cmd` built-ins `rd`, `rmdir`, `del`, and `erase` on a [system path](</docs/en/permission-modes#remove-item-in-powershell>), such as a drive root or your home directory. Claude Code ignores this variable in a settings file’s `env` block. Requires Claude Code v2.1.283 or later `CLAUDE_CODE_DISABLE_SUBSTITUTION_RM_PROMPT`| Set to `1` to turn off the [critical-path](</docs/en/permission-modes#critical-paths>) check for a recursive `rm` whose target is entirely the output of a command substitution, such as `rm -rf "$(pwd)"`. The other critical-path checks keep running. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.281 or later `CLAUDE_CODE_DISABLE_TERMINAL_TITLE`| Set to `1` to disable automatic terminal title updates based on conversation context. This also skips the background small/fast-model request that [generates a session title](</docs/en/sessions#name-your-sessions>) -`CLAUDE_CODE_DISABLE_THINKING`| Set to `1` to omit the `thinking` parameter from API requests entirely. This is a compatibility option for proxies and gateways that reject the parameter. On models that think by default, omitting the parameter means the model may still think. To explicitly disable [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) on the Anthropic API, use `MAX_THINKING_TOKENS=0` instead. Neither variable turns thinking off on Opus 5.5 or the Fable models, which can’t have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `MAX_THINKING_TOKENS=0` likewise omits the parameter, so the two variables behave the same there +`CLAUDE_CODE_DISABLE_THINKING`| Set to `1` to omit the `thinking` parameter from API requests entirely. This is a compatibility option for proxies and gateways that reject the parameter. On models that think by default, omitting the parameter means the model may still think. To explicitly disable [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) on the Anthropic API, use `MAX_THINKING_TOKENS=0` instead. Neither variable turns thinking off on Opus 5.5, Sonnet 5.5, or the Fable models, which can’t have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `MAX_THINKING_TOKENS=0` likewise omits the parameter, so the two variables behave the same there `CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT`| Set to `1` to skip proactive [auto-compaction](</docs/en/costs#reduce-token-usage>) when Claude Code doesn’t recognize the model ID, such as an [LLM gateway](</docs/en/llm-gateway>) alias. Without this variable, Claude Code compacts at the context window it assumes for the ID. `CLAUDE_CODE_MAX_CONTEXT_TOKENS` can correct the assumed window instead; see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>) for when each variable applies. Requires Claude Code v2.1.223 or later `CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL`| Set to `1` to disable virtual scrolling in [fullscreen rendering](</docs/en/fullscreen>) and render every message in the transcript. Use this if scrolling in fullscreen mode shows blank regions where messages should appear `CLAUDE_CODE_DISABLE_WINDOWS_SHELL_LAUNCHER`| Set to `1` to start [PowerShell tool](</docs/en/tools-reference#powershell-tool>) commands on Windows directly instead of through the `cmd.exe` launcher. By default, the launcher lets a PowerShell command [running in the background](</docs/en/tools-reference#background-commands>) [carry over to the session’s next process](</docs/en/agent-view#the-supervisor-process>), such as when you [background the session](</docs/en/agent-view#from-inside-a-session>). If you set the variable, a backgrounded PowerShell command stops when the session’s process exits. Bash commands aren’t affected. Requires Claude Code v2.1.269 or later @@ -385,7 +385,7 @@ `CLAUDE_CODE_WORKFLOW_PREFIX_STAGGER_MS`| Upper bound in milliseconds on how long a [workflow](</docs/en/workflows>) agent waits for a same-prefix sibling’s first response to begin before sending its own first request. When a fan-out starts several agents that share a [prompt-cache prefix](</docs/en/workflows#prompt-caching-in-a-fan-out>), Claude Code holds all but the first agent for up to this long so the rest read the cached prefix instead of each processing it uncached. Default `5000`. Set to `0` to disable the wait. When `DISABLE_PROMPT_CACHING` is set, agents never wait. Requires Claude Code v2.1.229 or later `CLAUDE_CONFIG_DIR`| Override the configuration directory (default: `~/.claude`). All settings, session history, and plugins are stored under this path. For credentials, see [where Claude Code stores credentials](</docs/en/authentication#credential-management>). Useful for running multiple accounts side by side: for example, `alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'`. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) `CLAUDE_DISABLE_ADOPT`| Set to `1` to stop in-flight background work instead of carrying it over when you background a session by pressing `←` or with [`/background`](</docs/en/agent-view#from-inside-a-session>). Claude Code asks you to confirm before backgrounding, then stops the tasks that would otherwise carry over. Requires Claude Code v2.1.195 or later -`CLAUDE_EFFORT`| Set automatically in Bash tool subprocesses and hook commands to the [effort level](</docs/en/model-config#adjust-effort-level>) in effect when the subprocess starts: `low`, `medium`, `high`, `xhigh`, or `max`. Ultracode is not a distinct level and reports as `xhigh`. Matches the `effort.level` field passed to [hooks](</docs/en/hooks>). Only set when the current model supports the effort parameter +`CLAUDE_EFFORT`| Set automatically in Bash tool subprocesses and hook commands to the [effort level](</docs/en/model-config#adjust-effort-level>) in effect when the subprocess starts: `low`, `medium`, `high`, `xhigh`, or `max`. Matches the `effort.level` field passed to [hooks](</docs/en/hooks>). Only set when the current model supports the effort parameter `CLAUDE_ENABLE_BYTE_WATCHDOG`| Set to `1` to force-enable the byte-level streaming idle watchdog, or set to `0` to force-disable it. `0` also turns off the [first-byte deadline](</docs/en/network-config#streaming-idle-watchdogs>) on the connections where that deadline runs. When unset, the watchdog is enabled by default for direct Anthropic API and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) connections, and for streaming responses on [gateway](</docs/en/gateways>) connections reached through `ANTHROPIC_BASE_URL` or `ANTHROPIC_AWS_BASE_URL`; before v2.1.222 it didn’t run on those gateway connections, so the event-level watchdog could report a stall there even while keep-alive pings were arriving. For timeouts and how the timers interact, see [Streaming idle watchdogs](</docs/en/network-config#streaming-idle-watchdogs>) `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK`| Set to `1` to enable the byte-level streaming idle watchdog on Amazon Bedrock `vnd.amazon.eventstream` responses, which also enables the [first-byte deadline](</docs/en/network-config#streaming-idle-watchdogs>) on Bedrock streaming requests. Off by default. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS` `CLAUDE_ENABLE_STREAM_WATCHDOG`| Set to `0` to force-disable the event-level streaming idle watchdog, or set to `1` to force-enable it. When unset, the watchdog is on by default for all providers. Before v2.1.196, the unset default was server-controlled on the direct Anthropic API and off on other providers. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS`; for the other stall timers that run alongside this one, see [Streaming idle watchdogs](</docs/en/network-config#streaming-idle-watchdogs>) @@ -434,7 +434,7 @@ `IS_DEMO`| Set to any non-empty value, such as `1`, to enable demo mode: hides your email and organization name from the header and `/status` output, and skips onboarding. **Setting it to`0` or `false` still enables demo mode**, unlike most on/off variables; unset the variable to turn it off. Useful when streaming or recording a session `MAX_MCP_OUTPUT_TOKENS`| Maximum number of tokens allowed in MCP tool responses. Claude Code displays a warning when output exceeds 10,000 tokens. Tools that declare [`anthropic/maxResultSizeChars`](</docs/en/mcp#raise-the-limit-for-a-specific-tool>) use that character limit for text content instead, but image content from those tools is still subject to this variable (default: 25000) `MAX_STRUCTURED_OUTPUT_RETRIES`| Number of attempts Claude Code allows when the model’s response fails validation against the [`--json-schema`](</docs/en/cli-reference#cli-flags>) in non-interactive mode with the `-p` flag; after that many failed attempts with no valid output, the run fails. The same cap applies when a [workflow](</docs/en/workflows>) subagent’s structured output fails validation. Defaults to 5, a first attempt plus four retries -`MAX_THINKING_TOKENS`| Fixed token budget for [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>). Claude Code caps it at one token below the request’s max output tokens and never below 1,024. See `CLAUDE_CODE_MAX_OUTPUT_TOKENS` for how that limit is set. When unset and thinking is enabled, models with [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) choose their own thinking depth, and other models use the cap. Set to `0` to disable thinking on the Anthropic API, except on Opus 5.5 and the Fable models, which can’t have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `0` omits the `thinking` parameter instead. With thinking turned off on the Anthropic API, Claude Code sends effort `high` instead of a higher level to models it knows [don’t accept that combination](</docs/en/errors#effort-isnt-available-with-thinking-turned-off>), such as Opus 5. Claude Code ignores nonzero values on adaptive reasoning models, except on the models where `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` turns adaptive reasoning off +`MAX_THINKING_TOKENS`| Fixed token budget for [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>). Claude Code caps it at one token below the request’s max output tokens and never below 1,024. See `CLAUDE_CODE_MAX_OUTPUT_TOKENS` for how that limit is set. When unset and thinking is enabled, models with [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) choose their own thinking depth, and other models use the cap. Set to `0` to disable thinking on the Anthropic API, except on Opus 5.5, Sonnet 5.5, and the Fable models, which can’t have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `0` omits the `thinking` parameter instead. With thinking turned off on the Anthropic API, Claude Code sends effort `high` instead of a higher level to models it knows [don’t accept that combination](</docs/en/errors#effort-isnt-available-with-thinking-turned-off>), such as Opus 5. Claude Code ignores nonzero values on adaptive reasoning models, except on the models where `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` turns adaptive reasoning off `MCP_CLIENT_SECRET`| OAuth client secret for MCP servers that require [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>). Avoids the interactive prompt when adding a server with `--client-secret` `MCP_CONNECTION_NONBLOCKING`| Controls whether startup waits for MCP servers to connect before the first query. MCP startup is non-blocking by default: servers connect in the background and their tools become available as they finish. Set to `0` to make Claude Code wait for servers to connect before the first query. Servers configured with [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>) still make startup wait regardless, except when served from the [discovery cache](</docs/en/mcp#server-status-detail>), since their tools must be present when the first prompt is built. In non-interactive mode (`-p`) without `--input-format stream-json`, Claude Code also waits for still-pending servers before the first turn regardless of this variable. When you pass [`--mcp-config`](</docs/en/cli-reference#cli-flags>) explicitly, the wait has a longer deadline; see that flag’s entry for the cached-server exception `MCP_CONNECT_TIMEOUT_MS`| How long blocking MCP startup waits, in milliseconds, for the connection batch before snapshotting the tool list (default: 5000). Applies when `MCP_CONNECTION_NONBLOCKING=0` or for servers marked [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>). Servers still pending at the deadline keep connecting in the background. Distinct from `MCP_TIMEOUT`, which bounds an individual server’s connect attempt @@ -455,7 +455,7 @@ `OTEL_LOG_MANAGED_SETTINGS`| Set to `1` to add the redacted managed settings, and a SHA-256 digest of the settings before redaction, to `managed_settings_resolved` OpenTelemetry log events. Disabled by default. Set it in your shell, user settings, or managed settings; a value in project or local settings doesn’t turn it on. Requires Claude Code v2.1.274 or later. See [Monitoring](</docs/en/monitoring-usage#managed-settings-resolved-event>) `OTEL_LOG_RAW_API_BODIES`| Emit Anthropic Messages API request and response JSON as `api_request_body` / `api_response_body` log events. Set to `1` for inline bodies truncated at the content limit, or `file:<dir>` to write untruncated bodies to disk and emit a `body_ref` path instead. `CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH` configures the content limit, 60 KB by default. Disabled by default; bodies include the entire conversation history. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). See [Monitoring](</docs/en/monitoring-usage#api-request-body-event>) `OTEL_LOG_TOOL_CONTENT`| Set to `1` to include tool content in the `tool.output` OpenTelemetry span event. Span attributes carry tool content under [their own gates](</docs/en/monitoring-usage#new-context-gates>). Requires [tracing](</docs/en/monitoring-usage#traces-beta>). Disabled by default to protect sensitive data. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>), apart from the off values that section describes. See [Monitoring](</docs/en/monitoring-usage#tool-output-span-event>) -`OTEL_LOG_TOOL_DETAILS`| Set to `1` to include tool input arguments, MCP server names, user-authored workflow names, raw error strings on tool failures, the refusal `category` on `api_refusal` events, and other tool details in OpenTelemetry traces and logs. Disabled by default to protect PII. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>), apart from the off values that section describes. See [Monitoring](</docs/en/monitoring-usage>) +`OTEL_LOG_TOOL_DETAILS`| Set to `1` to include tool input arguments; MCP server names; user-authored workflow names; raw error strings on tool failures; the refusal `category` on `api_refusal` events; real agent, skill, plugin, and MCP server names on [cost and token metrics](</docs/en/monitoring-usage#cost-counter>); and other tool details in OpenTelemetry metrics, traces, and logs. Disabled by default to protect PII. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>), apart from the off values that section describes. See [Monitoring](</docs/en/monitoring-usage>) `OTEL_LOG_USER_PROMPTS`| Set to `1` to include user prompt text in OpenTelemetry traces and logs. Disabled by default (prompts are redacted). Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>), apart from the off values that section describes. See [Monitoring](</docs/en/monitoring-usage>) `OTEL_METRICS_INCLUDE_ACCOUNT_UUID`| Set to `false` to exclude account UUID from metrics attributes (default: included). See [Monitoring](</docs/en/monitoring-usage>) `OTEL_METRICS_INCLUDE_ENTRYPOINT`| Set to `true` to include the session entrypoint in metrics attributes (default: excluded). Added in v2.1.152. See [Monitoring](</docs/en/monitoring-usage>) @@ -479,6 +479,7 @@ `VERTEX_REGION_CLAUDE_4_7_OPUS`| Override region for Claude Opus 4.7 when using Google Cloud’s Agent Platform `VERTEX_REGION_CLAUDE_4_8_OPUS`| Override region for Claude Opus 4.8 when using Google Cloud’s Agent Platform `VERTEX_REGION_CLAUDE_5_5_OPUS`| Override region for Claude Opus 5.5 when using Google Cloud’s Agent Platform. Added in v2.1.280 +`VERTEX_REGION_CLAUDE_5_5_SONNET`| Override region for Claude Sonnet 5.5 when using Google Cloud’s Agent Platform. Added in v2.1.284 `VERTEX_REGION_CLAUDE_5_OPUS`| Override region for Claude Opus 5 when using Google Cloud’s Agent Platform. Added in v2.1.219 `VERTEX_REGION_CLAUDE_5_SONNET`| Override region for Claude Sonnet 5 when using Google Cloud’s Agent Platform. Added in v2.1.197 `VERTEX_REGION_CLAUDE_FABLE_5`| Override region for Claude Fable 5 when using Google Cloud’s Agent Platform. Added in v2.1.170
modified
--- a/env-vars.md +++ b/env-vars.md @@ -225,6 +225,7 @@ `CLAUDE_CODE_DISABLE_CFC_PROMPT`| Set to `1` to keep the [Claude in Chrome](</docs/en/chrome>) browser tools available while omitting the Chrome section of the system prompt and the `/claude-in-chrome` [bundled skill](</docs/en/skills#bundled-skills>). For hosts that embed Claude Code and supply their own browser guidance. Requires Claude Code v2.1.257 or later `CLAUDE_CODE_DISABLE_CLAUDE_MDS`| Set to `1` to prevent loading any CLAUDE.md memory files into context, including user, project, and auto memory files `CLAUDE_CODE_DISABLE_CRON`| Set to `1` to disable [scheduled tasks](</docs/en/scheduled-tasks>). The `/loop` skill and cron tools become unavailable and any already-scheduled tasks stop firing, including tasks that are already running mid-session +`CLAUDE_CODE_DISABLE_DANGEROUS_RM_TIMEOUT`| Set to `1` to turn off the time limit on [critical-path removal](</docs/en/permission-modes#critical-paths>) prompts. In `auto` mode Claude Code then sends these removals to the classifier instead, and in `bypassPermissions` mode the prompt waits for your answer. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.281 or later `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`| Set to `1` to strip Anthropic-specific `anthropic-beta` request headers and beta tool-schema fields (such as `defer_loading` and `eager_input_streaming`) from API requests. Use this when a proxy gateway rejects requests with errors like “Unexpected value(s) for the `anthropic-beta` header” or “Extra inputs are not permitted”. Standard fields (`name`, `description`, `input_schema`, `cache_control`) are preserved. [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) is disabled and all MCP tools load upfront, even when you set `ENABLE_TOOL_SEARCH`. On Claude Code v2.1.227 or later, [managed settings](</docs/en/managed-settings>) can keep tool search on. [Disable pre-release capabilities](</docs/en/llm-gateway-protocol#disable-pre-release-capabilities>) covers where the override applies `CLAUDE_CODE_DISABLE_EXPLORE_PLAN_AGENTS`| Set to `1` to disable the built-in [Explore and Plan subagents](</docs/en/sub-agents#built-in-subagents>). Claude explores with its search tools or the general-purpose subagent instead, and [plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>) reads files directly rather than launching Explore and Plan agents. Custom subagents named `Explore` or `Plan` are unaffected. To remove every built-in subagent type in the Agent SDK or non-interactive mode, use `CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS` instead. Requires Claude Code v2.1.198 or later `CLAUDE_CODE_DISABLE_FAST_MODE`| Set to `1` to disable [fast mode](</docs/en/fast-mode>) @@ -241,6 +242,8 @@ `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL`| Set to `1` to disable automatic registration of the official plugin marketplace. Claude Code reads the variable when it is about to register the marketplace, usually during a machine’s first interactive launch. If the variable is set at that point, Claude Code skips the registration permanently. Unsetting the variable later doesn’t undo the skip. Run `claude plugin marketplace add anthropics/claude-plugins-official` to register the marketplace at any time `CLAUDE_CODE_DISABLE_PERMISSION_PROMPT_NOTIFY_HOOKS`| Set to `1` to stop Claude Code from running your [`Notification` hooks for unanswered permission requests](</docs/en/hooks#notification>) in sessions where Claude Code sends them to the Agent SDK’s `canUseTool` callback, which is how Claude Desktop and the VS Code extension host Claude Code. Has no effect in terminal sessions. Requires Claude Code v2.1.233 or later `CLAUDE_CODE_DISABLE_POLICY_SKILLS`| Set to `1` to skip loading skills from the system-wide managed skills directory. Useful for container or CI sessions that should not load operator-provisioned skills +`CLAUDE_CODE_DISABLE_POWERSHELL_CMD_RM_DENY`| Set to `1` to turn off the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) check that denies the `cmd` built-ins `rd`, `rmdir`, `del`, and `erase` on a [system path](</docs/en/permission-modes#remove-item-in-powershell>), such as a drive root or your home directory. Claude Code ignores this variable in a settings file’s `env` block. Requires Claude Code v2.1.283 or later +`CLAUDE_CODE_DISABLE_SUBSTITUTION_RM_PROMPT`| Set to `1` to turn off the [critical-path](</docs/en/permission-modes#critical-paths>) check for a recursive `rm` whose target is entirely the output of a command substitution, such as `rm -rf "$(pwd)"`. The other critical-path checks keep running. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.281 or later `CLAUDE_CODE_DISABLE_TERMINAL_TITLE`| Set to `1` to disable automatic terminal title updates based on conversation context. This also skips the background small/fast-model request that [generates a session title](</docs/en/sessions#name-your-sessions>) `CLAUDE_CODE_DISABLE_THINKING`| Set to `1` to omit the `thinking` parameter from API requests entirely. This is a compatibility option for proxies and gateways that reject the parameter. On models that think by default, omitting the parameter means the model may still think. To explicitly disable [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) on the Anthropic API, use `MAX_THINKING_TOKENS=0` instead. Neither variable turns thinking off on Opus 5.5 or the Fable models, which can’t have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `MAX_THINKING_TOKENS=0` likewise omits the parameter, so the two variables behave the same there `CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT`| Set to `1` to skip proactive [auto-compaction](</docs/en/costs#reduce-token-usage>) when Claude Code doesn’t recognize the model ID, such as an [LLM gateway](</docs/en/llm-gateway>) alias. Without this variable, Claude Code compacts at the context window it assumes for the ID. `CLAUDE_CODE_MAX_CONTEXT_TOKENS` can correct the assumed window instead; see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>) for when each variable applies. Requires Claude Code v2.1.223 or later @@ -410,13 +413,13 @@ `DISABLE_LOGOUT_COMMAND`| Set to `1` to hide the `/logout` command `DISABLE_PROMPT_CACHING`| Set to `1` to disable [prompt caching](</docs/en/prompt-caching#disable-prompt-caching>) for all models (takes precedence over per-model settings) `DISABLE_PROMPT_CACHING_FABLE`| Set to `1` to disable prompt caching for Fable models -`DISABLE_PROMPT_CACHING_HAIKU`| Set to `1` to disable prompt caching for Haiku models +`DISABLE_PROMPT_CACHING_HAIKU`| Set to `1` to disable prompt caching for the [default Haiku model](</docs/en/prompt-caching#disable-prompt-caching>), wherever it runs `DISABLE_PROMPT_CACHING_OPUS`| Set to `1` to disable prompt caching for Opus models `DISABLE_PROMPT_CACHING_SONNET`| Set to `1` to disable prompt caching for Sonnet models -`DISABLE_TELEMETRY`| Set to any non-empty value, such as `1`, to opt out of telemetry. **Setting it to`0` or `false` still opts out**, unlike most on/off variables; unset the variable to turn telemetry back on. Telemetry events don’t include user data like code, file paths, or bash commands. Also disables feature-flag fetching with the same effect as `DISABLE_GROWTHBOOK`, which makes [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable. See [Turn telemetry off for your organization](</docs/en/managed-settings#turn-telemetry-off-for-your-organization>) +`DISABLE_TELEMETRY`| Set to any non-empty value, such as `1`, to opt out of telemetry. **Setting it to`0` or `false` still opts out**, unlike most on/off variables; unset the variable to turn telemetry back on. Telemetry events don’t include user data like code, file paths, or Bash commands. Also disables feature-flag fetching. See [Turn telemetry off for your organization](</docs/en/managed-settings#turn-telemetry-off-for-your-organization>) `DISABLE_UPDATES`| Set to `1` to block all updates including manual `claude update` and `claude install`. Stricter than `DISABLE_AUTOUPDATER`. Use when distributing Claude Code through your own channels and users should not self-update `DISABLE_UPGRADE_COMMAND`| Set to `1` to hide the `/upgrade` command -`DO_NOT_TRACK`| Set to `1` to opt out of telemetry, with the same effect as `DISABLE_TELEMETRY`, including making [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable. Claude Code reads this variable as a standard boolean, so `0` leaves telemetry on, and honors it as the cross-tool convention recognized by many developer CLIs +`DO_NOT_TRACK`| Set to `1` to opt out of telemetry, with the same effect as `DISABLE_TELEMETRY`, including on feature-flag fetching. Claude Code reads this variable as a standard boolean, so `0` leaves telemetry on, and honors it as the cross-tool convention recognized by many developer CLIs `ENABLE_BETA_TRACING_DETAILED`| Set to `1`, together with `BETA_TRACING_ENDPOINT`, to turn on [detailed beta tracing](</docs/en/monitoring-usage#traces-beta>), which adds content-bearing span attributes and the `claude_code.hook` span. Interactive CLI sessions also require your organization to be allowlisted for the beta. Both variables are ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) `ENABLE_CLAUDEAI_MCP_SERVERS`| Set to `false` to stop Claude Code from fetching [claude.ai MCP servers](</docs/en/mcp#use-mcp-servers-from-claude-ai>). Enabled by default for logged-in users. To disable per-project or per-org, set [`disableClaudeAiConnectors`](</docs/en/settings-reference#disableclaudeaiconnectors>) in settings instead `ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) instead of the default 5 minutes. Intended for API key, [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), [Microsoft Foundry](</docs/en/microsoft-foundry>), and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) users. Subscription users within included usage receive the 1-hour TTL automatically on the [main conversation](</docs/en/prompt-caching#which-ttl-each-request-gets>). Subscription users drawing on [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>) can set it to keep the 1-hour TTL. 1-hour cache writes are billed at a higher rate. To choose the TTL per request bucket instead, use `CLAUDE_CODE_PROMPT_CACHE_TTL` and `CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL`, which take precedence over this variable @@ -498,11 +501,9 @@ With fetching off, you can’t: - * [Start sessions in auto mode by default](</docs/en/permission-modes#which-mode-a-session-starts-in>) on Pro, Max, and Team plans - * Have the VS Code extension [read settings files for the starting permission mode](</docs/en/permission-modes#switch-permission-modes>) * Run [`/auto-mode-setup`](</docs/en/auto-mode-config#generate-environment-entries>) to draft `autoMode.environment` entries - * Use [Remote Control](</docs/en/remote-control#requirements>) - * [Message sessions beyond this machine](</docs/en/cross-session-messaging#message-sessions-on-other-machines>); messaging between sessions on this machine works with fetching off + * Use [Remote Control](</docs/en/remote-control>) with `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` or `DISABLE_GROWTHBOOK` set. For `DISABLE_TELEMETRY` and `DO_NOT_TRACK`, see the [Remote Control requirements](</docs/en/remote-control#requirements>) + * [Message sessions beyond this machine](</docs/en/cross-session-messaging#message-sessions-on-other-machines>) when [Remote Control](</docs/en/remote-control#requirements>) is unavailable. Messaging between sessions on this machine works with fetching off * Run [`claude import` or the `/import` command](</docs/en/cli-reference#cli-commands>) * Run [`/skill-doctor`](</docs/en/skills#find-unused-skills>) or open its report in the `/plugin` **Stats** tab * Sync the [skills](</docs/en/skills#where-synced-skills-load>) and [plugins](</docs/en/plugins/loading#synced-plugins>) enabled for your claude.ai account into your terminal sessions @@ -520,7 +521,7 @@ First session after an install or upgrade -In your first session after you install Claude Code, or upgrade to a version that adds a feature, a flag-gated feature can be missing, and the session can start in Manual mode on a plan that otherwise starts in auto mode. Claude Code fetches the flags during that session, so both are there in your next session. After a fresh install, in a non-interactive session such as `claude -p`, the Agent SDK, or the VS Code extension, Claude Code can still pick the flags up before it [chooses the starting permission mode](</docs/en/permission-modes#which-mode-a-session-starts-in>). +In your first session after you install Claude Code, or upgrade to a version that adds a feature, a flag-gated feature can be missing. That session can also start in a different [permission mode](</docs/en/permission-modes#which-mode-a-session-starts-in>) than your later sessions do. Claude Code fetches the flags during that session, so your next session has the feature and the usual starting permission mode. After a fresh install, in a non-interactive session such as `claude -p`, the Agent SDK, or the VS Code extension, Claude Code can still pick the flags up before it [chooses the starting permission mode](</docs/en/permission-modes#which-mode-a-session-starts-in>). ##
modified
Show diff (109 lines)
--- a/env-vars.md +++ b/env-vars.md @@ -90,7 +90,7 @@ Precedence -Some behaviors have both an environment variable and a dedicated settings key, and which one Claude Code reads first differs per key. For `ANTHROPIC_MODEL` and `CLAUDE_CODE_AUTO_CONNECT_IDE`, Claude Code reads the variable first and uses the `model` or `autoConnectIde` setting only when the variable is unset. For the pair you’re setting, check the variable’s row below and the key’s entry on the [settings reference](</docs/en/settings-reference>). When the same variable is set in both your shell and a settings file `env` block, the settings file value applies. Claude Code writes each `env` entry into the process environment, replacing the value inherited from the shell. The [`env` setting](</docs/en/settings-reference#when-claude-code-applies-env-values>) says when it applies them. A few variables are special-cased; the [`env` setting](</docs/en/settings-reference#env>) lists the exceptions. In a settings file you can set a variable but you can’t remove one. To override a variable you can’t unset, such as a stale `CLAUDE_CODE_USE_VERTEX` exported by a shell profile you don’t control, set it to an empty string in the `env` block: `"CLAUDE_CODE_USE_VERTEX": ""`. Claude Code treats the empty value as unset for provider selection. Subprocesses still inherit the empty value. Between settings files, `env` values follow [settings precedence](</docs/en/settings#settings-precedence>), so a managed settings entry overrides the same variable in user or project settings. How an environment variable interacts with CLI flags and in-session commands varies per feature: `--model` and `/model` override `ANTHROPIC_MODEL`, while `CLAUDE_CODE_EFFORT_LEVEL` overrides `--effort` and `/effort`. When a variable interacts with another configuration source, its row in the Variables list states the precedence or links to the page that documents it. Claude Code reads shell environment variables at startup, so changes to them take effect the next time you launch `claude`. Variables set under the `env` key in settings files are reapplied to a running session when the file changes, with the startup-only exception described in In settings files. +Some behaviors have both an environment variable and a dedicated settings key, and which one Claude Code reads first differs per key. For `ANTHROPIC_MODEL` and `CLAUDE_CODE_AUTO_CONNECT_IDE`, Claude Code reads the variable first and uses the `model` or `autoConnectIde` setting only when the variable is unset. For the pair you’re setting, check the variable’s row below and the key’s entry on the [settings reference](</docs/en/settings-reference>). When the same variable is set in both your shell and a settings file `env` block, the settings file value applies. Claude Code writes each `env` entry into the process environment, replacing the value inherited from the shell. The [`env` setting](</docs/en/settings-reference#when-claude-code-applies-env-values>) says when it applies them. A few variables are special-cased; the [`env` setting](</docs/en/settings-reference#env>) lists the exceptions. In a settings file you can set a variable but you can’t remove one. To override a variable you can’t unset, such as a stale `CLAUDE_CODE_USE_VERTEX` exported by a shell profile you don’t control, set it to an empty string in the `env` block: `"CLAUDE_CODE_USE_VERTEX": ""`. Claude Code treats the empty value as unset for provider selection. Subprocesses still inherit the empty value. Between settings files, `env` values follow [settings precedence](</docs/en/settings#settings-precedence>), so a managed settings entry overrides the same variable in user or project settings. Project and local settings can’t set some variables, such as `CLAUDE_CONFIG_DIR` and the OpenTelemetry exporter variables. [Variables Claude Code ignores in `env`](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) lists them, along with the OpenTelemetry off values that still apply. How an environment variable interacts with CLI flags and in-session commands varies per feature: `--model` and `/model` override `ANTHROPIC_MODEL`, while `CLAUDE_CODE_EFFORT_LEVEL` overrides `--effort` and `/effort`. When a variable interacts with another configuration source, its row in the Variables list states the precedence or links to the page that documents it. Claude Code reads shell environment variables at startup, so changes to them take effect the next time you launch `claude`. Variables set under the `env` key in settings files are reapplied to a running session when the file changes, with the startup-only exception described in In settings files. ## @@ -193,7 +193,7 @@ `CLAUDE_CODE_AUTO_BACKGROUND_WORKER_CHECKIN_SECONDS`| When `CLAUDE_AUTO_BACKGROUND_TASKS` is enabled, seconds between reminders to Claude to check on [background subagents](</docs/en/sub-agents#run-subagents-in-foreground-or-background>) that are still running. Accepts a plain integer from `1` to `86400` only; any other value or spelling reads as unset. When unset, there are no check-in reminders. Requires Claude Code v2.1.248 or later `CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the [auto-compact window](</docs/en/model-config#set-the-auto-compact-window>) in tokens, from `100000` to `1000000`. Accepts a plain integer such as `500000` only: a value like `500k` reads as `500` and clamps to the 100K minimum. The effective window is also capped at the model’s context window. Takes precedence over the `/autocompact` command, the `--autocompact` flag, and the `autoCompactWindow` setting. The status line’s `used_percentage` always measures against the model’s full context window, so once this variable is set, that percentage no longer indicates when compaction will run `CLAUDE_CODE_AUTO_CONNECT_IDE`| Override automatic [IDE connection](</docs/en/vs-code>). By default, Claude Code connects automatically when launched inside a supported IDE’s integrated terminal. Set to `false` to prevent this. Set to `true` to force a connection attempt when auto-detection fails, such as when tmux obscures the parent terminal. Takes precedence over the [`autoConnectIde`](</docs/en/settings-reference#autoconnectide>) global config setting -`CLAUDE_CODE_AUTO_MODE_SERVER`| Controls whether Claude Code asks the server to [review auto mode actions](</docs/en/permission-modes#server-side-classifier-review>). When unset, Claude Code asks the server on Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and Claude Platform on AWS, and when you point `ANTHROPIC_BASE_URL` at an LLM gateway or proxy. Set to `0` to use Claude Code’s own classifier requests instead. Not read on a direct connection to the Anthropic API. Requires Claude Code v2.1.271 or later; asking the server by default requires v2.1.278 or later +`CLAUDE_CODE_AUTO_MODE_SERVER`| Controls whether Claude Code asks the server to [review auto mode actions](</docs/en/permission-modes#server-side-classifier-review>). Set to `0` to use Claude Code’s own classifier requests instead. On a direct connection to the Anthropic API, requires v2.1.281 or later. The linked section lists which sessions ask the server when the variable is unset, and from which version. Requires Claude Code v2.1.271 or later `CLAUDE_CODE_AWS_CHAIN_RESOLVE_TIMEOUT_MS`| Time in milliseconds Claude Code waits for the AWS default credential provider chain to produce credentials before the request fails with [`AWS default-chain credential resolve timed out`](</docs/en/errors#aws-default-chain-credential-resolve-timed-out>) (default: `60000`). Raise it when a step in your chain legitimately needs longer, such as a browser-based SSO sign-in with MFA through a wrapper like `aws-vault`. Applies wherever Claude Code signs with the default chain: [Amazon Bedrock](</docs/en/amazon-bedrock#credential-caching-and-resolution-timeout>), [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), and the [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>). Requires Claude Code v2.1.207 or later `CLAUDE_CODE_BASH_EDIT_DIFF`| Set to `0` to turn off the [diff of the files that changed while a Bash command ran](</docs/en/hooks#bash>), or `1` to record it in every permission mode. Takes precedence over the [`bashEditDiffEnabled`](</docs/en/settings-reference#basheditdiffenabled>) setting. Requires Claude Code v2.1.269 or later `CLAUDE_CODE_BG_TASKS_REPORT_RUNNING`| Set to `0` to make a non-interactive session report an idle status to its host at every turn end, even while background work is still running. By default, the session keeps reporting a running status past turn end while background work such as a background agent or a [workflow](</docs/en/workflows>) run is still live. This keeps a host that watches the status, such as a remote session list, from announcing that Claude is waiting for your input mid-work. Background shell commands, such as a dev server, don’t hold the running status. The running-status default and the `0` opt-out require Claude Code v2.1.269 or later; on earlier versions, set `1` to hold the running status @@ -235,7 +235,7 @@ `CLAUDE_CODE_DISABLE_MOUSE`| Set to `1` to disable mouse tracking in [fullscreen rendering](</docs/en/fullscreen>). Keyboard scrolling with `PgUp` and `PgDn` still works. Use this to keep your terminal’s native copy-on-select behavior `CLAUDE_CODE_DISABLE_MOUSE_CLICKS`| Set to `1` to disable click, drag, and hover handling in [fullscreen rendering](</docs/en/fullscreen>) while keeping mouse-wheel scrolling. Use this when you want wheel scroll to work inside Claude Code but don’t want clicks to position the cursor, expand tool output, or open links. `CLAUDE_CODE_DISABLE_MOUSE` takes precedence when both are set. Requires Claude Code v2.1.195 or later `CLAUDE_CODE_DISABLE_MTLS_RELOAD_ON_STALE_CONNECTION`| Set to `1` to stop Claude Code from re-reading the [mTLS client certificate and key](</docs/en/network-config#mtls-authentication>) when an API request fails with a connection-level error, such as a connection reset or a TLS handshake error. With the reload disabled, Claude Code loads rotated files only when it next applies settings or at the next startup. Requires Claude Code v2.1.232 or later -`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`| Set to any non-empty value, such as `1`, to disable nonessential network traffic: auto-updates, telemetry, error reporting, the `/feedback` command, [Claude-drafted feedback](</docs/en/tools-reference#sendfeedback-tool-behavior>), release notes, the [PR and MR status badge](</docs/en/interactive-mode#pr-review-status>) checks, and availability checks such as the [fast mode](</docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways>) check. It also stops the [background runs of plugin `command` sources](</docs/en/plugin-marketplaces#when-claude-code-re-runs-the-command>), which are local commands rather than network traffic, because they can trigger dependency installs. **Setting it to`0` or `false` still disables this traffic**, unlike most on/off variables; unset the variable to allow it again. Also disables feature-flag fetching, which makes [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable. Official plugin marketplace auto-install isn’t covered; disable it with `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL`. Doesn’t affect [gateway model discovery](</docs/en/llm-gateway-connect#add-gateway-models-to-the-model-picker>), which has its own opt-in +`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`| Set to any non-empty value, such as `1`, to disable nonessential network traffic: auto-updates, telemetry, error reporting, the `/feedback` command, [Claude-drafted feedback](</docs/en/tools-reference#sendfeedback-tool-behavior>), release notes, the [PR and MR status badge](</docs/en/interactive-mode#pr-review-status>) checks, and availability checks such as the [fast mode](</docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways>) check. It also stops the [background runs of plugin `command` sources](</docs/en/plugins/loading#when-a-command-source-re-runs>), which are local commands rather than network traffic, because they can trigger dependency installs. **Setting it to`0` or `false` still disables this traffic**, unlike most on/off variables; unset the variable to allow it again. Also disables feature-flag fetching, which makes [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable. Official plugin marketplace auto-install isn’t covered; disable it with `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL`. Doesn’t affect [gateway model discovery](</docs/en/llm-gateway-connect#add-gateway-models-to-the-model-picker>), which has its own opt-in `CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK`| Set to `1` to disable the non-streaming fallback when a streaming request fails mid-stream. Streaming errors propagate to the retry layer instead. Useful when a proxy or gateway causes the fallback to produce duplicate tool execution `CLAUDE_CODE_DISABLE_NOTIFICATION_PRESENCE_CHECK`| Set to `1` to send the `PushNotification` tool’s desktop notification even while you are typing in or focused on the terminal. By default the tool skips both the desktop notification and the [mobile push](</docs/en/remote-control#mobile-push-notifications>) when it detects recent keyboard activity or terminal focus. This variable disables only that local check, so the server can still suppress the mobile push when it detects that you are active. Requires Claude Code v2.1.193 or later `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL`| Set to `1` to disable automatic registration of the official plugin marketplace. Claude Code reads the variable when it is about to register the marketplace, usually during a machine’s first interactive launch. If the variable is set at that point, Claude Code skips the registration permanently. Unsetting the variable later doesn’t undo the skip. Run `claude plugin marketplace add anthropics/claude-plugins-official` to register the marketplace at any time @@ -257,7 +257,7 @@ `CLAUDE_CODE_ENABLE_OPUS_4_7_FAST_MODE`| Removed in v2.1.142, when the [fast mode](</docs/en/fast-mode>) default moved from Opus 4.6 to Opus 4.7 `CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION`| Set to `false` to turn off prompt suggestions, the grayed-out predictions that appear in your prompt input. Takes precedence over the [`promptSuggestionEnabled`](</docs/en/settings-reference#promptsuggestionenabled>) setting, which is what the **Prompt suggestions** toggle in `/config` writes. Claude Code also [pauses suggestions while your account is close to or at its usage limit](</docs/en/interactive-mode#when-claude-code-skips-suggestions>). Set to `true` to keep them on until you reach the limit. Requires Claude Code v2.1.238 or later. See [Prompt suggestions](</docs/en/interactive-mode#prompt-suggestions>) `CLAUDE_CODE_ENABLE_TASKS`| Selects which task-tracking tools Claude Code provides in [sessions that have them](</docs/en/tools-reference#task-tool-availability>). By default, Claude Code provides the Task tools `TaskCreate`, `TaskUpdate`, `TaskGet`, and `TaskList`. Set to `0` to get the legacy `TodoWrite` tool instead. See [Task list](</docs/en/interactive-mode#task-list>) -`CLAUDE_CODE_ENABLE_TELEMETRY`| Set to `1` to enable OpenTelemetry data collection for metrics and logging. Required before configuring OTel exporters. See [Monitoring](</docs/en/monitoring-usage>) +`CLAUDE_CODE_ENABLE_TELEMETRY`| Set to `1` to enable OpenTelemetry data collection for metrics and logging. Required before configuring OTel exporters. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). See [Monitoring](</docs/en/monitoring-usage>) `CLAUDE_CODE_ENABLE_TODO_TOOLS`| Set to `1` to get the task-tracking tools on every model. Without it, Claude Code provides them by default only on the models listed under [Task tool availability](</docs/en/tools-reference#task-tool-availability>). `CLAUDE_CODE_ENABLE_TASKS` still selects the Task tools or `TodoWrite`. Requires Claude Code v2.1.233 or later `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 `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS`| Set to `1` to enable [agent teams](</docs/en/agent-teams>). Agent teams are experimental and disabled by default @@ -311,11 +311,11 @@ `CLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATE`| Set to `1` to let Claude Code run your package manager’s upgrade command in the background when a new version is available. Applies to Homebrew and WinGet installations. Other package managers continue to show the upgrade command without running it. See [Auto updates](</docs/en/setup#auto-updates>) `CLAUDE_CODE_PERFORCE_MODE`| Set to `1` to enable Perforce-aware write protection. When set, Edit, Write, and NotebookEdit fail with a `p4 edit <file>` hint if the target file lacks the owner-write bit, which Perforce clears on synced files until `p4 edit` opens them. This prevents Claude Code from bypassing Perforce change tracking `CLAUDE_CODE_PLUGIN_CACHE_DIR`| Override the plugins root directory. Despite the name, this sets the parent directory, not the cache itself: marketplaces and the plugin cache live in subdirectories under this path. Defaults to `~/.claude/plugins` -`CLAUDE_CODE_PLUGIN_DIRS`| Plugin directories to load for the session, each loaded the way a [`--plugin-dir`](</docs/en/plugins#test-your-plugins-locally>) flag loads it. Separate multiple paths with `:` on Unix or `;` on Windows. Give each path as an absolute path or start it with `~`, because Claude Code skips relative paths. Requires Claude Code v2.1.280 or later -`CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS`| Timeout in milliseconds for git operations when installing or updating plugins (default: 120000). Increase this value for large repositories or slow network connections. See [Git operations time out](</docs/en/plugin-marketplaces#git-operations-time-out>) -`CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE`| Set to `1` to skip the re-clone attempt and keep using the existing marketplace checkout when a marketplace refresh can’t reach or authenticate to the remote. Useful in offline or airgapped environments where re-cloning would fail the same way. See [Marketplace updates fail in offline environments](</docs/en/plugin-marketplaces#marketplace-updates-fail-in-offline-environments>) +`CLAUDE_CODE_PLUGIN_DIRS`| Plugin directories to load for the session, each loaded the way a [`--plugin-dir`](</docs/en/plugins/cli-reference#flags-that-load-a-plugin-for-one-session>) flag loads it. Separate multiple paths with `:` on Unix or `;` on Windows. Give each path as an absolute path or start it with `~`, because Claude Code skips relative paths. Requires Claude Code v2.1.280 or later. See [Load a plugin for one session](</docs/en/plugins/create#load-a-directory-or-archive-for-one-session>) +`CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS`| Timeout in milliseconds for cloning or refreshing a plugin marketplace (default: 120000). Increase this value for large repositories or slow network connections. See [Git clone timed out](</docs/en/plugins/troubleshooting#git-clone-timed-out-after-120s>) +`CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE`| Set to `1` to skip the re-clone attempt and keep using the existing marketplace checkout when a marketplace refresh can’t reach or authenticate to the remote. Useful in offline or airgapped environments where re-cloning would fail the same way. See [Marketplace updates fail in offline environments](</docs/en/plugins/troubleshooting#marketplace-updates-keep-failing-offline>) `CLAUDE_CODE_PLUGIN_PREFER_HTTPS`| Set to `1` to clone GitHub `owner/repo` shorthand sources over HTTPS instead of SSH. Applies to plugin install and update, and to `/plugin marketplace add` and `update`. Useful in CI runners, containers, or any environment without a configured SSH key for `github.com` -`CLAUDE_CODE_PLUGIN_SEED_DIR`| Path to one or more read-only plugin seed directories, separated by `:` on Unix or `;` on Windows. Use this to bundle a pre-populated plugins directory into a container image. Claude Code registers marketplaces from these directories at startup and uses pre-cached plugins without re-cloning. See [Pre-populate plugins for containers](</docs/en/plugin-marketplaces#pre-populate-plugins-for-containers>) +`CLAUDE_CODE_PLUGIN_SEED_DIR`| Path to one or more read-only plugin seed directories, separated by `:` on Unix or `;` on Windows. Use this to bundle a pre-populated plugins directory into a container image. Claude Code registers marketplaces from these directories at startup and uses pre-cached plugins without re-cloning. See [Pre-populate plugins for containers](</docs/en/plugins/org#seed-containers-and-ci>) `CLAUDE_CODE_POWERSHELL_RESPECT_EXECUTION_POLICY`| Set to `1` to stop Claude Code from passing `-ExecutionPolicy Bypass` when spawning PowerShell for tool calls, hooks, and status line commands, and respect the machine’s effective execution policy instead. By default Claude Code bypasses execution policy at process scope so `.ps1` scripts and module imports work on default-Restricted Windows installs. Process-scope bypass never overrides Group Policy `MachinePolicy` or `UserPolicy` regardless of this setting `CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS`| Ceiling in milliseconds on idle waiting for background subagents and workflows after the final turn in [non-interactive mode](</docs/en/headless#background-tasks-at-exit>) with the `-p` flag. Idle waiting starts over each time Claude takes a turn to handle a background result. Default: `600000`, or 10 minutes. When idle waiting reaches the ceiling, Claude Code stops waiting for the remaining background tasks and exits. Set to `0` to wait indefinitely. This cap is separate from the five-second grace period that applies to plain background shells. Requires Claude Code v2.1.182 or later `CLAUDE_CODE_PROCESS_WRAPPER`| Launch the processes Claude Code starts from its own binary, such as the background service that hosts [agent view](</docs/en/agent-view>) sessions, through a corporate launcher given as an argv prefix like `/opt/corp/launcher`. Set it in the `env` block of user or [managed settings](</docs/en/managed-settings>), not as a shell export, so the detached background service inherits it; project and local settings can’t set it. Equivalent to the [`processWrapper` setting](</docs/en/settings-reference#processwrapper>), which requires Claude Code v2.1.210 or later; this variable takes precedence when both are set. The VS Code extension configures its own launcher separately through its `claudeProcessWrapper` setting. Ignored on Windows. See [Run Claude Code behind a corporate launcher](</docs/en/corporate-launcher>) for the value format, what the launcher covers, and the contract the launcher must satisfy. Requires Claude Code v2.1.208 or later @@ -328,8 +328,8 @@ `CLAUDE_CODE_REMOTE_SESSION_ID`| Set automatically in [cloud sessions](</docs/en/claude-code-on-the-web>) to the current session’s ID. Read this to construct a link back to the session transcript. See [Link output back to the session](</docs/en/cloud-environments#link-output-back-to-the-session>) `CLAUDE_CODE_RESTRICTED`| Set to `1` to start the session in restricted mode, the same as passing [`--restricted`](</docs/en/cli-reference#cli-flags>). Claude Code ignores this variable in a settings file’s `env` block. Requires Claude Code v2.1.248 or later `CLAUDE_CODE_RESUME_INTERRUPTED_TURN`| Set to `1` to automatically resume if the previous session ended mid-turn. Used in SDK mode so the model continues without requiring the SDK to re-send the prompt. To turn this off, unset the variable or set it to `0`. Before v2.1.221, Claude Code ignored `0` and other falsy values, so setting `0` still triggered the resume in non-interactive mode and unsetting the variable was the only way to turn it off -`CLAUDE_CODE_RESUME_INTERRUPTED_TURN_MAX_AGE_MS`| Maximum age in milliseconds of the last transcript message for a session that ended mid-turn to continue automatically on resume. When the last message is older than this bound, Claude Code skips both the `CLAUDE_CODE_RESUME_INTERRUPTED_TURN` automatic resume and the injected `CLAUDE_CODE_RESUME_PROMPT` continuation message, and the session starts idle so you continue explicitly. Unset or `0` means no bound, except that a turn whose last request failed with an API error resumes only while that error is less than six hours old. A positive value bounds every turn, including those; a negative or non-numeric value applies a one-hour bound. Spawn scripts for long-running agents can set this so a restart against an old transcript doesn’t re-run a stale prompt. Claude Code sets a one-hour bound itself when it restarts a crashed [agent view](</docs/en/agent-view>) session that inherited its conversation from an interactive session. Requires Claude Code v2.1.211 or later -`CLAUDE_CODE_RESUME_PROMPT`| Override the continuation message injected when resuming a session that ended mid-turn. Defaults to `Continue from where you left off.`. Spawn scripts for long-running agents can set this to a more directive boot message. An empty string uses the default +`CLAUDE_CODE_RESUME_INTERRUPTED_TURN_MAX_AGE_MS`| Maximum age in milliseconds of the last transcript message for a session that ended mid-turn to continue automatically on resume. When the last message is older than this bound, Claude Code skips the `CLAUDE_CODE_RESUME_INTERRUPTED_TURN` automatic resume and its `CLAUDE_CODE_RESUME_PROMPT` continuation message, and the session starts idle so you continue explicitly. Unset or `0` means no bound, except that a turn whose last request failed with an API error resumes only while that error is less than six hours old. A positive value bounds every turn, including those; a negative or non-numeric value applies a one-hour bound. Spawn scripts for long-running agents can set this so a restart against an old transcript doesn’t re-run a stale prompt. Claude Code sets a one-hour bound itself when it restarts a crashed [agent view](</docs/en/agent-view>) session that inherited its conversation from an interactive session. Requires Claude Code v2.1.211 or later +`CLAUDE_CODE_RESUME_PROMPT`| Override the continuation message Claude Code sends to Claude when `CLAUDE_CODE_RESUME_INTERRUPTED_TURN` continues an interrupted turn instead of resending its prompt, or when you resume a [deferred tool call](</docs/en/hooks#defer-a-tool-call-for-later>) with `-p`. Defaults to `Continue from where you left off.`. An empty string uses the default `CLAUDE_CODE_RETRY_WATCHDOG`| Set to `1` for unattended sessions such as eval harnesses, CI jobs, or remote workers. Retries `429` and `529` capacity errors indefinitely instead of failing after `CLAUDE_CODE_MAX_RETRIES` attempts. Claude Code fails at once when a standard-speed request gets a `429` that reports a spend limit or exhausted usage credits, even one from a [gateway spend cap](</docs/en/errors#spend-limit-reached>) that resets on a schedule. Before v2.1.239, the watchdog retried these indefinitely. For fast mode requests, see [Handle rate limits](</docs/en/fast-mode#handle-rate-limits>). The watchdog backs off up to 5 minutes between attempts, or until the limit resets when the response carries a rate-limit reset time, so a session that hits a usage limit waits out the remaining window. On v2.1.199 or later it also raises the default retry count for other transient errors, such as server errors, timeouts, and dropped connections, to 300, roughly three hours of backoff, and removes the cap of 15 on `CLAUDE_CODE_MAX_RETRIES` if you set that variable explicitly. Requires Claude Code v2.1.186 or later `CLAUDE_CODE_SAFE_MODE`| Set to `1` to start in safe mode: CLAUDE.md, skills, plugins, hooks, MCP servers, custom commands and agents, output styles, workflows, custom themes, custom keybindings, status line and file-suggestion commands, LSP servers, and auto memory do not load, for troubleshooting a broken configuration. Managed settings policy still applies, including policy-configured hooks, status line, and file-suggestion commands; managed plugins, managed skills, managed CLAUDE.md, and policy-configured MCP servers do not. Equivalent to passing [`--safe-mode`](</docs/en/cli-reference#cli-flags>). Directly spawned child processes inherit the variable `CLAUDE_CODE_SCRIPT_CAPS`| JSON object limiting how many times specific scripts may be invoked per session when `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB` is set. Keys are substrings matched against the command text; values are integer call limits. For example, `{"deploy.sh": 2}` allows `deploy.sh` to be called at most twice. Matching is substring-based so shell-expansion tricks like `./scripts/deploy.sh $(evil)` still count against the cap. Runtime fan-out via `xargs` or `find -exec` is not detected; this is a defense-in-depth control @@ -339,7 +339,7 @@ `CLAUDE_CODE_SESSION_ID`| Set automatically to the current session ID in Bash and PowerShell tool subprocesses, [hook command](</docs/en/hooks>) subprocesses, and stdio [MCP server](</docs/en/mcp>) subprocesses. For Bash, PowerShell, and hooks this matches the `session_id` field in the hook JSON input and is updated on `/clear`. An MCP server subprocess retains the ID it was spawned with. On `--resume <session-id>` it receives the resumed ID, matching hooks and Bash. On `--continue` or `--resume` without an explicit ID it may receive the initial startup ID instead. Use to correlate scripts and external tools with the Claude Code session that launched them `CLAUDE_CODE_SHELL`| Set the shell Claude Code uses to run Bash tool commands. Accepts a path to a `bash` or `zsh` binary, for example `/opt/homebrew/bin/bash`. Other shells such as `fish` are not supported. If the value is not a working `bash` or `zsh` path, Claude Code ignores it and falls back to auto-detection. Auto-detection uses your `$SHELL` when it points to `bash` or `zsh`, otherwise it picks the first working `zsh` then `bash` found on your `PATH` and standard install locations `CLAUDE_CODE_SHELL_PREFIX`| Command prefix that wraps shell commands Claude Code spawns: Bash tool calls, [hook](</docs/en/hooks>) commands, [status line](</docs/en/statusline>) commands, and stdio [MCP server](</docs/en/mcp>) startup commands. PowerShell hooks and exec-form hooks run without the prefix. Useful for logging or auditing. Setting a bare executable path such as `/path/to/logger.sh` runs each command as `/path/to/logger.sh '<command>'`. The wrapper receives the command line as a single shell-quoted argument in `$1`, so the wrapper must re-evaluate `$1` with a shell, for example `exec bash -c "$1"`. Treating `$1` as a bare executable path breaks stdio MCP servers that pass arguments such as `npx -y <package>`. For Bash tool calls, `$1` contains the full shell invocation Claude Code assembles, including environment setup, not only the command Claude ran -`CLAUDE_CODE_SIMPLE`| Set to `1` to run with a minimal system prompt and only the Bash, file read, and file edit tools. MCP tools from `--mcp-config` are still available. Disables auto-discovery of hooks, skills, custom commands, subagents, plugins, MCP servers, auto memory, and CLAUDE.md. Skills in a directory you pass with `--add-dir` still load. OAuth tokens and keychain credentials are not read, so Anthropic authentication must come from `ANTHROPIC_API_KEY` or an `apiKeyHelper` in `--settings`. Equivalent to passing [`--bare`](</docs/en/headless#start-faster-with-bare-mode>) +`CLAUDE_CODE_SIMPLE`| Set to `1` to run with a minimal system prompt and only the Bash, file read, and file edit tools. MCP tools from `--mcp-config` are still available. Disables auto-discovery of hooks, skills, custom commands, subagents, installed plugins, MCP servers, auto memory, and CLAUDE.md. Skills in a directory you pass with `--add-dir` still load. OAuth tokens and keychain credentials are not read, so Anthropic authentication must come from `ANTHROPIC_API_KEY` or an `apiKeyHelper` in `--settings`. Equivalent to passing [`--bare`](</docs/en/headless#start-faster-with-bare-mode>) `CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT`| Set to `1` to use a shorter system prompt and abbreviated tool descriptions on any model. Set to `0`, `false`, `no`, or `off` to opt out even on models where the experiment or server configuration would otherwise enable it. The full tool set, hooks, MCP servers, and CLAUDE.md discovery remain enabled `CLAUDE_CODE_SKIP_ANTHROPIC_AWS_AUTH`| Skip client-side authentication for [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), for gateways that sign requests themselves `CLAUDE_CODE_SKIP_AWS_CRED_CACHE`| Set to `1` to turn off the in-process cache of credentials resolved from the AWS default credential provider chain, so Claude Code resolves the chain on every API request. With the cache off, an SSO-backed profile requests credentials from IAM Identity Center on every request. See [credential caching and resolution timeout](</docs/en/amazon-bedrock#credential-caching-and-resolution-timeout>). Requires Claude Code v2.1.207 or later @@ -448,12 +448,12 @@ `MCP_TOOL_TIMEOUT`| Timeout in milliseconds for MCP tool execution (default: 100000000, about 28 hours). For an HTTP, SSE, or claude.ai connector server, each request also times out after 60 seconds by default; set this variable, or the per-server `timeout`, above 60000 to raise that per-request limit. A lower value still shortens the overall tool-execution timeout but leaves the per-request limit at 60 seconds. Stdio and WebSocket servers have no per-request timer. A per-server `timeout` field in `.mcp.json` overrides this for that server. A per-server `timeout` of at least 1000 also sets the minimum idle window for that server’s tool calls, so `CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT` never aborts them sooner; this floor requires Claude Code v2.1.203 or later. For the env variable, values below 1000 are floored to one second; for the per-server field, values below 1000 are ignored `NO_PROXY`| List of domains and IPs to which requests will be directly issued, bypassing proxy `OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`| Standard OpenTelemetry SDK limit on attribute value length. Claude Code caps content-bearing telemetry attributes at the smaller of this and `CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH`, so the truncation marker stays within the SDK limit. Claude Code reads the `OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT` and `OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT` variants the same way, and the smallest set value applies to all signals. Requires Claude Code v2.1.214 or later. See [Monitoring](</docs/en/monitoring-usage#common-configuration-variables>) -`OTEL_LOG_ASSISTANT_RESPONSES`| Set to `1` to include the model’s response text on `assistant_response` OpenTelemetry log events. When unset, the value of `OTEL_LOG_USER_PROMPTS` is used instead. Set to `0` to keep responses redacted even when `OTEL_LOG_USER_PROMPTS` is set. Requires Claude Code v2.1.193 or later. See [Monitoring](</docs/en/monitoring-usage#assistant-response-event>) +`OTEL_LOG_ASSISTANT_RESPONSES`| Set to `1` to include the model’s response text on `assistant_response` OpenTelemetry log events. When unset, Claude Code uses the value of `OTEL_LOG_USER_PROMPTS` instead. Set to `0` to keep responses redacted even when `OTEL_LOG_USER_PROMPTS` is set. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). Requires Claude Code v2.1.193 or later. See [Monitoring](</docs/en/monitoring-usage#assistant-response-event>) `OTEL_LOG_MANAGED_SETTINGS`| Set to `1` to add the redacted managed settings, and a SHA-256 digest of the settings before redaction, to `managed_settings_resolved` OpenTelemetry log events. Disabled by default. Set it in your shell, user settings, or managed settings; a value in project or local settings doesn’t turn it on. Requires Claude Code v2.1.274 or later. See [Monitoring](</docs/en/monitoring-usage#managed-settings-resolved-event>) `OTEL_LOG_RAW_API_BODIES`| Emit Anthropic Messages API request and response JSON as `api_request_body` / `api_response_body` log events. Set to `1` for inline bodies truncated at the content limit, or `file:<dir>` to write untruncated bodies to disk and emit a `body_ref` path instead. `CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH` configures the content limit, 60 KB by default. Disabled by default; bodies include the entire conversation history. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). See [Monitoring](</docs/en/monitoring-usage#api-request-body-event>) -`OTEL_LOG_TOOL_CONTENT`| Set to `1` to include tool content in the `tool.output` OpenTelemetry span event. Span attributes carry tool content under [their own gates](</docs/en/monitoring-usage#new-context-gates>). Requires [tracing](</docs/en/monitoring-usage#traces-beta>). Disabled by default to protect sensitive data. See [Monitoring](</docs/en/monitoring-usage#tool-output-span-event>) -`OTEL_LOG_TOOL_DETAILS`| Set to `1` to include tool input arguments, MCP server names, user-authored workflow names, raw error strings on tool failures, the refusal `category` on `api_refusal` events, and other tool details in OpenTelemetry traces and logs. Disabled by default to protect PII. See [Monitoring](</docs/en/monitoring-usage>) -`OTEL_LOG_USER_PROMPTS`| Set to `1` to include user prompt text in OpenTelemetry traces and logs. Disabled by default (prompts are redacted). See [Monitoring](</docs/en/monitoring-usage>) +`OTEL_LOG_TOOL_CONTENT`| Set to `1` to include tool content in the `tool.output` OpenTelemetry span event. Span attributes carry tool content under [their own gates](</docs/en/monitoring-usage#new-context-gates>). Requires [tracing](</docs/en/monitoring-usage#traces-beta>). Disabled by default to protect sensitive data. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>), apart from the off values that section describes. See [Monitoring](</docs/en/monitoring-usage#tool-output-span-event>) +`OTEL_LOG_TOOL_DETAILS`| Set to `1` to include tool input arguments, MCP server names, user-authored workflow names, raw error strings on tool failures, the refusal `category` on `api_refusal` events, and other tool details in OpenTelemetry traces and logs. Disabled by default to protect PII. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>), apart from the off values that section describes. See [Monitoring](</docs/en/monitoring-usage>) +`OTEL_LOG_USER_PROMPTS`| Set to `1` to include user prompt text in OpenTelemetry traces and logs. Disabled by default (prompts are redacted). Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>), apart from the off values that section describes. See [Monitoring](</docs/en/monitoring-usage>) `OTEL_METRICS_INCLUDE_ACCOUNT_UUID`| Set to `false` to exclude account UUID from metrics attributes (default: included). See [Monitoring](</docs/en/monitoring-usage>) `OTEL_METRICS_INCLUDE_ENTRYPOINT`| Set to `true` to include the session entrypoint in metrics attributes (default: excluded). Added in v2.1.152. See [Monitoring](</docs/en/monitoring-usage>) `OTEL_METRICS_INCLUDE_REPOSITORY`| Set to `true` to tag OpenTelemetry metrics and events with `vcs.*` attributes identifying the session’s repository (default: excluded). Requires Claude Code v2.1.269 or later. See [Repository attributes](</docs/en/monitoring-usage#repository-attributes>) @@ -482,7 +482,7 @@ `VERTEX_REGION_CLAUDE_FABLE_5_1`| Override region for Claude Fable 5.1 when using Google Cloud’s Agent Platform. Added in v2.1.257 `VERTEX_REGION_CLAUDE_HAIKU_4_5`| Override region for Claude Haiku 4.5 when using Google Cloud’s Agent Platform -Standard OpenTelemetry exporter variables (`OTEL_METRICS_EXPORTER`, `OTEL_LOGS_EXPORTER`, `OTEL_EXPORTER_OTLP_ENDPOINT`, `OTEL_EXPORTER_OTLP_PROTOCOL`, `OTEL_EXPORTER_OTLP_HEADERS`, `OTEL_METRIC_EXPORT_INTERVAL`, `OTEL_RESOURCE_ATTRIBUTES`, and signal-specific variants) are also supported. See [Monitoring](</docs/en/monitoring-usage>) for configuration details. +Standard OpenTelemetry exporter variables (`OTEL_METRICS_EXPORTER`, `OTEL_LOGS_EXPORTER`, `OTEL_EXPORTER_OTLP_ENDPOINT`, `OTEL_EXPORTER_OTLP_PROTOCOL`, `OTEL_EXPORTER_OTLP_HEADERS`, `OTEL_METRIC_EXPORT_INTERVAL`, `OTEL_RESOURCE_ATTRIBUTES`, and signal-specific variants) are also supported. See [Monitoring](</docs/en/monitoring-usage>) for configuration details. Set `CLAUDE_CODE_ENABLE_TELEMETRY` and the OpenTelemetry variables that turn on export, choose its destination, or capture content in your shell, user settings, or managed settings. Claude Code [ignores them in project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>), apart from the off values that section describes. `OTEL_RESOURCE_ATTRIBUTES` and the export interval, timeout, and compression variables, such as `OTEL_METRIC_EXPORT_INTERVAL`, still apply from project and local settings. ## @@ -505,7 +505,7 @@ * [Message sessions beyond this machine](</docs/en/cross-session-messaging#message-sessions-on-other-machines>); messaging between sessions on this machine works with fetching off * Run [`claude import` or the `/import` command](</docs/en/cli-reference#cli-commands>) * Run [`/skill-doctor`](</docs/en/skills#find-unused-skills>) or open its report in the `/plugin` **Stats** tab - * Sync the [skills](</docs/en/skills#where-synced-skills-load>) and [plugins](</docs/en/plugins-reference#synced-plugins>) enabled for your claude.ai account into your terminal sessions + * Sync the [skills](</docs/en/skills#where-synced-skills-load>) and [plugins](</docs/en/plugins/loading#synced-plugins>) enabled for your claude.ai account into your terminal sessions * Use [the advisor tool](</docs/en/advisor#requirements>) * Read or reply to [comments on an artifact](</docs/en/artifacts#collect-comments-on-an-artifact>) * Have Claude Code probe claude.ai connector servers for [MCP protocol revision 2026-07-28](</docs/en/mcp#mcp-client-runtimes>) unless you set `MCP_PROTOCOL_NEGOTIATION=auto`
modified
--- a/env-vars.md +++ b/env-vars.md @@ -498,7 +498,6 @@ With fetching off, you can’t: - * Have Claude Code [read `AGENTS.md` files](</docs/en/memory#agents-md>) as project instructions; it loads `CLAUDE.md` files only * [Start sessions in auto mode by default](</docs/en/permission-modes#which-mode-a-session-starts-in>) on Pro, Max, and Team plans * Have the VS Code extension [read settings files for the starting permission mode](</docs/en/permission-modes#switch-permission-modes>) * Run [`/auto-mode-setup`](</docs/en/auto-mode-config#generate-environment-entries>) to draft `autoMode.environment` entries
modified
--- a/env-vars.md +++ b/env-vars.md @@ -242,7 +242,7 @@ `CLAUDE_CODE_DISABLE_PERMISSION_PROMPT_NOTIFY_HOOKS`| Set to `1` to stop Claude Code from running your [`Notification` hooks for unanswered permission requests](</docs/en/hooks#notification>) in sessions where Claude Code sends them to the Agent SDK’s `canUseTool` callback, which is how Claude Desktop and the VS Code extension host Claude Code. Has no effect in terminal sessions. Requires Claude Code v2.1.233 or later `CLAUDE_CODE_DISABLE_POLICY_SKILLS`| Set to `1` to skip loading skills from the system-wide managed skills directory. Useful for container or CI sessions that should not load operator-provisioned skills `CLAUDE_CODE_DISABLE_TERMINAL_TITLE`| Set to `1` to disable automatic terminal title updates based on conversation context. This also skips the background small/fast-model request that [generates a session title](</docs/en/sessions#name-your-sessions>) -`CLAUDE_CODE_DISABLE_THINKING`| Set to `1` to omit the `thinking` parameter from API requests entirely. This is a compatibility option for proxies and gateways that reject the parameter. On models that think by default, omitting the parameter means the model may still think. To explicitly disable [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) on the Anthropic API, use `MAX_THINKING_TOKENS=0` instead. Neither variable turns thinking off on Fable models, which can’t have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `MAX_THINKING_TOKENS=0` likewise omits the parameter, so the two variables behave the same there +`CLAUDE_CODE_DISABLE_THINKING`| Set to `1` to omit the `thinking` parameter from API requests entirely. This is a compatibility option for proxies and gateways that reject the parameter. On models that think by default, omitting the parameter means the model may still think. To explicitly disable [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) on the Anthropic API, use `MAX_THINKING_TOKENS=0` instead. Neither variable turns thinking off on Opus 5.5 or the Fable models, which can’t have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `MAX_THINKING_TOKENS=0` likewise omits the parameter, so the two variables behave the same there `CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT`| Set to `1` to skip proactive [auto-compaction](</docs/en/costs#reduce-token-usage>) when Claude Code doesn’t recognize the model ID, such as an [LLM gateway](</docs/en/llm-gateway>) alias. Without this variable, Claude Code compacts at the context window it assumes for the ID. `CLAUDE_CODE_MAX_CONTEXT_TOKENS` can correct the assumed window instead; see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>) for when each variable applies. Requires Claude Code v2.1.223 or later `CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL`| Set to `1` to disable virtual scrolling in [fullscreen rendering](</docs/en/fullscreen>) and render every message in the transcript. Use this if scrolling in fullscreen mode shows blank regions where messages should appear `CLAUDE_CODE_DISABLE_WINDOWS_SHELL_LAUNCHER`| Set to `1` to start [PowerShell tool](</docs/en/tools-reference#powershell-tool>) commands on Windows directly instead of through the `cmd.exe` launcher. By default, the launcher lets a PowerShell command [running in the background](</docs/en/tools-reference#background-commands>) [carry over to the session’s next process](</docs/en/agent-view#the-supervisor-process>), such as when you [background the session](</docs/en/agent-view#from-inside-a-session>). If you set the variable, a backgrounded PowerShell command stops when the session’s process exits. Bash commands aren’t affected. Requires Claude Code v2.1.269 or later @@ -281,6 +281,7 @@ `CLAUDE_CODE_IDE_SKIP_VALID_CHECK`| Set to `1` to skip validation of IDE lockfile entries during connection. Use when auto-connect fails to find your IDE despite it running `CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS`| How many [subagents](</docs/en/sub-agents#concurrent-subagent-limit>) can be running in one session before the Agent tool refuses to spawn another (default: 20). Accepts a positive whole number in plain digits; anything else is ignored, so the variable can adjust the cap but can’t disable it. Requires Claude Code v2.1.217 or later `CLAUDE_CODE_MAX_CONTEXT_TOKENS`| Override the context window size Claude Code assumes for the active model. As of v2.1.193, how it applies depends on how Claude Code resolves the model ID; see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>). Use this when routing to a model through `ANTHROPIC_BASE_URL` whose context window does not match the built-in size for its name +`CLAUDE_CODE_MAX_MCP_DESCRIPTION_LENGTH`| Maximum length in characters of each MCP tool description and each MCP server’s instructions that Claude Code sends to the model (default: 2048). Claude Code [truncates longer text](</docs/en/mcp#for-mcp-server-authors>). Accepts a positive whole number in plain digits. Anything else is ignored and the default applies. Requires Claude Code v2.1.280 or later `CLAUDE_CODE_MAX_OUTPUT_TOKENS`| Set the maximum number of output tokens for most requests. Defaults and caps vary by model; see [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>). Claude Code defaults to 32000 for model IDs it doesn’t recognize, such as gateway-specific names, and lowers values above a model’s cap to the cap. Increasing this value reduces the effective context window available before [auto-compaction](</docs/en/costs#reduce-token-usage>) triggers `CLAUDE_CODE_MAX_RETRIES`| Override the number of times to retry failed API requests (default: 10). Capped at 15 as of v2.1.186; as of v2.1.199, `CLAUDE_CODE_RETRY_WATCHDOG` raises the default and removes the cap. For unattended sessions that need to wait through longer outages, set `CLAUDE_CODE_RETRY_WATCHDOG` instead `CLAUDE_CODE_MAX_SUBAGENTS_PER_SESSION`| Removed in v2.1.224 and now a no-op. Previously capped the total number of [subagents](</docs/en/sub-agents>) Claude could spawn with the Agent tool in one session (default: 200); spawning past the cap failed with `Subagent spawn limit reached`. The [concurrent subagent limit](</docs/en/sub-agents#concurrent-subagent-limit>) and the [depth limit](</docs/en/sub-agents#let-subagents-spawn-their-own-subagents>) still apply @@ -310,6 +311,7 @@ `CLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATE`| Set to `1` to let Claude Code run your package manager’s upgrade command in the background when a new version is available. Applies to Homebrew and WinGet installations. Other package managers continue to show the upgrade command without running it. See [Auto updates](</docs/en/setup#auto-updates>) `CLAUDE_CODE_PERFORCE_MODE`| Set to `1` to enable Perforce-aware write protection. When set, Edit, Write, and NotebookEdit fail with a `p4 edit <file>` hint if the target file lacks the owner-write bit, which Perforce clears on synced files until `p4 edit` opens them. This prevents Claude Code from bypassing Perforce change tracking `CLAUDE_CODE_PLUGIN_CACHE_DIR`| Override the plugins root directory. Despite the name, this sets the parent directory, not the cache itself: marketplaces and the plugin cache live in subdirectories under this path. Defaults to `~/.claude/plugins` +`CLAUDE_CODE_PLUGIN_DIRS`| Plugin directories to load for the session, each loaded the way a [`--plugin-dir`](</docs/en/plugins#test-your-plugins-locally>) flag loads it. Separate multiple paths with `:` on Unix or `;` on Windows. Give each path as an absolute path or start it with `~`, because Claude Code skips relative paths. Requires Claude Code v2.1.280 or later `CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS`| Timeout in milliseconds for git operations when installing or updating plugins (default: 120000). Increase this value for large repositories or slow network connections. See [Git operations time out](</docs/en/plugin-marketplaces#git-operations-time-out>) `CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE`| Set to `1` to skip the re-clone attempt and keep using the existing marketplace checkout when a marketplace refresh can’t reach or authenticate to the remote. Useful in offline or airgapped environments where re-cloning would fail the same way. See [Marketplace updates fail in offline environments](</docs/en/plugin-marketplaces#marketplace-updates-fail-in-offline-environments>) `CLAUDE_CODE_PLUGIN_PREFER_HTTPS`| Set to `1` to clone GitHub `owner/repo` shorthand sources over HTTPS instead of SSH. Applies to plugin install and update, and to `/plugin marketplace add` and `update`. Useful in CI runners, containers, or any environment without a configured SSH key for `github.com` @@ -429,7 +431,7 @@ `IS_DEMO`| Set to any non-empty value, such as `1`, to enable demo mode: hides your email and organization name from the header and `/status` output, and skips onboarding. **Setting it to`0` or `false` still enables demo mode**, unlike most on/off variables; unset the variable to turn it off. Useful when streaming or recording a session `MAX_MCP_OUTPUT_TOKENS`| Maximum number of tokens allowed in MCP tool responses. Claude Code displays a warning when output exceeds 10,000 tokens. Tools that declare [`anthropic/maxResultSizeChars`](</docs/en/mcp#raise-the-limit-for-a-specific-tool>) use that character limit for text content instead, but image content from those tools is still subject to this variable (default: 25000) `MAX_STRUCTURED_OUTPUT_RETRIES`| Number of attempts Claude Code allows when the model’s response fails validation against the [`--json-schema`](</docs/en/cli-reference#cli-flags>) in non-interactive mode with the `-p` flag; after that many failed attempts with no valid output, the run fails. The same cap applies when a [workflow](</docs/en/workflows>) subagent’s structured output fails validation. Defaults to 5, a first attempt plus four retries -`MAX_THINKING_TOKENS`| Fixed token budget for [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>). Claude Code caps it at one token below the request’s max output tokens and never below 1,024. See `CLAUDE_CODE_MAX_OUTPUT_TOKENS` for how that limit is set. When unset and thinking is enabled, models with [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) choose their own thinking depth, and other models use the cap. Set to `0` to disable thinking on the Anthropic API, except on Fable models, which can’t have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `0` omits the `thinking` parameter instead. With thinking turned off on the Anthropic API, Claude Code sends effort `high` instead of a higher level to models it knows [don’t accept that combination](</docs/en/errors#effort-isnt-available-with-thinking-turned-off>), such as Opus 5. Claude Code ignores nonzero values on adaptive reasoning models, except on the models where `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` turns adaptive reasoning off +`MAX_THINKING_TOKENS`| Fixed token budget for [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>). Claude Code caps it at one token below the request’s max output tokens and never below 1,024. See `CLAUDE_CODE_MAX_OUTPUT_TOKENS` for how that limit is set. When unset and thinking is enabled, models with [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) choose their own thinking depth, and other models use the cap. Set to `0` to disable thinking on the Anthropic API, except on Opus 5.5 and the Fable models, which can’t have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `0` omits the `thinking` parameter instead. With thinking turned off on the Anthropic API, Claude Code sends effort `high` instead of a higher level to models it knows [don’t accept that combination](</docs/en/errors#effort-isnt-available-with-thinking-turned-off>), such as Opus 5. Claude Code ignores nonzero values on adaptive reasoning models, except on the models where `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` turns adaptive reasoning off `MCP_CLIENT_SECRET`| OAuth client secret for MCP servers that require [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>). Avoids the interactive prompt when adding a server with `--client-secret` `MCP_CONNECTION_NONBLOCKING`| Controls whether startup waits for MCP servers to connect before the first query. MCP startup is non-blocking by default: servers connect in the background and their tools become available as they finish. Set to `0` to make Claude Code wait for servers to connect before the first query. Servers configured with [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>) still make startup wait regardless, except when served from the [discovery cache](</docs/en/mcp#server-status-detail>), since their tools must be present when the first prompt is built. In non-interactive mode (`-p`) without `--input-format stream-json`, Claude Code also waits for still-pending servers before the first turn regardless of this variable. When you pass [`--mcp-config`](</docs/en/cli-reference#cli-flags>) explicitly, the wait has a longer deadline; see that flag’s entry for the cached-server exception `MCP_CONNECT_TIMEOUT_MS`| How long blocking MCP startup waits, in milliseconds, for the connection batch before snapshotting the tool list (default: 5000). Applies when `MCP_CONNECTION_NONBLOCKING=0` or for servers marked [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>). Servers still pending at the deadline keep connecting in the background. Distinct from `MCP_TIMEOUT`, which bounds an individual server’s connect attempt @@ -473,6 +475,7 @@ `VERTEX_REGION_CLAUDE_4_6_SONNET`| Override region for Claude Sonnet 4.6 when using Google Cloud’s Agent Platform `VERTEX_REGION_CLAUDE_4_7_OPUS`| Override region for Claude Opus 4.7 when using Google Cloud’s Agent Platform `VERTEX_REGION_CLAUDE_4_8_OPUS`| Override region for Claude Opus 4.8 when using Google Cloud’s Agent Platform +`VERTEX_REGION_CLAUDE_5_5_OPUS`| Override region for Claude Opus 5.5 when using Google Cloud’s Agent Platform. Added in v2.1.280 `VERTEX_REGION_CLAUDE_5_OPUS`| Override region for Claude Opus 5 when using Google Cloud’s Agent Platform. Added in v2.1.219 `VERTEX_REGION_CLAUDE_5_SONNET`| Override region for Claude Sonnet 5 when using Google Cloud’s Agent Platform. Added in v2.1.197 `VERTEX_REGION_CLAUDE_FABLE_5`| Override region for Claude Fable 5 when using Google Cloud’s Agent Platform. Added in v2.1.170
modified
--- a/env-vars.md +++ b/env-vars.md @@ -195,7 +195,7 @@ `CLAUDE_CODE_AUTO_CONNECT_IDE`| Override automatic [IDE connection](</docs/en/vs-code>). By default, Claude Code connects automatically when launched inside a supported IDE’s integrated terminal. Set to `false` to prevent this. Set to `true` to force a connection attempt when auto-detection fails, such as when tmux obscures the parent terminal. Takes precedence over the [`autoConnectIde`](</docs/en/settings-reference#autoconnectide>) global config setting `CLAUDE_CODE_AUTO_MODE_SERVER`| Controls whether Claude Code asks the server to [review auto mode actions](</docs/en/permission-modes#server-side-classifier-review>). When unset, Claude Code asks the server on Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and Claude Platform on AWS, and when you point `ANTHROPIC_BASE_URL` at an LLM gateway or proxy. Set to `0` to use Claude Code’s own classifier requests instead. Not read on a direct connection to the Anthropic API. Requires Claude Code v2.1.271 or later; asking the server by default requires v2.1.278 or later `CLAUDE_CODE_AWS_CHAIN_RESOLVE_TIMEOUT_MS`| Time in milliseconds Claude Code waits for the AWS default credential provider chain to produce credentials before the request fails with [`AWS default-chain credential resolve timed out`](</docs/en/errors#aws-default-chain-credential-resolve-timed-out>) (default: `60000`). Raise it when a step in your chain legitimately needs longer, such as a browser-based SSO sign-in with MFA through a wrapper like `aws-vault`. Applies wherever Claude Code signs with the default chain: [Amazon Bedrock](</docs/en/amazon-bedrock#credential-caching-and-resolution-timeout>), [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), and the [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>). Requires Claude Code v2.1.207 or later -`CLAUDE_CODE_BASH_EDIT_DIFF`| Set to `0` to turn off the [diff of the files a Bash command changed](</docs/en/hooks#bash>), or `1` to record it in every permission mode. Takes precedence over the [`bashEditDiffEnabled`](</docs/en/settings-reference#basheditdiffenabled>) setting. Requires Claude Code v2.1.269 or later +`CLAUDE_CODE_BASH_EDIT_DIFF`| Set to `0` to turn off the [diff of the files that changed while a Bash command ran](</docs/en/hooks#bash>), or `1` to record it in every permission mode. Takes precedence over the [`bashEditDiffEnabled`](</docs/en/settings-reference#basheditdiffenabled>) setting. Requires Claude Code v2.1.269 or later `CLAUDE_CODE_BG_TASKS_REPORT_RUNNING`| Set to `0` to make a non-interactive session report an idle status to its host at every turn end, even while background work is still running. By default, the session keeps reporting a running status past turn end while background work such as a background agent or a [workflow](</docs/en/workflows>) run is still live. This keeps a host that watches the status, such as a remote session list, from announcing that Claude is waiting for your input mid-work. Background shell commands, such as a dev server, don’t hold the running status. The running-status default and the `0` opt-out require Claude Code v2.1.269 or later; on earlier versions, set `1` to hold the running status `CLAUDE_CODE_BRIDGE_SESSION_ID`| Set automatically in Bash tool and [hook command](</docs/en/hooks>) subprocesses while the session has an active [Remote Control](</docs/en/remote-control>) connection, and removed when the connection ends. The value is the session’s ID in `session_` form, the same identifier that appears in the session’s `claude.ai/code` URL, so a script can link back to the session that ran it. Requires Claude Code v2.1.199 or later. In [cloud sessions](</docs/en/claude-code-on-the-web>), read `CLAUDE_CODE_REMOTE_SESSION_ID` instead `CLAUDE_CODE_BS_AS_CTRL_BACKSPACE`| Set to `0` to make Claude Code read the `0x08` byte, also written `^H`, as plain Backspace, or `1` to read it as Ctrl+Backspace. Either value replaces the platform default. By default, Claude Code reads it as Ctrl+Backspace on Windows, except when `TERM_PROGRAM` is `mintty` or `TERM` is `cygwin`, and as plain Backspace on macOS and Linux. Set `0` in a Windows terminal where [Backspace deletes a whole word](</docs/en/terminal-config#fix-backspace-deleting-a-whole-word-on-windows>) @@ -220,7 +220,7 @@ `CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_DEFAULT`| Set to `1` to stop Claude Code from treating an [Amazon Bedrock](</docs/en/amazon-bedrock>) streaming response with a missing or empty `Content-Type` header as Amazon Bedrock’s binary event stream. By default, Claude Code assumes a gateway dropped the header from an otherwise unmodified response, so it decodes the body and streaming keeps working. Set this only for a gateway that also re-emits the stream as server-sent events; Claude Code then reads the header-less body as server-sent events instead. Requires Claude Code v2.1.239 or later `CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_GUARD`| Set to `1` to skip the check that an [Amazon Bedrock](</docs/en/amazon-bedrock>) streaming response carries the `application/vnd.amazon.eventstream` content-type. Without this variable, when a response carries a different content-type, Claude Code fails the request with an error naming that type, which means a [gateway or proxy is transforming the response](</docs/en/amazon-bedrock#streaming-errors-behind-a-gateway-or-proxy>). Configure the gateway to forward the `Content-Type` header and body unmodified rather than setting this variable. Requires Claude Code v2.1.208 or later `CLAUDE_CODE_DISABLE_BG_EXIT_HANDOFF`| Set to `1` to stop a [background session’s](</docs/en/agent-view>) running background shell commands, dynamic workflows, and, as of v2.1.198, background subagents when the [supervisor](</docs/en/agent-view#the-supervisor-process>) stops, restarts, or updates that session’s process, instead of handing them to the session’s next process. Affects only that handoff: backgrounding a session with `←` or [`/background`](</docs/en/agent-view#from-inside-a-session>) still carries in-flight work over, and `CLAUDE_DISABLE_ADOPT` turns off both. Requires Claude Code v2.1.196 or later -`CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP`| Set to `1` to stop Claude Code from terminating [background shell commands](</docs/en/interactive-mode#background-bash-commands>) when the operating system reports memory pressure. By default, on macOS and Linux, Claude Code terminates a background shell started in the main session on a memory-pressure signal once the session has been idle for 30 minutes and no turn or subagent is running. Windows has no memory-pressure signal, so this variable has no effect there. Requires Claude Code v2.1.193 or later +`CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP`| Set to `1` to stop Claude Code from terminating [background shell commands](</docs/en/interactive-mode#background-bash-commands>) under memory pressure. By default, on macOS and Linux, Claude Code terminates background shells when the operating system reports critical memory pressure and the session has been idle for 30 minutes with no turn or subagent running. Windows has no memory-pressure signal, so this variable has no effect there. Requires Claude Code v2.1.193 or later `CLAUDE_CODE_DISABLE_BUNDLED_SKILLS`| Set to `1` to disable the [skills](</docs/en/skills>) and workflows included with Claude Code: bundled skills and workflows are removed entirely, while built-in commands like `/init` stay typable but are hidden from the model. `/doctor` stays typable like the built-in commands; hide it with `DISABLE_DOCTOR_COMMAND` instead. Skills from plugins, `.claude/skills/`, and `.claude/commands/` are unaffected. Equivalent to the [`disableBundledSkills`](</docs/en/settings-reference#disablebundledskills>) setting `CLAUDE_CODE_DISABLE_CFC_PROMPT`| Set to `1` to keep the [Claude in Chrome](</docs/en/chrome>) browser tools available while omitting the Chrome section of the system prompt and the `/claude-in-chrome` [bundled skill](</docs/en/skills#bundled-skills>). For hosts that embed Claude Code and supply their own browser guidance. Requires Claude Code v2.1.257 or later `CLAUDE_CODE_DISABLE_CLAUDE_MDS`| Set to `1` to prevent loading any CLAUDE.md memory files into context, including user, project, and auto memory files @@ -230,7 +230,7 @@ `CLAUDE_CODE_DISABLE_FAST_MODE`| Set to `1` to disable [fast mode](</docs/en/fast-mode>) `CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY`| Set to `1` to disable the “How is Claude doing?” session quality surveys. Surveys are also disabled when `DISABLE_TELEMETRY`, `DO_NOT_TRACK`, or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` is set, unless `CLAUDE_CODE_ENABLE_FEEDBACK_SURVEY_FOR_OTEL` opts back in. To set a sample rate instead of disabling outright, use the [`feedbackSurveyRate`](</docs/en/settings-reference#feedbacksurveyrate>) setting. See [Session quality surveys](</docs/en/data-usage#session-quality-surveys>) `CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING`| Set to `1` to disable file [checkpointing](</docs/en/checkpointing>). The `/rewind` command will not be able to restore code changes. Overrides the [`fileCheckpointingEnabled`](</docs/en/settings-reference#filecheckpointingenabled>) setting -`CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS`| Set to `1` to remove built-in commit and PR workflow instructions and the git status snapshot from Claude’s system prompt. Useful when using your own git workflow skills. Takes precedence over the [`includeGitInstructions`](</docs/en/settings-reference#includegitinstructions>) setting when set +`CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS`| Set to `1` to remove built-in commit and PR workflow instructions and the git status snapshot from Claude’s context. Useful when using your own git workflow skills. Takes precedence over the [`includeGitInstructions`](</docs/en/settings-reference#includegitinstructions>) setting when set `CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP`| Set to `1` to prevent automatic remapping of Opus 4.0 and 4.1 to the current Opus version on the Anthropic API. Use when you intentionally want to pin an older model. The remap does not run on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry `CLAUDE_CODE_DISABLE_MOUSE`| Set to `1` to disable mouse tracking in [fullscreen rendering](</docs/en/fullscreen>). Keyboard scrolling with `PgUp` and `PgDn` still works. Use this to keep your terminal’s native copy-on-select behavior `CLAUDE_CODE_DISABLE_MOUSE_CLICKS`| Set to `1` to disable click, drag, and hover handling in [fullscreen rendering](</docs/en/fullscreen>) while keeping mouse-wheel scrolling. Use this when you want wheel scroll to work inside Claude Code but don’t want clicks to position the cursor, expand tool output, or open links. `CLAUDE_CODE_DISABLE_MOUSE` takes precedence when both are set. Requires Claude Code v2.1.195 or later @@ -241,7 +241,7 @@ `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL`| Set to `1` to disable automatic registration of the official plugin marketplace. Claude Code reads the variable when it is about to register the marketplace, usually during a machine’s first interactive launch. If the variable is set at that point, Claude Code skips the registration permanently. Unsetting the variable later doesn’t undo the skip. Run `claude plugin marketplace add anthropics/claude-plugins-official` to register the marketplace at any time `CLAUDE_CODE_DISABLE_PERMISSION_PROMPT_NOTIFY_HOOKS`| Set to `1` to stop Claude Code from running your [`Notification` hooks for unanswered permission requests](</docs/en/hooks#notification>) in sessions where Claude Code sends them to the Agent SDK’s `canUseTool` callback, which is how Claude Desktop and the VS Code extension host Claude Code. Has no effect in terminal sessions. Requires Claude Code v2.1.233 or later `CLAUDE_CODE_DISABLE_POLICY_SKILLS`| Set to `1` to skip loading skills from the system-wide managed skills directory. Useful for container or CI sessions that should not load operator-provisioned skills -`CLAUDE_CODE_DISABLE_TERMINAL_TITLE`| Set to `1` to disable automatic terminal title updates based on conversation context. In Agent SDK and `claude -p` sessions, this also skips the background small/fast-model request that generates the session title +`CLAUDE_CODE_DISABLE_TERMINAL_TITLE`| Set to `1` to disable automatic terminal title updates based on conversation context. This also skips the background small/fast-model request that [generates a session title](</docs/en/sessions#name-your-sessions>) `CLAUDE_CODE_DISABLE_THINKING`| Set to `1` to omit the `thinking` parameter from API requests entirely. This is a compatibility option for proxies and gateways that reject the parameter. On models that think by default, omitting the parameter means the model may still think. To explicitly disable [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) on the Anthropic API, use `MAX_THINKING_TOKENS=0` instead. Neither variable turns thinking off on Fable models, which can’t have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `MAX_THINKING_TOKENS=0` likewise omits the parameter, so the two variables behave the same there `CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT`| Set to `1` to skip proactive [auto-compaction](</docs/en/costs#reduce-token-usage>) when Claude Code doesn’t recognize the model ID, such as an [LLM gateway](</docs/en/llm-gateway>) alias. Without this variable, Claude Code compacts at the context window it assumes for the ID. `CLAUDE_CODE_MAX_CONTEXT_TOKENS` can correct the assumed window instead; see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>) for when each variable applies. Requires Claude Code v2.1.223 or later `CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL`| Set to `1` to disable virtual scrolling in [fullscreen rendering](</docs/en/fullscreen>) and render every message in the transcript. Use this if scrolling in fullscreen mode shows blank regions where messages should appear @@ -268,6 +268,7 @@ `CLAUDE_CODE_FORCE_SYNC_OUTPUT`| Set to `1` to force-enable DEC private mode 2026 [synchronized output](<https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036>) when your terminal supports it but is not auto-detected. Useful for emulators such as Emacs `eat` that implement BSU/ESU but do not reply to the capability probe. Has no effect under tmux. Unlike `CLAUDE_CODE_NO_FLICKER`, which switches to [fullscreen rendering](</docs/en/fullscreen>), this doesn’t change the renderer `CLAUDE_CODE_FORK_SUBAGENT`| Controls [fork mode](</docs/en/sub-agents#turn-fork-mode-on-or-off>), which lets Claude spawn [forked subagents](</docs/en/sub-agents#fork-the-current-conversation>) itself and is on by default in interactive sessions only. Set to `1` to turn it on in `claude -p` and the Agent SDK as well, or `0` to turn it off in every kind of session. You can run `/subtask` whether or not fork mode is on. The interactive default requires Claude Code v2.1.232 or later; on earlier versions, set the variable to `1` to turn fork mode on `CLAUDE_CODE_FORWARD_SUBAGENT_TEXT`| Set to `1` to emit [subagent](</docs/en/sub-agents>) text and thinking blocks in `claude -p --output-format stream-json` output, the same behavior as the [`--forward-subagent-text`](</docs/en/cli-reference#cli-flags>) flag. Use the variable when a harness invokes `claude` and can’t pass the flag itself. Unlike the flag, which exits with an error outside non-interactive mode with stream-json output, the variable is ignored there so that nested invocations keep working when it’s set process-wide. Requires Claude Code v2.1.211 or later +`CLAUDE_CODE_GATEWAY_HINT_HEADERS`| Set to `1` to send the [gateway hint headers](</docs/en/llm-gateway-protocol#gateway-hint-headers>), such as `x-claude-code-request-class` and `x-claude-code-compaction`, on a custom proxy or a third-party provider such as Amazon Bedrock or Claude Platform on AWS. Set to `0` to stop sending them on every connection, including a direct connection to the Anthropic API, where Claude Code sends them by default. Requires Claude Code v2.1.273 or later `CLAUDE_CODE_GATEWAY_MODEL_DISCOVERY_TIMEOUT_MS`| Timeout in milliseconds for the [gateway model discovery](</docs/en/llm-gateway-protocol#model-discovery>) request that `CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY` turns on (default: `3000`). Raise it when your gateway needs longer than three seconds to answer `/v1/models` at startup. Takes plain digits only; `0`, negative values, and other spellings keep the default. Requires Claude Code v2.1.269 or later `CLAUDE_CODE_GIT_BASH_PATH`| Windows only: path to the Git Bash executable (`bash.exe`). Use when Git Bash is installed but not in your PATH. If the path doesn’t exist or the file isn’t named `bash.exe`, `sh.exe`, `bash`, or `sh`, Claude Code ignores the variable and auto-detects Git Bash as if it were unset, logging a warning visible with `--debug`. Before v2.1.219, Claude Code exited at startup when the path didn’t exist, and used any existing file as the shell without checking that it was bash or sh. See [Windows setup](</docs/en/setup#set-up-on-windows>) `CLAUDE_CODE_GLOB_HIDDEN`| Set to `false` to exclude dotfiles from results when Claude invokes the [Glob tool](</docs/en/tools-reference#glob-tool-behavior>). Included by default. Does not affect `@` file autocomplete, `ls`, Grep, or Read @@ -361,7 +362,7 @@ `CLAUDE_CODE_SYNTAX_HIGHLIGHT`| Set to `false` to disable syntax highlighting in diff output. Useful when colors interfere with your terminal setup. To also disable highlighting in code blocks and file previews, use the [`syntaxHighlightingDisabled`](</docs/en/settings-reference#syntaxhighlightingdisabled>) setting `CLAUDE_CODE_TASK_LIST_ID`| Share a task list across sessions. Set the same ID in multiple Claude Code instances to coordinate on a shared task list, in [sessions that have the Task tools](</docs/en/tools-reference#task-tool-availability>). See [Task list](</docs/en/interactive-mode#task-list>) `CLAUDE_CODE_TEAM_TEARDOWN_PARK_TIMEOUT_MS`| Override, in milliseconds, how long a non-interactive session waits at exit for its [agent team](</docs/en/agent-teams>) to finish tearing down. Accepts 1000 to 60000; an out-of-range value is ignored and the default of 10000 applies. Requires Claude Code v2.1.206 or later -`CLAUDE_CODE_TMPDIR`| Override the temp directory used for internal temp files. Claude Code appends `/claude-{uid}/` on Unix or `/claude/` on Windows to this path. Default: `/tmp` on macOS, `os.tmpdir()` on Linux and Windows. On macOS and Linux, [sandboxed](</docs/en/sandboxing>) Bash subprocesses receive a short fallback `$TMPDIR` under the system default when your override is a long path, since some tools fail when temp paths get too long. Unsandboxed Bash commands inherit your shell’s `$TMPDIR` unchanged. Claude Code’s own temp files always use your override. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) +`CLAUDE_CODE_TMPDIR`| Override the temp directory used for internal temp files. Claude Code appends `/claude-{uid}/` on Unix or `/claude/` on Windows to this path. Default: `/tmp` on macOS, `os.tmpdir()` on Linux and Windows. On macOS and Linux, [sandboxed](</docs/en/sandboxing>) Bash subprocesses receive a short fallback `$TMPDIR` under the system default when your override is a long path, since some tools fail when temp paths get too long. Unsandboxed Bash commands inherit your shell’s `$TMPDIR` when it is set. Claude Code’s own temp files always use your override. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) `CLAUDE_CODE_TMUX_TRUECOLOR`| Set to any non-empty value, such as `1`, to allow 24-bit truecolor output inside tmux. **Setting it to`0` or `false` still allows truecolor**, unlike most on/off variables; unset the variable to restore the 256-color clamp. By default, Claude Code clamps to 256 colors when `$TMUX` is set because tmux does not pass through truecolor escape sequences unless configured to. Set this after adding `set -ga terminal-overrides ',*:Tc'` to your `~/.tmux.conf`. See [Terminal configuration](</docs/en/terminal-config>) for other tmux settings `CLAUDE_CODE_TOOL_MEMORY_CGROUP_EXCLUDE`| On Linux and WSL, set to a comma-separated list of the kinds of processes Claude Code [excludes from the tool memory cap](</docs/en/tools-reference#memory-limit-on-linux-and-wsl>), such as `mcp` or `lsp`. Set `none` to cap every kind, or `all-new` to cap only Bash, PowerShell, and Monitor tool commands. Claude Code keeps Bash, PowerShell, and Monitor tool commands under the cap whatever you list. Requires Claude Code v2.1.246 or later `CLAUDE_CODE_TOOL_MEMORY_LIMIT`| On Linux and WSL, set to a size such as `4G` to [cap the memory that Bash and PowerShell tool commands can use](</docs/en/tools-reference#memory-limit-on-linux-and-wsl>), and Monitor tool commands on v2.1.246 or later. Write the size in plain digits, alone for a number of bytes or with a `K`, `M`, `G`, or `T` suffix. Set `0` or `off` to turn the cap off. Once the first process Claude Code starts has turned the cap on or off, a changed value takes effect the next time you launch `claude`. Requires Claude Code v2.1.233 or later @@ -446,6 +447,7 @@ `NO_PROXY`| List of domains and IPs to which requests will be directly issued, bypassing proxy `OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`| Standard OpenTelemetry SDK limit on attribute value length. Claude Code caps content-bearing telemetry attributes at the smaller of this and `CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH`, so the truncation marker stays within the SDK limit. Claude Code reads the `OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT` and `OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT` variants the same way, and the smallest set value applies to all signals. Requires Claude Code v2.1.214 or later. See [Monitoring](</docs/en/monitoring-usage#common-configuration-variables>) `OTEL_LOG_ASSISTANT_RESPONSES`| Set to `1` to include the model’s response text on `assistant_response` OpenTelemetry log events. When unset, the value of `OTEL_LOG_USER_PROMPTS` is used instead. Set to `0` to keep responses redacted even when `OTEL_LOG_USER_PROMPTS` is set. Requires Claude Code v2.1.193 or later. See [Monitoring](</docs/en/monitoring-usage#assistant-response-event>) +`OTEL_LOG_MANAGED_SETTINGS`| Set to `1` to add the redacted managed settings, and a SHA-256 digest of the settings before redaction, to `managed_settings_resolved` OpenTelemetry log events. Disabled by default. Set it in your shell, user settings, or managed settings; a value in project or local settings doesn’t turn it on. Requires Claude Code v2.1.274 or later. See [Monitoring](</docs/en/monitoring-usage#managed-settings-resolved-event>) `OTEL_LOG_RAW_API_BODIES`| Emit Anthropic Messages API request and response JSON as `api_request_body` / `api_response_body` log events. Set to `1` for inline bodies truncated at the content limit, or `file:<dir>` to write untruncated bodies to disk and emit a `body_ref` path instead. `CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH` configures the content limit, 60 KB by default. Disabled by default; bodies include the entire conversation history. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). See [Monitoring](</docs/en/monitoring-usage#api-request-body-event>) `OTEL_LOG_TOOL_CONTENT`| Set to `1` to include tool content in the `tool.output` OpenTelemetry span event. Span attributes carry tool content under [their own gates](</docs/en/monitoring-usage#new-context-gates>). Requires [tracing](</docs/en/monitoring-usage#traces-beta>). Disabled by default to protect sensitive data. See [Monitoring](</docs/en/monitoring-usage#tool-output-span-event>) `OTEL_LOG_TOOL_DETAILS`| Set to `1` to include tool input arguments, MCP server names, user-authored workflow names, raw error strings on tool failures, the refusal `category` on `api_refusal` events, and other tool details in OpenTelemetry traces and logs. Disabled by default to protect PII. See [Monitoring](</docs/en/monitoring-usage>) @@ -457,7 +459,7 @@ `OTEL_METRICS_INCLUDE_SESSION_ID`| Set to `false` to exclude session ID from metrics attributes (default: included). See [Monitoring](</docs/en/monitoring-usage>) `OTEL_METRICS_INCLUDE_VERSION`| Set to `true` to include Claude Code version in metrics attributes (default: excluded). See [Monitoring](</docs/en/monitoring-usage>) `SLASH_COMMAND_TOOL_CHAR_BUDGET`| Override the character budget for skill metadata shown to the [Skill tool](</docs/en/skills#control-who-invokes-a-skill>). The budget scales dynamically at 1% of the context window, with a fallback of 8,000 characters. Legacy name kept for backwards compatibility -`TASK_MAX_OUTPUT_LENGTH`| Maximum number of characters of a [background task’s](</docs/en/tools-reference#background-commands>) output that the `TaskOutput` tool keeps (default: 32000; maximum: 160000). If you set the [`taskOutputMaxChars`](</docs/en/settings-reference#taskoutputmaxchars>) setting, Claude Code ignores this variable +`TASK_MAX_OUTPUT_LENGTH`| Removed in v2.1.277 and now a no-op, together with the `TaskOutput` tool it sized. Previously set the maximum number of characters of a [background task’s](</docs/en/tools-reference#background-commands>) output that the `TaskOutput` tool kept. Claude reads a background task’s output file with `Read` instead `USE_BUILTIN_RIPGREP`| Set to `0` to use system-installed `rg` instead of `rg` included with Claude Code `VERTEX_REGION_CLAUDE_3_5_HAIKU`| Override region for Claude 3.5 Haiku when using Google Cloud’s Agent Platform `VERTEX_REGION_CLAUDE_3_5_SONNET`| Override region for Claude 3.5 Sonnet when using Google Cloud’s Agent Platform @@ -507,6 +509,7 @@ * Have Claude Code probe claude.ai connector servers for [MCP protocol revision 2026-07-28](</docs/en/mcp#mcp-client-runtimes>) unless you set `MCP_PROTOCOL_NEGOTIATION=auto` * Get the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) by default for claude.ai and Console accounts on Windows with Git Bash installed; Claude Code routes shell commands through Git Bash unless you set `CLAUDE_CODE_USE_POWERSHELL_TOOL=1`. On Windows without Git Bash, the tool stays on * Get [Claude-drafted feedback](</docs/en/tools-reference#sendfeedback-tool-behavior>), which Claude Code turns on through a fetched flag + * Have Claude [treat large pastes as pasted rather than typed text](</docs/en/terminal-config#how-claude-treats-pasted-text>); the content behind a `[Pasted text #N]` placeholder reaches Claude unmarked * Have Claude Code [exclude MCP tools whose input schema the API would reject](</docs/en/mcp#tools-with-invalid-input-schemas>); it sends the schema anyway, and a request that includes it fails with [a 400 error naming the tool by its position](</docs/en/errors#tool-input-schema-is-invalid>) ###
modified
--- a/env-vars.md +++ b/env-vars.md @@ -193,7 +193,7 @@ `CLAUDE_CODE_AUTO_BACKGROUND_WORKER_CHECKIN_SECONDS`| When `CLAUDE_AUTO_BACKGROUND_TASKS` is enabled, seconds between reminders to Claude to check on [background subagents](</docs/en/sub-agents#run-subagents-in-foreground-or-background>) that are still running. Accepts a plain integer from `1` to `86400` only; any other value or spelling reads as unset. When unset, there are no check-in reminders. Requires Claude Code v2.1.248 or later `CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the [auto-compact window](</docs/en/model-config#set-the-auto-compact-window>) in tokens, from `100000` to `1000000`. Accepts a plain integer such as `500000` only: a value like `500k` reads as `500` and clamps to the 100K minimum. The effective window is also capped at the model’s context window. Takes precedence over the `/autocompact` command, the `--autocompact` flag, and the `autoCompactWindow` setting. The status line’s `used_percentage` always measures against the model’s full context window, so once this variable is set, that percentage no longer indicates when compaction will run `CLAUDE_CODE_AUTO_CONNECT_IDE`| Override automatic [IDE connection](</docs/en/vs-code>). By default, Claude Code connects automatically when launched inside a supported IDE’s integrated terminal. Set to `false` to prevent this. Set to `true` to force a connection attempt when auto-detection fails, such as when tmux obscures the parent terminal. Takes precedence over the [`autoConnectIde`](</docs/en/settings-reference#autoconnectide>) global config setting -`CLAUDE_CODE_AUTO_MODE_SERVER`| On Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry, set to `1` to have the platform’s server-side classifier review [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) actions; where the platform doesn’t run the classifier, Claude Code falls back to its own classifier requests. When unset or `0`, the classifier runs through requests that Claude Code itself sends. Has no effect on other providers, including the Anthropic API. Requires Claude Code v2.1.271 or later +`CLAUDE_CODE_AUTO_MODE_SERVER`| Controls whether Claude Code asks the server to [review auto mode actions](</docs/en/permission-modes#server-side-classifier-review>). When unset, Claude Code asks the server on Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and Claude Platform on AWS, and when you point `ANTHROPIC_BASE_URL` at an LLM gateway or proxy. Set to `0` to use Claude Code’s own classifier requests instead. Not read on a direct connection to the Anthropic API. Requires Claude Code v2.1.271 or later; asking the server by default requires v2.1.278 or later `CLAUDE_CODE_AWS_CHAIN_RESOLVE_TIMEOUT_MS`| Time in milliseconds Claude Code waits for the AWS default credential provider chain to produce credentials before the request fails with [`AWS default-chain credential resolve timed out`](</docs/en/errors#aws-default-chain-credential-resolve-timed-out>) (default: `60000`). Raise it when a step in your chain legitimately needs longer, such as a browser-based SSO sign-in with MFA through a wrapper like `aws-vault`. Applies wherever Claude Code signs with the default chain: [Amazon Bedrock](</docs/en/amazon-bedrock#credential-caching-and-resolution-timeout>), [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), and the [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>). Requires Claude Code v2.1.207 or later `CLAUDE_CODE_BASH_EDIT_DIFF`| Set to `0` to turn off the [diff of the files a Bash command changed](</docs/en/hooks#bash>), or `1` to record it in every permission mode. Takes precedence over the [`bashEditDiffEnabled`](</docs/en/settings-reference#basheditdiffenabled>) setting. Requires Claude Code v2.1.269 or later `CLAUDE_CODE_BG_TASKS_REPORT_RUNNING`| Set to `0` to make a non-interactive session report an idle status to its host at every turn end, even while background work is still running. By default, the session keeps reporting a running status past turn end while background work such as a background agent or a [workflow](</docs/en/workflows>) run is still live. This keeps a host that watches the status, such as a remote session list, from announcing that Claude is waiting for your input mid-work. Background shell commands, such as a dev server, don’t hold the running status. The running-status default and the `0` opt-out require Claude Code v2.1.269 or later; on earlier versions, set `1` to hold the running status @@ -493,6 +493,7 @@ With fetching off, you can’t: + * Have Claude Code [read `AGENTS.md` files](</docs/en/memory#agents-md>) as project instructions; it loads `CLAUDE.md` files only * [Start sessions in auto mode by default](</docs/en/permission-modes#which-mode-a-session-starts-in>) on Pro, Max, and Team plans * Have the VS Code extension [read settings files for the starting permission mode](</docs/en/permission-modes#switch-permission-modes>) * Run [`/auto-mode-setup`](</docs/en/auto-mode-config#generate-environment-entries>) to draft `autoMode.environment` entries
modified
--- a/env-vars.md +++ b/env-vars.md @@ -193,8 +193,10 @@ `CLAUDE_CODE_AUTO_BACKGROUND_WORKER_CHECKIN_SECONDS`| When `CLAUDE_AUTO_BACKGROUND_TASKS` is enabled, seconds between reminders to Claude to check on [background subagents](</docs/en/sub-agents#run-subagents-in-foreground-or-background>) that are still running. Accepts a plain integer from `1` to `86400` only; any other value or spelling reads as unset. When unset, there are no check-in reminders. Requires Claude Code v2.1.248 or later `CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the [auto-compact window](</docs/en/model-config#set-the-auto-compact-window>) in tokens, from `100000` to `1000000`. Accepts a plain integer such as `500000` only: a value like `500k` reads as `500` and clamps to the 100K minimum. The effective window is also capped at the model’s context window. Takes precedence over the `/autocompact` command, the `--autocompact` flag, and the `autoCompactWindow` setting. The status line’s `used_percentage` always measures against the model’s full context window, so once this variable is set, that percentage no longer indicates when compaction will run `CLAUDE_CODE_AUTO_CONNECT_IDE`| Override automatic [IDE connection](</docs/en/vs-code>). By default, Claude Code connects automatically when launched inside a supported IDE’s integrated terminal. Set to `false` to prevent this. Set to `true` to force a connection attempt when auto-detection fails, such as when tmux obscures the parent terminal. Takes precedence over the [`autoConnectIde`](</docs/en/settings-reference#autoconnectide>) global config setting +`CLAUDE_CODE_AUTO_MODE_SERVER`| On Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry, set to `1` to have the platform’s server-side classifier review [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) actions; where the platform doesn’t run the classifier, Claude Code falls back to its own classifier requests. When unset or `0`, the classifier runs through requests that Claude Code itself sends. Has no effect on other providers, including the Anthropic API. Requires Claude Code v2.1.271 or later `CLAUDE_CODE_AWS_CHAIN_RESOLVE_TIMEOUT_MS`| Time in milliseconds Claude Code waits for the AWS default credential provider chain to produce credentials before the request fails with [`AWS default-chain credential resolve timed out`](</docs/en/errors#aws-default-chain-credential-resolve-timed-out>) (default: `60000`). Raise it when a step in your chain legitimately needs longer, such as a browser-based SSO sign-in with MFA through a wrapper like `aws-vault`. Applies wherever Claude Code signs with the default chain: [Amazon Bedrock](</docs/en/amazon-bedrock#credential-caching-and-resolution-timeout>), [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), and the [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>). Requires Claude Code v2.1.207 or later `CLAUDE_CODE_BASH_EDIT_DIFF`| Set to `0` to turn off the [diff of the files a Bash command changed](</docs/en/hooks#bash>), or `1` to record it in every permission mode. Takes precedence over the [`bashEditDiffEnabled`](</docs/en/settings-reference#basheditdiffenabled>) setting. Requires Claude Code v2.1.269 or later +`CLAUDE_CODE_BG_TASKS_REPORT_RUNNING`| Set to `0` to make a non-interactive session report an idle status to its host at every turn end, even while background work is still running. By default, the session keeps reporting a running status past turn end while background work such as a background agent or a [workflow](</docs/en/workflows>) run is still live. This keeps a host that watches the status, such as a remote session list, from announcing that Claude is waiting for your input mid-work. Background shell commands, such as a dev server, don’t hold the running status. The running-status default and the `0` opt-out require Claude Code v2.1.269 or later; on earlier versions, set `1` to hold the running status `CLAUDE_CODE_BRIDGE_SESSION_ID`| Set automatically in Bash tool and [hook command](</docs/en/hooks>) subprocesses while the session has an active [Remote Control](</docs/en/remote-control>) connection, and removed when the connection ends. The value is the session’s ID in `session_` form, the same identifier that appears in the session’s `claude.ai/code` URL, so a script can link back to the session that ran it. Requires Claude Code v2.1.199 or later. In [cloud sessions](</docs/en/claude-code-on-the-web>), read `CLAUDE_CODE_REMOTE_SESSION_ID` instead `CLAUDE_CODE_BS_AS_CTRL_BACKSPACE`| Set to `0` to make Claude Code read the `0x08` byte, also written `^H`, as plain Backspace, or `1` to read it as Ctrl+Backspace. Either value replaces the platform default. By default, Claude Code reads it as Ctrl+Backspace on Windows, except when `TERM_PROGRAM` is `mintty` or `TERM` is `cygwin`, and as plain Backspace on macOS and Linux. Set `0` in a Windows terminal where [Backspace deletes a whole word](</docs/en/terminal-config#fix-backspace-deleting-a-whole-word-on-windows>) `CLAUDE_CODE_CERT_STORE`| Comma-separated list of CA certificate sources for TLS connections. `bundled` is the Mozilla CA set shipped with Claude Code. `system` is the operating system trust store, read only on runtimes with `tls.getCACertificates`: the native binary, or Node 22.15 or later for npm installs. See [CA certificate store](</docs/en/network-config#ca-certificate-store>). Default is `bundled,system` @@ -243,9 +245,9 @@ `CLAUDE_CODE_DISABLE_THINKING`| Set to `1` to omit the `thinking` parameter from API requests entirely. This is a compatibility option for proxies and gateways that reject the parameter. On models that think by default, omitting the parameter means the model may still think. To explicitly disable [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) on the Anthropic API, use `MAX_THINKING_TOKENS=0` instead. Neither variable turns thinking off on Fable models, which can’t have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `MAX_THINKING_TOKENS=0` likewise omits the parameter, so the two variables behave the same there `CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT`| Set to `1` to skip proactive [auto-compaction](</docs/en/costs#reduce-token-usage>) when Claude Code doesn’t recognize the model ID, such as an [LLM gateway](</docs/en/llm-gateway>) alias. Without this variable, Claude Code compacts at the context window it assumes for the ID. `CLAUDE_CODE_MAX_CONTEXT_TOKENS` can correct the assumed window instead; see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>) for when each variable applies. Requires Claude Code v2.1.223 or later `CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL`| Set to `1` to disable virtual scrolling in [fullscreen rendering](</docs/en/fullscreen>) and render every message in the transcript. Use this if scrolling in fullscreen mode shows blank regions where messages should appear +`CLAUDE_CODE_DISABLE_WINDOWS_SHELL_LAUNCHER`| Set to `1` to start [PowerShell tool](</docs/en/tools-reference#powershell-tool>) commands on Windows directly instead of through the `cmd.exe` launcher. By default, the launcher lets a PowerShell command [running in the background](</docs/en/tools-reference#background-commands>) [carry over to the session’s next process](</docs/en/agent-view#the-supervisor-process>), such as when you [background the session](</docs/en/agent-view#from-inside-a-session>). If you set the variable, a backgrounded PowerShell command stops when the session’s process exits. Bash commands aren’t affected. Requires Claude Code v2.1.269 or later `CLAUDE_CODE_DISABLE_WORKFLOWS`| Set to `1` to disable [workflows](</docs/en/workflows#turn-workflows-off>). Equivalent to the [`disableWorkflows`](</docs/en/settings-reference#disableworkflows>) setting `CLAUDE_CODE_EFFORT_LEVEL`| Set the effort level for supported models. Values: `low`, `medium`, `high`, `xhigh`, `max`, or `auto` to use the model default. Available levels depend on the model. Takes precedence over `--effort`, `/effort`, and the `modelSettings` and `effortLevel` settings. A [`maxEffortLevel`](</docs/en/settings-reference#maxeffortlevel>) cap still applies. See [Adjust effort level](</docs/en/model-config#adjust-effort-level>) -`CLAUDE_CODE_ENABLE_APPEND_SUBAGENT_PROMPT`| Set to `1` to enable appending extra text to the end of the system prompt of every [subagent](</docs/en/sub-agents>) other than a [forked subagent](</docs/en/sub-agents#fork-the-current-conversation>). The [`--append-subagent-system-prompt`](</docs/en/cli-reference#cli-flags>) and [`--append-subagent-system-prompt-file`](</docs/en/cli-reference#cli-flags>) flags supply the appended text and set this variable automatically, so you don’t need to set it yourself. Requires Claude Code v2.1.205 or later `CLAUDE_CODE_ENABLE_AUTO_MODE`| Accepted for compatibility with older releases and has no effect. Auto mode is available by default on every provider, including Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and signed-in [Claude apps gateway](</docs/en/claude-apps-gateway>) sessions. In v2.1.158 through v2.1.206, setting this to `1` was required to make [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) available on those providers `CLAUDE_CODE_ENABLE_AWAY_SUMMARY`| Override [session recap](</docs/en/interactive-mode#session-recap>) availability. Set to `0` to force recaps off regardless of the `/config` toggle. Set to `1` to force recaps on when [`awaySummaryEnabled`](</docs/en/settings-reference#awaysummaryenabled>) is `false`. Takes precedence over the setting and `/config` toggle `CLAUDE_CODE_ENABLE_BACKGROUND_PLUGIN_REFRESH`| Set to `1` to refresh plugin state at turn boundaries in [non-interactive mode](</docs/en/headless>) after a background install completes. Off by default because the refresh changes the system prompt mid-session, which invalidates [prompt caching](</docs/en/prompt-caching>) for that turn @@ -266,6 +268,7 @@ `CLAUDE_CODE_FORCE_SYNC_OUTPUT`| Set to `1` to force-enable DEC private mode 2026 [synchronized output](<https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036>) when your terminal supports it but is not auto-detected. Useful for emulators such as Emacs `eat` that implement BSU/ESU but do not reply to the capability probe. Has no effect under tmux. Unlike `CLAUDE_CODE_NO_FLICKER`, which switches to [fullscreen rendering](</docs/en/fullscreen>), this doesn’t change the renderer `CLAUDE_CODE_FORK_SUBAGENT`| Controls [fork mode](</docs/en/sub-agents#turn-fork-mode-on-or-off>), which lets Claude spawn [forked subagents](</docs/en/sub-agents#fork-the-current-conversation>) itself and is on by default in interactive sessions only. Set to `1` to turn it on in `claude -p` and the Agent SDK as well, or `0` to turn it off in every kind of session. You can run `/subtask` whether or not fork mode is on. The interactive default requires Claude Code v2.1.232 or later; on earlier versions, set the variable to `1` to turn fork mode on `CLAUDE_CODE_FORWARD_SUBAGENT_TEXT`| Set to `1` to emit [subagent](</docs/en/sub-agents>) text and thinking blocks in `claude -p --output-format stream-json` output, the same behavior as the [`--forward-subagent-text`](</docs/en/cli-reference#cli-flags>) flag. Use the variable when a harness invokes `claude` and can’t pass the flag itself. Unlike the flag, which exits with an error outside non-interactive mode with stream-json output, the variable is ignored there so that nested invocations keep working when it’s set process-wide. Requires Claude Code v2.1.211 or later +`CLAUDE_CODE_GATEWAY_MODEL_DISCOVERY_TIMEOUT_MS`| Timeout in milliseconds for the [gateway model discovery](</docs/en/llm-gateway-protocol#model-discovery>) request that `CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY` turns on (default: `3000`). Raise it when your gateway needs longer than three seconds to answer `/v1/models` at startup. Takes plain digits only; `0`, negative values, and other spellings keep the default. Requires Claude Code v2.1.269 or later `CLAUDE_CODE_GIT_BASH_PATH`| Windows only: path to the Git Bash executable (`bash.exe`). Use when Git Bash is installed but not in your PATH. If the path doesn’t exist or the file isn’t named `bash.exe`, `sh.exe`, `bash`, or `sh`, Claude Code ignores the variable and auto-detects Git Bash as if it were unset, logging a warning visible with `--debug`. Before v2.1.219, Claude Code exited at startup when the path didn’t exist, and used any existing file as the shell without checking that it was bash or sh. See [Windows setup](</docs/en/setup#set-up-on-windows>) `CLAUDE_CODE_GLOB_HIDDEN`| Set to `false` to exclude dotfiles from results when Claude invokes the [Glob tool](</docs/en/tools-reference#glob-tool-behavior>). Included by default. Does not affect `@` file autocomplete, `ls`, Grep, or Read `CLAUDE_CODE_GLOB_NO_IGNORE`| Set to `false` to make the [Glob tool](</docs/en/tools-reference#glob-tool-behavior>) respect `.gitignore` patterns. By default, Glob returns all matching files including gitignored ones. Does not affect `@` file autocomplete, which has its own [`respectGitignore` setting](</docs/en/settings-reference#respectgitignore>) @@ -286,6 +289,7 @@ `CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSION`| Cap on the total number of [WebSearch](</docs/en/tools-reference#websearch-tool-behavior>) calls one session can make (default: 200). When Claude reaches the cap, further WebSearch calls return a notice telling it to continue with the information it already gathered. Accepts a positive whole number with no upper bound. Anything else is ignored and the default applies, so the cap can be raised but not turned off. Requires Claude Code v2.1.212 or later `CLAUDE_CODE_MCP_ALLOWLIST_ENV`| Set to `1` to spawn stdio MCP servers with only a safe baseline environment plus the server’s configured `env`, instead of inheriting your shell environment `CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS`| Elapsed time in milliseconds before a still-running MCP tool call [moves to a background task](</docs/en/mcp#automatic-backgrounding-of-long-tool-calls>) (default: 120000, or 2 minutes). Set to `0` to turn automatic backgrounding off. Requires Claude Code v2.1.212 or later +`CLAUDE_CODE_MCP_STARTUP_WAIT_MS`| How long in milliseconds the first turn of a [non-interactive](</docs/en/headless>) session waits for MCP servers that are still connecting, in place of the default [first-turn wait](</docs/en/agent-sdk/mcp#connection-timing>). When set, the wait covers every pending server. Set to `0` to skip the wait. A [`--permission-prompt-tool`](</docs/en/cli-reference#cli-flags>) server keeps its own `MCP_TIMEOUT` wait regardless of the value. Requires Claude Code v2.1.274 or later `CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT`| Idle timeout in milliseconds for MCP tool calls. When a stdio, HTTP, SSE, WebSocket, or [claude.ai connector](</docs/en/mcp#use-mcp-servers-from-claude-ai>) MCP server sends no response and no progress notification for this long, the tool call aborts with an error instead of waiting for the overall `MCP_TOOL_TIMEOUT`. Overrides the per-transport defaults of 300000 (5 minutes) for network servers and 1800000 (30 minutes) for stdio servers. Set to `0` to disable the idle check. Values below 1000 are raised to one second, and the value is capped at the effective `MCP_TOOL_TIMEOUT`. A per-server `timeout` in `.mcp.json` of at least 1000 raises that server’s idle window to at least the `timeout` value. Doesn’t apply to IDE servers or SDK in-process servers. Requires Claude Code v2.1.187 or later. Before v2.1.203, stdio servers were exempt from the idle timeout `CLAUDE_CODE_MESSAGING_SOCKET`| Set by Claude Code, not by you: in sessions that bind an [inbox socket](</docs/en/cross-session-messaging#the-sessions-inbox-socket>), Claude Code exports that socket’s path to hooks and Bash commands when it binds the socket. In a session that starts with messaging on, Claude Code binds the socket before any hook runs. Other sessions on the machine deliver messages to this path. Each session exports its own socket rather than one inherited from a parent, and messages arriving on it go through the session’s [inbound controls](</docs/en/cross-session-messaging#control-inbound-messages>). Settings `env` blocks can’t set it. Requires Claude Code v2.1.224 or later `CLAUDE_CODE_MESSAGING_TOKEN`| Set by Claude Code, not by you: in sessions that bind an [inbox socket](</docs/en/cross-session-messaging#the-sessions-inbox-socket>), Claude Code exports this per-session token to hooks and Bash commands alongside `CLAUDE_CODE_MESSAGING_SOCKET`. A script posting to the socket can send `{"type":"auth","token":"<token>"}` as its first line to prove it belongs to the session. On native Windows, Claude Code requires this line and closes any connection that doesn’t open with a valid one. The [own-child rules](</docs/en/cross-session-messaging#the-sessions-inbox-socket>) say when Claude Code consults the token. Each session exports its own token, never one inherited from a parent session. Settings `env` blocks can’t set it. Requires Claude Code v2.1.228 or later @@ -321,7 +325,7 @@ `CLAUDE_CODE_REMOTE_SESSION_ID`| Set automatically in [cloud sessions](</docs/en/claude-code-on-the-web>) to the current session’s ID. Read this to construct a link back to the session transcript. See [Link output back to the session](</docs/en/cloud-environments#link-output-back-to-the-session>) `CLAUDE_CODE_RESTRICTED`| Set to `1` to start the session in restricted mode, the same as passing [`--restricted`](</docs/en/cli-reference#cli-flags>). Claude Code ignores this variable in a settings file’s `env` block. Requires Claude Code v2.1.248 or later `CLAUDE_CODE_RESUME_INTERRUPTED_TURN`| Set to `1` to automatically resume if the previous session ended mid-turn. Used in SDK mode so the model continues without requiring the SDK to re-send the prompt. To turn this off, unset the variable or set it to `0`. Before v2.1.221, Claude Code ignored `0` and other falsy values, so setting `0` still triggered the resume in non-interactive mode and unsetting the variable was the only way to turn it off -`CLAUDE_CODE_RESUME_INTERRUPTED_TURN_MAX_AGE_MS`| Maximum age in milliseconds of the last transcript message for a session that ended mid-turn to continue automatically on resume. When the last message is older than this bound, Claude Code skips both the `CLAUDE_CODE_RESUME_INTERRUPTED_TURN` automatic resume and the injected `CLAUDE_CODE_RESUME_PROMPT` continuation message, and the session starts idle so you continue explicitly. Unset or `0` means no bound; a negative or non-numeric value applies a one-hour bound. Spawn scripts for long-running agents can set this so a restart against an old transcript doesn’t re-run a stale prompt. Claude Code sets a one-hour bound itself when it restarts a crashed [agent view](</docs/en/agent-view>) session that inherited its conversation from an interactive session. Requires Claude Code v2.1.211 or later +`CLAUDE_CODE_RESUME_INTERRUPTED_TURN_MAX_AGE_MS`| Maximum age in milliseconds of the last transcript message for a session that ended mid-turn to continue automatically on resume. When the last message is older than this bound, Claude Code skips both the `CLAUDE_CODE_RESUME_INTERRUPTED_TURN` automatic resume and the injected `CLAUDE_CODE_RESUME_PROMPT` continuation message, and the session starts idle so you continue explicitly. Unset or `0` means no bound, except that a turn whose last request failed with an API error resumes only while that error is less than six hours old. A positive value bounds every turn, including those; a negative or non-numeric value applies a one-hour bound. Spawn scripts for long-running agents can set this so a restart against an old transcript doesn’t re-run a stale prompt. Claude Code sets a one-hour bound itself when it restarts a crashed [agent view](</docs/en/agent-view>) session that inherited its conversation from an interactive session. Requires Claude Code v2.1.211 or later `CLAUDE_CODE_RESUME_PROMPT`| Override the continuation message injected when resuming a session that ended mid-turn. Defaults to `Continue from where you left off.`. Spawn scripts for long-running agents can set this to a more directive boot message. An empty string uses the default `CLAUDE_CODE_RETRY_WATCHDOG`| Set to `1` for unattended sessions such as eval harnesses, CI jobs, or remote workers. Retries `429` and `529` capacity errors indefinitely instead of failing after `CLAUDE_CODE_MAX_RETRIES` attempts. Claude Code fails at once when a standard-speed request gets a `429` that reports a spend limit or exhausted usage credits, even one from a [gateway spend cap](</docs/en/errors#spend-limit-reached>) that resets on a schedule. Before v2.1.239, the watchdog retried these indefinitely. For fast mode requests, see [Handle rate limits](</docs/en/fast-mode#handle-rate-limits>). The watchdog backs off up to 5 minutes between attempts, or until the limit resets when the response carries a rate-limit reset time, so a session that hits a usage limit waits out the remaining window. On v2.1.199 or later it also raises the default retry count for other transient errors, such as server errors, timeouts, and dropped connections, to 300, roughly three hours of backoff, and removes the cap of 15 on `CLAUDE_CODE_MAX_RETRIES` if you set that variable explicitly. Requires Claude Code v2.1.186 or later `CLAUDE_CODE_SAFE_MODE`| Set to `1` to start in safe mode: CLAUDE.md, skills, plugins, hooks, MCP servers, custom commands and agents, output styles, workflows, custom themes, custom keybindings, status line and file-suggestion commands, LSP servers, and auto memory do not load, for troubleshooting a broken configuration. Managed settings policy still applies, including policy-configured hooks, status line, and file-suggestion commands; managed plugins, managed skills, managed CLAUDE.md, and policy-configured MCP servers do not. Equivalent to passing [`--safe-mode`](</docs/en/cli-reference#cli-flags>). Directly spawned child processes inherit the variable @@ -343,6 +347,7 @@ `CLAUDE_CODE_SKIP_MANTLE_AUTH`| Skip AWS authentication for Amazon Bedrock Mantle (for example, when using an LLM gateway) `CLAUDE_CODE_SKIP_PROMPT_HISTORY`| Set to `1` to skip writing prompt history and session transcripts to disk. Sessions started with this variable set do not appear in `--resume`, `--continue`, or up-arrow history. Useful for ephemeral scripted sessions `CLAUDE_CODE_SKIP_VERTEX_AUTH`| Skip Google authentication for Google Cloud’s Agent Platform (for example, when using an LLM gateway) +`CLAUDE_CODE_STARTUP_FAILURE_RESULTS`| Set to `1` to have a session started with `--output-format stream-json` write a [result message naming why Claude Code refused to start](</docs/en/agent-sdk/typescript#startup_failure_reason>) for startup failures that otherwise end with stderr alone. Requires Claude Code v2.1.274 or later `CLAUDE_CODE_STOP_HOOK_BLOCK_CAP`| Maximum number of consecutive times a [Stop](</docs/en/hooks#stop>) or [SubagentStop](</docs/en/hooks#subagentstop>) hook may block the turn from ending before Claude Code overrides it and ends the turn anyway (default: 8). Set to `0` to disable the cap. Raise this if your hook legitimately needs more iterations to resolve `CLAUDE_CODE_SUBAGENT_MODEL`| The default model for [subagents](</docs/en/sub-agents#choose-a-model>), [agent team](</docs/en/agent-teams#specify-teammates-and-models>) teammates, and [workflow](</docs/en/workflows>) agents that aren’t assigned a model another way. Accepts an alias such as `haiku` or a full model name. Two sources take precedence over it: a model Claude passes when it spawns the agent, and a `model` field in the agent’s definition, including `inherit`. To change that, set [`CLAUDE_CODE_SUBAGENT_MODEL_FORCE`](</docs/en/sub-agents#run-every-subagent-on-one-model>). See [Choose a model](</docs/en/sub-agents#choose-a-model>) for the full order. Setting it to `inherit` is the same as leaving it unset. Before v2.1.251, this variable overrode both the per-invocation model and the definition’s `model` field `CLAUDE_CODE_SUBAGENT_MODEL_FORCE`| Set to `1` to force one model onto subagents, teammates, and workflow agents. [Run every subagent on one model](</docs/en/sub-agents#run-every-subagent-on-one-model>) says which model that is. Requires Claude Code v2.1.257 or later @@ -370,6 +375,7 @@ `CLAUDE_CODE_USE_VERTEX`| Use [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>) `CLAUDE_CODE_WEBFETCH_CACHE_TTL_MS`| Set to the number of milliseconds [WebFetch](</docs/en/tools-reference#webfetch-tool-behavior>) keeps each fetched URL’s response cached. The default is `900000`, which is 15 minutes. Takes plain digits only; `0`, a decimal, or any other spelling keeps the default. Claude Code reads the value once per launch, so a change in a settings `env` block applies when you next launch `claude`. Requires Claude Code v2.1.233 or later `CLAUDE_CODE_WEBFETCH_DEADLINE_MS`| Upper bound in milliseconds on how long [WebFetch](</docs/en/tools-reference#webfetch-tool-behavior>) waits for a page to download, including any redirects it follows. A download that hasn’t completed by then fails with a deadline error. The default is `300000`, which is five minutes. Set to `0` to remove the limit. Takes plain digits only; a decimal or any other spelling keeps the default. Requires Claude Code v2.1.268 or later +`CLAUDE_CODE_WORKFLOW_MAX_CONCURRENT_AGENTS`| How many agents a single [workflow](</docs/en/workflows>) run executes at once, from `1` to `256`. By default, a run executes up to 16 agents at once, fewer when Claude Code has fewer CPUs available; queued `agent()` calls wait for a free slot. Each running agent’s transcript stays in Claude Code’s memory, so higher values raise memory use. Takes plain digits only; out-of-range values and other spellings keep the default. Requires Claude Code v2.1.269 or later `CLAUDE_CODE_WORKFLOW_PREFIX_STAGGER_MS`| Upper bound in milliseconds on how long a [workflow](</docs/en/workflows>) agent waits for a same-prefix sibling’s first response to begin before sending its own first request. When a fan-out starts several agents that share a [prompt-cache prefix](</docs/en/workflows#prompt-caching-in-a-fan-out>), Claude Code holds all but the first agent for up to this long so the rest read the cached prefix instead of each processing it uncached. Default `5000`. Set to `0` to disable the wait. When `DISABLE_PROMPT_CACHING` is set, agents never wait. Requires Claude Code v2.1.229 or later `CLAUDE_CONFIG_DIR`| Override the configuration directory (default: `~/.claude`). All settings, session history, and plugins are stored under this path. For credentials, see [where Claude Code stores credentials](</docs/en/authentication#credential-management>). Useful for running multiple accounts side by side: for example, `alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'`. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) `CLAUDE_DISABLE_ADOPT`| Set to `1` to stop in-flight background work instead of carrying it over when you background a session by pressing `←` or with [`/background`](</docs/en/agent-view#from-inside-a-session>). Claude Code asks you to confirm before backgrounding, then stops the tasks that would otherwise carry over. Requires Claude Code v2.1.195 or later @@ -424,7 +430,7 @@ `MAX_STRUCTURED_OUTPUT_RETRIES`| Number of attempts Claude Code allows when the model’s response fails validation against the [`--json-schema`](</docs/en/cli-reference#cli-flags>) in non-interactive mode with the `-p` flag; after that many failed attempts with no valid output, the run fails. The same cap applies when a [workflow](</docs/en/workflows>) subagent’s structured output fails validation. Defaults to 5, a first attempt plus four retries `MAX_THINKING_TOKENS`| Fixed token budget for [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>). Claude Code caps it at one token below the request’s max output tokens and never below 1,024. See `CLAUDE_CODE_MAX_OUTPUT_TOKENS` for how that limit is set. When unset and thinking is enabled, models with [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) choose their own thinking depth, and other models use the cap. Set to `0` to disable thinking on the Anthropic API, except on Fable models, which can’t have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `0` omits the `thinking` parameter instead. With thinking turned off on the Anthropic API, Claude Code sends effort `high` instead of a higher level to models it knows [don’t accept that combination](</docs/en/errors#effort-isnt-available-with-thinking-turned-off>), such as Opus 5. Claude Code ignores nonzero values on adaptive reasoning models, except on the models where `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` turns adaptive reasoning off `MCP_CLIENT_SECRET`| OAuth client secret for MCP servers that require [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>). Avoids the interactive prompt when adding a server with `--client-secret` -`MCP_CONNECTION_NONBLOCKING`| Controls whether startup waits for MCP servers to connect before the first query. MCP startup is non-blocking by default: servers connect in the background and their tools become available as they finish. Set to `0` to make Claude Code wait for servers to connect before the first query. Servers configured with [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>) still make startup wait regardless, except when served from the [discovery cache](</docs/en/mcp#server-status-detail>), since their tools must be present when the first prompt is built. In non-interactive mode (`-p`), Claude Code also waits for still-pending servers before the first turn regardless of this variable, with a longer deadline when you pass [`--mcp-config`](</docs/en/cli-reference#cli-flags>) explicitly; see that flag’s entry for the cached-server exception +`MCP_CONNECTION_NONBLOCKING`| Controls whether startup waits for MCP servers to connect before the first query. MCP startup is non-blocking by default: servers connect in the background and their tools become available as they finish. Set to `0` to make Claude Code wait for servers to connect before the first query. Servers configured with [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>) still make startup wait regardless, except when served from the [discovery cache](</docs/en/mcp#server-status-detail>), since their tools must be present when the first prompt is built. In non-interactive mode (`-p`) without `--input-format stream-json`, Claude Code also waits for still-pending servers before the first turn regardless of this variable. When you pass [`--mcp-config`](</docs/en/cli-reference#cli-flags>) explicitly, the wait has a longer deadline; see that flag’s entry for the cached-server exception `MCP_CONNECT_TIMEOUT_MS`| How long blocking MCP startup waits, in milliseconds, for the connection batch before snapshotting the tool list (default: 5000). Applies when `MCP_CONNECTION_NONBLOCKING=0` or for servers marked [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>). Servers still pending at the deadline keep connecting in the background. Distinct from `MCP_TIMEOUT`, which bounds an individual server’s connect attempt `MCP_DISCOVERY_CACHE`| Turns the [MCP discovery cache](</docs/en/mcp#server-status-detail>) on or off. With the cache on, a remote HTTP or SSE server you’ve used before can show the [`cached` status](</docs/en/mcp#server-status-detail>), and Claude Code connects it on its first tool call instead of at startup. The cache is off by default unless a gradual rollout has enabled it for your account. Set to `1` to turn it on, or `0` to keep it off even when the rollout has enabled it. Before v2.1.238, the cache was on by default. The `cached` status requires Claude Code v2.1.221 or later `MCP_DISCOVERY_CACHE_MAX_STALE_S`| Maximum age, in seconds, of a [discovery-cache](</docs/en/mcp#server-status-detail>) entry (default: 14400, or 4 hours). At a start where the entry is older than that, Claude Code discards it and connects the server at startup, as it does with the cache off. Claude Code caps the value at 7 days. Before v2.1.238, the default was 86400, or 24 hours, and Claude Code didn’t cap the value
modified
--- a/env-vars.md +++ b/env-vars.md @@ -306,7 +306,7 @@ `CLAUDE_CODE_PERFORCE_MODE`| Set to `1` to enable Perforce-aware write protection. When set, Edit, Write, and NotebookEdit fail with a `p4 edit <file>` hint if the target file lacks the owner-write bit, which Perforce clears on synced files until `p4 edit` opens them. This prevents Claude Code from bypassing Perforce change tracking `CLAUDE_CODE_PLUGIN_CACHE_DIR`| Override the plugins root directory. Despite the name, this sets the parent directory, not the cache itself: marketplaces and the plugin cache live in subdirectories under this path. Defaults to `~/.claude/plugins` `CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS`| Timeout in milliseconds for git operations when installing or updating plugins (default: 120000). Increase this value for large repositories or slow network connections. See [Git operations time out](</docs/en/plugin-marketplaces#git-operations-time-out>) -`CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE`| Set to `1` to skip the re-clone attempt and keep using the existing marketplace cache when a `git pull` fails. Useful in offline or airgapped environments where re-cloning would fail the same way. See [Marketplace updates fail in offline environments](</docs/en/plugin-marketplaces#marketplace-updates-fail-in-offline-environments>) +`CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE`| Set to `1` to skip the re-clone attempt and keep using the existing marketplace checkout when a marketplace refresh can’t reach or authenticate to the remote. Useful in offline or airgapped environments where re-cloning would fail the same way. See [Marketplace updates fail in offline environments](</docs/en/plugin-marketplaces#marketplace-updates-fail-in-offline-environments>) `CLAUDE_CODE_PLUGIN_PREFER_HTTPS`| Set to `1` to clone GitHub `owner/repo` shorthand sources over HTTPS instead of SSH. Applies to plugin install and update, and to `/plugin marketplace add` and `update`. Useful in CI runners, containers, or any environment without a configured SSH key for `github.com` `CLAUDE_CODE_PLUGIN_SEED_DIR`| Path to one or more read-only plugin seed directories, separated by `:` on Unix or `;` on Windows. Use this to bundle a pre-populated plugins directory into a container image. Claude Code registers marketplaces from these directories at startup and uses pre-cached plugins without re-cloning. See [Pre-populate plugins for containers](</docs/en/plugin-marketplaces#pre-populate-plugins-for-containers>) `CLAUDE_CODE_POWERSHELL_RESPECT_EXECUTION_POLICY`| Set to `1` to stop Claude Code from passing `-ExecutionPolicy Bypass` when spawning PowerShell for tool calls, hooks, and status line commands, and respect the machine’s effective execution policy instead. By default Claude Code bypasses execution policy at process scope so `.ps1` scripts and module imports work on default-Restricted Windows installs. Process-scope bypass never overrides Group Policy `MachinePolicy` or `UserPolicy` regardless of this setting @@ -350,8 +350,8 @@ `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB`| Set to `1` to strip credentials from subprocess environments (Bash tool, hooks, MCP stdio servers): Anthropic and cloud provider credentials, any other variable that Claude Code recognizes as a credential, and credentials embedded in package registry URLs. The parent Claude process keeps these credentials for API calls, but child processes cannot read them, reducing exposure to prompt injection attacks that attempt to exfiltrate secrets via shell expansion. On v2.1.251 or later, the scrub also removes Claude Code’s own configuration-store pointer variables (such as `CLAUDE_CONFIG_DIR`), so a child process cannot locate a relocated configuration directory. Leave the scrub unset if a subprocess needs these variables. On Linux, this also runs Bash subprocesses in an isolated PID namespace so they cannot read host process environments via `/proc`; as a side effect, `ps`, `pgrep`, and `kill` cannot see or signal host processes. `claude-code-action` sets this automatically when `allowed_non_write_users` is configured `CLAUDE_CODE_SYNC_PLUGIN_INSTALL`| Set to `1` in non-interactive mode (the `-p` flag) to wait for plugin installation to complete before the first query. Without this, plugins install in the background and may not be available on the first turn. Combine with `CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS` to bound the wait `CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS`| Timeout in milliseconds for synchronous plugin installation. When exceeded, Claude Code proceeds without plugins and logs an error. No default: without this variable, synchronous installation waits until complete -`CLAUDE_CODE_SYNC_SKILLS`| Set to `1` to download your enabled claude.ai skills into `~/.claude/skills/synced/` and resync every 10 minutes. Before it runs the first query, Claude Code waits up to `CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS` for the list of your skills. The downloads themselves finish in the background, and Claude waits for a skill’s download when it invokes that skill. The `synced` folder name is [reserved for this download](</docs/en/skills#where-skills-live>). Before v2.1.227, the skills downloaded into `~/.claude/skills/` directly. Applies only in non-interactive mode with the `-p` flag. Requires claude.ai authentication. [Cloud sessions](</docs/en/claude-code-on-the-web>) receive your enabled claude.ai skills automatically; you don’t need to set this there. Claude Code applies [extra rules to the downloaded skills](</docs/en/skills#how-synced-skills-behave>), such as not running their `!` commands on your machine -`CLAUDE_CODE_SYNC_SKILLS_INSTALL_TIMEOUT_MS`| Timeout in milliseconds for a mid-session skills resync when `CLAUDE_CODE_SYNC_SKILLS` is set (default: 30000). Bounds the download triggered when the host requests a skill reload during the session. When exceeded, the resync stops and remaining downloads continue in the background +`CLAUDE_CODE_SYNC_SKILLS`| Set to `1` in non-interactive mode with the `-p` flag to make Claude Code download the skills enabled for your claude.ai account in that run and wait for the list of them, up to `CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS`, before it runs the first query. The downloads themselves finish in the background, and Claude waits for a skill’s download when it invokes that skill. Requires claude.ai authentication. Terminal sessions where you sign in with your claude.ai account [download these skills](</docs/en/skills#where-synced-skills-load>) into `~/.claude/skills/synced/` and resync about every 10 minutes without this variable, so set it only when a `-p` run needs your current skills on its first query. Before v2.1.273, terminal sessions downloaded them only in a `-p` run with this variable set. The `synced` folder name is [reserved for this download](</docs/en/skills#where-skills-live>). Before v2.1.227, the skills downloaded into `~/.claude/skills/` directly. Claude Code applies [extra rules to the downloaded skills](</docs/en/skills#how-synced-skills-behave>), such as not running their `!` commands on your machine +`CLAUDE_CODE_SYNC_SKILLS_INSTALL_TIMEOUT_MS`| Timeout in milliseconds for the skills resync that runs mid-session when an app built on the [Agent SDK](</docs/en/agent-sdk/typescript#query-object>) reloads skills (default: 30000). When exceeded, the reload continues with whichever skills have arrived, and the remaining downloads finish in the background `CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS`| Timeout in milliseconds for the first query to wait for the initial skill list when `CLAUDE_CODE_SYNC_SKILLS` is set (default: 5000). When exceeded, the first query runs with whichever skills have arrived. The downloads finish in the background either way, and Claude waits for a skill’s download when it invokes that skill `CLAUDE_CODE_SYNTAX_HIGHLIGHT`| Set to `false` to disable syntax highlighting in diff output. Useful when colors interfere with your terminal setup. To also disable highlighting in code blocks and file previews, use the [`syntaxHighlightingDisabled`](</docs/en/settings-reference#syntaxhighlightingdisabled>) setting `CLAUDE_CODE_TASK_LIST_ID`| Share a task list across sessions. Set the same ID in multiple Claude Code instances to coordinate on a shared task list, in [sessions that have the Task tools](</docs/en/tools-reference#task-tool-availability>). See [Task list](</docs/en/interactive-mode#task-list>) @@ -431,9 +431,9 @@ `MCP_DISCOVERY_CACHE_STRIKES`| At a start where a [discovery-cache](</docs/en/mcp#server-status-detail>) entry is older than `MCP_DISCOVERY_CACHE_TTL_S`, Claude Code refreshes it in the background. This variable sets how many refreshes in a row can fail before Claude Code discards the entry and connects the server at the next start instead (default: 1). Raise it if your network connection drops occasionally, so that one failed refresh doesn’t discard the entry. Requires Claude Code v2.1.238 or later `MCP_DISCOVERY_CACHE_TTL_S`| Seconds for which Claude Code uses a [discovery-cache](</docs/en/mcp#server-status-detail>) entry without refreshing it (default: 900). At a start where the entry is older than that, Claude Code still uses it but refreshes it in the background. Once the entry is older than `MCP_DISCOVERY_CACHE_MAX_STALE_S`, Claude Code discards it instead. Claude Code caps the value at `MCP_DISCOVERY_CACHE_MAX_STALE_S`, which is 4 hours by default. Before v2.1.238, Claude Code didn’t cap the value `MCP_OAUTH_CALLBACK_PORT`| Fixed port for the OAuth redirect callback, as an alternative to `--callback-port` when adding an MCP server with [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>) -`MCP_PROTOCOL_NEGOTIATION`| On the [v2 MCP client runtime](</docs/en/mcp#mcp-client-runtimes>) only, whether Claude Code probes servers for MCP protocol revision 2026-07-28. Set `auto` to probe HTTP, claude.ai connector, and stdio servers; a server that doesn’t answer the probe connects on the earlier protocol instead, as SSE and WebSocket servers always do. Set `legacy` to skip the probe for every server. Without the variable, Claude Code probes HTTP and claude.ai connector servers on Claude Code v2.1.232 or later, with the exceptions the [MCP client runtimes](</docs/en/mcp#mcp-client-runtimes>) section lists. Any other value is ignored with a warning in the debug log. Requires Claude Code v2.1.221 or later +`MCP_PROTOCOL_NEGOTIATION`| On the [v2 MCP client runtime](</docs/en/mcp#mcp-client-runtimes>) only, whether Claude Code probes servers for MCP protocol revision 2026-07-28. Set `auto` to probe HTTP, claude.ai connector, and stdio servers; a server that doesn’t answer the probe connects on the earlier protocol instead, as SSE and WebSocket servers always do. Set `legacy` to skip the probe for every server. Without the variable, Claude Code probes HTTP servers, and also probes claude.ai connector servers in sessions where it fetches feature flags. Any other value is ignored with a warning in the debug log. Requires Claude Code v2.1.221 or later `MCP_REMOTE_SERVER_CONNECTION_BATCH_SIZE`| Maximum number of remote MCP servers (HTTP/SSE) to connect in parallel during startup (default: 20) -`MCP_SDK_GENERATION`| Pin which [MCP client runtime](</docs/en/mcp#mcp-client-runtimes>) this process connects to MCP servers with: `v1`, built on MCP TypeScript SDK 1.x, or `v2`, built on [MCP TypeScript SDK 2.0](<https://ts.sdk.modelcontextprotocol.io/v2/>). Without the variable, Claude Code uses v2 on Claude Code v2.1.232 or later, except where that section says it uses v1. On Claude Code v2.1.221 or later, the v2 runtime checks the issuer an MCP OAuth server returns in its authorization response and fails the sign-in with an error that begins `Issuer mismatch in authorization response` when it doesn’t match. The v1 runtime doesn’t run this check. If you set an unrecognized value, Claude Code ignores it and writes a warning to the debug log. Claude Code reads the value once per process. Requires Claude Code v2.1.218 or later +`MCP_SDK_GENERATION`| Pin which [MCP client runtime](</docs/en/mcp#mcp-client-runtimes>) this process connects to MCP servers with: `v1`, built on MCP TypeScript SDK 1.x, or `v2`, built on [MCP TypeScript SDK 2.0](<https://ts.sdk.modelcontextprotocol.io/v2/>). Without the variable, Claude Code uses v2, starting with the versions listed in that section. On Claude Code v2.1.221 or later, the v2 runtime checks the issuer an MCP OAuth server returns in its authorization response and fails the sign-in with an error that begins `Issuer mismatch in authorization response` when it doesn’t match. The v1 runtime doesn’t run this check. If you set an unrecognized value, Claude Code ignores it and writes a warning to the debug log. Claude Code reads the value once per process. Requires Claude Code v2.1.218 or later `MCP_SERVER_CONNECTION_BATCH_SIZE`| Maximum number of local MCP servers (stdio) to connect in parallel during startup (default: 3) `MCP_TIMEOUT`| Timeout in milliseconds for MCP server startup (default: 30000, or 30 seconds) `MCP_TOOL_TIMEOUT`| Timeout in milliseconds for MCP tool execution (default: 100000000, about 28 hours). For an HTTP, SSE, or claude.ai connector server, each request also times out after 60 seconds by default; set this variable, or the per-server `timeout`, above 60000 to raise that per-request limit. A lower value still shortens the overall tool-execution timeout but leaves the per-request limit at 60 seconds. Stdio and WebSocket servers have no per-request timer. A per-server `timeout` field in `.mcp.json` overrides this for that server. A per-server `timeout` of at least 1000 also sets the minimum idle window for that server’s tool calls, so `CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT` never aborts them sooner; this floor requires Claude Code v2.1.203 or later. For the env variable, values below 1000 are floored to one second; for the per-server field, values below 1000 are ignored @@ -441,7 +441,7 @@ `OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`| Standard OpenTelemetry SDK limit on attribute value length. Claude Code caps content-bearing telemetry attributes at the smaller of this and `CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH`, so the truncation marker stays within the SDK limit. Claude Code reads the `OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT` and `OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT` variants the same way, and the smallest set value applies to all signals. Requires Claude Code v2.1.214 or later. See [Monitoring](</docs/en/monitoring-usage#common-configuration-variables>) `OTEL_LOG_ASSISTANT_RESPONSES`| Set to `1` to include the model’s response text on `assistant_response` OpenTelemetry log events. When unset, the value of `OTEL_LOG_USER_PROMPTS` is used instead. Set to `0` to keep responses redacted even when `OTEL_LOG_USER_PROMPTS` is set. Requires Claude Code v2.1.193 or later. See [Monitoring](</docs/en/monitoring-usage#assistant-response-event>) `OTEL_LOG_RAW_API_BODIES`| Emit Anthropic Messages API request and response JSON as `api_request_body` / `api_response_body` log events. Set to `1` for inline bodies truncated at the content limit, or `file:<dir>` to write untruncated bodies to disk and emit a `body_ref` path instead. `CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH` configures the content limit, 60 KB by default. Disabled by default; bodies include the entire conversation history. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). See [Monitoring](</docs/en/monitoring-usage#api-request-body-event>) -`OTEL_LOG_TOOL_CONTENT`| Set to `1` to include tool input and output content in OpenTelemetry span events. Disabled by default to protect sensitive data. See [Monitoring](</docs/en/monitoring-usage>) +`OTEL_LOG_TOOL_CONTENT`| Set to `1` to include tool content in the `tool.output` OpenTelemetry span event. Span attributes carry tool content under [their own gates](</docs/en/monitoring-usage#new-context-gates>). Requires [tracing](</docs/en/monitoring-usage#traces-beta>). Disabled by default to protect sensitive data. See [Monitoring](</docs/en/monitoring-usage#tool-output-span-event>) `OTEL_LOG_TOOL_DETAILS`| Set to `1` to include tool input arguments, MCP server names, user-authored workflow names, raw error strings on tool failures, the refusal `category` on `api_refusal` events, and other tool details in OpenTelemetry traces and logs. Disabled by default to protect PII. See [Monitoring](</docs/en/monitoring-usage>) `OTEL_LOG_USER_PROMPTS`| Set to `1` to include user prompt text in OpenTelemetry traces and logs. Disabled by default (prompts are redacted). See [Monitoring](</docs/en/monitoring-usage>) `OTEL_METRICS_INCLUDE_ACCOUNT_UUID`| Set to `false` to exclude account UUID from metrics attributes (default: included). See [Monitoring](</docs/en/monitoring-usage>) @@ -494,9 +494,10 @@ * [Message sessions beyond this machine](</docs/en/cross-session-messaging#message-sessions-on-other-machines>); messaging between sessions on this machine works with fetching off * Run [`claude import` or the `/import` command](</docs/en/cli-reference#cli-commands>) * Run [`/skill-doctor`](</docs/en/skills#find-unused-skills>) or open its report in the `/plugin` **Stats** tab + * Sync the [skills](</docs/en/skills#where-synced-skills-load>) and [plugins](</docs/en/plugins-reference#synced-plugins>) enabled for your claude.ai account into your terminal sessions * Use [the advisor tool](</docs/en/advisor#requirements>) * Read or reply to [comments on an artifact](</docs/en/artifacts#collect-comments-on-an-artifact>) - * Get the [v2 MCP client runtime](</docs/en/mcp#mcp-client-runtimes>) and its protocol probe without setting `MCP_SDK_GENERATION` and `MCP_PROTOCOL_NEGOTIATION`; Claude Code uses the v1 runtime unless you set `MCP_SDK_GENERATION=v2`, and skips the probe unless you set `MCP_PROTOCOL_NEGOTIATION=auto` + * Have Claude Code probe claude.ai connector servers for [MCP protocol revision 2026-07-28](</docs/en/mcp#mcp-client-runtimes>) unless you set `MCP_PROTOCOL_NEGOTIATION=auto` * Get the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) by default for claude.ai and Console accounts on Windows with Git Bash installed; Claude Code routes shell commands through Git Bash unless you set `CLAUDE_CODE_USE_POWERSHELL_TOOL=1`. On Windows without Git Bash, the tool stays on * Get [Claude-drafted feedback](</docs/en/tools-reference#sendfeedback-tool-behavior>), which Claude Code turns on through a fetched flag * Have Claude Code [exclude MCP tools whose input schema the API would reject](</docs/en/mcp#tools-with-invalid-input-schemas>); it sends the schema anyway, and a request that includes it fails with [a 400 error naming the tool by its position](</docs/en/errors#tool-input-schema-is-invalid>)
modified
--- a/env-vars.md +++ b/env-vars.md @@ -194,6 +194,7 @@ `CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the [auto-compact window](</docs/en/model-config#set-the-auto-compact-window>) in tokens, from `100000` to `1000000`. Accepts a plain integer such as `500000` only: a value like `500k` reads as `500` and clamps to the 100K minimum. The effective window is also capped at the model’s context window. Takes precedence over the `/autocompact` command, the `--autocompact` flag, and the `autoCompactWindow` setting. The status line’s `used_percentage` always measures against the model’s full context window, so once this variable is set, that percentage no longer indicates when compaction will run `CLAUDE_CODE_AUTO_CONNECT_IDE`| Override automatic [IDE connection](</docs/en/vs-code>). By default, Claude Code connects automatically when launched inside a supported IDE’s integrated terminal. Set to `false` to prevent this. Set to `true` to force a connection attempt when auto-detection fails, such as when tmux obscures the parent terminal. Takes precedence over the [`autoConnectIde`](</docs/en/settings-reference#autoconnectide>) global config setting `CLAUDE_CODE_AWS_CHAIN_RESOLVE_TIMEOUT_MS`| Time in milliseconds Claude Code waits for the AWS default credential provider chain to produce credentials before the request fails with [`AWS default-chain credential resolve timed out`](</docs/en/errors#aws-default-chain-credential-resolve-timed-out>) (default: `60000`). Raise it when a step in your chain legitimately needs longer, such as a browser-based SSO sign-in with MFA through a wrapper like `aws-vault`. Applies wherever Claude Code signs with the default chain: [Amazon Bedrock](</docs/en/amazon-bedrock#credential-caching-and-resolution-timeout>), [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), and the [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>). Requires Claude Code v2.1.207 or later +`CLAUDE_CODE_BASH_EDIT_DIFF`| Set to `0` to turn off the [diff of the files a Bash command changed](</docs/en/hooks#bash>), or `1` to record it in every permission mode. Takes precedence over the [`bashEditDiffEnabled`](</docs/en/settings-reference#basheditdiffenabled>) setting. Requires Claude Code v2.1.269 or later `CLAUDE_CODE_BRIDGE_SESSION_ID`| Set automatically in Bash tool and [hook command](</docs/en/hooks>) subprocesses while the session has an active [Remote Control](</docs/en/remote-control>) connection, and removed when the connection ends. The value is the session’s ID in `session_` form, the same identifier that appears in the session’s `claude.ai/code` URL, so a script can link back to the session that ran it. Requires Claude Code v2.1.199 or later. In [cloud sessions](</docs/en/claude-code-on-the-web>), read `CLAUDE_CODE_REMOTE_SESSION_ID` instead `CLAUDE_CODE_BS_AS_CTRL_BACKSPACE`| Set to `0` to make Claude Code read the `0x08` byte, also written `^H`, as plain Backspace, or `1` to read it as Ctrl+Backspace. Either value replaces the platform default. By default, Claude Code reads it as Ctrl+Backspace on Windows, except when `TERM_PROGRAM` is `mintty` or `TERM` is `cygwin`, and as plain Backspace on macOS and Linux. Set `0` in a Windows terminal where [Backspace deletes a whole word](</docs/en/terminal-config#fix-backspace-deleting-a-whole-word-on-windows>) `CLAUDE_CODE_CERT_STORE`| Comma-separated list of CA certificate sources for TLS connections. `bundled` is the Mozilla CA set shipped with Claude Code. `system` is the operating system trust store, read only on runtimes with `tls.getCACertificates`: the native binary, or Node 22.15 or later for npm installs. See [CA certificate store](</docs/en/network-config#ca-certificate-store>). Default is `bundled,system` @@ -327,7 +328,7 @@ `CLAUDE_CODE_SCRIPT_CAPS`| JSON object limiting how many times specific scripts may be invoked per session when `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB` is set. Keys are substrings matched against the command text; values are integer call limits. For example, `{"deploy.sh": 2}` allows `deploy.sh` to be called at most twice. Matching is substring-based so shell-expansion tricks like `./scripts/deploy.sh $(evil)` still count against the cap. Runtime fan-out via `xargs` or `find -exec` is not detected; this is a defense-in-depth control `CLAUDE_CODE_SCROLL_SPEED`| Set the mouse wheel scroll multiplier in [fullscreen rendering](</docs/en/fullscreen#mouse-wheel-scrolling>). Accepts any positive value up to 20, including fractional values below 1 such as `0.5` to slow accelerated trackpad and wheel scrolling in terminals that already amplify wheel events. Set to `3` to match `vim` if your terminal sends one wheel event per notch without amplification. Ignored in the JetBrains IDE terminal, where Claude Code uses its own scroll handling `CLAUDE_CODE_SEND_FEEDBACK`| Set to `0` to turn off [Claude-drafted feedback](</docs/en/tools-reference#sendfeedback-tool-behavior>) for a session. Set to `1` to turn it on where your account already has access; the variable can’t grant access itself, and the other switches that turn feedback off, such as `DISABLE_FEEDBACK_COMMAND` and the [`feedbackDrafts`](</docs/en/settings-reference#feedbackdrafts>) setting’s `off` value, still apply -`CLAUDE_CODE_SESSIONEND_HOOKS_TIMEOUT_MS`| Override the time budget in milliseconds for [SessionEnd](</docs/en/hooks#sessionend>) hooks. Applies to session exit, `/clear`, and switching sessions via interactive `/resume`. By default the budget is 1.5 seconds, automatically raised to the highest per-hook `timeout` configured in settings files, up to 60 seconds. Timeouts on plugin-provided hooks do not raise the budget +`CLAUDE_CODE_SESSIONEND_HOOKS_TIMEOUT_MS`| Override the time budget in milliseconds for [SessionEnd](</docs/en/hooks#sessionend>) hooks. The value is also the timeout for each hook that sets no `timeout` of its own. Applies to session exit, `/clear`, and switching sessions via interactive `/resume`. By default the budget is 1.5 seconds, automatically raised to the highest per-hook `timeout` configured in settings files, up to 60 seconds. Timeouts on plugin-provided hooks do not raise the budget `CLAUDE_CODE_SESSION_ID`| Set automatically to the current session ID in Bash and PowerShell tool subprocesses, [hook command](</docs/en/hooks>) subprocesses, and stdio [MCP server](</docs/en/mcp>) subprocesses. For Bash, PowerShell, and hooks this matches the `session_id` field in the hook JSON input and is updated on `/clear`. An MCP server subprocess retains the ID it was spawned with. On `--resume <session-id>` it receives the resumed ID, matching hooks and Bash. On `--continue` or `--resume` without an explicit ID it may receive the initial startup ID instead. Use to correlate scripts and external tools with the Claude Code session that launched them `CLAUDE_CODE_SHELL`| Set the shell Claude Code uses to run Bash tool commands. Accepts a path to a `bash` or `zsh` binary, for example `/opt/homebrew/bin/bash`. Other shells such as `fish` are not supported. If the value is not a working `bash` or `zsh` path, Claude Code ignores it and falls back to auto-detection. Auto-detection uses your `$SHELL` when it points to `bash` or `zsh`, otherwise it picks the first working `zsh` then `bash` found on your `PATH` and standard install locations `CLAUDE_CODE_SHELL_PREFIX`| Command prefix that wraps shell commands Claude Code spawns: Bash tool calls, [hook](</docs/en/hooks>) commands, [status line](</docs/en/statusline>) commands, and stdio [MCP server](</docs/en/mcp>) startup commands. PowerShell hooks and exec-form hooks run without the prefix. Useful for logging or auditing. Setting a bare executable path such as `/path/to/logger.sh` runs each command as `/path/to/logger.sh '<command>'`. The wrapper receives the command line as a single shell-quoted argument in `$1`, so the wrapper must re-evaluate `$1` with a shell, for example `exec bash -c "$1"`. Treating `$1` as a bare executable path breaks stdio MCP servers that pass arguments such as `npx -y <package>`. For Bash tool calls, `$1` contains the full shell invocation Claude Code assembles, including environment setup, not only the command Claude ran @@ -346,10 +347,10 @@ `CLAUDE_CODE_SUBAGENT_MODEL`| The default model for [subagents](</docs/en/sub-agents#choose-a-model>), [agent team](</docs/en/agent-teams#specify-teammates-and-models>) teammates, and [workflow](</docs/en/workflows>) agents that aren’t assigned a model another way. Accepts an alias such as `haiku` or a full model name. Two sources take precedence over it: a model Claude passes when it spawns the agent, and a `model` field in the agent’s definition, including `inherit`. To change that, set [`CLAUDE_CODE_SUBAGENT_MODEL_FORCE`](</docs/en/sub-agents#run-every-subagent-on-one-model>). See [Choose a model](</docs/en/sub-agents#choose-a-model>) for the full order. Setting it to `inherit` is the same as leaving it unset. Before v2.1.251, this variable overrode both the per-invocation model and the definition’s `model` field `CLAUDE_CODE_SUBAGENT_MODEL_FORCE`| Set to `1` to force one model onto subagents, teammates, and workflow agents. [Run every subagent on one model](</docs/en/sub-agents#run-every-subagent-on-one-model>) says which model that is. Requires Claude Code v2.1.257 or later `CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL`| Set `5m` or `1h`, the only values Claude Code accepts, to choose the [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) for requests outside the main conversation, such as [subagents](</docs/en/sub-agents>), workflows, and background work. Takes precedence over the `subagentPromptCacheTtl` setting and over `ENABLE_PROMPT_CACHING_1H`, and `FORCE_PROMPT_CACHING_5M` overrides it. The API bills 1-hour cache writes at a higher rate. Requires Claude Code v2.1.242 or later -`CLAUDE_CODE_SUBPROCESS_ENV_SCRUB`| Set to `1` to strip credentials from subprocess environments (Bash tool, hooks, MCP stdio servers): Anthropic and cloud provider credentials, any other variable that Claude Code recognizes as a credential, and credentials embedded in package registry URLs. The parent Claude process keeps these credentials for API calls, but child processes cannot read them, reducing exposure to prompt injection attacks that attempt to exfiltrate secrets via shell expansion. On Linux, this also runs Bash subprocesses in an isolated PID namespace so they cannot read host process environments via `/proc`; as a side effect, `ps`, `pgrep`, and `kill` cannot see or signal host processes. `claude-code-action` sets this automatically when `allowed_non_write_users` is configured +`CLAUDE_CODE_SUBPROCESS_ENV_SCRUB`| Set to `1` to strip credentials from subprocess environments (Bash tool, hooks, MCP stdio servers): Anthropic and cloud provider credentials, any other variable that Claude Code recognizes as a credential, and credentials embedded in package registry URLs. The parent Claude process keeps these credentials for API calls, but child processes cannot read them, reducing exposure to prompt injection attacks that attempt to exfiltrate secrets via shell expansion. On v2.1.251 or later, the scrub also removes Claude Code’s own configuration-store pointer variables (such as `CLAUDE_CONFIG_DIR`), so a child process cannot locate a relocated configuration directory. Leave the scrub unset if a subprocess needs these variables. On Linux, this also runs Bash subprocesses in an isolated PID namespace so they cannot read host process environments via `/proc`; as a side effect, `ps`, `pgrep`, and `kill` cannot see or signal host processes. `claude-code-action` sets this automatically when `allowed_non_write_users` is configured `CLAUDE_CODE_SYNC_PLUGIN_INSTALL`| Set to `1` in non-interactive mode (the `-p` flag) to wait for plugin installation to complete before the first query. Without this, plugins install in the background and may not be available on the first turn. Combine with `CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS` to bound the wait `CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS`| Timeout in milliseconds for synchronous plugin installation. When exceeded, Claude Code proceeds without plugins and logs an error. No default: without this variable, synchronous installation waits until complete -`CLAUDE_CODE_SYNC_SKILLS`| Set to `1` to download your enabled claude.ai skills into `~/.claude/skills/synced/` and resync every 10 minutes. Before it runs the first query, Claude Code waits up to `CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS` for the list of your skills. The downloads themselves finish in the background, and Claude waits for a skill’s download when it invokes that skill. The `synced` folder name is [reserved for this download](</docs/en/skills#where-skills-live>). Before v2.1.227, the skills downloaded into `~/.claude/skills/` directly. Applies only in non-interactive mode with the `-p` flag. Requires claude.ai authentication. [Claude Code on the web](</docs/en/claude-code-on-the-web>) sessions receive your enabled claude.ai skills automatically; you don’t need to set this there. Claude Code applies [extra rules to the downloaded skills](</docs/en/skills#how-synced-skills-behave>), such as not running their `!` commands on your machine +`CLAUDE_CODE_SYNC_SKILLS`| Set to `1` to download your enabled claude.ai skills into `~/.claude/skills/synced/` and resync every 10 minutes. Before it runs the first query, Claude Code waits up to `CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS` for the list of your skills. The downloads themselves finish in the background, and Claude waits for a skill’s download when it invokes that skill. The `synced` folder name is [reserved for this download](</docs/en/skills#where-skills-live>). Before v2.1.227, the skills downloaded into `~/.claude/skills/` directly. Applies only in non-interactive mode with the `-p` flag. Requires claude.ai authentication. [Cloud sessions](</docs/en/claude-code-on-the-web>) receive your enabled claude.ai skills automatically; you don’t need to set this there. Claude Code applies [extra rules to the downloaded skills](</docs/en/skills#how-synced-skills-behave>), such as not running their `!` commands on your machine `CLAUDE_CODE_SYNC_SKILLS_INSTALL_TIMEOUT_MS`| Timeout in milliseconds for a mid-session skills resync when `CLAUDE_CODE_SYNC_SKILLS` is set (default: 30000). Bounds the download triggered when the host requests a skill reload during the session. When exceeded, the resync stops and remaining downloads continue in the background `CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS`| Timeout in milliseconds for the first query to wait for the initial skill list when `CLAUDE_CODE_SYNC_SKILLS` is set (default: 5000). When exceeded, the first query runs with whichever skills have arrived. The downloads finish in the background either way, and Claude waits for a skill’s download when it invokes that skill `CLAUDE_CODE_SYNTAX_HIGHLIGHT`| Set to `false` to disable syntax highlighting in diff output. Useful when colors interfere with your terminal setup. To also disable highlighting in code blocks and file previews, use the [`syntaxHighlightingDisabled`](</docs/en/settings-reference#syntaxhighlightingdisabled>) setting
modified
--- a/env-vars.md +++ b/env-vars.md @@ -322,7 +322,7 @@ `CLAUDE_CODE_RESUME_INTERRUPTED_TURN`| Set to `1` to automatically resume if the previous session ended mid-turn. Used in SDK mode so the model continues without requiring the SDK to re-send the prompt. To turn this off, unset the variable or set it to `0`. Before v2.1.221, Claude Code ignored `0` and other falsy values, so setting `0` still triggered the resume in non-interactive mode and unsetting the variable was the only way to turn it off `CLAUDE_CODE_RESUME_INTERRUPTED_TURN_MAX_AGE_MS`| Maximum age in milliseconds of the last transcript message for a session that ended mid-turn to continue automatically on resume. When the last message is older than this bound, Claude Code skips both the `CLAUDE_CODE_RESUME_INTERRUPTED_TURN` automatic resume and the injected `CLAUDE_CODE_RESUME_PROMPT` continuation message, and the session starts idle so you continue explicitly. Unset or `0` means no bound; a negative or non-numeric value applies a one-hour bound. Spawn scripts for long-running agents can set this so a restart against an old transcript doesn’t re-run a stale prompt. Claude Code sets a one-hour bound itself when it restarts a crashed [agent view](</docs/en/agent-view>) session that inherited its conversation from an interactive session. Requires Claude Code v2.1.211 or later `CLAUDE_CODE_RESUME_PROMPT`| Override the continuation message injected when resuming a session that ended mid-turn. Defaults to `Continue from where you left off.`. Spawn scripts for long-running agents can set this to a more directive boot message. An empty string uses the default -`CLAUDE_CODE_RETRY_WATCHDOG`| Set to `1` for unattended sessions such as eval harnesses, CI jobs, or remote workers. Retries `429` and `529` capacity errors indefinitely instead of failing after `CLAUDE_CODE_MAX_RETRIES` attempts. Claude Code fails at once on a `429` that reports a spend limit or exhausted usage credits, even one from a [gateway spend cap](</docs/en/errors#spend-limit-reached>) that resets on a schedule. Before v2.1.239, the watchdog retried these indefinitely. The watchdog backs off up to 5 minutes between attempts, or until the limit resets when the response carries a rate-limit reset time, so a session that hits a usage limit waits out the remaining window. On v2.1.199 or later it also raises the default retry count for other transient errors, such as server errors, timeouts, and dropped connections, to 300, roughly three hours of backoff, and removes the cap of 15 on `CLAUDE_CODE_MAX_RETRIES` if you set that variable explicitly. Requires Claude Code v2.1.186 or later +`CLAUDE_CODE_RETRY_WATCHDOG`| Set to `1` for unattended sessions such as eval harnesses, CI jobs, or remote workers. Retries `429` and `529` capacity errors indefinitely instead of failing after `CLAUDE_CODE_MAX_RETRIES` attempts. Claude Code fails at once when a standard-speed request gets a `429` that reports a spend limit or exhausted usage credits, even one from a [gateway spend cap](</docs/en/errors#spend-limit-reached>) that resets on a schedule. Before v2.1.239, the watchdog retried these indefinitely. For fast mode requests, see [Handle rate limits](</docs/en/fast-mode#handle-rate-limits>). The watchdog backs off up to 5 minutes between attempts, or until the limit resets when the response carries a rate-limit reset time, so a session that hits a usage limit waits out the remaining window. On v2.1.199 or later it also raises the default retry count for other transient errors, such as server errors, timeouts, and dropped connections, to 300, roughly three hours of backoff, and removes the cap of 15 on `CLAUDE_CODE_MAX_RETRIES` if you set that variable explicitly. Requires Claude Code v2.1.186 or later `CLAUDE_CODE_SAFE_MODE`| Set to `1` to start in safe mode: CLAUDE.md, skills, plugins, hooks, MCP servers, custom commands and agents, output styles, workflows, custom themes, custom keybindings, status line and file-suggestion commands, LSP servers, and auto memory do not load, for troubleshooting a broken configuration. Managed settings policy still applies, including policy-configured hooks, status line, and file-suggestion commands; managed plugins, managed skills, managed CLAUDE.md, and policy-configured MCP servers do not. Equivalent to passing [`--safe-mode`](</docs/en/cli-reference#cli-flags>). Directly spawned child processes inherit the variable `CLAUDE_CODE_SCRIPT_CAPS`| JSON object limiting how many times specific scripts may be invoked per session when `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB` is set. Keys are substrings matched against the command text; values are integer call limits. For example, `{"deploy.sh": 2}` allows `deploy.sh` to be called at most twice. Matching is substring-based so shell-expansion tricks like `./scripts/deploy.sh $(evil)` still count against the cap. Runtime fan-out via `xargs` or `find -exec` is not detected; this is a defense-in-depth control `CLAUDE_CODE_SCROLL_SPEED`| Set the mouse wheel scroll multiplier in [fullscreen rendering](</docs/en/fullscreen#mouse-wheel-scrolling>). Accepts any positive value up to 20, including fractional values below 1 such as `0.5` to slow accelerated trackpad and wheel scrolling in terminals that already amplify wheel events. Set to `3` to match `vim` if your terminal sends one wheel event per notch without amplification. Ignored in the JetBrains IDE terminal, where Claude Code uses its own scroll handling
modified
--- a/env-vars.md +++ b/env-vars.md @@ -166,7 +166,7 @@ `BASH_MAX_OUTPUT_LENGTH`| Maximum number of characters of bash output that Claude Code reads back into a command’s result (default: 30000; maximum: 150000). If you set the [`bashOutputMaxChars`](</docs/en/settings-reference#bashoutputmaxchars>) setting, Claude Code ignores this variable. See [Output limits](</docs/en/tools-reference#output-limits>) `BASH_MAX_TIMEOUT_MS`| Maximum timeout the model can set for long-running bash commands (default: 600000, or 10 minutes). The effective ceiling is the larger of this and `BASH_DEFAULT_TIMEOUT_MS` `BETA_TRACING_ENDPOINT`| OTLP endpoint for [detailed beta tracing](</docs/en/monitoring-usage#traces-beta>): with `ENABLE_BETA_TRACING_DETAILED=1`, logs and traces go there instead of to the configured exporters. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) -`CCR_FORCE_BUNDLE`| Set to `1` to force [`claude --cloud`](</docs/en/claude-code-on-the-web#send-local-repositories-without-github>) to bundle and upload your local repository even when GitHub access is available +`CCR_FORCE_BUNDLE`| Set to `1` to force [`claude --cloud`](</docs/en/claude-code-on-the-web#send-local-repositories-without-github>) to bundle and upload your local repository instead of cloning from its remote `CLAUDECODE`| Set to `1` in subprocesses Claude Code spawns (Bash and PowerShell tools, tmux sessions, [hook](</docs/en/hooks>) commands, [status line](</docs/en/statusline>) commands, stdio [MCP server](</docs/en/mcp>) subprocesses). IDE extensions also set this in their integrated terminals. Use to detect when a script is running inside a subprocess spawned by Claude Code. To check whether the current process was spawned directly by a tool call or hook, rather than inside a stdio MCP server that Claude Code started, use `CLAUDE_CODE_CHILD_SESSION` instead `CLAUDE_AFK_COUNTDOWN_MS`| How many milliseconds before auto-continue the on-screen countdown appears on an unanswered [`AskUserQuestion`](</docs/en/tools-reference>) dialog. Default `20000` (20 seconds), capped at the auto-continue timeout. Has no effect unless auto-continue is on; see the [`askUserQuestionTimeout`](</docs/en/settings-reference#askuserquestiontimeout>) setting and `CLAUDE_AFK_TIMEOUT_MS`. Requires Claude Code v2.1.198 or later `CLAUDE_AFK_TIMEOUT_MS`| How many milliseconds of idle time before an unanswered [`AskUserQuestion`](</docs/en/tools-reference>) dialog auto-continues without you. Auto-continue is off by default; opt in with the [`askUserQuestionTimeout`](</docs/en/settings-reference#askuserquestiontimeout>) setting. This variable is an override for demos and automated tests: when set, it takes precedence over that setting and turns auto-continue on even when the setting is unset or `never`. Setting `0` doesn’t turn the timeout off; it closes the dialog immediately. In v2.1.198 and v2.1.199, auto-continue was on by default with a `60000` (60 seconds) timeout. Requires Claude Code v2.1.198 or later @@ -445,6 +445,7 @@ `OTEL_LOG_USER_PROMPTS`| Set to `1` to include user prompt text in OpenTelemetry traces and logs. Disabled by default (prompts are redacted). See [Monitoring](</docs/en/monitoring-usage>) `OTEL_METRICS_INCLUDE_ACCOUNT_UUID`| Set to `false` to exclude account UUID from metrics attributes (default: included). See [Monitoring](</docs/en/monitoring-usage>) `OTEL_METRICS_INCLUDE_ENTRYPOINT`| Set to `true` to include the session entrypoint in metrics attributes (default: excluded). Added in v2.1.152. See [Monitoring](</docs/en/monitoring-usage>) +`OTEL_METRICS_INCLUDE_REPOSITORY`| Set to `true` to tag OpenTelemetry metrics and events with `vcs.*` attributes identifying the session’s repository (default: excluded). Requires Claude Code v2.1.269 or later. See [Repository attributes](</docs/en/monitoring-usage#repository-attributes>) `OTEL_METRICS_INCLUDE_RESOURCE_ATTRIBUTES`| As of v2.1.161, Claude Code attaches `OTEL_RESOURCE_ATTRIBUTES` keys to metric datapoint labels. Set to `false` to exclude them (default: included). See [Monitoring](</docs/en/monitoring-usage#multi-team-organization-support>) `OTEL_METRICS_INCLUDE_SESSION_ID`| Set to `false` to exclude session ID from metrics attributes (default: included). See [Monitoring](</docs/en/monitoring-usage>) `OTEL_METRICS_INCLUDE_VERSION`| Set to `true` to include Claude Code version in metrics attributes (default: excluded). See [Monitoring](</docs/en/monitoring-usage>)
modified
--- a/env-vars.md +++ b/env-vars.md @@ -255,7 +255,7 @@ `CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION`| Set to `false` to turn off prompt suggestions, the grayed-out predictions that appear in your prompt input. Takes precedence over the [`promptSuggestionEnabled`](</docs/en/settings-reference#promptsuggestionenabled>) setting, which is what the **Prompt suggestions** toggle in `/config` writes. Claude Code also [pauses suggestions while your account is close to or at its usage limit](</docs/en/interactive-mode#when-claude-code-skips-suggestions>). Set to `true` to keep them on until you reach the limit. Requires Claude Code v2.1.238 or later. See [Prompt suggestions](</docs/en/interactive-mode#prompt-suggestions>) `CLAUDE_CODE_ENABLE_TASKS`| Selects which task-tracking tools Claude Code provides in [sessions that have them](</docs/en/tools-reference#task-tool-availability>). By default, Claude Code provides the Task tools `TaskCreate`, `TaskUpdate`, `TaskGet`, and `TaskList`. Set to `0` to get the legacy `TodoWrite` tool instead. See [Task list](</docs/en/interactive-mode#task-list>) `CLAUDE_CODE_ENABLE_TELEMETRY`| Set to `1` to enable OpenTelemetry data collection for metrics and logging. Required before configuring OTel exporters. See [Monitoring](</docs/en/monitoring-usage>) -`CLAUDE_CODE_ENABLE_TODO_TOOLS`| Set to `1` to get the task-tracking tools on the models listed under [Task tool availability](</docs/en/tools-reference#task-tool-availability>), where Claude Code otherwise leaves them out. `CLAUDE_CODE_ENABLE_TASKS` still selects the Task tools or `TodoWrite`. Requires Claude Code v2.1.233 or later +`CLAUDE_CODE_ENABLE_TODO_TOOLS`| Set to `1` to get the task-tracking tools on every model. Without it, Claude Code provides them by default only on the models listed under [Task tool availability](</docs/en/tools-reference#task-tool-availability>). `CLAUDE_CODE_ENABLE_TASKS` still selects the Task tools or `TodoWrite`. Requires Claude Code v2.1.233 or later `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 `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS`| Set to `1` to enable [agent teams](</docs/en/agent-teams>). Agent teams are experimental and disabled by default `CLAUDE_CODE_EXTRA_BODY`| JSON object to merge into the top level of every API request body. Useful for passing provider-specific parameters that Claude Code doesn’t expose directly. A value exported in your shell also applies to the [background sessions](</docs/en/agent-view>) you dispatch with `claude agents` or `--bg`. Before v2.1.206, background sessions ignored a shell-exported value and used whatever copy the background supervisor process inherited @@ -368,6 +368,7 @@ `CLAUDE_CODE_USE_POWERSHELL_TOOL`| Controls the PowerShell tool. On Windows without Git Bash, the tool is enabled automatically; set to `0` to disable it. On Windows with Git Bash installed, the tool is on by default for claude.ai and Console accounts; set to `1` to enable it in Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry sessions, or `0` to turn it off. On Linux, macOS, and WSL, set to `1` to enable it, which requires `pwsh` on your `PATH`. When enabled on Windows, Claude can run PowerShell commands natively instead of routing through Git Bash. See [PowerShell tool](</docs/en/tools-reference#powershell-tool>) `CLAUDE_CODE_USE_VERTEX`| Use [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>) `CLAUDE_CODE_WEBFETCH_CACHE_TTL_MS`| Set to the number of milliseconds [WebFetch](</docs/en/tools-reference#webfetch-tool-behavior>) keeps each fetched URL’s response cached. The default is `900000`, which is 15 minutes. Takes plain digits only; `0`, a decimal, or any other spelling keeps the default. Claude Code reads the value once per launch, so a change in a settings `env` block applies when you next launch `claude`. Requires Claude Code v2.1.233 or later +`CLAUDE_CODE_WEBFETCH_DEADLINE_MS`| Upper bound in milliseconds on how long [WebFetch](</docs/en/tools-reference#webfetch-tool-behavior>) waits for a page to download, including any redirects it follows. A download that hasn’t completed by then fails with a deadline error. The default is `300000`, which is five minutes. Set to `0` to remove the limit. Takes plain digits only; a decimal or any other spelling keeps the default. Requires Claude Code v2.1.268 or later `CLAUDE_CODE_WORKFLOW_PREFIX_STAGGER_MS`| Upper bound in milliseconds on how long a [workflow](</docs/en/workflows>) agent waits for a same-prefix sibling’s first response to begin before sending its own first request. When a fan-out starts several agents that share a [prompt-cache prefix](</docs/en/workflows#prompt-caching-in-a-fan-out>), Claude Code holds all but the first agent for up to this long so the rest read the cached prefix instead of each processing it uncached. Default `5000`. Set to `0` to disable the wait. When `DISABLE_PROMPT_CACHING` is set, agents never wait. Requires Claude Code v2.1.229 or later `CLAUDE_CONFIG_DIR`| Override the configuration directory (default: `~/.claude`). All settings, session history, and plugins are stored under this path. For credentials, see [where Claude Code stores credentials](</docs/en/authentication#credential-management>). Useful for running multiple accounts side by side: for example, `alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'`. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) `CLAUDE_DISABLE_ADOPT`| Set to `1` to stop in-flight background work instead of carrying it over when you background a session by pressing `←` or with [`/background`](</docs/en/agent-view#from-inside-a-session>). Claude Code asks you to confirm before backgrounding, then stops the tasks that would otherwise carry over. Requires Claude Code v2.1.195 or later @@ -497,7 +498,6 @@ * Get the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) by default for claude.ai and Console accounts on Windows with Git Bash installed; Claude Code routes shell commands through Git Bash unless you set `CLAUDE_CODE_USE_POWERSHELL_TOOL=1`. On Windows without Git Bash, the tool stays on * Get [Claude-drafted feedback](</docs/en/tools-reference#sendfeedback-tool-behavior>), which Claude Code turns on through a fetched flag * Have Claude Code [exclude MCP tools whose input schema the API would reject](</docs/en/mcp#tools-with-invalid-input-schemas>); it sends the schema anyway, and a request that includes it fails with [a 400 error naming the tool by its position](</docs/en/errors#tool-input-schema-is-invalid>) - * Have a resumed conversation [keep its recorded system prompt](</docs/en/cli-reference#system-prompt-flags-in-resumed-conversations>); Claude Code rebuilds the prompt on every request and `--system-prompt-snapshot` has no effect ###
modified
Show diff (103 lines)
--- a/env-vars.md +++ b/env-vars.md @@ -157,7 +157,7 @@ `ANTHROPIC_SMALL_FAST_MODEL`| [DEPRECATED] Name of [Haiku-class model for background tasks](</docs/en/costs>) `ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION`| Override AWS region for the Haiku-class model when using Amazon Bedrock or Amazon Bedrock Mantle. On Amazon Bedrock, this only takes effect when `ANTHROPIC_DEFAULT_HAIKU_MODEL` or the deprecated `ANTHROPIC_SMALL_FAST_MODEL` is also set, since Amazon Bedrock otherwise runs background tasks on the [default Sonnet model or the primary model](</docs/en/amazon-bedrock#4-pin-model-versions>) in the session region `ANTHROPIC_VERTEX_BASE_URL`| Override Google Cloud’s Agent Platform endpoint URL. Use for custom Google Cloud’s Agent Platform endpoints or when routing through an [LLM gateway](</docs/en/llm-gateway>). See [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>) -`ANTHROPIC_VERTEX_PROJECT_ID`| GCP project ID for Google Cloud’s Agent Platform requests. Overridden by `GCLOUD_PROJECT`, `GOOGLE_CLOUD_PROJECT`, or the project in your `GOOGLE_APPLICATION_CREDENTIALS` credential file. See [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>) +`ANTHROPIC_VERTEX_PROJECT_ID`| GCP project ID that Google Cloud’s Agent Platform requests are addressed to. See [Configure GCP credentials](</docs/en/google-vertex-ai#3-configure-gcp-credentials>) `ANTHROPIC_WORKSPACE_ID`| Workspace ID for [workload identity federation](<https://platform.claude.com/docs/en/manage-claude/workload-identity-federation>). Set this when your federation rule is scoped to more than one workspace so the token exchange knows which workspace to target `API_FORCE_IDLE_TIMEOUT`| Override the 5-minute body idle timeout that aborts a streaming model response when no bytes arrive. Set to `0` to turn the timeout off, for example when a slow [gateway](</docs/en/llm-gateway>) or local model pauses longer than 5 minutes between chunks, or `1` to keep it on for every provider. When unset, the timeout is active on providers other than the direct Anthropic API and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>). The [stream watchdogs](</docs/en/network-config#streaming-idle-watchdogs>) run independently of it and abort a long silent pause even when you set `0` here `API_TIMEOUT_MS`| Timeout for API requests in milliseconds (default: 600000, or 10 minutes; maximum: 2147483647). Increase this when requests time out on slow networks or when routing through a proxy. Values above the maximum overflow the underlying timer and cause requests to fail immediately @@ -186,7 +186,7 @@ `CLAUDE_CODE_ALT_SCREEN_FULL_REPAINT`| Set to `1` to repaint the entire screen on every frame in [fullscreen rendering](</docs/en/fullscreen>) instead of sending incremental updates. Use this if fullscreen mode shows stale or misplaced text fragments. Claude Code enables this automatically for background sessions and [agent view](</docs/en/agent-view>) on Windows `CLAUDE_CODE_ALWAYS_ENABLE_EFFORT`| Set to `1` to send the [effort](</docs/en/model-config#adjust-effort-level>) parameter with every request, even when Claude Code does not recognize the model ID as effort-capable. Use this when routing through an [LLM gateway](</docs/en/llm-gateway>) or third-party provider that serves models under custom identifiers. Models that reject the effort parameter at the API, including Claude 3 models, Sonnet 4.0 and 4.5, Opus 4.0 and 4.1, and Haiku 4.5, are still excluded so requests do not fail `CLAUDE_CODE_API_KEY_HELPER_TTL_MS`| Interval in milliseconds at which credentials should be refreshed (when using [`apiKeyHelper`](</docs/en/settings-reference#apikeyhelper>)) -`CLAUDE_CODE_ARTIFACT_AUTO_OPEN`| Set to `0` to stop Claude Code from opening the browser automatically when a new [artifact](</docs/en/artifacts>) is published. Republishing an existing artifact does not open the browser regardless of this setting +`CLAUDE_CODE_ARTIFACT_AUTO_OPEN`| Set to `0` to stop Claude Code from opening the browser automatically when a new [artifact](</docs/en/artifacts#create-an-artifact>) is published `CLAUDE_CODE_ARTIFACT_COMMENTS`| Set to `0` to stop Claude reading and replying to [comments on an artifact](</docs/en/artifacts#collect-comments-on-an-artifact>). Has no effect when `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` has [turned artifacts off](</docs/en/artifacts#availability>). Requires Claude Code v2.1.221 or later `CLAUDE_CODE_ARTIFACT_COMMENTS_AUTOREACT`| Set to `0` to stop Claude [replying on its own to comments sent to it](</docs/en/artifacts#let-claude-reply-to-comments-on-its-own>). Requires Claude Code v2.1.228 or later `CLAUDE_CODE_ATTRIBUTION_HEADER`| Set to `0` to omit the [attribution block](</docs/en/llm-gateway-protocol#system-prompt-attribution-block>), which carries the client version and a prompt fingerprint, from the start of the system prompt. Caching on a direct connection to the Anthropic API is unaffected either way. In some direct-connection setups, Claude Code keeps the block on [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) classifier requests even when you set `0`. In [System prompt attribution block](</docs/en/llm-gateway-protocol#system-prompt-attribution-block>), check which connections and credentials this covers. Before v2.1.181 the block included a per-request token on custom base URLs and Microsoft Foundry connections, so on those versions set it to `0` when your LLM gateway caches on the request body or forwards requests to a third-party provider, or when you connect to Microsoft Foundry directly @@ -239,11 +239,11 @@ `CLAUDE_CODE_DISABLE_PERMISSION_PROMPT_NOTIFY_HOOKS`| Set to `1` to stop Claude Code from running your [`Notification` hooks for unanswered permission requests](</docs/en/hooks#notification>) in sessions where Claude Code sends them to the Agent SDK’s `canUseTool` callback, which is how Claude Desktop and the VS Code extension host Claude Code. Has no effect in terminal sessions. Requires Claude Code v2.1.233 or later `CLAUDE_CODE_DISABLE_POLICY_SKILLS`| Set to `1` to skip loading skills from the system-wide managed skills directory. Useful for container or CI sessions that should not load operator-provisioned skills `CLAUDE_CODE_DISABLE_TERMINAL_TITLE`| Set to `1` to disable automatic terminal title updates based on conversation context. In Agent SDK and `claude -p` sessions, this also skips the background small/fast-model request that generates the session title -`CLAUDE_CODE_DISABLE_THINKING`| Set to `1` to omit the `thinking` parameter from API requests entirely. This is a compatibility option for proxies and gateways that reject the parameter. The variable’s behavior is unchanged from earlier versions; on models that think by default, omitting the parameter means the model may still think. To explicitly disable [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) on the Anthropic API, use `MAX_THINKING_TOKENS=0` instead, which is also ineffective on [Fable models](</docs/en/model-config#extended-thinking>) since they can’t have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `0` likewise omits the parameter, so the two variables behave the same there +`CLAUDE_CODE_DISABLE_THINKING`| Set to `1` to omit the `thinking` parameter from API requests entirely. This is a compatibility option for proxies and gateways that reject the parameter. On models that think by default, omitting the parameter means the model may still think. To explicitly disable [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) on the Anthropic API, use `MAX_THINKING_TOKENS=0` instead. Neither variable turns thinking off on Fable models, which can’t have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `MAX_THINKING_TOKENS=0` likewise omits the parameter, so the two variables behave the same there `CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT`| Set to `1` to skip proactive [auto-compaction](</docs/en/costs#reduce-token-usage>) when Claude Code doesn’t recognize the model ID, such as an [LLM gateway](</docs/en/llm-gateway>) alias. Without this variable, Claude Code compacts at the context window it assumes for the ID. `CLAUDE_CODE_MAX_CONTEXT_TOKENS` can correct the assumed window instead; see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>) for when each variable applies. Requires Claude Code v2.1.223 or later `CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL`| Set to `1` to disable virtual scrolling in [fullscreen rendering](</docs/en/fullscreen>) and render every message in the transcript. Use this if scrolling in fullscreen mode shows blank regions where messages should appear `CLAUDE_CODE_DISABLE_WORKFLOWS`| Set to `1` to disable [workflows](</docs/en/workflows#turn-workflows-off>). Equivalent to the [`disableWorkflows`](</docs/en/settings-reference#disableworkflows>) setting -`CLAUDE_CODE_EFFORT_LEVEL`| Set the effort level for supported models. Values: `low`, `medium`, `high`, `xhigh`, `max`, or `auto` to use the model default. Available levels depend on the model. Takes precedence over `--effort`, `/effort`, and the `modelSettings` and `effortLevel` settings. See [Adjust effort level](</docs/en/model-config#adjust-effort-level>) +`CLAUDE_CODE_EFFORT_LEVEL`| Set the effort level for supported models. Values: `low`, `medium`, `high`, `xhigh`, `max`, or `auto` to use the model default. Available levels depend on the model. Takes precedence over `--effort`, `/effort`, and the `modelSettings` and `effortLevel` settings. A [`maxEffortLevel`](</docs/en/settings-reference#maxeffortlevel>) cap still applies. See [Adjust effort level](</docs/en/model-config#adjust-effort-level>) `CLAUDE_CODE_ENABLE_APPEND_SUBAGENT_PROMPT`| Set to `1` to enable appending extra text to the end of the system prompt of every [subagent](</docs/en/sub-agents>) other than a [forked subagent](</docs/en/sub-agents#fork-the-current-conversation>). The [`--append-subagent-system-prompt`](</docs/en/cli-reference#cli-flags>) and [`--append-subagent-system-prompt-file`](</docs/en/cli-reference#cli-flags>) flags supply the appended text and set this variable automatically, so you don’t need to set it yourself. Requires Claude Code v2.1.205 or later `CLAUDE_CODE_ENABLE_AUTO_MODE`| Accepted for compatibility with older releases and has no effect. Auto mode is available by default on every provider, including Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and signed-in [Claude apps gateway](</docs/en/claude-apps-gateway>) sessions. In v2.1.158 through v2.1.206, setting this to `1` was required to make [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) available on those providers `CLAUDE_CODE_ENABLE_AWAY_SUMMARY`| Override [session recap](</docs/en/interactive-mode#session-recap>) availability. Set to `0` to force recaps off regardless of the `/config` toggle. Set to `1` to force recaps on when [`awaySummaryEnabled`](</docs/en/settings-reference#awaysummaryenabled>) is `false`. Takes precedence over the setting and `/config` toggle @@ -290,6 +290,7 @@ `CLAUDE_CODE_MESSAGING_TOKEN`| Set by Claude Code, not by you: in sessions that bind an [inbox socket](</docs/en/cross-session-messaging#the-sessions-inbox-socket>), Claude Code exports this per-session token to hooks and Bash commands alongside `CLAUDE_CODE_MESSAGING_SOCKET`. A script posting to the socket can send `{"type":"auth","token":"<token>"}` as its first line to prove it belongs to the session. On native Windows, Claude Code requires this line and closes any connection that doesn’t open with a valid one. The [own-child rules](</docs/en/cross-session-messaging#the-sessions-inbox-socket>) say when Claude Code consults the token. Each session exports its own token, never one inherited from a parent session. Settings `env` blocks can’t set it. Requires Claude Code v2.1.228 or later `CLAUDE_CODE_NATIVE_CURSOR`| Set to `1` to show the terminal’s own cursor at the input caret instead of a drawn block. The cursor respects the terminal’s blink, shape, and focus settings `CLAUDE_CODE_NEW_INIT`| Set to `1` to make `/init` run an interactive setup flow. The flow asks which files to generate, including CLAUDE.md, skills, and hooks, before exploring the codebase and writing them. Without this variable, `/init` generates a CLAUDE.md automatically without prompting +`CLAUDE_CODE_NONBLOCKING_STDOUT`| Set to `1` to write terminal output through a second non-blocking file descriptor, so a terminal that stops reading, such as a paused tmux control-mode pane or a stalled SSH connection, can’t freeze Claude Code mid-session. Applies on macOS, Linux, and WSL when stdout is a terminal. Requires Claude Code v2.1.261 or later `CLAUDE_CODE_NO_FLICKER`| Set to `1` to enable [fullscreen rendering](</docs/en/fullscreen>), a research preview that reduces flicker and keeps memory flat in long conversations. Overrides the [`tui`](</docs/en/settings-reference#tui>) setting; you can also switch with `/tui fullscreen` `CLAUDE_CODE_OAUTH_REFRESH_TOKEN`| OAuth refresh token for Claude.ai authentication. When set, `claude auth login` exchanges this token directly instead of opening a browser. Requires `CLAUDE_CODE_OAUTH_SCOPES`. Useful for provisioning authentication in automated environments `CLAUDE_CODE_OAUTH_SCOPES`| Space-separated OAuth scopes the refresh token was issued with, such as `"user:profile user:inference user:sessions:claude_code"`. Required when `CLAUDE_CODE_OAUTH_REFRESH_TOKEN` is set @@ -358,7 +359,7 @@ `CLAUDE_CODE_TMUX_TRUECOLOR`| Set to any non-empty value, such as `1`, to allow 24-bit truecolor output inside tmux. **Setting it to`0` or `false` still allows truecolor**, unlike most on/off variables; unset the variable to restore the 256-color clamp. By default, Claude Code clamps to 256 colors when `$TMUX` is set because tmux does not pass through truecolor escape sequences unless configured to. Set this after adding `set -ga terminal-overrides ',*:Tc'` to your `~/.tmux.conf`. See [Terminal configuration](</docs/en/terminal-config>) for other tmux settings `CLAUDE_CODE_TOOL_MEMORY_CGROUP_EXCLUDE`| On Linux and WSL, set to a comma-separated list of the kinds of processes Claude Code [excludes from the tool memory cap](</docs/en/tools-reference#memory-limit-on-linux-and-wsl>), such as `mcp` or `lsp`. Set `none` to cap every kind, or `all-new` to cap only Bash, PowerShell, and Monitor tool commands. Claude Code keeps Bash, PowerShell, and Monitor tool commands under the cap whatever you list. Requires Claude Code v2.1.246 or later `CLAUDE_CODE_TOOL_MEMORY_LIMIT`| On Linux and WSL, set to a size such as `4G` to [cap the memory that Bash and PowerShell tool commands can use](</docs/en/tools-reference#memory-limit-on-linux-and-wsl>), and Monitor tool commands on v2.1.246 or later. Write the size in plain digits, alone for a number of bytes or with a `K`, `M`, `G`, or `T` suffix. Set `0` or `off` to turn the cap off. Once the first process Claude Code starts has turned the cap on or off, a changed value takes effect the next time you launch `claude`. Requires Claude Code v2.1.233 or later -`CLAUDE_CODE_USER_DIALOG_TIMEOUT_MS`| Deadline in milliseconds for dialogs Claude Code forwards to a remote client, such as a [Remote Control](</docs/en/remote-control>) or SDK host, and for the approval dialog for a [held cross-session message](</docs/en/cross-session-messaging#control-inbound-messages>), before Claude Code cancels them; permission prompts and `AskUserQuestion` questions use their own flows and aren’t governed by it. Also bounds the mid-session [Fable usage-credits consent prompt](</docs/en/model-config#fable-and-usage-credits>) in a session that may be running unattended. [Control inbound messages](</docs/en/cross-session-messaging#control-inbound-messages>) and [non-interactive sessions](</docs/en/cross-session-messaging#non-interactive-sessions>) cover the full held-message expiry rules, including the cases where the deadline doesn’t apply. Overrides the [`dialogExpiry`](</docs/en/settings-reference#dialogexpiry>) setting; `0` or a negative value disables the deadline +`CLAUDE_CODE_USER_DIALOG_TIMEOUT_MS`| Deadline in milliseconds before Claude Code cancels a dialog it forwards to a remote client such as a [Remote Control](</docs/en/remote-control>) or SDK host, or the approval dialog for a [held cross-session message](</docs/en/cross-session-messaging#control-inbound-messages>); permission prompts and `AskUserQuestion` questions use their own flows and aren’t governed by it. On Claude Code v2.1.236 or later, it also bounds the mid-session [Fable usage-credits consent prompt](</docs/en/model-config#fable-and-usage-credits>) in a session that may be running unattended. [Control inbound messages](</docs/en/cross-session-messaging#control-inbound-messages>) and [non-interactive sessions](</docs/en/cross-session-messaging#non-interactive-sessions>) cover the full held-message expiry rules, including the cases where the deadline doesn’t apply. Overrides the [`dialogExpiry`](</docs/en/settings-reference#dialogexpiry>) setting. `0` or a negative value disables the deadline `CLAUDE_CODE_USE_ANTHROPIC_AWS`| Use [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) `CLAUDE_CODE_USE_BEDROCK`| Use [Amazon Bedrock](</docs/en/amazon-bedrock>) `CLAUDE_CODE_USE_FOUNDRY`| Use [Microsoft Foundry](</docs/en/microsoft-foundry>) @@ -375,11 +376,12 @@ `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK`| Set to `1` to enable the byte-level streaming idle watchdog on Amazon Bedrock `vnd.amazon.eventstream` responses, which also enables the [first-byte deadline](</docs/en/network-config#streaming-idle-watchdogs>) on Bedrock streaming requests. Off by default. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS` `CLAUDE_ENABLE_STREAM_WATCHDOG`| Set to `0` to force-disable the event-level streaming idle watchdog, or set to `1` to force-enable it. When unset, the watchdog is on by default for all providers. Before v2.1.196, the unset default was server-controlled on the direct Anthropic API and off on other providers. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS`; for the other stall timers that run alongside this one, see [Streaming idle watchdogs](</docs/en/network-config#streaming-idle-watchdogs>) `CLAUDE_ENV_FILE`| Path to a shell script whose contents Claude Code runs before each Bash command in the same shell process, so exports in the file are visible to the command. Use to persist virtualenv or conda activation across commands. Also populated dynamically by [SessionStart](</docs/en/hooks#persist-environment-variables>), [Setup](</docs/en/hooks#setup>), [CwdChanged](</docs/en/hooks#cwdchanged>), and [FileChanged](</docs/en/hooks#filechanged>) hooks +`CLAUDE_JOB_DIR`| Set by Claude Code in each [background session](</docs/en/agent-view>) to that session’s `~/.claude/jobs/<id>` directory. Shell commands that the session runs inherit it. Write scratch files to [`$CLAUDE_JOB_DIR/tmp`](</docs/en/agent-view#where-state-is-stored>). Claude’s `Write` and `Edit` calls there don’t prompt for permission, and the directory is removed when the session is deleted `CLAUDE_PID`| Claude Code sets this to its own process ID in the subprocesses it spawns: Bash and PowerShell tool commands and hook commands. On Linux, the Bash tool’s shell integration uses it to refuse a `pkill` pattern that would match the Claude Code process itself; see [the error reference](</docs/en/errors#pkill-pattern-matches-the-claude-code-process>). Read it from your own scripts to identify or signal the parent Claude Code process deliberately. Requires Claude Code v2.1.214 or later `CLAUDE_REMOTE_CONTROL_SESSION_NAME_PREFIX`| Prefix for auto-generated [Remote Control](</docs/en/remote-control>) session names when no explicit name is provided. Defaults to your machine’s hostname, producing names like `myhost-graceful-unicorn`. The `--remote-control-session-name-prefix` CLI flag sets the same value for a single invocation `CLAUDE_STREAM_FIRST_BYTE_TIMEOUT_MS`| Deadline in milliseconds for the first response byte of a streaming request, on the connections where the [first-byte deadline](</docs/en/network-config#streaming-idle-watchdogs>) runs. For how Claude Code clamps it, the extra time it adds for large request bodies, and how it picks the deadline when you leave this unset, see [No response from API](</docs/en/errors#no-response-from-api>). Requires Claude Code v2.1.242 or later `CLAUDE_STREAM_IDLE_TIMEOUT_MS`| Timeout in milliseconds before the event- and byte-level streaming idle watchdogs close a stalled connection. When you set this variable explicitly, the minimum is `300000` (5 minutes); lower values are silently clamped to absorb extended thinking pauses and proxy buffering, and the byte-level watchdog caps the value at 30 minutes. `CLAUDE_BYTE_STREAM_IDLE_TIMEOUT_MS` takes precedence over this variable for the byte-level watchdog. For the per-watchdog unset defaults, see [Streaming idle watchdogs](</docs/en/network-config#streaming-idle-watchdogs>) -`CLAUDE_SUBAGENT_BG_SHELL_MAX_MS`| Maximum lifetime in milliseconds for a [background shell command](</docs/en/interactive-mode#background-bash-commands>) that a [subagent](</docs/en/sub-agents>) started. Default `3600000` (60 minutes). When you set `0`, Claude Code applies the default instead of removing the cap. When the subagent runs in the foreground, Claude Code also ends the command when that subagent gives its final response, regardless of this cap. See [the background command lifetime rules](</docs/en/tools-reference#background-commands>). Claude Code doesn’t cap main-session background commands this way. For the memory-pressure limit that covers them, see [How backgrounding works](</docs/en/interactive-mode#how-backgrounding-works>) +`CLAUDE_SUBAGENT_BG_SHELL_MAX_MS`| Removed in v2.1.260 and now a no-op. Previously capped how long a [background shell command](</docs/en/interactive-mode#background-bash-commands>) that a [subagent](</docs/en/sub-agents>) started could run, in milliseconds, with a 60-minute default. See [the background command lifetime rules](</docs/en/tools-reference#background-commands>) `DEBUG`| Set to `1` to enable debug mode, equivalent to launching with [`--debug`](</docs/en/cli-reference#cli-flags>). Debug logs are written to `~/.claude/debug/<session-id>.txt`, or to the path set by `CLAUDE_CODE_DEBUG_LOGS_DIR`. Only the truthy values `1`, `true`, `yes`, and `on` enable debug mode, so namespace patterns like `DEBUG=express:*` set for other tools do not trigger it `DISABLE_AUTOUPDATER`| Set to `1` to disable automatic background updates. Manual `claude update` still works. Use `DISABLE_UPDATES` to block both `DISABLE_AUTO_COMPACT`| Set to `1` to disable automatic compaction when approaching the context limit. The manual `/compact` command remains available. Use when you want explicit control over when compaction occurs. Overrides the [`autoCompactEnabled`](</docs/en/settings-reference#autocompactenabled>) setting @@ -409,16 +411,16 @@ `ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) instead of the default 5 minutes. Intended for API key, [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), [Microsoft Foundry](</docs/en/microsoft-foundry>), and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) users. Subscription users within included usage receive the 1-hour TTL automatically on the [main conversation](</docs/en/prompt-caching#which-ttl-each-request-gets>). Subscription users drawing on [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>) can set it to keep the 1-hour TTL. 1-hour cache writes are billed at a higher rate. To choose the TTL per request bucket instead, use `CLAUDE_CODE_PROMPT_CACHE_TTL` and `CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL`, which take precedence over this variable `ENABLE_PROMPT_CACHING_1H_BEDROCK`| Deprecated. Use `ENABLE_PROMPT_CACHING_1H` instead `ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset, Claude Code defers all MCP tools by default. It still loads them upfront on Google Cloud’s Agent Platform models earlier than the Claude 4.5 generation, on a Microsoft Foundry deployment hosted on Azure, and when `ANTHROPIC_BASE_URL` points to a non-first-party host. `true` always defers and sends the beta header, except on those same Agent Platform models and Microsoft Foundry deployments; requests fail on proxies that don’t support `tool_reference`. `auto` loads upfront when tool definitions fit within 10% of context. `auto:N` sets a custom threshold, such as `auto:5` for 5%. `false` loads all tools upfront. A value you set yourself is ignored when `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS` is set. Before v2.1.221, Claude Code disabled tool search for all models on Google Cloud’s Agent Platform unless you set this variable to `true` -`FALLBACK_FOR_ALL_PRIMARY_MODELS`| Set to any non-empty value, such as `1`, to make every model stop retrying with a repeated-overload error when no fallback model is configured. **Setting it to`0` or `false` still enables this**, unlike most on/off variables; unset the variable to restore the default retry behavior. Without it, models Claude Code recognizes as Opus, Fable, or Mythos models stop retrying this way when you authenticate with an API key or a [third-party provider](</docs/en/third-party-integrations>) rather than a Claude subscription. As of v2.1.160, a configured [fallback model chain](</docs/en/model-config#fallback-model-chains>) triggers on repeated overload errors for any primary model, so this variable does not affect switching to a fallback model +`FALLBACK_FOR_ALL_PRIMARY_MODELS`| Set to any non-empty value, such as `1`, to make Claude Code stop retrying on repeated overload errors for every model when no fallback model is configured. **Setting it to`0` or `false` still enables this**, unlike most on/off variables; unset the variable to restore the default retry behavior. Without it, Claude Code stops retrying this way on models it recognizes as Opus, Fable, or Mythos models when you authenticate with an API key or a [third-party provider](</docs/en/third-party-integrations>) rather than a Claude subscription. On Claude Code v2.1.160 or later, Claude Code switches to your configured [fallback model chain](</docs/en/model-config#fallback-model-chains>) on repeated overload errors for any primary model, so this variable doesn’t affect switching to a fallback model `FORCE_AUTOUPDATE_PLUGINS`| Set to `1` to force plugin auto-updates even when the main auto-updater is disabled via `DISABLE_AUTOUPDATER` -`FORCE_HYPERLINK`| Set to `1` to enable clickable OSC 8 hyperlinks when your terminal supports them but isn’t auto-detected, or `0` to disable them. When unset, Claude Code enables hyperlinks only when it detects terminal support. Claude Code parses this value as a number, not a Boolean, so a value such as `false`, `no`, or `off` enables hyperlinks rather than disabling them. Claude Code renders the footer [PR or merge request badge](</docs/en/interactive-mode#pr-review-status>) as a hyperlink even when it can’t detect terminal support, such as over SSH. Set `0` to render the badge as plain text +`FORCE_HYPERLINK`| Set to `1` to enable clickable OSC 8 hyperlinks when your terminal supports them but isn’t auto-detected, or `0` to disable them. When unset, Claude Code enables hyperlinks only when it detects terminal support. Claude Code parses this value as a number, not a Boolean, so a value such as `false`, `no`, or `off` enables hyperlinks rather than disabling them. The footer [PR or merge request badge](</docs/en/interactive-mode#pr-review-status>) renders as a hyperlink even when Claude Code can’t detect terminal support, such as over SSH. Set `0` to render the badge as plain text `FORCE_PROMPT_CACHING_5M`| Set to `1` to force the 5-minute prompt cache TTL even when 1-hour TTL would otherwise apply. Overrides `CLAUDE_CODE_PROMPT_CACHE_TTL`, `CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL`, `ENABLE_PROMPT_CACHING_1H`, and the `promptCacheTtl` and `subagentPromptCacheTtl` settings `HTTP_PROXY`| Specify HTTP proxy server for network connections `HTTPS_PROXY`| Specify HTTPS proxy server for network connections `IS_DEMO`| Set to any non-empty value, such as `1`, to enable demo mode: hides your email and organization name from the header and `/status` output, and skips onboarding. **Setting it to`0` or `false` still enables demo mode**, unlike most on/off variables; unset the variable to turn it off. Useful when streaming or recording a session `MAX_MCP_OUTPUT_TOKENS`| Maximum number of tokens allowed in MCP tool responses. Claude Code displays a warning when output exceeds 10,000 tokens. Tools that declare [`anthropic/maxResultSizeChars`](</docs/en/mcp#raise-the-limit-for-a-specific-tool>) use that character limit for text content instead, but image content from those tools is still subject to this variable (default: 25000) -`MAX_STRUCTURED_OUTPUT_RETRIES`| Number of times Claude Code retries when the model’s response fails validation against the [`--json-schema`](</docs/en/cli-reference#cli-flags>) in non-interactive mode with the `-p` flag. The same retry count applies when a [workflow](</docs/en/workflows>) subagent’s structured output fails validation. Defaults to 5 -`MAX_THINKING_TOKENS`| Fixed token budget for [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>). Claude Code caps it at one token below the request’s max output tokens and never below 1,024; see `CLAUDE_CODE_MAX_OUTPUT_TOKENS` for how that limit is set. When unset and thinking is enabled, models with [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) choose their own thinking depth, and other models use the cap. Set to `0` to disable thinking on the Anthropic API, except on [Fable models](</docs/en/model-config#extended-thinking>), which can’t have thinking turned off; on [third-party providers](</docs/en/third-party-integrations>), `0` omits the `thinking` parameter instead. With thinking turned off on the Anthropic API, Claude Code sends effort `high` instead of a higher level to models it knows [don’t accept that combination](</docs/en/errors#effort-isnt-available-with-thinking-turned-off>), such as Opus 5. Nonzero values are ignored on adaptive reasoning models unless `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` is set +`MAX_STRUCTURED_OUTPUT_RETRIES`| Number of attempts Claude Code allows when the model’s response fails validation against the [`--json-schema`](</docs/en/cli-reference#cli-flags>) in non-interactive mode with the `-p` flag; after that many failed attempts with no valid output, the run fails. The same cap applies when a [workflow](</docs/en/workflows>) subagent’s structured output fails validation. Defaults to 5, a first attempt plus four retries +`MAX_THINKING_TOKENS`| Fixed token budget for [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>). Claude Code caps it at one token below the request’s max output tokens and never below 1,024. See `CLAUDE_CODE_MAX_OUTPUT_TOKENS` for how that limit is set. When unset and thinking is enabled, models with [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) choose their own thinking depth, and other models use the cap. Set to `0` to disable thinking on the Anthropic API, except on Fable models, which can’t have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `0` omits the `thinking` parameter instead. With thinking turned off on the Anthropic API, Claude Code sends effort `high` instead of a higher level to models it knows [don’t accept that combination](</docs/en/errors#effort-isnt-available-with-thinking-turned-off>), such as Opus 5. Claude Code ignores nonzero values on adaptive reasoning models, except on the models where `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` turns adaptive reasoning off `MCP_CLIENT_SECRET`| OAuth client secret for MCP servers that require [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>). Avoids the interactive prompt when adding a server with `--client-secret` `MCP_CONNECTION_NONBLOCKING`| Controls whether startup waits for MCP servers to connect before the first query. MCP startup is non-blocking by default: servers connect in the background and their tools become available as they finish. Set to `0` to make Claude Code wait for servers to connect before the first query. Servers configured with [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>) still make startup wait regardless, except when served from the [discovery cache](</docs/en/mcp#server-status-detail>), since their tools must be present when the first prompt is built. In non-interactive mode (`-p`), Claude Code also waits for still-pending servers before the first turn regardless of this variable, with a longer deadline when you pass [`--mcp-config`](</docs/en/cli-reference#cli-flags>) explicitly; see that flag’s entry for the cached-server exception `MCP_CONNECT_TIMEOUT_MS`| How long blocking MCP startup waits, in milliseconds, for the connection batch before snapshotting the tool list (default: 5000). Applies when `MCP_CONNECTION_NONBLOCKING=0` or for servers marked [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>). Servers still pending at the deadline keep connecting in the background. Distinct from `MCP_TIMEOUT`, which bounds an individual server’s connect attempt @@ -463,7 +465,7 @@ `VERTEX_REGION_CLAUDE_5_OPUS`| Override region for Claude Opus 5 when using Google Cloud’s Agent Platform. Added in v2.1.219 `VERTEX_REGION_CLAUDE_5_SONNET`| Override region for Claude Sonnet 5 when using Google Cloud’s Agent Platform. Added in v2.1.197 `VERTEX_REGION_CLAUDE_FABLE_5`| Override region for Claude Fable 5 when using Google Cloud’s Agent Platform. Added in v2.1.170 -`VERTEX_REGION_CLAUDE_FABLE_5_1`| Override region for Claude Fable 5.1 when using Google Cloud’s Agent Platform. Added in v2.1.255 +`VERTEX_REGION_CLAUDE_FABLE_5_1`| Override region for Claude Fable 5.1 when using Google Cloud’s Agent Platform. Added in v2.1.257 `VERTEX_REGION_CLAUDE_HAIKU_4_5`| Override region for Claude Haiku 4.5 when using Google Cloud’s Agent Platform Standard OpenTelemetry exporter variables (`OTEL_METRICS_EXPORTER`, `OTEL_LOGS_EXPORTER`, `OTEL_EXPORTER_OTLP_ENDPOINT`, `OTEL_EXPORTER_OTLP_PROTOCOL`, `OTEL_EXPORTER_OTLP_HEADERS`, `OTEL_METRIC_EXPORT_INTERVAL`, `OTEL_RESOURCE_ATTRIBUTES`, and signal-specific variants) are also supported. See [Monitoring](</docs/en/monitoring-usage>) for configuration details. @@ -495,6 +497,7 @@ * Get the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) by default for claude.ai and Console accounts on Windows with Git Bash installed; Claude Code routes shell commands through Git Bash unless you set `CLAUDE_CODE_USE_POWERSHELL_TOOL=1`. On Windows without Git Bash, the tool stays on * Get [Claude-drafted feedback](</docs/en/tools-reference#sendfeedback-tool-behavior>), which Claude Code turns on through a fetched flag * Have Claude Code [exclude MCP tools whose input schema the API would reject](</docs/en/mcp#tools-with-invalid-input-schemas>); it sends the schema anyway, and a request that includes it fails with [a 400 error naming the tool by its position](</docs/en/errors#tool-input-schema-is-invalid>) + * Have a resumed conversation [keep its recorded system prompt](</docs/en/cli-reference#system-prompt-flags-in-resumed-conversations>); Claude Code rebuilds the prompt on every request and `--system-prompt-snapshot` has no effect ###
modified
--- a/env-vars.md +++ b/env-vars.md @@ -127,24 +127,24 @@ `ANTHROPIC_CUSTOM_HEADERS`| Custom headers to add to requests (`Name: Value` format, newline-separated for multiple headers). If a name or value contains a character an HTTP header can’t carry, such as a curly quote or a zero-width space, the request fails with an error that identifies the pair by position. Requires Claude Code v2.1.227 or later. [Invalid request header value](</docs/en/errors#invalid-request-header-value>) lists the exact character set and where the check runs. A value that sets a credential, org or tenant, routing, or API-behavior header, such as `Authorization` or `Host`, counts as a [setting that needs approval](</docs/en/server-managed-settings#environment-variables-and-the-approval-dialog>) when server-managed settings deliver it. From project or local settings, such a value follows the [rules for when `env` values apply](</docs/en/settings-reference#when-claude-code-applies-env-values>) `ANTHROPIC_CUSTOM_MODEL_OPTION`| Model ID to add as a custom entry in the `/model` picker. Use this to make a non-standard or gateway-specific model selectable without replacing built-in aliases. See [Model configuration](</docs/en/model-config#add-a-custom-model-option>) `ANTHROPIC_CUSTOM_MODEL_OPTION_DESCRIPTION`| Display description for the custom model entry in the `/model` picker. Defaults to `Custom model (<model-id>)` when not set -`ANTHROPIC_CUSTOM_MODEL_OPTION_NAME`| Display name for the custom model entry in the `/model` picker. Defaults to the model ID when not set +`ANTHROPIC_CUSTOM_MODEL_OPTION_NAME`| Display name for the custom model entry in the `/model` picker. When not set, the entry shows the model’s name if Claude Code [recognizes the ID](</docs/en/model-config#customize-pinned-model-display-and-capabilities>), and the model ID otherwise `ANTHROPIC_CUSTOM_MODEL_OPTION_SUPPORTED_CAPABILITIES`| Comma-separated list of [capabilities](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) the custom model supports, for example `effort,thinking`. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) `ANTHROPIC_DEFAULT_FABLE_MODEL`| Model ID that the `fable` alias resolves to, and the ID Claude Code recognizes as a Fable model for [automatic model fallback](</docs/en/model-config#automatic-model-fallback>) on third-party providers. See [Model configuration](</docs/en/model-config#environment-variables>) -`ANTHROPIC_DEFAULT_FABLE_MODEL_DESCRIPTION`| Display description for the pinned Fable model in the `/model` picker. Defaults to `Custom Fable model` when not set. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) -`ANTHROPIC_DEFAULT_FABLE_MODEL_NAME`| Display name for the pinned Fable model in the `/model` picker. Defaults to the model ID when not set. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) +`ANTHROPIC_DEFAULT_FABLE_MODEL_DESCRIPTION`| Display description for the pinned Fable model in the `/model` picker. When not set, the row shows a default description that begins `Custom Fable model`. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) +`ANTHROPIC_DEFAULT_FABLE_MODEL_NAME`| Display name for the pinned Fable model in the `/model` picker. When not set, the row shows the model’s name if Claude Code recognizes the pinned ID, and the pinned ID otherwise. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) `ANTHROPIC_DEFAULT_FABLE_MODEL_SUPPORTED_CAPABILITIES`| Comma-separated list of [capabilities](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) the pinned Fable model supports, for example `effort,thinking`. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) `ANTHROPIC_DEFAULT_HAIKU_MODEL`| Model ID that the `haiku` alias resolves to, also used for [background functionality](</docs/en/costs#background-token-usage>). See [Model configuration](</docs/en/model-config#environment-variables>) -`ANTHROPIC_DEFAULT_HAIKU_MODEL_DESCRIPTION`| Display description for the pinned Haiku model in the `/model` picker. Defaults to `Custom Haiku model` when not set. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) -`ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME`| Display name for the pinned Haiku model in the `/model` picker. Defaults to the model ID when not set. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) +`ANTHROPIC_DEFAULT_HAIKU_MODEL_DESCRIPTION`| Display description for the pinned Haiku model in the `/model` picker. When not set, the row shows a default description that begins `Custom Haiku model`. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) +`ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME`| Display name for the pinned Haiku model in the `/model` picker. When not set, the row shows the model’s name if Claude Code recognizes the pinned ID, and the pinned ID otherwise. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) `ANTHROPIC_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES`| Comma-separated list of [capabilities](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) the pinned Haiku model supports, for example `effort,thinking`. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) `ANTHROPIC_DEFAULT_MODEL`| Model that new sessions start on by default. Requires Claude Code v2.1.236 or later. See [Set a default model for new sessions](</docs/en/model-config#set-a-default-model-for-new-sessions>) `ANTHROPIC_DEFAULT_OPUS_MODEL`| Model ID that the `opus` alias resolves to, and that `opusplan` uses while Plan Mode is active. See [Model configuration](</docs/en/model-config#environment-variables>) -`ANTHROPIC_DEFAULT_OPUS_MODEL_DESCRIPTION`| Display description for the pinned Opus model in the `/model` picker. When not set, defaults to `Custom Opus model`, or `Custom Opus model (1M context)` if the pinned model ID has the `[1m]` suffix and `CLAUDE_CODE_DISABLE_1M_CONTEXT` isn’t turned on. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) -`ANTHROPIC_DEFAULT_OPUS_MODEL_NAME`| Display name for the pinned Opus model in the `/model` picker. Defaults to the model ID when not set. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) +`ANTHROPIC_DEFAULT_OPUS_MODEL_DESCRIPTION`| Display description for the pinned Opus model in the `/model` picker. When not set, the row shows a default description that begins `Custom Opus model`. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) +`ANTHROPIC_DEFAULT_OPUS_MODEL_NAME`| Display name for the pinned Opus model in the `/model` picker. When not set, the row shows the model’s name if Claude Code recognizes the pinned ID, and the pinned ID otherwise. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) `ANTHROPIC_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES`| Comma-separated list of [capabilities](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) the pinned Opus model supports, for example `effort,thinking`. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) `ANTHROPIC_DEFAULT_SONNET_MODEL`| Model ID that the `sonnet` alias resolves to, and that `opusplan` uses when Plan Mode is not active. See [Model configuration](</docs/en/model-config#environment-variables>) -`ANTHROPIC_DEFAULT_SONNET_MODEL_DESCRIPTION`| Display description for the pinned Sonnet model in the `/model` picker. When not set, defaults to `Custom Sonnet model`, or `Custom Sonnet model (1M context)` if the pinned model ID has the `[1m]` suffix and `CLAUDE_CODE_DISABLE_1M_CONTEXT` isn’t turned on. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) -`ANTHROPIC_DEFAULT_SONNET_MODEL_NAME`| Display name for the pinned Sonnet model in the `/model` picker. Defaults to the model ID when not set. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) +`ANTHROPIC_DEFAULT_SONNET_MODEL_DESCRIPTION`| Display description for the pinned Sonnet model in the `/model` picker. When not set, the row shows a default description that begins `Custom Sonnet model`. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) +`ANTHROPIC_DEFAULT_SONNET_MODEL_NAME`| Display name for the pinned Sonnet model in the `/model` picker. When not set, the row shows the model’s name if Claude Code recognizes the pinned ID, and the pinned ID otherwise. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) `ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES`| Comma-separated list of [capabilities](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) the pinned Sonnet model supports, for example `effort,thinking`. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) `ANTHROPIC_FEDERATION_RULE_ID`| Federation rule ID for [Workload Identity Federation](<https://platform.claude.com/docs/en/manage-claude/workload-identity-federation>). When you set it together with `ANTHROPIC_ORGANIZATION_ID`, Claude Code selects federation credentials, which rank above your `/login` credential. See [authentication precedence](</docs/en/authentication#authentication-precedence>) `ANTHROPIC_FOUNDRY_API_KEY`| API key for Microsoft Foundry authentication (see [Microsoft Foundry](</docs/en/microsoft-foundry>)) @@ -159,7 +159,7 @@ `ANTHROPIC_VERTEX_BASE_URL`| Override Google Cloud’s Agent Platform endpoint URL. Use for custom Google Cloud’s Agent Platform endpoints or when routing through an [LLM gateway](</docs/en/llm-gateway>). See [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>) `ANTHROPIC_VERTEX_PROJECT_ID`| GCP project ID for Google Cloud’s Agent Platform requests. Overridden by `GCLOUD_PROJECT`, `GOOGLE_CLOUD_PROJECT`, or the project in your `GOOGLE_APPLICATION_CREDENTIALS` credential file. See [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>) `ANTHROPIC_WORKSPACE_ID`| Workspace ID for [workload identity federation](<https://platform.claude.com/docs/en/manage-claude/workload-identity-federation>). Set this when your federation rule is scoped to more than one workspace so the token exchange knows which workspace to target -`API_FORCE_IDLE_TIMEOUT`| Override the 5-minute body idle timeout that aborts a streaming model response when no bytes arrive. Set to `0` to turn the timeout off, for example when a slow [gateway](</docs/en/llm-gateway>) or local model pauses longer than 5 minutes between chunks, or `1` to keep it on for every provider. When unset, the timeout is active on providers other than the direct Anthropic API and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>). The [stream watchdogs](</docs/en/network-config#streaming-idle-watchdogs>) run independently of it and abort a long silent pause even when you set `0` here. Requires Claude Code v2.1.169 or later +`API_FORCE_IDLE_TIMEOUT`| Override the 5-minute body idle timeout that aborts a streaming model response when no bytes arrive. Set to `0` to turn the timeout off, for example when a slow [gateway](</docs/en/llm-gateway>) or local model pauses longer than 5 minutes between chunks, or `1` to keep it on for every provider. When unset, the timeout is active on providers other than the direct Anthropic API and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>). The [stream watchdogs](</docs/en/network-config#streaming-idle-watchdogs>) run independently of it and abort a long silent pause even when you set `0` here `API_TIMEOUT_MS`| Timeout for API requests in milliseconds (default: 600000, or 10 minutes; maximum: 2147483647). Increase this when requests time out on slow networks or when routing through a proxy. Values above the maximum overflow the underlying timer and cause requests to fail immediately `AWS_BEARER_TOKEN_BEDROCK`| Amazon Bedrock API key for authentication (see [Amazon Bedrock API keys](<https://aws.amazon.com/blogs/machine-learning/accelerate-ai-development-with-amazon-bedrock-api-keys/>)) `BASH_DEFAULT_TIMEOUT_MS`| Default timeout for long-running bash commands (default: 120000, or 2 minutes) @@ -354,7 +354,7 @@ `CLAUDE_CODE_SYNTAX_HIGHLIGHT`| Set to `false` to disable syntax highlighting in diff output. Useful when colors interfere with your terminal setup. To also disable highlighting in code blocks and file previews, use the [`syntaxHighlightingDisabled`](</docs/en/settings-reference#syntaxhighlightingdisabled>) setting `CLAUDE_CODE_TASK_LIST_ID`| Share a task list across sessions. Set the same ID in multiple Claude Code instances to coordinate on a shared task list, in [sessions that have the Task tools](</docs/en/tools-reference#task-tool-availability>). See [Task list](</docs/en/interactive-mode#task-list>) `CLAUDE_CODE_TEAM_TEARDOWN_PARK_TIMEOUT_MS`| Override, in milliseconds, how long a non-interactive session waits at exit for its [agent team](</docs/en/agent-teams>) to finish tearing down. Accepts 1000 to 60000; an out-of-range value is ignored and the default of 10000 applies. Requires Claude Code v2.1.206 or later -`CLAUDE_CODE_TMPDIR`| Override the temp directory used for internal temp files. Claude Code appends `/claude-{uid}/` on Unix or `/claude/` on Windows to this path. Default: `/tmp` on macOS, `os.tmpdir()` on Linux and Windows. As of v2.1.161, on macOS and Linux, [sandboxed](</docs/en/sandboxing>) Bash subprocesses receive a short fallback `$TMPDIR` under the system default when your override is a long path, since some tools fail when temp paths get too long. Unsandboxed Bash commands inherit your shell’s `$TMPDIR` unchanged. Claude Code’s own temp files always use your override. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) +`CLAUDE_CODE_TMPDIR`| Override the temp directory used for internal temp files. Claude Code appends `/claude-{uid}/` on Unix or `/claude/` on Windows to this path. Default: `/tmp` on macOS, `os.tmpdir()` on Linux and Windows. On macOS and Linux, [sandboxed](</docs/en/sandboxing>) Bash subprocesses receive a short fallback `$TMPDIR` under the system default when your override is a long path, since some tools fail when temp paths get too long. Unsandboxed Bash commands inherit your shell’s `$TMPDIR` unchanged. Claude Code’s own temp files always use your override. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) `CLAUDE_CODE_TMUX_TRUECOLOR`| Set to any non-empty value, such as `1`, to allow 24-bit truecolor output inside tmux. **Setting it to`0` or `false` still allows truecolor**, unlike most on/off variables; unset the variable to restore the 256-color clamp. By default, Claude Code clamps to 256 colors when `$TMUX` is set because tmux does not pass through truecolor escape sequences unless configured to. Set this after adding `set -ga terminal-overrides ',*:Tc'` to your `~/.tmux.conf`. See [Terminal configuration](</docs/en/terminal-config>) for other tmux settings `CLAUDE_CODE_TOOL_MEMORY_CGROUP_EXCLUDE`| On Linux and WSL, set to a comma-separated list of the kinds of processes Claude Code [excludes from the tool memory cap](</docs/en/tools-reference#memory-limit-on-linux-and-wsl>), such as `mcp` or `lsp`. Set `none` to cap every kind, or `all-new` to cap only Bash, PowerShell, and Monitor tool commands. Claude Code keeps Bash, PowerShell, and Monitor tool commands under the cap whatever you list. Requires Claude Code v2.1.246 or later `CLAUDE_CODE_TOOL_MEMORY_LIMIT`| On Linux and WSL, set to a size such as `4G` to [cap the memory that Bash and PowerShell tool commands can use](</docs/en/tools-reference#memory-limit-on-linux-and-wsl>), and Monitor tool commands on v2.1.246 or later. Write the size in plain digits, alone for a number of bytes or with a `K`, `M`, `G`, or `T` suffix. Set `0` or `off` to turn the cap off. Once the first process Claude Code starts has turned the cap on or off, a changed value takes effect the next time you launch `claude`. Requires Claude Code v2.1.233 or later @@ -459,7 +459,7 @@ `VERTEX_REGION_CLAUDE_4_6_OPUS`| Override region for Claude Opus 4.6 when using Google Cloud’s Agent Platform `VERTEX_REGION_CLAUDE_4_6_SONNET`| Override region for Claude Sonnet 4.6 when using Google Cloud’s Agent Platform `VERTEX_REGION_CLAUDE_4_7_OPUS`| Override region for Claude Opus 4.7 when using Google Cloud’s Agent Platform -`VERTEX_REGION_CLAUDE_4_8_OPUS`| Override region for Claude Opus 4.8 when using Google Cloud’s Agent Platform. Added in v2.1.154 +`VERTEX_REGION_CLAUDE_4_8_OPUS`| Override region for Claude Opus 4.8 when using Google Cloud’s Agent Platform `VERTEX_REGION_CLAUDE_5_OPUS`| Override region for Claude Opus 5 when using Google Cloud’s Agent Platform. Added in v2.1.219 `VERTEX_REGION_CLAUDE_5_SONNET`| Override region for Claude Sonnet 5 when using Google Cloud’s Agent Platform. Added in v2.1.197 `VERTEX_REGION_CLAUDE_FABLE_5`| Override region for Claude Fable 5 when using Google Cloud’s Agent Platform. Added in v2.1.170
modified
--- a/env-vars.md +++ b/env-vars.md @@ -244,7 +244,7 @@ `CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL`| Set to `1` to disable virtual scrolling in [fullscreen rendering](</docs/en/fullscreen>) and render every message in the transcript. Use this if scrolling in fullscreen mode shows blank regions where messages should appear `CLAUDE_CODE_DISABLE_WORKFLOWS`| Set to `1` to disable [workflows](</docs/en/workflows#turn-workflows-off>). Equivalent to the [`disableWorkflows`](</docs/en/settings-reference#disableworkflows>) setting `CLAUDE_CODE_EFFORT_LEVEL`| Set the effort level for supported models. Values: `low`, `medium`, `high`, `xhigh`, `max`, or `auto` to use the model default. Available levels depend on the model. Takes precedence over `--effort`, `/effort`, and the `modelSettings` and `effortLevel` settings. See [Adjust effort level](</docs/en/model-config#adjust-effort-level>) -`CLAUDE_CODE_ENABLE_APPEND_SUBAGENT_PROMPT`| Set to `1` to enable appending extra text to the end of the system prompt of every [subagent](</docs/en/sub-agents>) other than a [forked subagent](</docs/en/sub-agents#fork-the-current-conversation>). The [`--append-subagent-system-prompt`](</docs/en/cli-reference#cli-flags>) flag supplies the appended text and sets this variable automatically, so you don’t need to set it yourself. Requires Claude Code v2.1.205 or later +`CLAUDE_CODE_ENABLE_APPEND_SUBAGENT_PROMPT`| Set to `1` to enable appending extra text to the end of the system prompt of every [subagent](</docs/en/sub-agents>) other than a [forked subagent](</docs/en/sub-agents#fork-the-current-conversation>). The [`--append-subagent-system-prompt`](</docs/en/cli-reference#cli-flags>) and [`--append-subagent-system-prompt-file`](</docs/en/cli-reference#cli-flags>) flags supply the appended text and set this variable automatically, so you don’t need to set it yourself. Requires Claude Code v2.1.205 or later `CLAUDE_CODE_ENABLE_AUTO_MODE`| Accepted for compatibility with older releases and has no effect. Auto mode is available by default on every provider, including Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and signed-in [Claude apps gateway](</docs/en/claude-apps-gateway>) sessions. In v2.1.158 through v2.1.206, setting this to `1` was required to make [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) available on those providers `CLAUDE_CODE_ENABLE_AWAY_SUMMARY`| Override [session recap](</docs/en/interactive-mode#session-recap>) availability. Set to `0` to force recaps off regardless of the `/config` toggle. Set to `1` to force recaps on when [`awaySummaryEnabled`](</docs/en/settings-reference#awaysummaryenabled>) is `false`. Takes precedence over the setting and `/config` toggle `CLAUDE_CODE_ENABLE_BACKGROUND_PLUGIN_REFRESH`| Set to `1` to refresh plugin state at turn boundaries in [non-interactive mode](</docs/en/headless>) after a background install completes. Off by default because the refresh changes the system prompt mid-session, which invalidates [prompt caching](</docs/en/prompt-caching>) for that turn
modified
--- a/env-vars.md +++ b/env-vars.md @@ -163,7 +163,7 @@ `API_TIMEOUT_MS`| Timeout for API requests in milliseconds (default: 600000, or 10 minutes; maximum: 2147483647). Increase this when requests time out on slow networks or when routing through a proxy. Values above the maximum overflow the underlying timer and cause requests to fail immediately `AWS_BEARER_TOKEN_BEDROCK`| Amazon Bedrock API key for authentication (see [Amazon Bedrock API keys](<https://aws.amazon.com/blogs/machine-learning/accelerate-ai-development-with-amazon-bedrock-api-keys/>)) `BASH_DEFAULT_TIMEOUT_MS`| Default timeout for long-running bash commands (default: 120000, or 2 minutes) -`BASH_MAX_OUTPUT_LENGTH`| Maximum number of characters of bash output that Claude Code reads back into a command’s result (default: 30000; maximum: 150000). See [Output limits](</docs/en/tools-reference#output-limits>) +`BASH_MAX_OUTPUT_LENGTH`| Maximum number of characters of bash output that Claude Code reads back into a command’s result (default: 30000; maximum: 150000). If you set the [`bashOutputMaxChars`](</docs/en/settings-reference#bashoutputmaxchars>) setting, Claude Code ignores this variable. See [Output limits](</docs/en/tools-reference#output-limits>) `BASH_MAX_TIMEOUT_MS`| Maximum timeout the model can set for long-running bash commands (default: 600000, or 10 minutes). The effective ceiling is the larger of this and `BASH_DEFAULT_TIMEOUT_MS` `BETA_TRACING_ENDPOINT`| OTLP endpoint for [detailed beta tracing](</docs/en/monitoring-usage#traces-beta>): with `ENABLE_BETA_TRACING_DETAILED=1`, logs and traces go there instead of to the configured exporters. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) `CCR_FORCE_BUNDLE`| Set to `1` to force [`claude --cloud`](</docs/en/claude-code-on-the-web#send-local-repositories-without-github>) to bundle and upload your local repository even when GitHub access is available @@ -232,7 +232,7 @@ `CLAUDE_CODE_DISABLE_MOUSE`| Set to `1` to disable mouse tracking in [fullscreen rendering](</docs/en/fullscreen>). Keyboard scrolling with `PgUp` and `PgDn` still works. Use this to keep your terminal’s native copy-on-select behavior `CLAUDE_CODE_DISABLE_MOUSE_CLICKS`| Set to `1` to disable click, drag, and hover handling in [fullscreen rendering](</docs/en/fullscreen>) while keeping mouse-wheel scrolling. Use this when you want wheel scroll to work inside Claude Code but don’t want clicks to position the cursor, expand tool output, or open links. `CLAUDE_CODE_DISABLE_MOUSE` takes precedence when both are set. Requires Claude Code v2.1.195 or later `CLAUDE_CODE_DISABLE_MTLS_RELOAD_ON_STALE_CONNECTION`| Set to `1` to stop Claude Code from re-reading the [mTLS client certificate and key](</docs/en/network-config#mtls-authentication>) when an API request fails with a connection-level error, such as a connection reset or a TLS handshake error. With the reload disabled, Claude Code loads rotated files only when it next applies settings or at the next startup. Requires Claude Code v2.1.232 or later -`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`| Set to any non-empty value, such as `1`, to disable nonessential network traffic: auto-updates, telemetry, error reporting, the `/feedback` command, [Claude-drafted feedback](</docs/en/tools-reference#sendfeedback-tool-behavior>), release notes, the [PR and MR status badge](</docs/en/interactive-mode#pr-review-status>) checks, [gateway model discovery](</docs/en/llm-gateway-connect#add-gateway-models-to-the-model-picker>) refreshes, and availability checks such as the [fast mode](</docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways>) check. It also stops the [background runs of plugin `command` sources](</docs/en/plugin-marketplaces#when-claude-code-re-runs-the-command>), which are local commands rather than network traffic, because they can trigger dependency installs. **Setting it to`0` or `false` still disables this traffic**, unlike most on/off variables; unset the variable to allow it again. Also disables feature-flag fetching, which makes [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable. Official plugin marketplace auto-install isn’t covered; disable it with `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL` +`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`| Set to any non-empty value, such as `1`, to disable nonessential network traffic: auto-updates, telemetry, error reporting, the `/feedback` command, [Claude-drafted feedback](</docs/en/tools-reference#sendfeedback-tool-behavior>), release notes, the [PR and MR status badge](</docs/en/interactive-mode#pr-review-status>) checks, and availability checks such as the [fast mode](</docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways>) check. It also stops the [background runs of plugin `command` sources](</docs/en/plugin-marketplaces#when-claude-code-re-runs-the-command>), which are local commands rather than network traffic, because they can trigger dependency installs. **Setting it to`0` or `false` still disables this traffic**, unlike most on/off variables; unset the variable to allow it again. Also disables feature-flag fetching, which makes [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable. Official plugin marketplace auto-install isn’t covered; disable it with `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL`. Doesn’t affect [gateway model discovery](</docs/en/llm-gateway-connect#add-gateway-models-to-the-model-picker>), which has its own opt-in `CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK`| Set to `1` to disable the non-streaming fallback when a streaming request fails mid-stream. Streaming errors propagate to the retry layer instead. Useful when a proxy or gateway causes the fallback to produce duplicate tool execution `CLAUDE_CODE_DISABLE_NOTIFICATION_PRESENCE_CHECK`| Set to `1` to send the `PushNotification` tool’s desktop notification even while you are typing in or focused on the terminal. By default the tool skips both the desktop notification and the [mobile push](</docs/en/remote-control#mobile-push-notifications>) when it detects recent keyboard activity or terminal focus. This variable disables only that local check, so the server can still suppress the mobile push when it detects that you are active. Requires Claude Code v2.1.193 or later `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL`| Set to `1` to disable automatic registration of the official plugin marketplace. Claude Code reads the variable when it is about to register the marketplace, usually during a machine’s first interactive launch. If the variable is set at that point, Claude Code skips the registration permanently. Unsetting the variable later doesn’t undo the skip. Run `claude plugin marketplace add anthropics/claude-plugins-official` to register the marketplace at any time @@ -308,7 +308,7 @@ `CLAUDE_CODE_PLUGIN_PREFER_HTTPS`| Set to `1` to clone GitHub `owner/repo` shorthand sources over HTTPS instead of SSH. Applies to plugin install and update, and to `/plugin marketplace add` and `update`. Useful in CI runners, containers, or any environment without a configured SSH key for `github.com` `CLAUDE_CODE_PLUGIN_SEED_DIR`| Path to one or more read-only plugin seed directories, separated by `:` on Unix or `;` on Windows. Use this to bundle a pre-populated plugins directory into a container image. Claude Code registers marketplaces from these directories at startup and uses pre-cached plugins without re-cloning. See [Pre-populate plugins for containers](</docs/en/plugin-marketplaces#pre-populate-plugins-for-containers>) `CLAUDE_CODE_POWERSHELL_RESPECT_EXECUTION_POLICY`| Set to `1` to stop Claude Code from passing `-ExecutionPolicy Bypass` when spawning PowerShell for tool calls, hooks, and status line commands, and respect the machine’s effective execution policy instead. By default Claude Code bypasses execution policy at process scope so `.ps1` scripts and module imports work on default-Restricted Windows installs. Process-scope bypass never overrides Group Policy `MachinePolicy` or `UserPolicy` regardless of this setting -`CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS`| Ceiling in milliseconds on continuous idle waiting after the final turn in [non-interactive mode](</docs/en/headless#background-tasks-at-exit>) with the `-p` flag, while background subagents and workflows whose result is part of the output finish. Each turn that handles queued background results starts the count again. Default: `600000`, or 10 minutes. When idle waiting reaches the ceiling, Claude Code stops waiting for the remaining background tasks and exits. Set to `0` to wait indefinitely. This cap is separate from the five-second grace period that applies to plain background shells. Requires Claude Code v2.1.182 or later +`CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS`| Ceiling in milliseconds on idle waiting for background subagents and workflows after the final turn in [non-interactive mode](</docs/en/headless#background-tasks-at-exit>) with the `-p` flag. Idle waiting starts over each time Claude takes a turn to handle a background result. Default: `600000`, or 10 minutes. When idle waiting reaches the ceiling, Claude Code stops waiting for the remaining background tasks and exits. Set to `0` to wait indefinitely. This cap is separate from the five-second grace period that applies to plain background shells. Requires Claude Code v2.1.182 or later `CLAUDE_CODE_PROCESS_WRAPPER`| Launch the processes Claude Code starts from its own binary, such as the background service that hosts [agent view](</docs/en/agent-view>) sessions, through a corporate launcher given as an argv prefix like `/opt/corp/launcher`. Set it in the `env` block of user or [managed settings](</docs/en/managed-settings>), not as a shell export, so the detached background service inherits it; project and local settings can’t set it. Equivalent to the [`processWrapper` setting](</docs/en/settings-reference#processwrapper>), which requires Claude Code v2.1.210 or later; this variable takes precedence when both are set. The VS Code extension configures its own launcher separately through its `claudeProcessWrapper` setting. Ignored on Windows. See [Run Claude Code behind a corporate launcher](</docs/en/corporate-launcher>) for the value format, what the launcher covers, and the contract the launcher must satisfy. Requires Claude Code v2.1.208 or later `CLAUDE_CODE_PROJECT_DIR_NAME`| Set together with `CLAUDE_CONFIG_DIR` to choose the `projects/` directory name Claude Code stores that session’s transcripts and auto memory under, in place of one derived from the working directory path. For example, starting Claude Code with `CLAUDE_CONFIG_DIR=/srv/tenant-a CLAUDE_CODE_PROJECT_DIR_NAME=work claude` stores them under `/srv/tenant-a/projects/work/`. Claude Code ignores this variable when `CLAUDE_CONFIG_DIR` is unset, and reads it only from the environment you start `claude` from, never from a settings file `env` block. See [Name the project directory yourself](</docs/en/sessions#name-the-project-directory-yourself>). Requires Claude Code v2.1.234 or later `CLAUDE_CODE_PROMPT_CACHE_TTL`| Set `5m` or `1h`, the only values Claude Code accepts, to choose the [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) for the main conversation: your interactive, `-p`, and SDK turns, plus the helpers that run inline with them. Takes precedence over the `promptCacheTtl` setting and over `ENABLE_PROMPT_CACHING_1H`, and `FORCE_PROMPT_CACHING_5M` overrides it. The API bills 1-hour cache writes at a higher rate. Requires Claude Code v2.1.242 or later @@ -446,7 +446,7 @@ `OTEL_METRICS_INCLUDE_SESSION_ID`| Set to `false` to exclude session ID from metrics attributes (default: included). See [Monitoring](</docs/en/monitoring-usage>) `OTEL_METRICS_INCLUDE_VERSION`| Set to `true` to include Claude Code version in metrics attributes (default: excluded). See [Monitoring](</docs/en/monitoring-usage>) `SLASH_COMMAND_TOOL_CHAR_BUDGET`| Override the character budget for skill metadata shown to the [Skill tool](</docs/en/skills#control-who-invokes-a-skill>). The budget scales dynamically at 1% of the context window, with a fallback of 8,000 characters. Legacy name kept for backwards compatibility -`TASK_MAX_OUTPUT_LENGTH`| Maximum number of characters in [subagent](</docs/en/sub-agents>) output before truncation (default: 32000, maximum: 160000). When truncated, the full output is saved to disk and the path is included in the truncated response +`TASK_MAX_OUTPUT_LENGTH`| Maximum number of characters of a [background task’s](</docs/en/tools-reference#background-commands>) output that the `TaskOutput` tool keeps (default: 32000; maximum: 160000). If you set the [`taskOutputMaxChars`](</docs/en/settings-reference#taskoutputmaxchars>) setting, Claude Code ignores this variable `USE_BUILTIN_RIPGREP`| Set to `0` to use system-installed `rg` instead of `rg` included with Claude Code `VERTEX_REGION_CLAUDE_3_5_HAIKU`| Override region for Claude 3.5 Haiku when using Google Cloud’s Agent Platform `VERTEX_REGION_CLAUDE_3_5_SONNET`| Override region for Claude 3.5 Sonnet when using Google Cloud’s Agent Platform @@ -488,6 +488,7 @@ * Use [Remote Control](</docs/en/remote-control#requirements>) * [Message sessions beyond this machine](</docs/en/cross-session-messaging#message-sessions-on-other-machines>); messaging between sessions on this machine works with fetching off * Run [`claude import` or the `/import` command](</docs/en/cli-reference#cli-commands>) + * Run [`/skill-doctor`](</docs/en/skills#find-unused-skills>) or open its report in the `/plugin` **Stats** tab * Use [the advisor tool](</docs/en/advisor#requirements>) * Read or reply to [comments on an artifact](</docs/en/artifacts#collect-comments-on-an-artifact>) * Get the [v2 MCP client runtime](</docs/en/mcp#mcp-client-runtimes>) and its protocol probe without setting `MCP_SDK_GENERATION` and `MCP_PROTOCOL_NEGOTIATION`; Claude Code uses the v1 runtime unless you set `MCP_SDK_GENERATION=v2`, and skips the probe unless you set `MCP_PROTOCOL_NEGOTIATION=auto`
modified
--- a/env-vars.md +++ b/env-vars.md @@ -232,7 +232,7 @@ `CLAUDE_CODE_DISABLE_MOUSE`| Set to `1` to disable mouse tracking in [fullscreen rendering](</docs/en/fullscreen>). Keyboard scrolling with `PgUp` and `PgDn` still works. Use this to keep your terminal’s native copy-on-select behavior `CLAUDE_CODE_DISABLE_MOUSE_CLICKS`| Set to `1` to disable click, drag, and hover handling in [fullscreen rendering](</docs/en/fullscreen>) while keeping mouse-wheel scrolling. Use this when you want wheel scroll to work inside Claude Code but don’t want clicks to position the cursor, expand tool output, or open links. `CLAUDE_CODE_DISABLE_MOUSE` takes precedence when both are set. Requires Claude Code v2.1.195 or later `CLAUDE_CODE_DISABLE_MTLS_RELOAD_ON_STALE_CONNECTION`| Set to `1` to stop Claude Code from re-reading the [mTLS client certificate and key](</docs/en/network-config#mtls-authentication>) when an API request fails with a connection-level error, such as a connection reset or a TLS handshake error. With the reload disabled, Claude Code loads rotated files only when it next applies settings or at the next startup. Requires Claude Code v2.1.232 or later -`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`| Set to any non-empty value, such as `1`, to disable nonessential network traffic: auto-updates, telemetry, error reporting, the `/feedback` command, [Claude-drafted feedback](</docs/en/tools-reference#sendfeedback-tool-behavior>), release notes, [gateway model discovery](</docs/en/llm-gateway-connect#add-gateway-models-to-the-model-picker>) refreshes, and availability checks such as the [fast mode](</docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways>) check. It also stops the [background runs of plugin `command` sources](</docs/en/plugin-marketplaces#when-claude-code-re-runs-the-command>), which are local commands rather than network traffic, because they can trigger dependency installs. **Setting it to`0` or `false` still disables this traffic**, unlike most on/off variables; unset the variable to allow it again. Also disables feature-flag fetching, which makes [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable. Official plugin marketplace auto-install isn’t covered; disable it with `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL` +`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`| Set to any non-empty value, such as `1`, to disable nonessential network traffic: auto-updates, telemetry, error reporting, the `/feedback` command, [Claude-drafted feedback](</docs/en/tools-reference#sendfeedback-tool-behavior>), release notes, the [PR and MR status badge](</docs/en/interactive-mode#pr-review-status>) checks, [gateway model discovery](</docs/en/llm-gateway-connect#add-gateway-models-to-the-model-picker>) refreshes, and availability checks such as the [fast mode](</docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways>) check. It also stops the [background runs of plugin `command` sources](</docs/en/plugin-marketplaces#when-claude-code-re-runs-the-command>), which are local commands rather than network traffic, because they can trigger dependency installs. **Setting it to`0` or `false` still disables this traffic**, unlike most on/off variables; unset the variable to allow it again. Also disables feature-flag fetching, which makes [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable. Official plugin marketplace auto-install isn’t covered; disable it with `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL` `CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK`| Set to `1` to disable the non-streaming fallback when a streaming request fails mid-stream. Streaming errors propagate to the retry layer instead. Useful when a proxy or gateway causes the fallback to produce duplicate tool execution `CLAUDE_CODE_DISABLE_NOTIFICATION_PRESENCE_CHECK`| Set to `1` to send the `PushNotification` tool’s desktop notification even while you are typing in or focused on the terminal. By default the tool skips both the desktop notification and the [mobile push](</docs/en/remote-control#mobile-push-notifications>) when it detects recent keyboard activity or terminal focus. This variable disables only that local check, so the server can still suppress the mobile push when it detects that you are active. Requires Claude Code v2.1.193 or later `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL`| Set to `1` to disable automatic registration of the official plugin marketplace. Claude Code reads the variable when it is about to register the marketplace, usually during a machine’s first interactive launch. If the variable is set at that point, Claude Code skips the registration permanently. Unsetting the variable later doesn’t undo the skip. Run `claude plugin marketplace add anthropics/claude-plugins-official` to register the marketplace at any time @@ -342,8 +342,8 @@ `CLAUDE_CODE_SKIP_PROMPT_HISTORY`| Set to `1` to skip writing prompt history and session transcripts to disk. Sessions started with this variable set do not appear in `--resume`, `--continue`, or up-arrow history. Useful for ephemeral scripted sessions `CLAUDE_CODE_SKIP_VERTEX_AUTH`| Skip Google authentication for Google Cloud’s Agent Platform (for example, when using an LLM gateway) `CLAUDE_CODE_STOP_HOOK_BLOCK_CAP`| Maximum number of consecutive times a [Stop](</docs/en/hooks#stop>) or [SubagentStop](</docs/en/hooks#subagentstop>) hook may block the turn from ending before Claude Code overrides it and ends the turn anyway (default: 8). Set to `0` to disable the cap. Raise this if your hook legitimately needs more iterations to resolve -`CLAUDE_CODE_SUBAGENT_MODEL`| The default model for [subagents](</docs/en/sub-agents#choose-a-model>), [agent team](</docs/en/agent-teams#specify-teammates-and-models>) teammates, and [workflow](</docs/en/workflows>) agents that aren’t assigned a model another way. Accepts an alias such as `haiku` or a full model name. Two sources take precedence over it: a model Claude passes when it spawns the agent, and a `model` field in the agent’s definition, including `inherit`. To change that, set [`CLAUDE_CODE_SUBAGENT_MODEL_FORCE`](</docs/en/sub-agents#choose-a-model>). See [Choose a model](</docs/en/sub-agents#choose-a-model>) for the full order. Setting it to `inherit` is the same as leaving it unset. Before v2.1.251, this variable overrode both the per-invocation model and the definition’s `model` field -`CLAUDE_CODE_SUBAGENT_MODEL_FORCE`| Set to `1` to force one model onto subagents, teammates, and workflow agents. [Choose a model](</docs/en/sub-agents#choose-a-model>) says which model that is. Requires Claude Code v2.1.257 or later +`CLAUDE_CODE_SUBAGENT_MODEL`| The default model for [subagents](</docs/en/sub-agents#choose-a-model>), [agent team](</docs/en/agent-teams#specify-teammates-and-models>) teammates, and [workflow](</docs/en/workflows>) agents that aren’t assigned a model another way. Accepts an alias such as `haiku` or a full model name. Two sources take precedence over it: a model Claude passes when it spawns the agent, and a `model` field in the agent’s definition, including `inherit`. To change that, set [`CLAUDE_CODE_SUBAGENT_MODEL_FORCE`](</docs/en/sub-agents#run-every-subagent-on-one-model>). See [Choose a model](</docs/en/sub-agents#choose-a-model>) for the full order. Setting it to `inherit` is the same as leaving it unset. Before v2.1.251, this variable overrode both the per-invocation model and the definition’s `model` field +`CLAUDE_CODE_SUBAGENT_MODEL_FORCE`| Set to `1` to force one model onto subagents, teammates, and workflow agents. [Run every subagent on one model](</docs/en/sub-agents#run-every-subagent-on-one-model>) says which model that is. Requires Claude Code v2.1.257 or later `CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL`| Set `5m` or `1h`, the only values Claude Code accepts, to choose the [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) for requests outside the main conversation, such as [subagents](</docs/en/sub-agents>), workflows, and background work. Takes precedence over the `subagentPromptCacheTtl` setting and over `ENABLE_PROMPT_CACHING_1H`, and `FORCE_PROMPT_CACHING_5M` overrides it. The API bills 1-hour cache writes at a higher rate. Requires Claude Code v2.1.242 or later `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB`| Set to `1` to strip credentials from subprocess environments (Bash tool, hooks, MCP stdio servers): Anthropic and cloud provider credentials, any other variable that Claude Code recognizes as a credential, and credentials embedded in package registry URLs. The parent Claude process keeps these credentials for API calls, but child processes cannot read them, reducing exposure to prompt injection attacks that attempt to exfiltrate secrets via shell expansion. On Linux, this also runs Bash subprocesses in an isolated PID namespace so they cannot read host process environments via `/proc`; as a side effect, `ps`, `pgrep`, and `kill` cannot see or signal host processes. `claude-code-action` sets this automatically when `allowed_non_write_users` is configured `CLAUDE_CODE_SYNC_PLUGIN_INSTALL`| Set to `1` in non-interactive mode (the `-p` flag) to wait for plugin installation to complete before the first query. Without this, plugins install in the background and may not be available on the first turn. Combine with `CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS` to bound the wait @@ -490,7 +490,6 @@ * Run [`claude import` or the `/import` command](</docs/en/cli-reference#cli-commands>) * Use [the advisor tool](</docs/en/advisor#requirements>) * Read or reply to [comments on an artifact](</docs/en/artifacts#collect-comments-on-an-artifact>) - * Have Claude Code refresh the [PR review status badge](</docs/en/interactive-mode#pr-review-status>) less often while you’re idle; Claude Code refreshes it every 60 seconds instead * Get the [v2 MCP client runtime](</docs/en/mcp#mcp-client-runtimes>) and its protocol probe without setting `MCP_SDK_GENERATION` and `MCP_PROTOCOL_NEGOTIATION`; Claude Code uses the v1 runtime unless you set `MCP_SDK_GENERATION=v2`, and skips the probe unless you set `MCP_PROTOCOL_NEGOTIATION=auto` * Get the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) by default for claude.ai and Console accounts on Windows with Git Bash installed; Claude Code routes shell commands through Git Bash unless you set `CLAUDE_CODE_USE_POWERSHELL_TOOL=1`. On Windows without Git Bash, the tool stays on * Get [Claude-drafted feedback](</docs/en/tools-reference#sendfeedback-tool-behavior>), which Claude Code turns on through a fetched flag
modified
--- a/env-vars.md +++ b/env-vars.md @@ -129,7 +129,7 @@ `ANTHROPIC_CUSTOM_MODEL_OPTION_DESCRIPTION`| Display description for the custom model entry in the `/model` picker. Defaults to `Custom model (<model-id>)` when not set `ANTHROPIC_CUSTOM_MODEL_OPTION_NAME`| Display name for the custom model entry in the `/model` picker. Defaults to the model ID when not set `ANTHROPIC_CUSTOM_MODEL_OPTION_SUPPORTED_CAPABILITIES`| Comma-separated list of [capabilities](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) the custom model supports, for example `effort,thinking`. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) -`ANTHROPIC_DEFAULT_FABLE_MODEL`| Model ID that the `fable` alias resolves to, and the ID Claude Code recognizes as Fable 5 for [automatic model fallback](</docs/en/model-config#automatic-model-fallback>) on third-party providers. See [Model configuration](</docs/en/model-config#environment-variables>) +`ANTHROPIC_DEFAULT_FABLE_MODEL`| Model ID that the `fable` alias resolves to, and the ID Claude Code recognizes as a Fable model for [automatic model fallback](</docs/en/model-config#automatic-model-fallback>) on third-party providers. See [Model configuration](</docs/en/model-config#environment-variables>) `ANTHROPIC_DEFAULT_FABLE_MODEL_DESCRIPTION`| Display description for the pinned Fable model in the `/model` picker. Defaults to `Custom Fable model` when not set. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) `ANTHROPIC_DEFAULT_FABLE_MODEL_NAME`| Display name for the pinned Fable model in the `/model` picker. Defaults to the model ID when not set. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) `ANTHROPIC_DEFAULT_FABLE_MODEL_SUPPORTED_CAPABILITIES`| Comma-separated list of [capabilities](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) the pinned Fable model supports, for example `effort,thinking`. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) @@ -172,7 +172,7 @@ `CLAUDE_AFK_TIMEOUT_MS`| How many milliseconds of idle time before an unanswered [`AskUserQuestion`](</docs/en/tools-reference>) dialog auto-continues without you. Auto-continue is off by default; opt in with the [`askUserQuestionTimeout`](</docs/en/settings-reference#askuserquestiontimeout>) setting. This variable is an override for demos and automated tests: when set, it takes precedence over that setting and turns auto-continue on even when the setting is unset or `never`. Setting `0` doesn’t turn the timeout off; it closes the dialog immediately. In v2.1.198 and v2.1.199, auto-continue was on by default with a `60000` (60 seconds) timeout. Requires Claude Code v2.1.198 or later `CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS`| Set to `1` to disable all built-in [subagent](</docs/en/sub-agents>) types such as Explore and Plan. Only applies in non-interactive mode (the `-p` flag). Useful for SDK users who want a blank slate. This also removes `general-purpose`, the subagent Claude Code runs when an Agent tool call omits `subagent_type`. Such a call then fails with [`subagent_type is required`](</docs/en/errors#subagent-type-is-required>) `CLAUDE_AGENT_SDK_MCP_NO_PREFIX`| Set to `1` to skip the `mcp__<server>__` prefix on tool names from SDK-created MCP servers. Tools use their original names. SDK usage only -`CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS`| Stall timeout in milliseconds for background subagents. Default `600000` (10 minutes). The timer resets on each streaming progress event; if no progress arrives within the window, the subagent is aborted and the task is marked failed, surfacing any partial result to the parent +`CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS`| Stall timeout in milliseconds for subagents. Default `600000` (10 minutes); if you raise `CLAUDE_STREAM_IDLE_TIMEOUT_MS` while the stream watchdog is on, the default rises with it, as [Handle slow or stalled API responses](</docs/en/agent-sdk/typescript#handle-slow-or-stalled-api-responses>) describes. The timer resets on each streaming progress event; if no progress arrives within the window, Claude Code aborts the subagent and reports the stall to the parent `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE`| Set the percentage (1-100) of the auto-compact window at which auto-compaction triggers. Use lower values like `50` to compact earlier; the variable can’t raise the threshold, so values above the default percentage are ignored. It applies only in sessions that [compact before the model’s context limit](</docs/en/model-config#context-window-and-auto-compaction>). Applies to both main conversations and subagents `CLAUDE_AUTO_BACKGROUND_TASKS`| Set to `1` to force-enable automatic backgrounding of long-running agent tasks. When enabled, subagents are moved to the background after running for approximately two minutes. Also enables [automatic backgrounding of long MCP tool calls](</docs/en/mcp#automatic-backgrounding-of-long-tool-calls>) in non-interactive mode on Claude Code v2.1.212 or later `CLAUDE_AX_PREPARK_MS`| In [screen reader mode](</docs/en/accessibility#what-your-screen-reader-hears>), how many milliseconds Claude Code waits, with the cursor at the start of the line, before it writes a new or changed line. Default `50`. Set `0` to write immediately. Claude Code caps the wait at `5000`. Requires Claude Code v2.1.233 or later @@ -204,8 +204,8 @@ `CLAUDE_CODE_CONNECT_TIMEOUT_MS`| Removed in v2.1.186 and now a no-op. Previously set a separate timeout for the connect, TLS, and response-header phase of a streaming API request. Use `API_TIMEOUT_MS` for the per-request timeout. For the response-header phase of a streaming request, see `CLAUDE_STREAM_FIRST_BYTE_TIMEOUT_MS` `CLAUDE_CODE_DEBUG_LOGS_DIR`| Override the debug log file path. Despite the name, this is a file path, not a directory. Requires debug mode to be enabled separately via `--debug`, `/debug`, or the `DEBUG` environment variable: setting this variable alone does not enable logging. The [`--debug-file`](</docs/en/cli-reference#cli-flags>) flag does both at once. Defaults to `~/.claude/debug/<session-id>.txt` `CLAUDE_CODE_DEBUG_LOG_LEVEL`| Minimum log level written to the debug log file. Values: `verbose`, `debug` (default), `info`, `warn`, `error`. Set to `verbose` to include high-volume diagnostics like full status line command output, or raise to `error` to reduce noise -`CLAUDE_CODE_DISABLE_1M_CONTEXT`| Set to `1` to disable [1M context window](</docs/en/model-config#extended-context>) support. When set, 1M model variants are unavailable in the model picker, and Claude Code holds sessions on models with a native 1M window, such as [Sonnet 5](</docs/en/model-config#sonnet-5-context-window>) and Fable 5, to a 200K window; see [Extended context](</docs/en/model-config#extended-context>) for how the hold is enforced. Useful for enterprise environments with compliance requirements. For its role in correcting the window for an unrecognized `[1m]` model ID, see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>) -`CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING`| Set to `1` to disable [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) on Opus 4.6 and Sonnet 4.6 and fall back to the fixed thinking budget controlled by `MAX_THINKING_TOKENS`. Has no effect on Fable 5, Sonnet 5, or Opus 4.7 and later, which always use adaptive reasoning +`CLAUDE_CODE_DISABLE_1M_CONTEXT`| Set to `1` to disable [1M context window](</docs/en/model-config#extended-context>) support. When set, 1M model variants are unavailable in the model picker, and Claude Code holds sessions on models with a native 1M window, such as [Sonnet 5](</docs/en/model-config#sonnet-5-context-window>) and the Fable models, to a 200K window; see [Extended context](</docs/en/model-config#extended-context>) for how the hold is enforced. Useful for enterprise environments with compliance requirements. For its role in correcting the window for an unrecognized `[1m]` model ID, see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>) +`CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING`| Set to `1` to disable [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) on Opus 4.6 and Sonnet 4.6 and fall back to the fixed thinking budget controlled by `MAX_THINKING_TOKENS`. Has no effect on [Fable models](</docs/en/model-config#extended-thinking>), Sonnet 5, or Opus 4.7 and later, which always use adaptive reasoning `CLAUDE_CODE_DISABLE_ADMIN_ENV_UNION`| Set to `1` to stop Claude Code from merging [managed settings](</docs/en/managed-settings#precedence-within-the-managed-tier>) `env` blocks per key across admin sources, so only the highest-priority source’s whole `env` block applies, as before v2.1.223. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.223 or later `CLAUDE_CODE_DISABLE_ADVISOR_TOOL`| Set to `1` to disable the [advisor tool](</docs/en/advisor>). The `/advisor` command becomes unavailable, any configured `advisorModel` is ignored, and the `--advisor` flag is accepted but has no effect, so existing scripts that pass it continue to work without errors `CLAUDE_CODE_DISABLE_AGENT_VIEW`| Set to `1` to turn off [background agents and agent view](</docs/en/agent-view>): `claude agents`, `--bg`, `/background`, and the on-demand supervisor. Equivalent to the [`disableAgentView`](</docs/en/settings-reference#disableagentview>) setting @@ -219,6 +219,7 @@ `CLAUDE_CODE_DISABLE_BG_EXIT_HANDOFF`| Set to `1` to stop a [background session’s](</docs/en/agent-view>) running background shell commands, dynamic workflows, and, as of v2.1.198, background subagents when the [supervisor](</docs/en/agent-view#the-supervisor-process>) stops, restarts, or updates that session’s process, instead of handing them to the session’s next process. Affects only that handoff: backgrounding a session with `←` or [`/background`](</docs/en/agent-view#from-inside-a-session>) still carries in-flight work over, and `CLAUDE_DISABLE_ADOPT` turns off both. Requires Claude Code v2.1.196 or later `CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP`| Set to `1` to stop Claude Code from terminating [background shell commands](</docs/en/interactive-mode#background-bash-commands>) when the operating system reports memory pressure. By default, on macOS and Linux, Claude Code terminates a background shell started in the main session on a memory-pressure signal once the session has been idle for 30 minutes and no turn or subagent is running. Windows has no memory-pressure signal, so this variable has no effect there. Requires Claude Code v2.1.193 or later `CLAUDE_CODE_DISABLE_BUNDLED_SKILLS`| Set to `1` to disable the [skills](</docs/en/skills>) and workflows included with Claude Code: bundled skills and workflows are removed entirely, while built-in commands like `/init` stay typable but are hidden from the model. `/doctor` stays typable like the built-in commands; hide it with `DISABLE_DOCTOR_COMMAND` instead. Skills from plugins, `.claude/skills/`, and `.claude/commands/` are unaffected. Equivalent to the [`disableBundledSkills`](</docs/en/settings-reference#disablebundledskills>) setting +`CLAUDE_CODE_DISABLE_CFC_PROMPT`| Set to `1` to keep the [Claude in Chrome](</docs/en/chrome>) browser tools available while omitting the Chrome section of the system prompt and the `/claude-in-chrome` [bundled skill](</docs/en/skills#bundled-skills>). For hosts that embed Claude Code and supply their own browser guidance. Requires Claude Code v2.1.257 or later `CLAUDE_CODE_DISABLE_CLAUDE_MDS`| Set to `1` to prevent loading any CLAUDE.md memory files into context, including user, project, and auto memory files `CLAUDE_CODE_DISABLE_CRON`| Set to `1` to disable [scheduled tasks](</docs/en/scheduled-tasks>). The `/loop` skill and cron tools become unavailable and any already-scheduled tasks stop firing, including tasks that are already running mid-session `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`| Set to `1` to strip Anthropic-specific `anthropic-beta` request headers and beta tool-schema fields (such as `defer_loading` and `eager_input_streaming`) from API requests. Use this when a proxy gateway rejects requests with errors like “Unexpected value(s) for the `anthropic-beta` header” or “Extra inputs are not permitted”. Standard fields (`name`, `description`, `input_schema`, `cache_control`) are preserved. [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) is disabled and all MCP tools load upfront, even when you set `ENABLE_TOOL_SEARCH`. On Claude Code v2.1.227 or later, [managed settings](</docs/en/managed-settings>) can keep tool search on. [Disable pre-release capabilities](</docs/en/llm-gateway-protocol#disable-pre-release-capabilities>) covers where the override applies @@ -238,7 +239,7 @@ `CLAUDE_CODE_DISABLE_PERMISSION_PROMPT_NOTIFY_HOOKS`| Set to `1` to stop Claude Code from running your [`Notification` hooks for unanswered permission requests](</docs/en/hooks#notification>) in sessions where Claude Code sends them to the Agent SDK’s `canUseTool` callback, which is how Claude Desktop and the VS Code extension host Claude Code. Has no effect in terminal sessions. Requires Claude Code v2.1.233 or later `CLAUDE_CODE_DISABLE_POLICY_SKILLS`| Set to `1` to skip loading skills from the system-wide managed skills directory. Useful for container or CI sessions that should not load operator-provisioned skills `CLAUDE_CODE_DISABLE_TERMINAL_TITLE`| Set to `1` to disable automatic terminal title updates based on conversation context. In Agent SDK and `claude -p` sessions, this also skips the background small/fast-model request that generates the session title -`CLAUDE_CODE_DISABLE_THINKING`| Set to `1` to omit the `thinking` parameter from API requests entirely. This is a compatibility option for proxies and gateways that reject the parameter. The variable’s behavior is unchanged from earlier versions; on models that think by default, omitting the parameter means the model may still think. To explicitly disable [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) on the Anthropic API, use `MAX_THINKING_TOKENS=0` instead, which is also ineffective on Fable 5 since it cannot have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `0` likewise omits the parameter, so the two variables behave the same there +`CLAUDE_CODE_DISABLE_THINKING`| Set to `1` to omit the `thinking` parameter from API requests entirely. This is a compatibility option for proxies and gateways that reject the parameter. The variable’s behavior is unchanged from earlier versions; on models that think by default, omitting the parameter means the model may still think. To explicitly disable [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) on the Anthropic API, use `MAX_THINKING_TOKENS=0` instead, which is also ineffective on [Fable models](</docs/en/model-config#extended-thinking>) since they can’t have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `0` likewise omits the parameter, so the two variables behave the same there `CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT`| Set to `1` to skip proactive [auto-compaction](</docs/en/costs#reduce-token-usage>) when Claude Code doesn’t recognize the model ID, such as an [LLM gateway](</docs/en/llm-gateway>) alias. Without this variable, Claude Code compacts at the context window it assumes for the ID. `CLAUDE_CODE_MAX_CONTEXT_TOKENS` can correct the assumed window instead; see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>) for when each variable applies. Requires Claude Code v2.1.223 or later `CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL`| Set to `1` to disable virtual scrolling in [fullscreen rendering](</docs/en/fullscreen>) and render every message in the transcript. Use this if scrolling in fullscreen mode shows blank regions where messages should appear `CLAUDE_CODE_DISABLE_WORKFLOWS`| Set to `1` to disable [workflows](</docs/en/workflows#turn-workflows-off>). Equivalent to the [`disableWorkflows`](</docs/en/settings-reference#disableworkflows>) setting @@ -341,9 +342,10 @@ `CLAUDE_CODE_SKIP_PROMPT_HISTORY`| Set to `1` to skip writing prompt history and session transcripts to disk. Sessions started with this variable set do not appear in `--resume`, `--continue`, or up-arrow history. Useful for ephemeral scripted sessions `CLAUDE_CODE_SKIP_VERTEX_AUTH`| Skip Google authentication for Google Cloud’s Agent Platform (for example, when using an LLM gateway) `CLAUDE_CODE_STOP_HOOK_BLOCK_CAP`| Maximum number of consecutive times a [Stop](</docs/en/hooks#stop>) or [SubagentStop](</docs/en/hooks#subagentstop>) hook may block the turn from ending before Claude Code overrides it and ends the turn anyway (default: 8). Set to `0` to disable the cap. Raise this if your hook legitimately needs more iterations to resolve -`CLAUDE_CODE_SUBAGENT_MODEL`| The default model for [subagents](</docs/en/sub-agents#choose-a-model>), [agent team](</docs/en/agent-teams#specify-teammates-and-models>) teammates, and [workflow](</docs/en/workflows>) agents that aren’t assigned a model another way. Accepts an alias such as `haiku` or a full model name. Two sources take precedence over it: a model Claude passes when it spawns the agent, and a `model` field in the agent’s definition, including `inherit`. See [Choose a model](</docs/en/sub-agents#choose-a-model>) for the full order. Setting it to `inherit` is the same as leaving it unset. Before v2.1.251, this variable overrode both the per-invocation model and the definition’s `model` field +`CLAUDE_CODE_SUBAGENT_MODEL`| The default model for [subagents](</docs/en/sub-agents#choose-a-model>), [agent team](</docs/en/agent-teams#specify-teammates-and-models>) teammates, and [workflow](</docs/en/workflows>) agents that aren’t assigned a model another way. Accepts an alias such as `haiku` or a full model name. Two sources take precedence over it: a model Claude passes when it spawns the agent, and a `model` field in the agent’s definition, including `inherit`. To change that, set [`CLAUDE_CODE_SUBAGENT_MODEL_FORCE`](</docs/en/sub-agents#choose-a-model>). See [Choose a model](</docs/en/sub-agents#choose-a-model>) for the full order. Setting it to `inherit` is the same as leaving it unset. Before v2.1.251, this variable overrode both the per-invocation model and the definition’s `model` field +`CLAUDE_CODE_SUBAGENT_MODEL_FORCE`| Set to `1` to force one model onto subagents, teammates, and workflow agents. [Choose a model](</docs/en/sub-agents#choose-a-model>) says which model that is. Requires Claude Code v2.1.257 or later `CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL`| Set `5m` or `1h`, the only values Claude Code accepts, to choose the [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) for requests outside the main conversation, such as [subagents](</docs/en/sub-agents>), workflows, and background work. Takes precedence over the `subagentPromptCacheTtl` setting and over `ENABLE_PROMPT_CACHING_1H`, and `FORCE_PROMPT_CACHING_5M` overrides it. The API bills 1-hour cache writes at a higher rate. Requires Claude Code v2.1.242 or later -`CLAUDE_CODE_SUBPROCESS_ENV_SCRUB`| Set to `1` to strip Anthropic and cloud provider credentials from subprocess environments (Bash tool, hooks, MCP stdio servers). The parent Claude process keeps these credentials for API calls, but child processes cannot read them, reducing exposure to prompt injection attacks that attempt to exfiltrate secrets via shell expansion. On Linux, this also runs Bash subprocesses in an isolated PID namespace so they cannot read host process environments via `/proc`; as a side effect, `ps`, `pgrep`, and `kill` cannot see or signal host processes. `claude-code-action` sets this automatically when `allowed_non_write_users` is configured +`CLAUDE_CODE_SUBPROCESS_ENV_SCRUB`| Set to `1` to strip credentials from subprocess environments (Bash tool, hooks, MCP stdio servers): Anthropic and cloud provider credentials, any other variable that Claude Code recognizes as a credential, and credentials embedded in package registry URLs. The parent Claude process keeps these credentials for API calls, but child processes cannot read them, reducing exposure to prompt injection attacks that attempt to exfiltrate secrets via shell expansion. On Linux, this also runs Bash subprocesses in an isolated PID namespace so they cannot read host process environments via `/proc`; as a side effect, `ps`, `pgrep`, and `kill` cannot see or signal host processes. `claude-code-action` sets this automatically when `allowed_non_write_users` is configured `CLAUDE_CODE_SYNC_PLUGIN_INSTALL`| Set to `1` in non-interactive mode (the `-p` flag) to wait for plugin installation to complete before the first query. Without this, plugins install in the background and may not be available on the first turn. Combine with `CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS` to bound the wait `CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS`| Timeout in milliseconds for synchronous plugin installation. When exceeded, Claude Code proceeds without plugins and logs an error. No default: without this variable, synchronous installation waits until complete `CLAUDE_CODE_SYNC_SKILLS`| Set to `1` to download your enabled claude.ai skills into `~/.claude/skills/synced/` and resync every 10 minutes. Before it runs the first query, Claude Code waits up to `CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS` for the list of your skills. The downloads themselves finish in the background, and Claude waits for a skill’s download when it invokes that skill. The `synced` folder name is [reserved for this download](</docs/en/skills#where-skills-live>). Before v2.1.227, the skills downloaded into `~/.claude/skills/` directly. Applies only in non-interactive mode with the `-p` flag. Requires claude.ai authentication. [Claude Code on the web](</docs/en/claude-code-on-the-web>) sessions receive your enabled claude.ai skills automatically; you don’t need to set this there. Claude Code applies [extra rules to the downloaded skills](</docs/en/skills#how-synced-skills-behave>), such as not running their `!` commands on your machine @@ -356,7 +358,7 @@ `CLAUDE_CODE_TMUX_TRUECOLOR`| Set to any non-empty value, such as `1`, to allow 24-bit truecolor output inside tmux. **Setting it to`0` or `false` still allows truecolor**, unlike most on/off variables; unset the variable to restore the 256-color clamp. By default, Claude Code clamps to 256 colors when `$TMUX` is set because tmux does not pass through truecolor escape sequences unless configured to. Set this after adding `set -ga terminal-overrides ',*:Tc'` to your `~/.tmux.conf`. See [Terminal configuration](</docs/en/terminal-config>) for other tmux settings `CLAUDE_CODE_TOOL_MEMORY_CGROUP_EXCLUDE`| On Linux and WSL, set to a comma-separated list of the kinds of processes Claude Code [excludes from the tool memory cap](</docs/en/tools-reference#memory-limit-on-linux-and-wsl>), such as `mcp` or `lsp`. Set `none` to cap every kind, or `all-new` to cap only Bash, PowerShell, and Monitor tool commands. Claude Code keeps Bash, PowerShell, and Monitor tool commands under the cap whatever you list. Requires Claude Code v2.1.246 or later `CLAUDE_CODE_TOOL_MEMORY_LIMIT`| On Linux and WSL, set to a size such as `4G` to [cap the memory that Bash and PowerShell tool commands can use](</docs/en/tools-reference#memory-limit-on-linux-and-wsl>), and Monitor tool commands on v2.1.246 or later. Write the size in plain digits, alone for a number of bytes or with a `K`, `M`, `G`, or `T` suffix. Set `0` or `off` to turn the cap off. Once the first process Claude Code starts has turned the cap on or off, a changed value takes effect the next time you launch `claude`. Requires Claude Code v2.1.233 or later -`CLAUDE_CODE_USER_DIALOG_TIMEOUT_MS`| Deadline in milliseconds for dialogs Claude Code forwards to a remote client, such as a [Remote Control](</docs/en/remote-control>) or SDK host, and for the approval dialog for a [held cross-session message](</docs/en/cross-session-messaging#control-inbound-messages>), before Claude Code cancels them; permission prompts and `AskUserQuestion` questions use their own flows and aren’t governed by it. Also bounds the mid-session [Fable 5 usage-credits consent prompt](</docs/en/model-config#fable-5-and-usage-credits>) in a session that may be running unattended. [Control inbound messages](</docs/en/cross-session-messaging#control-inbound-messages>) and [non-interactive sessions](</docs/en/cross-session-messaging#non-interactive-sessions>) cover the full held-message expiry rules, including the cases where the deadline doesn’t apply. Overrides the [`dialogExpiry`](</docs/en/settings-reference#dialogexpiry>) setting; `0` or a negative value disables the deadline +`CLAUDE_CODE_USER_DIALOG_TIMEOUT_MS`| Deadline in milliseconds for dialogs Claude Code forwards to a remote client, such as a [Remote Control](</docs/en/remote-control>) or SDK host, and for the approval dialog for a [held cross-session message](</docs/en/cross-session-messaging#control-inbound-messages>), before Claude Code cancels them; permission prompts and `AskUserQuestion` questions use their own flows and aren’t governed by it. Also bounds the mid-session [Fable usage-credits consent prompt](</docs/en/model-config#fable-and-usage-credits>) in a session that may be running unattended. [Control inbound messages](</docs/en/cross-session-messaging#control-inbound-messages>) and [non-interactive sessions](</docs/en/cross-session-messaging#non-interactive-sessions>) cover the full held-message expiry rules, including the cases where the deadline doesn’t apply. Overrides the [`dialogExpiry`](</docs/en/settings-reference#dialogexpiry>) setting; `0` or a negative value disables the deadline `CLAUDE_CODE_USE_ANTHROPIC_AWS`| Use [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) `CLAUDE_CODE_USE_BEDROCK`| Use [Amazon Bedrock](</docs/en/amazon-bedrock>) `CLAUDE_CODE_USE_FOUNDRY`| Use [Microsoft Foundry](</docs/en/microsoft-foundry>) @@ -407,7 +409,7 @@ `ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) instead of the default 5 minutes. Intended for API key, [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), [Microsoft Foundry](</docs/en/microsoft-foundry>), and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) users. Subscription users within included usage receive the 1-hour TTL automatically on the [main conversation](</docs/en/prompt-caching#which-ttl-each-request-gets>). Subscription users drawing on [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>) can set it to keep the 1-hour TTL. 1-hour cache writes are billed at a higher rate. To choose the TTL per request bucket instead, use `CLAUDE_CODE_PROMPT_CACHE_TTL` and `CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL`, which take precedence over this variable `ENABLE_PROMPT_CACHING_1H_BEDROCK`| Deprecated. Use `ENABLE_PROMPT_CACHING_1H` instead `ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset, Claude Code defers all MCP tools by default. It still loads them upfront on Google Cloud’s Agent Platform models earlier than the Claude 4.5 generation, on a Microsoft Foundry deployment hosted on Azure, and when `ANTHROPIC_BASE_URL` points to a non-first-party host. `true` always defers and sends the beta header, except on those same Agent Platform models and Microsoft Foundry deployments; requests fail on proxies that don’t support `tool_reference`. `auto` loads upfront when tool definitions fit within 10% of context. `auto:N` sets a custom threshold, such as `auto:5` for 5%. `false` loads all tools upfront. A value you set yourself is ignored when `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS` is set. Before v2.1.221, Claude Code disabled tool search for all models on Google Cloud’s Agent Platform unless you set this variable to `true` -`FALLBACK_FOR_ALL_PRIMARY_MODELS`| Set to any non-empty value, such as `1`, to make every model stop retrying with a repeated-overload error when no fallback model is configured. **Setting it to`0` or `false` still enables this**, unlike most on/off variables; unset the variable to restore the default retry behavior. Without it, models Claude Code recognizes as Opus, Fable 5, or Mythos models stop retrying this way when you authenticate with an API key or a [third-party provider](</docs/en/third-party-integrations>) rather than a Claude subscription. As of v2.1.160, a configured [fallback model chain](</docs/en/model-config#fallback-model-chains>) triggers on repeated overload errors for any primary model, so this variable does not affect switching to a fallback model +`FALLBACK_FOR_ALL_PRIMARY_MODELS`| Set to any non-empty value, such as `1`, to make every model stop retrying with a repeated-overload error when no fallback model is configured. **Setting it to`0` or `false` still enables this**, unlike most on/off variables; unset the variable to restore the default retry behavior. Without it, models Claude Code recognizes as Opus, Fable, or Mythos models stop retrying this way when you authenticate with an API key or a [third-party provider](</docs/en/third-party-integrations>) rather than a Claude subscription. As of v2.1.160, a configured [fallback model chain](</docs/en/model-config#fallback-model-chains>) triggers on repeated overload errors for any primary model, so this variable does not affect switching to a fallback model `FORCE_AUTOUPDATE_PLUGINS`| Set to `1` to force plugin auto-updates even when the main auto-updater is disabled via `DISABLE_AUTOUPDATER` `FORCE_HYPERLINK`| Set to `1` to enable clickable OSC 8 hyperlinks when your terminal supports them but isn’t auto-detected, or `0` to disable them. When unset, Claude Code enables hyperlinks only when it detects terminal support. Claude Code parses this value as a number, not a Boolean, so a value such as `false`, `no`, or `off` enables hyperlinks rather than disabling them. Claude Code renders the footer [PR or merge request badge](</docs/en/interactive-mode#pr-review-status>) as a hyperlink even when it can’t detect terminal support, such as over SSH. Set `0` to render the badge as plain text `FORCE_PROMPT_CACHING_5M`| Set to `1` to force the 5-minute prompt cache TTL even when 1-hour TTL would otherwise apply. Overrides `CLAUDE_CODE_PROMPT_CACHE_TTL`, `CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL`, `ENABLE_PROMPT_CACHING_1H`, and the `promptCacheTtl` and `subagentPromptCacheTtl` settings @@ -416,7 +418,7 @@ `IS_DEMO`| Set to any non-empty value, such as `1`, to enable demo mode: hides your email and organization name from the header and `/status` output, and skips onboarding. **Setting it to`0` or `false` still enables demo mode**, unlike most on/off variables; unset the variable to turn it off. Useful when streaming or recording a session `MAX_MCP_OUTPUT_TOKENS`| Maximum number of tokens allowed in MCP tool responses. Claude Code displays a warning when output exceeds 10,000 tokens. Tools that declare [`anthropic/maxResultSizeChars`](</docs/en/mcp#raise-the-limit-for-a-specific-tool>) use that character limit for text content instead, but image content from those tools is still subject to this variable (default: 25000) `MAX_STRUCTURED_OUTPUT_RETRIES`| Number of times Claude Code retries when the model’s response fails validation against the [`--json-schema`](</docs/en/cli-reference#cli-flags>) in non-interactive mode with the `-p` flag. The same retry count applies when a [workflow](</docs/en/workflows>) subagent’s structured output fails validation. Defaults to 5 -`MAX_THINKING_TOKENS`| Fixed token budget for [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>). Claude Code caps it at one token below the request’s max output tokens and never below 1,024; see `CLAUDE_CODE_MAX_OUTPUT_TOKENS` for how that limit is set. When unset and thinking is enabled, models with [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) choose their own thinking depth, and other models use the cap. Set to `0` to disable thinking on the Anthropic API, except on Fable 5, which cannot have thinking turned off; on [third-party providers](</docs/en/third-party-integrations>), `0` omits the `thinking` parameter instead. With thinking turned off on the Anthropic API, Claude Code sends effort `high` instead of a higher level to models it knows [don’t accept that combination](</docs/en/errors#effort-isnt-available-with-thinking-turned-off>), such as Opus 5. Nonzero values are ignored on adaptive reasoning models unless `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` is set +`MAX_THINKING_TOKENS`| Fixed token budget for [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>). Claude Code caps it at one token below the request’s max output tokens and never below 1,024; see `CLAUDE_CODE_MAX_OUTPUT_TOKENS` for how that limit is set. When unset and thinking is enabled, models with [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) choose their own thinking depth, and other models use the cap. Set to `0` to disable thinking on the Anthropic API, except on [Fable models](</docs/en/model-config#extended-thinking>), which can’t have thinking turned off; on [third-party providers](</docs/en/third-party-integrations>), `0` omits the `thinking` parameter instead. With thinking turned off on the Anthropic API, Claude Code sends effort `high` instead of a higher level to models it knows [don’t accept that combination](</docs/en/errors#effort-isnt-available-with-thinking-turned-off>), such as Opus 5. Nonzero values are ignored on adaptive reasoning models unless `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` is set `MCP_CLIENT_SECRET`| OAuth client secret for MCP servers that require [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>). Avoids the interactive prompt when adding a server with `--client-secret` `MCP_CONNECTION_NONBLOCKING`| Controls whether startup waits for MCP servers to connect before the first query. MCP startup is non-blocking by default: servers connect in the background and their tools become available as they finish. Set to `0` to make Claude Code wait for servers to connect before the first query. Servers configured with [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>) still make startup wait regardless, except when served from the [discovery cache](</docs/en/mcp#server-status-detail>), since their tools must be present when the first prompt is built. In non-interactive mode (`-p`), Claude Code also waits for still-pending servers before the first turn regardless of this variable, with a longer deadline when you pass [`--mcp-config`](</docs/en/cli-reference#cli-flags>) explicitly; see that flag’s entry for the cached-server exception `MCP_CONNECT_TIMEOUT_MS`| How long blocking MCP startup waits, in milliseconds, for the connection batch before snapshotting the tool list (default: 5000). Applies when `MCP_CONNECTION_NONBLOCKING=0` or for servers marked [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>). Servers still pending at the deadline keep connecting in the background. Distinct from `MCP_TIMEOUT`, which bounds an individual server’s connect attempt @@ -461,6 +463,7 @@ `VERTEX_REGION_CLAUDE_5_OPUS`| Override region for Claude Opus 5 when using Google Cloud’s Agent Platform. Added in v2.1.219 `VERTEX_REGION_CLAUDE_5_SONNET`| Override region for Claude Sonnet 5 when using Google Cloud’s Agent Platform. Added in v2.1.197 `VERTEX_REGION_CLAUDE_FABLE_5`| Override region for Claude Fable 5 when using Google Cloud’s Agent Platform. Added in v2.1.170 +`VERTEX_REGION_CLAUDE_FABLE_5_1`| Override region for Claude Fable 5.1 when using Google Cloud’s Agent Platform. Added in v2.1.255 `VERTEX_REGION_CLAUDE_HAIKU_4_5`| Override region for Claude Haiku 4.5 when using Google Cloud’s Agent Platform Standard OpenTelemetry exporter variables (`OTEL_METRICS_EXPORTER`, `OTEL_LOGS_EXPORTER`, `OTEL_EXPORTER_OTLP_ENDPOINT`, `OTEL_EXPORTER_OTLP_PROTOCOL`, `OTEL_EXPORTER_OTLP_HEADERS`, `OTEL_METRIC_EXPORT_INTERVAL`, `OTEL_RESOURCE_ATTRIBUTES`, and signal-specific variants) are also supported. See [Monitoring](</docs/en/monitoring-usage>) for configuration details.
modified
--- a/env-vars.md +++ b/env-vars.md @@ -124,7 +124,7 @@ `ANTHROPIC_BEDROCK_REGION_PREFIX`| Cross-region inference profile prefix (`us`, `eu`, `apac`, `jp`, `au`, or `global`) Claude Code tries first instead of the one derived from the AWS region. Ignored in AWS GovCloud regions. Requires Claude Code v2.1.224 or later. See [Amazon Bedrock](</docs/en/amazon-bedrock#cross-region-inference-profile-prefixes>) `ANTHROPIC_BEDROCK_SERVICE_TIER`| Amazon Bedrock [service tier](<https://docs.aws.amazon.com/bedrock/latest/userguide/service-tiers-inference.html>) (`default`, `flex`, or `priority`). Sent as the `X-Amzn-Bedrock-Service-Tier` header. See [Amazon Bedrock](</docs/en/amazon-bedrock#service-tiers>) `ANTHROPIC_BETAS`| Comma-separated list of additional `anthropic-beta` header values to include in API requests. Claude Code already sends the beta headers it needs; use this to opt into an [Anthropic API beta](<https://platform.claude.com/docs/en/api/beta-headers>) before Claude Code adds native support. Unlike the [`--betas` flag](</docs/en/cli-reference#cli-flags>), which requires API key authentication, this variable works with all auth methods including Claude.ai subscription -`ANTHROPIC_CUSTOM_HEADERS`| Custom headers to add to requests (`Name: Value` format, newline-separated for multiple headers). If a name or value contains a character an HTTP header can’t carry, such as a curly quote or a zero-width space, Claude Code fails the request with an error that identifies the pair by position. Requires Claude Code v2.1.227 or later. [Invalid request header value](</docs/en/errors#invalid-request-header-value>) lists the exact character set and where the check runs +`ANTHROPIC_CUSTOM_HEADERS`| Custom headers to add to requests (`Name: Value` format, newline-separated for multiple headers). If a name or value contains a character an HTTP header can’t carry, such as a curly quote or a zero-width space, the request fails with an error that identifies the pair by position. Requires Claude Code v2.1.227 or later. [Invalid request header value](</docs/en/errors#invalid-request-header-value>) lists the exact character set and where the check runs. A value that sets a credential, org or tenant, routing, or API-behavior header, such as `Authorization` or `Host`, counts as a [setting that needs approval](</docs/en/server-managed-settings#environment-variables-and-the-approval-dialog>) when server-managed settings deliver it. From project or local settings, such a value follows the [rules for when `env` values apply](</docs/en/settings-reference#when-claude-code-applies-env-values>) `ANTHROPIC_CUSTOM_MODEL_OPTION`| Model ID to add as a custom entry in the `/model` picker. Use this to make a non-standard or gateway-specific model selectable without replacing built-in aliases. See [Model configuration](</docs/en/model-config#add-a-custom-model-option>) `ANTHROPIC_CUSTOM_MODEL_OPTION_DESCRIPTION`| Display description for the custom model entry in the `/model` picker. Defaults to `Custom model (<model-id>)` when not set `ANTHROPIC_CUSTOM_MODEL_OPTION_NAME`| Display name for the custom model entry in the `/model` picker. Defaults to the model ID when not set @@ -191,7 +191,7 @@ `CLAUDE_CODE_ARTIFACT_COMMENTS_AUTOREACT`| Set to `0` to stop Claude [replying on its own to comments sent to it](</docs/en/artifacts#let-claude-reply-to-comments-on-its-own>). Requires Claude Code v2.1.228 or later `CLAUDE_CODE_ATTRIBUTION_HEADER`| Set to `0` to omit the [attribution block](</docs/en/llm-gateway-protocol#system-prompt-attribution-block>), which carries the client version and a prompt fingerprint, from the start of the system prompt. Caching on a direct connection to the Anthropic API is unaffected either way. In some direct-connection setups, Claude Code keeps the block on [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) classifier requests even when you set `0`. In [System prompt attribution block](</docs/en/llm-gateway-protocol#system-prompt-attribution-block>), check which connections and credentials this covers. Before v2.1.181 the block included a per-request token on custom base URLs and Microsoft Foundry connections, so on those versions set it to `0` when your LLM gateway caches on the request body or forwards requests to a third-party provider, or when you connect to Microsoft Foundry directly `CLAUDE_CODE_AUTO_BACKGROUND_WORKER_CHECKIN_SECONDS`| When `CLAUDE_AUTO_BACKGROUND_TASKS` is enabled, seconds between reminders to Claude to check on [background subagents](</docs/en/sub-agents#run-subagents-in-foreground-or-background>) that are still running. Accepts a plain integer from `1` to `86400` only; any other value or spelling reads as unset. When unset, there are no check-in reminders. Requires Claude Code v2.1.248 or later -`CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the [auto-compact window](</docs/en/model-config#set-the-auto-compact-window>) in tokens, from `100000` to `1000000`. Accepts a plain integer such as `500000` only: a value like `500k` reads as `500` and clamps to the 100K minimum. Takes precedence over the `/autocompact` command, the `--autocompact` flag, and the `autoCompactWindow` setting. The status line’s `used_percentage` always measures against the model’s full context window, so once this variable is set, that percentage no longer indicates when compaction will run +`CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the [auto-compact window](</docs/en/model-config#set-the-auto-compact-window>) in tokens, from `100000` to `1000000`. Accepts a plain integer such as `500000` only: a value like `500k` reads as `500` and clamps to the 100K minimum. The effective window is also capped at the model’s context window. Takes precedence over the `/autocompact` command, the `--autocompact` flag, and the `autoCompactWindow` setting. The status line’s `used_percentage` always measures against the model’s full context window, so once this variable is set, that percentage no longer indicates when compaction will run `CLAUDE_CODE_AUTO_CONNECT_IDE`| Override automatic [IDE connection](</docs/en/vs-code>). By default, Claude Code connects automatically when launched inside a supported IDE’s integrated terminal. Set to `false` to prevent this. Set to `true` to force a connection attempt when auto-detection fails, such as when tmux obscures the parent terminal. Takes precedence over the [`autoConnectIde`](</docs/en/settings-reference#autoconnectide>) global config setting `CLAUDE_CODE_AWS_CHAIN_RESOLVE_TIMEOUT_MS`| Time in milliseconds Claude Code waits for the AWS default credential provider chain to produce credentials before the request fails with [`AWS default-chain credential resolve timed out`](</docs/en/errors#aws-default-chain-credential-resolve-timed-out>) (default: `60000`). Raise it when a step in your chain legitimately needs longer, such as a browser-based SSO sign-in with MFA through a wrapper like `aws-vault`. Applies wherever Claude Code signs with the default chain: [Amazon Bedrock](</docs/en/amazon-bedrock#credential-caching-and-resolution-timeout>), [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), and the [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>). Requires Claude Code v2.1.207 or later `CLAUDE_CODE_BRIDGE_SESSION_ID`| Set automatically in Bash tool and [hook command](</docs/en/hooks>) subprocesses while the session has an active [Remote Control](</docs/en/remote-control>) connection, and removed when the connection ends. The value is the session’s ID in `session_` form, the same identifier that appears in the session’s `claude.ai/code` URL, so a script can link back to the session that ran it. Requires Claude Code v2.1.199 or later. In [cloud sessions](</docs/en/claude-code-on-the-web>), read `CLAUDE_CODE_REMOTE_SESSION_ID` instead @@ -398,7 +398,7 @@ `DISABLE_PROMPT_CACHING_HAIKU`| Set to `1` to disable prompt caching for Haiku models `DISABLE_PROMPT_CACHING_OPUS`| Set to `1` to disable prompt caching for Opus models `DISABLE_PROMPT_CACHING_SONNET`| Set to `1` to disable prompt caching for Sonnet models -`DISABLE_TELEMETRY`| Set to any non-empty value, such as `1`, to opt out of telemetry. **Setting it to`0` or `false` still opts out**, unlike most on/off variables; unset the variable to turn telemetry back on. Telemetry events do not include user data like code, file paths, or bash commands. Also disables feature-flag fetching with the same effect as `DISABLE_GROWTHBOOK`, which makes [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable. See [Turn telemetry off for your organization](</docs/en/managed-settings#turn-telemetry-off-for-your-organization>) +`DISABLE_TELEMETRY`| Set to any non-empty value, such as `1`, to opt out of telemetry. **Setting it to`0` or `false` still opts out**, unlike most on/off variables; unset the variable to turn telemetry back on. Telemetry events don’t include user data like code, file paths, or bash commands. Also disables feature-flag fetching with the same effect as `DISABLE_GROWTHBOOK`, which makes [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable. See [Turn telemetry off for your organization](</docs/en/managed-settings#turn-telemetry-off-for-your-organization>) `DISABLE_UPDATES`| Set to `1` to block all updates including manual `claude update` and `claude install`. Stricter than `DISABLE_AUTOUPDATER`. Use when distributing Claude Code through your own channels and users should not self-update `DISABLE_UPGRADE_COMMAND`| Set to `1` to hide the `/upgrade` command `DO_NOT_TRACK`| Set to `1` to opt out of telemetry, with the same effect as `DISABLE_TELEMETRY`, including making [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable. Claude Code reads this variable as a standard boolean, so `0` leaves telemetry on, and honors it as the cross-tool convention recognized by many developer CLIs @@ -483,8 +483,8 @@ * Have the VS Code extension [read settings files for the starting permission mode](</docs/en/permission-modes#switch-permission-modes>) * Run [`/auto-mode-setup`](</docs/en/auto-mode-config#generate-environment-entries>) to draft `autoMode.environment` entries * Use [Remote Control](</docs/en/remote-control#requirements>) + * [Message sessions beyond this machine](</docs/en/cross-session-messaging#message-sessions-on-other-machines>); messaging between sessions on this machine works with fetching off * Run [`claude import` or the `/import` command](</docs/en/cli-reference#cli-commands>) - * Create routines from the CLI with [`/schedule`](</docs/en/routines#troubleshooting>) * Use [the advisor tool](</docs/en/advisor#requirements>) * Read or reply to [comments on an artifact](</docs/en/artifacts#collect-comments-on-an-artifact>) * Have Claude Code refresh the [PR review status badge](</docs/en/interactive-mode#pr-review-status>) less often while you’re idle; Claude Code refreshes it every 60 seconds instead
modified
Show diff (126 lines)
--- a/env-vars.md +++ b/env-vars.md @@ -90,7 +90,7 @@ Precedence -Some behaviors have both an environment variable and a dedicated settings key, and which one Claude Code reads first differs per key. For `ANTHROPIC_MODEL` and `CLAUDE_CODE_AUTO_CONNECT_IDE`, Claude Code reads the variable first and uses the `model` or `autoConnectIde` setting only when the variable is unset. For the pair you’re setting, check the variable’s row below and the key’s entry on the [settings reference](</docs/en/settings-reference>). When the same variable is set in both your shell and a settings file `env` block, the settings file value applies. Claude Code writes each `env` entry into the process environment, replacing the value inherited from the shell. The [`env` setting](</docs/en/settings-reference#when-claude-code-applies-env-values>) says when it applies them. A few variables are special-cased; the [`env` setting](</docs/en/settings-reference#env>) lists the exceptions. In a settings file you can set a variable but you can’t remove one. To override a variable you can’t unset, such as a stale `CLAUDE_CODE_USE_VERTEX` exported by a shell profile you don’t control, set it to an empty string in the `env` block: `"CLAUDE_CODE_USE_VERTEX": ""`. Claude Code treats the empty value as unset for provider selection. Subprocesses still inherit the empty value. Between settings files, `env` values follow [settings precedence](</docs/en/settings#settings-precedence>), so a managed settings entry overrides the same variable in user or project settings. How an environment variable interacts with CLI flags and in-session commands varies per feature: `--model` and `/model` override `ANTHROPIC_MODEL`, while `CLAUDE_CODE_EFFORT_LEVEL` overrides `/effort`. When a variable interacts with another configuration source, its row in the Variables list states the precedence or links to the page that documents it. Claude Code reads shell environment variables at startup, so changes to them take effect the next time you launch `claude`. Variables set under the `env` key in settings files are reapplied to a running session when the file changes, with the startup-only exception described in In settings files. +Some behaviors have both an environment variable and a dedicated settings key, and which one Claude Code reads first differs per key. For `ANTHROPIC_MODEL` and `CLAUDE_CODE_AUTO_CONNECT_IDE`, Claude Code reads the variable first and uses the `model` or `autoConnectIde` setting only when the variable is unset. For the pair you’re setting, check the variable’s row below and the key’s entry on the [settings reference](</docs/en/settings-reference>). When the same variable is set in both your shell and a settings file `env` block, the settings file value applies. Claude Code writes each `env` entry into the process environment, replacing the value inherited from the shell. The [`env` setting](</docs/en/settings-reference#when-claude-code-applies-env-values>) says when it applies them. A few variables are special-cased; the [`env` setting](</docs/en/settings-reference#env>) lists the exceptions. In a settings file you can set a variable but you can’t remove one. To override a variable you can’t unset, such as a stale `CLAUDE_CODE_USE_VERTEX` exported by a shell profile you don’t control, set it to an empty string in the `env` block: `"CLAUDE_CODE_USE_VERTEX": ""`. Claude Code treats the empty value as unset for provider selection. Subprocesses still inherit the empty value. Between settings files, `env` values follow [settings precedence](</docs/en/settings#settings-precedence>), so a managed settings entry overrides the same variable in user or project settings. How an environment variable interacts with CLI flags and in-session commands varies per feature: `--model` and `/model` override `ANTHROPIC_MODEL`, while `CLAUDE_CODE_EFFORT_LEVEL` overrides `--effort` and `/effort`. When a variable interacts with another configuration source, its row in the Variables list states the precedence or links to the page that documents it. Claude Code reads shell environment variables at startup, so changes to them take effect the next time you launch `claude`. Variables set under the `env` key in settings files are reapplied to a running session when the file changes, with the startup-only exception described in In settings files. ## @@ -153,7 +153,7 @@ `ANTHROPIC_FOUNDRY_RESOURCE`| Microsoft Foundry resource name (for example, `my-resource`). Required if `ANTHROPIC_FOUNDRY_BASE_URL` is not set (see [Microsoft Foundry](</docs/en/microsoft-foundry>)) `ANTHROPIC_MODEL`| Name of the model setting to use (see [Model Configuration](</docs/en/model-config#environment-variables>)) `ANTHROPIC_ORGANIZATION_ID`| Organization ID for [Workload Identity Federation](<https://platform.claude.com/docs/en/manage-claude/workload-identity-federation>). Set it together with `ANTHROPIC_FEDERATION_RULE_ID`. See [authentication precedence](</docs/en/authentication#authentication-precedence>) -`ANTHROPIC_PROFILE`| Name of the Anthropic profile to authenticate with, such as one created by [`ant auth login`](<https://platform.claude.com/docs/en/cli-sdks-libraries/cli/authentication>). The named profile ranks above your `/login` credential. See [authentication precedence](</docs/en/authentication#authentication-precedence>) +`ANTHROPIC_PROFILE`| Name of the Anthropic profile to authenticate with, such as one created by [`ant auth login`](<https://platform.claude.com/docs/en/cli-sdks-libraries/cli/authentication>) or by [signing in to a Console account without an API key](</docs/en/authentication#sign-in-without-an-api-key>). See [authentication precedence](</docs/en/authentication#authentication-precedence>) `ANTHROPIC_SMALL_FAST_MODEL`| [DEPRECATED] Name of [Haiku-class model for background tasks](</docs/en/costs>) `ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION`| Override AWS region for the Haiku-class model when using Amazon Bedrock or Amazon Bedrock Mantle. On Amazon Bedrock, this only takes effect when `ANTHROPIC_DEFAULT_HAIKU_MODEL` or the deprecated `ANTHROPIC_SMALL_FAST_MODEL` is also set, since Amazon Bedrock otherwise runs background tasks on the [default Sonnet model or the primary model](</docs/en/amazon-bedrock#4-pin-model-versions>) in the session region `ANTHROPIC_VERTEX_BASE_URL`| Override Google Cloud’s Agent Platform endpoint URL. Use for custom Google Cloud’s Agent Platform endpoints or when routing through an [LLM gateway](</docs/en/llm-gateway>). See [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>) @@ -165,6 +165,7 @@ `BASH_DEFAULT_TIMEOUT_MS`| Default timeout for long-running bash commands (default: 120000, or 2 minutes) `BASH_MAX_OUTPUT_LENGTH`| Maximum number of characters of bash output that Claude Code reads back into a command’s result (default: 30000; maximum: 150000). See [Output limits](</docs/en/tools-reference#output-limits>) `BASH_MAX_TIMEOUT_MS`| Maximum timeout the model can set for long-running bash commands (default: 600000, or 10 minutes). The effective ceiling is the larger of this and `BASH_DEFAULT_TIMEOUT_MS` +`BETA_TRACING_ENDPOINT`| OTLP endpoint for [detailed beta tracing](</docs/en/monitoring-usage#traces-beta>): with `ENABLE_BETA_TRACING_DETAILED=1`, logs and traces go there instead of to the configured exporters. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) `CCR_FORCE_BUNDLE`| Set to `1` to force [`claude --cloud`](</docs/en/claude-code-on-the-web#send-local-repositories-without-github>) to bundle and upload your local repository even when GitHub access is available `CLAUDECODE`| Set to `1` in subprocesses Claude Code spawns (Bash and PowerShell tools, tmux sessions, [hook](</docs/en/hooks>) commands, [status line](</docs/en/statusline>) commands, stdio [MCP server](</docs/en/mcp>) subprocesses). IDE extensions also set this in their integrated terminals. Use to detect when a script is running inside a subprocess spawned by Claude Code. To check whether the current process was spawned directly by a tool call or hook, rather than inside a stdio MCP server that Claude Code started, use `CLAUDE_CODE_CHILD_SESSION` instead `CLAUDE_AFK_COUNTDOWN_MS`| How many milliseconds before auto-continue the on-screen countdown appears on an unanswered [`AskUserQuestion`](</docs/en/tools-reference>) dialog. Default `20000` (20 seconds), capped at the auto-continue timeout. Has no effect unless auto-continue is on; see the [`askUserQuestionTimeout`](</docs/en/settings-reference#askuserquestiontimeout>) setting and `CLAUDE_AFK_TIMEOUT_MS`. Requires Claude Code v2.1.198 or later @@ -189,6 +190,7 @@ `CLAUDE_CODE_ARTIFACT_COMMENTS`| Set to `0` to stop Claude reading and replying to [comments on an artifact](</docs/en/artifacts#collect-comments-on-an-artifact>). Has no effect when `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` has [turned artifacts off](</docs/en/artifacts#availability>). Requires Claude Code v2.1.221 or later `CLAUDE_CODE_ARTIFACT_COMMENTS_AUTOREACT`| Set to `0` to stop Claude [replying on its own to comments sent to it](</docs/en/artifacts#let-claude-reply-to-comments-on-its-own>). Requires Claude Code v2.1.228 or later `CLAUDE_CODE_ATTRIBUTION_HEADER`| Set to `0` to omit the [attribution block](</docs/en/llm-gateway-protocol#system-prompt-attribution-block>), which carries the client version and a prompt fingerprint, from the start of the system prompt. Caching on a direct connection to the Anthropic API is unaffected either way. In some direct-connection setups, Claude Code keeps the block on [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) classifier requests even when you set `0`. In [System prompt attribution block](</docs/en/llm-gateway-protocol#system-prompt-attribution-block>), check which connections and credentials this covers. Before v2.1.181 the block included a per-request token on custom base URLs and Microsoft Foundry connections, so on those versions set it to `0` when your LLM gateway caches on the request body or forwards requests to a third-party provider, or when you connect to Microsoft Foundry directly +`CLAUDE_CODE_AUTO_BACKGROUND_WORKER_CHECKIN_SECONDS`| When `CLAUDE_AUTO_BACKGROUND_TASKS` is enabled, seconds between reminders to Claude to check on [background subagents](</docs/en/sub-agents#run-subagents-in-foreground-or-background>) that are still running. Accepts a plain integer from `1` to `86400` only; any other value or spelling reads as unset. When unset, there are no check-in reminders. Requires Claude Code v2.1.248 or later `CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the [auto-compact window](</docs/en/model-config#set-the-auto-compact-window>) in tokens, from `100000` to `1000000`. Accepts a plain integer such as `500000` only: a value like `500k` reads as `500` and clamps to the 100K minimum. Takes precedence over the `/autocompact` command, the `--autocompact` flag, and the `autoCompactWindow` setting. The status line’s `used_percentage` always measures against the model’s full context window, so once this variable is set, that percentage no longer indicates when compaction will run `CLAUDE_CODE_AUTO_CONNECT_IDE`| Override automatic [IDE connection](</docs/en/vs-code>). By default, Claude Code connects automatically when launched inside a supported IDE’s integrated terminal. Set to `false` to prevent this. Set to `true` to force a connection attempt when auto-detection fails, such as when tmux obscures the parent terminal. Takes precedence over the [`autoConnectIde`](</docs/en/settings-reference#autoconnectide>) global config setting `CLAUDE_CODE_AWS_CHAIN_RESOLVE_TIMEOUT_MS`| Time in milliseconds Claude Code waits for the AWS default credential provider chain to produce credentials before the request fails with [`AWS default-chain credential resolve timed out`](</docs/en/errors#aws-default-chain-credential-resolve-timed-out>) (default: `60000`). Raise it when a step in your chain legitimately needs longer, such as a browser-based SSO sign-in with MFA through a wrapper like `aws-vault`. Applies wherever Claude Code signs with the default chain: [Amazon Bedrock](</docs/en/amazon-bedrock#credential-caching-and-resolution-timeout>), [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), and the [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>). Requires Claude Code v2.1.207 or later @@ -212,8 +214,8 @@ `CLAUDE_CODE_DISABLE_ATTACHMENTS`| Set to `1` to disable attachment processing. File mentions with `@` syntax are sent as plain text instead of being expanded into file content `CLAUDE_CODE_DISABLE_AUTO_MEMORY`| Set to `1` to disable [auto memory](</docs/en/memory#auto-memory>). Set to `0` to force auto memory on even when `--bare` mode or [`autoMemoryEnabled: false`](</docs/en/settings-reference#automemoryenabled>) would otherwise disable it. When disabled, Claude does not create or load auto memory files `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 -`CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_DEFAULT`| Set to `1` to stop Claude Code from treating an [Amazon Bedrock](</docs/en/amazon-bedrock>) streaming response with a missing or empty `Content-Type` header as the binary `application/vnd.amazon.eventstream` format. Amazon Bedrock always sends that header, so when it’s absent, a [proxy stripped it](</docs/en/amazon-bedrock#streaming-errors-behind-a-gateway-or-proxy>) and by default Claude Code decodes the body as the binary format anyway. Set this variable only when the proxy strips the header and also re-emits the body as server-sent events; Claude Code then reads the body as server-sent events instead. Requires Claude Code v2.1.239 or later -`CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_GUARD`| Set to `1` to skip the check that an [Amazon Bedrock](</docs/en/amazon-bedrock>) streaming response carries the `application/vnd.amazon.eventstream` content-type. Without this variable, a response with a different content-type fails with an error naming that content-type, which means a [gateway or proxy is transforming the response](</docs/en/amazon-bedrock#streaming-errors-behind-a-gateway-or-proxy>). Set it only when the gateway rewrites the `Content-Type` header but passes the binary event-stream body through unmodified; if the body itself was transformed, requests fail with `Truncated event message received` instead. Requires Claude Code v2.1.208 or later +`CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_DEFAULT`| Set to `1` to stop Claude Code from treating an [Amazon Bedrock](</docs/en/amazon-bedrock>) streaming response with a missing or empty `Content-Type` header as Amazon Bedrock’s binary event stream. By default, Claude Code assumes a gateway dropped the header from an otherwise unmodified response, so it decodes the body and streaming keeps working. Set this only for a gateway that also re-emits the stream as server-sent events; Claude Code then reads the header-less body as server-sent events instead. Requires Claude Code v2.1.239 or later +`CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_GUARD`| Set to `1` to skip the check that an [Amazon Bedrock](</docs/en/amazon-bedrock>) streaming response carries the `application/vnd.amazon.eventstream` content-type. Without this variable, when a response carries a different content-type, Claude Code fails the request with an error naming that type, which means a [gateway or proxy is transforming the response](</docs/en/amazon-bedrock#streaming-errors-behind-a-gateway-or-proxy>). Configure the gateway to forward the `Content-Type` header and body unmodified rather than setting this variable. Requires Claude Code v2.1.208 or later `CLAUDE_CODE_DISABLE_BG_EXIT_HANDOFF`| Set to `1` to stop a [background session’s](</docs/en/agent-view>) running background shell commands, dynamic workflows, and, as of v2.1.198, background subagents when the [supervisor](</docs/en/agent-view#the-supervisor-process>) stops, restarts, or updates that session’s process, instead of handing them to the session’s next process. Affects only that handoff: backgrounding a session with `←` or [`/background`](</docs/en/agent-view#from-inside-a-session>) still carries in-flight work over, and `CLAUDE_DISABLE_ADOPT` turns off both. Requires Claude Code v2.1.196 or later `CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP`| Set to `1` to stop Claude Code from terminating [background shell commands](</docs/en/interactive-mode#background-bash-commands>) when the operating system reports memory pressure. By default, on macOS and Linux, Claude Code terminates a background shell started in the main session on a memory-pressure signal once the session has been idle for 30 minutes and no turn or subagent is running. Windows has no memory-pressure signal, so this variable has no effect there. Requires Claude Code v2.1.193 or later `CLAUDE_CODE_DISABLE_BUNDLED_SKILLS`| Set to `1` to disable the [skills](</docs/en/skills>) and workflows included with Claude Code: bundled skills and workflows are removed entirely, while built-in commands like `/init` stay typable but are hidden from the model. `/doctor` stays typable like the built-in commands; hide it with `DISABLE_DOCTOR_COMMAND` instead. Skills from plugins, `.claude/skills/`, and `.claude/commands/` are unaffected. Equivalent to the [`disableBundledSkills`](</docs/en/settings-reference#disablebundledskills>) setting @@ -240,7 +242,7 @@ `CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT`| Set to `1` to skip proactive [auto-compaction](</docs/en/costs#reduce-token-usage>) when Claude Code doesn’t recognize the model ID, such as an [LLM gateway](</docs/en/llm-gateway>) alias. Without this variable, Claude Code compacts at the context window it assumes for the ID. `CLAUDE_CODE_MAX_CONTEXT_TOKENS` can correct the assumed window instead; see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>) for when each variable applies. Requires Claude Code v2.1.223 or later `CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL`| Set to `1` to disable virtual scrolling in [fullscreen rendering](</docs/en/fullscreen>) and render every message in the transcript. Use this if scrolling in fullscreen mode shows blank regions where messages should appear `CLAUDE_CODE_DISABLE_WORKFLOWS`| Set to `1` to disable [workflows](</docs/en/workflows#turn-workflows-off>). Equivalent to the [`disableWorkflows`](</docs/en/settings-reference#disableworkflows>) setting -`CLAUDE_CODE_EFFORT_LEVEL`| Set the effort level for supported models. Values: `low`, `medium`, `high`, `xhigh`, `max`, or `auto` to use the model default. Available levels depend on the model. Takes precedence over `/effort` and the `effortLevel` setting. See [Adjust effort level](</docs/en/model-config#adjust-effort-level>) +`CLAUDE_CODE_EFFORT_LEVEL`| Set the effort level for supported models. Values: `low`, `medium`, `high`, `xhigh`, `max`, or `auto` to use the model default. Available levels depend on the model. Takes precedence over `--effort`, `/effort`, and the `modelSettings` and `effortLevel` settings. See [Adjust effort level](</docs/en/model-config#adjust-effort-level>) `CLAUDE_CODE_ENABLE_APPEND_SUBAGENT_PROMPT`| Set to `1` to enable appending extra text to the end of the system prompt of every [subagent](</docs/en/sub-agents>) other than a [forked subagent](</docs/en/sub-agents#fork-the-current-conversation>). The [`--append-subagent-system-prompt`](</docs/en/cli-reference#cli-flags>) flag supplies the appended text and sets this variable automatically, so you don’t need to set it yourself. Requires Claude Code v2.1.205 or later `CLAUDE_CODE_ENABLE_AUTO_MODE`| Accepted for compatibility with older releases and has no effect. Auto mode is available by default on every provider, including Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and signed-in [Claude apps gateway](</docs/en/claude-apps-gateway>) sessions. In v2.1.158 through v2.1.206, setting this to `1` was required to make [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) available on those providers `CLAUDE_CODE_ENABLE_AWAY_SUMMARY`| Override [session recap](</docs/en/interactive-mode#session-recap>) availability. Set to `0` to force recaps off regardless of the `/config` toggle. Set to `1` to force recaps on when [`awaySummaryEnabled`](</docs/en/settings-reference#awaysummaryenabled>) is `false`. Takes precedence over the setting and `/config` toggle @@ -305,7 +307,7 @@ `CLAUDE_CODE_PLUGIN_PREFER_HTTPS`| Set to `1` to clone GitHub `owner/repo` shorthand sources over HTTPS instead of SSH. Applies to plugin install and update, and to `/plugin marketplace add` and `update`. Useful in CI runners, containers, or any environment without a configured SSH key for `github.com` `CLAUDE_CODE_PLUGIN_SEED_DIR`| Path to one or more read-only plugin seed directories, separated by `:` on Unix or `;` on Windows. Use this to bundle a pre-populated plugins directory into a container image. Claude Code registers marketplaces from these directories at startup and uses pre-cached plugins without re-cloning. See [Pre-populate plugins for containers](</docs/en/plugin-marketplaces#pre-populate-plugins-for-containers>) `CLAUDE_CODE_POWERSHELL_RESPECT_EXECUTION_POLICY`| Set to `1` to stop Claude Code from passing `-ExecutionPolicy Bypass` when spawning PowerShell for tool calls, hooks, and status line commands, and respect the machine’s effective execution policy instead. By default Claude Code bypasses execution policy at process scope so `.ps1` scripts and module imports work on default-Restricted Windows installs. Process-scope bypass never overrides Group Policy `MachinePolicy` or `UserPolicy` regardless of this setting -`CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS`| Maximum time in milliseconds that [non-interactive mode](</docs/en/headless#background-tasks-at-exit>) with the `-p` flag waits after the final turn for background subagents and workflows whose result is part of the output. Default: `600000`, or 10 minutes. When the cap is exceeded, remaining background tasks are terminated and the process exits. Set to `0` to wait indefinitely. This cap is separate from the five-second grace period that applies to plain background shells +`CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS`| Ceiling in milliseconds on continuous idle waiting after the final turn in [non-interactive mode](</docs/en/headless#background-tasks-at-exit>) with the `-p` flag, while background subagents and workflows whose result is part of the output finish. Each turn that handles queued background results starts the count again. Default: `600000`, or 10 minutes. When idle waiting reaches the ceiling, Claude Code stops waiting for the remaining background tasks and exits. Set to `0` to wait indefinitely. This cap is separate from the five-second grace period that applies to plain background shells. Requires Claude Code v2.1.182 or later `CLAUDE_CODE_PROCESS_WRAPPER`| Launch the processes Claude Code starts from its own binary, such as the background service that hosts [agent view](</docs/en/agent-view>) sessions, through a corporate launcher given as an argv prefix like `/opt/corp/launcher`. Set it in the `env` block of user or [managed settings](</docs/en/managed-settings>), not as a shell export, so the detached background service inherits it; project and local settings can’t set it. Equivalent to the [`processWrapper` setting](</docs/en/settings-reference#processwrapper>), which requires Claude Code v2.1.210 or later; this variable takes precedence when both are set. The VS Code extension configures its own launcher separately through its `claudeProcessWrapper` setting. Ignored on Windows. See [Run Claude Code behind a corporate launcher](</docs/en/corporate-launcher>) for the value format, what the launcher covers, and the contract the launcher must satisfy. Requires Claude Code v2.1.208 or later `CLAUDE_CODE_PROJECT_DIR_NAME`| Set together with `CLAUDE_CONFIG_DIR` to choose the `projects/` directory name Claude Code stores that session’s transcripts and auto memory under, in place of one derived from the working directory path. For example, starting Claude Code with `CLAUDE_CONFIG_DIR=/srv/tenant-a CLAUDE_CODE_PROJECT_DIR_NAME=work claude` stores them under `/srv/tenant-a/projects/work/`. Claude Code ignores this variable when `CLAUDE_CONFIG_DIR` is unset, and reads it only from the environment you start `claude` from, never from a settings file `env` block. See [Name the project directory yourself](</docs/en/sessions#name-the-project-directory-yourself>). Requires Claude Code v2.1.234 or later `CLAUDE_CODE_PROMPT_CACHE_TTL`| Set `5m` or `1h`, the only values Claude Code accepts, to choose the [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) for the main conversation: your interactive, `-p`, and SDK turns, plus the helpers that run inline with them. Takes precedence over the `promptCacheTtl` setting and over `ENABLE_PROMPT_CACHING_1H`, and `FORCE_PROMPT_CACHING_5M` overrides it. The API bills 1-hour cache writes at a higher rate. Requires Claude Code v2.1.242 or later @@ -339,7 +341,7 @@ `CLAUDE_CODE_SKIP_PROMPT_HISTORY`| Set to `1` to skip writing prompt history and session transcripts to disk. Sessions started with this variable set do not appear in `--resume`, `--continue`, or up-arrow history. Useful for ephemeral scripted sessions `CLAUDE_CODE_SKIP_VERTEX_AUTH`| Skip Google authentication for Google Cloud’s Agent Platform (for example, when using an LLM gateway) `CLAUDE_CODE_STOP_HOOK_BLOCK_CAP`| Maximum number of consecutive times a [Stop](</docs/en/hooks#stop>) or [SubagentStop](</docs/en/hooks#subagentstop>) hook may block the turn from ending before Claude Code overrides it and ends the turn anyway (default: 8). Set to `0` to disable the cap. Raise this if your hook legitimately needs more iterations to resolve -`CLAUDE_CODE_SUBAGENT_MODEL`| The model Claude Code uses for all [subagents](</docs/en/sub-agents#choose-a-model>), [agent teams](</docs/en/agent-teams>), and agents in a [workflow](</docs/en/workflows>). Accepts an alias such as `haiku` or a full model name, and takes precedence over the per-invocation `model` parameter and the subagent definition’s `model` frontmatter. See [Model configuration](</docs/en/model-config#environment-variables>). Setting it to `inherit` is the same as leaving it unset; before v2.1.196, `inherit` was an override that forced every subagent onto the main conversation’s model +`CLAUDE_CODE_SUBAGENT_MODEL`| The default model for [subagents](</docs/en/sub-agents#choose-a-model>), [agent team](</docs/en/agent-teams#specify-teammates-and-models>) teammates, and [workflow](</docs/en/workflows>) agents that aren’t assigned a model another way. Accepts an alias such as `haiku` or a full model name. Two sources take precedence over it: a model Claude passes when it spawns the agent, and a `model` field in the agent’s definition, including `inherit`. See [Choose a model](</docs/en/sub-agents#choose-a-model>) for the full order. Setting it to `inherit` is the same as leaving it unset. Before v2.1.251, this variable overrode both the per-invocation model and the definition’s `model` field `CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL`| Set `5m` or `1h`, the only values Claude Code accepts, to choose the [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) for requests outside the main conversation, such as [subagents](</docs/en/sub-agents>), workflows, and background work. Takes precedence over the `subagentPromptCacheTtl` setting and over `ENABLE_PROMPT_CACHING_1H`, and `FORCE_PROMPT_CACHING_5M` overrides it. The API bills 1-hour cache writes at a higher rate. Requires Claude Code v2.1.242 or later `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB`| Set to `1` to strip Anthropic and cloud provider credentials from subprocess environments (Bash tool, hooks, MCP stdio servers). The parent Claude process keeps these credentials for API calls, but child processes cannot read them, reducing exposure to prompt injection attacks that attempt to exfiltrate secrets via shell expansion. On Linux, this also runs Bash subprocesses in an isolated PID namespace so they cannot read host process environments via `/proc`; as a side effect, `ps`, `pgrep`, and `kill` cannot see or signal host processes. `claude-code-action` sets this automatically when `allowed_non_write_users` is configured `CLAUDE_CODE_SYNC_PLUGIN_INSTALL`| Set to `1` in non-interactive mode (the `-p` flag) to wait for plugin installation to complete before the first query. Without this, plugins install in the background and may not be available on the first turn. Combine with `CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS` to bound the wait @@ -350,7 +352,7 @@ `CLAUDE_CODE_SYNTAX_HIGHLIGHT`| Set to `false` to disable syntax highlighting in diff output. Useful when colors interfere with your terminal setup. To also disable highlighting in code blocks and file previews, use the [`syntaxHighlightingDisabled`](</docs/en/settings-reference#syntaxhighlightingdisabled>) setting `CLAUDE_CODE_TASK_LIST_ID`| Share a task list across sessions. Set the same ID in multiple Claude Code instances to coordinate on a shared task list, in [sessions that have the Task tools](</docs/en/tools-reference#task-tool-availability>). See [Task list](</docs/en/interactive-mode#task-list>) `CLAUDE_CODE_TEAM_TEARDOWN_PARK_TIMEOUT_MS`| Override, in milliseconds, how long a non-interactive session waits at exit for its [agent team](</docs/en/agent-teams>) to finish tearing down. Accepts 1000 to 60000; an out-of-range value is ignored and the default of 10000 applies. Requires Claude Code v2.1.206 or later -`CLAUDE_CODE_TMPDIR`| Override the temp directory used for internal temp files. Claude Code appends `/claude-{uid}/` on Unix or `/claude/` on Windows to this path. Default: `/tmp` on macOS, `os.tmpdir()` on Linux and Windows. As of v2.1.161, on macOS and Linux, [sandboxed](</docs/en/sandboxing>) Bash subprocesses receive a short fallback `$TMPDIR` under the system default when your override is a long path, since some tools fail when temp paths get too long. Unsandboxed Bash commands inherit your shell’s `$TMPDIR` unchanged. Claude Code’s own temp files always use your override +`CLAUDE_CODE_TMPDIR`| Override the temp directory used for internal temp files. Claude Code appends `/claude-{uid}/` on Unix or `/claude/` on Windows to this path. Default: `/tmp` on macOS, `os.tmpdir()` on Linux and Windows. As of v2.1.161, on macOS and Linux, [sandboxed](</docs/en/sandboxing>) Bash subprocesses receive a short fallback `$TMPDIR` under the system default when your override is a long path, since some tools fail when temp paths get too long. Unsandboxed Bash commands inherit your shell’s `$TMPDIR` unchanged. Claude Code’s own temp files always use your override. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) `CLAUDE_CODE_TMUX_TRUECOLOR`| Set to any non-empty value, such as `1`, to allow 24-bit truecolor output inside tmux. **Setting it to`0` or `false` still allows truecolor**, unlike most on/off variables; unset the variable to restore the 256-color clamp. By default, Claude Code clamps to 256 colors when `$TMUX` is set because tmux does not pass through truecolor escape sequences unless configured to. Set this after adding `set -ga terminal-overrides ',*:Tc'` to your `~/.tmux.conf`. See [Terminal configuration](</docs/en/terminal-config>) for other tmux settings `CLAUDE_CODE_TOOL_MEMORY_CGROUP_EXCLUDE`| On Linux and WSL, set to a comma-separated list of the kinds of processes Claude Code [excludes from the tool memory cap](</docs/en/tools-reference#memory-limit-on-linux-and-wsl>), such as `mcp` or `lsp`. Set `none` to cap every kind, or `all-new` to cap only Bash, PowerShell, and Monitor tool commands. Claude Code keeps Bash, PowerShell, and Monitor tool commands under the cap whatever you list. Requires Claude Code v2.1.246 or later `CLAUDE_CODE_TOOL_MEMORY_LIMIT`| On Linux and WSL, set to a size such as `4G` to [cap the memory that Bash and PowerShell tool commands can use](</docs/en/tools-reference#memory-limit-on-linux-and-wsl>), and Monitor tool commands on v2.1.246 or later. Write the size in plain digits, alone for a number of bytes or with a `K`, `M`, `G`, or `T` suffix. Set `0` or `off` to turn the cap off. Once the first process Claude Code starts has turned the cap on or off, a changed value takes effect the next time you launch `claude`. Requires Claude Code v2.1.233 or later @@ -364,7 +366,7 @@ `CLAUDE_CODE_USE_VERTEX`| Use [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>) `CLAUDE_CODE_WEBFETCH_CACHE_TTL_MS`| Set to the number of milliseconds [WebFetch](</docs/en/tools-reference#webfetch-tool-behavior>) keeps each fetched URL’s response cached. The default is `900000`, which is 15 minutes. Takes plain digits only; `0`, a decimal, or any other spelling keeps the default. Claude Code reads the value once per launch, so a change in a settings `env` block applies when you next launch `claude`. Requires Claude Code v2.1.233 or later `CLAUDE_CODE_WORKFLOW_PREFIX_STAGGER_MS`| Upper bound in milliseconds on how long a [workflow](</docs/en/workflows>) agent waits for a same-prefix sibling’s first response to begin before sending its own first request. When a fan-out starts several agents that share a [prompt-cache prefix](</docs/en/workflows#prompt-caching-in-a-fan-out>), Claude Code holds all but the first agent for up to this long so the rest read the cached prefix instead of each processing it uncached. Default `5000`. Set to `0` to disable the wait. When `DISABLE_PROMPT_CACHING` is set, agents never wait. Requires Claude Code v2.1.229 or later -`CLAUDE_CONFIG_DIR`| Override the configuration directory (default: `~/.claude`). All settings, session history, and plugins are stored under this path, as are credentials on Linux and Windows; on macOS, credentials are in the system Keychain. Useful for running multiple accounts side by side: for example, `alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'` +`CLAUDE_CONFIG_DIR`| Override the configuration directory (default: `~/.claude`). All settings, session history, and plugins are stored under this path. For credentials, see [where Claude Code stores credentials](</docs/en/authentication#credential-management>). Useful for running multiple accounts side by side: for example, `alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'`. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) `CLAUDE_DISABLE_ADOPT`| Set to `1` to stop in-flight background work instead of carrying it over when you background a session by pressing `←` or with [`/background`](</docs/en/agent-view#from-inside-a-session>). Claude Code asks you to confirm before backgrounding, then stops the tasks that would otherwise carry over. Requires Claude Code v2.1.195 or later `CLAUDE_EFFORT`| Set automatically in Bash tool subprocesses and hook commands to the [effort level](</docs/en/model-config#adjust-effort-level>) in effect when the subprocess starts: `low`, `medium`, `high`, `xhigh`, or `max`. Ultracode is not a distinct level and reports as `xhigh`. Matches the `effort.level` field passed to [hooks](</docs/en/hooks>). Only set when the current model supports the effort parameter `CLAUDE_ENABLE_BYTE_WATCHDOG`| Set to `1` to force-enable the byte-level streaming idle watchdog, or set to `0` to force-disable it. `0` also turns off the [first-byte deadline](</docs/en/network-config#streaming-idle-watchdogs>) on the connections where that deadline runs. When unset, the watchdog is enabled by default for direct Anthropic API and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) connections, and for streaming responses on [gateway](</docs/en/gateways>) connections reached through `ANTHROPIC_BASE_URL` or `ANTHROPIC_AWS_BASE_URL`; before v2.1.222 it didn’t run on those gateway connections, so the event-level watchdog could report a stall there even while keep-alive pings were arriving. For timeouts and how the timers interact, see [Streaming idle watchdogs](</docs/en/network-config#streaming-idle-watchdogs>) @@ -400,6 +402,7 @@ `DISABLE_UPDATES`| Set to `1` to block all updates including manual `claude update` and `claude install`. Stricter than `DISABLE_AUTOUPDATER`. Use when distributing Claude Code through your own channels and users should not self-update `DISABLE_UPGRADE_COMMAND`| Set to `1` to hide the `/upgrade` command `DO_NOT_TRACK`| Set to `1` to opt out of telemetry, with the same effect as `DISABLE_TELEMETRY`, including making [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable. Claude Code reads this variable as a standard boolean, so `0` leaves telemetry on, and honors it as the cross-tool convention recognized by many developer CLIs +`ENABLE_BETA_TRACING_DETAILED`| Set to `1`, together with `BETA_TRACING_ENDPOINT`, to turn on [detailed beta tracing](</docs/en/monitoring-usage#traces-beta>), which adds content-bearing span attributes and the `claude_code.hook` span. Interactive CLI sessions also require your organization to be allowlisted for the beta. Both variables are ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>) `ENABLE_CLAUDEAI_MCP_SERVERS`| Set to `false` to stop Claude Code from fetching [claude.ai MCP servers](</docs/en/mcp#use-mcp-servers-from-claude-ai>). Enabled by default for logged-in users. To disable per-project or per-org, set [`disableClaudeAiConnectors`](</docs/en/settings-reference#disableclaudeaiconnectors>) in settings instead `ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) instead of the default 5 minutes. Intended for API key, [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), [Microsoft Foundry](</docs/en/microsoft-foundry>), and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) users. Subscription users within included usage receive the 1-hour TTL automatically on the [main conversation](</docs/en/prompt-caching#which-ttl-each-request-gets>). Subscription users drawing on [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>) can set it to keep the 1-hour TTL. 1-hour cache writes are billed at a higher rate. To choose the TTL per request bucket instead, use `CLAUDE_CODE_PROMPT_CACHE_TTL` and `CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL`, which take precedence over this variable `ENABLE_PROMPT_CACHING_1H_BEDROCK`| Deprecated. Use `ENABLE_PROMPT_CACHING_1H` instead @@ -431,7 +434,7 @@ `NO_PROXY`| List of domains and IPs to which requests will be directly issued, bypassing proxy `OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`| Standard OpenTelemetry SDK limit on attribute value length. Claude Code caps content-bearing telemetry attributes at the smaller of this and `CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH`, so the truncation marker stays within the SDK limit. Claude Code reads the `OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT` and `OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT` variants the same way, and the smallest set value applies to all signals. Requires Claude Code v2.1.214 or later. See [Monitoring](</docs/en/monitoring-usage#common-configuration-variables>) `OTEL_LOG_ASSISTANT_RESPONSES`| Set to `1` to include the model’s response text on `assistant_response` OpenTelemetry log events. When unset, the value of `OTEL_LOG_USER_PROMPTS` is used instead. Set to `0` to keep responses redacted even when `OTEL_LOG_USER_PROMPTS` is set. Requires Claude Code v2.1.193 or later. See [Monitoring](</docs/en/monitoring-usage#assistant-response-event>) -`OTEL_LOG_RAW_API_BODIES`| Emit Anthropic Messages API request and response JSON as `api_request_body` / `api_response_body` log events. Set to `1` for inline bodies truncated at the content limit, or `file:<dir>` to write untruncated bodies to disk and emit a `body_ref` path instead. `CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH` configures the content limit, 60 KB by default. Disabled by default; bodies include the entire conversation history. See [Monitoring](</docs/en/monitoring-usage#api-request-body-event>) +`OTEL_LOG_RAW_API_BODIES`| Emit Anthropic Messages API request and response JSON as `api_request_body` / `api_response_body` log events. Set to `1` for inline bodies truncated at the content limit, or `file:<dir>` to write untruncated bodies to disk and emit a `body_ref` path instead. `CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH` configures the content limit, 60 KB by default. Disabled by default; bodies include the entire conversation history. Set it in your shell, user settings, or managed settings. Ignored in [project and local settings](</docs/en/settings-reference#variables-claude-code-ignores-in-env>). See [Monitoring](</docs/en/monitoring-usage#api-request-body-event>) `OTEL_LOG_TOOL_CONTENT`| Set to `1` to include tool input and output content in OpenTelemetry span events. Disabled by default to protect sensitive data. See [Monitoring](</docs/en/monitoring-usage>) `OTEL_LOG_TOOL_DETAILS`| Set to `1` to include tool input arguments, MCP server names, user-authored workflow names, raw error strings on tool failures, the refusal `category` on `api_refusal` events, and other tool details in OpenTelemetry traces and logs. Disabled by default to protect PII. See [Monitoring](</docs/en/monitoring-usage>) `OTEL_LOG_USER_PROMPTS`| Set to `1` to include user prompt text in OpenTelemetry traces and logs. Disabled by default (prompts are redacted). See [Monitoring](</docs/en/monitoring-usage>) @@ -488,6 +491,7 @@ * Get the [v2 MCP client runtime](</docs/en/mcp#mcp-client-runtimes>) and its protocol probe without setting `MCP_SDK_GENERATION` and `MCP_PROTOCOL_NEGOTIATION`; Claude Code uses the v1 runtime unless you set `MCP_SDK_GENERATION=v2`, and skips the probe unless you set `MCP_PROTOCOL_NEGOTIATION=auto` * Get the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) by default for claude.ai and Console accounts on Windows with Git Bash installed; Claude Code routes shell commands through Git Bash unless you set `CLAUDE_CODE_USE_POWERSHELL_TOOL=1`. On Windows without Git Bash, the tool stays on * Get [Claude-drafted feedback](</docs/en/tools-reference#sendfeedback-tool-behavior>), which Claude Code turns on through a fetched flag + * Have Claude Code [exclude MCP tools whose input schema the API would reject](</docs/en/mcp#tools-with-invalid-input-schemas>); it sends the schema anyway, and a request that includes it fails with [a 400 error naming the tool by its position](</docs/en/errors#tool-input-schema-is-invalid>) ### @@ -495,7 +499,7 @@ First session after an install or upgrade -In your first session after you install Claude Code, or upgrade to a version that adds a feature, a flag-gated feature can be missing, and a session can start in Manual mode on a plan that otherwise starts in auto mode. Claude Code fetches the flags during that session, so both are there in your next session. After a fresh install, a non-interactive session, such as `claude -p`, the Agent SDK, or the VS Code extension, can pick the flags up before it [chooses its starting permission mode](</docs/en/permission-modes#which-mode-a-session-starts-in>); an interactive terminal session doesn’t. +In your first session after you install Claude Code, or upgrade to a version that adds a feature, a flag-gated feature can be missing, and the session can start in Manual mode on a plan that otherwise starts in auto mode. Claude Code fetches the flags during that session, so both are there in your next session. After a fresh install, in a non-interactive session such as `claude -p`, the Agent SDK, or the VS Code extension, Claude Code can still pick the flags up before it [chooses the starting permission mode](</docs/en/permission-modes#which-mode-a-session-starts-in>). ##
modified
--- a/env-vars.md +++ b/env-vars.md @@ -396,7 +396,7 @@ `DISABLE_PROMPT_CACHING_HAIKU`| Set to `1` to disable prompt caching for Haiku models `DISABLE_PROMPT_CACHING_OPUS`| Set to `1` to disable prompt caching for Opus models `DISABLE_PROMPT_CACHING_SONNET`| Set to `1` to disable prompt caching for Sonnet models -`DISABLE_TELEMETRY`| Set to any non-empty value, such as `1`, to opt out of telemetry. **Setting it to`0` or `false` still opts out**, unlike most on/off variables; unset the variable to turn telemetry back on. Telemetry events do not include user data like code, file paths, or bash commands. Also disables feature-flag fetching with the same effect as `DISABLE_GROWTHBOOK`, which makes [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable +`DISABLE_TELEMETRY`| Set to any non-empty value, such as `1`, to opt out of telemetry. **Setting it to`0` or `false` still opts out**, unlike most on/off variables; unset the variable to turn telemetry back on. Telemetry events do not include user data like code, file paths, or bash commands. Also disables feature-flag fetching with the same effect as `DISABLE_GROWTHBOOK`, which makes [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable. See [Turn telemetry off for your organization](</docs/en/managed-settings#turn-telemetry-off-for-your-organization>) `DISABLE_UPDATES`| Set to `1` to block all updates including manual `claude update` and `claude install`. Stricter than `DISABLE_AUTOUPDATER`. Use when distributing Claude Code through your own channels and users should not self-update `DISABLE_UPGRADE_COMMAND`| Set to `1` to hide the `/upgrade` command `DO_NOT_TRACK`| Set to `1` to opt out of telemetry, with the same effect as `DISABLE_TELEMETRY`, including making [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable. Claude Code reads this variable as a standard boolean, so `0` leaves telemetry on, and honors it as the cross-tool convention recognized by many developer CLIs
modified
--- a/env-vars.md +++ b/env-vars.md @@ -178,7 +178,7 @@ `CLAUDE_AX_SCREEN_READER`| Set to `1` to render screen-reader friendly output: flat text without decorative borders or animations. Set to `0` to force screen-reader mode off even when [`axScreenReader`](</docs/en/settings-reference#axscreenreader>) is `true`. The [`--ax-screen-reader`](</docs/en/cli-reference#cli-flags>) flag takes precedence. Requires Claude Code v2.1.181 or later `CLAUDE_AX_STARTUP_QUIET_MS`| In [screen reader mode](</docs/en/accessibility>), how many milliseconds Claude Code holds the first interface render after the startup confirmation line, so your screen reader can speak the line in full before new output interrupts it. Default `3000`. Set `0` to render immediately. Claude Code caps the hold at `600000` (10 minutes). Your first keystroke ends the hold early. Requires Claude Code v2.1.217 or later `CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR`| Return to the original working directory after each Bash or PowerShell command in the main session -`CLAUDE_BYTE_STREAM_IDLE_TIMEOUT_MS`| Timeout in milliseconds for the byte-level streaming idle watchdog only; when set, it takes precedence over `CLAUDE_STREAM_IDLE_TIMEOUT_MS` for that watchdog and leaves the event-level watchdog unchanged. Claude Code clamps this variable to between 10 seconds and 30 minutes. Requires Claude Code v2.1.210 or later +`CLAUDE_BYTE_STREAM_IDLE_TIMEOUT_MS`| Timeout in milliseconds for the byte-level streaming idle watchdog; when set, it takes precedence over `CLAUDE_STREAM_IDLE_TIMEOUT_MS` for that watchdog and leaves the event-level watchdog unchanged. Claude Code clamps this variable to between 10 seconds and 30 minutes. Requires Claude Code v2.1.210 or later `CLAUDE_CLIENT_PRESENCE_FILE`| Path to a file that an external tool, such as a screen-lock listener, creates when you unlock your screen and deletes when you lock it. While the file exists, Claude Code skips [Remote Control mobile push notifications](</docs/en/remote-control#mobile-push-notifications>), so you stop getting pushes while you are actively using the computer. When the file is absent or unreadable, notifications are sent as normal. Claude Code checks the file once per push-triggering event rather than polling it. Requires Claude Code v2.1.181 or later `CLAUDE_CODE_ACCESSIBILITY`| Set to `1` to keep the native terminal cursor visible and disable the inverted-text cursor indicator. Allows screen magnifiers like macOS Zoom to track cursor position `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD`| Set to `1` to load memory files from directories specified with `--add-dir`. Loads `CLAUDE.md`, `.claude/CLAUDE.md`, `.claude/rules/*.md`, and `CLAUDE.local.md`. By default, additional directories do not load memory files @@ -199,7 +199,7 @@ `CLAUDE_CODE_CLIENT_CERT`| Path to client certificate file for mTLS authentication `CLAUDE_CODE_CLIENT_KEY`| Path to client private key file for mTLS authentication `CLAUDE_CODE_CLIENT_KEY_PASSPHRASE`| Passphrase for encrypted CLAUDE_CODE_CLIENT_KEY (optional) -`CLAUDE_CODE_CONNECT_TIMEOUT_MS`| Removed in v2.1.186 and now a no-op. Previously set a separate timeout for the connect, TLS, and response-header phase of a streaming API request. Use `API_TIMEOUT_MS` for the per-request timeout +`CLAUDE_CODE_CONNECT_TIMEOUT_MS`| Removed in v2.1.186 and now a no-op. Previously set a separate timeout for the connect, TLS, and response-header phase of a streaming API request. Use `API_TIMEOUT_MS` for the per-request timeout. For the response-header phase of a streaming request, see `CLAUDE_STREAM_FIRST_BYTE_TIMEOUT_MS` `CLAUDE_CODE_DEBUG_LOGS_DIR`| Override the debug log file path. Despite the name, this is a file path, not a directory. Requires debug mode to be enabled separately via `--debug`, `/debug`, or the `DEBUG` environment variable: setting this variable alone does not enable logging. The [`--debug-file`](</docs/en/cli-reference#cli-flags>) flag does both at once. Defaults to `~/.claude/debug/<session-id>.txt` `CLAUDE_CODE_DEBUG_LOG_LEVEL`| Minimum log level written to the debug log file. Values: `verbose`, `debug` (default), `info`, `warn`, `error`. Set to `verbose` to include high-volume diagnostics like full status line command output, or raise to `error` to reduce noise `CLAUDE_CODE_DISABLE_1M_CONTEXT`| Set to `1` to disable [1M context window](</docs/en/model-config#extended-context>) support. When set, 1M model variants are unavailable in the model picker, and Claude Code holds sessions on models with a native 1M window, such as [Sonnet 5](</docs/en/model-config#sonnet-5-context-window>) and Fable 5, to a 200K window; see [Extended context](</docs/en/model-config#extended-context>) for how the hold is enforced. Useful for enterprise environments with compliance requirements. For its role in correcting the window for an unrecognized `[1m]` model ID, see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>) @@ -366,13 +366,14 @@ `CLAUDE_CODE_WORKFLOW_PREFIX_STAGGER_MS`| Upper bound in milliseconds on how long a [workflow](</docs/en/workflows>) agent waits for a same-prefix sibling’s first response to begin before sending its own first request. When a fan-out starts several agents that share a [prompt-cache prefix](</docs/en/workflows#prompt-caching-in-a-fan-out>), Claude Code holds all but the first agent for up to this long so the rest read the cached prefix instead of each processing it uncached. Default `5000`. Set to `0` to disable the wait. When `DISABLE_PROMPT_CACHING` is set, agents never wait. Requires Claude Code v2.1.229 or later `CLAUDE_CONFIG_DIR`| Override the configuration directory (default: `~/.claude`). All settings, session history, and plugins are stored under this path, as are credentials on Linux and Windows; on macOS, credentials are in the system Keychain. Useful for running multiple accounts side by side: for example, `alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'` `CLAUDE_DISABLE_ADOPT`| Set to `1` to stop in-flight background work instead of carrying it over when you background a session by pressing `←` or with [`/background`](</docs/en/agent-view#from-inside-a-session>). Claude Code asks you to confirm before backgrounding, then stops the tasks that would otherwise carry over. Requires Claude Code v2.1.195 or later -`CLAUDE_EFFORT`| Set automatically in Bash tool subprocesses and hook commands to the active [effort level](</docs/en/model-config#adjust-effort-level>) for the turn: `low`, `medium`, `high`, `xhigh`, or `max`. Ultracode is not a distinct level and reports as `xhigh`. Matches the `effort.level` field passed to [hooks](</docs/en/hooks>). Only set when the current model supports the effort parameter -`CLAUDE_ENABLE_BYTE_WATCHDOG`| Set to `1` to force-enable the byte-level streaming idle watchdog, or set to `0` to force-disable it. When unset, the watchdog is enabled by default for direct Anthropic API and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) connections, and for streaming responses on [gateway](</docs/en/gateways>) connections reached through `ANTHROPIC_BASE_URL` or `ANTHROPIC_AWS_BASE_URL`; before v2.1.222 it didn’t run on those gateway connections, so the event-level watchdog could report a stall there even while keep-alive pings were arriving. For timeouts and how the timers interact, see [Streaming idle watchdogs](</docs/en/network-config#streaming-idle-watchdogs>) -`CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK`| Set to `1` to enable the byte-level streaming idle watchdog on Amazon Bedrock `vnd.amazon.eventstream` responses. Off by default. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS` +`CLAUDE_EFFORT`| Set automatically in Bash tool subprocesses and hook commands to the [effort level](</docs/en/model-config#adjust-effort-level>) in effect when the subprocess starts: `low`, `medium`, `high`, `xhigh`, or `max`. Ultracode is not a distinct level and reports as `xhigh`. Matches the `effort.level` field passed to [hooks](</docs/en/hooks>). Only set when the current model supports the effort parameter +`CLAUDE_ENABLE_BYTE_WATCHDOG`| Set to `1` to force-enable the byte-level streaming idle watchdog, or set to `0` to force-disable it. `0` also turns off the [first-byte deadline](</docs/en/network-config#streaming-idle-watchdogs>) on the connections where that deadline runs. When unset, the watchdog is enabled by default for direct Anthropic API and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) connections, and for streaming responses on [gateway](</docs/en/gateways>) connections reached through `ANTHROPIC_BASE_URL` or `ANTHROPIC_AWS_BASE_URL`; before v2.1.222 it didn’t run on those gateway connections, so the event-level watchdog could report a stall there even while keep-alive pings were arriving. For timeouts and how the timers interact, see [Streaming idle watchdogs](</docs/en/network-config#streaming-idle-watchdogs>) +`CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK`| Set to `1` to enable the byte-level streaming idle watchdog on Amazon Bedrock `vnd.amazon.eventstream` responses, which also enables the [first-byte deadline](</docs/en/network-config#streaming-idle-watchdogs>) on Bedrock streaming requests. Off by default. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS` `CLAUDE_ENABLE_STREAM_WATCHDOG`| Set to `0` to force-disable the event-level streaming idle watchdog, or set to `1` to force-enable it. When unset, the watchdog is on by default for all providers. Before v2.1.196, the unset default was server-controlled on the direct Anthropic API and off on other providers. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS`; for the other stall timers that run alongside this one, see [Streaming idle watchdogs](</docs/en/network-config#streaming-idle-watchdogs>) `CLAUDE_ENV_FILE`| Path to a shell script whose contents Claude Code runs before each Bash command in the same shell process, so exports in the file are visible to the command. Use to persist virtualenv or conda activation across commands. Also populated dynamically by [SessionStart](</docs/en/hooks#persist-environment-variables>), [Setup](</docs/en/hooks#setup>), [CwdChanged](</docs/en/hooks#cwdchanged>), and [FileChanged](</docs/en/hooks#filechanged>) hooks `CLAUDE_PID`| Claude Code sets this to its own process ID in the subprocesses it spawns: Bash and PowerShell tool commands and hook commands. On Linux, the Bash tool’s shell integration uses it to refuse a `pkill` pattern that would match the Claude Code process itself; see [the error reference](</docs/en/errors#pkill-pattern-matches-the-claude-code-process>). Read it from your own scripts to identify or signal the parent Claude Code process deliberately. Requires Claude Code v2.1.214 or later `CLAUDE_REMOTE_CONTROL_SESSION_NAME_PREFIX`| Prefix for auto-generated [Remote Control](</docs/en/remote-control>) session names when no explicit name is provided. Defaults to your machine’s hostname, producing names like `myhost-graceful-unicorn`. The `--remote-control-session-name-prefix` CLI flag sets the same value for a single invocation +`CLAUDE_STREAM_FIRST_BYTE_TIMEOUT_MS`| Deadline in milliseconds for the first response byte of a streaming request, on the connections where the [first-byte deadline](</docs/en/network-config#streaming-idle-watchdogs>) runs. For how Claude Code clamps it, the extra time it adds for large request bodies, and how it picks the deadline when you leave this unset, see [No response from API](</docs/en/errors#no-response-from-api>). Requires Claude Code v2.1.242 or later `CLAUDE_STREAM_IDLE_TIMEOUT_MS`| Timeout in milliseconds before the event- and byte-level streaming idle watchdogs close a stalled connection. When you set this variable explicitly, the minimum is `300000` (5 minutes); lower values are silently clamped to absorb extended thinking pauses and proxy buffering, and the byte-level watchdog caps the value at 30 minutes. `CLAUDE_BYTE_STREAM_IDLE_TIMEOUT_MS` takes precedence over this variable for the byte-level watchdog. For the per-watchdog unset defaults, see [Streaming idle watchdogs](</docs/en/network-config#streaming-idle-watchdogs>) `CLAUDE_SUBAGENT_BG_SHELL_MAX_MS`| Maximum lifetime in milliseconds for a [background shell command](</docs/en/interactive-mode#background-bash-commands>) that a [subagent](</docs/en/sub-agents>) started. Default `3600000` (60 minutes). When you set `0`, Claude Code applies the default instead of removing the cap. When the subagent runs in the foreground, Claude Code also ends the command when that subagent gives its final response, regardless of this cap. See [the background command lifetime rules](</docs/en/tools-reference#background-commands>). Claude Code doesn’t cap main-session background commands this way. For the memory-pressure limit that covers them, see [How backgrounding works](</docs/en/interactive-mode#how-backgrounding-works>) `DEBUG`| Set to `1` to enable debug mode, equivalent to launching with [`--debug`](</docs/en/cli-reference#cli-flags>). Debug logs are written to `~/.claude/debug/<session-id>.txt`, or to the path set by `CLAUDE_CODE_DEBUG_LOGS_DIR`. Only the truthy values `1`, `true`, `yes`, and `on` enable debug mode, so namespace patterns like `DEBUG=express:*` set for other tools do not trigger it @@ -412,7 +413,7 @@ `IS_DEMO`| Set to any non-empty value, such as `1`, to enable demo mode: hides your email and organization name from the header and `/status` output, and skips onboarding. **Setting it to`0` or `false` still enables demo mode**, unlike most on/off variables; unset the variable to turn it off. Useful when streaming or recording a session `MAX_MCP_OUTPUT_TOKENS`| Maximum number of tokens allowed in MCP tool responses. Claude Code displays a warning when output exceeds 10,000 tokens. Tools that declare [`anthropic/maxResultSizeChars`](</docs/en/mcp#raise-the-limit-for-a-specific-tool>) use that character limit for text content instead, but image content from those tools is still subject to this variable (default: 25000) `MAX_STRUCTURED_OUTPUT_RETRIES`| Number of times Claude Code retries when the model’s response fails validation against the [`--json-schema`](</docs/en/cli-reference#cli-flags>) in non-interactive mode with the `-p` flag. The same retry count applies when a [workflow](</docs/en/workflows>) subagent’s structured output fails validation. Defaults to 5 -`MAX_THINKING_TOKENS`| Fixed token budget for [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>). Claude Code caps it at one token below the request’s max output tokens and never below 1,024; see `CLAUDE_CODE_MAX_OUTPUT_TOKENS` for how that limit is set. When unset and thinking is enabled, models with [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) choose their own thinking depth, and other models use the cap. Set to `0` to disable thinking on the Anthropic API, except on Fable 5, which cannot have thinking turned off; on [third-party providers](</docs/en/third-party-integrations>), `0` omits the `thinking` parameter instead. Nonzero values are ignored on adaptive reasoning models unless `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` is set +`MAX_THINKING_TOKENS`| Fixed token budget for [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>). Claude Code caps it at one token below the request’s max output tokens and never below 1,024; see `CLAUDE_CODE_MAX_OUTPUT_TOKENS` for how that limit is set. When unset and thinking is enabled, models with [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) choose their own thinking depth, and other models use the cap. Set to `0` to disable thinking on the Anthropic API, except on Fable 5, which cannot have thinking turned off; on [third-party providers](</docs/en/third-party-integrations>), `0` omits the `thinking` parameter instead. With thinking turned off on the Anthropic API, Claude Code sends effort `high` instead of a higher level to models it knows [don’t accept that combination](</docs/en/errors#effort-isnt-available-with-thinking-turned-off>), such as Opus 5. Nonzero values are ignored on adaptive reasoning models unless `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` is set `MCP_CLIENT_SECRET`| OAuth client secret for MCP servers that require [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>). Avoids the interactive prompt when adding a server with `--client-secret` `MCP_CONNECTION_NONBLOCKING`| Controls whether startup waits for MCP servers to connect before the first query. MCP startup is non-blocking by default: servers connect in the background and their tools become available as they finish. Set to `0` to make Claude Code wait for servers to connect before the first query. Servers configured with [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>) still make startup wait regardless, except when served from the [discovery cache](</docs/en/mcp#server-status-detail>), since their tools must be present when the first prompt is built. In non-interactive mode (`-p`), Claude Code also waits for still-pending servers before the first turn regardless of this variable, with a longer deadline when you pass [`--mcp-config`](</docs/en/cli-reference#cli-flags>) explicitly; see that flag’s entry for the cached-server exception `MCP_CONNECT_TIMEOUT_MS`| How long blocking MCP startup waits, in milliseconds, for the connection batch before snapshotting the tool list (default: 5000). Applies when `MCP_CONNECTION_NONBLOCKING=0` or for servers marked [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>). Servers still pending at the deadline keep connecting in the background. Distinct from `MCP_TIMEOUT`, which bounds an individual server’s connect attempt @@ -467,7 +468,13 @@ Features that need feature-flag fetching -Claude Code turns some features on through feature flags it fetches from Anthropic. You turn flag fetching off for a session by setting `DISABLE_GROWTHBOOK`, `DISABLE_TELEMETRY`, `DO_NOT_TRACK`, or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`. Each variable’s row says which values do that. Claude Code also leaves fetching off when you connect through a [Claude apps gateway](</docs/en/claude-apps-gateway>), and on machines where a managed settings file, MDM profile, or policy helper requires gateway sign-in with [`forceLoginMethod: "gateway"`](</docs/en/settings-reference#forceloginmethod>), even before anyone signs in. On Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, or Microsoft Foundry, Claude Code leaves fetching off unless a host platform that embeds Claude Code sets `CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`. With fetching off, you can’t: +Claude Code turns some features on through feature flags it fetches from Anthropic. Claude Code skips that fetch in these sessions: + + * A session where you set `DISABLE_GROWTHBOOK`, `DISABLE_TELEMETRY`, `DO_NOT_TRACK`, or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`; each variable’s row in the variables table says which values turn fetching off + * A session on a [third-party provider](</docs/en/third-party-integrations>), such as Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, or Microsoft Foundry, unless a host platform that embeds Claude Code sets `CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST` + * A [Claude apps gateway](</docs/en/claude-apps-gateway>) session + +With fetching off, you can’t: * [Start sessions in auto mode by default](</docs/en/permission-modes#which-mode-a-session-starts-in>) on Pro, Max, and Team plans * Have the VS Code extension [read settings files for the starting permission mode](</docs/en/permission-modes#switch-permission-modes>)
modified
--- a/env-vars.md +++ b/env-vars.md @@ -90,7 +90,7 @@ Precedence -Some behaviors have both an environment variable and a dedicated settings key, and which one Claude Code reads first differs per key. For `ANTHROPIC_MODEL` and `CLAUDE_CODE_AUTO_CONNECT_IDE`, Claude Code reads the variable first and uses the `model` or `autoConnectIde` setting only when the variable is unset. For the pair you’re setting, check the variable’s row below and the key’s entry on the [settings reference](</docs/en/settings-reference>). When the same variable is set in both your shell and a settings file `env` block, the settings file value applies. Claude Code writes each `env` entry into the process environment at startup and again when the file changes, replacing the value inherited from the shell. A few variables are special-cased; the [`env` setting](</docs/en/settings-reference#env>) lists the exceptions. In a settings file you can set a variable but you can’t remove one. To override a variable you can’t unset, such as a stale `CLAUDE_CODE_USE_VERTEX` exported by a shell profile you don’t control, set it to an empty string in the `env` block: `"CLAUDE_CODE_USE_VERTEX": ""`. Claude Code treats the empty value as unset for provider selection. Subprocesses still inherit the empty value. Between settings files, `env` values follow [settings precedence](</docs/en/settings#settings-precedence>), so a managed settings entry overrides the same variable in user or project settings. How an environment variable interacts with CLI flags and in-session commands varies per feature: `--model` and `/model` override `ANTHROPIC_MODEL`, while `CLAUDE_CODE_EFFORT_LEVEL` overrides `/effort`. When a variable interacts with another configuration source, its row in the Variables list states the precedence or links to the page that documents it. Claude Code reads shell environment variables at startup, so changes to them take effect the next time you launch `claude`. Variables set under the `env` key in settings files are reapplied to a running session when the file changes, with the startup-only exception described in In settings files. +Some behaviors have both an environment variable and a dedicated settings key, and which one Claude Code reads first differs per key. For `ANTHROPIC_MODEL` and `CLAUDE_CODE_AUTO_CONNECT_IDE`, Claude Code reads the variable first and uses the `model` or `autoConnectIde` setting only when the variable is unset. For the pair you’re setting, check the variable’s row below and the key’s entry on the [settings reference](</docs/en/settings-reference>). When the same variable is set in both your shell and a settings file `env` block, the settings file value applies. Claude Code writes each `env` entry into the process environment, replacing the value inherited from the shell. The [`env` setting](</docs/en/settings-reference#when-claude-code-applies-env-values>) says when it applies them. A few variables are special-cased; the [`env` setting](</docs/en/settings-reference#env>) lists the exceptions. In a settings file you can set a variable but you can’t remove one. To override a variable you can’t unset, such as a stale `CLAUDE_CODE_USE_VERTEX` exported by a shell profile you don’t control, set it to an empty string in the `env` block: `"CLAUDE_CODE_USE_VERTEX": ""`. Claude Code treats the empty value as unset for provider selection. Subprocesses still inherit the empty value. Between settings files, `env` values follow [settings precedence](</docs/en/settings#settings-precedence>), so a managed settings entry overrides the same variable in user or project settings. How an environment variable interacts with CLI flags and in-session commands varies per feature: `--model` and `/model` override `ANTHROPIC_MODEL`, while `CLAUDE_CODE_EFFORT_LEVEL` overrides `/effort`. When a variable interacts with another configuration source, its row in the Variables list states the precedence or links to the page that documents it. Claude Code reads shell environment variables at startup, so changes to them take effect the next time you launch `claude`. Variables set under the `env` key in settings files are reapplied to a running session when the file changes, with the startup-only exception described in In settings files. ## @@ -186,8 +186,8 @@ `CLAUDE_CODE_ALWAYS_ENABLE_EFFORT`| Set to `1` to send the [effort](</docs/en/model-config#adjust-effort-level>) parameter with every request, even when Claude Code does not recognize the model ID as effort-capable. Use this when routing through an [LLM gateway](</docs/en/llm-gateway>) or third-party provider that serves models under custom identifiers. Models that reject the effort parameter at the API, including Claude 3 models, Sonnet 4.0 and 4.5, Opus 4.0 and 4.1, and Haiku 4.5, are still excluded so requests do not fail `CLAUDE_CODE_API_KEY_HELPER_TTL_MS`| Interval in milliseconds at which credentials should be refreshed (when using [`apiKeyHelper`](</docs/en/settings-reference#apikeyhelper>)) `CLAUDE_CODE_ARTIFACT_AUTO_OPEN`| Set to `0` to stop Claude Code from opening the browser automatically when a new [artifact](</docs/en/artifacts>) is published. Republishing an existing artifact does not open the browser regardless of this setting -`CLAUDE_CODE_ARTIFACT_COMMENTS`| Set to `1` to let Claude read and reply to [comments on an artifact](</docs/en/artifacts#collect-comments-on-an-artifact>) when feature-flag fetching is off. Set to `0` to turn comment reading and replying off even when fetching is on. Has no effect when `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` has [turned artifacts off](</docs/en/artifacts#availability>). Requires Claude Code v2.1.221 or later -`CLAUDE_CODE_ARTIFACT_COMMENTS_AUTOREACT`| Set to `1` to let Claude [reply on its own to comments sent to it](</docs/en/artifacts#let-claude-reply-to-comments-on-its-own>) when feature-flag fetching is off, or `0` to turn that off even when fetching is on. Needs comment reading on as well. Requires Claude Code v2.1.228 or later +`CLAUDE_CODE_ARTIFACT_COMMENTS`| Set to `0` to stop Claude reading and replying to [comments on an artifact](</docs/en/artifacts#collect-comments-on-an-artifact>). Has no effect when `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` has [turned artifacts off](</docs/en/artifacts#availability>). Requires Claude Code v2.1.221 or later +`CLAUDE_CODE_ARTIFACT_COMMENTS_AUTOREACT`| Set to `0` to stop Claude [replying on its own to comments sent to it](</docs/en/artifacts#let-claude-reply-to-comments-on-its-own>). Requires Claude Code v2.1.228 or later `CLAUDE_CODE_ATTRIBUTION_HEADER`| Set to `0` to omit the [attribution block](</docs/en/llm-gateway-protocol#system-prompt-attribution-block>), which carries the client version and a prompt fingerprint, from the start of the system prompt. Caching on a direct connection to the Anthropic API is unaffected either way. In some direct-connection setups, Claude Code keeps the block on [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) classifier requests even when you set `0`. In [System prompt attribution block](</docs/en/llm-gateway-protocol#system-prompt-attribution-block>), check which connections and credentials this covers. Before v2.1.181 the block included a per-request token on custom base URLs and Microsoft Foundry connections, so on those versions set it to `0` when your LLM gateway caches on the request body or forwards requests to a third-party provider, or when you connect to Microsoft Foundry directly `CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the [auto-compact window](</docs/en/model-config#set-the-auto-compact-window>) in tokens, from `100000` to `1000000`. Accepts a plain integer such as `500000` only: a value like `500k` reads as `500` and clamps to the 100K minimum. Takes precedence over the `/autocompact` command, the `--autocompact` flag, and the `autoCompactWindow` setting. The status line’s `used_percentage` always measures against the model’s full context window, so once this variable is set, that percentage no longer indicates when compaction will run `CLAUDE_CODE_AUTO_CONNECT_IDE`| Override automatic [IDE connection](</docs/en/vs-code>). By default, Claude Code connects automatically when launched inside a supported IDE’s integrated terminal. Set to `false` to prevent this. Set to `true` to force a connection attempt when auto-detection fails, such as when tmux obscures the parent terminal. Takes precedence over the [`autoConnectIde`](</docs/en/settings-reference#autoconnectide>) global config setting @@ -208,7 +208,7 @@ `CLAUDE_CODE_DISABLE_ADVISOR_TOOL`| Set to `1` to disable the [advisor tool](</docs/en/advisor>). The `/advisor` command becomes unavailable, any configured `advisorModel` is ignored, and the `--advisor` flag is accepted but has no effect, so existing scripts that pass it continue to work without errors `CLAUDE_CODE_DISABLE_AGENT_VIEW`| Set to `1` to turn off [background agents and agent view](</docs/en/agent-view>): `claude agents`, `--bg`, `/background`, and the on-demand supervisor. Equivalent to the [`disableAgentView`](</docs/en/settings-reference#disableagentview>) setting `CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN`| Set to `1` to disable [fullscreen rendering](</docs/en/fullscreen>) and use the classic main-screen renderer. The conversation stays in your terminal’s native scrollback so `Cmd+f` and tmux copy mode work as usual. Takes precedence over `CLAUDE_CODE_NO_FLICKER` and the [`tui`](</docs/en/settings-reference#tui>) setting. You can also switch with `/tui default`. Does not apply to background sessions opened from [agent view](</docs/en/agent-view>), which always use fullscreen rendering -`CLAUDE_CODE_DISABLE_ARTIFACT`| Set to `1` to disable the [Artifact](</docs/en/artifacts>) tool, which publishes session output as a private web page on claude.ai. Equivalent to the [`disableArtifact`](</docs/en/settings-reference#disableartifact>) setting +`CLAUDE_CODE_DISABLE_ARTIFACT`| Set to `1` to turn off the [Artifact](</docs/en/artifacts>) tool, which publishes session output as a private web page on claude.ai. Once you set it, no settings file turns the tool back on. To turn the tool off from a settings file instead, set [`enableArtifact`](</docs/en/settings-reference#enableartifact>) to `false`; the deprecated [`disableArtifact`](</docs/en/settings-reference#disableartifact>) key also turns it off `CLAUDE_CODE_DISABLE_ATTACHMENTS`| Set to `1` to disable attachment processing. File mentions with `@` syntax are sent as plain text instead of being expanded into file content `CLAUDE_CODE_DISABLE_AUTO_MEMORY`| Set to `1` to disable [auto memory](</docs/en/memory#auto-memory>). Set to `0` to force auto memory on even when `--bare` mode or [`autoMemoryEnabled: false`](</docs/en/settings-reference#automemoryenabled>) would otherwise disable it. When disabled, Claude does not create or load auto memory files `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 @@ -314,6 +314,7 @@ `CLAUDE_CODE_PROXY_RESOLVES_HOSTS`| Set to `1` to allow the proxy to perform DNS resolution instead of the caller. Opt-in for environments where the proxy should handle hostname resolution `CLAUDE_CODE_REMOTE`| Set automatically to `true` when Claude Code is running as a [cloud session](</docs/en/claude-code-on-the-web>). Read this from a hook or setup script to detect whether you are in a cloud session `CLAUDE_CODE_REMOTE_SESSION_ID`| Set automatically in [cloud sessions](</docs/en/claude-code-on-the-web>) to the current session’s ID. Read this to construct a link back to the session transcript. See [Link output back to the session](</docs/en/cloud-environments#link-output-back-to-the-session>) +`CLAUDE_CODE_RESTRICTED`| Set to `1` to start the session in restricted mode, the same as passing [`--restricted`](</docs/en/cli-reference#cli-flags>). Claude Code ignores this variable in a settings file’s `env` block. Requires Claude Code v2.1.248 or later `CLAUDE_CODE_RESUME_INTERRUPTED_TURN`| Set to `1` to automatically resume if the previous session ended mid-turn. Used in SDK mode so the model continues without requiring the SDK to re-send the prompt. To turn this off, unset the variable or set it to `0`. Before v2.1.221, Claude Code ignored `0` and other falsy values, so setting `0` still triggered the resume in non-interactive mode and unsetting the variable was the only way to turn it off `CLAUDE_CODE_RESUME_INTERRUPTED_TURN_MAX_AGE_MS`| Maximum age in milliseconds of the last transcript message for a session that ended mid-turn to continue automatically on resume. When the last message is older than this bound, Claude Code skips both the `CLAUDE_CODE_RESUME_INTERRUPTED_TURN` automatic resume and the injected `CLAUDE_CODE_RESUME_PROMPT` continuation message, and the session starts idle so you continue explicitly. Unset or `0` means no bound; a negative or non-numeric value applies a one-hour bound. Spawn scripts for long-running agents can set this so a restart against an old transcript doesn’t re-run a stale prompt. Claude Code sets a one-hour bound itself when it restarts a crashed [agent view](</docs/en/agent-view>) session that inherited its conversation from an interactive session. Requires Claude Code v2.1.211 or later `CLAUDE_CODE_RESUME_PROMPT`| Override the continuation message injected when resuming a session that ended mid-turn. Defaults to `Continue from where you left off.`. Spawn scripts for long-running agents can set this to a more directive boot message. An empty string uses the default @@ -351,7 +352,8 @@ `CLAUDE_CODE_TEAM_TEARDOWN_PARK_TIMEOUT_MS`| Override, in milliseconds, how long a non-interactive session waits at exit for its [agent team](</docs/en/agent-teams>) to finish tearing down. Accepts 1000 to 60000; an out-of-range value is ignored and the default of 10000 applies. Requires Claude Code v2.1.206 or later `CLAUDE_CODE_TMPDIR`| Override the temp directory used for internal temp files. Claude Code appends `/claude-{uid}/` on Unix or `/claude/` on Windows to this path. Default: `/tmp` on macOS, `os.tmpdir()` on Linux and Windows. As of v2.1.161, on macOS and Linux, [sandboxed](</docs/en/sandboxing>) Bash subprocesses receive a short fallback `$TMPDIR` under the system default when your override is a long path, since some tools fail when temp paths get too long. Unsandboxed Bash commands inherit your shell’s `$TMPDIR` unchanged. Claude Code’s own temp files always use your override `CLAUDE_CODE_TMUX_TRUECOLOR`| Set to any non-empty value, such as `1`, to allow 24-bit truecolor output inside tmux. **Setting it to`0` or `false` still allows truecolor**, unlike most on/off variables; unset the variable to restore the 256-color clamp. By default, Claude Code clamps to 256 colors when `$TMUX` is set because tmux does not pass through truecolor escape sequences unless configured to. Set this after adding `set -ga terminal-overrides ',*:Tc'` to your `~/.tmux.conf`. See [Terminal configuration](</docs/en/terminal-config>) for other tmux settings -`CLAUDE_CODE_TOOL_MEMORY_LIMIT`| On Linux and WSL, set to a size such as `4G` to [cap the memory that Bash and PowerShell tool commands can use](</docs/en/tools-reference#memory-limit-on-linux-and-wsl>). Write the size in plain digits, alone for a number of bytes or with a `K`, `M`, `G`, or `T` suffix. Set `0` or `off` to turn the cap off. Once a tool command has turned the cap on or off, a changed value takes effect the next time you launch `claude`. Requires Claude Code v2.1.233 or later +`CLAUDE_CODE_TOOL_MEMORY_CGROUP_EXCLUDE`| On Linux and WSL, set to a comma-separated list of the kinds of processes Claude Code [excludes from the tool memory cap](</docs/en/tools-reference#memory-limit-on-linux-and-wsl>), such as `mcp` or `lsp`. Set `none` to cap every kind, or `all-new` to cap only Bash, PowerShell, and Monitor tool commands. Claude Code keeps Bash, PowerShell, and Monitor tool commands under the cap whatever you list. Requires Claude Code v2.1.246 or later +`CLAUDE_CODE_TOOL_MEMORY_LIMIT`| On Linux and WSL, set to a size such as `4G` to [cap the memory that Bash and PowerShell tool commands can use](</docs/en/tools-reference#memory-limit-on-linux-and-wsl>), and Monitor tool commands on v2.1.246 or later. Write the size in plain digits, alone for a number of bytes or with a `K`, `M`, `G`, or `T` suffix. Set `0` or `off` to turn the cap off. Once the first process Claude Code starts has turned the cap on or off, a changed value takes effect the next time you launch `claude`. Requires Claude Code v2.1.233 or later `CLAUDE_CODE_USER_DIALOG_TIMEOUT_MS`| Deadline in milliseconds for dialogs Claude Code forwards to a remote client, such as a [Remote Control](</docs/en/remote-control>) or SDK host, and for the approval dialog for a [held cross-session message](</docs/en/cross-session-messaging#control-inbound-messages>), before Claude Code cancels them; permission prompts and `AskUserQuestion` questions use their own flows and aren’t governed by it. Also bounds the mid-session [Fable 5 usage-credits consent prompt](</docs/en/model-config#fable-5-and-usage-credits>) in a session that may be running unattended. [Control inbound messages](</docs/en/cross-session-messaging#control-inbound-messages>) and [non-interactive sessions](</docs/en/cross-session-messaging#non-interactive-sessions>) cover the full held-message expiry rules, including the cases where the deadline doesn’t apply. Overrides the [`dialogExpiry`](</docs/en/settings-reference#dialogexpiry>) setting; `0` or a negative value disables the deadline `CLAUDE_CODE_USE_ANTHROPIC_AWS`| Use [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) `CLAUDE_CODE_USE_BEDROCK`| Use [Amazon Bedrock](</docs/en/amazon-bedrock>) @@ -397,7 +399,7 @@ `DISABLE_UPDATES`| Set to `1` to block all updates including manual `claude update` and `claude install`. Stricter than `DISABLE_AUTOUPDATER`. Use when distributing Claude Code through your own channels and users should not self-update `DISABLE_UPGRADE_COMMAND`| Set to `1` to hide the `/upgrade` command `DO_NOT_TRACK`| Set to `1` to opt out of telemetry, with the same effect as `DISABLE_TELEMETRY`, including making [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable. Claude Code reads this variable as a standard boolean, so `0` leaves telemetry on, and honors it as the cross-tool convention recognized by many developer CLIs -`ENABLE_CLAUDEAI_MCP_SERVERS`| Set to `false` to disable [claude.ai MCP servers](</docs/en/mcp#use-mcp-servers-from-claude-ai>) in Claude Code. Enabled by default for logged-in users. To disable per-project or per-org, set [`disableClaudeAiConnectors`](</docs/en/settings-reference#disableclaudeaiconnectors>) in settings instead +`ENABLE_CLAUDEAI_MCP_SERVERS`| Set to `false` to stop Claude Code from fetching [claude.ai MCP servers](</docs/en/mcp#use-mcp-servers-from-claude-ai>). Enabled by default for logged-in users. To disable per-project or per-org, set [`disableClaudeAiConnectors`](</docs/en/settings-reference#disableclaudeaiconnectors>) in settings instead `ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) instead of the default 5 minutes. Intended for API key, [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), [Microsoft Foundry](</docs/en/microsoft-foundry>), and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) users. Subscription users within included usage receive the 1-hour TTL automatically on the [main conversation](</docs/en/prompt-caching#which-ttl-each-request-gets>). Subscription users drawing on [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>) can set it to keep the 1-hour TTL. 1-hour cache writes are billed at a higher rate. To choose the TTL per request bucket instead, use `CLAUDE_CODE_PROMPT_CACHE_TTL` and `CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL`, which take precedence over this variable `ENABLE_PROMPT_CACHING_1H_BEDROCK`| Deprecated. Use `ENABLE_PROMPT_CACHING_1H` instead `ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset, Claude Code defers all MCP tools by default. It still loads them upfront on Google Cloud’s Agent Platform models earlier than the Claude 4.5 generation, on a Microsoft Foundry deployment hosted on Azure, and when `ANTHROPIC_BASE_URL` points to a non-first-party host. `true` always defers and sends the beta header, except on those same Agent Platform models and Microsoft Foundry deployments; requests fail on proxies that don’t support `tool_reference`. `auto` loads upfront when tool definitions fit within 10% of context. `auto:N` sets a custom threshold, such as `auto:5` for 5%. `false` loads all tools upfront. A value you set yourself is ignored when `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS` is set. Before v2.1.221, Claude Code disabled tool search for all models on Google Cloud’s Agent Platform unless you set this variable to `true` @@ -465,19 +467,16 @@ Features that need feature-flag fetching -Claude Code turns some features on through feature flags it fetches from Anthropic. You turn flag fetching off for a session by setting `DISABLE_GROWTHBOOK`, `DISABLE_TELEMETRY`, `DO_NOT_TRACK`, or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`. Each variable’s row says which values do that. Claude Code also leaves fetching off when you connect through a [Claude apps gateway](</docs/en/claude-apps-gateway>). On Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, or Microsoft Foundry, Claude Code leaves fetching off unless a host platform that embeds Claude Code sets `CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`. With fetching off, you can’t: - - * [Start sessions in auto mode by default](</docs/en/permission-modes#which-mode-a-session-starts-in>) on Pro, Max, and Team plans; Claude Code starts your sessions in Manual instead +Claude Code turns some features on through feature flags it fetches from Anthropic. You turn flag fetching off for a session by setting `DISABLE_GROWTHBOOK`, `DISABLE_TELEMETRY`, `DO_NOT_TRACK`, or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`. Each variable’s row says which values do that. Claude Code also leaves fetching off when you connect through a [Claude apps gateway](</docs/en/claude-apps-gateway>), and on machines where a managed settings file, MDM profile, or policy helper requires gateway sign-in with [`forceLoginMethod: "gateway"`](</docs/en/settings-reference#forceloginmethod>), even before anyone signs in. On Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, or Microsoft Foundry, Claude Code leaves fetching off unless a host platform that embeds Claude Code sets `CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`. With fetching off, you can’t: + + * [Start sessions in auto mode by default](</docs/en/permission-modes#which-mode-a-session-starts-in>) on Pro, Max, and Team plans * Have the VS Code extension [read settings files for the starting permission mode](</docs/en/permission-modes#switch-permission-modes>) * Run [`/auto-mode-setup`](</docs/en/auto-mode-config#generate-environment-entries>) to draft `autoMode.environment` entries * Use [Remote Control](</docs/en/remote-control#requirements>) - * Send or receive [cross-session messages](</docs/en/cross-session-messaging#availability>) * Run [`claude import` or the `/import` command](</docs/en/cli-reference#cli-commands>) * Create routines from the CLI with [`/schedule`](</docs/en/routines#troubleshooting>) * Use [the advisor tool](</docs/en/advisor#requirements>) - * Let [Claude choose the `/loop` interval](</docs/en/scheduled-tasks#let-claude-choose-the-interval>); Claude Code runs a `/loop` prompt with no interval on the fixed 10-minute schedule instead - * Run [the built-in `/loop` maintenance prompt](</docs/en/scheduled-tasks#run-the-built-in-maintenance-prompt>); Claude Code shows the usage message instead when you run `/loop` with no prompt - * Read or reply to [comments on an artifact](</docs/en/artifacts#collect-comments-on-an-artifact>), unless you set `CLAUDE_CODE_ARTIFACT_COMMENTS=1`; for Claude to reply to sent comments on its own, also set `CLAUDE_CODE_ARTIFACT_COMMENTS_AUTOREACT=1`. Neither override helps under `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`, which [turns artifacts off entirely](</docs/en/artifacts#availability>) + * Read or reply to [comments on an artifact](</docs/en/artifacts#collect-comments-on-an-artifact>) * Have Claude Code refresh the [PR review status badge](</docs/en/interactive-mode#pr-review-status>) less often while you’re idle; Claude Code refreshes it every 60 seconds instead * Get the [v2 MCP client runtime](</docs/en/mcp#mcp-client-runtimes>) and its protocol probe without setting `MCP_SDK_GENERATION` and `MCP_PROTOCOL_NEGOTIATION`; Claude Code uses the v1 runtime unless you set `MCP_SDK_GENERATION=v2`, and skips the probe unless you set `MCP_PROTOCOL_NEGOTIATION=auto` * Get the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) by default for claude.ai and Console accounts on Windows with Git Bash installed; Claude Code routes shell commands through Git Bash unless you set `CLAUDE_CODE_USE_POWERSHELL_TOOL=1`. On Windows without Git Bash, the tool stays on
modified
--- a/env-vars.md +++ b/env-vars.md @@ -229,7 +229,7 @@ `CLAUDE_CODE_DISABLE_MOUSE`| Set to `1` to disable mouse tracking in [fullscreen rendering](</docs/en/fullscreen>). Keyboard scrolling with `PgUp` and `PgDn` still works. Use this to keep your terminal’s native copy-on-select behavior `CLAUDE_CODE_DISABLE_MOUSE_CLICKS`| Set to `1` to disable click, drag, and hover handling in [fullscreen rendering](</docs/en/fullscreen>) while keeping mouse-wheel scrolling. Use this when you want wheel scroll to work inside Claude Code but don’t want clicks to position the cursor, expand tool output, or open links. `CLAUDE_CODE_DISABLE_MOUSE` takes precedence when both are set. Requires Claude Code v2.1.195 or later `CLAUDE_CODE_DISABLE_MTLS_RELOAD_ON_STALE_CONNECTION`| Set to `1` to stop Claude Code from re-reading the [mTLS client certificate and key](</docs/en/network-config#mtls-authentication>) when an API request fails with a connection-level error, such as a connection reset or a TLS handshake error. With the reload disabled, Claude Code loads rotated files only when it next applies settings or at the next startup. Requires Claude Code v2.1.232 or later -`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`| Set to any non-empty value, such as `1`, to disable nonessential network traffic: auto-updates, telemetry, error reporting, the `/feedback` command, release notes, [gateway model discovery](</docs/en/llm-gateway-connect#add-gateway-models-to-the-model-picker>) refreshes, and availability checks such as the [fast mode](</docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways>) check. It also stops the [background runs of plugin `command` sources](</docs/en/plugin-marketplaces#when-claude-code-re-runs-the-command>), which are local commands rather than network traffic, because they can trigger dependency installs. **Setting it to`0` or `false` still disables this traffic**, unlike most on/off variables; unset the variable to allow it again. Also disables feature-flag fetching, which makes [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable. Official plugin marketplace auto-install isn’t covered; disable it with `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL` +`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`| Set to any non-empty value, such as `1`, to disable nonessential network traffic: auto-updates, telemetry, error reporting, the `/feedback` command, [Claude-drafted feedback](</docs/en/tools-reference#sendfeedback-tool-behavior>), release notes, [gateway model discovery](</docs/en/llm-gateway-connect#add-gateway-models-to-the-model-picker>) refreshes, and availability checks such as the [fast mode](</docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways>) check. It also stops the [background runs of plugin `command` sources](</docs/en/plugin-marketplaces#when-claude-code-re-runs-the-command>), which are local commands rather than network traffic, because they can trigger dependency installs. **Setting it to`0` or `false` still disables this traffic**, unlike most on/off variables; unset the variable to allow it again. Also disables feature-flag fetching, which makes [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable. Official plugin marketplace auto-install isn’t covered; disable it with `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL` `CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK`| Set to `1` to disable the non-streaming fallback when a streaming request fails mid-stream. Streaming errors propagate to the retry layer instead. Useful when a proxy or gateway causes the fallback to produce duplicate tool execution `CLAUDE_CODE_DISABLE_NOTIFICATION_PRESENCE_CHECK`| Set to `1` to send the `PushNotification` tool’s desktop notification even while you are typing in or focused on the terminal. By default the tool skips both the desktop notification and the [mobile push](</docs/en/remote-control#mobile-push-notifications>) when it detects recent keyboard activity or terminal focus. This variable disables only that local check, so the server can still suppress the mobile push when it detects that you are active. Requires Claude Code v2.1.193 or later `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL`| Set to `1` to disable automatic registration of the official plugin marketplace. Claude Code reads the variable when it is about to register the marketplace, usually during a machine’s first interactive launch. If the variable is set at that point, Claude Code skips the registration permanently. Unsetting the variable later doesn’t undo the skip. Run `claude plugin marketplace add anthropics/claude-plugins-official` to register the marketplace at any time @@ -321,6 +321,7 @@ `CLAUDE_CODE_SAFE_MODE`| Set to `1` to start in safe mode: CLAUDE.md, skills, plugins, hooks, MCP servers, custom commands and agents, output styles, workflows, custom themes, custom keybindings, status line and file-suggestion commands, LSP servers, and auto memory do not load, for troubleshooting a broken configuration. Managed settings policy still applies, including policy-configured hooks, status line, and file-suggestion commands; managed plugins, managed skills, managed CLAUDE.md, and policy-configured MCP servers do not. Equivalent to passing [`--safe-mode`](</docs/en/cli-reference#cli-flags>). Directly spawned child processes inherit the variable `CLAUDE_CODE_SCRIPT_CAPS`| JSON object limiting how many times specific scripts may be invoked per session when `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB` is set. Keys are substrings matched against the command text; values are integer call limits. For example, `{"deploy.sh": 2}` allows `deploy.sh` to be called at most twice. Matching is substring-based so shell-expansion tricks like `./scripts/deploy.sh $(evil)` still count against the cap. Runtime fan-out via `xargs` or `find -exec` is not detected; this is a defense-in-depth control `CLAUDE_CODE_SCROLL_SPEED`| Set the mouse wheel scroll multiplier in [fullscreen rendering](</docs/en/fullscreen#mouse-wheel-scrolling>). Accepts any positive value up to 20, including fractional values below 1 such as `0.5` to slow accelerated trackpad and wheel scrolling in terminals that already amplify wheel events. Set to `3` to match `vim` if your terminal sends one wheel event per notch without amplification. Ignored in the JetBrains IDE terminal, where Claude Code uses its own scroll handling +`CLAUDE_CODE_SEND_FEEDBACK`| Set to `0` to turn off [Claude-drafted feedback](</docs/en/tools-reference#sendfeedback-tool-behavior>) for a session. Set to `1` to turn it on where your account already has access; the variable can’t grant access itself, and the other switches that turn feedback off, such as `DISABLE_FEEDBACK_COMMAND` and the [`feedbackDrafts`](</docs/en/settings-reference#feedbackdrafts>) setting’s `off` value, still apply `CLAUDE_CODE_SESSIONEND_HOOKS_TIMEOUT_MS`| Override the time budget in milliseconds for [SessionEnd](</docs/en/hooks#sessionend>) hooks. Applies to session exit, `/clear`, and switching sessions via interactive `/resume`. By default the budget is 1.5 seconds, automatically raised to the highest per-hook `timeout` configured in settings files, up to 60 seconds. Timeouts on plugin-provided hooks do not raise the budget `CLAUDE_CODE_SESSION_ID`| Set automatically to the current session ID in Bash and PowerShell tool subprocesses, [hook command](</docs/en/hooks>) subprocesses, and stdio [MCP server](</docs/en/mcp>) subprocesses. For Bash, PowerShell, and hooks this matches the `session_id` field in the hook JSON input and is updated on `/clear`. An MCP server subprocess retains the ID it was spawned with. On `--resume <session-id>` it receives the resumed ID, matching hooks and Bash. On `--continue` or `--resume` without an explicit ID it may receive the initial startup ID instead. Use to correlate scripts and external tools with the Claude Code session that launched them `CLAUDE_CODE_SHELL`| Set the shell Claude Code uses to run Bash tool commands. Accepts a path to a `bash` or `zsh` binary, for example `/opt/homebrew/bin/bash`. Other shells such as `fish` are not supported. If the value is not a working `bash` or `zsh` path, Claude Code ignores it and falls back to auto-detection. Auto-detection uses your `$SHELL` when it points to `bash` or `zsh`, otherwise it picks the first working `zsh` then `bash` found on your `PATH` and standard install locations @@ -380,7 +381,7 @@ `DISABLE_DOCTOR_COMMAND`| Set to `1` to hide the [`/doctor`](</docs/en/commands#all-commands>) setup checkup skill and its `/checkup` alias. Useful for managed deployments where users shouldn’t run setup diagnostics from a session. Doesn’t affect the `claude doctor` terminal command. Before v2.1.205, this variable hid the `/doctor` diagnostics screen command `DISABLE_ERROR_REPORTING`| Set to any non-empty value, such as `1`, to opt out of error reporting. **Setting it to`0` or `false` still opts out**, unlike most on/off variables; unset the variable to turn error reporting back on `DISABLE_EXTRA_USAGE_COMMAND`| Set to `1` to hide the `/usage-credits` command that lets users purchase additional usage beyond rate limits -`DISABLE_FEEDBACK_COMMAND`| Set to `1` to disable the `/feedback` command. Also disables `/bug` and `/share`, which report through the same path; before v2.1.212 they were aliases of `/feedback`, so the command was disabled under every name. The older name `DISABLE_BUG_COMMAND` is also accepted +`DISABLE_FEEDBACK_COMMAND`| Set to `1` to disable the `/feedback` command and [Claude-drafted feedback](</docs/en/tools-reference#sendfeedback-tool-behavior>). Also disables `/bug` and `/share`, which report through the same path; before v2.1.212 they were aliases of `/feedback`, so the command was disabled under every name. The older name `DISABLE_BUG_COMMAND` is also accepted `DISABLE_GROWTHBOOK`| Set to `1` or `true` to disable GrowthBook feature-flag fetching and use code defaults for every flag. This makes [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable. Setting it to `0` or `false` leaves fetching on. Telemetry event logging stays on unless `DISABLE_TELEMETRY` is also set `DISABLE_INSTALLATION_CHECKS`| Set to `1` to disable installation warnings. Use only when manually managing the installation location, as this can mask issues with standard installations `DISABLE_INSTALL_GITHUB_APP_COMMAND`| Set to `1` to hide the `/install-github-app` command. Already hidden when using third-party providers (Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry) @@ -480,6 +481,7 @@ * Have Claude Code refresh the [PR review status badge](</docs/en/interactive-mode#pr-review-status>) less often while you’re idle; Claude Code refreshes it every 60 seconds instead * Get the [v2 MCP client runtime](</docs/en/mcp#mcp-client-runtimes>) and its protocol probe without setting `MCP_SDK_GENERATION` and `MCP_PROTOCOL_NEGOTIATION`; Claude Code uses the v1 runtime unless you set `MCP_SDK_GENERATION=v2`, and skips the probe unless you set `MCP_PROTOCOL_NEGOTIATION=auto` * Get the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) by default for claude.ai and Console accounts on Windows with Git Bash installed; Claude Code routes shell commands through Git Bash unless you set `CLAUDE_CODE_USE_POWERSHELL_TOOL=1`. On Windows without Git Bash, the tool stays on + * Get [Claude-drafted feedback](</docs/en/tools-reference#sendfeedback-tool-behavior>), which Claude Code turns on through a fetched flag ###
modified
--- a/env-vars.md +++ b/env-vars.md @@ -212,6 +212,7 @@ `CLAUDE_CODE_DISABLE_ATTACHMENTS`| Set to `1` to disable attachment processing. File mentions with `@` syntax are sent as plain text instead of being expanded into file content `CLAUDE_CODE_DISABLE_AUTO_MEMORY`| Set to `1` to disable [auto memory](</docs/en/memory#auto-memory>). Set to `0` to force auto memory on even when `--bare` mode or [`autoMemoryEnabled: false`](</docs/en/settings-reference#automemoryenabled>) would otherwise disable it. When disabled, Claude does not create or load auto memory files `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 +`CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_DEFAULT`| Set to `1` to stop Claude Code from treating an [Amazon Bedrock](</docs/en/amazon-bedrock>) streaming response with a missing or empty `Content-Type` header as the binary `application/vnd.amazon.eventstream` format. Amazon Bedrock always sends that header, so when it’s absent, a [proxy stripped it](</docs/en/amazon-bedrock#streaming-errors-behind-a-gateway-or-proxy>) and by default Claude Code decodes the body as the binary format anyway. Set this variable only when the proxy strips the header and also re-emits the body as server-sent events; Claude Code then reads the body as server-sent events instead. Requires Claude Code v2.1.239 or later `CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_GUARD`| Set to `1` to skip the check that an [Amazon Bedrock](</docs/en/amazon-bedrock>) streaming response carries the `application/vnd.amazon.eventstream` content-type. Without this variable, a response with a different content-type fails with an error naming that content-type, which means a [gateway or proxy is transforming the response](</docs/en/amazon-bedrock#streaming-errors-behind-a-gateway-or-proxy>). Set it only when the gateway rewrites the `Content-Type` header but passes the binary event-stream body through unmodified; if the body itself was transformed, requests fail with `Truncated event message received` instead. Requires Claude Code v2.1.208 or later `CLAUDE_CODE_DISABLE_BG_EXIT_HANDOFF`| Set to `1` to stop a [background session’s](</docs/en/agent-view>) running background shell commands, dynamic workflows, and, as of v2.1.198, background subagents when the [supervisor](</docs/en/agent-view#the-supervisor-process>) stops, restarts, or updates that session’s process, instead of handing them to the session’s next process. Affects only that handoff: backgrounding a session with `←` or [`/background`](</docs/en/agent-view#from-inside-a-session>) still carries in-flight work over, and `CLAUDE_DISABLE_ADOPT` turns off both. Requires Claude Code v2.1.196 or later `CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP`| Set to `1` to stop Claude Code from terminating [background shell commands](</docs/en/interactive-mode#background-bash-commands>) when the operating system reports memory pressure. By default, on macOS and Linux, Claude Code terminates a background shell started in the main session on a memory-pressure signal once the session has been idle for 30 minutes and no turn or subagent is running. Windows has no memory-pressure signal, so this variable has no effect there. Requires Claude Code v2.1.193 or later @@ -463,7 +464,7 @@ Features that need feature-flag fetching -Claude Code turns some features on through feature flags it fetches from Anthropic. You turn flag fetching off for a session by setting `DISABLE_GROWTHBOOK`, `DISABLE_TELEMETRY`, `DO_NOT_TRACK`, or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`. Each variable’s row says which values do that. With fetching off, you can’t: +Claude Code turns some features on through feature flags it fetches from Anthropic. You turn flag fetching off for a session by setting `DISABLE_GROWTHBOOK`, `DISABLE_TELEMETRY`, `DO_NOT_TRACK`, or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`. Each variable’s row says which values do that. Claude Code also leaves fetching off when you connect through a [Claude apps gateway](</docs/en/claude-apps-gateway>). On Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, or Microsoft Foundry, Claude Code leaves fetching off unless a host platform that embeds Claude Code sets `CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`. With fetching off, you can’t: * [Start sessions in auto mode by default](</docs/en/permission-modes#which-mode-a-session-starts-in>) on Pro, Max, and Team plans; Claude Code starts your sessions in Manual instead * Have the VS Code extension [read settings files for the starting permission mode](</docs/en/permission-modes#switch-permission-modes>) @@ -480,18 +481,13 @@ * Get the [v2 MCP client runtime](</docs/en/mcp#mcp-client-runtimes>) and its protocol probe without setting `MCP_SDK_GENERATION` and `MCP_PROTOCOL_NEGOTIATION`; Claude Code uses the v1 runtime unless you set `MCP_SDK_GENERATION=v2`, and skips the probe unless you set `MCP_PROTOCOL_NEGOTIATION=auto` * Get the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) by default for claude.ai and Console accounts on Windows with Git Bash installed; Claude Code routes shell commands through Git Bash unless you set `CLAUDE_CODE_USE_POWERSHELL_TOOL=1`. On Windows without Git Bash, the tool stays on -With fetching off, you can still type `/code-review` yourself, but [Claude can’t start the review on its own, and a scheduled `/code-review` reaches Claude as plain text](</docs/en/code-review#let-claude-start-the-review>) instead of running the review. - ### ​ First session after an install or upgrade -You can also miss a flag-gated feature in your first session after you install Claude Code, or after you upgrade to a version that adds the feature, even when none of the variables that disable flag fetching are set. Claude Code fetches the flags during that session, so a feature that’s otherwise available to you is there in your next session. Two features behave differently in that first session: - - * Claude Code [binds the session’s inbox socket](</docs/en/cross-session-messaging#the-sessions-inbox-socket>) and exports the messaging variables partway through the session, as soon as the fetch completes, so other sessions can message it before you restart. - * Claude Code checks the `claude import` flag before it starts a session, so if `claude import` is the first thing you run after installing, it prints [`claude import is not yet available in this build`](</docs/en/errors#claude-import-is-not-yet-available-in-this-build>). Start a session, then run it again. +In your first session after you install Claude Code, or upgrade to a version that adds a feature, a flag-gated feature can be missing, and a session can start in Manual mode on a plan that otherwise starts in auto mode. Claude Code fetches the flags during that session, so both are there in your next session. After a fresh install, a non-interactive session, such as `claude -p`, the Agent SDK, or the VS Code extension, can pick the flags up before it [chooses its starting permission mode](</docs/en/permission-modes#which-mode-a-session-starts-in>); an interactive terminal session doesn’t. ##
modified
--- a/env-vars.md +++ b/env-vars.md @@ -307,6 +307,7 @@ `CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS`| Maximum time in milliseconds that [non-interactive mode](</docs/en/headless#background-tasks-at-exit>) with the `-p` flag waits after the final turn for background subagents and workflows whose result is part of the output. Default: `600000`, or 10 minutes. When the cap is exceeded, remaining background tasks are terminated and the process exits. Set to `0` to wait indefinitely. This cap is separate from the five-second grace period that applies to plain background shells `CLAUDE_CODE_PROCESS_WRAPPER`| Launch the processes Claude Code starts from its own binary, such as the background service that hosts [agent view](</docs/en/agent-view>) sessions, through a corporate launcher given as an argv prefix like `/opt/corp/launcher`. Set it in the `env` block of user or [managed settings](</docs/en/managed-settings>), not as a shell export, so the detached background service inherits it; project and local settings can’t set it. Equivalent to the [`processWrapper` setting](</docs/en/settings-reference#processwrapper>), which requires Claude Code v2.1.210 or later; this variable takes precedence when both are set. The VS Code extension configures its own launcher separately through its `claudeProcessWrapper` setting. Ignored on Windows. See [Run Claude Code behind a corporate launcher](</docs/en/corporate-launcher>) for the value format, what the launcher covers, and the contract the launcher must satisfy. Requires Claude Code v2.1.208 or later `CLAUDE_CODE_PROJECT_DIR_NAME`| Set together with `CLAUDE_CONFIG_DIR` to choose the `projects/` directory name Claude Code stores that session’s transcripts and auto memory under, in place of one derived from the working directory path. For example, starting Claude Code with `CLAUDE_CONFIG_DIR=/srv/tenant-a CLAUDE_CODE_PROJECT_DIR_NAME=work claude` stores them under `/srv/tenant-a/projects/work/`. Claude Code ignores this variable when `CLAUDE_CONFIG_DIR` is unset, and reads it only from the environment you start `claude` from, never from a settings file `env` block. See [Name the project directory yourself](</docs/en/sessions#name-the-project-directory-yourself>). Requires Claude Code v2.1.234 or later +`CLAUDE_CODE_PROMPT_CACHE_TTL`| Set `5m` or `1h`, the only values Claude Code accepts, to choose the [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) for the main conversation: your interactive, `-p`, and SDK turns, plus the helpers that run inline with them. Takes precedence over the `promptCacheTtl` setting and over `ENABLE_PROMPT_CACHING_1H`, and `FORCE_PROMPT_CACHING_5M` overrides it. The API bills 1-hour cache writes at a higher rate. Requires Claude Code v2.1.242 or later `CLAUDE_CODE_PROPAGATE_TRACEPARENT`| Set to `1` to propagate W3C trace context when `ANTHROPIC_BASE_URL` points at a custom proxy. Propagation covers the `traceparent` header on model and HTTP MCP requests and the `TRACEPARENT` environment variable for Bash, PowerShell, and hook subprocesses. By default, propagation is enabled only when connected directly to the Anthropic API. Added in v2.1.152. See [Traces (beta)](</docs/en/monitoring-usage#traces-beta>) `CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`| Set by host platforms that embed Claude Code and manage model provider routing on its behalf. When set, Claude Code ignores provider-selection, endpoint, and authentication variables such as `CLAUDE_CODE_USE_BEDROCK`, `ANTHROPIC_BASE_URL`, and `ANTHROPIC_API_KEY` in settings files, so user settings can’t override the host’s routing. Claude Code also ignores model-selection keys such as `model`, `fallbackModel`, and `modelOverrides` in [managed settings](</docs/en/managed-settings>), whichever managed source delivers them, so the host’s model configuration takes precedence over an out-of-date managed model pin. Claude Code also ignores model-selection variables such as `ANTHROPIC_MODEL` and the `ANTHROPIC_DEFAULT_*_MODEL` family in a managed `env` block; an [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist in managed settings still applies unless the host supplies its own. Claude Code also skips the automatic telemetry opt-out it otherwise applies on third-party providers such as Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, and Microsoft Foundry, so telemetry follows the standard `DISABLE_TELEMETRY` opt-out. See [Default behaviors by API provider](</docs/en/data-usage#default-behaviors-by-api-provider>) `CLAUDE_CODE_PROXY_RESOLVES_HOSTS`| Set to `1` to allow the proxy to perform DNS resolution instead of the caller. Opt-in for environments where the proxy should handle hostname resolution @@ -336,6 +337,7 @@ `CLAUDE_CODE_SKIP_VERTEX_AUTH`| Skip Google authentication for Google Cloud’s Agent Platform (for example, when using an LLM gateway) `CLAUDE_CODE_STOP_HOOK_BLOCK_CAP`| Maximum number of consecutive times a [Stop](</docs/en/hooks#stop>) or [SubagentStop](</docs/en/hooks#subagentstop>) hook may block the turn from ending before Claude Code overrides it and ends the turn anyway (default: 8). Set to `0` to disable the cap. Raise this if your hook legitimately needs more iterations to resolve `CLAUDE_CODE_SUBAGENT_MODEL`| The model Claude Code uses for all [subagents](</docs/en/sub-agents#choose-a-model>), [agent teams](</docs/en/agent-teams>), and agents in a [workflow](</docs/en/workflows>). Accepts an alias such as `haiku` or a full model name, and takes precedence over the per-invocation `model` parameter and the subagent definition’s `model` frontmatter. See [Model configuration](</docs/en/model-config#environment-variables>). Setting it to `inherit` is the same as leaving it unset; before v2.1.196, `inherit` was an override that forced every subagent onto the main conversation’s model +`CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL`| Set `5m` or `1h`, the only values Claude Code accepts, to choose the [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) for requests outside the main conversation, such as [subagents](</docs/en/sub-agents>), workflows, and background work. Takes precedence over the `subagentPromptCacheTtl` setting and over `ENABLE_PROMPT_CACHING_1H`, and `FORCE_PROMPT_CACHING_5M` overrides it. The API bills 1-hour cache writes at a higher rate. Requires Claude Code v2.1.242 or later `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB`| Set to `1` to strip Anthropic and cloud provider credentials from subprocess environments (Bash tool, hooks, MCP stdio servers). The parent Claude process keeps these credentials for API calls, but child processes cannot read them, reducing exposure to prompt injection attacks that attempt to exfiltrate secrets via shell expansion. On Linux, this also runs Bash subprocesses in an isolated PID namespace so they cannot read host process environments via `/proc`; as a side effect, `ps`, `pgrep`, and `kill` cannot see or signal host processes. `claude-code-action` sets this automatically when `allowed_non_write_users` is configured `CLAUDE_CODE_SYNC_PLUGIN_INSTALL`| Set to `1` in non-interactive mode (the `-p` flag) to wait for plugin installation to complete before the first query. Without this, plugins install in the background and may not be available on the first turn. Combine with `CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS` to bound the wait `CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS`| Timeout in milliseconds for synchronous plugin installation. When exceeded, Claude Code proceeds without plugins and logs an error. No default: without this variable, synchronous installation waits until complete @@ -394,13 +396,13 @@ `DISABLE_UPGRADE_COMMAND`| Set to `1` to hide the `/upgrade` command `DO_NOT_TRACK`| Set to `1` to opt out of telemetry, with the same effect as `DISABLE_TELEMETRY`, including making [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable. Claude Code reads this variable as a standard boolean, so `0` leaves telemetry on, and honors it as the cross-tool convention recognized by many developer CLIs `ENABLE_CLAUDEAI_MCP_SERVERS`| Set to `false` to disable [claude.ai MCP servers](</docs/en/mcp#use-mcp-servers-from-claude-ai>) in Claude Code. Enabled by default for logged-in users. To disable per-project or per-org, set [`disableClaudeAiConnectors`](</docs/en/settings-reference#disableclaudeaiconnectors>) in settings instead -`ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) instead of the default 5 minutes. Intended for API key, [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), [Microsoft Foundry](</docs/en/microsoft-foundry>), and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) users. Subscription users within included usage receive 1-hour TTL automatically. Subscription users drawing on [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>) can set it to keep the 1-hour TTL. 1-hour cache writes are billed at a higher rate +`ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) instead of the default 5 minutes. Intended for API key, [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), [Microsoft Foundry](</docs/en/microsoft-foundry>), and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) users. Subscription users within included usage receive the 1-hour TTL automatically on the [main conversation](</docs/en/prompt-caching#which-ttl-each-request-gets>). Subscription users drawing on [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>) can set it to keep the 1-hour TTL. 1-hour cache writes are billed at a higher rate. To choose the TTL per request bucket instead, use `CLAUDE_CODE_PROMPT_CACHE_TTL` and `CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL`, which take precedence over this variable `ENABLE_PROMPT_CACHING_1H_BEDROCK`| Deprecated. Use `ENABLE_PROMPT_CACHING_1H` instead `ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset, Claude Code defers all MCP tools by default. It still loads them upfront on Google Cloud’s Agent Platform models earlier than the Claude 4.5 generation, on a Microsoft Foundry deployment hosted on Azure, and when `ANTHROPIC_BASE_URL` points to a non-first-party host. `true` always defers and sends the beta header, except on those same Agent Platform models and Microsoft Foundry deployments; requests fail on proxies that don’t support `tool_reference`. `auto` loads upfront when tool definitions fit within 10% of context. `auto:N` sets a custom threshold, such as `auto:5` for 5%. `false` loads all tools upfront. A value you set yourself is ignored when `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS` is set. Before v2.1.221, Claude Code disabled tool search for all models on Google Cloud’s Agent Platform unless you set this variable to `true` `FALLBACK_FOR_ALL_PRIMARY_MODELS`| Set to any non-empty value, such as `1`, to make every model stop retrying with a repeated-overload error when no fallback model is configured. **Setting it to`0` or `false` still enables this**, unlike most on/off variables; unset the variable to restore the default retry behavior. Without it, models Claude Code recognizes as Opus, Fable 5, or Mythos models stop retrying this way when you authenticate with an API key or a [third-party provider](</docs/en/third-party-integrations>) rather than a Claude subscription. As of v2.1.160, a configured [fallback model chain](</docs/en/model-config#fallback-model-chains>) triggers on repeated overload errors for any primary model, so this variable does not affect switching to a fallback model `FORCE_AUTOUPDATE_PLUGINS`| Set to `1` to force plugin auto-updates even when the main auto-updater is disabled via `DISABLE_AUTOUPDATER` `FORCE_HYPERLINK`| Set to `1` to enable clickable OSC 8 hyperlinks when your terminal supports them but isn’t auto-detected, or `0` to disable them. When unset, Claude Code enables hyperlinks only when it detects terminal support. Claude Code parses this value as a number, not a Boolean, so a value such as `false`, `no`, or `off` enables hyperlinks rather than disabling them. Claude Code renders the footer [PR or merge request badge](</docs/en/interactive-mode#pr-review-status>) as a hyperlink even when it can’t detect terminal support, such as over SSH. Set `0` to render the badge as plain text -`FORCE_PROMPT_CACHING_5M`| Set to `1` to force the 5-minute prompt cache TTL even when 1-hour TTL would otherwise apply. Overrides `ENABLE_PROMPT_CACHING_1H` +`FORCE_PROMPT_CACHING_5M`| Set to `1` to force the 5-minute prompt cache TTL even when 1-hour TTL would otherwise apply. Overrides `CLAUDE_CODE_PROMPT_CACHE_TTL`, `CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL`, `ENABLE_PROMPT_CACHING_1H`, and the `promptCacheTtl` and `subagentPromptCacheTtl` settings `HTTP_PROXY`| Specify HTTP proxy server for network connections `HTTPS_PROXY`| Specify HTTPS proxy server for network connections `IS_DEMO`| Set to any non-empty value, such as `1`, to enable demo mode: hides your email and organization name from the header and `/status` output, and skips onboarding. **Setting it to`0` or `false` still enables demo mode**, unlike most on/off variables; unset the variable to turn it off. Useful when streaming or recording a session @@ -476,6 +478,7 @@ * Read or reply to [comments on an artifact](</docs/en/artifacts#collect-comments-on-an-artifact>), unless you set `CLAUDE_CODE_ARTIFACT_COMMENTS=1`; for Claude to reply to sent comments on its own, also set `CLAUDE_CODE_ARTIFACT_COMMENTS_AUTOREACT=1`. Neither override helps under `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`, which [turns artifacts off entirely](</docs/en/artifacts#availability>) * Have Claude Code refresh the [PR review status badge](</docs/en/interactive-mode#pr-review-status>) less often while you’re idle; Claude Code refreshes it every 60 seconds instead * Get the [v2 MCP client runtime](</docs/en/mcp#mcp-client-runtimes>) and its protocol probe without setting `MCP_SDK_GENERATION` and `MCP_PROTOCOL_NEGOTIATION`; Claude Code uses the v1 runtime unless you set `MCP_SDK_GENERATION=v2`, and skips the probe unless you set `MCP_PROTOCOL_NEGOTIATION=auto` + * Get the [PowerShell tool](</docs/en/tools-reference#powershell-tool>) by default for claude.ai and Console accounts on Windows with Git Bash installed; Claude Code routes shell commands through Git Bash unless you set `CLAUDE_CODE_USE_POWERSHELL_TOOL=1`. On Windows without Git Bash, the tool stays on With fetching off, you can still type `/code-review` yourself, but [Claude can’t start the review on its own, and a scheduled `/code-review` reaches Claude as plain text](</docs/en/code-review#let-claude-start-the-review>) instead of running the review.
modified
--- a/env-vars.md +++ b/env-vars.md @@ -465,6 +465,7 @@ * [Start sessions in auto mode by default](</docs/en/permission-modes#which-mode-a-session-starts-in>) on Pro, Max, and Team plans; Claude Code starts your sessions in Manual instead * Have the VS Code extension [read settings files for the starting permission mode](</docs/en/permission-modes#switch-permission-modes>) + * Run [`/auto-mode-setup`](</docs/en/auto-mode-config#generate-environment-entries>) to draft `autoMode.environment` entries * Use [Remote Control](</docs/en/remote-control#requirements>) * Send or receive [cross-session messages](</docs/en/cross-session-messaging#availability>) * Run [`claude import` or the `/import` command](</docs/en/cli-reference#cli-commands>)
modified
Show diff (213 lines)
--- a/env-vars.md +++ b/env-vars.md @@ -82,7 +82,7 @@ `.claude/settings.local.json`| You, in this project only, gitignored when Claude Code saves a setting to it; add it to your gitignore if you create it by hand Managed settings| Everyone in your organization, deployed by an admin -See [Settings files](</docs/en/settings#settings-files>) for where each file lives and [Settings precedence](</docs/en/settings#settings-precedence>) for how they combine when more than one sets the same variable. +See [Settings files](</docs/en/settings#where-settings-live>) for where each file lives and [Settings precedence](</docs/en/settings#settings-precedence>) for how they combine when more than one sets the same variable. ## @@ -90,7 +90,7 @@ Precedence -Some behaviors have both an environment variable and a dedicated settings key. If you set both, the environment variable takes precedence, except for [`ANTHROPIC_DEFAULT_MODEL`](</docs/en/model-config#set-a-default-model-for-new-sessions>). For example, `ANTHROPIC_MODEL` overrides the `model` setting, and `CLAUDE_CODE_AUTO_CONNECT_IDE` overrides `autoConnectIde`. When the same variable is set in both your shell and a settings file `env` block, the settings file value applies. Claude Code writes each `env` entry into the process environment at startup and again when the file changes, replacing the value inherited from the shell. A few variables are special-cased; the [`env` setting](</docs/en/settings#available-settings>) lists the exceptions. In a settings file you can set a variable but you can’t remove one. To override a variable you can’t unset, such as a stale `CLAUDE_CODE_USE_VERTEX` exported by a shell profile you don’t control, set it to an empty string in the `env` block: `"CLAUDE_CODE_USE_VERTEX": ""`. Claude Code treats the empty value as unset for provider selection. Subprocesses still inherit the empty value. Between settings files, `env` values follow [settings precedence](</docs/en/settings#settings-precedence>), so a managed settings entry overrides the same variable in user or project settings. How an environment variable interacts with CLI flags and in-session commands varies per feature: `--model` and `/model` override `ANTHROPIC_MODEL`, while `CLAUDE_CODE_EFFORT_LEVEL` overrides `/effort`. When a variable interacts with another configuration source, its row in the Variables list states the precedence or links to the page that documents it. Claude Code reads shell environment variables at startup, so changes to them take effect the next time you launch `claude`. Variables set under the `env` key in settings files are reapplied to a running session when the file changes, with the startup-only exception described in In settings files. +Some behaviors have both an environment variable and a dedicated settings key, and which one Claude Code reads first differs per key. For `ANTHROPIC_MODEL` and `CLAUDE_CODE_AUTO_CONNECT_IDE`, Claude Code reads the variable first and uses the `model` or `autoConnectIde` setting only when the variable is unset. For the pair you’re setting, check the variable’s row below and the key’s entry on the [settings reference](</docs/en/settings-reference>). When the same variable is set in both your shell and a settings file `env` block, the settings file value applies. Claude Code writes each `env` entry into the process environment at startup and again when the file changes, replacing the value inherited from the shell. A few variables are special-cased; the [`env` setting](</docs/en/settings-reference#env>) lists the exceptions. In a settings file you can set a variable but you can’t remove one. To override a variable you can’t unset, such as a stale `CLAUDE_CODE_USE_VERTEX` exported by a shell profile you don’t control, set it to an empty string in the `env` block: `"CLAUDE_CODE_USE_VERTEX": ""`. Claude Code treats the empty value as unset for provider selection. Subprocesses still inherit the empty value. Between settings files, `env` values follow [settings precedence](</docs/en/settings#settings-precedence>), so a managed settings entry overrides the same variable in user or project settings. How an environment variable interacts with CLI flags and in-session commands varies per feature: `--model` and `/model` override `ANTHROPIC_MODEL`, while `CLAUDE_CODE_EFFORT_LEVEL` overrides `/effort`. When a variable interacts with another configuration source, its row in the Variables list states the precedence or links to the page that documents it. Claude Code reads shell environment variables at startup, so changes to them take effect the next time you launch `claude`. Variables set under the `env` key in settings files are reapplied to a running session when the file changes, with the startup-only exception described in In settings files. ## @@ -167,15 +167,15 @@ `BASH_MAX_TIMEOUT_MS`| Maximum timeout the model can set for long-running bash commands (default: 600000, or 10 minutes). The effective ceiling is the larger of this and `BASH_DEFAULT_TIMEOUT_MS` `CCR_FORCE_BUNDLE`| Set to `1` to force [`claude --cloud`](</docs/en/claude-code-on-the-web#send-local-repositories-without-github>) to bundle and upload your local repository even when GitHub access is available `CLAUDECODE`| Set to `1` in subprocesses Claude Code spawns (Bash and PowerShell tools, tmux sessions, [hook](</docs/en/hooks>) commands, [status line](</docs/en/statusline>) commands, stdio [MCP server](</docs/en/mcp>) subprocesses). IDE extensions also set this in their integrated terminals. Use to detect when a script is running inside a subprocess spawned by Claude Code. To check whether the current process was spawned directly by a tool call or hook, rather than inside a stdio MCP server that Claude Code started, use `CLAUDE_CODE_CHILD_SESSION` instead -`CLAUDE_AFK_COUNTDOWN_MS`| How many milliseconds before auto-continue the on-screen countdown appears on an unanswered [`AskUserQuestion`](</docs/en/tools-reference>) dialog. Default `20000` (20 seconds), capped at the auto-continue timeout. Has no effect unless auto-continue is on; see the [`askUserQuestionTimeout`](</docs/en/settings#available-settings>) setting and `CLAUDE_AFK_TIMEOUT_MS`. Requires Claude Code v2.1.198 or later -`CLAUDE_AFK_TIMEOUT_MS`| How many milliseconds of idle time before an unanswered [`AskUserQuestion`](</docs/en/tools-reference>) dialog auto-continues without you. Auto-continue is off by default; opt in with the [`askUserQuestionTimeout`](</docs/en/settings#available-settings>) setting. This variable is an override for demos and automated tests: when set, it takes precedence over that setting and turns auto-continue on even when the setting is unset or `never`. Setting `0` doesn’t turn the timeout off; it closes the dialog immediately. In v2.1.198 and v2.1.199, auto-continue was on by default with a `60000` (60 seconds) timeout. Requires Claude Code v2.1.198 or later +`CLAUDE_AFK_COUNTDOWN_MS`| How many milliseconds before auto-continue the on-screen countdown appears on an unanswered [`AskUserQuestion`](</docs/en/tools-reference>) dialog. Default `20000` (20 seconds), capped at the auto-continue timeout. Has no effect unless auto-continue is on; see the [`askUserQuestionTimeout`](</docs/en/settings-reference#askuserquestiontimeout>) setting and `CLAUDE_AFK_TIMEOUT_MS`. Requires Claude Code v2.1.198 or later +`CLAUDE_AFK_TIMEOUT_MS`| How many milliseconds of idle time before an unanswered [`AskUserQuestion`](</docs/en/tools-reference>) dialog auto-continues without you. Auto-continue is off by default; opt in with the [`askUserQuestionTimeout`](</docs/en/settings-reference#askuserquestiontimeout>) setting. This variable is an override for demos and automated tests: when set, it takes precedence over that setting and turns auto-continue on even when the setting is unset or `never`. Setting `0` doesn’t turn the timeout off; it closes the dialog immediately. In v2.1.198 and v2.1.199, auto-continue was on by default with a `60000` (60 seconds) timeout. Requires Claude Code v2.1.198 or later `CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS`| Set to `1` to disable all built-in [subagent](</docs/en/sub-agents>) types such as Explore and Plan. Only applies in non-interactive mode (the `-p` flag). Useful for SDK users who want a blank slate. This also removes `general-purpose`, the subagent Claude Code runs when an Agent tool call omits `subagent_type`. Such a call then fails with [`subagent_type is required`](</docs/en/errors#subagent-type-is-required>) `CLAUDE_AGENT_SDK_MCP_NO_PREFIX`| Set to `1` to skip the `mcp__<server>__` prefix on tool names from SDK-created MCP servers. Tools use their original names. SDK usage only `CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS`| Stall timeout in milliseconds for background subagents. Default `600000` (10 minutes). The timer resets on each streaming progress event; if no progress arrives within the window, the subagent is aborted and the task is marked failed, surfacing any partial result to the parent `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE`| Set the percentage (1-100) of the auto-compact window at which auto-compaction triggers. Use lower values like `50` to compact earlier; the variable can’t raise the threshold, so values above the default percentage are ignored. It applies only in sessions that [compact before the model’s context limit](</docs/en/model-config#context-window-and-auto-compaction>). Applies to both main conversations and subagents `CLAUDE_AUTO_BACKGROUND_TASKS`| Set to `1` to force-enable automatic backgrounding of long-running agent tasks. When enabled, subagents are moved to the background after running for approximately two minutes. Also enables [automatic backgrounding of long MCP tool calls](</docs/en/mcp#automatic-backgrounding-of-long-tool-calls>) in non-interactive mode on Claude Code v2.1.212 or later `CLAUDE_AX_PREPARK_MS`| In [screen reader mode](</docs/en/accessibility#what-your-screen-reader-hears>), how many milliseconds Claude Code waits, with the cursor at the start of the line, before it writes a new or changed line. Default `50`. Set `0` to write immediately. Claude Code caps the wait at `5000`. Requires Claude Code v2.1.233 or later -`CLAUDE_AX_SCREEN_READER`| Set to `1` to render screen-reader friendly output: flat text without decorative borders or animations. Set to `0` to force screen-reader mode off even when [`axScreenReader`](</docs/en/settings#available-settings>) is `true`. The [`--ax-screen-reader`](</docs/en/cli-reference#cli-flags>) flag takes precedence. Requires Claude Code v2.1.181 or later +`CLAUDE_AX_SCREEN_READER`| Set to `1` to render screen-reader friendly output: flat text without decorative borders or animations. Set to `0` to force screen-reader mode off even when [`axScreenReader`](</docs/en/settings-reference#axscreenreader>) is `true`. The [`--ax-screen-reader`](</docs/en/cli-reference#cli-flags>) flag takes precedence. Requires Claude Code v2.1.181 or later `CLAUDE_AX_STARTUP_QUIET_MS`| In [screen reader mode](</docs/en/accessibility>), how many milliseconds Claude Code holds the first interface render after the startup confirmation line, so your screen reader can speak the line in full before new output interrupts it. Default `3000`. Set `0` to render immediately. Claude Code caps the hold at `600000` (10 minutes). Your first keystroke ends the hold early. Requires Claude Code v2.1.217 or later `CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR`| Return to the original working directory after each Bash or PowerShell command in the main session `CLAUDE_BYTE_STREAM_IDLE_TIMEOUT_MS`| Timeout in milliseconds for the byte-level streaming idle watchdog only; when set, it takes precedence over `CLAUDE_STREAM_IDLE_TIMEOUT_MS` for that watchdog and leaves the event-level watchdog unchanged. Claude Code clamps this variable to between 10 seconds and 30 minutes. Requires Claude Code v2.1.210 or later @@ -184,13 +184,13 @@ `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD`| Set to `1` to load memory files from directories specified with `--add-dir`. Loads `CLAUDE.md`, `.claude/CLAUDE.md`, `.claude/rules/*.md`, and `CLAUDE.local.md`. By default, additional directories do not load memory files `CLAUDE_CODE_ALT_SCREEN_FULL_REPAINT`| Set to `1` to repaint the entire screen on every frame in [fullscreen rendering](</docs/en/fullscreen>) instead of sending incremental updates. Use this if fullscreen mode shows stale or misplaced text fragments. Claude Code enables this automatically for background sessions and [agent view](</docs/en/agent-view>) on Windows `CLAUDE_CODE_ALWAYS_ENABLE_EFFORT`| Set to `1` to send the [effort](</docs/en/model-config#adjust-effort-level>) parameter with every request, even when Claude Code does not recognize the model ID as effort-capable. Use this when routing through an [LLM gateway](</docs/en/llm-gateway>) or third-party provider that serves models under custom identifiers. Models that reject the effort parameter at the API, including Claude 3 models, Sonnet 4.0 and 4.5, Opus 4.0 and 4.1, and Haiku 4.5, are still excluded so requests do not fail -`CLAUDE_CODE_API_KEY_HELPER_TTL_MS`| Interval in milliseconds at which credentials should be refreshed (when using [`apiKeyHelper`](</docs/en/settings#available-settings>)) +`CLAUDE_CODE_API_KEY_HELPER_TTL_MS`| Interval in milliseconds at which credentials should be refreshed (when using [`apiKeyHelper`](</docs/en/settings-reference#apikeyhelper>)) `CLAUDE_CODE_ARTIFACT_AUTO_OPEN`| Set to `0` to stop Claude Code from opening the browser automatically when a new [artifact](</docs/en/artifacts>) is published. Republishing an existing artifact does not open the browser regardless of this setting `CLAUDE_CODE_ARTIFACT_COMMENTS`| Set to `1` to let Claude read and reply to [comments on an artifact](</docs/en/artifacts#collect-comments-on-an-artifact>) when feature-flag fetching is off. Set to `0` to turn comment reading and replying off even when fetching is on. Has no effect when `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` has [turned artifacts off](</docs/en/artifacts#availability>). Requires Claude Code v2.1.221 or later `CLAUDE_CODE_ARTIFACT_COMMENTS_AUTOREACT`| Set to `1` to let Claude [reply on its own to comments sent to it](</docs/en/artifacts#let-claude-reply-to-comments-on-its-own>) when feature-flag fetching is off, or `0` to turn that off even when fetching is on. Needs comment reading on as well. Requires Claude Code v2.1.228 or later `CLAUDE_CODE_ATTRIBUTION_HEADER`| Set to `0` to omit the [attribution block](</docs/en/llm-gateway-protocol#system-prompt-attribution-block>), which carries the client version and a prompt fingerprint, from the start of the system prompt. Caching on a direct connection to the Anthropic API is unaffected either way. In some direct-connection setups, Claude Code keeps the block on [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) classifier requests even when you set `0`. In [System prompt attribution block](</docs/en/llm-gateway-protocol#system-prompt-attribution-block>), check which connections and credentials this covers. Before v2.1.181 the block included a per-request token on custom base URLs and Microsoft Foundry connections, so on those versions set it to `0` when your LLM gateway caches on the request body or forwards requests to a third-party provider, or when you connect to Microsoft Foundry directly `CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the [auto-compact window](</docs/en/model-config#set-the-auto-compact-window>) in tokens, from `100000` to `1000000`. Accepts a plain integer such as `500000` only: a value like `500k` reads as `500` and clamps to the 100K minimum. Takes precedence over the `/autocompact` command, the `--autocompact` flag, and the `autoCompactWindow` setting. The status line’s `used_percentage` always measures against the model’s full context window, so once this variable is set, that percentage no longer indicates when compaction will run -`CLAUDE_CODE_AUTO_CONNECT_IDE`| Override automatic [IDE connection](</docs/en/vs-code>). By default, Claude Code connects automatically when launched inside a supported IDE’s integrated terminal. Set to `false` to prevent this. Set to `true` to force a connection attempt when auto-detection fails, such as when tmux obscures the parent terminal. Takes precedence over the [`autoConnectIde`](</docs/en/settings#global-config-settings>) global config setting +`CLAUDE_CODE_AUTO_CONNECT_IDE`| Override automatic [IDE connection](</docs/en/vs-code>). By default, Claude Code connects automatically when launched inside a supported IDE’s integrated terminal. Set to `false` to prevent this. Set to `true` to force a connection attempt when auto-detection fails, such as when tmux obscures the parent terminal. Takes precedence over the [`autoConnectIde`](</docs/en/settings-reference#autoconnectide>) global config setting `CLAUDE_CODE_AWS_CHAIN_RESOLVE_TIMEOUT_MS`| Time in milliseconds Claude Code waits for the AWS default credential provider chain to produce credentials before the request fails with [`AWS default-chain credential resolve timed out`](</docs/en/errors#aws-default-chain-credential-resolve-timed-out>) (default: `60000`). Raise it when a step in your chain legitimately needs longer, such as a browser-based SSO sign-in with MFA through a wrapper like `aws-vault`. Applies wherever Claude Code signs with the default chain: [Amazon Bedrock](</docs/en/amazon-bedrock#credential-caching-and-resolution-timeout>), [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), and the [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>). Requires Claude Code v2.1.207 or later `CLAUDE_CODE_BRIDGE_SESSION_ID`| Set automatically in Bash tool and [hook command](</docs/en/hooks>) subprocesses while the session has an active [Remote Control](</docs/en/remote-control>) connection, and removed when the connection ends. The value is the session’s ID in `session_` form, the same identifier that appears in the session’s `claude.ai/code` URL, so a script can link back to the session that ran it. Requires Claude Code v2.1.199 or later. In [cloud sessions](</docs/en/claude-code-on-the-web>), read `CLAUDE_CODE_REMOTE_SESSION_ID` instead `CLAUDE_CODE_BS_AS_CTRL_BACKSPACE`| Set to `0` to make Claude Code read the `0x08` byte, also written `^H`, as plain Backspace, or `1` to read it as Ctrl+Backspace. Either value replaces the platform default. By default, Claude Code reads it as Ctrl+Backspace on Windows, except when `TERM_PROGRAM` is `mintty` or `TERM` is `cygwin`, and as plain Backspace on macOS and Linux. Set `0` in a Windows terminal where [Backspace deletes a whole word](</docs/en/terminal-config#fix-backspace-deleting-a-whole-word-on-windows>) @@ -204,26 +204,26 @@ `CLAUDE_CODE_DEBUG_LOG_LEVEL`| Minimum log level written to the debug log file. Values: `verbose`, `debug` (default), `info`, `warn`, `error`. Set to `verbose` to include high-volume diagnostics like full status line command output, or raise to `error` to reduce noise `CLAUDE_CODE_DISABLE_1M_CONTEXT`| Set to `1` to disable [1M context window](</docs/en/model-config#extended-context>) support. When set, 1M model variants are unavailable in the model picker, and Claude Code holds sessions on models with a native 1M window, such as [Sonnet 5](</docs/en/model-config#sonnet-5-context-window>) and Fable 5, to a 200K window; see [Extended context](</docs/en/model-config#extended-context>) for how the hold is enforced. Useful for enterprise environments with compliance requirements. For its role in correcting the window for an unrecognized `[1m]` model ID, see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>) `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING`| Set to `1` to disable [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) on Opus 4.6 and Sonnet 4.6 and fall back to the fixed thinking budget controlled by `MAX_THINKING_TOKENS`. Has no effect on Fable 5, Sonnet 5, or Opus 4.7 and later, which always use adaptive reasoning -`CLAUDE_CODE_DISABLE_ADMIN_ENV_UNION`| Set to `1` to stop Claude Code from merging [managed settings](</docs/en/settings#precedence-within-the-managed-tier>) `env` blocks per key across admin sources, so only the highest-priority source’s whole `env` block applies, as before v2.1.223. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.223 or later +`CLAUDE_CODE_DISABLE_ADMIN_ENV_UNION`| Set to `1` to stop Claude Code from merging [managed settings](</docs/en/managed-settings#precedence-within-the-managed-tier>) `env` blocks per key across admin sources, so only the highest-priority source’s whole `env` block applies, as before v2.1.223. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.223 or later `CLAUDE_CODE_DISABLE_ADVISOR_TOOL`| Set to `1` to disable the [advisor tool](</docs/en/advisor>). The `/advisor` command becomes unavailable, any configured `advisorModel` is ignored, and the `--advisor` flag is accepted but has no effect, so existing scripts that pass it continue to work without errors -`CLAUDE_CODE_DISABLE_AGENT_VIEW`| Set to `1` to turn off [background agents and agent view](</docs/en/agent-view>): `claude agents`, `--bg`, `/background`, and the on-demand supervisor. Equivalent to the [`disableAgentView`](</docs/en/settings#available-settings>) setting -`CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN`| Set to `1` to disable [fullscreen rendering](</docs/en/fullscreen>) and use the classic main-screen renderer. The conversation stays in your terminal’s native scrollback so `Cmd+f` and tmux copy mode work as usual. Takes precedence over `CLAUDE_CODE_NO_FLICKER` and the [`tui`](</docs/en/settings#available-settings>) setting. You can also switch with `/tui default`. Does not apply to background sessions opened from [agent view](</docs/en/agent-view>), which always use fullscreen rendering -`CLAUDE_CODE_DISABLE_ARTIFACT`| Set to `1` to disable the [Artifact](</docs/en/artifacts>) tool, which publishes session output as a private web page on claude.ai. Equivalent to the [`disableArtifact`](</docs/en/settings#available-settings>) setting +`CLAUDE_CODE_DISABLE_AGENT_VIEW`| Set to `1` to turn off [background agents and agent view](</docs/en/agent-view>): `claude agents`, `--bg`, `/background`, and the on-demand supervisor. Equivalent to the [`disableAgentView`](</docs/en/settings-reference#disableagentview>) setting +`CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN`| Set to `1` to disable [fullscreen rendering](</docs/en/fullscreen>) and use the classic main-screen renderer. The conversation stays in your terminal’s native scrollback so `Cmd+f` and tmux copy mode work as usual. Takes precedence over `CLAUDE_CODE_NO_FLICKER` and the [`tui`](</docs/en/settings-reference#tui>) setting. You can also switch with `/tui default`. Does not apply to background sessions opened from [agent view](</docs/en/agent-view>), which always use fullscreen rendering +`CLAUDE_CODE_DISABLE_ARTIFACT`| Set to `1` to disable the [Artifact](</docs/en/artifacts>) tool, which publishes session output as a private web page on claude.ai. Equivalent to the [`disableArtifact`](</docs/en/settings-reference#disableartifact>) setting `CLAUDE_CODE_DISABLE_ATTACHMENTS`| Set to `1` to disable attachment processing. File mentions with `@` syntax are sent as plain text instead of being expanded into file content -`CLAUDE_CODE_DISABLE_AUTO_MEMORY`| Set to `1` to disable [auto memory](</docs/en/memory#auto-memory>). Set to `0` to force auto memory on even when `--bare` mode or [`autoMemoryEnabled: false`](</docs/en/settings#available-settings>) would otherwise disable it. When disabled, Claude does not create or load auto memory files +`CLAUDE_CODE_DISABLE_AUTO_MEMORY`| Set to `1` to disable [auto memory](</docs/en/memory#auto-memory>). Set to `0` to force auto memory on even when `--bare` mode or [`autoMemoryEnabled: false`](</docs/en/settings-reference#automemoryenabled>) would otherwise disable it. When disabled, Claude does not create or load auto memory files `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 `CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_GUARD`| Set to `1` to skip the check that an [Amazon Bedrock](</docs/en/amazon-bedrock>) streaming response carries the `application/vnd.amazon.eventstream` content-type. Without this variable, a response with a different content-type fails with an error naming that content-type, which means a [gateway or proxy is transforming the response](</docs/en/amazon-bedrock#streaming-errors-behind-a-gateway-or-proxy>). Set it only when the gateway rewrites the `Content-Type` header but passes the binary event-stream body through unmodified; if the body itself was transformed, requests fail with `Truncated event message received` instead. Requires Claude Code v2.1.208 or later `CLAUDE_CODE_DISABLE_BG_EXIT_HANDOFF`| Set to `1` to stop a [background session’s](</docs/en/agent-view>) running background shell commands, dynamic workflows, and, as of v2.1.198, background subagents when the [supervisor](</docs/en/agent-view#the-supervisor-process>) stops, restarts, or updates that session’s process, instead of handing them to the session’s next process. Affects only that handoff: backgrounding a session with `←` or [`/background`](</docs/en/agent-view#from-inside-a-session>) still carries in-flight work over, and `CLAUDE_DISABLE_ADOPT` turns off both. Requires Claude Code v2.1.196 or later `CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP`| Set to `1` to stop Claude Code from terminating [background shell commands](</docs/en/interactive-mode#background-bash-commands>) when the operating system reports memory pressure. By default, on macOS and Linux, Claude Code terminates a background shell started in the main session on a memory-pressure signal once the session has been idle for 30 minutes and no turn or subagent is running. Windows has no memory-pressure signal, so this variable has no effect there. Requires Claude Code v2.1.193 or later -`CLAUDE_CODE_DISABLE_BUNDLED_SKILLS`| Set to `1` to disable the [skills](</docs/en/skills>) and workflows included with Claude Code: bundled skills and workflows are removed entirely, while built-in commands like `/init` stay typable but are hidden from the model. `/doctor` stays typable like the built-in commands; hide it with `DISABLE_DOCTOR_COMMAND` instead. Skills from plugins, `.claude/skills/`, and `.claude/commands/` are unaffected. Equivalent to the [`disableBundledSkills`](</docs/en/settings#available-settings>) setting +`CLAUDE_CODE_DISABLE_BUNDLED_SKILLS`| Set to `1` to disable the [skills](</docs/en/skills>) and workflows included with Claude Code: bundled skills and workflows are removed entirely, while built-in commands like `/init` stay typable but are hidden from the model. `/doctor` stays typable like the built-in commands; hide it with `DISABLE_DOCTOR_COMMAND` instead. Skills from plugins, `.claude/skills/`, and `.claude/commands/` are unaffected. Equivalent to the [`disableBundledSkills`](</docs/en/settings-reference#disablebundledskills>) setting `CLAUDE_CODE_DISABLE_CLAUDE_MDS`| Set to `1` to prevent loading any CLAUDE.md memory files into context, including user, project, and auto memory files `CLAUDE_CODE_DISABLE_CRON`| Set to `1` to disable [scheduled tasks](</docs/en/scheduled-tasks>). The `/loop` skill and cron tools become unavailable and any already-scheduled tasks stop firing, including tasks that are already running mid-session -`CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`| Set to `1` to strip Anthropic-specific `anthropic-beta` request headers and beta tool-schema fields (such as `defer_loading` and `eager_input_streaming`) from API requests. Use this when a proxy gateway rejects requests with errors like “Unexpected value(s) for the `anthropic-beta` header” or “Extra inputs are not permitted”. Standard fields (`name`, `description`, `input_schema`, `cache_control`) are preserved. [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) is disabled and all MCP tools load upfront, even when you set `ENABLE_TOOL_SEARCH`. On Claude Code v2.1.227 or later, [managed settings](</docs/en/settings#settings-files>) can keep tool search on. [Disable pre-release capabilities](</docs/en/llm-gateway-protocol#disable-pre-release-capabilities>) covers where the override applies +`CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`| Set to `1` to strip Anthropic-specific `anthropic-beta` request headers and beta tool-schema fields (such as `defer_loading` and `eager_input_streaming`) from API requests. Use this when a proxy gateway rejects requests with errors like “Unexpected value(s) for the `anthropic-beta` header” or “Extra inputs are not permitted”. Standard fields (`name`, `description`, `input_schema`, `cache_control`) are preserved. [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) is disabled and all MCP tools load upfront, even when you set `ENABLE_TOOL_SEARCH`. On Claude Code v2.1.227 or later, [managed settings](</docs/en/managed-settings>) can keep tool search on. [Disable pre-release capabilities](</docs/en/llm-gateway-protocol#disable-pre-release-capabilities>) covers where the override applies `CLAUDE_CODE_DISABLE_EXPLORE_PLAN_AGENTS`| Set to `1` to disable the built-in [Explore and Plan subagents](</docs/en/sub-agents#built-in-subagents>). Claude explores with its search tools or the general-purpose subagent instead, and [plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>) reads files directly rather than launching Explore and Plan agents. Custom subagents named `Explore` or `Plan` are unaffected. To remove every built-in subagent type in the Agent SDK or non-interactive mode, use `CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS` instead. Requires Claude Code v2.1.198 or later `CLAUDE_CODE_DISABLE_FAST_MODE`| Set to `1` to disable [fast mode](</docs/en/fast-mode>) -`CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY`| Set to `1` to disable the “How is Claude doing?” session quality surveys. Surveys are also disabled when `DISABLE_TELEMETRY`, `DO_NOT_TRACK`, or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` is set, unless `CLAUDE_CODE_ENABLE_FEEDBACK_SURVEY_FOR_OTEL` opts back in. To set a sample rate instead of disabling outright, use the [`feedbackSurveyRate`](</docs/en/settings#available-settings>) setting. See [Session quality surveys](</docs/en/data-usage#session-quality-surveys>) -`CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING`| Set to `1` to disable file [checkpointing](</docs/en/checkpointing>). The `/rewind` command will not be able to restore code changes. Overrides the [`fileCheckpointingEnabled`](</docs/en/settings#available-settings>) setting -`CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS`| Set to `1` to remove built-in commit and PR workflow instructions and the git status snapshot from Claude’s system prompt. Useful when using your own git workflow skills. Takes precedence over the [`includeGitInstructions`](</docs/en/settings#available-settings>) setting when set +`CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY`| Set to `1` to disable the “How is Claude doing?” session quality surveys. Surveys are also disabled when `DISABLE_TELEMETRY`, `DO_NOT_TRACK`, or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` is set, unless `CLAUDE_CODE_ENABLE_FEEDBACK_SURVEY_FOR_OTEL` opts back in. To set a sample rate instead of disabling outright, use the [`feedbackSurveyRate`](</docs/en/settings-reference#feedbacksurveyrate>) setting. See [Session quality surveys](</docs/en/data-usage#session-quality-surveys>) +`CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING`| Set to `1` to disable file [checkpointing](</docs/en/checkpointing>). The `/rewind` command will not be able to restore code changes. Overrides the [`fileCheckpointingEnabled`](</docs/en/settings-reference#filecheckpointingenabled>) setting +`CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS`| Set to `1` to remove built-in commit and PR workflow instructions and the git status snapshot from Claude’s system prompt. Useful when using your own git workflow skills. Takes precedence over the [`includeGitInstructions`](</docs/en/settings-reference#includegitinstructions>) setting when set `CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP`| Set to `1` to prevent automatic remapping of Opus 4.0 and 4.1 to the current Opus version on the Anthropic API. Use when you intentionally want to pin an older model. The remap does not run on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry `CLAUDE_CODE_DISABLE_MOUSE`| Set to `1` to disable mouse tracking in [fullscreen rendering](</docs/en/fullscreen>). Keyboard scrolling with `PgUp` and `PgDn` still works. Use this to keep your terminal’s native copy-on-select behavior `CLAUDE_CODE_DISABLE_MOUSE_CLICKS`| Set to `1` to disable click, drag, and hover handling in [fullscreen rendering](</docs/en/fullscreen>) while keeping mouse-wheel scrolling. Use this when you want wheel scroll to work inside Claude Code but don’t want clicks to position the cursor, expand tool output, or open links. `CLAUDE_CODE_DISABLE_MOUSE` takes precedence when both are set. Requires Claude Code v2.1.195 or later @@ -238,17 +238,17 @@ `CLAUDE_CODE_DISABLE_THINKING`| Set to `1` to omit the `thinking` parameter from API requests entirely. This is a compatibility option for proxies and gateways that reject the parameter. The variable’s behavior is unchanged from earlier versions; on models that think by default, omitting the parameter means the model may still think. To explicitly disable [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) on the Anthropic API, use `MAX_THINKING_TOKENS=0` instead, which is also ineffective on Fable 5 since it cannot have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `0` likewise omits the parameter, so the two variables behave the same there `CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT`| Set to `1` to skip proactive [auto-compaction](</docs/en/costs#reduce-token-usage>) when Claude Code doesn’t recognize the model ID, such as an [LLM gateway](</docs/en/llm-gateway>) alias. Without this variable, Claude Code compacts at the context window it assumes for the ID. `CLAUDE_CODE_MAX_CONTEXT_TOKENS` can correct the assumed window instead; see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>) for when each variable applies. Requires Claude Code v2.1.223 or later `CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL`| Set to `1` to disable virtual scrolling in [fullscreen rendering](</docs/en/fullscreen>) and render every message in the transcript. Use this if scrolling in fullscreen mode shows blank regions where messages should appear -`CLAUDE_CODE_DISABLE_WORKFLOWS`| Set to `1` to disable [workflows](</docs/en/workflows#turn-workflows-off>). Equivalent to the [`disableWorkflows`](</docs/en/settings#available-settings>) setting +`CLAUDE_CODE_DISABLE_WORKFLOWS`| Set to `1` to disable [workflows](</docs/en/workflows#turn-workflows-off>). Equivalent to the [`disableWorkflows`](</docs/en/settings-reference#disableworkflows>) setting `CLAUDE_CODE_EFFORT_LEVEL`| Set the effort level for supported models. Values: `low`, `medium`, `high`, `xhigh`, `max`, or `auto` to use the model default. Available levels depend on the model. Takes precedence over `/effort` and the `effortLevel` setting. See [Adjust effort level](</docs/en/model-config#adjust-effort-level>) `CLAUDE_CODE_ENABLE_APPEND_SUBAGENT_PROMPT`| Set to `1` to enable appending extra text to the end of the system prompt of every [subagent](</docs/en/sub-agents>) other than a [forked subagent](</docs/en/sub-agents#fork-the-current-conversation>). The [`--append-subagent-system-prompt`](</docs/en/cli-reference#cli-flags>) flag supplies the appended text and sets this variable automatically, so you don’t need to set it yourself. Requires Claude Code v2.1.205 or later `CLAUDE_CODE_ENABLE_AUTO_MODE`| Accepted for compatibility with older releases and has no effect. Auto mode is available by default on every provider, including Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and signed-in [Claude apps gateway](</docs/en/claude-apps-gateway>) sessions. In v2.1.158 through v2.1.206, setting this to `1` was required to make [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) available on those providers -`CLAUDE_CODE_ENABLE_AWAY_SUMMARY`| Override [session recap](</docs/en/interactive-mode#session-recap>) availability. Set to `0` to force recaps off regardless of the `/config` toggle. Set to `1` to force recaps on when [`awaySummaryEnabled`](</docs/en/settings#available-settings>) is `false`. Takes precedence over the setting and `/config` toggle +`CLAUDE_CODE_ENABLE_AWAY_SUMMARY`| Override [session recap](</docs/en/interactive-mode#session-recap>) availability. Set to `0` to force recaps off regardless of the `/config` toggle. Set to `1` to force recaps on when [`awaySummaryEnabled`](</docs/en/settings-reference#awaysummaryenabled>) is `false`. Takes precedence over the setting and `/config` toggle `CLAUDE_CODE_ENABLE_BACKGROUND_PLUGIN_REFRESH`| Set to `1` to refresh plugin state at turn boundaries in [non-interactive mode](</docs/en/headless>) after a background install completes. Off by default because the refresh changes the system prompt mid-session, which invalidates [prompt caching](</docs/en/prompt-caching>) for that turn `CLAUDE_CODE_ENABLE_FEEDBACK_SURVEY_FOR_OTEL`| Set to `1` to route the “How is Claude doing?” session quality survey to your own [OpenTelemetry collector](</docs/en/monitoring-usage>) when Anthropic-bound nonessential traffic is blocked. Survey ratings are emitted only as OTEL events to your configured collector. No survey data is sent to Anthropic in this mode. Applies when `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`, `DISABLE_TELEMETRY`, or `DO_NOT_TRACK` is set, and has no effect otherwise. `CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY` and the organization product feedback policy take precedence `CLAUDE_CODE_ENABLE_FINE_GRAINED_TOOL_STREAMING`| Controls whether tool call inputs stream from the API as Claude generates them. With this off, a large tool input such as a long file write arrives only after Claude finishes generating it, which can look like it’s hanging. Enabled by default on the Anthropic API. On Amazon Bedrock and Google Cloud’s Agent Platform, enabled per model where the deployed container supports it. Set to `0` to opt out. Set to `1` to force on when routing through a proxy via `ANTHROPIC_BASE_URL`, `ANTHROPIC_VERTEX_BASE_URL`, or `ANTHROPIC_BEDROCK_BASE_URL`. Off by default on Microsoft Foundry and [gateway](</docs/en/llm-gateway>) connections -`CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY`| Set to `1` to populate the `/model` picker from your gateway’s `/v1/models` endpoint when `ANTHROPIC_BASE_URL` points at an Anthropic-compatible gateway such as LiteLLM, Kong, or an internal proxy. Off by default because gateways backed by a shared API key would otherwise show every user every model the key can access. Discovered models are still filtered by an [`availableModels`](</docs/en/settings#available-settings>) allowlist the session receives; deliver the list through [MDM or a managed settings file](</docs/en/settings#settings-files>), since [server-managed delivery is not available on gateway configurations](</docs/en/server-managed-settings#platform-availability>) +`CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY`| Set to `1` to populate the `/model` picker from your gateway’s `/v1/models` endpoint when `ANTHROPIC_BASE_URL` points at an Anthropic-compatible gateway such as LiteLLM, Kong, or an internal proxy. Off by default because gateways backed by a shared API key would otherwise show every user every model the key can access. Discovered models are still filtered by an [`availableModels`](</docs/en/settings-reference#availablemodels>) allowlist the session receives; deliver the list through [MDM or a managed settings file](</docs/en/managed-settings#delivery-mechanisms>), since [server-managed delivery is not available on gateway configurations](</docs/en/server-managed-settings#platform-availability>) `CLAUDE_CODE_ENABLE_OPUS_4_7_FAST_MODE`| Removed in v2.1.142, when the [fast mode](</docs/en/fast-mode>) default moved from Opus 4.6 to Opus 4.7 -`CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION`| Set to `false` to turn off prompt suggestions, the grayed-out predictions that appear in your prompt input. Takes precedence over the [`promptSuggestionEnabled`](</docs/en/settings#available-settings>) setting, which is what the **Prompt suggestions** toggle in `/config` writes. Claude Code also [pauses suggestions while your account is close to or at its usage limit](</docs/en/interactive-mode#when-claude-code-skips-suggestions>). Set to `true` to keep them on until you reach the limit. Requires Claude Code v2.1.238 or later. See [Prompt suggestions](</docs/en/interactive-mode#prompt-suggestions>) +`CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION`| Set to `false` to turn off prompt suggestions, the grayed-out predictions that appear in your prompt input. Takes precedence over the [`promptSuggestionEnabled`](</docs/en/settings-reference#promptsuggestionenabled>) setting, which is what the **Prompt suggestions** toggle in `/config` writes. Claude Code also [pauses suggestions while your account is close to or at its usage limit](</docs/en/interactive-mode#when-claude-code-skips-suggestions>). Set to `true` to keep them on until you reach the limit. Requires Claude Code v2.1.238 or later. See [Prompt suggestions](</docs/en/interactive-mode#prompt-suggestions>) `CLAUDE_CODE_ENABLE_TASKS`| Selects which task-tracking tools Claude Code provides in [sessions that have them](</docs/en/tools-reference#task-tool-availability>). By default, Claude Code provides the Task tools `TaskCreate`, `TaskUpdate`, `TaskGet`, and `TaskList`. Set to `0` to get the legacy `TodoWrite` tool instead. See [Task list](</docs/en/interactive-mode#task-list>) `CLAUDE_CODE_ENABLE_TELEMETRY`| Set to `1` to enable OpenTelemetry data collection for metrics and logging. Required before configuring OTel exporters. See [Monitoring](</docs/en/monitoring-usage>) `CLAUDE_CODE_ENABLE_TODO_TOOLS`| Set to `1` to get the task-tracking tools on the models listed under [Task tool availability](</docs/en/tools-reference#task-tool-availability>), where Claude Code otherwise leaves them out. `CLAUDE_CODE_ENABLE_TASKS` still selects the Task tools or `TodoWrite`. Requires Claude Code v2.1.233 or later @@ -263,12 +263,12 @@ `CLAUDE_CODE_FORWARD_SUBAGENT_TEXT`| Set to `1` to emit [subagent](</docs/en/sub-agents>) text and thinking blocks in `claude -p --output-format stream-json` output, the same behavior as the [`--forward-subagent-text`](</docs/en/cli-reference#cli-flags>) flag. Use the variable when a harness invokes `claude` and can’t pass the flag itself. Unlike the flag, which exits with an error outside non-interactive mode with stream-json output, the variable is ignored there so that nested invocations keep working when it’s set process-wide. Requires Claude Code v2.1.211 or later `CLAUDE_CODE_GIT_BASH_PATH`| Windows only: path to the Git Bash executable (`bash.exe`). Use when Git Bash is installed but not in your PATH. If the path doesn’t exist or the file isn’t named `bash.exe`, `sh.exe`, `bash`, or `sh`, Claude Code ignores the variable and auto-detects Git Bash as if it were unset, logging a warning visible with `--debug`. Before v2.1.219, Claude Code exited at startup when the path didn’t exist, and used any existing file as the shell without checking that it was bash or sh. See [Windows setup](</docs/en/setup#set-up-on-windows>) `CLAUDE_CODE_GLOB_HIDDEN`| Set to `false` to exclude dotfiles from results when Claude invokes the [Glob tool](</docs/en/tools-reference#glob-tool-behavior>). Included by default. Does not affect `@` file autocomplete, `ls`, Grep, or Read -`CLAUDE_CODE_GLOB_NO_IGNORE`| Set to `false` to make the [Glob tool](</docs/en/tools-reference#glob-tool-behavior>) respect `.gitignore` patterns. By default, Glob returns all matching files including gitignored ones. Does not affect `@` file autocomplete, which has its own [`respectGitignore` setting](</docs/en/settings#available-settings>) +`CLAUDE_CODE_GLOB_NO_IGNORE`| Set to `false` to make the [Glob tool](</docs/en/tools-reference#glob-tool-behavior>) respect `.gitignore` patterns. By default, Glob returns all matching files including gitignored ones. Does not affect `@` file autocomplete, which has its own [`respectGitignore` setting](</docs/en/settings-reference#respectgitignore>) `CLAUDE_CODE_GLOB_TIMEOUT_SECONDS`| Timeout in seconds for Glob tool file discovery. Defaults to 20 seconds on most platforms and 60 seconds on WSL `CLAUDE_CODE_GOAL_CHECKIN_MINUTES`| How many minutes background work can keep an active goal waiting before Claude Code [asks Claude to check on it](</docs/en/goal#background-work-defers-evaluation>). Default `30`. Set `0` to turn check-ins off. Give whole minutes in plain digits, at most `10080`, which is one week. Claude Code treats any other value as unset and uses the default. Requires Claude Code v2.1.234 or later `CLAUDE_CODE_HIDE_CWD`| Set to `1` to hide the working directory in the startup logo. Useful for screenshares or recordings where the path exposes your OS username `CLAUDE_CODE_IDE_HOST_OVERRIDE`| Override the host address used to connect to the IDE extension. By default Claude Code auto-detects the correct address, including WSL-to-Windows routing -`CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL`| Set to `1` to skip auto-installation of IDE extensions. Equivalent to setting [`autoInstallIdeExtension`](</docs/en/settings#global-config-settings>) to `false` +`CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL`| Set to `1` to skip auto-installation of IDE extensions. Equivalent to setting [`autoInstallIdeExtension`](</docs/en/settings-reference#autoinstallideextension>) to `false` `CLAUDE_CODE_IDE_SKIP_VALID_CHECK`| Set to `1` to skip validation of IDE lockfile entries during connection. Use when auto-connect fails to find your IDE despite it running `CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS`| How many [subagents](</docs/en/sub-agents#concurrent-subagent-limit>) can be running in one session before the Agent tool refuses to spawn another (default: 20). Accepts a positive whole number in plain digits; anything else is ignored, so the variable can adjust the cap but can’t disable it. Requires Claude Code v2.1.217 or later `CLAUDE_CODE_MAX_CONTEXT_TOKENS`| Override the context window size Claude Code assumes for the active model. As of v2.1.193, how it applies depends on how Claude Code resolves the model ID; see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>). Use this when routing to a model through `ANTHROPIC_BASE_URL` whose context window does not match the built-in size for its name @@ -283,10 +283,10 @@ `CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS`| Elapsed time in milliseconds before a still-running MCP tool call [moves to a background task](</docs/en/mcp#automatic-backgrounding-of-long-tool-calls>) (default: 120000, or 2 minutes). Set to `0` to turn automatic backgrounding off. Requires Claude Code v2.1.212 or later `CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT`| Idle timeout in milliseconds for MCP tool calls. When a stdio, HTTP, SSE, WebSocket, or [claude.ai connector](</docs/en/mcp#use-mcp-servers-from-claude-ai>) MCP server sends no response and no progress notification for this long, the tool call aborts with an error instead of waiting for the overall `MCP_TOOL_TIMEOUT`. Overrides the per-transport defaults of 300000 (5 minutes) for network servers and 1800000 (30 minutes) for stdio servers. Set to `0` to disable the idle check. Values below 1000 are raised to one second, and the value is capped at the effective `MCP_TOOL_TIMEOUT`. A per-server `timeout` in `.mcp.json` of at least 1000 raises that server’s idle window to at least the `timeout` value. Doesn’t apply to IDE servers or SDK in-process servers. Requires Claude Code v2.1.187 or later. Before v2.1.203, stdio servers were exempt from the idle timeout `CLAUDE_CODE_MESSAGING_SOCKET`| Set by Claude Code, not by you: in sessions that bind an [inbox socket](</docs/en/cross-session-messaging#the-sessions-inbox-socket>), Claude Code exports that socket’s path to hooks and Bash commands when it binds the socket. In a session that starts with messaging on, Claude Code binds the socket before any hook runs. Other sessions on the machine deliver messages to this path. Each session exports its own socket rather than one inherited from a parent, and messages arriving on it go through the session’s [inbound controls](</docs/en/cross-session-messaging#control-inbound-messages>). Settings `env` blocks can’t set it. Requires Claude Code v2.1.224 or later -`CLAUDE_CODE_MESSAGING_TOKEN`| Set by Claude Code, not by you: in sessions that bind an [inbox socket](</docs/en/cross-session-messaging#the-sessions-inbox-socket>), Claude Code exports this per-session token to hooks and Bash commands alongside `CLAUDE_CODE_MESSAGING_SOCKET`. A script posting to the socket can send `{"type":"auth","token":"<token>"}` as its first line to prove it belongs to the session. The [own-child rules](</docs/en/cross-session-messaging#the-sessions-inbox-socket>) say when Claude Code consults it. Each session exports its own token, never one inherited from a parent session. Settings `env` blocks can’t set it. Requires Claude Code v2.1.228 or later +`CLAUDE_CODE_MESSAGING_TOKEN`| Set by Claude Code, not by you: in sessions that bind an [inbox socket](</docs/en/cross-session-messaging#the-sessions-inbox-socket>), Claude Code exports this per-session token to hooks and Bash commands alongside `CLAUDE_CODE_MESSAGING_SOCKET`. A script posting to the socket can send `{"type":"auth","token":"<token>"}` as its first line to prove it belongs to the session. On native Windows, Claude Code requires this line and closes any connection that doesn’t open with a valid one. The [own-child rules](</docs/en/cross-session-messaging#the-sessions-inbox-socket>) say when Claude Code consults the token. Each session exports its own token, never one inherited from a parent session. Settings `env` blocks can’t set it. Requires Claude Code v2.1.228 or later `CLAUDE_CODE_NATIVE_CURSOR`| Set to `1` to show the terminal’s own cursor at the input caret instead of a drawn block. The cursor respects the terminal’s blink, shape, and focus settings `CLAUDE_CODE_NEW_INIT`| Set to `1` to make `/init` run an interactive setup flow. The flow asks which files to generate, including CLAUDE.md, skills, and hooks, before exploring the codebase and writing them. Without this variable, `/init` generates a CLAUDE.md automatically without prompting -`CLAUDE_CODE_NO_FLICKER`| Set to `1` to enable [fullscreen rendering](</docs/en/fullscreen>), a research preview that reduces flicker and keeps memory flat in long conversations. You can also switch with `/tui fullscreen` +`CLAUDE_CODE_NO_FLICKER`| Set to `1` to enable [fullscreen rendering](</docs/en/fullscreen>), a research preview that reduces flicker and keeps memory flat in long conversations. Overrides the [`tui`](</docs/en/settings-reference#tui>) setting; you can also switch with `/tui fullscreen` `CLAUDE_CODE_OAUTH_REFRESH_TOKEN`| OAuth refresh token for Claude.ai authentication. When set, `claude auth login` exchanges this token directly instead of opening a browser. Requires `CLAUDE_CODE_OAUTH_SCOPES`. Useful for provisioning authentication in automated environments `CLAUDE_CODE_OAUTH_SCOPES`| Space-separated OAuth scopes the refresh token was issued with, such as `"user:profile user:inference user:sessions:claude_code"`. Required when `CLAUDE_CODE_OAUTH_REFRESH_TOKEN` is set `CLAUDE_CODE_OAUTH_TOKEN`| OAuth access token for claude.ai authentication. Alternative to `/login` for SDK and automated environments. Takes precedence over keychain-stored credentials. Generate one with [`claude setup-token`](</docs/en/authentication#generate-a-long-lived-token>). Unless you run [`/login`](</docs/en/authentication#authentication-precedence>), Claude Code uses the token you set for the whole session. To replace an expired token, generate a new one and restart @@ -305,17 +305,17 @@ `CLAUDE_CODE_PLUGIN_SEED_DIR`| Path to one or more read-only plugin seed directories, separated by `:` on Unix or `;` on Windows. Use this to bundle a pre-populated plugins directory into a container image. Claude Code registers marketplaces from these directories at startup and uses pre-cached plugins without re-cloning. See [Pre-populate plugins for containers](</docs/en/plugin-marketplaces#pre-populate-plugins-for-containers>) `CLAUDE_CODE_POWERSHELL_RESPECT_EXECUTION_POLICY`| Set to `1` to stop Claude Code from passing `-ExecutionPolicy Bypass` when spawning PowerShell for tool calls, hooks, and status line commands, and respect the machine’s effective execution policy instead. By default Claude Code bypasses execution policy at process scope so `.ps1` scripts and module imports work on default-Restricted Windows installs. Process-scope bypass never overrides Group Policy `MachinePolicy` or `UserPolicy` regardless of this setting `CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS`| Maximum time in milliseconds that [non-interactive mode](</docs/en/headless#background-tasks-at-exit>) with the `-p` flag waits after the final turn for background subagents and workflows whose result is part of the output. Default: `600000`, or 10 minutes. When the cap is exceeded, remaining background tasks are terminated and the process exits. Set to `0` to wait indefinitely. This cap is separate from the five-second grace period that applies to plain background shells -`CLAUDE_CODE_PROCESS_WRAPPER`| Launch the processes Claude Code starts from its own binary, such as the background service that hosts [agent view](</docs/en/agent-view>) sessions, through a corporate launcher given as an argv prefix like `/opt/corp/launcher`. Set it in the `env` block of user or [managed settings](</docs/en/permissions#managed-settings>), not as a shell export, so the detached background service inherits it; project and local settings can’t set it. Equivalent to the [`processWrapper` setting](</docs/en/settings#available-settings>), which requires Claude Code v2.1.210 or later; this variable takes precedence when both are set. The VS Code extension configures its own launcher separately through its `claudeProcessWrapper` setting. Ignored on Windows. See [Run Claude Code behind a corporate launcher](</docs/en/corporate-launcher>) for the value format, what the launcher covers, and the contract the launcher must satisfy. Requires Claude Code v2.1.208 or later +`CLAUDE_CODE_PROCESS_WRAPPER`| Launch the processes Claude Code starts from its own binary, such as the background service that hosts [agent view](</docs/en/agent-view>) sessions, through a corporate launcher given as an argv prefix like `/opt/corp/launcher`. Set it in the `env` block of user or [managed settings](</docs/en/managed-settings>), not as a shell export, so the detached background service inherits it; project and local settings can’t set it. Equivalent to the [`processWrapper` setting](</docs/en/settings-reference#processwrapper>), which requires Claude Code v2.1.210 or later; this variable takes precedence when both are set. The VS Code extension configures its own launcher separately through its `claudeProcessWrapper` setting. Ignored on Windows. See [Run Claude Code behind a corporate launcher](</docs/en/corporate-launcher>) for the value format, what the launcher covers, and the contract the launcher must satisfy. Requires Claude Code v2.1.208 or later `CLAUDE_CODE_PROJECT_DIR_NAME`| Set together with `CLAUDE_CONFIG_DIR` to choose the `projects/` directory name Claude Code stores that session’s transcripts and auto memory under, in place of one derived from the working directory path. For example, starting Claude Code with `CLAUDE_CONFIG_DIR=/srv/tenant-a CLAUDE_CODE_PROJECT_DIR_NAME=work claude` stores them under `/srv/tenant-a/projects/work/`. Claude Code ignores this variable when `CLAUDE_CONFIG_DIR` is unset, and reads it only from the environment you start `claude` from, never from a settings file `env` block. See [Name the project directory yourself](</docs/en/sessions#name-the-project-directory-yourself>). Requires Claude Code v2.1.234 or later `CLAUDE_CODE_PROPAGATE_TRACEPARENT`| Set to `1` to propagate W3C trace context when `ANTHROPIC_BASE_URL` points at a custom proxy. Propagation covers the `traceparent` header on model and HTTP MCP requests and the `TRACEPARENT` environment variable for Bash, PowerShell, and hook subprocesses. By default, propagation is enabled only when connected directly to the Anthropic API. Added in v2.1.152. See [Traces (beta)](</docs/en/monitoring-usage#traces-beta>) -`CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`| Set by host platforms that embed Claude Code and manage model provider routing on its behalf. When set, Claude Code ignores provider-selection, endpoint, and authentication variables such as `CLAUDE_CODE_USE_BEDROCK`, `ANTHROPIC_BASE_URL`, and `ANTHROPIC_API_KEY` in settings files, so user settings can’t override the host’s routing. Claude Code also ignores model-selection keys such as `model`, `fallbackModel`, and `modelOverrides` in [managed settings](</docs/en/permissions#managed-settings>), whichever managed source delivers them, so the host’s model configuration takes precedence over an out-of-date managed model pin; an [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist in managed settings still applies unless the host supplies its own. Claude Code also skips the automatic telemetry opt-out it otherwise applies on third-party providers such as Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, and Microsoft Foundry, so telemetry follows the standard `DISABLE_TELEMETRY` opt-out. See [Default behaviors by API provider](</docs/en/data-usage#default-behaviors-by-api-provider>) +`CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`| Set by host platforms that embed Claude Code and manage model provider routing on its behalf. When set, Claude Code ignores provider-selection, endpoint, and authentication variables such as `CLAUDE_CODE_USE_BEDROCK`, `ANTHROPIC_BASE_URL`, and `ANTHROPIC_API_KEY` in settings files, so user settings can’t override the host’s routing. Claude Code also ignores model-selection keys such as `model`, `fallbackModel`, and `modelOverrides` in [managed settings](</docs/en/managed-settings>), whichever managed source delivers them, so the host’s model configuration takes precedence over an out-of-date managed model pin. Claude Code also ignores model-selection variables such as `ANTHROPIC_MODEL` and the `ANTHROPIC_DEFAULT_*_MODEL` family in a managed `env` block; an [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist in managed settings still applies unless the host supplies its own. Claude Code also skips the automatic telemetry opt-out it otherwise applies on third-party providers such as Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, and Microsoft Foundry, so telemetry follows the standard `DISABLE_TELEMETRY` opt-out. See [Default behaviors by API provider](</docs/en/data-usage#default-behaviors-by-api-provider>) `CLAUDE_CODE_PROXY_RESOLVES_HOSTS`| Set to `1` to allow the proxy to perform DNS resolution instead of the caller. Opt-in for environments where the proxy should handle hostname resolution `CLAUDE_CODE_REMOTE`| Set automatically to `true` when Claude Code is running as a [cloud session](</docs/en/claude-code-on-the-web>). Read this from a hook or setup script to detect whether you are in a cloud session `CLAUDE_CODE_REMOTE_SESSION_ID`| Set automatically in [cloud sessions](</docs/en/claude-code-on-the-web>) to the current session’s ID. Read this to construct a link back to the session transcript. See [Link output back to the session](</docs/en/cloud-environments#link-output-back-to-the-session>) `CLAUDE_CODE_RESUME_INTERRUPTED_TURN`| Set to `1` to automatically resume if the previous session ended mid-turn. Used in SDK mode so the model continues without requiring the SDK to re-send the prompt. To turn this off, unset the variable or set it to `0`. Before v2.1.221, Claude Code ignored `0` and other falsy values, so setting `0` still triggered the resume in non-interactive mode and unsetting the variable was the only way to turn it off `CLAUDE_CODE_RESUME_INTERRUPTED_TURN_MAX_AGE_MS`| Maximum age in milliseconds of the last transcript message for a session that ended mid-turn to continue automatically on resume. When the last message is older than this bound, Claude Code skips both the `CLAUDE_CODE_RESUME_INTERRUPTED_TURN` automatic resume and the injected `CLAUDE_CODE_RESUME_PROMPT` continuation message, and the session starts idle so you continue explicitly. Unset or `0` means no bound; a negative or non-numeric value applies a one-hour bound. Spawn scripts for long-running agents can set this so a restart against an old transcript doesn’t re-run a stale prompt. Claude Code sets a one-hour bound itself when it restarts a crashed [agent view](</docs/en/agent-view>) session that inherited its conversation from an interactive session. Requires Claude Code v2.1.211 or later `CLAUDE_CODE_RESUME_PROMPT`| Override the continuation message injected when resuming a session that ended mid-turn. Defaults to `Continue from where you left off.`. Spawn scripts for long-running agents can set this to a more directive boot message. An empty string uses the default -`CLAUDE_CODE_RETRY_WATCHDOG`| Set to `1` for unattended sessions such as eval harnesses, CI jobs, or remote workers. Retries `429` and `529` capacity errors indefinitely instead of failing after `CLAUDE_CODE_MAX_RETRIES` attempts. The watchdog backs off up to 5 minutes between attempts, or until the limit resets when the response carries a rate-limit reset time, so a session that hits a usage limit waits out the remaining window. As of v2.1.199 it also raises the default retry count for other transient errors, such as server errors, timeouts, and dropped connections, to 300, roughly three hours of backoff, and removes the cap of 15 on `CLAUDE_CODE_MAX_RETRIES` if you set that variable explicitly. Requires Claude Code v2.1.186 or later +`CLAUDE_CODE_RETRY_WATCHDOG`| Set to `1` for unattended sessions such as eval harnesses, CI jobs, or remote workers. Retries `429` and `529` capacity errors indefinitely instead of failing after `CLAUDE_CODE_MAX_RETRIES` attempts. Claude Code fails at once on a `429` that reports a spend limit or exhausted usage credits, even one from a [gateway spend cap](</docs/en/errors#spend-limit-reached>) that resets on a schedule. Before v2.1.239, the watchdog retried these indefinitely. The watchdog backs off up to 5 minutes between attempts, or until the limit resets when the response carries a rate-limit reset time, so a session that hits a usage limit waits out the remaining window. On v2.1.199 or later it also raises the default retry count for other transient errors, such as server errors, timeouts, and dropped connections, to 300, roughly three hours of backoff, and removes the cap of 15 on `CLAUDE_CODE_MAX_RETRIES` if you set that variable explicitly. Requires Claude Code v2.1.186 or later `CLAUDE_CODE_SAFE_MODE`| Set to `1` to start in safe mode: CLAUDE.md, skills, plugins, hooks, MCP servers, custom commands and agents, output styles, workflows, custom themes, custom keybindings, status line and file-suggestion commands, LSP servers, and auto memory do not load, for troubleshooting a broken configuration. Managed settings policy still applies, including policy-configured hooks, status line, and file-suggestion commands; managed plugins, managed skills, managed CLAUDE.md, and policy-configured MCP servers do not. Equivalent to passing [`--safe-mode`](</docs/en/cli-reference#cli-flags>). Directly spawned child processes inherit the variable `CLAUDE_CODE_SCRIPT_CAPS`| JSON object limiting how many times specific scripts may be invoked per session when `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB` is set. Keys are substrings matched against the command text; values are integer call limits. For example, `{"deploy.sh": 2}` allows `deploy.sh` to be called at most twice. Matching is substring-based so shell-expansion tricks like `./scripts/deploy.sh $(evil)` still count against the cap. Runtime fan-out via `xargs` or `find -exec` is not detected; this is a defense-in-depth control `CLAUDE_CODE_SCROLL_SPEED`| Set the mouse wheel scroll multiplier in [fullscreen rendering](</docs/en/fullscreen#mouse-wheel-scrolling>). Accepts any positive value up to 20, including fractional values below 1 such as `0.5` to slow accelerated trackpad and wheel scrolling in terminals that already amplify wheel events. Set to `3` to match `vim` if your terminal sends one wheel event per notch without amplification. Ignored in the JetBrains IDE terminal, where Claude Code uses its own scroll handling @@ -342,19 +342,19 @@ `CLAUDE_CODE_SYNC_SKILLS`| Set to `1` to download your enabled claude.ai skills into `~/.claude/skills/synced/` and resync every 10 minutes. Before it runs the first query, Claude Code waits up to `CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS` for the list of your skills. The downloads themselves finish in the background, and Claude waits for a skill’s download when it invokes that skill. The `synced` folder name is [reserved for this download](</docs/en/skills#where-skills-live>). Before v2.1.227, the skills downloaded into `~/.claude/skills/` directly. Applies only in non-interactive mode with the `-p` flag. Requires claude.ai authentication. [Claude Code on the web](</docs/en/claude-code-on-the-web>) sessions receive your enabled claude.ai skills automatically; you don’t need to set this there. Claude Code applies [extra rules to the downloaded skills](</docs/en/skills#how-synced-skills-behave>), such as not running their `!` commands on your machine `CLAUDE_CODE_SYNC_SKILLS_INSTALL_TIMEOUT_MS`| Timeout in milliseconds for a mid-session skills resync when `CLAUDE_CODE_SYNC_SKILLS` is set (default: 30000). Bounds the download triggered when the host requests a skill reload during the session. When exceeded, the resync stops and remaining downloads continue in the background `CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS`| Timeout in milliseconds for the first query to wait for the initial skill list when `CLAUDE_CODE_SYNC_SKILLS` is set (default: 5000). When exceeded, the first query runs with whichever skills have arrived. The downloads finish in the background either way, and Claude waits for a skill’s download when it invokes that skill -`CLAUDE_CODE_SYNTAX_HIGHLIGHT`| Set to `false` to disable syntax highlighting in diff output. Useful when colors interfere with your terminal setup. To also disable highlighting in code blocks and file previews, use the [`syntaxHighlightingDisabled`](</docs/en/settings>) setting +`CLAUDE_CODE_SYNTAX_HIGHLIGHT`| Set to `false` to disable syntax highlighting in diff output. Useful when colors interfere with your terminal setup. To also disable highlighting in code blocks and file previews, use the [`syntaxHighlightingDisabled`](</docs/en/settings-reference#syntaxhighlightingdisabled>) setting `CLAUDE_CODE_TASK_LIST_ID`| Share a task list across sessions. Set the same ID in multiple Claude Code instances to coordinate on a shared task list, in [sessions that have the Task tools](</docs/en/tools-reference#task-tool-availability>). See [Task list](</docs/en/interactive-mode#task-list>) `CLAUDE_CODE_TEAM_TEARDOWN_PARK_TIMEOUT_MS`| Override, in milliseconds, how long a non-interactive session waits at exit for its [agent team](</docs/en/agent-teams>) to finish tearing down. Accepts 1000 to 60000; an out-of-range value is ignored and the default of 10000 applies. Requires Claude Code v2.1.206 or later `CLAUDE_CODE_TMPDIR`| Override the temp directory used for internal temp files. Claude Code appends `/claude-{uid}/` on Unix or `/claude/` on Windows to this path. Default: `/tmp` on macOS, `os.tmpdir()` on Linux and Windows. As of v2.1.161, on macOS and Linux, [sandboxed](</docs/en/sandboxing>) Bash subprocesses receive a short fallback `$TMPDIR` under the system default when your override is a long path, since some tools fail when temp paths get too long. Unsandboxed Bash commands inherit your shell’s `$TMPDIR` unchanged. Claude Code’s own temp files always use your override `CLAUDE_CODE_TMUX_TRUECOLOR`| Set to any non-empty value, such as `1`, to allow 24-bit truecolor output inside tmux. **Setting it to`0` or `false` still allows truecolor**, unlike most on/off variables; unset the variable to restore the 256-color clamp. By default, Claude Code clamps to 256 colors when `$TMUX` is set because tmux does not pass through truecolor escape sequences unless configured to. Set this after adding `set -ga terminal-overrides ',*:Tc'` to your `~/.tmux.conf`. See [Terminal configuration](</docs/en/terminal-config>) for other tmux settings `CLAUDE_CODE_TOOL_MEMORY_LIMIT`| On Linux and WSL, set to a size such as `4G` to [cap the memory that Bash and PowerShell tool commands can use](</docs/en/tools-reference#memory-limit-on-linux-and-wsl>). Write the size in plain digits, alone for a number of bytes or with a `K`, `M`, `G`, or `T` suffix. Set `0` or `off` to turn the cap off. Once a tool command has turned the cap on or off, a changed value takes effect the next time you launch `claude`. Requires Claude Code v2.1.233 or later -`CLAUDE_CODE_USER_DIALOG_TIMEOUT_MS`| Deadline in milliseconds for dialogs Claude Code forwards to a remote client, such as a [Remote Control](</docs/en/remote-control>) or SDK host, and for the approval dialog for a [held cross-session message](</docs/en/cross-session-messaging#control-inbound-messages>), before Claude Code cancels them; permission prompts and `AskUserQuestion` questions use their own flows and aren’t governed by it. Also bounds the mid-session [Fable 5 usage-credits consent prompt](</docs/en/model-config#fable-5-and-usage-credits>) in a session that may be running unattended. [Control inbound messages](</docs/en/cross-session-messaging#control-inbound-messages>) and [non-interactive sessions](</docs/en/cross-session-messaging#non-interactive-sessions>) cover the full held-message expiry rules, including the cases where the deadline doesn’t apply. Overrides the [`dialogExpiry`](</docs/en/settings#available-settings>) setting; `0` or a negative value disables the deadline +`CLAUDE_CODE_USER_DIALOG_TIMEOUT_MS`| Deadline in milliseconds for dialogs Claude Code forwards to a remote client, such as a [Remote Control](</docs/en/remote-control>) or SDK host, and for the approval dialog for a [held cross-session message](</docs/en/cross-session-messaging#control-inbound-messages>), before Claude Code cancels them; permission prompts and `AskUserQuestion` questions use their own flows and aren’t governed by it. Also bounds the mid-session [Fable 5 usage-credits consent prompt](</docs/en/model-config#fable-5-and-usage-credits>) in a session that may be running unattended. [Control inbound messages](</docs/en/cross-session-messaging#control-inbound-messages>) and [non-interactive sessions](</docs/en/cross-session-messaging#non-interactive-sessions>) cover the full held-message expiry rules, including the cases where the deadline doesn’t apply. Overrides the [`dialogExpiry`](</docs/en/settings-reference#dialogexpiry>) setting; `0` or a negative value disables the deadline `CLAUDE_CODE_USE_ANTHROPIC_AWS`| Use [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) `CLAUDE_CODE_USE_BEDROCK`| Use [Amazon Bedrock](</docs/en/amazon-bedrock>) `CLAUDE_CODE_USE_FOUNDRY`| Use [Microsoft Foundry](</docs/en/microsoft-foundry>) `CLAUDE_CODE_USE_MANTLE`| Use the Amazon Bedrock [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>) `CLAUDE_CODE_USE_NATIVE_FILE_SEARCH`| Set to `1` to discover custom commands, subagents, and output styles using Node.js file APIs instead of ripgrep. Set this if the bundled ripgrep binary is unavailable or blocked in your environment. Does not affect the Grep or file search tools -`CLAUDE_CODE_USE_POWERSHELL_TOOL`| Controls the PowerShell tool. On Windows without Git Bash, the tool is enabled automatically; set to `0` to disable it. On Windows with Git Bash installed, the tool is rolling out progressively: set to `1` to opt in or `0` to opt out. On Linux, macOS, and WSL, set to `1` to enable it, which requires `pwsh` on your `PATH`. When enabled on Windows, Claude can run PowerShell commands natively instead of routing through Git Bash. See [PowerShell tool](</docs/en/tools-reference#powershell-tool>) +`CLAUDE_CODE_USE_POWERSHELL_TOOL`| Controls the PowerShell tool. On Windows without Git Bash, the tool is enabled automatically; set to `0` to disable it. On Windows with Git Bash installed, the tool is on by default for claude.ai and Console accounts; set to `1` to enable it in Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry sessions, or `0` to turn it off. On Linux, macOS, and WSL, set to `1` to enable it, which requires `pwsh` on your `PATH`. When enabled on Windows, Claude can run PowerShell commands natively instead of routing through Git Bash. See [PowerShell tool](</docs/en/tools-reference#powershell-tool>) `CLAUDE_CODE_USE_VERTEX`| Use [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>) `CLAUDE_CODE_WEBFETCH_CACHE_TTL_MS`| Set to the number of milliseconds [WebFetch](</docs/en/tools-reference#webfetch-tool-behavior>) keeps each fetched URL’s response cached. The default is `900000`, which is 15 minutes. Takes plain digits only; `0`, a decimal, or any other spelling keeps the default. Claude Code reads the value once per launch, so a change in a settings `env` block applies when you next launch `claude`. Requires Claude Code v2.1.233 or later `CLAUDE_CODE_WORKFLOW_PREFIX_STAGGER_MS`| Upper bound in milliseconds on how long a [workflow](</docs/en/workflows>) agent waits for a same-prefix sibling’s first response to begin before sending its own first request. When a fan-out starts several agents that share a [prompt-cache prefix](</docs/en/workflows#prompt-caching-in-a-fan-out>), Claude Code holds all but the first agent for up to this long so the rest read the cached prefix instead of each processing it uncached. Default `5000`. Set to `0` to disable the wait. When `DISABLE_PROMPT_CACHING` is set, agents never wait. Requires Claude Code v2.1.229 or later @@ -371,7 +371,7 @@ `CLAUDE_SUBAGENT_BG_SHELL_MAX_MS`| Maximum lifetime in milliseconds for a [background shell command](</docs/en/interactive-mode#background-bash-commands>) that a [subagent](</docs/en/sub-agents>) started. Default `3600000` (60 minutes). When you set `0`, Claude Code applies the default instead of removing the cap. When the subagent runs in the foreground, Claude Code also ends the command when that subagent gives its final response, regardless of this cap. See [the background command lifetime rules](</docs/en/tools-reference#background-commands>). Claude Code doesn’t cap main-session background commands this way. For the memory-pressure limit that covers them, see [How backgrounding works](</docs/en/interactive-mode#how-backgrounding-works>) `DEBUG`| Set to `1` to enable debug mode, equivalent to launching with [`--debug`](</docs/en/cli-reference#cli-flags>). Debug logs are written to `~/.claude/debug/<session-id>.txt`, or to the path set by `CLAUDE_CODE_DEBUG_LOGS_DIR`. Only the truthy values `1`, `true`, `yes`, and `on` enable debug mode, so namespace patterns like `DEBUG=express:*` set for other tools do not trigger it `DISABLE_AUTOUPDATER`| Set to `1` to disable automatic background updates. Manual `claude update` still works. Use `DISABLE_UPDATES` to block both -`DISABLE_AUTO_COMPACT`| Set to `1` to disable automatic compaction when approaching the context limit. The manual `/compact` command remains available. Use when you want explicit control over when compaction occurs. Overrides the [`autoCompactEnabled`](</docs/en/settings#available-settings>) setting +`DISABLE_AUTO_COMPACT`| Set to `1` to disable automatic compaction when approaching the context limit. The manual `/compact` command remains available. Use when you want explicit control over when compaction occurs. Overrides the [`autoCompactEnabled`](</docs/en/settings-reference#autocompactenabled>) setting `DISABLE_COMPACT`| Set to `1` to disable all compaction: both automatic compaction and the manual `/compact` command `DISABLE_COST_WARNINGS`| Set to `1` to disable cost warning messages `DISABLE_DOCTOR_COMMAND`| Set to `1` to hide the [`/doctor`](</docs/en/commands#all-commands>) setup checkup skill and its `/checkup` alias. Useful for managed deployments where users shouldn’t run setup diagnostics from a session. Doesn’t affect the `claude doctor` terminal command. Before v2.1.205, this variable hid the `/doctor` diagnostics screen command @@ -393,7 +393,7 @@ `DISABLE_UPDATES`| Set to `1` to block all updates including manual `claude update` and `claude install`. Stricter than `DISABLE_AUTOUPDATER`. Use when distributing Claude Code through your own channels and users should not self-update `DISABLE_UPGRADE_COMMAND`| Set to `1` to hide the `/upgrade` command `DO_NOT_TRACK`| Set to `1` to opt out of telemetry, with the same effect as `DISABLE_TELEMETRY`, including making [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable. Claude Code reads this variable as a standard boolean, so `0` leaves telemetry on, and honors it as the cross-tool convention recognized by many developer CLIs -`ENABLE_CLAUDEAI_MCP_SERVERS`| Set to `false` to disable [claude.ai MCP servers](</docs/en/mcp#use-mcp-servers-from-claude-ai>) in Claude Code. Enabled by default for logged-in users. To disable per-project or per-org, set [`disableClaudeAiConnectors`](</docs/en/settings#available-settings>) in settings instead +`ENABLE_CLAUDEAI_MCP_SERVERS`| Set to `false` to disable [claude.ai MCP servers](</docs/en/mcp#use-mcp-servers-from-claude-ai>) in Claude Code. Enabled by default for logged-in users. To disable per-project or per-org, set [`disableClaudeAiConnectors`](</docs/en/settings-reference#disableclaudeaiconnectors>) in settings instead `ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) instead of the default 5 minutes. Intended for API key, [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), [Microsoft Foundry](</docs/en/microsoft-foundry>), and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) users. Subscription users within included usage receive 1-hour TTL automatically. Subscription users drawing on [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>) can set it to keep the 1-hour TTL. 1-hour cache writes are billed at a higher rate `ENABLE_PROMPT_CACHING_1H_BEDROCK`| Deprecated. Use `ENABLE_PROMPT_CACHING_1H` instead `ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset, Claude Code defers all MCP tools by default. It still loads them upfront on Google Cloud’s Agent Platform models earlier than the Claude 4.5 generation, on a Microsoft Foundry deployment hosted on Azure, and when `ANTHROPIC_BASE_URL` points to a non-first-party host. `true` always defers and sends the beta header, except on those same Agent Platform models and Microsoft Foundry deployments; requests fail on proxies that don’t support `tool_reference`. `auto` loads upfront when tool definitions fit within 10% of context. `auto:N` sets a custom threshold, such as `auto:5` for 5%. `false` loads all tools upfront. A value you set yourself is ignored when `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS` is set. Before v2.1.221, Claude Code disabled tool search for all models on Google Cloud’s Agent Platform unless you set this variable to `true` @@ -415,7 +415,7 @@ `MCP_DISCOVERY_CACHE_STRIKES`| At a start where a [discovery-cache](</docs/en/mcp#server-status-detail>) entry is older than `MCP_DISCOVERY_CACHE_TTL_S`, Claude Code refreshes it in the background. This variable sets how many refreshes in a row can fail before Claude Code discards the entry and connects the server at the next start instead (default: 1). Raise it if your network connection drops occasionally, so that one failed refresh doesn’t discard the entry. Requires Claude Code v2.1.238 or later `MCP_DISCOVERY_CACHE_TTL_S`| Seconds for which Claude Code uses a [discovery-cache](</docs/en/mcp#server-status-detail>) entry without refreshing it (default: 900). At a start where the entry is older than that, Claude Code still uses it but refreshes it in the background. Once the entry is older than `MCP_DISCOVERY_CACHE_MAX_STALE_S`, Claude Code discards it instead. Claude Code caps the value at `MCP_DISCOVERY_CACHE_MAX_STALE_S`, which is 4 hours by default. Before v2.1.238, Claude Code didn’t cap the value `MCP_OAUTH_CALLBACK_PORT`| Fixed port for the OAuth redirect callback, as an alternative to `--callback-port` when adding an MCP server with [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>) -`MCP_PROTOCOL_NEGOTIATION`| On the [v2 MCP client runtime](</docs/en/mcp#mcp-client-runtimes>) only, whether Claude Code probes servers for MCP protocol revision 2026-07-28. Set `auto` to probe HTTP, claude.ai connector, and stdio servers; a server that doesn’t answer the probe connects on the earlier protocol instead, as SSE and WebSocket servers always do. Set `legacy` to skip the probe for every server. Without the variable, Claude Code probes HTTP, claude.ai connector, and stdio servers on Claude Code v2.1.232 or later, with the exceptions the [MCP client runtimes](</docs/en/mcp#mcp-client-runtimes>) section lists. Any other value is ignored with a warning in the debug log. Requires Claude Code v2.1.221 or later +`MCP_PROTOCOL_NEGOTIATION`| On the [v2 MCP client runtime](</docs/en/mcp#mcp-client-runtimes>) only, whether Claude Code probes servers for MCP protocol revision 2026-07-28. Set `auto` to probe HTTP, claude.ai connector, and stdio servers; a server that doesn’t answer the probe connects on the earlier protocol instead, as SSE and WebSocket servers always do. Set `legacy` to skip the probe for every server. Without the variable, Claude Code probes HTTP and claude.ai connector servers on Claude Code v2.1.232 or later, with the exceptions the [MCP client runtimes](</docs/en/mcp#mcp-client-runtimes>) section lists. Any other value is ignored with a warning in the debug log. Requires Claude Code v2.1.221 or later `MCP_REMOTE_SERVER_CONNECTION_BATCH_SIZE`| Maximum number of remote MCP servers (HTTP/SSE) to connect in parallel during startup (default: 20) `MCP_SDK_GENERATION`| Pin which [MCP client runtime](</docs/en/mcp#mcp-client-runtimes>) this process connects to MCP servers with: `v1`, built on MCP TypeScript SDK 1.x, or `v2`, built on [MCP TypeScript SDK 2.0](<https://ts.sdk.modelcontextprotocol.io/v2/>). Without the variable, Claude Code uses v2 on Claude Code v2.1.232 or later, except where that section says it uses v1. On Claude Code v2.1.221 or later, the v2 runtime checks the issuer an MCP OAuth server returns in its authorization response and fails the sign-in with an error that begins `Issuer mismatch in authorization response` when it doesn’t match. The v1 runtime doesn’t run this check. If you set an unrecognized value, Claude Code ignores it and writes a warning to the debug log. Claude Code reads the value once per process. Requires Claude Code v2.1.218 or later `MCP_SERVER_CONNECTION_BATCH_SIZE`| Maximum number of local MCP servers (stdio) to connect in parallel during startup (default: 3)
modified
--- a/env-vars.md +++ b/env-vars.md @@ -186,11 +186,14 @@ `CLAUDE_CODE_ALWAYS_ENABLE_EFFORT`| Set to `1` to send the [effort](</docs/en/model-config#adjust-effort-level>) parameter with every request, even when Claude Code does not recognize the model ID as effort-capable. Use this when routing through an [LLM gateway](</docs/en/llm-gateway>) or third-party provider that serves models under custom identifiers. Models that reject the effort parameter at the API, including Claude 3 models, Sonnet 4.0 and 4.5, Opus 4.0 and 4.1, and Haiku 4.5, are still excluded so requests do not fail `CLAUDE_CODE_API_KEY_HELPER_TTL_MS`| Interval in milliseconds at which credentials should be refreshed (when using [`apiKeyHelper`](</docs/en/settings#available-settings>)) `CLAUDE_CODE_ARTIFACT_AUTO_OPEN`| Set to `0` to stop Claude Code from opening the browser automatically when a new [artifact](</docs/en/artifacts>) is published. Republishing an existing artifact does not open the browser regardless of this setting +`CLAUDE_CODE_ARTIFACT_COMMENTS`| Set to `1` to let Claude read and reply to [comments on an artifact](</docs/en/artifacts#collect-comments-on-an-artifact>) when feature-flag fetching is off. Set to `0` to turn comment reading and replying off even when fetching is on. Has no effect when `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` has [turned artifacts off](</docs/en/artifacts#availability>). Requires Claude Code v2.1.221 or later +`CLAUDE_CODE_ARTIFACT_COMMENTS_AUTOREACT`| Set to `1` to let Claude [reply on its own to comments sent to it](</docs/en/artifacts#let-claude-reply-to-comments-on-its-own>) when feature-flag fetching is off, or `0` to turn that off even when fetching is on. Needs comment reading on as well. Requires Claude Code v2.1.228 or later `CLAUDE_CODE_ATTRIBUTION_HEADER`| Set to `0` to omit the [attribution block](</docs/en/llm-gateway-protocol#system-prompt-attribution-block>), which carries the client version and a prompt fingerprint, from the start of the system prompt. Caching on a direct connection to the Anthropic API is unaffected either way. In some direct-connection setups, Claude Code keeps the block on [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) classifier requests even when you set `0`. In [System prompt attribution block](</docs/en/llm-gateway-protocol#system-prompt-attribution-block>), check which connections and credentials this covers. Before v2.1.181 the block included a per-request token on custom base URLs and Microsoft Foundry connections, so on those versions set it to `0` when your LLM gateway caches on the request body or forwards requests to a third-party provider, or when you connect to Microsoft Foundry directly `CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the [auto-compact window](</docs/en/model-config#set-the-auto-compact-window>) in tokens, from `100000` to `1000000`. Accepts a plain integer such as `500000` only: a value like `500k` reads as `500` and clamps to the 100K minimum. Takes precedence over the `/autocompact` command, the `--autocompact` flag, and the `autoCompactWindow` setting. The status line’s `used_percentage` always measures against the model’s full context window, so once this variable is set, that percentage no longer indicates when compaction will run `CLAUDE_CODE_AUTO_CONNECT_IDE`| Override automatic [IDE connection](</docs/en/vs-code>). By default, Claude Code connects automatically when launched inside a supported IDE’s integrated terminal. Set to `false` to prevent this. Set to `true` to force a connection attempt when auto-detection fails, such as when tmux obscures the parent terminal. Takes precedence over the [`autoConnectIde`](</docs/en/settings#global-config-settings>) global config setting `CLAUDE_CODE_AWS_CHAIN_RESOLVE_TIMEOUT_MS`| Time in milliseconds Claude Code waits for the AWS default credential provider chain to produce credentials before the request fails with [`AWS default-chain credential resolve timed out`](</docs/en/errors#aws-default-chain-credential-resolve-timed-out>) (default: `60000`). Raise it when a step in your chain legitimately needs longer, such as a browser-based SSO sign-in with MFA through a wrapper like `aws-vault`. Applies wherever Claude Code signs with the default chain: [Amazon Bedrock](</docs/en/amazon-bedrock#credential-caching-and-resolution-timeout>), [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), and the [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>). Requires Claude Code v2.1.207 or later `CLAUDE_CODE_BRIDGE_SESSION_ID`| Set automatically in Bash tool and [hook command](</docs/en/hooks>) subprocesses while the session has an active [Remote Control](</docs/en/remote-control>) connection, and removed when the connection ends. The value is the session’s ID in `session_` form, the same identifier that appears in the session’s `claude.ai/code` URL, so a script can link back to the session that ran it. Requires Claude Code v2.1.199 or later. In [cloud sessions](</docs/en/claude-code-on-the-web>), read `CLAUDE_CODE_REMOTE_SESSION_ID` instead +`CLAUDE_CODE_BS_AS_CTRL_BACKSPACE`| Set to `0` to make Claude Code read the `0x08` byte, also written `^H`, as plain Backspace, or `1` to read it as Ctrl+Backspace. Either value replaces the platform default. By default, Claude Code reads it as Ctrl+Backspace on Windows, except when `TERM_PROGRAM` is `mintty` or `TERM` is `cygwin`, and as plain Backspace on macOS and Linux. Set `0` in a Windows terminal where [Backspace deletes a whole word](</docs/en/terminal-config#fix-backspace-deleting-a-whole-word-on-windows>) `CLAUDE_CODE_CERT_STORE`| Comma-separated list of CA certificate sources for TLS connections. `bundled` is the Mozilla CA set shipped with Claude Code. `system` is the operating system trust store, read only on runtimes with `tls.getCACertificates`: the native binary, or Node 22.15 or later for npm installs. See [CA certificate store](</docs/en/network-config#ca-certificate-store>). Default is `bundled,system` `CLAUDE_CODE_CHILD_SESSION`| Set to `1` in subprocesses Claude Code spawns via the Bash, PowerShell, and Monitor tools, [hook](</docs/en/hooks>) commands, and [status line](</docs/en/statusline>) commands. Not set for stdio [MCP server](</docs/en/mcp>) subprocesses, which are long-lived and outlive the session that spawned them. Unlike `CLAUDECODE`, this is only set by Claude Code itself when it launches a subprocess and not by IDE extensions, so it reliably distinguishes a nested session from a top-level `claude` launched in an IDE-integrated terminal. A nested interactive `claude` TUI started this way is automatically excluded from `--resume`, `--continue`, up-arrow history, and the `claude agents` list. Non-interactive `claude -p` sessions still persist. Set `CLAUDE_CODE_FORCE_SESSION_PERSISTENCE=1` to override this exclusion. Requires Claude Code v2.1.172 or later `CLAUDE_CODE_CLIENT_CERT`| Path to client certificate file for mTLS authentication @@ -245,8 +248,8 @@ `CLAUDE_CODE_ENABLE_FINE_GRAINED_TOOL_STREAMING`| Controls whether tool call inputs stream from the API as Claude generates them. With this off, a large tool input such as a long file write arrives only after Claude finishes generating it, which can look like it’s hanging. Enabled by default on the Anthropic API. On Amazon Bedrock and Google Cloud’s Agent Platform, enabled per model where the deployed container supports it. Set to `0` to opt out. Set to `1` to force on when routing through a proxy via `ANTHROPIC_BASE_URL`, `ANTHROPIC_VERTEX_BASE_URL`, or `ANTHROPIC_BEDROCK_BASE_URL`. Off by default on Microsoft Foundry and [gateway](</docs/en/llm-gateway>) connections `CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY`| Set to `1` to populate the `/model` picker from your gateway’s `/v1/models` endpoint when `ANTHROPIC_BASE_URL` points at an Anthropic-compatible gateway such as LiteLLM, Kong, or an internal proxy. Off by default because gateways backed by a shared API key would otherwise show every user every model the key can access. Discovered models are still filtered by an [`availableModels`](</docs/en/settings#available-settings>) allowlist the session receives; deliver the list through [MDM or a managed settings file](</docs/en/settings#settings-files>), since [server-managed delivery is not available on gateway configurations](</docs/en/server-managed-settings#platform-availability>) `CLAUDE_CODE_ENABLE_OPUS_4_7_FAST_MODE`| Removed in v2.1.142, when the [fast mode](</docs/en/fast-mode>) default moved from Opus 4.6 to Opus 4.7 -`CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION`| Set to `false` to disable prompt suggestions (the “Prompt suggestions” toggle in `/config`). These are the grayed-out predictions that appear in your prompt input. Takes precedence over the [`promptSuggestionEnabled`](</docs/en/settings#available-settings>) setting. See [Prompt suggestions](</docs/en/interactive-mode#prompt-suggestions>) -`CLAUDE_CODE_ENABLE_TASKS`| Selects which task-tracking tools Claude Code provides in [sessions that have them](</docs/en/tools-reference#task-tool-availability>). By default, Claude Code provides the Task tools `TaskCreate`, `TaskUpdate`, `TaskGet`, and `TaskList`. Set to `0` to get the legacy `TodoWrite` tool instead. See [Task list](</docs/en/interactive-mode#task-list>) and [Migrate to Task tools](</docs/en/agent-sdk/todo-tracking#migrate-to-task-tools>) +`CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION`| Set to `false` to turn off prompt suggestions, the grayed-out predictions that appear in your prompt input. Takes precedence over the [`promptSuggestionEnabled`](</docs/en/settings#available-settings>) setting, which is what the **Prompt suggestions** toggle in `/config` writes. Claude Code also [pauses suggestions while your account is close to or at its usage limit](</docs/en/interactive-mode#when-claude-code-skips-suggestions>). Set to `true` to keep them on until you reach the limit. Requires Claude Code v2.1.238 or later. See [Prompt suggestions](</docs/en/interactive-mode#prompt-suggestions>) +`CLAUDE_CODE_ENABLE_TASKS`| Selects which task-tracking tools Claude Code provides in [sessions that have them](</docs/en/tools-reference#task-tool-availability>). By default, Claude Code provides the Task tools `TaskCreate`, `TaskUpdate`, `TaskGet`, and `TaskList`. Set to `0` to get the legacy `TodoWrite` tool instead. See [Task list](</docs/en/interactive-mode#task-list>) `CLAUDE_CODE_ENABLE_TELEMETRY`| Set to `1` to enable OpenTelemetry data collection for metrics and logging. Required before configuring OTel exporters. See [Monitoring](</docs/en/monitoring-usage>) `CLAUDE_CODE_ENABLE_TODO_TOOLS`| Set to `1` to get the task-tracking tools on the models listed under [Task tool availability](</docs/en/tools-reference#task-tool-availability>), where Claude Code otherwise leaves them out. `CLAUDE_CODE_ENABLE_TASKS` still selects the Task tools or `TodoWrite`. Requires Claude Code v2.1.233 or later `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 @@ -283,7 +286,7 @@ `CLAUDE_CODE_MESSAGING_TOKEN`| Set by Claude Code, not by you: in sessions that bind an [inbox socket](</docs/en/cross-session-messaging#the-sessions-inbox-socket>), Claude Code exports this per-session token to hooks and Bash commands alongside `CLAUDE_CODE_MESSAGING_SOCKET`. A script posting to the socket can send `{"type":"auth","token":"<token>"}` as its first line to prove it belongs to the session. The [own-child rules](</docs/en/cross-session-messaging#the-sessions-inbox-socket>) say when Claude Code consults it. Each session exports its own token, never one inherited from a parent session. Settings `env` blocks can’t set it. Requires Claude Code v2.1.228 or later `CLAUDE_CODE_NATIVE_CURSOR`| Set to `1` to show the terminal’s own cursor at the input caret instead of a drawn block. The cursor respects the terminal’s blink, shape, and focus settings `CLAUDE_CODE_NEW_INIT`| Set to `1` to make `/init` run an interactive setup flow. The flow asks which files to generate, including CLAUDE.md, skills, and hooks, before exploring the codebase and writing them. Without this variable, `/init` generates a CLAUDE.md automatically without prompting -`CLAUDE_CODE_NO_FLICKER`| Set to `1` to enable [fullscreen rendering](</docs/en/fullscreen>), a research preview that reduces flicker and keeps memory flat in long conversations. Equivalent to the [`tui`](</docs/en/settings#available-settings>) setting; you can also switch with `/tui fullscreen` +`CLAUDE_CODE_NO_FLICKER`| Set to `1` to enable [fullscreen rendering](</docs/en/fullscreen>), a research preview that reduces flicker and keeps memory flat in long conversations. You can also switch with `/tui fullscreen` `CLAUDE_CODE_OAUTH_REFRESH_TOKEN`| OAuth refresh token for Claude.ai authentication. When set, `claude auth login` exchanges this token directly instead of opening a browser. Requires `CLAUDE_CODE_OAUTH_SCOPES`. Useful for provisioning authentication in automated environments `CLAUDE_CODE_OAUTH_SCOPES`| Space-separated OAuth scopes the refresh token was issued with, such as `"user:profile user:inference user:sessions:claude_code"`. Required when `CLAUDE_CODE_OAUTH_REFRESH_TOKEN` is set `CLAUDE_CODE_OAUTH_TOKEN`| OAuth access token for claude.ai authentication. Alternative to `/login` for SDK and automated environments. Takes precedence over keychain-stored credentials. Generate one with [`claude setup-token`](</docs/en/authentication#generate-a-long-lived-token>). Unless you run [`/login`](</docs/en/authentication#authentication-precedence>), Claude Code uses the token you set for the whole session. To replace an expired token, generate a new one and restart @@ -320,7 +323,7 @@ `CLAUDE_CODE_SESSION_ID`| Set automatically to the current session ID in Bash and PowerShell tool subprocesses, [hook command](</docs/en/hooks>) subprocesses, and stdio [MCP server](</docs/en/mcp>) subprocesses. For Bash, PowerShell, and hooks this matches the `session_id` field in the hook JSON input and is updated on `/clear`. An MCP server subprocess retains the ID it was spawned with. On `--resume <session-id>` it receives the resumed ID, matching hooks and Bash. On `--continue` or `--resume` without an explicit ID it may receive the initial startup ID instead. Use to correlate scripts and external tools with the Claude Code session that launched them `CLAUDE_CODE_SHELL`| Set the shell Claude Code uses to run Bash tool commands. Accepts a path to a `bash` or `zsh` binary, for example `/opt/homebrew/bin/bash`. Other shells such as `fish` are not supported. If the value is not a working `bash` or `zsh` path, Claude Code ignores it and falls back to auto-detection. Auto-detection uses your `$SHELL` when it points to `bash` or `zsh`, otherwise it picks the first working `zsh` then `bash` found on your `PATH` and standard install locations `CLAUDE_CODE_SHELL_PREFIX`| Command prefix that wraps shell commands Claude Code spawns: Bash tool calls, [hook](</docs/en/hooks>) commands, [status line](</docs/en/statusline>) commands, and stdio [MCP server](</docs/en/mcp>) startup commands. PowerShell hooks and exec-form hooks run without the prefix. Useful for logging or auditing. Setting a bare executable path such as `/path/to/logger.sh` runs each command as `/path/to/logger.sh '<command>'`. The wrapper receives the command line as a single shell-quoted argument in `$1`, so the wrapper must re-evaluate `$1` with a shell, for example `exec bash -c "$1"`. Treating `$1` as a bare executable path breaks stdio MCP servers that pass arguments such as `npx -y <package>`. For Bash tool calls, `$1` contains the full shell invocation Claude Code assembles, including environment setup, not only the command Claude ran -`CLAUDE_CODE_SIMPLE`| Set to `1` to run with a minimal system prompt and only the Bash, file read, and file edit tools. MCP tools from `--mcp-config` are still available. Disables auto-discovery of hooks, skills, plugins, MCP servers, auto memory, and CLAUDE.md. OAuth tokens and keychain credentials are not read, so Anthropic authentication must come from `ANTHROPIC_API_KEY` or an `apiKeyHelper` in `--settings`. Equivalent to passing [`--bare`](</docs/en/headless#start-faster-with-bare-mode>) +`CLAUDE_CODE_SIMPLE`| Set to `1` to run with a minimal system prompt and only the Bash, file read, and file edit tools. MCP tools from `--mcp-config` are still available. Disables auto-discovery of hooks, skills, custom commands, subagents, plugins, MCP servers, auto memory, and CLAUDE.md. Skills in a directory you pass with `--add-dir` still load. OAuth tokens and keychain credentials are not read, so Anthropic authentication must come from `ANTHROPIC_API_KEY` or an `apiKeyHelper` in `--settings`. Equivalent to passing [`--bare`](</docs/en/headless#start-faster-with-bare-mode>) `CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT`| Set to `1` to use a shorter system prompt and abbreviated tool descriptions on any model. Set to `0`, `false`, `no`, or `off` to opt out even on models where the experiment or server configuration would otherwise enable it. The full tool set, hooks, MCP servers, and CLAUDE.md discovery remain enabled `CLAUDE_CODE_SKIP_ANTHROPIC_AWS_AUTH`| Skip client-side authentication for [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), for gateways that sign requests themselves `CLAUDE_CODE_SKIP_AWS_CRED_CACHE`| Set to `1` to turn off the in-process cache of credentials resolved from the AWS default credential provider chain, so Claude Code resolves the chain on every API request. With the cache off, an SSO-backed profile requests credentials from IAM Identity Center on every request. See [credential caching and resolution timeout](</docs/en/amazon-bedrock#credential-caching-and-resolution-timeout>). Requires Claude Code v2.1.207 or later @@ -345,7 +348,7 @@ `CLAUDE_CODE_TMPDIR`| Override the temp directory used for internal temp files. Claude Code appends `/claude-{uid}/` on Unix or `/claude/` on Windows to this path. Default: `/tmp` on macOS, `os.tmpdir()` on Linux and Windows. As of v2.1.161, on macOS and Linux, [sandboxed](</docs/en/sandboxing>) Bash subprocesses receive a short fallback `$TMPDIR` under the system default when your override is a long path, since some tools fail when temp paths get too long. Unsandboxed Bash commands inherit your shell’s `$TMPDIR` unchanged. Claude Code’s own temp files always use your override `CLAUDE_CODE_TMUX_TRUECOLOR`| Set to any non-empty value, such as `1`, to allow 24-bit truecolor output inside tmux. **Setting it to`0` or `false` still allows truecolor**, unlike most on/off variables; unset the variable to restore the 256-color clamp. By default, Claude Code clamps to 256 colors when `$TMUX` is set because tmux does not pass through truecolor escape sequences unless configured to. Set this after adding `set -ga terminal-overrides ',*:Tc'` to your `~/.tmux.conf`. See [Terminal configuration](</docs/en/terminal-config>) for other tmux settings `CLAUDE_CODE_TOOL_MEMORY_LIMIT`| On Linux and WSL, set to a size such as `4G` to [cap the memory that Bash and PowerShell tool commands can use](</docs/en/tools-reference#memory-limit-on-linux-and-wsl>). Write the size in plain digits, alone for a number of bytes or with a `K`, `M`, `G`, or `T` suffix. Set `0` or `off` to turn the cap off. Once a tool command has turned the cap on or off, a changed value takes effect the next time you launch `claude`. Requires Claude Code v2.1.233 or later -`CLAUDE_CODE_USER_DIALOG_TIMEOUT_MS`| Deadline in milliseconds for dialogs Claude Code forwards to a remote client, such as a [Remote Control](</docs/en/remote-control>) or SDK host, and for the approval dialog for a [held cross-session message](</docs/en/cross-session-messaging#control-inbound-messages>), before Claude Code cancels them; permission prompts and `AskUserQuestion` questions use their own flows and aren’t governed by it. [Control inbound messages](</docs/en/cross-session-messaging#control-inbound-messages>) and [non-interactive sessions](</docs/en/cross-session-messaging#non-interactive-sessions>) cover the full held-message expiry rules, including the cases where the deadline doesn’t apply. Overrides the [`dialogExpiry`](</docs/en/settings#available-settings>) setting; `0` or a negative value disables the deadline +`CLAUDE_CODE_USER_DIALOG_TIMEOUT_MS`| Deadline in milliseconds for dialogs Claude Code forwards to a remote client, such as a [Remote Control](</docs/en/remote-control>) or SDK host, and for the approval dialog for a [held cross-session message](</docs/en/cross-session-messaging#control-inbound-messages>), before Claude Code cancels them; permission prompts and `AskUserQuestion` questions use their own flows and aren’t governed by it. Also bounds the mid-session [Fable 5 usage-credits consent prompt](</docs/en/model-config#fable-5-and-usage-credits>) in a session that may be running unattended. [Control inbound messages](</docs/en/cross-session-messaging#control-inbound-messages>) and [non-interactive sessions](</docs/en/cross-session-messaging#non-interactive-sessions>) cover the full held-message expiry rules, including the cases where the deadline doesn’t apply. Overrides the [`dialogExpiry`](</docs/en/settings#available-settings>) setting; `0` or a negative value disables the deadline `CLAUDE_CODE_USE_ANTHROPIC_AWS`| Use [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) `CLAUDE_CODE_USE_BEDROCK`| Use [Amazon Bedrock](</docs/en/amazon-bedrock>) `CLAUDE_CODE_USE_FOUNDRY`| Use [Microsoft Foundry](</docs/en/microsoft-foundry>) @@ -405,12 +408,16 @@ `MAX_STRUCTURED_OUTPUT_RETRIES`| Number of times Claude Code retries when the model’s response fails validation against the [`--json-schema`](</docs/en/cli-reference#cli-flags>) in non-interactive mode with the `-p` flag. The same retry count applies when a [workflow](</docs/en/workflows>) subagent’s structured output fails validation. Defaults to 5 `MAX_THINKING_TOKENS`| Fixed token budget for [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>). Claude Code caps it at one token below the request’s max output tokens and never below 1,024; see `CLAUDE_CODE_MAX_OUTPUT_TOKENS` for how that limit is set. When unset and thinking is enabled, models with [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) choose their own thinking depth, and other models use the cap. Set to `0` to disable thinking on the Anthropic API, except on Fable 5, which cannot have thinking turned off; on [third-party providers](</docs/en/third-party-integrations>), `0` omits the `thinking` parameter instead. Nonzero values are ignored on adaptive reasoning models unless `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` is set `MCP_CLIENT_SECRET`| OAuth client secret for MCP servers that require [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>). Avoids the interactive prompt when adding a server with `--client-secret` -`MCP_CONNECTION_NONBLOCKING`| Controls whether startup waits for MCP servers to connect before the first query. MCP startup is non-blocking by default: servers connect in the background and their tools become available as they finish. Set to `0` to make Claude Code wait for servers to connect before the first query. Servers configured with [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>) still make startup wait regardless, except when served from the [discovery cache](</docs/en/mcp#managing-your-servers>), since their tools must be present when the first prompt is built. In non-interactive mode (`-p`), Claude Code also waits for still-pending servers before the first turn regardless of this variable, with a longer deadline when you pass [`--mcp-config`](</docs/en/cli-reference#cli-flags>) explicitly; see that flag’s entry for the cached-server exception +`MCP_CONNECTION_NONBLOCKING`| Controls whether startup waits for MCP servers to connect before the first query. MCP startup is non-blocking by default: servers connect in the background and their tools become available as they finish. Set to `0` to make Claude Code wait for servers to connect before the first query. Servers configured with [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>) still make startup wait regardless, except when served from the [discovery cache](</docs/en/mcp#server-status-detail>), since their tools must be present when the first prompt is built. In non-interactive mode (`-p`), Claude Code also waits for still-pending servers before the first turn regardless of this variable, with a longer deadline when you pass [`--mcp-config`](</docs/en/cli-reference#cli-flags>) explicitly; see that flag’s entry for the cached-server exception `MCP_CONNECT_TIMEOUT_MS`| How long blocking MCP startup waits, in milliseconds, for the connection batch before snapshotting the tool list (default: 5000). Applies when `MCP_CONNECTION_NONBLOCKING=0` or for servers marked [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>). Servers still pending at the deadline keep connecting in the background. Distinct from `MCP_TIMEOUT`, which bounds an individual server’s connect attempt -`MCP_DISCOVERY_CACHE`| Set to `0` to turn off the cross-process MCP discovery cache, so every server connects at startup instead of showing the [`connects on first use` cached status](</docs/en/mcp#managing-your-servers>) and connecting on its first tool call. The cached status requires Claude Code v2.1.221 or later +`MCP_DISCOVERY_CACHE`| Turns the [MCP discovery cache](</docs/en/mcp#server-status-detail>) on or off. With the cache on, a remote HTTP or SSE server you’ve used before can show the [`cached` status](</docs/en/mcp#server-status-detail>), and Claude Code connects it on its first tool call instead of at startup. The cache is off by default unless a gradual rollout has enabled it for your account. Set to `1` to turn it on, or `0` to keep it off even when the rollout has enabled it. Before v2.1.238, the cache was on by default. The `cached` status requires Claude Code v2.1.221 or later +`MCP_DISCOVERY_CACHE_MAX_STALE_S`| Maximum age, in seconds, of a [discovery-cache](</docs/en/mcp#server-status-detail>) entry (default: 14400, or 4 hours). At a start where the entry is older than that, Claude Code discards it and connects the server at startup, as it does with the cache off. Claude Code caps the value at 7 days. Before v2.1.238, the default was 86400, or 24 hours, and Claude Code didn’t cap the value +`MCP_DISCOVERY_CACHE_STRIKES`| At a start where a [discovery-cache](</docs/en/mcp#server-status-detail>) entry is older than `MCP_DISCOVERY_CACHE_TTL_S`, Claude Code refreshes it in the background. This variable sets how many refreshes in a row can fail before Claude Code discards the entry and connects the server at the next start instead (default: 1). Raise it if your network connection drops occasionally, so that one failed refresh doesn’t discard the entry. Requires Claude Code v2.1.238 or later +`MCP_DISCOVERY_CACHE_TTL_S`| Seconds for which Claude Code uses a [discovery-cache](</docs/en/mcp#server-status-detail>) entry without refreshing it (default: 900). At a start where the entry is older than that, Claude Code still uses it but refreshes it in the background. Once the entry is older than `MCP_DISCOVERY_CACHE_MAX_STALE_S`, Claude Code discards it instead. Claude Code caps the value at `MCP_DISCOVERY_CACHE_MAX_STALE_S`, which is 4 hours by default. Before v2.1.238, Claude Code didn’t cap the value `MCP_OAUTH_CALLBACK_PORT`| Fixed port for the OAuth redirect callback, as an alternative to `--callback-port` when adding an MCP server with [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>) +`MCP_PROTOCOL_NEGOTIATION`| On the [v2 MCP client runtime](</docs/en/mcp#mcp-client-runtimes>) only, whether Claude Code probes servers for MCP protocol revision 2026-07-28. Set `auto` to probe HTTP, claude.ai connector, and stdio servers; a server that doesn’t answer the probe connects on the earlier protocol instead, as SSE and WebSocket servers always do. Set `legacy` to skip the probe for every server. Without the variable, Claude Code probes HTTP, claude.ai connector, and stdio servers on Claude Code v2.1.232 or later, with the exceptions the [MCP client runtimes](</docs/en/mcp#mcp-client-runtimes>) section lists. Any other value is ignored with a warning in the debug log. Requires Claude Code v2.1.221 or later `MCP_REMOTE_SERVER_CONNECTION_BATCH_SIZE`| Maximum number of remote MCP servers (HTTP/SSE) to connect in parallel during startup (default: 20) -`MCP_SDK_GENERATION`| Pin which MCP client runtime this process uses, the implementation behind [MCP server connections](</docs/en/mcp>), while Claude Code migrates from its v1 runtime to v2. Set `v1` to stay on the current runtime or `v2` to opt in early. Without the variable, a gradual rollout decides, and defaults to v1. On Claude Code v2.1.221 or later, the v2 runtime checks the issuer an MCP OAuth server returns in its authorization response and fails the sign-in with an error that begins `Issuer mismatch in authorization response` when it doesn’t match. The v1 runtime doesn’t run this check. If you set an unrecognized value, Claude Code ignores it and writes a warning to the debug log. Claude Code reads the value once per process. Requires Claude Code v2.1.218 or later +`MCP_SDK_GENERATION`| Pin which [MCP client runtime](</docs/en/mcp#mcp-client-runtimes>) this process connects to MCP servers with: `v1`, built on MCP TypeScript SDK 1.x, or `v2`, built on [MCP TypeScript SDK 2.0](<https://ts.sdk.modelcontextprotocol.io/v2/>). Without the variable, Claude Code uses v2 on Claude Code v2.1.232 or later, except where that section says it uses v1. On Claude Code v2.1.221 or later, the v2 runtime checks the issuer an MCP OAuth server returns in its authorization response and fails the sign-in with an error that begins `Issuer mismatch in authorization response` when it doesn’t match. The v1 runtime doesn’t run this check. If you set an unrecognized value, Claude Code ignores it and writes a warning to the debug log. Claude Code reads the value once per process. Requires Claude Code v2.1.218 or later `MCP_SERVER_CONNECTION_BATCH_SIZE`| Maximum number of local MCP servers (stdio) to connect in parallel during startup (default: 3) `MCP_TIMEOUT`| Timeout in milliseconds for MCP server startup (default: 30000, or 30 seconds) `MCP_TOOL_TIMEOUT`| Timeout in milliseconds for MCP tool execution (default: 100000000, about 28 hours). For an HTTP, SSE, or claude.ai connector server, each request also times out after 60 seconds by default; set this variable, or the per-server `timeout`, above 60000 to raise that per-request limit. A lower value still shortens the overall tool-execution timeout but leaves the per-request limit at 60 seconds. Stdio and WebSocket servers have no per-request timer. A per-server `timeout` field in `.mcp.json` overrides this for that server. A per-server `timeout` of at least 1000 also sets the minimum idle window for that server’s tool calls, so `CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT` never aborts them sooner; this floor requires Claude Code v2.1.203 or later. For the env variable, values below 1000 are floored to one second; for the per-server field, values below 1000 are ignored @@ -465,7 +472,9 @@ * Use [the advisor tool](</docs/en/advisor#requirements>) * Let [Claude choose the `/loop` interval](</docs/en/scheduled-tasks#let-claude-choose-the-interval>); Claude Code runs a `/loop` prompt with no interval on the fixed 10-minute schedule instead * Run [the built-in `/loop` maintenance prompt](</docs/en/scheduled-tasks#run-the-built-in-maintenance-prompt>); Claude Code shows the usage message instead when you run `/loop` with no prompt + * Read or reply to [comments on an artifact](</docs/en/artifacts#collect-comments-on-an-artifact>), unless you set `CLAUDE_CODE_ARTIFACT_COMMENTS=1`; for Claude to reply to sent comments on its own, also set `CLAUDE_CODE_ARTIFACT_COMMENTS_AUTOREACT=1`. Neither override helps under `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`, which [turns artifacts off entirely](</docs/en/artifacts#availability>) * Have Claude Code refresh the [PR review status badge](</docs/en/interactive-mode#pr-review-status>) less often while you’re idle; Claude Code refreshes it every 60 seconds instead + * Get the [v2 MCP client runtime](</docs/en/mcp#mcp-client-runtimes>) and its protocol probe without setting `MCP_SDK_GENERATION` and `MCP_PROTOCOL_NEGOTIATION`; Claude Code uses the v1 runtime unless you set `MCP_SDK_GENERATION=v2`, and skips the probe unless you set `MCP_PROTOCOL_NEGOTIATION=auto` With fetching off, you can still type `/code-review` yourself, but [Claude can’t start the review on its own, and a scheduled `/code-review` reaches Claude as plain text](</docs/en/code-review#let-claude-start-the-review>) instead of running the review.
modified
--- a/env-vars.md +++ b/env-vars.md @@ -90,7 +90,7 @@ Precedence -Some behaviors have both an environment variable and a dedicated settings key. If you set both, the environment variable takes precedence. For example, `ANTHROPIC_MODEL` overrides the `model` setting, and `CLAUDE_CODE_AUTO_CONNECT_IDE` overrides `autoConnectIde`. Claude Code uses the settings key only when the environment variable is unset. When the same variable is set in both your shell and a settings file `env` block, the settings file value applies. Claude Code writes each `env` entry into the process environment at startup and again when the file changes, replacing the value inherited from the shell. A few variables are special-cased; the [`env` setting](</docs/en/settings#available-settings>) lists the exceptions. In a settings file you can set a variable but you can’t remove one. To override a variable you can’t unset, such as a stale `CLAUDE_CODE_USE_VERTEX` exported by a shell profile you don’t control, set it to an empty string in the `env` block: `"CLAUDE_CODE_USE_VERTEX": ""`. Claude Code treats the empty value as unset for provider selection. Subprocesses still inherit the empty value. Between settings files, `env` values follow [settings precedence](</docs/en/settings#settings-precedence>), so a managed settings entry overrides the same variable in user or project settings. How an environment variable interacts with CLI flags and in-session commands varies per feature: `--model` and `/model` override `ANTHROPIC_MODEL`, while `CLAUDE_CODE_EFFORT_LEVEL` overrides `/effort`. When a variable interacts with another configuration source, its row in the Variables list states the precedence or links to the page that documents it. Claude Code reads shell environment variables at startup, so changes to them take effect the next time you launch `claude`. Variables set under the `env` key in settings files are reapplied to a running session when the file changes, with the startup-only exception described in In settings files. +Some behaviors have both an environment variable and a dedicated settings key. If you set both, the environment variable takes precedence, except for [`ANTHROPIC_DEFAULT_MODEL`](</docs/en/model-config#set-a-default-model-for-new-sessions>). For example, `ANTHROPIC_MODEL` overrides the `model` setting, and `CLAUDE_CODE_AUTO_CONNECT_IDE` overrides `autoConnectIde`. When the same variable is set in both your shell and a settings file `env` block, the settings file value applies. Claude Code writes each `env` entry into the process environment at startup and again when the file changes, replacing the value inherited from the shell. A few variables are special-cased; the [`env` setting](</docs/en/settings#available-settings>) lists the exceptions. In a settings file you can set a variable but you can’t remove one. To override a variable you can’t unset, such as a stale `CLAUDE_CODE_USE_VERTEX` exported by a shell profile you don’t control, set it to an empty string in the `env` block: `"CLAUDE_CODE_USE_VERTEX": ""`. Claude Code treats the empty value as unset for provider selection. Subprocesses still inherit the empty value. Between settings files, `env` values follow [settings precedence](</docs/en/settings#settings-precedence>), so a managed settings entry overrides the same variable in user or project settings. How an environment variable interacts with CLI flags and in-session commands varies per feature: `--model` and `/model` override `ANTHROPIC_MODEL`, while `CLAUDE_CODE_EFFORT_LEVEL` overrides `/effort`. When a variable interacts with another configuration source, its row in the Variables list states the precedence or links to the page that documents it. Claude Code reads shell environment variables at startup, so changes to them take effect the next time you launch `claude`. Variables set under the `env` key in settings files are reapplied to a running session when the file changes, with the startup-only exception described in In settings files. ## @@ -137,6 +137,7 @@ `ANTHROPIC_DEFAULT_HAIKU_MODEL_DESCRIPTION`| Display description for the pinned Haiku model in the `/model` picker. Defaults to `Custom Haiku model` when not set. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) `ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME`| Display name for the pinned Haiku model in the `/model` picker. Defaults to the model ID when not set. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) `ANTHROPIC_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES`| Comma-separated list of [capabilities](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) the pinned Haiku model supports, for example `effort,thinking`. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) +`ANTHROPIC_DEFAULT_MODEL`| Model that new sessions start on by default. Requires Claude Code v2.1.236 or later. See [Set a default model for new sessions](</docs/en/model-config#set-a-default-model-for-new-sessions>) `ANTHROPIC_DEFAULT_OPUS_MODEL`| Model ID that the `opus` alias resolves to, and that `opusplan` uses while Plan Mode is active. See [Model configuration](</docs/en/model-config#environment-variables>) `ANTHROPIC_DEFAULT_OPUS_MODEL_DESCRIPTION`| Display description for the pinned Opus model in the `/model` picker. When not set, defaults to `Custom Opus model`, or `Custom Opus model (1M context)` if the pinned model ID has the `[1m]` suffix and `CLAUDE_CODE_DISABLE_1M_CONTEXT` isn’t turned on. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) `ANTHROPIC_DEFAULT_OPUS_MODEL_NAME`| Display name for the pinned Opus model in the `/model` picker. Defaults to the model ID when not set. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) @@ -302,6 +303,7 @@ `CLAUDE_CODE_POWERSHELL_RESPECT_EXECUTION_POLICY`| Set to `1` to stop Claude Code from passing `-ExecutionPolicy Bypass` when spawning PowerShell for tool calls, hooks, and status line commands, and respect the machine’s effective execution policy instead. By default Claude Code bypasses execution policy at process scope so `.ps1` scripts and module imports work on default-Restricted Windows installs. Process-scope bypass never overrides Group Policy `MachinePolicy` or `UserPolicy` regardless of this setting `CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS`| Maximum time in milliseconds that [non-interactive mode](</docs/en/headless#background-tasks-at-exit>) with the `-p` flag waits after the final turn for background subagents and workflows whose result is part of the output. Default: `600000`, or 10 minutes. When the cap is exceeded, remaining background tasks are terminated and the process exits. Set to `0` to wait indefinitely. This cap is separate from the five-second grace period that applies to plain background shells `CLAUDE_CODE_PROCESS_WRAPPER`| Launch the processes Claude Code starts from its own binary, such as the background service that hosts [agent view](</docs/en/agent-view>) sessions, through a corporate launcher given as an argv prefix like `/opt/corp/launcher`. Set it in the `env` block of user or [managed settings](</docs/en/permissions#managed-settings>), not as a shell export, so the detached background service inherits it; project and local settings can’t set it. Equivalent to the [`processWrapper` setting](</docs/en/settings#available-settings>), which requires Claude Code v2.1.210 or later; this variable takes precedence when both are set. The VS Code extension configures its own launcher separately through its `claudeProcessWrapper` setting. Ignored on Windows. See [Run Claude Code behind a corporate launcher](</docs/en/corporate-launcher>) for the value format, what the launcher covers, and the contract the launcher must satisfy. Requires Claude Code v2.1.208 or later +`CLAUDE_CODE_PROJECT_DIR_NAME`| Set together with `CLAUDE_CONFIG_DIR` to choose the `projects/` directory name Claude Code stores that session’s transcripts and auto memory under, in place of one derived from the working directory path. For example, starting Claude Code with `CLAUDE_CONFIG_DIR=/srv/tenant-a CLAUDE_CODE_PROJECT_DIR_NAME=work claude` stores them under `/srv/tenant-a/projects/work/`. Claude Code ignores this variable when `CLAUDE_CONFIG_DIR` is unset, and reads it only from the environment you start `claude` from, never from a settings file `env` block. See [Name the project directory yourself](</docs/en/sessions#name-the-project-directory-yourself>). Requires Claude Code v2.1.234 or later `CLAUDE_CODE_PROPAGATE_TRACEPARENT`| Set to `1` to propagate W3C trace context when `ANTHROPIC_BASE_URL` points at a custom proxy. Propagation covers the `traceparent` header on model and HTTP MCP requests and the `TRACEPARENT` environment variable for Bash, PowerShell, and hook subprocesses. By default, propagation is enabled only when connected directly to the Anthropic API. Added in v2.1.152. See [Traces (beta)](</docs/en/monitoring-usage#traces-beta>) `CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`| Set by host platforms that embed Claude Code and manage model provider routing on its behalf. When set, Claude Code ignores provider-selection, endpoint, and authentication variables such as `CLAUDE_CODE_USE_BEDROCK`, `ANTHROPIC_BASE_URL`, and `ANTHROPIC_API_KEY` in settings files, so user settings can’t override the host’s routing. Claude Code also ignores model-selection keys such as `model`, `fallbackModel`, and `modelOverrides` in [managed settings](</docs/en/permissions#managed-settings>), whichever managed source delivers them, so the host’s model configuration takes precedence over an out-of-date managed model pin; an [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist in managed settings still applies unless the host supplies its own. Claude Code also skips the automatic telemetry opt-out it otherwise applies on third-party providers such as Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, and Microsoft Foundry, so telemetry follows the standard `DISABLE_TELEMETRY` opt-out. See [Default behaviors by API provider](</docs/en/data-usage#default-behaviors-by-api-provider>) `CLAUDE_CODE_PROXY_RESOLVES_HOSTS`| Set to `1` to allow the proxy to perform DNS resolution instead of the caller. Opt-in for environments where the proxy should handle hostname resolution @@ -473,7 +475,7 @@ First session after an install or upgrade -You can also miss a feature in this list in your first session after you install Claude Code, or after you upgrade to a version that adds the feature, even with none of these variables set. Claude Code fetches the flags during that session, so a feature that’s otherwise available to you is there in your next session. Two features behave differently in that first session: +You can also miss a flag-gated feature in your first session after you install Claude Code, or after you upgrade to a version that adds the feature, even when none of the variables that disable flag fetching are set. Claude Code fetches the flags during that session, so a feature that’s otherwise available to you is there in your next session. Two features behave differently in that first session: * Claude Code [binds the session’s inbox socket](</docs/en/cross-session-messaging#the-sessions-inbox-socket>) and exports the messaging variables partway through the session, as soon as the fetch completes, so other sessions can message it before you restart. * Claude Code checks the `claude import` flag before it starts a session, so if `claude import` is the first thing you run after installing, it prints [`claude import is not yet available in this build`](</docs/en/errors#claude-import-is-not-yet-available-in-this-build>). Start a session, then run it again.
modified
--- a/env-vars.md +++ b/env-vars.md @@ -168,7 +168,7 @@ `CLAUDECODE`| Set to `1` in subprocesses Claude Code spawns (Bash and PowerShell tools, tmux sessions, [hook](</docs/en/hooks>) commands, [status line](</docs/en/statusline>) commands, stdio [MCP server](</docs/en/mcp>) subprocesses). IDE extensions also set this in their integrated terminals. Use to detect when a script is running inside a subprocess spawned by Claude Code. To check whether the current process was spawned directly by a tool call or hook, rather than inside a stdio MCP server that Claude Code started, use `CLAUDE_CODE_CHILD_SESSION` instead `CLAUDE_AFK_COUNTDOWN_MS`| How many milliseconds before auto-continue the on-screen countdown appears on an unanswered [`AskUserQuestion`](</docs/en/tools-reference>) dialog. Default `20000` (20 seconds), capped at the auto-continue timeout. Has no effect unless auto-continue is on; see the [`askUserQuestionTimeout`](</docs/en/settings#available-settings>) setting and `CLAUDE_AFK_TIMEOUT_MS`. Requires Claude Code v2.1.198 or later `CLAUDE_AFK_TIMEOUT_MS`| How many milliseconds of idle time before an unanswered [`AskUserQuestion`](</docs/en/tools-reference>) dialog auto-continues without you. Auto-continue is off by default; opt in with the [`askUserQuestionTimeout`](</docs/en/settings#available-settings>) setting. This variable is an override for demos and automated tests: when set, it takes precedence over that setting and turns auto-continue on even when the setting is unset or `never`. Setting `0` doesn’t turn the timeout off; it closes the dialog immediately. In v2.1.198 and v2.1.199, auto-continue was on by default with a `60000` (60 seconds) timeout. Requires Claude Code v2.1.198 or later -`CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS`| Set to `1` to disable all built-in [subagent](</docs/en/sub-agents>) types such as Explore and Plan. Only applies in non-interactive mode (the `-p` flag). Useful for SDK users who want a blank slate +`CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS`| Set to `1` to disable all built-in [subagent](</docs/en/sub-agents>) types such as Explore and Plan. Only applies in non-interactive mode (the `-p` flag). Useful for SDK users who want a blank slate. This also removes `general-purpose`, the subagent Claude Code runs when an Agent tool call omits `subagent_type`. Such a call then fails with [`subagent_type is required`](</docs/en/errors#subagent-type-is-required>) `CLAUDE_AGENT_SDK_MCP_NO_PREFIX`| Set to `1` to skip the `mcp__<server>__` prefix on tool names from SDK-created MCP servers. Tools use their original names. SDK usage only `CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS`| Stall timeout in milliseconds for background subagents. Default `600000` (10 minutes). The timer resets on each streaming progress event; if no progress arrives within the window, the subagent is aborted and the task is marked failed, surfacing any partial result to the parent `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE`| Set the percentage (1-100) of the auto-compact window at which auto-compaction triggers. Use lower values like `50` to compact earlier; the variable can’t raise the threshold, so values above the default percentage are ignored. It applies only in sessions that [compact before the model’s context limit](</docs/en/model-config#context-window-and-auto-compaction>). Applies to both main conversations and subagents @@ -261,6 +261,7 @@ `CLAUDE_CODE_GLOB_HIDDEN`| Set to `false` to exclude dotfiles from results when Claude invokes the [Glob tool](</docs/en/tools-reference#glob-tool-behavior>). Included by default. Does not affect `@` file autocomplete, `ls`, Grep, or Read `CLAUDE_CODE_GLOB_NO_IGNORE`| Set to `false` to make the [Glob tool](</docs/en/tools-reference#glob-tool-behavior>) respect `.gitignore` patterns. By default, Glob returns all matching files including gitignored ones. Does not affect `@` file autocomplete, which has its own [`respectGitignore` setting](</docs/en/settings#available-settings>) `CLAUDE_CODE_GLOB_TIMEOUT_SECONDS`| Timeout in seconds for Glob tool file discovery. Defaults to 20 seconds on most platforms and 60 seconds on WSL +`CLAUDE_CODE_GOAL_CHECKIN_MINUTES`| How many minutes background work can keep an active goal waiting before Claude Code [asks Claude to check on it](</docs/en/goal#background-work-defers-evaluation>). Default `30`. Set `0` to turn check-ins off. Give whole minutes in plain digits, at most `10080`, which is one week. Claude Code treats any other value as unset and uses the default. Requires Claude Code v2.1.234 or later `CLAUDE_CODE_HIDE_CWD`| Set to `1` to hide the working directory in the startup logo. Useful for screenshares or recordings where the path exposes your OS username `CLAUDE_CODE_IDE_HOST_OVERRIDE`| Override the host address used to connect to the IDE extension. By default Claude Code auto-detects the correct address, including WSL-to-Windows routing `CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL`| Set to `1` to skip auto-installation of IDE extensions. Equivalent to setting [`autoInstallIdeExtension`](</docs/en/settings#global-config-settings>) to `false` @@ -454,7 +455,7 @@ Claude Code turns some features on through feature flags it fetches from Anthropic. You turn flag fetching off for a session by setting `DISABLE_GROWTHBOOK`, `DISABLE_TELEMETRY`, `DO_NOT_TRACK`, or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`. Each variable’s row says which values do that. With fetching off, you can’t: * [Start sessions in auto mode by default](</docs/en/permission-modes#which-mode-a-session-starts-in>) on Pro, Max, and Team plans; Claude Code starts your sessions in Manual instead - * Have the VS Code extension [read settings files for the starting mode](</docs/en/permission-modes#switch-permission-modes>) + * Have the VS Code extension [read settings files for the starting permission mode](</docs/en/permission-modes#switch-permission-modes>) * Use [Remote Control](</docs/en/remote-control#requirements>) * Send or receive [cross-session messages](</docs/en/cross-session-messaging#availability>) * Run [`claude import` or the `/import` command](</docs/en/cli-reference#cli-commands>)
modified
--- a/env-vars.md +++ b/env-vars.md @@ -116,7 +116,7 @@ `ANTHROPIC_API_KEY`| API key sent as `X-Api-Key` header. When set, this key is used instead of your Claude Pro, Max, Team, or Enterprise subscription even if you are logged in. In non-interactive mode (`-p`), the key is always used when present. In interactive mode, you are prompted to approve the key once before it overrides your subscription. To use your subscription instead, run `unset ANTHROPIC_API_KEY` `ANTHROPIC_AUTH_TOKEN`| Custom value for the `Authorization` header (the value you set here will be prefixed with `Bearer `) `ANTHROPIC_AWS_API_KEY`| Workspace API key for [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), generated in the AWS Console. Sent as `x-api-key` and takes precedence over AWS SigV4 -`ANTHROPIC_AWS_BASE_URL`| Override the [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) endpoint URL. Use for custom regions or when routing through an [LLM gateway](</docs/en/llm-gateway>). Defaults to `https://aws-external-anthropic.{AWS_REGION}.api.aws` +`ANTHROPIC_AWS_BASE_URL`| Override the [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) endpoint URL. Use for custom regions or when routing through an [LLM gateway](</docs/en/llm-gateway>). Defaults to `https://aws-external-anthropic.{region}.api.aws`. Claude Code resolves the region with the [same precedence as on Amazon Bedrock](</docs/en/amazon-bedrock#3-configure-claude-code>) `ANTHROPIC_AWS_WORKSPACE_ID`| Required for [Claude Platform on AWS](</docs/en/claude-platform-on-aws>). Sent on every request as the `anthropic-workspace-id` header `ANTHROPIC_BASE_URL`| Override the API endpoint to route requests through a proxy or gateway. When set to a non-first-party host, [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) is disabled by default. Set `ENABLE_TOOL_SEARCH=true` if your proxy forwards `tool_reference` blocks. As of v2.1.196, [Remote Control](</docs/en/remote-control#requirements>) is disabled when this points at a host other than `api.anthropic.com`, matching its behavior on Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry `ANTHROPIC_BEDROCK_BASE_URL`| Override the Amazon Bedrock endpoint URL. Use for custom Amazon Bedrock endpoints or when routing through an [LLM gateway](</docs/en/llm-gateway>). See [Amazon Bedrock](</docs/en/amazon-bedrock>) @@ -173,6 +173,7 @@ `CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS`| Stall timeout in milliseconds for background subagents. Default `600000` (10 minutes). The timer resets on each streaming progress event; if no progress arrives within the window, the subagent is aborted and the task is marked failed, surfacing any partial result to the parent `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE`| Set the percentage (1-100) of the auto-compact window at which auto-compaction triggers. Use lower values like `50` to compact earlier; the variable can’t raise the threshold, so values above the default percentage are ignored. It applies only in sessions that [compact before the model’s context limit](</docs/en/model-config#context-window-and-auto-compaction>). Applies to both main conversations and subagents `CLAUDE_AUTO_BACKGROUND_TASKS`| Set to `1` to force-enable automatic backgrounding of long-running agent tasks. When enabled, subagents are moved to the background after running for approximately two minutes. Also enables [automatic backgrounding of long MCP tool calls](</docs/en/mcp#automatic-backgrounding-of-long-tool-calls>) in non-interactive mode on Claude Code v2.1.212 or later +`CLAUDE_AX_PREPARK_MS`| In [screen reader mode](</docs/en/accessibility#what-your-screen-reader-hears>), how many milliseconds Claude Code waits, with the cursor at the start of the line, before it writes a new or changed line. Default `50`. Set `0` to write immediately. Claude Code caps the wait at `5000`. Requires Claude Code v2.1.233 or later `CLAUDE_AX_SCREEN_READER`| Set to `1` to render screen-reader friendly output: flat text without decorative borders or animations. Set to `0` to force screen-reader mode off even when [`axScreenReader`](</docs/en/settings#available-settings>) is `true`. The [`--ax-screen-reader`](</docs/en/cli-reference#cli-flags>) flag takes precedence. Requires Claude Code v2.1.181 or later `CLAUDE_AX_STARTUP_QUIET_MS`| In [screen reader mode](</docs/en/accessibility>), how many milliseconds Claude Code holds the first interface render after the startup confirmation line, so your screen reader can speak the line in full before new output interrupts it. Default `3000`. Set `0` to render immediately. Claude Code caps the hold at `600000` (10 minutes). Your first keystroke ends the hold early. Requires Claude Code v2.1.217 or later `CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR`| Return to the original working directory after each Bash or PowerShell command in the main session @@ -254,7 +255,7 @@ `CLAUDE_CODE_FORCE_SESSION_PERSISTENCE`| Set to `1` to force transcript persistence, prompt history, and `claude agents` registration even when this `claude` was launched from inside another Claude Code session. Use when an inherited `CLAUDE_CODE_CHILD_SESSION` value, for example from a `screen` session or a background launcher first started by Claude Code’s Bash tool, causes a genuine top-level session to be misclassified as nested. As of v2.1.178, Claude Code detects the tmux case automatically and ignores the inherited marker, so tmux no longer needs this variable. Also honored on v2.1.169 and earlier; has no effect on v2.1.170 and v2.1.171, where the nested-session detection it overrides was removed `CLAUDE_CODE_FORCE_STRIKETHROUGH`| Set to `1` to force strikethrough rendering for `~~text~~` in Claude’s responses when your terminal supports it but is not auto-detected, such as over SSH without `TERM_PROGRAM` forwarded. Without this, undetected terminals show the literal `~~` markers instead of rendering the text as strikethrough. Requires Claude Code v2.1.186 or later `CLAUDE_CODE_FORCE_SYNC_OUTPUT`| Set to `1` to force-enable DEC private mode 2026 [synchronized output](<https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036>) when your terminal supports it but is not auto-detected. Useful for emulators such as Emacs `eat` that implement BSU/ESU but do not reply to the capability probe. Has no effect under tmux. Unlike `CLAUDE_CODE_NO_FLICKER`, which switches to [fullscreen rendering](</docs/en/fullscreen>), this doesn’t change the renderer -`CLAUDE_CODE_FORK_SUBAGENT`| Controls [fork mode](</docs/en/sub-agents#turn-fork-mode-on-or-off>), which lets Claude spawn [forked subagents](</docs/en/sub-agents#fork-the-current-conversation>) itself and is on by default in interactive sessions only. Set to `1` to turn it on in `claude -p` and the Agent SDK as well, or `0` to turn it off in every kind of session. The `/subtask` command works whether or not fork mode is on. The interactive default requires Claude Code v2.1.232 or later +`CLAUDE_CODE_FORK_SUBAGENT`| Controls [fork mode](</docs/en/sub-agents#turn-fork-mode-on-or-off>), which lets Claude spawn [forked subagents](</docs/en/sub-agents#fork-the-current-conversation>) itself and is on by default in interactive sessions only. Set to `1` to turn it on in `claude -p` and the Agent SDK as well, or `0` to turn it off in every kind of session. You can run `/subtask` whether or not fork mode is on. The interactive default requires Claude Code v2.1.232 or later; on earlier versions, set the variable to `1` to turn fork mode on `CLAUDE_CODE_FORWARD_SUBAGENT_TEXT`| Set to `1` to emit [subagent](</docs/en/sub-agents>) text and thinking blocks in `claude -p --output-format stream-json` output, the same behavior as the [`--forward-subagent-text`](</docs/en/cli-reference#cli-flags>) flag. Use the variable when a harness invokes `claude` and can’t pass the flag itself. Unlike the flag, which exits with an error outside non-interactive mode with stream-json output, the variable is ignored there so that nested invocations keep working when it’s set process-wide. Requires Claude Code v2.1.211 or later `CLAUDE_CODE_GIT_BASH_PATH`| Windows only: path to the Git Bash executable (`bash.exe`). Use when Git Bash is installed but not in your PATH. If the path doesn’t exist or the file isn’t named `bash.exe`, `sh.exe`, `bash`, or `sh`, Claude Code ignores the variable and auto-detects Git Bash as if it were unset, logging a warning visible with `--debug`. Before v2.1.219, Claude Code exited at startup when the path didn’t exist, and used any existing file as the shell without checking that it was bash or sh. See [Windows setup](</docs/en/setup#set-up-on-windows>) `CLAUDE_CODE_GLOB_HIDDEN`| Set to `false` to exclude dotfiles from results when Claude invokes the [Glob tool](</docs/en/tools-reference#glob-tool-behavior>). Included by default. Does not affect `@` file autocomplete, `ls`, Grep, or Read @@ -392,7 +393,7 @@ `ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset, Claude Code defers all MCP tools by default. It still loads them upfront on Google Cloud’s Agent Platform models earlier than the Claude 4.5 generation, on a Microsoft Foundry deployment hosted on Azure, and when `ANTHROPIC_BASE_URL` points to a non-first-party host. `true` always defers and sends the beta header, except on those same Agent Platform models and Microsoft Foundry deployments; requests fail on proxies that don’t support `tool_reference`. `auto` loads upfront when tool definitions fit within 10% of context. `auto:N` sets a custom threshold, such as `auto:5` for 5%. `false` loads all tools upfront. A value you set yourself is ignored when `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS` is set. Before v2.1.221, Claude Code disabled tool search for all models on Google Cloud’s Agent Platform unless you set this variable to `true` `FALLBACK_FOR_ALL_PRIMARY_MODELS`| Set to any non-empty value, such as `1`, to make every model stop retrying with a repeated-overload error when no fallback model is configured. **Setting it to`0` or `false` still enables this**, unlike most on/off variables; unset the variable to restore the default retry behavior. Without it, models Claude Code recognizes as Opus, Fable 5, or Mythos models stop retrying this way when you authenticate with an API key or a [third-party provider](</docs/en/third-party-integrations>) rather than a Claude subscription. As of v2.1.160, a configured [fallback model chain](</docs/en/model-config#fallback-model-chains>) triggers on repeated overload errors for any primary model, so this variable does not affect switching to a fallback model `FORCE_AUTOUPDATE_PLUGINS`| Set to `1` to force plugin auto-updates even when the main auto-updater is disabled via `DISABLE_AUTOUPDATER` -`FORCE_HYPERLINK`| Set to `1` to enable clickable OSC 8 hyperlinks when your terminal supports them but isn’t auto-detected, or `0` to disable them. When unset, Claude Code enables hyperlinks only when it detects terminal support. Claude Code parses this value as a number, not a Boolean, so a value such as `false`, `no`, or `off` enables hyperlinks rather than disabling them. Claude Code renders the footer PR badge as a hyperlink even when it can’t detect terminal support, such as over SSH. Set `0` to render the badge as plain text +`FORCE_HYPERLINK`| Set to `1` to enable clickable OSC 8 hyperlinks when your terminal supports them but isn’t auto-detected, or `0` to disable them. When unset, Claude Code enables hyperlinks only when it detects terminal support. Claude Code parses this value as a number, not a Boolean, so a value such as `false`, `no`, or `off` enables hyperlinks rather than disabling them. Claude Code renders the footer [PR or merge request badge](</docs/en/interactive-mode#pr-review-status>) as a hyperlink even when it can’t detect terminal support, such as over SSH. Set `0` to render the badge as plain text `FORCE_PROMPT_CACHING_5M`| Set to `1` to force the 5-minute prompt cache TTL even when 1-hour TTL would otherwise apply. Overrides `ENABLE_PROMPT_CACHING_1H` `HTTP_PROXY`| Specify HTTP proxy server for network connections `HTTPS_PROXY`| Specify HTTPS proxy server for network connections @@ -461,6 +462,7 @@ * Use [the advisor tool](</docs/en/advisor#requirements>) * Let [Claude choose the `/loop` interval](</docs/en/scheduled-tasks#let-claude-choose-the-interval>); Claude Code runs a `/loop` prompt with no interval on the fixed 10-minute schedule instead * Run [the built-in `/loop` maintenance prompt](</docs/en/scheduled-tasks#run-the-built-in-maintenance-prompt>); Claude Code shows the usage message instead when you run `/loop` with no prompt + * Have Claude Code refresh the [PR review status badge](</docs/en/interactive-mode#pr-review-status>) less often while you’re idle; Claude Code refreshes it every 60 seconds instead With fetching off, you can still type `/code-review` yourself, but [Claude can’t start the review on its own, and a scheduled `/code-review` reaches Claude as plain text](</docs/en/code-review#let-claude-start-the-review>) instead of running the review.
modified
--- a/env-vars.md +++ b/env-vars.md @@ -227,6 +227,7 @@ `CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK`| Set to `1` to disable the non-streaming fallback when a streaming request fails mid-stream. Streaming errors propagate to the retry layer instead. Useful when a proxy or gateway causes the fallback to produce duplicate tool execution `CLAUDE_CODE_DISABLE_NOTIFICATION_PRESENCE_CHECK`| Set to `1` to send the `PushNotification` tool’s desktop notification even while you are typing in or focused on the terminal. By default the tool skips both the desktop notification and the [mobile push](</docs/en/remote-control#mobile-push-notifications>) when it detects recent keyboard activity or terminal focus. This variable disables only that local check, so the server can still suppress the mobile push when it detects that you are active. Requires Claude Code v2.1.193 or later `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL`| Set to `1` to disable automatic registration of the official plugin marketplace. Claude Code reads the variable when it is about to register the marketplace, usually during a machine’s first interactive launch. If the variable is set at that point, Claude Code skips the registration permanently. Unsetting the variable later doesn’t undo the skip. Run `claude plugin marketplace add anthropics/claude-plugins-official` to register the marketplace at any time +`CLAUDE_CODE_DISABLE_PERMISSION_PROMPT_NOTIFY_HOOKS`| Set to `1` to stop Claude Code from running your [`Notification` hooks for unanswered permission requests](</docs/en/hooks#notification>) in sessions where Claude Code sends them to the Agent SDK’s `canUseTool` callback, which is how Claude Desktop and the VS Code extension host Claude Code. Has no effect in terminal sessions. Requires Claude Code v2.1.233 or later `CLAUDE_CODE_DISABLE_POLICY_SKILLS`| Set to `1` to skip loading skills from the system-wide managed skills directory. Useful for container or CI sessions that should not load operator-provisioned skills `CLAUDE_CODE_DISABLE_TERMINAL_TITLE`| Set to `1` to disable automatic terminal title updates based on conversation context. In Agent SDK and `claude -p` sessions, this also skips the background small/fast-model request that generates the session title `CLAUDE_CODE_DISABLE_THINKING`| Set to `1` to omit the `thinking` parameter from API requests entirely. This is a compatibility option for proxies and gateways that reject the parameter. The variable’s behavior is unchanged from earlier versions; on models that think by default, omitting the parameter means the model may still think. To explicitly disable [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) on the Anthropic API, use `MAX_THINKING_TOKENS=0` instead, which is also ineffective on Fable 5 since it cannot have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `0` likewise omits the parameter, so the two variables behave the same there @@ -339,6 +340,7 @@ `CLAUDE_CODE_TEAM_TEARDOWN_PARK_TIMEOUT_MS`| Override, in milliseconds, how long a non-interactive session waits at exit for its [agent team](</docs/en/agent-teams>) to finish tearing down. Accepts 1000 to 60000; an out-of-range value is ignored and the default of 10000 applies. Requires Claude Code v2.1.206 or later `CLAUDE_CODE_TMPDIR`| Override the temp directory used for internal temp files. Claude Code appends `/claude-{uid}/` on Unix or `/claude/` on Windows to this path. Default: `/tmp` on macOS, `os.tmpdir()` on Linux and Windows. As of v2.1.161, on macOS and Linux, [sandboxed](</docs/en/sandboxing>) Bash subprocesses receive a short fallback `$TMPDIR` under the system default when your override is a long path, since some tools fail when temp paths get too long. Unsandboxed Bash commands inherit your shell’s `$TMPDIR` unchanged. Claude Code’s own temp files always use your override `CLAUDE_CODE_TMUX_TRUECOLOR`| Set to any non-empty value, such as `1`, to allow 24-bit truecolor output inside tmux. **Setting it to`0` or `false` still allows truecolor**, unlike most on/off variables; unset the variable to restore the 256-color clamp. By default, Claude Code clamps to 256 colors when `$TMUX` is set because tmux does not pass through truecolor escape sequences unless configured to. Set this after adding `set -ga terminal-overrides ',*:Tc'` to your `~/.tmux.conf`. See [Terminal configuration](</docs/en/terminal-config>) for other tmux settings +`CLAUDE_CODE_TOOL_MEMORY_LIMIT`| On Linux and WSL, set to a size such as `4G` to [cap the memory that Bash and PowerShell tool commands can use](</docs/en/tools-reference#memory-limit-on-linux-and-wsl>). Write the size in plain digits, alone for a number of bytes or with a `K`, `M`, `G`, or `T` suffix. Set `0` or `off` to turn the cap off. Once a tool command has turned the cap on or off, a changed value takes effect the next time you launch `claude`. Requires Claude Code v2.1.233 or later `CLAUDE_CODE_USER_DIALOG_TIMEOUT_MS`| Deadline in milliseconds for dialogs Claude Code forwards to a remote client, such as a [Remote Control](</docs/en/remote-control>) or SDK host, and for the approval dialog for a [held cross-session message](</docs/en/cross-session-messaging#control-inbound-messages>), before Claude Code cancels them; permission prompts and `AskUserQuestion` questions use their own flows and aren’t governed by it. [Control inbound messages](</docs/en/cross-session-messaging#control-inbound-messages>) and [non-interactive sessions](</docs/en/cross-session-messaging#non-interactive-sessions>) cover the full held-message expiry rules, including the cases where the deadline doesn’t apply. Overrides the [`dialogExpiry`](</docs/en/settings#available-settings>) setting; `0` or a negative value disables the deadline `CLAUDE_CODE_USE_ANTHROPIC_AWS`| Use [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) `CLAUDE_CODE_USE_BEDROCK`| Use [Amazon Bedrock](</docs/en/amazon-bedrock>) @@ -347,6 +349,7 @@ `CLAUDE_CODE_USE_NATIVE_FILE_SEARCH`| Set to `1` to discover custom commands, subagents, and output styles using Node.js file APIs instead of ripgrep. Set this if the bundled ripgrep binary is unavailable or blocked in your environment. Does not affect the Grep or file search tools `CLAUDE_CODE_USE_POWERSHELL_TOOL`| Controls the PowerShell tool. On Windows without Git Bash, the tool is enabled automatically; set to `0` to disable it. On Windows with Git Bash installed, the tool is rolling out progressively: set to `1` to opt in or `0` to opt out. On Linux, macOS, and WSL, set to `1` to enable it, which requires `pwsh` on your `PATH`. When enabled on Windows, Claude can run PowerShell commands natively instead of routing through Git Bash. See [PowerShell tool](</docs/en/tools-reference#powershell-tool>) `CLAUDE_CODE_USE_VERTEX`| Use [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>) +`CLAUDE_CODE_WEBFETCH_CACHE_TTL_MS`| Set to the number of milliseconds [WebFetch](</docs/en/tools-reference#webfetch-tool-behavior>) keeps each fetched URL’s response cached. The default is `900000`, which is 15 minutes. Takes plain digits only; `0`, a decimal, or any other spelling keeps the default. Claude Code reads the value once per launch, so a change in a settings `env` block applies when you next launch `claude`. Requires Claude Code v2.1.233 or later `CLAUDE_CODE_WORKFLOW_PREFIX_STAGGER_MS`| Upper bound in milliseconds on how long a [workflow](</docs/en/workflows>) agent waits for a same-prefix sibling’s first response to begin before sending its own first request. When a fan-out starts several agents that share a [prompt-cache prefix](</docs/en/workflows#prompt-caching-in-a-fan-out>), Claude Code holds all but the first agent for up to this long so the rest read the cached prefix instead of each processing it uncached. Default `5000`. Set to `0` to disable the wait. When `DISABLE_PROMPT_CACHING` is set, agents never wait. Requires Claude Code v2.1.229 or later `CLAUDE_CONFIG_DIR`| Override the configuration directory (default: `~/.claude`). All settings, session history, and plugins are stored under this path, as are credentials on Linux and Windows; on macOS, credentials are in the system Keychain. Useful for running multiple accounts side by side: for example, `alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'` `CLAUDE_DISABLE_ADOPT`| Set to `1` to stop in-flight background work instead of carrying it over when you background a session by pressing `←` or with [`/background`](</docs/en/agent-view#from-inside-a-session>). Claude Code asks you to confirm before backgrounding, then stops the tasks that would otherwise carry over. Requires Claude Code v2.1.195 or later
modified
--- a/env-vars.md +++ b/env-vars.md @@ -222,6 +222,7 @@ `CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP`| Set to `1` to prevent automatic remapping of Opus 4.0 and 4.1 to the current Opus version on the Anthropic API. Use when you intentionally want to pin an older model. The remap does not run on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry `CLAUDE_CODE_DISABLE_MOUSE`| Set to `1` to disable mouse tracking in [fullscreen rendering](</docs/en/fullscreen>). Keyboard scrolling with `PgUp` and `PgDn` still works. Use this to keep your terminal’s native copy-on-select behavior `CLAUDE_CODE_DISABLE_MOUSE_CLICKS`| Set to `1` to disable click, drag, and hover handling in [fullscreen rendering](</docs/en/fullscreen>) while keeping mouse-wheel scrolling. Use this when you want wheel scroll to work inside Claude Code but don’t want clicks to position the cursor, expand tool output, or open links. `CLAUDE_CODE_DISABLE_MOUSE` takes precedence when both are set. Requires Claude Code v2.1.195 or later +`CLAUDE_CODE_DISABLE_MTLS_RELOAD_ON_STALE_CONNECTION`| Set to `1` to stop Claude Code from re-reading the [mTLS client certificate and key](</docs/en/network-config#mtls-authentication>) when an API request fails with a connection-level error, such as a connection reset or a TLS handshake error. With the reload disabled, Claude Code loads rotated files only when it next applies settings or at the next startup. Requires Claude Code v2.1.232 or later `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`| Set to any non-empty value, such as `1`, to disable nonessential network traffic: auto-updates, telemetry, error reporting, the `/feedback` command, release notes, [gateway model discovery](</docs/en/llm-gateway-connect#add-gateway-models-to-the-model-picker>) refreshes, and availability checks such as the [fast mode](</docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways>) check. It also stops the [background runs of plugin `command` sources](</docs/en/plugin-marketplaces#when-claude-code-re-runs-the-command>), which are local commands rather than network traffic, because they can trigger dependency installs. **Setting it to`0` or `false` still disables this traffic**, unlike most on/off variables; unset the variable to allow it again. Also disables feature-flag fetching, which makes [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable. Official plugin marketplace auto-install isn’t covered; disable it with `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL` `CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK`| Set to `1` to disable the non-streaming fallback when a streaming request fails mid-stream. Streaming errors propagate to the retry layer instead. Useful when a proxy or gateway causes the fallback to produce duplicate tool execution `CLAUDE_CODE_DISABLE_NOTIFICATION_PRESENCE_CHECK`| Set to `1` to send the `PushNotification` tool’s desktop notification even while you are typing in or focused on the terminal. By default the tool skips both the desktop notification and the [mobile push](</docs/en/remote-control#mobile-push-notifications>) when it detects recent keyboard activity or terminal focus. This variable disables only that local check, so the server can still suppress the mobile push when it detects that you are active. Requires Claude Code v2.1.193 or later @@ -233,7 +234,7 @@ `CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL`| Set to `1` to disable virtual scrolling in [fullscreen rendering](</docs/en/fullscreen>) and render every message in the transcript. Use this if scrolling in fullscreen mode shows blank regions where messages should appear `CLAUDE_CODE_DISABLE_WORKFLOWS`| Set to `1` to disable [workflows](</docs/en/workflows#turn-workflows-off>). Equivalent to the [`disableWorkflows`](</docs/en/settings#available-settings>) setting `CLAUDE_CODE_EFFORT_LEVEL`| Set the effort level for supported models. Values: `low`, `medium`, `high`, `xhigh`, `max`, or `auto` to use the model default. Available levels depend on the model. Takes precedence over `/effort` and the `effortLevel` setting. See [Adjust effort level](</docs/en/model-config#adjust-effort-level>) -`CLAUDE_CODE_ENABLE_APPEND_SUBAGENT_PROMPT`| Set to `1` to enable appending extra text to the end of every [subagent](</docs/en/sub-agents>)’s system prompt. The [`--append-subagent-system-prompt`](</docs/en/cli-reference#cli-flags>) flag supplies the appended text and sets this variable automatically, so you don’t need to set it yourself. Requires Claude Code v2.1.205 or later +`CLAUDE_CODE_ENABLE_APPEND_SUBAGENT_PROMPT`| Set to `1` to enable appending extra text to the end of the system prompt of every [subagent](</docs/en/sub-agents>) other than a [forked subagent](</docs/en/sub-agents#fork-the-current-conversation>). The [`--append-subagent-system-prompt`](</docs/en/cli-reference#cli-flags>) flag supplies the appended text and sets this variable automatically, so you don’t need to set it yourself. Requires Claude Code v2.1.205 or later `CLAUDE_CODE_ENABLE_AUTO_MODE`| Accepted for compatibility with older releases and has no effect. Auto mode is available by default on every provider, including Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and signed-in [Claude apps gateway](</docs/en/claude-apps-gateway>) sessions. In v2.1.158 through v2.1.206, setting this to `1` was required to make [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) available on those providers `CLAUDE_CODE_ENABLE_AWAY_SUMMARY`| Override [session recap](</docs/en/interactive-mode#session-recap>) availability. Set to `0` to force recaps off regardless of the `/config` toggle. Set to `1` to force recaps on when [`awaySummaryEnabled`](</docs/en/settings#available-settings>) is `false`. Takes precedence over the setting and `/config` toggle `CLAUDE_CODE_ENABLE_BACKGROUND_PLUGIN_REFRESH`| Set to `1` to refresh plugin state at turn boundaries in [non-interactive mode](</docs/en/headless>) after a background install completes. Off by default because the refresh changes the system prompt mid-session, which invalidates [prompt caching](</docs/en/prompt-caching>) for that turn @@ -242,8 +243,9 @@ `CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY`| Set to `1` to populate the `/model` picker from your gateway’s `/v1/models` endpoint when `ANTHROPIC_BASE_URL` points at an Anthropic-compatible gateway such as LiteLLM, Kong, or an internal proxy. Off by default because gateways backed by a shared API key would otherwise show every user every model the key can access. Discovered models are still filtered by an [`availableModels`](</docs/en/settings#available-settings>) allowlist the session receives; deliver the list through [MDM or a managed settings file](</docs/en/settings#settings-files>), since [server-managed delivery is not available on gateway configurations](</docs/en/server-managed-settings#platform-availability>) `CLAUDE_CODE_ENABLE_OPUS_4_7_FAST_MODE`| Removed in v2.1.142, when the [fast mode](</docs/en/fast-mode>) default moved from Opus 4.6 to Opus 4.7 `CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION`| Set to `false` to disable prompt suggestions (the “Prompt suggestions” toggle in `/config`). These are the grayed-out predictions that appear in your prompt input. Takes precedence over the [`promptSuggestionEnabled`](</docs/en/settings#available-settings>) setting. See [Prompt suggestions](</docs/en/interactive-mode#prompt-suggestions>) -`CLAUDE_CODE_ENABLE_TASKS`| Controls whether sessions use the structured Task tools (`TaskCreate`, `TaskUpdate`, `TaskGet`, `TaskList`) or the legacy `TodoWrite` tool. As of Claude Code v2.1.142, Task tools are the default in all modes. Set to `0` to revert to `TodoWrite`. See [Task list](</docs/en/interactive-mode#task-list>) and [Migrate to Task tools](</docs/en/agent-sdk/todo-tracking#migrate-to-task-tools>) +`CLAUDE_CODE_ENABLE_TASKS`| Selects which task-tracking tools Claude Code provides in [sessions that have them](</docs/en/tools-reference#task-tool-availability>). By default, Claude Code provides the Task tools `TaskCreate`, `TaskUpdate`, `TaskGet`, and `TaskList`. Set to `0` to get the legacy `TodoWrite` tool instead. See [Task list](</docs/en/interactive-mode#task-list>) and [Migrate to Task tools](</docs/en/agent-sdk/todo-tracking#migrate-to-task-tools>) `CLAUDE_CODE_ENABLE_TELEMETRY`| Set to `1` to enable OpenTelemetry data collection for metrics and logging. Required before configuring OTel exporters. See [Monitoring](</docs/en/monitoring-usage>) +`CLAUDE_CODE_ENABLE_TODO_TOOLS`| Set to `1` to get the task-tracking tools on the models listed under [Task tool availability](</docs/en/tools-reference#task-tool-availability>), where Claude Code otherwise leaves them out. `CLAUDE_CODE_ENABLE_TASKS` still selects the Task tools or `TodoWrite`. Requires Claude Code v2.1.233 or later `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 `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS`| Set to `1` to enable [agent teams](</docs/en/agent-teams>). Agent teams are experimental and disabled by default `CLAUDE_CODE_EXTRA_BODY`| JSON object to merge into the top level of every API request body. Useful for passing provider-specific parameters that Claude Code doesn’t expose directly. A value exported in your shell also applies to the [background sessions](</docs/en/agent-view>) you dispatch with `claude agents` or `--bg`. Before v2.1.206, background sessions ignored a shell-exported value and used whatever copy the background supervisor process inherited @@ -333,7 +335,7 @@ `CLAUDE_CODE_SYNC_SKILLS_INSTALL_TIMEOUT_MS`| Timeout in milliseconds for a mid-session skills resync when `CLAUDE_CODE_SYNC_SKILLS` is set (default: 30000). Bounds the download triggered when the host requests a skill reload during the session. When exceeded, the resync stops and remaining downloads continue in the background `CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS`| Timeout in milliseconds for the first query to wait for the initial skill list when `CLAUDE_CODE_SYNC_SKILLS` is set (default: 5000). When exceeded, the first query runs with whichever skills have arrived. The downloads finish in the background either way, and Claude waits for a skill’s download when it invokes that skill `CLAUDE_CODE_SYNTAX_HIGHLIGHT`| Set to `false` to disable syntax highlighting in diff output. Useful when colors interfere with your terminal setup. To also disable highlighting in code blocks and file previews, use the [`syntaxHighlightingDisabled`](</docs/en/settings>) setting -`CLAUDE_CODE_TASK_LIST_ID`| Share a task list across sessions. Set the same ID in multiple Claude Code instances to coordinate on a shared task list. See [Task list](</docs/en/interactive-mode#task-list>) +`CLAUDE_CODE_TASK_LIST_ID`| Share a task list across sessions. Set the same ID in multiple Claude Code instances to coordinate on a shared task list, in [sessions that have the Task tools](</docs/en/tools-reference#task-tool-availability>). See [Task list](</docs/en/interactive-mode#task-list>) `CLAUDE_CODE_TEAM_TEARDOWN_PARK_TIMEOUT_MS`| Override, in milliseconds, how long a non-interactive session waits at exit for its [agent team](</docs/en/agent-teams>) to finish tearing down. Accepts 1000 to 60000; an out-of-range value is ignored and the default of 10000 applies. Requires Claude Code v2.1.206 or later `CLAUDE_CODE_TMPDIR`| Override the temp directory used for internal temp files. Claude Code appends `/claude-{uid}/` on Unix or `/claude/` on Windows to this path. Default: `/tmp` on macOS, `os.tmpdir()` on Linux and Windows. As of v2.1.161, on macOS and Linux, [sandboxed](</docs/en/sandboxing>) Bash subprocesses receive a short fallback `$TMPDIR` under the system default when your override is a long path, since some tools fail when temp paths get too long. Unsandboxed Bash commands inherit your shell’s `$TMPDIR` unchanged. Claude Code’s own temp files always use your override `CLAUDE_CODE_TMUX_TRUECOLOR`| Set to any non-empty value, such as `1`, to allow 24-bit truecolor output inside tmux. **Setting it to`0` or `false` still allows truecolor**, unlike most on/off variables; unset the variable to restore the 256-color clamp. By default, Claude Code clamps to 256 colors when `$TMUX` is set because tmux does not pass through truecolor escape sequences unless configured to. Set this after adding `set -ga terminal-overrides ',*:Tc'` to your `~/.tmux.conf`. See [Terminal configuration](</docs/en/terminal-config>) for other tmux settings @@ -396,7 +398,7 @@ `MAX_STRUCTURED_OUTPUT_RETRIES`| Number of times Claude Code retries when the model’s response fails validation against the [`--json-schema`](</docs/en/cli-reference#cli-flags>) in non-interactive mode with the `-p` flag. The same retry count applies when a [workflow](</docs/en/workflows>) subagent’s structured output fails validation. Defaults to 5 `MAX_THINKING_TOKENS`| Fixed token budget for [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>). Claude Code caps it at one token below the request’s max output tokens and never below 1,024; see `CLAUDE_CODE_MAX_OUTPUT_TOKENS` for how that limit is set. When unset and thinking is enabled, models with [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) choose their own thinking depth, and other models use the cap. Set to `0` to disable thinking on the Anthropic API, except on Fable 5, which cannot have thinking turned off; on [third-party providers](</docs/en/third-party-integrations>), `0` omits the `thinking` parameter instead. Nonzero values are ignored on adaptive reasoning models unless `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` is set `MCP_CLIENT_SECRET`| OAuth client secret for MCP servers that require [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>). Avoids the interactive prompt when adding a server with `--client-secret` -`MCP_CONNECTION_NONBLOCKING`| Controls whether startup waits for MCP servers to connect before the first query. MCP startup is non-blocking by default: servers connect in the background and their tools become available as they finish; before v2.1.142, the blocking wait was the default. Set to `0` to restore the blocking 5-second connection wait. Servers configured with [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>) still make startup wait regardless, except when served from the [discovery cache](</docs/en/mcp#managing-your-servers>), since their tools must be present when the first prompt is built. In non-interactive mode (`-p`), Claude Code also waits for still-pending servers before the first turn regardless of this variable, with a longer deadline when you pass [`--mcp-config`](</docs/en/cli-reference#cli-flags>) explicitly; see that flag’s entry for the cached-server exception +`MCP_CONNECTION_NONBLOCKING`| Controls whether startup waits for MCP servers to connect before the first query. MCP startup is non-blocking by default: servers connect in the background and their tools become available as they finish. Set to `0` to make Claude Code wait for servers to connect before the first query. Servers configured with [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>) still make startup wait regardless, except when served from the [discovery cache](</docs/en/mcp#managing-your-servers>), since their tools must be present when the first prompt is built. In non-interactive mode (`-p`), Claude Code also waits for still-pending servers before the first turn regardless of this variable, with a longer deadline when you pass [`--mcp-config`](</docs/en/cli-reference#cli-flags>) explicitly; see that flag’s entry for the cached-server exception `MCP_CONNECT_TIMEOUT_MS`| How long blocking MCP startup waits, in milliseconds, for the connection batch before snapshotting the tool list (default: 5000). Applies when `MCP_CONNECTION_NONBLOCKING=0` or for servers marked [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>). Servers still pending at the deadline keep connecting in the background. Distinct from `MCP_TIMEOUT`, which bounds an individual server’s connect attempt `MCP_DISCOVERY_CACHE`| Set to `0` to turn off the cross-process MCP discovery cache, so every server connects at startup instead of showing the [`connects on first use` cached status](</docs/en/mcp#managing-your-servers>) and connecting on its first tool call. The cached status requires Claude Code v2.1.221 or later `MCP_OAUTH_CALLBACK_PORT`| Fixed port for the OAuth redirect callback, as an alternative to `--callback-port` when adding an MCP server with [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>) @@ -445,17 +447,19 @@ Features that need feature-flag fetching -Claude Code turns some features on through feature flags it fetches from Anthropic. `DISABLE_GROWTHBOOK`, `DISABLE_TELEMETRY`, `DO_NOT_TRACK`, and `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` all turn flag fetching off when set to a value that disables them, and each variable’s row says which values do that. A session running with fetching off can’t use: - - * [Remote Control](</docs/en/remote-control#requirements>) - * [Cross-session messaging](</docs/en/cross-session-messaging#availability>) - * [`claude import` and the `/import` command](</docs/en/cli-reference#cli-commands>) - * [The `/schedule` command](</docs/en/routines#troubleshooting>) for creating routines from the CLI - * [The advisor tool](</docs/en/advisor#requirements>) - * [`/loop` self-pacing](</docs/en/scheduled-tasks#let-claude-choose-the-interval>), so a `/loop` prompt with no interval runs on the fixed 10-minute schedule instead - * [The built-in `/loop` maintenance prompt](</docs/en/scheduled-tasks#run-the-built-in-maintenance-prompt>), so `/loop` with no prompt shows the usage message instead - -In such a session you can still type `/code-review` yourself, but [Claude can’t start the review on its own, and a scheduled `/code-review` reaches Claude as plain text](</docs/en/code-review#let-claude-start-the-review>) instead of running the review. +Claude Code turns some features on through feature flags it fetches from Anthropic. You turn flag fetching off for a session by setting `DISABLE_GROWTHBOOK`, `DISABLE_TELEMETRY`, `DO_NOT_TRACK`, or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`. Each variable’s row says which values do that. With fetching off, you can’t: + + * [Start sessions in auto mode by default](</docs/en/permission-modes#which-mode-a-session-starts-in>) on Pro, Max, and Team plans; Claude Code starts your sessions in Manual instead + * Have the VS Code extension [read settings files for the starting mode](</docs/en/permission-modes#switch-permission-modes>) + * Use [Remote Control](</docs/en/remote-control#requirements>) + * Send or receive [cross-session messages](</docs/en/cross-session-messaging#availability>) + * Run [`claude import` or the `/import` command](</docs/en/cli-reference#cli-commands>) + * Create routines from the CLI with [`/schedule`](</docs/en/routines#troubleshooting>) + * Use [the advisor tool](</docs/en/advisor#requirements>) + * Let [Claude choose the `/loop` interval](</docs/en/scheduled-tasks#let-claude-choose-the-interval>); Claude Code runs a `/loop` prompt with no interval on the fixed 10-minute schedule instead + * Run [the built-in `/loop` maintenance prompt](</docs/en/scheduled-tasks#run-the-built-in-maintenance-prompt>); Claude Code shows the usage message instead when you run `/loop` with no prompt + +With fetching off, you can still type `/code-review` yourself, but [Claude can’t start the review on its own, and a scheduled `/code-review` reaches Claude as plain text](</docs/en/code-review#let-claude-start-the-review>) instead of running the review. ### @@ -463,7 +467,7 @@ First session after an install or upgrade -A feature in this list can be missing from your first session after you install Claude Code, or after you upgrade to a version that adds the feature, even with none of these variables set. Claude Code fetches the flags during that session, so a feature that’s otherwise available to you is there in your next session. Two features work differently in that first session: +You can also miss a feature in this list in your first session after you install Claude Code, or after you upgrade to a version that adds the feature, even with none of these variables set. Claude Code fetches the flags during that session, so a feature that’s otherwise available to you is there in your next session. Two features behave differently in that first session: * Claude Code [binds the session’s inbox socket](</docs/en/cross-session-messaging#the-sessions-inbox-socket>) and exports the messaging variables partway through the session, as soon as the fetch completes, so other sessions can message it before you restart. * Claude Code checks the `claude import` flag before it starts a session, so if `claude import` is the first thing you run after installing, it prints [`claude import is not yet available in this build`](</docs/en/errors#claude-import-is-not-yet-available-in-this-build>). Start a session, then run it again.
modified
--- a/env-vars.md +++ b/env-vars.md @@ -184,7 +184,7 @@ `CLAUDE_CODE_ALWAYS_ENABLE_EFFORT`| Set to `1` to send the [effort](</docs/en/model-config#adjust-effort-level>) parameter with every request, even when Claude Code does not recognize the model ID as effort-capable. Use this when routing through an [LLM gateway](</docs/en/llm-gateway>) or third-party provider that serves models under custom identifiers. Models that reject the effort parameter at the API, including Claude 3 models, Sonnet 4.0 and 4.5, Opus 4.0 and 4.1, and Haiku 4.5, are still excluded so requests do not fail `CLAUDE_CODE_API_KEY_HELPER_TTL_MS`| Interval in milliseconds at which credentials should be refreshed (when using [`apiKeyHelper`](</docs/en/settings#available-settings>)) `CLAUDE_CODE_ARTIFACT_AUTO_OPEN`| Set to `0` to stop Claude Code from opening the browser automatically when a new [artifact](</docs/en/artifacts>) is published. Republishing an existing artifact does not open the browser regardless of this setting -`CLAUDE_CODE_ATTRIBUTION_HEADER`| Set to `0` to omit the [attribution block](</docs/en/llm-gateway-protocol#system-prompt-attribution-block>), which carries the client version and a prompt fingerprint, from the start of the system prompt. Caching on a direct connection to the Anthropic API is unaffected either way. Before v2.1.181 the block included a per-request token on custom base URLs and Microsoft Foundry connections, so on those versions set it to `0` when your [LLM gateway](</docs/en/llm-gateway>) caches on the request body or forwards requests to a third-party provider, or when you connect to Microsoft Foundry directly +`CLAUDE_CODE_ATTRIBUTION_HEADER`| Set to `0` to omit the [attribution block](</docs/en/llm-gateway-protocol#system-prompt-attribution-block>), which carries the client version and a prompt fingerprint, from the start of the system prompt. Caching on a direct connection to the Anthropic API is unaffected either way. In some direct-connection setups, Claude Code keeps the block on [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) classifier requests even when you set `0`. In [System prompt attribution block](</docs/en/llm-gateway-protocol#system-prompt-attribution-block>), check which connections and credentials this covers. Before v2.1.181 the block included a per-request token on custom base URLs and Microsoft Foundry connections, so on those versions set it to `0` when your LLM gateway caches on the request body or forwards requests to a third-party provider, or when you connect to Microsoft Foundry directly `CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the [auto-compact window](</docs/en/model-config#set-the-auto-compact-window>) in tokens, from `100000` to `1000000`. Accepts a plain integer such as `500000` only: a value like `500k` reads as `500` and clamps to the 100K minimum. Takes precedence over the `/autocompact` command, the `--autocompact` flag, and the `autoCompactWindow` setting. The status line’s `used_percentage` always measures against the model’s full context window, so once this variable is set, that percentage no longer indicates when compaction will run `CLAUDE_CODE_AUTO_CONNECT_IDE`| Override automatic [IDE connection](</docs/en/vs-code>). By default, Claude Code connects automatically when launched inside a supported IDE’s integrated terminal. Set to `false` to prevent this. Set to `true` to force a connection attempt when auto-detection fails, such as when tmux obscures the parent terminal. Takes precedence over the [`autoConnectIde`](</docs/en/settings#global-config-settings>) global config setting `CLAUDE_CODE_AWS_CHAIN_RESOLVE_TIMEOUT_MS`| Time in milliseconds Claude Code waits for the AWS default credential provider chain to produce credentials before the request fails with [`AWS default-chain credential resolve timed out`](</docs/en/errors#aws-default-chain-credential-resolve-timed-out>) (default: `60000`). Raise it when a step in your chain legitimately needs longer, such as a browser-based SSO sign-in with MFA through a wrapper like `aws-vault`. Applies wherever Claude Code signs with the default chain: [Amazon Bedrock](</docs/en/amazon-bedrock#credential-caching-and-resolution-timeout>), [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), and the [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>). Requires Claude Code v2.1.207 or later @@ -199,7 +199,7 @@ `CLAUDE_CODE_DEBUG_LOG_LEVEL`| Minimum log level written to the debug log file. Values: `verbose`, `debug` (default), `info`, `warn`, `error`. Set to `verbose` to include high-volume diagnostics like full status line command output, or raise to `error` to reduce noise `CLAUDE_CODE_DISABLE_1M_CONTEXT`| Set to `1` to disable [1M context window](</docs/en/model-config#extended-context>) support. When set, 1M model variants are unavailable in the model picker, and Claude Code holds sessions on models with a native 1M window, such as [Sonnet 5](</docs/en/model-config#sonnet-5-context-window>) and Fable 5, to a 200K window; see [Extended context](</docs/en/model-config#extended-context>) for how the hold is enforced. Useful for enterprise environments with compliance requirements. For its role in correcting the window for an unrecognized `[1m]` model ID, see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>) `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING`| Set to `1` to disable [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) on Opus 4.6 and Sonnet 4.6 and fall back to the fixed thinking budget controlled by `MAX_THINKING_TOKENS`. Has no effect on Fable 5, Sonnet 5, or Opus 4.7 and later, which always use adaptive reasoning -`CLAUDE_CODE_DISABLE_ADMIN_ENV_UNION`| Set to `1` to stop Claude Code from merging [managed settings](</docs/en/settings#settings-precedence>) `env` blocks per key across admin sources, so only the highest-priority source’s whole `env` block applies, as before v2.1.223. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.223 or later +`CLAUDE_CODE_DISABLE_ADMIN_ENV_UNION`| Set to `1` to stop Claude Code from merging [managed settings](</docs/en/settings#precedence-within-the-managed-tier>) `env` blocks per key across admin sources, so only the highest-priority source’s whole `env` block applies, as before v2.1.223. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.223 or later `CLAUDE_CODE_DISABLE_ADVISOR_TOOL`| Set to `1` to disable the [advisor tool](</docs/en/advisor>). The `/advisor` command becomes unavailable, any configured `advisorModel` is ignored, and the `--advisor` flag is accepted but has no effect, so existing scripts that pass it continue to work without errors `CLAUDE_CODE_DISABLE_AGENT_VIEW`| Set to `1` to turn off [background agents and agent view](</docs/en/agent-view>): `claude agents`, `--bg`, `/background`, and the on-demand supervisor. Equivalent to the [`disableAgentView`](</docs/en/settings#available-settings>) setting `CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN`| Set to `1` to disable [fullscreen rendering](</docs/en/fullscreen>) and use the classic main-screen renderer. The conversation stays in your terminal’s native scrollback so `Cmd+f` and tmux copy mode work as usual. Takes precedence over `CLAUDE_CODE_NO_FLICKER` and the [`tui`](</docs/en/settings#available-settings>) setting. You can also switch with `/tui default`. Does not apply to background sessions opened from [agent view](</docs/en/agent-view>), which always use fullscreen rendering @@ -222,7 +222,7 @@ `CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP`| Set to `1` to prevent automatic remapping of Opus 4.0 and 4.1 to the current Opus version on the Anthropic API. Use when you intentionally want to pin an older model. The remap does not run on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry `CLAUDE_CODE_DISABLE_MOUSE`| Set to `1` to disable mouse tracking in [fullscreen rendering](</docs/en/fullscreen>). Keyboard scrolling with `PgUp` and `PgDn` still works. Use this to keep your terminal’s native copy-on-select behavior `CLAUDE_CODE_DISABLE_MOUSE_CLICKS`| Set to `1` to disable click, drag, and hover handling in [fullscreen rendering](</docs/en/fullscreen>) while keeping mouse-wheel scrolling. Use this when you want wheel scroll to work inside Claude Code but don’t want clicks to position the cursor, expand tool output, or open links. `CLAUDE_CODE_DISABLE_MOUSE` takes precedence when both are set. Requires Claude Code v2.1.195 or later -`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`| Set to any non-empty value, such as `1`, to disable nonessential network traffic: auto-updates, telemetry, error reporting, the `/feedback` command, release notes, [gateway model discovery](</docs/en/llm-gateway-connect#add-gateway-models-to-the-model-picker>) refreshes, and availability checks such as the [fast mode](</docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways>) check. **Setting it to`0` or `false` still disables this traffic**, unlike most on/off variables; unset the variable to allow it again. Also disables feature-flag fetching, which makes [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable. Official plugin marketplace auto-install isn’t covered; disable it with `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL` +`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`| Set to any non-empty value, such as `1`, to disable nonessential network traffic: auto-updates, telemetry, error reporting, the `/feedback` command, release notes, [gateway model discovery](</docs/en/llm-gateway-connect#add-gateway-models-to-the-model-picker>) refreshes, and availability checks such as the [fast mode](</docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways>) check. It also stops the [background runs of plugin `command` sources](</docs/en/plugin-marketplaces#when-claude-code-re-runs-the-command>), which are local commands rather than network traffic, because they can trigger dependency installs. **Setting it to`0` or `false` still disables this traffic**, unlike most on/off variables; unset the variable to allow it again. Also disables feature-flag fetching, which makes [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable. Official plugin marketplace auto-install isn’t covered; disable it with `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL` `CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK`| Set to `1` to disable the non-streaming fallback when a streaming request fails mid-stream. Streaming errors propagate to the retry layer instead. Useful when a proxy or gateway causes the fallback to produce duplicate tool execution `CLAUDE_CODE_DISABLE_NOTIFICATION_PRESENCE_CHECK`| Set to `1` to send the `PushNotification` tool’s desktop notification even while you are typing in or focused on the terminal. By default the tool skips both the desktop notification and the [mobile push](</docs/en/remote-control#mobile-push-notifications>) when it detects recent keyboard activity or terminal focus. This variable disables only that local check, so the server can still suppress the mobile push when it detects that you are active. Requires Claude Code v2.1.193 or later `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL`| Set to `1` to disable automatic registration of the official plugin marketplace. Claude Code reads the variable when it is about to register the marketplace, usually during a machine’s first interactive launch. If the variable is set at that point, Claude Code skips the registration permanently. Unsetting the variable later doesn’t undo the skip. Run `claude plugin marketplace add anthropics/claude-plugins-official` to register the marketplace at any time @@ -251,7 +251,7 @@ `CLAUDE_CODE_FORCE_SESSION_PERSISTENCE`| Set to `1` to force transcript persistence, prompt history, and `claude agents` registration even when this `claude` was launched from inside another Claude Code session. Use when an inherited `CLAUDE_CODE_CHILD_SESSION` value, for example from a `screen` session or a background launcher first started by Claude Code’s Bash tool, causes a genuine top-level session to be misclassified as nested. As of v2.1.178, Claude Code detects the tmux case automatically and ignores the inherited marker, so tmux no longer needs this variable. Also honored on v2.1.169 and earlier; has no effect on v2.1.170 and v2.1.171, where the nested-session detection it overrides was removed `CLAUDE_CODE_FORCE_STRIKETHROUGH`| Set to `1` to force strikethrough rendering for `~~text~~` in Claude’s responses when your terminal supports it but is not auto-detected, such as over SSH without `TERM_PROGRAM` forwarded. Without this, undetected terminals show the literal `~~` markers instead of rendering the text as strikethrough. Requires Claude Code v2.1.186 or later `CLAUDE_CODE_FORCE_SYNC_OUTPUT`| Set to `1` to force-enable DEC private mode 2026 [synchronized output](<https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036>) when your terminal supports it but is not auto-detected. Useful for emulators such as Emacs `eat` that implement BSU/ESU but do not reply to the capability probe. Has no effect under tmux. Unlike `CLAUDE_CODE_NO_FLICKER`, which switches to [fullscreen rendering](</docs/en/fullscreen>), this doesn’t change the renderer -`CLAUDE_CODE_FORK_SUBAGENT`| Set to `1` to let Claude spawn [forked subagents](</docs/en/sub-agents#fork-the-current-conversation>), or `0` to disable them, overriding any server-side rollout. When enabled, Claude can request the `fork` subagent type to spawn a fork, a subagent that inherits the full conversation context instead of starting fresh. When Claude doesn’t request a subagent type, it still gets the general-purpose subagent, and every subagent runs in the background. The explicit [`/subtask`](</docs/en/commands#all-commands>) command, named `/fork` on v2.1.161 through v2.1.211, works without this variable; on v2.1.117 through v2.1.160, `/fork` is the forked-subagent command only when this variable is set to `1` or a server-side rollout enabled it. Works in interactive mode and via the SDK or `claude -p`. When [agent view is turned off](</docs/en/agent-view#turn-off-agent-view>), `/subtask` isn’t available and the command stays `/fork` +`CLAUDE_CODE_FORK_SUBAGENT`| Controls [fork mode](</docs/en/sub-agents#turn-fork-mode-on-or-off>), which lets Claude spawn [forked subagents](</docs/en/sub-agents#fork-the-current-conversation>) itself and is on by default in interactive sessions only. Set to `1` to turn it on in `claude -p` and the Agent SDK as well, or `0` to turn it off in every kind of session. The `/subtask` command works whether or not fork mode is on. The interactive default requires Claude Code v2.1.232 or later `CLAUDE_CODE_FORWARD_SUBAGENT_TEXT`| Set to `1` to emit [subagent](</docs/en/sub-agents>) text and thinking blocks in `claude -p --output-format stream-json` output, the same behavior as the [`--forward-subagent-text`](</docs/en/cli-reference#cli-flags>) flag. Use the variable when a harness invokes `claude` and can’t pass the flag itself. Unlike the flag, which exits with an error outside non-interactive mode with stream-json output, the variable is ignored there so that nested invocations keep working when it’s set process-wide. Requires Claude Code v2.1.211 or later `CLAUDE_CODE_GIT_BASH_PATH`| Windows only: path to the Git Bash executable (`bash.exe`). Use when Git Bash is installed but not in your PATH. If the path doesn’t exist or the file isn’t named `bash.exe`, `sh.exe`, `bash`, or `sh`, Claude Code ignores the variable and auto-detects Git Bash as if it were unset, logging a warning visible with `--debug`. Before v2.1.219, Claude Code exited at startup when the path didn’t exist, and used any existing file as the shell without checking that it was bash or sh. See [Windows setup](</docs/en/setup#set-up-on-windows>) `CLAUDE_CODE_GLOB_HIDDEN`| Set to `false` to exclude dotfiles from results when Claude invokes the [Glob tool](</docs/en/tools-reference#glob-tool-behavior>). Included by default. Does not affect `@` file autocomplete, `ls`, Grep, or Read @@ -280,7 +280,7 @@ `CLAUDE_CODE_NO_FLICKER`| Set to `1` to enable [fullscreen rendering](</docs/en/fullscreen>), a research preview that reduces flicker and keeps memory flat in long conversations. Equivalent to the [`tui`](</docs/en/settings#available-settings>) setting; you can also switch with `/tui fullscreen` `CLAUDE_CODE_OAUTH_REFRESH_TOKEN`| OAuth refresh token for Claude.ai authentication. When set, `claude auth login` exchanges this token directly instead of opening a browser. Requires `CLAUDE_CODE_OAUTH_SCOPES`. Useful for provisioning authentication in automated environments `CLAUDE_CODE_OAUTH_SCOPES`| Space-separated OAuth scopes the refresh token was issued with, such as `"user:profile user:inference user:sessions:claude_code"`. Required when `CLAUDE_CODE_OAUTH_REFRESH_TOKEN` is set -`CLAUDE_CODE_OAUTH_TOKEN`| OAuth access token for Claude.ai authentication. Alternative to `/login` for SDK and automated environments. Takes precedence over keychain-stored credentials. Generate one with [`claude setup-token`](</docs/en/authentication#generate-a-long-lived-token>). Claude Code uses the token you set for the whole session. To replace an expired token, generate a new one and restart +`CLAUDE_CODE_OAUTH_TOKEN`| OAuth access token for claude.ai authentication. Alternative to `/login` for SDK and automated environments. Takes precedence over keychain-stored credentials. Generate one with [`claude setup-token`](</docs/en/authentication#generate-a-long-lived-token>). Unless you run [`/login`](</docs/en/authentication#authentication-precedence>), Claude Code uses the token you set for the whole session. To replace an expired token, generate a new one and restart `CLAUDE_CODE_OPUS_4_6_FAST_MODE_OVERRIDE`| Removed in v2.1.160 and now a no-op. Previously pinned [fast mode](</docs/en/fast-mode>) to Claude Opus 4.6 instead of the current default. Opus 4.6 no longer supports fast mode `CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH`| Maximum length of content-bearing OpenTelemetry attributes (model responses, tool content, system prompts, raw API bodies), truncation marker included, in UTF-16 code units (default: 61440, i.e. 60 KB). Raise it only if your telemetry backend accepts attribute values larger than 64 KB, or lower it to cut telemetry volume. Requires Claude Code v2.1.214 or later. See [Monitoring](</docs/en/monitoring-usage>) `CLAUDE_CODE_OTEL_DIAG_STDERR`| Set to `1` to write OpenTelemetry exporter diagnostic errors to stderr. By default these errors only appear with `--debug`, so a misconfigured exporter such as a Prometheus port collision otherwise fails silently. Requires Claude Code v2.1.179 or later. See [Monitoring](</docs/en/monitoring-usage>) @@ -298,7 +298,7 @@ `CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS`| Maximum time in milliseconds that [non-interactive mode](</docs/en/headless#background-tasks-at-exit>) with the `-p` flag waits after the final turn for background subagents and workflows whose result is part of the output. Default: `600000`, or 10 minutes. When the cap is exceeded, remaining background tasks are terminated and the process exits. Set to `0` to wait indefinitely. This cap is separate from the five-second grace period that applies to plain background shells `CLAUDE_CODE_PROCESS_WRAPPER`| Launch the processes Claude Code starts from its own binary, such as the background service that hosts [agent view](</docs/en/agent-view>) sessions, through a corporate launcher given as an argv prefix like `/opt/corp/launcher`. Set it in the `env` block of user or [managed settings](</docs/en/permissions#managed-settings>), not as a shell export, so the detached background service inherits it; project and local settings can’t set it. Equivalent to the [`processWrapper` setting](</docs/en/settings#available-settings>), which requires Claude Code v2.1.210 or later; this variable takes precedence when both are set. The VS Code extension configures its own launcher separately through its `claudeProcessWrapper` setting. Ignored on Windows. See [Run Claude Code behind a corporate launcher](</docs/en/corporate-launcher>) for the value format, what the launcher covers, and the contract the launcher must satisfy. Requires Claude Code v2.1.208 or later `CLAUDE_CODE_PROPAGATE_TRACEPARENT`| Set to `1` to propagate W3C trace context when `ANTHROPIC_BASE_URL` points at a custom proxy. Propagation covers the `traceparent` header on model and HTTP MCP requests and the `TRACEPARENT` environment variable for Bash, PowerShell, and hook subprocesses. By default, propagation is enabled only when connected directly to the Anthropic API. Added in v2.1.152. See [Traces (beta)](</docs/en/monitoring-usage#traces-beta>) -`CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`| Set by host platforms that embed Claude Code and manage model provider routing on its behalf. When set, Claude Code ignores provider-selection, endpoint, and authentication variables such as `CLAUDE_CODE_USE_BEDROCK`, `ANTHROPIC_BASE_URL`, and `ANTHROPIC_API_KEY` in settings files, so user settings can’t override the host’s routing. Claude Code also ignores model-selection keys such as `model`, `fallbackModel`, and `modelOverrides` in [managed settings](</docs/en/permissions#managed-settings>), whichever managed source delivers them, so the host’s model configuration takes precedence over an out-of-date managed model pin; an [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist in managed settings still applies unless the host supplies its own. Claude Code also skips the automatic telemetry opt-out for Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry, so telemetry follows the standard `DISABLE_TELEMETRY` opt-out. See [Default behaviors by API provider](</docs/en/data-usage#default-behaviors-by-api-provider>) +`CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`| Set by host platforms that embed Claude Code and manage model provider routing on its behalf. When set, Claude Code ignores provider-selection, endpoint, and authentication variables such as `CLAUDE_CODE_USE_BEDROCK`, `ANTHROPIC_BASE_URL`, and `ANTHROPIC_API_KEY` in settings files, so user settings can’t override the host’s routing. Claude Code also ignores model-selection keys such as `model`, `fallbackModel`, and `modelOverrides` in [managed settings](</docs/en/permissions#managed-settings>), whichever managed source delivers them, so the host’s model configuration takes precedence over an out-of-date managed model pin; an [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist in managed settings still applies unless the host supplies its own. Claude Code also skips the automatic telemetry opt-out it otherwise applies on third-party providers such as Amazon Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform, and Microsoft Foundry, so telemetry follows the standard `DISABLE_TELEMETRY` opt-out. See [Default behaviors by API provider](</docs/en/data-usage#default-behaviors-by-api-provider>) `CLAUDE_CODE_PROXY_RESOLVES_HOSTS`| Set to `1` to allow the proxy to perform DNS resolution instead of the caller. Opt-in for environments where the proxy should handle hostname resolution `CLAUDE_CODE_REMOTE`| Set automatically to `true` when Claude Code is running as a [cloud session](</docs/en/claude-code-on-the-web>). Read this from a hook or setup script to detect whether you are in a cloud session `CLAUDE_CODE_REMOTE_SESSION_ID`| Set automatically in [cloud sessions](</docs/en/claude-code-on-the-web>) to the current session’s ID. Read this to construct a link back to the session transcript. See [Link output back to the session](</docs/en/cloud-environments#link-output-back-to-the-session>) @@ -345,6 +345,7 @@ `CLAUDE_CODE_USE_NATIVE_FILE_SEARCH`| Set to `1` to discover custom commands, subagents, and output styles using Node.js file APIs instead of ripgrep. Set this if the bundled ripgrep binary is unavailable or blocked in your environment. Does not affect the Grep or file search tools `CLAUDE_CODE_USE_POWERSHELL_TOOL`| Controls the PowerShell tool. On Windows without Git Bash, the tool is enabled automatically; set to `0` to disable it. On Windows with Git Bash installed, the tool is rolling out progressively: set to `1` to opt in or `0` to opt out. On Linux, macOS, and WSL, set to `1` to enable it, which requires `pwsh` on your `PATH`. When enabled on Windows, Claude can run PowerShell commands natively instead of routing through Git Bash. See [PowerShell tool](</docs/en/tools-reference#powershell-tool>) `CLAUDE_CODE_USE_VERTEX`| Use [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>) +`CLAUDE_CODE_WORKFLOW_PREFIX_STAGGER_MS`| Upper bound in milliseconds on how long a [workflow](</docs/en/workflows>) agent waits for a same-prefix sibling’s first response to begin before sending its own first request. When a fan-out starts several agents that share a [prompt-cache prefix](</docs/en/workflows#prompt-caching-in-a-fan-out>), Claude Code holds all but the first agent for up to this long so the rest read the cached prefix instead of each processing it uncached. Default `5000`. Set to `0` to disable the wait. When `DISABLE_PROMPT_CACHING` is set, agents never wait. Requires Claude Code v2.1.229 or later `CLAUDE_CONFIG_DIR`| Override the configuration directory (default: `~/.claude`). All settings, session history, and plugins are stored under this path, as are credentials on Linux and Windows; on macOS, credentials are in the system Keychain. Useful for running multiple accounts side by side: for example, `alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'` `CLAUDE_DISABLE_ADOPT`| Set to `1` to stop in-flight background work instead of carrying it over when you background a session by pressing `←` or with [`/background`](</docs/en/agent-view#from-inside-a-session>). Claude Code asks you to confirm before backgrounding, then stops the tasks that would otherwise carry over. Requires Claude Code v2.1.195 or later `CLAUDE_EFFORT`| Set automatically in Bash tool subprocesses and hook commands to the active [effort level](</docs/en/model-config#adjust-effort-level>) for the turn: `low`, `medium`, `high`, `xhigh`, or `max`. Ultracode is not a distinct level and reports as `xhigh`. Matches the `effort.level` field passed to [hooks](</docs/en/hooks>). Only set when the current model supports the effort parameter @@ -365,7 +366,7 @@ `DISABLE_ERROR_REPORTING`| Set to any non-empty value, such as `1`, to opt out of error reporting. **Setting it to`0` or `false` still opts out**, unlike most on/off variables; unset the variable to turn error reporting back on `DISABLE_EXTRA_USAGE_COMMAND`| Set to `1` to hide the `/usage-credits` command that lets users purchase additional usage beyond rate limits `DISABLE_FEEDBACK_COMMAND`| Set to `1` to disable the `/feedback` command. Also disables `/bug` and `/share`, which report through the same path; before v2.1.212 they were aliases of `/feedback`, so the command was disabled under every name. The older name `DISABLE_BUG_COMMAND` is also accepted -`DISABLE_GROWTHBOOK`| Set to `1` to disable GrowthBook feature-flag fetching and use code defaults for every flag. This makes [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable. Telemetry event logging stays on unless `DISABLE_TELEMETRY` is also set +`DISABLE_GROWTHBOOK`| Set to `1` or `true` to disable GrowthBook feature-flag fetching and use code defaults for every flag. This makes [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable. Setting it to `0` or `false` leaves fetching on. Telemetry event logging stays on unless `DISABLE_TELEMETRY` is also set `DISABLE_INSTALLATION_CHECKS`| Set to `1` to disable installation warnings. Use only when manually managing the installation location, as this can mask issues with standard installations `DISABLE_INSTALL_GITHUB_APP_COMMAND`| Set to `1` to hide the `/install-github-app` command. Already hidden when using third-party providers (Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry) `DISABLE_INTERLEAVED_THINKING`| Set to `1` to prevent sending the interleaved-thinking beta header. Useful when your LLM gateway or provider does not support [interleaved thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking#interleaved-thinking>)
modified
Show diff (117 lines)
--- a/env-vars.md +++ b/env-vars.md @@ -3,6 +3,7 @@ * Set environment variables in your shell or in a settings file * Check which value applies when a behavior can be set more than one way * Look up the variables Claude Code reads + * See which features stop working when a variable turns feature-flag fetching off ## @@ -210,7 +211,7 @@ `CLAUDE_CODE_DISABLE_BG_EXIT_HANDOFF`| Set to `1` to stop a [background session’s](</docs/en/agent-view>) running background shell commands, dynamic workflows, and, as of v2.1.198, background subagents when the [supervisor](</docs/en/agent-view#the-supervisor-process>) stops, restarts, or updates that session’s process, instead of handing them to the session’s next process. Affects only that handoff: backgrounding a session with `←` or [`/background`](</docs/en/agent-view#from-inside-a-session>) still carries in-flight work over, and `CLAUDE_DISABLE_ADOPT` turns off both. Requires Claude Code v2.1.196 or later `CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP`| Set to `1` to stop Claude Code from terminating [background shell commands](</docs/en/interactive-mode#background-bash-commands>) when the operating system reports memory pressure. By default, on macOS and Linux, Claude Code terminates a background shell started in the main session on a memory-pressure signal once the session has been idle for 30 minutes and no turn or subagent is running. Windows has no memory-pressure signal, so this variable has no effect there. Requires Claude Code v2.1.193 or later `CLAUDE_CODE_DISABLE_BUNDLED_SKILLS`| Set to `1` to disable the [skills](</docs/en/skills>) and workflows included with Claude Code: bundled skills and workflows are removed entirely, while built-in commands like `/init` stay typable but are hidden from the model. `/doctor` stays typable like the built-in commands; hide it with `DISABLE_DOCTOR_COMMAND` instead. Skills from plugins, `.claude/skills/`, and `.claude/commands/` are unaffected. Equivalent to the [`disableBundledSkills`](</docs/en/settings#available-settings>) setting -`CLAUDE_CODE_DISABLE_CLAUDE_MDS`| Set to `1` to prevent loading any CLAUDE.md memory files into context, including user, project, and auto-memory files +`CLAUDE_CODE_DISABLE_CLAUDE_MDS`| Set to `1` to prevent loading any CLAUDE.md memory files into context, including user, project, and auto memory files `CLAUDE_CODE_DISABLE_CRON`| Set to `1` to disable [scheduled tasks](</docs/en/scheduled-tasks>). The `/loop` skill and cron tools become unavailable and any already-scheduled tasks stop firing, including tasks that are already running mid-session `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`| Set to `1` to strip Anthropic-specific `anthropic-beta` request headers and beta tool-schema fields (such as `defer_loading` and `eager_input_streaming`) from API requests. Use this when a proxy gateway rejects requests with errors like “Unexpected value(s) for the `anthropic-beta` header” or “Extra inputs are not permitted”. Standard fields (`name`, `description`, `input_schema`, `cache_control`) are preserved. [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) is disabled and all MCP tools load upfront, even when you set `ENABLE_TOOL_SEARCH`. On Claude Code v2.1.227 or later, [managed settings](</docs/en/settings#settings-files>) can keep tool search on. [Disable pre-release capabilities](</docs/en/llm-gateway-protocol#disable-pre-release-capabilities>) covers where the override applies `CLAUDE_CODE_DISABLE_EXPLORE_PLAN_AGENTS`| Set to `1` to disable the built-in [Explore and Plan subagents](</docs/en/sub-agents#built-in-subagents>). Claude explores with its search tools or the general-purpose subagent instead, and [plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>) reads files directly rather than launching Explore and Plan agents. Custom subagents named `Explore` or `Plan` are unaffected. To remove every built-in subagent type in the Agent SDK or non-interactive mode, use `CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS` instead. Requires Claude Code v2.1.198 or later @@ -221,7 +222,7 @@ `CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP`| Set to `1` to prevent automatic remapping of Opus 4.0 and 4.1 to the current Opus version on the Anthropic API. Use when you intentionally want to pin an older model. The remap does not run on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry `CLAUDE_CODE_DISABLE_MOUSE`| Set to `1` to disable mouse tracking in [fullscreen rendering](</docs/en/fullscreen>). Keyboard scrolling with `PgUp` and `PgDn` still works. Use this to keep your terminal’s native copy-on-select behavior `CLAUDE_CODE_DISABLE_MOUSE_CLICKS`| Set to `1` to disable click, drag, and hover handling in [fullscreen rendering](</docs/en/fullscreen>) while keeping mouse-wheel scrolling. Use this when you want wheel scroll to work inside Claude Code but don’t want clicks to position the cursor, expand tool output, or open links. `CLAUDE_CODE_DISABLE_MOUSE` takes precedence when both are set. Requires Claude Code v2.1.195 or later -`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`| Set to any non-empty value, such as `1`, to disable nonessential network traffic: auto-updates, telemetry, error reporting, the `/feedback` command, release notes, [gateway model discovery](</docs/en/llm-gateway-connect#add-gateway-models-to-the-model-picker>) refreshes, and availability checks such as the [fast mode](</docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways>) check. **Setting it to`0` or `false` still disables this traffic**, unlike most on/off variables; unset the variable to allow it again. Also disables feature-flag fetching, which makes [Remote Control](</docs/en/remote-control#requirements>) and [cross-session messaging](</docs/en/cross-session-messaging#availability>) unavailable. Official plugin marketplace auto-install isn’t covered; disable it with `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL` +`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`| Set to any non-empty value, such as `1`, to disable nonessential network traffic: auto-updates, telemetry, error reporting, the `/feedback` command, release notes, [gateway model discovery](</docs/en/llm-gateway-connect#add-gateway-models-to-the-model-picker>) refreshes, and availability checks such as the [fast mode](</docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways>) check. **Setting it to`0` or `false` still disables this traffic**, unlike most on/off variables; unset the variable to allow it again. Also disables feature-flag fetching, which makes [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable. Official plugin marketplace auto-install isn’t covered; disable it with `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL` `CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK`| Set to `1` to disable the non-streaming fallback when a streaming request fails mid-stream. Streaming errors propagate to the retry layer instead. Useful when a proxy or gateway causes the fallback to produce duplicate tool execution `CLAUDE_CODE_DISABLE_NOTIFICATION_PRESENCE_CHECK`| Set to `1` to send the `PushNotification` tool’s desktop notification even while you are typing in or focused on the terminal. By default the tool skips both the desktop notification and the [mobile push](</docs/en/remote-control#mobile-push-notifications>) when it detects recent keyboard activity or terminal focus. This variable disables only that local check, so the server can still suppress the mobile push when it detects that you are active. Requires Claude Code v2.1.193 or later `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL`| Set to `1` to disable automatic registration of the official plugin marketplace. Claude Code reads the variable when it is about to register the marketplace, usually during a machine’s first interactive launch. If the variable is set at that point, Claude Code skips the registration permanently. Unsetting the variable later doesn’t undo the skip. Run `claude plugin marketplace add anthropics/claude-plugins-official` to register the marketplace at any time @@ -272,7 +273,8 @@ `CLAUDE_CODE_MCP_ALLOWLIST_ENV`| Set to `1` to spawn stdio MCP servers with only a safe baseline environment plus the server’s configured `env`, instead of inheriting your shell environment `CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS`| Elapsed time in milliseconds before a still-running MCP tool call [moves to a background task](</docs/en/mcp#automatic-backgrounding-of-long-tool-calls>) (default: 120000, or 2 minutes). Set to `0` to turn automatic backgrounding off. Requires Claude Code v2.1.212 or later `CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT`| Idle timeout in milliseconds for MCP tool calls. When a stdio, HTTP, SSE, WebSocket, or [claude.ai connector](</docs/en/mcp#use-mcp-servers-from-claude-ai>) MCP server sends no response and no progress notification for this long, the tool call aborts with an error instead of waiting for the overall `MCP_TOOL_TIMEOUT`. Overrides the per-transport defaults of 300000 (5 minutes) for network servers and 1800000 (30 minutes) for stdio servers. Set to `0` to disable the idle check. Values below 1000 are raised to one second, and the value is capped at the effective `MCP_TOOL_TIMEOUT`. A per-server `timeout` in `.mcp.json` of at least 1000 raises that server’s idle window to at least the `timeout` value. Doesn’t apply to IDE servers or SDK in-process servers. Requires Claude Code v2.1.187 or later. Before v2.1.203, stdio servers were exempt from the idle timeout -`CLAUDE_CODE_MESSAGING_SOCKET`| Set by Claude Code, not by you: in sessions that bind an [inbox socket](</docs/en/cross-session-messaging#the-sessions-inbox-socket>), Claude Code exports that socket’s path to hooks and Bash commands before any hook runs. Other sessions on the machine deliver messages to this path. Each session exports its own socket rather than one inherited from a parent, and messages arriving on it go through the session’s [inbound controls](</docs/en/cross-session-messaging#control-inbound-messages>). Settings `env` blocks can’t set it. Requires Claude Code v2.1.224 or later +`CLAUDE_CODE_MESSAGING_SOCKET`| Set by Claude Code, not by you: in sessions that bind an [inbox socket](</docs/en/cross-session-messaging#the-sessions-inbox-socket>), Claude Code exports that socket’s path to hooks and Bash commands when it binds the socket. In a session that starts with messaging on, Claude Code binds the socket before any hook runs. Other sessions on the machine deliver messages to this path. Each session exports its own socket rather than one inherited from a parent, and messages arriving on it go through the session’s [inbound controls](</docs/en/cross-session-messaging#control-inbound-messages>). Settings `env` blocks can’t set it. Requires Claude Code v2.1.224 or later +`CLAUDE_CODE_MESSAGING_TOKEN`| Set by Claude Code, not by you: in sessions that bind an [inbox socket](</docs/en/cross-session-messaging#the-sessions-inbox-socket>), Claude Code exports this per-session token to hooks and Bash commands alongside `CLAUDE_CODE_MESSAGING_SOCKET`. A script posting to the socket can send `{"type":"auth","token":"<token>"}` as its first line to prove it belongs to the session. The [own-child rules](</docs/en/cross-session-messaging#the-sessions-inbox-socket>) say when Claude Code consults it. Each session exports its own token, never one inherited from a parent session. Settings `env` blocks can’t set it. Requires Claude Code v2.1.228 or later `CLAUDE_CODE_NATIVE_CURSOR`| Set to `1` to show the terminal’s own cursor at the input caret instead of a drawn block. The cursor respects the terminal’s blink, shape, and focus settings `CLAUDE_CODE_NEW_INIT`| Set to `1` to make `/init` run an interactive setup flow. The flow asks which files to generate, including CLAUDE.md, skills, and hooks, before exploring the codebase and writing them. Without this variable, `/init` generates a CLAUDE.md automatically without prompting `CLAUDE_CODE_NO_FLICKER`| Set to `1` to enable [fullscreen rendering](</docs/en/fullscreen>), a research preview that reduces flicker and keeps memory flat in long conversations. Equivalent to the [`tui`](</docs/en/settings#available-settings>) setting; you can also switch with `/tui fullscreen` @@ -304,7 +306,7 @@ `CLAUDE_CODE_RESUME_INTERRUPTED_TURN_MAX_AGE_MS`| Maximum age in milliseconds of the last transcript message for a session that ended mid-turn to continue automatically on resume. When the last message is older than this bound, Claude Code skips both the `CLAUDE_CODE_RESUME_INTERRUPTED_TURN` automatic resume and the injected `CLAUDE_CODE_RESUME_PROMPT` continuation message, and the session starts idle so you continue explicitly. Unset or `0` means no bound; a negative or non-numeric value applies a one-hour bound. Spawn scripts for long-running agents can set this so a restart against an old transcript doesn’t re-run a stale prompt. Claude Code sets a one-hour bound itself when it restarts a crashed [agent view](</docs/en/agent-view>) session that inherited its conversation from an interactive session. Requires Claude Code v2.1.211 or later `CLAUDE_CODE_RESUME_PROMPT`| Override the continuation message injected when resuming a session that ended mid-turn. Defaults to `Continue from where you left off.`. Spawn scripts for long-running agents can set this to a more directive boot message. An empty string uses the default `CLAUDE_CODE_RETRY_WATCHDOG`| Set to `1` for unattended sessions such as eval harnesses, CI jobs, or remote workers. Retries `429` and `529` capacity errors indefinitely instead of failing after `CLAUDE_CODE_MAX_RETRIES` attempts. The watchdog backs off up to 5 minutes between attempts, or until the limit resets when the response carries a rate-limit reset time, so a session that hits a usage limit waits out the remaining window. As of v2.1.199 it also raises the default retry count for other transient errors, such as server errors, timeouts, and dropped connections, to 300, roughly three hours of backoff, and removes the cap of 15 on `CLAUDE_CODE_MAX_RETRIES` if you set that variable explicitly. Requires Claude Code v2.1.186 or later -`CLAUDE_CODE_SAFE_MODE`| Set to `1` to start in safe mode: CLAUDE.md, skills, plugins, hooks, MCP servers, custom commands and agents, output styles, workflows, custom themes, custom keybindings, status line and file-suggestion commands, LSP servers, and auto-memory do not load, for troubleshooting a broken configuration. Managed settings policy still applies, including policy-configured hooks, status line, and file-suggestion commands; managed plugins, managed skills, managed CLAUDE.md, and policy-configured MCP servers do not. Equivalent to passing [`--safe-mode`](</docs/en/cli-reference#cli-flags>). Directly spawned child processes inherit the variable +`CLAUDE_CODE_SAFE_MODE`| Set to `1` to start in safe mode: CLAUDE.md, skills, plugins, hooks, MCP servers, custom commands and agents, output styles, workflows, custom themes, custom keybindings, status line and file-suggestion commands, LSP servers, and auto memory do not load, for troubleshooting a broken configuration. Managed settings policy still applies, including policy-configured hooks, status line, and file-suggestion commands; managed plugins, managed skills, managed CLAUDE.md, and policy-configured MCP servers do not. Equivalent to passing [`--safe-mode`](</docs/en/cli-reference#cli-flags>). Directly spawned child processes inherit the variable `CLAUDE_CODE_SCRIPT_CAPS`| JSON object limiting how many times specific scripts may be invoked per session when `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB` is set. Keys are substrings matched against the command text; values are integer call limits. For example, `{"deploy.sh": 2}` allows `deploy.sh` to be called at most twice. Matching is substring-based so shell-expansion tricks like `./scripts/deploy.sh $(evil)` still count against the cap. Runtime fan-out via `xargs` or `find -exec` is not detected; this is a defense-in-depth control `CLAUDE_CODE_SCROLL_SPEED`| Set the mouse wheel scroll multiplier in [fullscreen rendering](</docs/en/fullscreen#mouse-wheel-scrolling>). Accepts any positive value up to 20, including fractional values below 1 such as `0.5` to slow accelerated trackpad and wheel scrolling in terminals that already amplify wheel events. Set to `3` to match `vim` if your terminal sends one wheel event per notch without amplification. Ignored in the JetBrains IDE terminal, where Claude Code uses its own scroll handling `CLAUDE_CODE_SESSIONEND_HOOKS_TIMEOUT_MS`| Override the time budget in milliseconds for [SessionEnd](</docs/en/hooks#sessionend>) hooks. Applies to session exit, `/clear`, and switching sessions via interactive `/resume`. By default the budget is 1.5 seconds, automatically raised to the highest per-hook `timeout` configured in settings files, up to 60 seconds. Timeouts on plugin-provided hooks do not raise the budget @@ -327,9 +329,9 @@ `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB`| Set to `1` to strip Anthropic and cloud provider credentials from subprocess environments (Bash tool, hooks, MCP stdio servers). The parent Claude process keeps these credentials for API calls, but child processes cannot read them, reducing exposure to prompt injection attacks that attempt to exfiltrate secrets via shell expansion. On Linux, this also runs Bash subprocesses in an isolated PID namespace so they cannot read host process environments via `/proc`; as a side effect, `ps`, `pgrep`, and `kill` cannot see or signal host processes. `claude-code-action` sets this automatically when `allowed_non_write_users` is configured `CLAUDE_CODE_SYNC_PLUGIN_INSTALL`| Set to `1` in non-interactive mode (the `-p` flag) to wait for plugin installation to complete before the first query. Without this, plugins install in the background and may not be available on the first turn. Combine with `CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS` to bound the wait `CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS`| Timeout in milliseconds for synchronous plugin installation. When exceeded, Claude Code proceeds without plugins and logs an error. No default: without this variable, synchronous installation waits until complete -`CLAUDE_CODE_SYNC_SKILLS`| Set to `1` to download your enabled claude.ai skills into `~/.claude/skills/synced/` before the first query and resync every 10 minutes. The `synced` folder name is [reserved for this download](</docs/en/skills#where-skills-live>). Before v2.1.227, the skills downloaded into `~/.claude/skills/` directly. Applies only in non-interactive mode with the `-p` flag. Requires claude.ai authentication. [Claude Code on the web](</docs/en/claude-code-on-the-web>) sessions receive your enabled claude.ai skills automatically; you don’t need to set this there +`CLAUDE_CODE_SYNC_SKILLS`| Set to `1` to download your enabled claude.ai skills into `~/.claude/skills/synced/` and resync every 10 minutes. Before it runs the first query, Claude Code waits up to `CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS` for the list of your skills. The downloads themselves finish in the background, and Claude waits for a skill’s download when it invokes that skill. The `synced` folder name is [reserved for this download](</docs/en/skills#where-skills-live>). Before v2.1.227, the skills downloaded into `~/.claude/skills/` directly. Applies only in non-interactive mode with the `-p` flag. Requires claude.ai authentication. [Claude Code on the web](</docs/en/claude-code-on-the-web>) sessions receive your enabled claude.ai skills automatically; you don’t need to set this there. Claude Code applies [extra rules to the downloaded skills](</docs/en/skills#how-synced-skills-behave>), such as not running their `!` commands on your machine `CLAUDE_CODE_SYNC_SKILLS_INSTALL_TIMEOUT_MS`| Timeout in milliseconds for a mid-session skills resync when `CLAUDE_CODE_SYNC_SKILLS` is set (default: 30000). Bounds the download triggered when the host requests a skill reload during the session. When exceeded, the resync stops and remaining downloads continue in the background -`CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS`| Timeout in milliseconds for the first query to wait on the initial skills sync when `CLAUDE_CODE_SYNC_SKILLS` is set (default: 5000). When exceeded, the query proceeds and remaining skill downloads continue in the background +`CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS`| Timeout in milliseconds for the first query to wait for the initial skill list when `CLAUDE_CODE_SYNC_SKILLS` is set (default: 5000). When exceeded, the first query runs with whichever skills have arrived. The downloads finish in the background either way, and Claude waits for a skill’s download when it invokes that skill `CLAUDE_CODE_SYNTAX_HIGHLIGHT`| Set to `false` to disable syntax highlighting in diff output. Useful when colors interfere with your terminal setup. To also disable highlighting in code blocks and file previews, use the [`syntaxHighlightingDisabled`](</docs/en/settings>) setting `CLAUDE_CODE_TASK_LIST_ID`| Share a task list across sessions. Set the same ID in multiple Claude Code instances to coordinate on a shared task list. See [Task list](</docs/en/interactive-mode#task-list>) `CLAUDE_CODE_TEAM_TEARDOWN_PARK_TIMEOUT_MS`| Override, in milliseconds, how long a non-interactive session waits at exit for its [agent team](</docs/en/agent-teams>) to finish tearing down. Accepts 1000 to 60000; an out-of-range value is ignored and the default of 10000 applies. Requires Claude Code v2.1.206 or later @@ -363,7 +365,7 @@ `DISABLE_ERROR_REPORTING`| Set to any non-empty value, such as `1`, to opt out of error reporting. **Setting it to`0` or `false` still opts out**, unlike most on/off variables; unset the variable to turn error reporting back on `DISABLE_EXTRA_USAGE_COMMAND`| Set to `1` to hide the `/usage-credits` command that lets users purchase additional usage beyond rate limits `DISABLE_FEEDBACK_COMMAND`| Set to `1` to disable the `/feedback` command. Also disables `/bug` and `/share`, which report through the same path; before v2.1.212 they were aliases of `/feedback`, so the command was disabled under every name. The older name `DISABLE_BUG_COMMAND` is also accepted -`DISABLE_GROWTHBOOK`| Set to `1` to disable GrowthBook feature-flag fetching and use code defaults for every flag. This makes [Remote Control](</docs/en/remote-control#requirements>) and [cross-session messaging](</docs/en/cross-session-messaging#availability>) unavailable. Telemetry event logging stays on unless `DISABLE_TELEMETRY` is also set +`DISABLE_GROWTHBOOK`| Set to `1` to disable GrowthBook feature-flag fetching and use code defaults for every flag. This makes [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable. Telemetry event logging stays on unless `DISABLE_TELEMETRY` is also set `DISABLE_INSTALLATION_CHECKS`| Set to `1` to disable installation warnings. Use only when manually managing the installation location, as this can mask issues with standard installations `DISABLE_INSTALL_GITHUB_APP_COMMAND`| Set to `1` to hide the `/install-github-app` command. Already hidden when using third-party providers (Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry) `DISABLE_INTERLEAVED_THINKING`| Set to `1` to prevent sending the interleaved-thinking beta header. Useful when your LLM gateway or provider does not support [interleaved thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking#interleaved-thinking>) @@ -374,10 +376,10 @@ `DISABLE_PROMPT_CACHING_HAIKU`| Set to `1` to disable prompt caching for Haiku models `DISABLE_PROMPT_CACHING_OPUS`| Set to `1` to disable prompt caching for Opus models `DISABLE_PROMPT_CACHING_SONNET`| Set to `1` to disable prompt caching for Sonnet models -`DISABLE_TELEMETRY`| Set to any non-empty value, such as `1`, to opt out of telemetry. **Setting it to`0` or `false` still opts out**, unlike most on/off variables; unset the variable to turn telemetry back on. Telemetry events do not include user data like code, file paths, or bash commands. Also disables feature-flag fetching with the same effect as `DISABLE_GROWTHBOOK`, which makes [Remote Control](</docs/en/remote-control#requirements>) and [cross-session messaging](</docs/en/cross-session-messaging#availability>) unavailable +`DISABLE_TELEMETRY`| Set to any non-empty value, such as `1`, to opt out of telemetry. **Setting it to`0` or `false` still opts out**, unlike most on/off variables; unset the variable to turn telemetry back on. Telemetry events do not include user data like code, file paths, or bash commands. Also disables feature-flag fetching with the same effect as `DISABLE_GROWTHBOOK`, which makes [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable `DISABLE_UPDATES`| Set to `1` to block all updates including manual `claude update` and `claude install`. Stricter than `DISABLE_AUTOUPDATER`. Use when distributing Claude Code through your own channels and users should not self-update `DISABLE_UPGRADE_COMMAND`| Set to `1` to hide the `/upgrade` command -`DO_NOT_TRACK`| Set to `1` to opt out of telemetry, with the same effect as `DISABLE_TELEMETRY`, including making [Remote Control](</docs/en/remote-control#requirements>) and [cross-session messaging](</docs/en/cross-session-messaging#availability>) unavailable. Claude Code reads this variable as a standard boolean, so `0` leaves telemetry on, and honors it as the cross-tool convention recognized by many developer CLIs +`DO_NOT_TRACK`| Set to `1` to opt out of telemetry, with the same effect as `DISABLE_TELEMETRY`, including making [Remote Control](</docs/en/remote-control#requirements>) and the other features that need feature-flag fetching unavailable. Claude Code reads this variable as a standard boolean, so `0` leaves telemetry on, and honors it as the cross-tool convention recognized by many developer CLIs `ENABLE_CLAUDEAI_MCP_SERVERS`| Set to `false` to disable [claude.ai MCP servers](</docs/en/mcp#use-mcp-servers-from-claude-ai>) in Claude Code. Enabled by default for logged-in users. To disable per-project or per-org, set [`disableClaudeAiConnectors`](</docs/en/settings#available-settings>) in settings instead `ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) instead of the default 5 minutes. Intended for API key, [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), [Microsoft Foundry](</docs/en/microsoft-foundry>), and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) users. Subscription users within included usage receive 1-hour TTL automatically. Subscription users drawing on [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>) can set it to keep the 1-hour TTL. 1-hour cache writes are billed at a higher rate `ENABLE_PROMPT_CACHING_1H_BEDROCK`| Deprecated. Use `ENABLE_PROMPT_CACHING_1H` instead @@ -440,6 +442,35 @@ ​ +Features that need feature-flag fetching + +Claude Code turns some features on through feature flags it fetches from Anthropic. `DISABLE_GROWTHBOOK`, `DISABLE_TELEMETRY`, `DO_NOT_TRACK`, and `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` all turn flag fetching off when set to a value that disables them, and each variable’s row says which values do that. A session running with fetching off can’t use: + + * [Remote Control](</docs/en/remote-control#requirements>) + * [Cross-session messaging](</docs/en/cross-session-messaging#availability>) + * [`claude import` and the `/import` command](</docs/en/cli-reference#cli-commands>) + * [The `/schedule` command](</docs/en/routines#troubleshooting>) for creating routines from the CLI + * [The advisor tool](</docs/en/advisor#requirements>) + * [`/loop` self-pacing](</docs/en/scheduled-tasks#let-claude-choose-the-interval>), so a `/loop` prompt with no interval runs on the fixed 10-minute schedule instead + * [The built-in `/loop` maintenance prompt](</docs/en/scheduled-tasks#run-the-built-in-maintenance-prompt>), so `/loop` with no prompt shows the usage message instead + +In such a session you can still type `/code-review` yourself, but [Claude can’t start the review on its own, and a scheduled `/code-review` reaches Claude as plain text](</docs/en/code-review#let-claude-start-the-review>) instead of running the review. + +### + +​ + +First session after an install or upgrade + +A feature in this list can be missing from your first session after you install Claude Code, or after you upgrade to a version that adds the feature, even with none of these variables set. Claude Code fetches the flags during that session, so a feature that’s otherwise available to you is there in your next session. Two features work differently in that first session: + + * Claude Code [binds the session’s inbox socket](</docs/en/cross-session-messaging#the-sessions-inbox-socket>) and exports the messaging variables partway through the session, as soon as the fetch completes, so other sessions can message it before you restart. + * Claude Code checks the `claude import` flag before it starts a session, so if `claude import` is the first thing you run after installing, it prints [`claude import is not yet available in this build`](</docs/en/errors#claude-import-is-not-yet-available-in-this-build>). Start a session, then run it again. + +## + +​ + See also * [Settings](</docs/en/settings>): all `settings.json` configuration, including the `env` key
modified
Show diff (146 lines)
--- a/env-vars.md +++ b/env-vars.md @@ -123,7 +123,7 @@ `ANTHROPIC_BEDROCK_REGION_PREFIX`| Cross-region inference profile prefix (`us`, `eu`, `apac`, `jp`, `au`, or `global`) Claude Code tries first instead of the one derived from the AWS region. Ignored in AWS GovCloud regions. Requires Claude Code v2.1.224 or later. See [Amazon Bedrock](</docs/en/amazon-bedrock#cross-region-inference-profile-prefixes>) `ANTHROPIC_BEDROCK_SERVICE_TIER`| Amazon Bedrock [service tier](<https://docs.aws.amazon.com/bedrock/latest/userguide/service-tiers-inference.html>) (`default`, `flex`, or `priority`). Sent as the `X-Amzn-Bedrock-Service-Tier` header. See [Amazon Bedrock](</docs/en/amazon-bedrock#service-tiers>) `ANTHROPIC_BETAS`| Comma-separated list of additional `anthropic-beta` header values to include in API requests. Claude Code already sends the beta headers it needs; use this to opt into an [Anthropic API beta](<https://platform.claude.com/docs/en/api/beta-headers>) before Claude Code adds native support. Unlike the [`--betas` flag](</docs/en/cli-reference#cli-flags>), which requires API key authentication, this variable works with all auth methods including Claude.ai subscription -`ANTHROPIC_CUSTOM_HEADERS`| Custom headers to add to requests (`Name: Value` format, newline-separated for multiple headers) +`ANTHROPIC_CUSTOM_HEADERS`| Custom headers to add to requests (`Name: Value` format, newline-separated for multiple headers). If a name or value contains a character an HTTP header can’t carry, such as a curly quote or a zero-width space, Claude Code fails the request with an error that identifies the pair by position. Requires Claude Code v2.1.227 or later. [Invalid request header value](</docs/en/errors#invalid-request-header-value>) lists the exact character set and where the check runs `ANTHROPIC_CUSTOM_MODEL_OPTION`| Model ID to add as a custom entry in the `/model` picker. Use this to make a non-standard or gateway-specific model selectable without replacing built-in aliases. See [Model configuration](</docs/en/model-config#add-a-custom-model-option>) `ANTHROPIC_CUSTOM_MODEL_OPTION_DESCRIPTION`| Display description for the custom model entry in the `/model` picker. Defaults to `Custom model (<model-id>)` when not set `ANTHROPIC_CUSTOM_MODEL_OPTION_NAME`| Display name for the custom model entry in the `/model` picker. Defaults to the model ID when not set @@ -144,11 +144,14 @@ `ANTHROPIC_DEFAULT_SONNET_MODEL_DESCRIPTION`| Display description for the pinned Sonnet model in the `/model` picker. When not set, defaults to `Custom Sonnet model`, or `Custom Sonnet model (1M context)` if the pinned model ID has the `[1m]` suffix and `CLAUDE_CODE_DISABLE_1M_CONTEXT` isn’t turned on. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) `ANTHROPIC_DEFAULT_SONNET_MODEL_NAME`| Display name for the pinned Sonnet model in the `/model` picker. Defaults to the model ID when not set. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) `ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES`| Comma-separated list of [capabilities](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) the pinned Sonnet model supports, for example `effort,thinking`. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) +`ANTHROPIC_FEDERATION_RULE_ID`| Federation rule ID for [Workload Identity Federation](<https://platform.claude.com/docs/en/manage-claude/workload-identity-federation>). When you set it together with `ANTHROPIC_ORGANIZATION_ID`, Claude Code selects federation credentials, which rank above your `/login` credential. See [authentication precedence](</docs/en/authentication#authentication-precedence>) `ANTHROPIC_FOUNDRY_API_KEY`| API key for Microsoft Foundry authentication (see [Microsoft Foundry](</docs/en/microsoft-foundry>)) `ANTHROPIC_FOUNDRY_AUTH_TOKEN`| Bearer token for Microsoft Foundry authentication, such as a Microsoft Entra access token. Claude Code sends it as the `Authorization: Bearer` header. Takes precedence over `ANTHROPIC_FOUNDRY_API_KEY` and over the Azure default credential chain. See [Microsoft Foundry](</docs/en/microsoft-foundry>). Requires Claude Code v2.1.203 or later `ANTHROPIC_FOUNDRY_BASE_URL`| Full base URL for the Microsoft Foundry resource (for example, `https://my-resource.services.ai.azure.com/anthropic`). Alternative to `ANTHROPIC_FOUNDRY_RESOURCE` (see [Microsoft Foundry](</docs/en/microsoft-foundry>)) `ANTHROPIC_FOUNDRY_RESOURCE`| Microsoft Foundry resource name (for example, `my-resource`). Required if `ANTHROPIC_FOUNDRY_BASE_URL` is not set (see [Microsoft Foundry](</docs/en/microsoft-foundry>)) `ANTHROPIC_MODEL`| Name of the model setting to use (see [Model Configuration](</docs/en/model-config#environment-variables>)) +`ANTHROPIC_ORGANIZATION_ID`| Organization ID for [Workload Identity Federation](<https://platform.claude.com/docs/en/manage-claude/workload-identity-federation>). Set it together with `ANTHROPIC_FEDERATION_RULE_ID`. See [authentication precedence](</docs/en/authentication#authentication-precedence>) +`ANTHROPIC_PROFILE`| Name of the Anthropic profile to authenticate with, such as one created by [`ant auth login`](<https://platform.claude.com/docs/en/cli-sdks-libraries/cli/authentication>). The named profile ranks above your `/login` credential. See [authentication precedence](</docs/en/authentication#authentication-precedence>) `ANTHROPIC_SMALL_FAST_MODEL`| [DEPRECATED] Name of [Haiku-class model for background tasks](</docs/en/costs>) `ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION`| Override AWS region for the Haiku-class model when using Amazon Bedrock or Amazon Bedrock Mantle. On Amazon Bedrock, this only takes effect when `ANTHROPIC_DEFAULT_HAIKU_MODEL` or the deprecated `ANTHROPIC_SMALL_FAST_MODEL` is also set, since Amazon Bedrock otherwise runs background tasks on the [default Sonnet model or the primary model](</docs/en/amazon-bedrock#4-pin-model-versions>) in the session region `ANTHROPIC_VERTEX_BASE_URL`| Override Google Cloud’s Agent Platform endpoint URL. Use for custom Google Cloud’s Agent Platform endpoints or when routing through an [LLM gateway](</docs/en/llm-gateway>). See [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>) @@ -167,9 +170,10 @@ `CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS`| Set to `1` to disable all built-in [subagent](</docs/en/sub-agents>) types such as Explore and Plan. Only applies in non-interactive mode (the `-p` flag). Useful for SDK users who want a blank slate `CLAUDE_AGENT_SDK_MCP_NO_PREFIX`| Set to `1` to skip the `mcp__<server>__` prefix on tool names from SDK-created MCP servers. Tools use their original names. SDK usage only `CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS`| Stall timeout in milliseconds for background subagents. Default `600000` (10 minutes). The timer resets on each streaming progress event; if no progress arrives within the window, the subagent is aborted and the task is marked failed, surfacing any partial result to the parent -`CLAUDE_AUTOCOMPACT_PCT_OVERRIDE`| Set the percentage (1-100) of the auto-compact window at which auto-compaction triggers. Use lower values like `50` to compact earlier; the variable can’t raise the threshold, so values above the default percentage are ignored. It applies only in sessions that [compact before the model’s context limit](</docs/en/context-window#set-the-auto-compact-window>). Applies to both main conversations and subagents +`CLAUDE_AUTOCOMPACT_PCT_OVERRIDE`| Set the percentage (1-100) of the auto-compact window at which auto-compaction triggers. Use lower values like `50` to compact earlier; the variable can’t raise the threshold, so values above the default percentage are ignored. It applies only in sessions that [compact before the model’s context limit](</docs/en/model-config#context-window-and-auto-compaction>). Applies to both main conversations and subagents `CLAUDE_AUTO_BACKGROUND_TASKS`| Set to `1` to force-enable automatic backgrounding of long-running agent tasks. When enabled, subagents are moved to the background after running for approximately two minutes. Also enables [automatic backgrounding of long MCP tool calls](</docs/en/mcp#automatic-backgrounding-of-long-tool-calls>) in non-interactive mode on Claude Code v2.1.212 or later `CLAUDE_AX_SCREEN_READER`| Set to `1` to render screen-reader friendly output: flat text without decorative borders or animations. Set to `0` to force screen-reader mode off even when [`axScreenReader`](</docs/en/settings#available-settings>) is `true`. The [`--ax-screen-reader`](</docs/en/cli-reference#cli-flags>) flag takes precedence. Requires Claude Code v2.1.181 or later +`CLAUDE_AX_STARTUP_QUIET_MS`| In [screen reader mode](</docs/en/accessibility>), how many milliseconds Claude Code holds the first interface render after the startup confirmation line, so your screen reader can speak the line in full before new output interrupts it. Default `3000`. Set `0` to render immediately. Claude Code caps the hold at `600000` (10 minutes). Your first keystroke ends the hold early. Requires Claude Code v2.1.217 or later `CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR`| Return to the original working directory after each Bash or PowerShell command in the main session `CLAUDE_BYTE_STREAM_IDLE_TIMEOUT_MS`| Timeout in milliseconds for the byte-level streaming idle watchdog only; when set, it takes precedence over `CLAUDE_STREAM_IDLE_TIMEOUT_MS` for that watchdog and leaves the event-level watchdog unchanged. Claude Code clamps this variable to between 10 seconds and 30 minutes. Requires Claude Code v2.1.210 or later `CLAUDE_CLIENT_PRESENCE_FILE`| Path to a file that an external tool, such as a screen-lock listener, creates when you unlock your screen and deletes when you lock it. While the file exists, Claude Code skips [Remote Control mobile push notifications](</docs/en/remote-control#mobile-push-notifications>), so you stop getting pushes while you are actively using the computer. When the file is absent or unreadable, notifications are sent as normal. Claude Code checks the file once per push-triggering event rather than polling it. Requires Claude Code v2.1.181 or later @@ -180,7 +184,7 @@ `CLAUDE_CODE_API_KEY_HELPER_TTL_MS`| Interval in milliseconds at which credentials should be refreshed (when using [`apiKeyHelper`](</docs/en/settings#available-settings>)) `CLAUDE_CODE_ARTIFACT_AUTO_OPEN`| Set to `0` to stop Claude Code from opening the browser automatically when a new [artifact](</docs/en/artifacts>) is published. Republishing an existing artifact does not open the browser regardless of this setting `CLAUDE_CODE_ATTRIBUTION_HEADER`| Set to `0` to omit the [attribution block](</docs/en/llm-gateway-protocol#system-prompt-attribution-block>), which carries the client version and a prompt fingerprint, from the start of the system prompt. Caching on a direct connection to the Anthropic API is unaffected either way. Before v2.1.181 the block included a per-request token on custom base URLs and Microsoft Foundry connections, so on those versions set it to `0` when your [LLM gateway](</docs/en/llm-gateway>) caches on the request body or forwards requests to a third-party provider, or when you connect to Microsoft Foundry directly -`CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the [auto-compact window](</docs/en/context-window#set-the-auto-compact-window>) in tokens, from `100000` to `1000000`. Accepts a plain integer such as `500000` only: a value like `500k` reads as `500` and clamps to the 100K minimum. Takes precedence over the `/autocompact` command, the `--autocompact` flag, and the `autoCompactWindow` setting. The status line’s `used_percentage` always measures against the model’s full context window, so once this variable is set, that percentage no longer indicates when compaction will run +`CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the [auto-compact window](</docs/en/model-config#set-the-auto-compact-window>) in tokens, from `100000` to `1000000`. Accepts a plain integer such as `500000` only: a value like `500k` reads as `500` and clamps to the 100K minimum. Takes precedence over the `/autocompact` command, the `--autocompact` flag, and the `autoCompactWindow` setting. The status line’s `used_percentage` always measures against the model’s full context window, so once this variable is set, that percentage no longer indicates when compaction will run `CLAUDE_CODE_AUTO_CONNECT_IDE`| Override automatic [IDE connection](</docs/en/vs-code>). By default, Claude Code connects automatically when launched inside a supported IDE’s integrated terminal. Set to `false` to prevent this. Set to `true` to force a connection attempt when auto-detection fails, such as when tmux obscures the parent terminal. Takes precedence over the [`autoConnectIde`](</docs/en/settings#global-config-settings>) global config setting `CLAUDE_CODE_AWS_CHAIN_RESOLVE_TIMEOUT_MS`| Time in milliseconds Claude Code waits for the AWS default credential provider chain to produce credentials before the request fails with [`AWS default-chain credential resolve timed out`](</docs/en/errors#aws-default-chain-credential-resolve-timed-out>) (default: `60000`). Raise it when a step in your chain legitimately needs longer, such as a browser-based SSO sign-in with MFA through a wrapper like `aws-vault`. Applies wherever Claude Code signs with the default chain: [Amazon Bedrock](</docs/en/amazon-bedrock#credential-caching-and-resolution-timeout>), [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), and the [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>). Requires Claude Code v2.1.207 or later `CLAUDE_CODE_BRIDGE_SESSION_ID`| Set automatically in Bash tool and [hook command](</docs/en/hooks>) subprocesses while the session has an active [Remote Control](</docs/en/remote-control>) connection, and removed when the connection ends. The value is the session’s ID in `session_` form, the same identifier that appears in the session’s `claude.ai/code` URL, so a script can link back to the session that ran it. Requires Claude Code v2.1.199 or later. In [cloud sessions](</docs/en/claude-code-on-the-web>), read `CLAUDE_CODE_REMOTE_SESSION_ID` instead @@ -192,7 +196,7 @@ `CLAUDE_CODE_CONNECT_TIMEOUT_MS`| Removed in v2.1.186 and now a no-op. Previously set a separate timeout for the connect, TLS, and response-header phase of a streaming API request. Use `API_TIMEOUT_MS` for the per-request timeout `CLAUDE_CODE_DEBUG_LOGS_DIR`| Override the debug log file path. Despite the name, this is a file path, not a directory. Requires debug mode to be enabled separately via `--debug`, `/debug`, or the `DEBUG` environment variable: setting this variable alone does not enable logging. The [`--debug-file`](</docs/en/cli-reference#cli-flags>) flag does both at once. Defaults to `~/.claude/debug/<session-id>.txt` `CLAUDE_CODE_DEBUG_LOG_LEVEL`| Minimum log level written to the debug log file. Values: `verbose`, `debug` (default), `info`, `warn`, `error`. Set to `verbose` to include high-volume diagnostics like full status line command output, or raise to `error` to reduce noise -`CLAUDE_CODE_DISABLE_1M_CONTEXT`| Set to `1` to disable [1M context window](</docs/en/model-config#extended-context>) support. When set, 1M model variants are unavailable in the model picker, and [Sonnet 5](</docs/en/model-config#sonnet-5-context-window>) sessions are treated as having a 200K window. Useful for enterprise environments with compliance requirements +`CLAUDE_CODE_DISABLE_1M_CONTEXT`| Set to `1` to disable [1M context window](</docs/en/model-config#extended-context>) support. When set, 1M model variants are unavailable in the model picker, and Claude Code holds sessions on models with a native 1M window, such as [Sonnet 5](</docs/en/model-config#sonnet-5-context-window>) and Fable 5, to a 200K window; see [Extended context](</docs/en/model-config#extended-context>) for how the hold is enforced. Useful for enterprise environments with compliance requirements. For its role in correcting the window for an unrecognized `[1m]` model ID, see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>) `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING`| Set to `1` to disable [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) on Opus 4.6 and Sonnet 4.6 and fall back to the fixed thinking budget controlled by `MAX_THINKING_TOKENS`. Has no effect on Fable 5, Sonnet 5, or Opus 4.7 and later, which always use adaptive reasoning `CLAUDE_CODE_DISABLE_ADMIN_ENV_UNION`| Set to `1` to stop Claude Code from merging [managed settings](</docs/en/settings#settings-precedence>) `env` blocks per key across admin sources, so only the highest-priority source’s whole `env` block applies, as before v2.1.223. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.223 or later `CLAUDE_CODE_DISABLE_ADVISOR_TOOL`| Set to `1` to disable the [advisor tool](</docs/en/advisor>). The `/advisor` command becomes unavailable, any configured `advisorModel` is ignored, and the `--advisor` flag is accepted but has no effect, so existing scripts that pass it continue to work without errors @@ -208,7 +212,7 @@ `CLAUDE_CODE_DISABLE_BUNDLED_SKILLS`| Set to `1` to disable the [skills](</docs/en/skills>) and workflows included with Claude Code: bundled skills and workflows are removed entirely, while built-in commands like `/init` stay typable but are hidden from the model. `/doctor` stays typable like the built-in commands; hide it with `DISABLE_DOCTOR_COMMAND` instead. Skills from plugins, `.claude/skills/`, and `.claude/commands/` are unaffected. Equivalent to the [`disableBundledSkills`](</docs/en/settings#available-settings>) setting `CLAUDE_CODE_DISABLE_CLAUDE_MDS`| Set to `1` to prevent loading any CLAUDE.md memory files into context, including user, project, and auto-memory files `CLAUDE_CODE_DISABLE_CRON`| Set to `1` to disable [scheduled tasks](</docs/en/scheduled-tasks>). The `/loop` skill and cron tools become unavailable and any already-scheduled tasks stop firing, including tasks that are already running mid-session -`CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`| Set to `1` to strip Anthropic-specific `anthropic-beta` request headers and beta tool-schema fields (such as `defer_loading` and `eager_input_streaming`) from API requests. Use this when a proxy gateway rejects requests with errors like “Unexpected value(s) for the `anthropic-beta` header” or “Extra inputs are not permitted”. Standard fields (`name`, `description`, `input_schema`, `cache_control`) are preserved. [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) is disabled and all MCP tools load upfront, even when `ENABLE_TOOL_SEARCH` is set +`CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`| Set to `1` to strip Anthropic-specific `anthropic-beta` request headers and beta tool-schema fields (such as `defer_loading` and `eager_input_streaming`) from API requests. Use this when a proxy gateway rejects requests with errors like “Unexpected value(s) for the `anthropic-beta` header” or “Extra inputs are not permitted”. Standard fields (`name`, `description`, `input_schema`, `cache_control`) are preserved. [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) is disabled and all MCP tools load upfront, even when you set `ENABLE_TOOL_SEARCH`. On Claude Code v2.1.227 or later, [managed settings](</docs/en/settings#settings-files>) can keep tool search on. [Disable pre-release capabilities](</docs/en/llm-gateway-protocol#disable-pre-release-capabilities>) covers where the override applies `CLAUDE_CODE_DISABLE_EXPLORE_PLAN_AGENTS`| Set to `1` to disable the built-in [Explore and Plan subagents](</docs/en/sub-agents#built-in-subagents>). Claude explores with its search tools or the general-purpose subagent instead, and [plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>) reads files directly rather than launching Explore and Plan agents. Custom subagents named `Explore` or `Plan` are unaffected. To remove every built-in subagent type in the Agent SDK or non-interactive mode, use `CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS` instead. Requires Claude Code v2.1.198 or later `CLAUDE_CODE_DISABLE_FAST_MODE`| Set to `1` to disable [fast mode](</docs/en/fast-mode>) `CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY`| Set to `1` to disable the “How is Claude doing?” session quality surveys. Surveys are also disabled when `DISABLE_TELEMETRY`, `DO_NOT_TRACK`, or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` is set, unless `CLAUDE_CODE_ENABLE_FEEDBACK_SURVEY_FOR_OTEL` opts back in. To set a sample rate instead of disabling outright, use the [`feedbackSurveyRate`](</docs/en/settings#available-settings>) setting. See [Session quality surveys](</docs/en/data-usage#session-quality-surveys>) @@ -224,6 +228,7 @@ `CLAUDE_CODE_DISABLE_POLICY_SKILLS`| Set to `1` to skip loading skills from the system-wide managed skills directory. Useful for container or CI sessions that should not load operator-provisioned skills `CLAUDE_CODE_DISABLE_TERMINAL_TITLE`| Set to `1` to disable automatic terminal title updates based on conversation context. In Agent SDK and `claude -p` sessions, this also skips the background small/fast-model request that generates the session title `CLAUDE_CODE_DISABLE_THINKING`| Set to `1` to omit the `thinking` parameter from API requests entirely. This is a compatibility option for proxies and gateways that reject the parameter. The variable’s behavior is unchanged from earlier versions; on models that think by default, omitting the parameter means the model may still think. To explicitly disable [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) on the Anthropic API, use `MAX_THINKING_TOKENS=0` instead, which is also ineffective on Fable 5 since it cannot have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `0` likewise omits the parameter, so the two variables behave the same there +`CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT`| Set to `1` to skip proactive [auto-compaction](</docs/en/costs#reduce-token-usage>) when Claude Code doesn’t recognize the model ID, such as an [LLM gateway](</docs/en/llm-gateway>) alias. Without this variable, Claude Code compacts at the context window it assumes for the ID. `CLAUDE_CODE_MAX_CONTEXT_TOKENS` can correct the assumed window instead; see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>) for when each variable applies. Requires Claude Code v2.1.223 or later `CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL`| Set to `1` to disable virtual scrolling in [fullscreen rendering](</docs/en/fullscreen>) and render every message in the transcript. Use this if scrolling in fullscreen mode shows blank regions where messages should appear `CLAUDE_CODE_DISABLE_WORKFLOWS`| Set to `1` to disable [workflows](</docs/en/workflows#turn-workflows-off>). Equivalent to the [`disableWorkflows`](</docs/en/settings#available-settings>) setting `CLAUDE_CODE_EFFORT_LEVEL`| Set the effort level for supported models. Values: `low`, `medium`, `high`, `xhigh`, `max`, or `auto` to use the model default. Available levels depend on the model. Takes precedence over `/effort` and the `effortLevel` setting. See [Adjust effort level](</docs/en/model-config#adjust-effort-level>) @@ -256,7 +261,7 @@ `CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL`| Set to `1` to skip auto-installation of IDE extensions. Equivalent to setting [`autoInstallIdeExtension`](</docs/en/settings#global-config-settings>) to `false` `CLAUDE_CODE_IDE_SKIP_VALID_CHECK`| Set to `1` to skip validation of IDE lockfile entries during connection. Use when auto-connect fails to find your IDE despite it running `CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS`| How many [subagents](</docs/en/sub-agents#concurrent-subagent-limit>) can be running in one session before the Agent tool refuses to spawn another (default: 20). Accepts a positive whole number in plain digits; anything else is ignored, so the variable can adjust the cap but can’t disable it. Requires Claude Code v2.1.217 or later -`CLAUDE_CODE_MAX_CONTEXT_TOKENS`| Override the context window size Claude Code assumes for the active model. As of v2.1.193, applied directly for model names Claude Code does not recognize as a Claude model; for recognized Claude models it only takes effect when `DISABLE_COMPACT` is also set. Use this when routing to a model through `ANTHROPIC_BASE_URL` whose context window does not match the built-in size for its name +`CLAUDE_CODE_MAX_CONTEXT_TOKENS`| Override the context window size Claude Code assumes for the active model. As of v2.1.193, how it applies depends on how Claude Code resolves the model ID; see [Correct the window for a gateway or custom model ID](</docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id>). Use this when routing to a model through `ANTHROPIC_BASE_URL` whose context window does not match the built-in size for its name `CLAUDE_CODE_MAX_OUTPUT_TOKENS`| Set the maximum number of output tokens for most requests. Defaults and caps vary by model; see [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>). Claude Code defaults to 32000 for model IDs it doesn’t recognize, such as gateway-specific names, and lowers values above a model’s cap to the cap. Increasing this value reduces the effective context window available before [auto-compaction](</docs/en/costs#reduce-token-usage>) triggers `CLAUDE_CODE_MAX_RETRIES`| Override the number of times to retry failed API requests (default: 10). Capped at 15 as of v2.1.186; as of v2.1.199, `CLAUDE_CODE_RETRY_WATCHDOG` raises the default and removes the cap. For unattended sessions that need to wait through longer outages, set `CLAUDE_CODE_RETRY_WATCHDOG` instead `CLAUDE_CODE_MAX_SUBAGENTS_PER_SESSION`| Removed in v2.1.224 and now a no-op. Previously capped the total number of [subagents](</docs/en/sub-agents>) Claude could spawn with the Agent tool in one session (default: 200); spawning past the cap failed with `Subagent spawn limit reached`. The [concurrent subagent limit](</docs/en/sub-agents#concurrent-subagent-limit>) and the [depth limit](</docs/en/sub-agents#let-subagents-spawn-their-own-subagents>) still apply @@ -273,7 +278,7 @@ `CLAUDE_CODE_NO_FLICKER`| Set to `1` to enable [fullscreen rendering](</docs/en/fullscreen>), a research preview that reduces flicker and keeps memory flat in long conversations. Equivalent to the [`tui`](</docs/en/settings#available-settings>) setting; you can also switch with `/tui fullscreen` `CLAUDE_CODE_OAUTH_REFRESH_TOKEN`| OAuth refresh token for Claude.ai authentication. When set, `claude auth login` exchanges this token directly instead of opening a browser. Requires `CLAUDE_CODE_OAUTH_SCOPES`. Useful for provisioning authentication in automated environments `CLAUDE_CODE_OAUTH_SCOPES`| Space-separated OAuth scopes the refresh token was issued with, such as `"user:profile user:inference user:sessions:claude_code"`. Required when `CLAUDE_CODE_OAUTH_REFRESH_TOKEN` is set -`CLAUDE_CODE_OAUTH_TOKEN`| OAuth access token for Claude.ai authentication. Alternative to `/login` for SDK and automated environments. Takes precedence over keychain-stored credentials. Generate one with [`claude setup-token`](</docs/en/authentication#generate-a-long-lived-token>) +`CLAUDE_CODE_OAUTH_TOKEN`| OAuth access token for Claude.ai authentication. Alternative to `/login` for SDK and automated environments. Takes precedence over keychain-stored credentials. Generate one with [`claude setup-token`](</docs/en/authentication#generate-a-long-lived-token>). Claude Code uses the token you set for the whole session. To replace an expired token, generate a new one and restart `CLAUDE_CODE_OPUS_4_6_FAST_MODE_OVERRIDE`| Removed in v2.1.160 and now a no-op. Previously pinned [fast mode](</docs/en/fast-mode>) to Claude Opus 4.6 instead of the current default. Opus 4.6 no longer supports fast mode `CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH`| Maximum length of content-bearing OpenTelemetry attributes (model responses, tool content, system prompts, raw API bodies), truncation marker included, in UTF-16 code units (default: 61440, i.e. 60 KB). Raise it only if your telemetry backend accepts attribute values larger than 64 KB, or lower it to cut telemetry volume. Requires Claude Code v2.1.214 or later. See [Monitoring](</docs/en/monitoring-usage>) `CLAUDE_CODE_OTEL_DIAG_STDERR`| Set to `1` to write OpenTelemetry exporter diagnostic errors to stderr. By default these errors only appear with `--debug`, so a misconfigured exporter such as a Prometheus port collision otherwise fails silently. Requires Claude Code v2.1.179 or later. See [Monitoring](</docs/en/monitoring-usage>) @@ -322,7 +327,7 @@ `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB`| Set to `1` to strip Anthropic and cloud provider credentials from subprocess environments (Bash tool, hooks, MCP stdio servers). The parent Claude process keeps these credentials for API calls, but child processes cannot read them, reducing exposure to prompt injection attacks that attempt to exfiltrate secrets via shell expansion. On Linux, this also runs Bash subprocesses in an isolated PID namespace so they cannot read host process environments via `/proc`; as a side effect, `ps`, `pgrep`, and `kill` cannot see or signal host processes. `claude-code-action` sets this automatically when `allowed_non_write_users` is configured `CLAUDE_CODE_SYNC_PLUGIN_INSTALL`| Set to `1` in non-interactive mode (the `-p` flag) to wait for plugin installation to complete before the first query. Without this, plugins install in the background and may not be available on the first turn. Combine with `CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS` to bound the wait `CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS`| Timeout in milliseconds for synchronous plugin installation. When exceeded, Claude Code proceeds without plugins and logs an error. No default: without this variable, synchronous installation waits until complete -`CLAUDE_CODE_SYNC_SKILLS`| Set to `1` to download your enabled claude.ai skills into `~/.claude/skills/` before the first query and resync every 10 minutes. Applies only in non-interactive mode with the `-p` flag. Requires claude.ai authentication. [Claude Code on the web](</docs/en/claude-code-on-the-web>) sessions receive your enabled claude.ai skills automatically; you don’t need to set this there +`CLAUDE_CODE_SYNC_SKILLS`| Set to `1` to download your enabled claude.ai skills into `~/.claude/skills/synced/` before the first query and resync every 10 minutes. The `synced` folder name is [reserved for this download](</docs/en/skills#where-skills-live>). Before v2.1.227, the skills downloaded into `~/.claude/skills/` directly. Applies only in non-interactive mode with the `-p` flag. Requires claude.ai authentication. [Claude Code on the web](</docs/en/claude-code-on-the-web>) sessions receive your enabled claude.ai skills automatically; you don’t need to set this there `CLAUDE_CODE_SYNC_SKILLS_INSTALL_TIMEOUT_MS`| Timeout in milliseconds for a mid-session skills resync when `CLAUDE_CODE_SYNC_SKILLS` is set (default: 30000). Bounds the download triggered when the host requests a skill reload during the session. When exceeded, the resync stops and remaining downloads continue in the background `CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS`| Timeout in milliseconds for the first query to wait on the initial skills sync when `CLAUDE_CODE_SYNC_SKILLS` is set (default: 5000). When exceeded, the query proceeds and remaining skill downloads continue in the background `CLAUDE_CODE_SYNTAX_HIGHLIGHT`| Set to `false` to disable syntax highlighting in diff output. Useful when colors interfere with your terminal setup. To also disable highlighting in code blocks and file previews, use the [`syntaxHighlightingDisabled`](</docs/en/settings>) setting @@ -330,7 +335,7 @@ `CLAUDE_CODE_TEAM_TEARDOWN_PARK_TIMEOUT_MS`| Override, in milliseconds, how long a non-interactive session waits at exit for its [agent team](</docs/en/agent-teams>) to finish tearing down. Accepts 1000 to 60000; an out-of-range value is ignored and the default of 10000 applies. Requires Claude Code v2.1.206 or later `CLAUDE_CODE_TMPDIR`| Override the temp directory used for internal temp files. Claude Code appends `/claude-{uid}/` on Unix or `/claude/` on Windows to this path. Default: `/tmp` on macOS, `os.tmpdir()` on Linux and Windows. As of v2.1.161, on macOS and Linux, [sandboxed](</docs/en/sandboxing>) Bash subprocesses receive a short fallback `$TMPDIR` under the system default when your override is a long path, since some tools fail when temp paths get too long. Unsandboxed Bash commands inherit your shell’s `$TMPDIR` unchanged. Claude Code’s own temp files always use your override `CLAUDE_CODE_TMUX_TRUECOLOR`| Set to any non-empty value, such as `1`, to allow 24-bit truecolor output inside tmux. **Setting it to`0` or `false` still allows truecolor**, unlike most on/off variables; unset the variable to restore the 256-color clamp. By default, Claude Code clamps to 256 colors when `$TMUX` is set because tmux does not pass through truecolor escape sequences unless configured to. Set this after adding `set -ga terminal-overrides ',*:Tc'` to your `~/.tmux.conf`. See [Terminal configuration](</docs/en/terminal-config>) for other tmux settings -`CLAUDE_CODE_USER_DIALOG_TIMEOUT_MS`| Deadline in milliseconds for dialogs Claude Code forwards to a remote client, such as a [Remote Control](</docs/en/remote-control>) or SDK host, and for a [held cross-session message](</docs/en/cross-session-messaging#control-inbound-messages>) awaiting approval, before Claude Code cancels the dialog or drops the default-held message; permission prompts and `AskUserQuestion` questions use their own flows and aren’t governed by it. Overrides the [`dialogExpiry`](</docs/en/settings#available-settings>) setting; `0` or a negative value disables the deadline +`CLAUDE_CODE_USER_DIALOG_TIMEOUT_MS`| Deadline in milliseconds for dialogs Claude Code forwards to a remote client, such as a [Remote Control](</docs/en/remote-control>) or SDK host, and for the approval dialog for a [held cross-session message](</docs/en/cross-session-messaging#control-inbound-messages>), before Claude Code cancels them; permission prompts and `AskUserQuestion` questions use their own flows and aren’t governed by it. [Control inbound messages](</docs/en/cross-session-messaging#control-inbound-messages>) and [non-interactive sessions](</docs/en/cross-session-messaging#non-interactive-sessions>) cover the full held-message expiry rules, including the cases where the deadline doesn’t apply. Overrides the [`dialogExpiry`](</docs/en/settings#available-settings>) setting; `0` or a negative value disables the deadline `CLAUDE_CODE_USE_ANTHROPIC_AWS`| Use [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) `CLAUDE_CODE_USE_BEDROCK`| Use [Amazon Bedrock](</docs/en/amazon-bedrock>) `CLAUDE_CODE_USE_FOUNDRY`| Use [Microsoft Foundry](</docs/en/microsoft-foundry>) @@ -348,7 +353,7 @@ `CLAUDE_PID`| Claude Code sets this to its own process ID in the subprocesses it spawns: Bash and PowerShell tool commands and hook commands. On Linux, the Bash tool’s shell integration uses it to refuse a `pkill` pattern that would match the Claude Code process itself; see [the error reference](</docs/en/errors#pkill-pattern-matches-the-claude-code-process>). Read it from your own scripts to identify or signal the parent Claude Code process deliberately. Requires Claude Code v2.1.214 or later `CLAUDE_REMOTE_CONTROL_SESSION_NAME_PREFIX`| Prefix for auto-generated [Remote Control](</docs/en/remote-control>) session names when no explicit name is provided. Defaults to your machine’s hostname, producing names like `myhost-graceful-unicorn`. The `--remote-control-session-name-prefix` CLI flag sets the same value for a single invocation `CLAUDE_STREAM_IDLE_TIMEOUT_MS`| Timeout in milliseconds before the event- and byte-level streaming idle watchdogs close a stalled connection. When you set this variable explicitly, the minimum is `300000` (5 minutes); lower values are silently clamped to absorb extended thinking pauses and proxy buffering, and the byte-level watchdog caps the value at 30 minutes. `CLAUDE_BYTE_STREAM_IDLE_TIMEOUT_MS` takes precedence over this variable for the byte-level watchdog. For the per-watchdog unset defaults, see [Streaming idle watchdogs](</docs/en/network-config#streaming-idle-watchdogs>) -`CLAUDE_SUBAGENT_BG_SHELL_MAX_MS`| Maximum lifetime in milliseconds for a [background shell command](</docs/en/interactive-mode#background-bash-commands>) that a [subagent](</docs/en/sub-agents>) started. Default `3600000` (60 minutes). When you set `0`, Claude Code applies the default instead of removing the cap. Claude Code doesn’t cap main-session background commands this way; see [How backgrounding works](</docs/en/interactive-mode#how-backgrounding-works>) for the memory-pressure limit that covers them +`CLAUDE_SUBAGENT_BG_SHELL_MAX_MS`| Maximum lifetime in milliseconds for a [background shell command](</docs/en/interactive-mode#background-bash-commands>) that a [subagent](</docs/en/sub-agents>) started. Default `3600000` (60 minutes). When you set `0`, Claude Code applies the default instead of removing the cap. When the subagent runs in the foreground, Claude Code also ends the command when that subagent gives its final response, regardless of this cap. See [the background command lifetime rules](</docs/en/tools-reference#background-commands>). Claude Code doesn’t cap main-session background commands this way. For the memory-pressure limit that covers them, see [How backgrounding works](</docs/en/interactive-mode#how-backgrounding-works>) `DEBUG`| Set to `1` to enable debug mode, equivalent to launching with [`--debug`](</docs/en/cli-reference#cli-flags>). Debug logs are written to `~/.claude/debug/<session-id>.txt`, or to the path set by `CLAUDE_CODE_DEBUG_LOGS_DIR`. Only the truthy values `1`, `true`, `yes`, and `on` enable debug mode, so namespace patterns like `DEBUG=express:*` set for other tools do not trigger it `DISABLE_AUTOUPDATER`| Set to `1` to disable automatic background updates. Manual `claude update` still works. Use `DISABLE_UPDATES` to block both `DISABLE_AUTO_COMPACT`| Set to `1` to disable automatic compaction when approaching the context limit. The manual `/compact` command remains available. Use when you want explicit control over when compaction occurs. Overrides the [`autoCompactEnabled`](</docs/en/settings#available-settings>) setting @@ -376,16 +381,16 @@ `ENABLE_CLAUDEAI_MCP_SERVERS`| Set to `false` to disable [claude.ai MCP servers](</docs/en/mcp#use-mcp-servers-from-claude-ai>) in Claude Code. Enabled by default for logged-in users. To disable per-project or per-org, set [`disableClaudeAiConnectors`](</docs/en/settings#available-settings>) in settings instead `ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) instead of the default 5 minutes. Intended for API key, [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), [Microsoft Foundry](</docs/en/microsoft-foundry>), and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) users. Subscription users within included usage receive 1-hour TTL automatically. Subscription users drawing on [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>) can set it to keep the 1-hour TTL. 1-hour cache writes are billed at a higher rate `ENABLE_PROMPT_CACHING_1H_BEDROCK`| Deprecated. Use `ENABLE_PROMPT_CACHING_1H` instead -`ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset: all MCP tools deferred by default, but loaded upfront on Google Cloud’s Agent Platform models earlier than the Claude 4.5 generation, when `ANTHROPIC_BASE_URL` points to a non-first-party host, or on a Microsoft Foundry deployment hosted on Azure. Values: `true` (always defer and send the beta header, except on a Microsoft Foundry deployment hosted on Azure and on Google Cloud’s Agent Platform models earlier than the Claude 4.5 generation, where Claude Code still loads tools upfront; requests fail on proxies that don’t support `tool_reference`), `auto` (threshold mode: load upfront if tools fit within 10% of context), `auto:N` (custom threshold, e.g., `auto:5` for 5%), `false` (load all upfront). Ignored when `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS` is set, which forces all tools to load upfront. Before v2.1.221, Claude Code disabled tool search for all models on Google Cloud’s Agent Platform unless you set this variable to `true` +`ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset, Claude Code defers all MCP tools by default. It still loads them upfront on Google Cloud’s Agent Platform models earlier than the Claude 4.5 generation, on a Microsoft Foundry deployment hosted on Azure, and when `ANTHROPIC_BASE_URL` points to a non-first-party host. `true` always defers and sends the beta header, except on those same Agent Platform models and Microsoft Foundry deployments; requests fail on proxies that don’t support `tool_reference`. `auto` loads upfront when tool definitions fit within 10% of context. `auto:N` sets a custom threshold, such as `auto:5` for 5%. `false` loads all tools upfront. A value you set yourself is ignored when `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS` is set. Before v2.1.221, Claude Code disabled tool search for all models on Google Cloud’s Agent Platform unless you set this variable to `true` `FALLBACK_FOR_ALL_PRIMARY_MODELS`| Set to any non-empty value, such as `1`, to make every model stop retrying with a repeated-overload error when no fallback model is configured. **Setting it to`0` or `false` still enables this**, unlike most on/off variables; unset the variable to restore the default retry behavior. Without it, models Claude Code recognizes as Opus, Fable 5, or Mythos models stop retrying this way when you authenticate with an API key or a [third-party provider](</docs/en/third-party-integrations>) rather than a Claude subscription. As of v2.1.160, a configured [fallback model chain](</docs/en/model-config#fallback-model-chains>) triggers on repeated overload errors for any primary model, so this variable does not affect switching to a fallback model `FORCE_AUTOUPDATE_PLUGINS`| Set to `1` to force plugin auto-updates even when the main auto-updater is disabled via `DISABLE_AUTOUPDATER` -`FORCE_HYPERLINK`| Set to `1` to enable clickable OSC 8 hyperlinks when your terminal supports them but isn’t auto-detected, or `0` to disable them. Claude Code parses this value as a number, not a boolean, so word spellings such as `false`, `no`, or `off` enable hyperlinks rather than disabling them +`FORCE_HYPERLINK`| Set to `1` to enable clickable OSC 8 hyperlinks when your terminal supports them but isn’t auto-detected, or `0` to disable them. When unset, Claude Code enables hyperlinks only when it detects terminal support. Claude Code parses this value as a number, not a Boolean, so a value such as `false`, `no`, or `off` enables hyperlinks rather than disabling them. Claude Code renders the footer PR badge as a hyperlink even when it can’t detect terminal support, such as over SSH. Set `0` to render the badge as plain text `FORCE_PROMPT_CACHING_5M`| Set to `1` to force the 5-minute prompt cache TTL even when 1-hour TTL would otherwise apply. Overrides `ENABLE_PROMPT_CACHING_1H` `HTTP_PROXY`| Specify HTTP proxy server for network connections `HTTPS_PROXY`| Specify HTTPS proxy server for network connections `IS_DEMO`| Set to any non-empty value, such as `1`, to enable demo mode: hides your email and organization name from the header and `/status` output, and skips onboarding. **Setting it to`0` or `false` still enables demo mode**, unlike most on/off variables; unset the variable to turn it off. Useful when streaming or recording a session `MAX_MCP_OUTPUT_TOKENS`| Maximum number of tokens allowed in MCP tool responses. Claude Code displays a warning when output exceeds 10,000 tokens. Tools that declare [`anthropic/maxResultSizeChars`](</docs/en/mcp#raise-the-limit-for-a-specific-tool>) use that character limit for text content instead, but image content from those tools is still subject to this variable (default: 25000) -`MAX_STRUCTURED_OUTPUT_RETRIES`| Number of times to retry when the model’s response fails validation against the [`--json-schema`](</docs/en/cli-reference#cli-flags>) in non-interactive mode (the `-p` flag). Defaults to 5 +`MAX_STRUCTURED_OUTPUT_RETRIES`| Number of times Claude Code retries when the model’s response fails validation against the [`--json-schema`](</docs/en/cli-reference#cli-flags>) in non-interactive mode with the `-p` flag. The same retry count applies when a [workflow](</docs/en/workflows>) subagent’s structured output fails validation. Defaults to 5 `MAX_THINKING_TOKENS`| Fixed token budget for [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>). Claude Code caps it at one token below the request’s max output tokens and never below 1,024; see `CLAUDE_CODE_MAX_OUTPUT_TOKENS` for how that limit is set. When unset and thinking is enabled, models with [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) choose their own thinking depth, and other models use the cap. Set to `0` to disable thinking on the Anthropic API, except on Fable 5, which cannot have thinking turned off; on [third-party providers](</docs/en/third-party-integrations>), `0` omits the `thinking` parameter instead. Nonzero values are ignored on adaptive reasoning models unless `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` is set `MCP_CLIENT_SECRET`| OAuth client secret for MCP servers that require [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>). Avoids the interactive prompt when adding a server with `--client-secret` `MCP_CONNECTION_NONBLOCKING`| Controls whether startup waits for MCP servers to connect before the first query. MCP startup is non-blocking by default: servers connect in the background and their tools become available as they finish; before v2.1.142, the blocking wait was the default. Set to `0` to restore the blocking 5-second connection wait. Servers configured with [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>) still make startup wait regardless, except when served from the [discovery cache](</docs/en/mcp#managing-your-servers>), since their tools must be present when the first prompt is built. In non-interactive mode (`-p`), Claude Code also waits for still-pending servers before the first turn regardless of this variable, with a longer deadline when you pass [`--mcp-config`](</docs/en/cli-reference#cli-flags>) explicitly; see that flag’s entry for the cached-server exception @@ -393,6 +398,7 @@ `MCP_DISCOVERY_CACHE`| Set to `0` to turn off the cross-process MCP discovery cache, so every server connects at startup instead of showing the [`connects on first use` cached status](</docs/en/mcp#managing-your-servers>) and connecting on its first tool call. The cached status requires Claude Code v2.1.221 or later `MCP_OAUTH_CALLBACK_PORT`| Fixed port for the OAuth redirect callback, as an alternative to `--callback-port` when adding an MCP server with [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>) `MCP_REMOTE_SERVER_CONNECTION_BATCH_SIZE`| Maximum number of remote MCP servers (HTTP/SSE) to connect in parallel during startup (default: 20) +`MCP_SDK_GENERATION`| Pin which MCP client runtime this process uses, the implementation behind [MCP server connections](</docs/en/mcp>), while Claude Code migrates from its v1 runtime to v2. Set `v1` to stay on the current runtime or `v2` to opt in early. Without the variable, a gradual rollout decides, and defaults to v1. On Claude Code v2.1.221 or later, the v2 runtime checks the issuer an MCP OAuth server returns in its authorization response and fails the sign-in with an error that begins `Issuer mismatch in authorization response` when it doesn’t match. The v1 runtime doesn’t run this check. If you set an unrecognized value, Claude Code ignores it and writes a warning to the debug log. Claude Code reads the value once per process. Requires Claude Code v2.1.218 or later `MCP_SERVER_CONNECTION_BATCH_SIZE`| Maximum number of local MCP servers (stdio) to connect in parallel during startup (default: 3) `MCP_TIMEOUT`| Timeout in milliseconds for MCP server startup (default: 30000, or 30 seconds) `MCP_TOOL_TIMEOUT`| Timeout in milliseconds for MCP tool execution (default: 100000000, about 28 hours). For an HTTP, SSE, or claude.ai connector server, each request also times out after 60 seconds by default; set this variable, or the per-server `timeout`, above 60000 to raise that per-request limit. A lower value still shortens the overall tool-execution timeout but leaves the per-request limit at 60 seconds. Stdio and WebSocket servers have no per-request timer. A per-server `timeout` field in `.mcp.json` overrides this for that server. A per-server `timeout` of at least 1000 also sets the minimum idle window for that server’s tool calls, so `CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT` never aborts them sooner; this floor requires Claude Code v2.1.203 or later. For the env variable, values below 1000 are floored to one second; for the per-server field, values below 1000 are ignored
modified
--- a/env-vars.md +++ b/env-vars.md @@ -330,7 +330,7 @@ `CLAUDE_CODE_TEAM_TEARDOWN_PARK_TIMEOUT_MS`| Override, in milliseconds, how long a non-interactive session waits at exit for its [agent team](</docs/en/agent-teams>) to finish tearing down. Accepts 1000 to 60000; an out-of-range value is ignored and the default of 10000 applies. Requires Claude Code v2.1.206 or later `CLAUDE_CODE_TMPDIR`| Override the temp directory used for internal temp files. Claude Code appends `/claude-{uid}/` on Unix or `/claude/` on Windows to this path. Default: `/tmp` on macOS, `os.tmpdir()` on Linux and Windows. As of v2.1.161, on macOS and Linux, [sandboxed](</docs/en/sandboxing>) Bash subprocesses receive a short fallback `$TMPDIR` under the system default when your override is a long path, since some tools fail when temp paths get too long. Unsandboxed Bash commands inherit your shell’s `$TMPDIR` unchanged. Claude Code’s own temp files always use your override `CLAUDE_CODE_TMUX_TRUECOLOR`| Set to any non-empty value, such as `1`, to allow 24-bit truecolor output inside tmux. **Setting it to`0` or `false` still allows truecolor**, unlike most on/off variables; unset the variable to restore the 256-color clamp. By default, Claude Code clamps to 256 colors when `$TMUX` is set because tmux does not pass through truecolor escape sequences unless configured to. Set this after adding `set -ga terminal-overrides ',*:Tc'` to your `~/.tmux.conf`. See [Terminal configuration](</docs/en/terminal-config>) for other tmux settings -`CLAUDE_CODE_USER_DIALOG_TIMEOUT_MS`| Deadline in milliseconds for dialogs Claude Code forwards to a remote client, such as a [Remote Control](</docs/en/remote-control>) or SDK host, and for the approval dialog for a [held cross-session message](</docs/en/cross-session-messaging#control-inbound-messages>), before Claude Code cancels them; permission prompts and `AskUserQuestion` questions use their own flows and aren’t governed by it. Overrides the [`dialogExpiry`](</docs/en/settings#available-settings>) setting; `0` or a negative value disables the deadline +`CLAUDE_CODE_USER_DIALOG_TIMEOUT_MS`| Deadline in milliseconds for dialogs Claude Code forwards to a remote client, such as a [Remote Control](</docs/en/remote-control>) or SDK host, and for a [held cross-session message](</docs/en/cross-session-messaging#control-inbound-messages>) awaiting approval, before Claude Code cancels the dialog or drops the default-held message; permission prompts and `AskUserQuestion` questions use their own flows and aren’t governed by it. Overrides the [`dialogExpiry`](</docs/en/settings#available-settings>) setting; `0` or a negative value disables the deadline `CLAUDE_CODE_USE_ANTHROPIC_AWS`| Use [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) `CLAUDE_CODE_USE_BEDROCK`| Use [Amazon Bedrock](</docs/en/amazon-bedrock>) `CLAUDE_CODE_USE_FOUNDRY`| Use [Microsoft Foundry](</docs/en/microsoft-foundry>) @@ -348,7 +348,7 @@ `CLAUDE_PID`| Claude Code sets this to its own process ID in the subprocesses it spawns: Bash and PowerShell tool commands and hook commands. On Linux, the Bash tool’s shell integration uses it to refuse a `pkill` pattern that would match the Claude Code process itself; see [the error reference](</docs/en/errors#pkill-pattern-matches-the-claude-code-process>). Read it from your own scripts to identify or signal the parent Claude Code process deliberately. Requires Claude Code v2.1.214 or later `CLAUDE_REMOTE_CONTROL_SESSION_NAME_PREFIX`| Prefix for auto-generated [Remote Control](</docs/en/remote-control>) session names when no explicit name is provided. Defaults to your machine’s hostname, producing names like `myhost-graceful-unicorn`. The `--remote-control-session-name-prefix` CLI flag sets the same value for a single invocation `CLAUDE_STREAM_IDLE_TIMEOUT_MS`| Timeout in milliseconds before the event- and byte-level streaming idle watchdogs close a stalled connection. When you set this variable explicitly, the minimum is `300000` (5 minutes); lower values are silently clamped to absorb extended thinking pauses and proxy buffering, and the byte-level watchdog caps the value at 30 minutes. `CLAUDE_BYTE_STREAM_IDLE_TIMEOUT_MS` takes precedence over this variable for the byte-level watchdog. For the per-watchdog unset defaults, see [Streaming idle watchdogs](</docs/en/network-config#streaming-idle-watchdogs>) -`CLAUDE_SUBAGENT_BG_SHELL_MAX_MS`| Maximum lifetime in milliseconds for a [background shell command](</docs/en/interactive-mode#background-bash-commands>) that a [subagent](</docs/en/sub-agents>) started, after which Claude Code terminates the command. Default `3600000` (60 minutes). Setting `0` doesn’t disable the cap: Claude Code applies the 60-minute default instead. Claude Code doesn’t apply a lifetime cap to background commands in the main session; `CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP` covers the separate memory-pressure limit that applies to them. Requires Claude Code v2.1.133 or later +`CLAUDE_SUBAGENT_BG_SHELL_MAX_MS`| Maximum lifetime in milliseconds for a [background shell command](</docs/en/interactive-mode#background-bash-commands>) that a [subagent](</docs/en/sub-agents>) started. Default `3600000` (60 minutes). When you set `0`, Claude Code applies the default instead of removing the cap. Claude Code doesn’t cap main-session background commands this way; see [How backgrounding works](</docs/en/interactive-mode#how-backgrounding-works>) for the memory-pressure limit that covers them `DEBUG`| Set to `1` to enable debug mode, equivalent to launching with [`--debug`](</docs/en/cli-reference#cli-flags>). Debug logs are written to `~/.claude/debug/<session-id>.txt`, or to the path set by `CLAUDE_CODE_DEBUG_LOGS_DIR`. Only the truthy values `1`, `true`, `yes`, and `on` enable debug mode, so namespace patterns like `DEBUG=express:*` set for other tools do not trigger it `DISABLE_AUTOUPDATER`| Set to `1` to disable automatic background updates. Manual `claude update` still works. Use `DISABLE_UPDATES` to block both `DISABLE_AUTO_COMPACT`| Set to `1` to disable automatic compaction when approaching the context limit. The manual `/compact` command remains available. Use when you want explicit control over when compaction occurs. Overrides the [`autoCompactEnabled`](</docs/en/settings#available-settings>) setting
modified
--- a/env-vars.md +++ b/env-vars.md @@ -235,7 +235,7 @@ `CLAUDE_CODE_ENABLE_FINE_GRAINED_TOOL_STREAMING`| Controls whether tool call inputs stream from the API as Claude generates them. With this off, a large tool input such as a long file write arrives only after Claude finishes generating it, which can look like it’s hanging. Enabled by default on the Anthropic API. On Amazon Bedrock and Google Cloud’s Agent Platform, enabled per model where the deployed container supports it. Set to `0` to opt out. Set to `1` to force on when routing through a proxy via `ANTHROPIC_BASE_URL`, `ANTHROPIC_VERTEX_BASE_URL`, or `ANTHROPIC_BEDROCK_BASE_URL`. Off by default on Microsoft Foundry and [gateway](</docs/en/llm-gateway>) connections `CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY`| Set to `1` to populate the `/model` picker from your gateway’s `/v1/models` endpoint when `ANTHROPIC_BASE_URL` points at an Anthropic-compatible gateway such as LiteLLM, Kong, or an internal proxy. Off by default because gateways backed by a shared API key would otherwise show every user every model the key can access. Discovered models are still filtered by an [`availableModels`](</docs/en/settings#available-settings>) allowlist the session receives; deliver the list through [MDM or a managed settings file](</docs/en/settings#settings-files>), since [server-managed delivery is not available on gateway configurations](</docs/en/server-managed-settings#platform-availability>) `CLAUDE_CODE_ENABLE_OPUS_4_7_FAST_MODE`| Removed in v2.1.142, when the [fast mode](</docs/en/fast-mode>) default moved from Opus 4.6 to Opus 4.7 -`CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION`| Set to `false` to disable prompt suggestions (the “Prompt suggestions” toggle in `/config`). These are the grayed-out predictions that appear in your prompt input after Claude responds. See [Prompt suggestions](</docs/en/interactive-mode#prompt-suggestions>) +`CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION`| Set to `false` to disable prompt suggestions (the “Prompt suggestions” toggle in `/config`). These are the grayed-out predictions that appear in your prompt input. Takes precedence over the [`promptSuggestionEnabled`](</docs/en/settings#available-settings>) setting. See [Prompt suggestions](</docs/en/interactive-mode#prompt-suggestions>) `CLAUDE_CODE_ENABLE_TASKS`| Controls whether sessions use the structured Task tools (`TaskCreate`, `TaskUpdate`, `TaskGet`, `TaskList`) or the legacy `TodoWrite` tool. As of Claude Code v2.1.142, Task tools are the default in all modes. Set to `0` to revert to `TodoWrite`. See [Task list](</docs/en/interactive-mode#task-list>) and [Migrate to Task tools](</docs/en/agent-sdk/todo-tracking#migrate-to-task-tools>) `CLAUDE_CODE_ENABLE_TELEMETRY`| Set to `1` to enable OpenTelemetry data collection for metrics and logging. Required before configuring OTel exporters. See [Monitoring](</docs/en/monitoring-usage>) `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
modified
--- a/env-vars.md +++ b/env-vars.md @@ -120,6 +120,7 @@ `ANTHROPIC_BASE_URL`| Override the API endpoint to route requests through a proxy or gateway. When set to a non-first-party host, [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) is disabled by default. Set `ENABLE_TOOL_SEARCH=true` if your proxy forwards `tool_reference` blocks. As of v2.1.196, [Remote Control](</docs/en/remote-control#requirements>) is disabled when this points at a host other than `api.anthropic.com`, matching its behavior on Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry `ANTHROPIC_BEDROCK_BASE_URL`| Override the Amazon Bedrock endpoint URL. Use for custom Amazon Bedrock endpoints or when routing through an [LLM gateway](</docs/en/llm-gateway>). See [Amazon Bedrock](</docs/en/amazon-bedrock>) `ANTHROPIC_BEDROCK_MANTLE_BASE_URL`| Override the Amazon Bedrock Mantle endpoint URL. See [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>) +`ANTHROPIC_BEDROCK_REGION_PREFIX`| Cross-region inference profile prefix (`us`, `eu`, `apac`, `jp`, `au`, or `global`) Claude Code tries first instead of the one derived from the AWS region. Ignored in AWS GovCloud regions. Requires Claude Code v2.1.224 or later. See [Amazon Bedrock](</docs/en/amazon-bedrock#cross-region-inference-profile-prefixes>) `ANTHROPIC_BEDROCK_SERVICE_TIER`| Amazon Bedrock [service tier](<https://docs.aws.amazon.com/bedrock/latest/userguide/service-tiers-inference.html>) (`default`, `flex`, or `priority`). Sent as the `X-Amzn-Bedrock-Service-Tier` header. See [Amazon Bedrock](</docs/en/amazon-bedrock#service-tiers>) `ANTHROPIC_BETAS`| Comma-separated list of additional `anthropic-beta` header values to include in API requests. Claude Code already sends the beta headers it needs; use this to opt into an [Anthropic API beta](<https://platform.claude.com/docs/en/api/beta-headers>) before Claude Code adds native support. Unlike the [`--betas` flag](</docs/en/cli-reference#cli-flags>), which requires API key authentication, this variable works with all auth methods including Claude.ai subscription `ANTHROPIC_CUSTOM_HEADERS`| Custom headers to add to requests (`Name: Value` format, newline-separated for multiple headers) @@ -216,7 +217,7 @@ `CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP`| Set to `1` to prevent automatic remapping of Opus 4.0 and 4.1 to the current Opus version on the Anthropic API. Use when you intentionally want to pin an older model. The remap does not run on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry `CLAUDE_CODE_DISABLE_MOUSE`| Set to `1` to disable mouse tracking in [fullscreen rendering](</docs/en/fullscreen>). Keyboard scrolling with `PgUp` and `PgDn` still works. Use this to keep your terminal’s native copy-on-select behavior `CLAUDE_CODE_DISABLE_MOUSE_CLICKS`| Set to `1` to disable click, drag, and hover handling in [fullscreen rendering](</docs/en/fullscreen>) while keeping mouse-wheel scrolling. Use this when you want wheel scroll to work inside Claude Code but don’t want clicks to position the cursor, expand tool output, or open links. `CLAUDE_CODE_DISABLE_MOUSE` takes precedence when both are set. Requires Claude Code v2.1.195 or later -`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`| Set to any non-empty value, such as `1`, to disable nonessential network traffic: auto-updates, telemetry, error reporting, the `/feedback` command, release notes, [gateway model discovery](</docs/en/llm-gateway-connect#add-gateway-models-to-the-model-picker>) refreshes, and availability checks such as the [fast mode](</docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways>) check. **Setting it to`0` or `false` still disables this traffic**, unlike most on/off variables; unset the variable to allow it again. Also disables feature-flag fetching, which makes [Remote Control](</docs/en/remote-control#requirements>) unavailable. Official plugin marketplace auto-install isn’t covered; disable it with `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL` +`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`| Set to any non-empty value, such as `1`, to disable nonessential network traffic: auto-updates, telemetry, error reporting, the `/feedback` command, release notes, [gateway model discovery](</docs/en/llm-gateway-connect#add-gateway-models-to-the-model-picker>) refreshes, and availability checks such as the [fast mode](</docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways>) check. **Setting it to`0` or `false` still disables this traffic**, unlike most on/off variables; unset the variable to allow it again. Also disables feature-flag fetching, which makes [Remote Control](</docs/en/remote-control#requirements>) and [cross-session messaging](</docs/en/cross-session-messaging#availability>) unavailable. Official plugin marketplace auto-install isn’t covered; disable it with `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL` `CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK`| Set to `1` to disable the non-streaming fallback when a streaming request fails mid-stream. Streaming errors propagate to the retry layer instead. Useful when a proxy or gateway causes the fallback to produce duplicate tool execution `CLAUDE_CODE_DISABLE_NOTIFICATION_PRESENCE_CHECK`| Set to `1` to send the `PushNotification` tool’s desktop notification even while you are typing in or focused on the terminal. By default the tool skips both the desktop notification and the [mobile push](</docs/en/remote-control#mobile-push-notifications>) when it detects recent keyboard activity or terminal focus. This variable disables only that local check, so the server can still suppress the mobile push when it detects that you are active. Requires Claude Code v2.1.193 or later `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL`| Set to `1` to disable automatic registration of the official plugin marketplace. Claude Code reads the variable when it is about to register the marketplace, usually during a machine’s first interactive launch. If the variable is set at that point, Claude Code skips the registration permanently. Unsetting the variable later doesn’t undo the skip. Run `claude plugin marketplace add anthropics/claude-plugins-official` to register the marketplace at any time @@ -266,6 +267,7 @@ `CLAUDE_CODE_MCP_ALLOWLIST_ENV`| Set to `1` to spawn stdio MCP servers with only a safe baseline environment plus the server’s configured `env`, instead of inheriting your shell environment `CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS`| Elapsed time in milliseconds before a still-running MCP tool call [moves to a background task](</docs/en/mcp#automatic-backgrounding-of-long-tool-calls>) (default: 120000, or 2 minutes). Set to `0` to turn automatic backgrounding off. Requires Claude Code v2.1.212 or later `CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT`| Idle timeout in milliseconds for MCP tool calls. When a stdio, HTTP, SSE, WebSocket, or [claude.ai connector](</docs/en/mcp#use-mcp-servers-from-claude-ai>) MCP server sends no response and no progress notification for this long, the tool call aborts with an error instead of waiting for the overall `MCP_TOOL_TIMEOUT`. Overrides the per-transport defaults of 300000 (5 minutes) for network servers and 1800000 (30 minutes) for stdio servers. Set to `0` to disable the idle check. Values below 1000 are raised to one second, and the value is capped at the effective `MCP_TOOL_TIMEOUT`. A per-server `timeout` in `.mcp.json` of at least 1000 raises that server’s idle window to at least the `timeout` value. Doesn’t apply to IDE servers or SDK in-process servers. Requires Claude Code v2.1.187 or later. Before v2.1.203, stdio servers were exempt from the idle timeout +`CLAUDE_CODE_MESSAGING_SOCKET`| Set by Claude Code, not by you: in sessions that bind an [inbox socket](</docs/en/cross-session-messaging#the-sessions-inbox-socket>), Claude Code exports that socket’s path to hooks and Bash commands before any hook runs. Other sessions on the machine deliver messages to this path. Each session exports its own socket rather than one inherited from a parent, and messages arriving on it go through the session’s [inbound controls](</docs/en/cross-session-messaging#control-inbound-messages>). Settings `env` blocks can’t set it. Requires Claude Code v2.1.224 or later `CLAUDE_CODE_NATIVE_CURSOR`| Set to `1` to show the terminal’s own cursor at the input caret instead of a drawn block. The cursor respects the terminal’s blink, shape, and focus settings `CLAUDE_CODE_NEW_INIT`| Set to `1` to make `/init` run an interactive setup flow. The flow asks which files to generate, including CLAUDE.md, skills, and hooks, before exploring the codebase and writing them. Without this variable, `/init` generates a CLAUDE.md automatically without prompting `CLAUDE_CODE_NO_FLICKER`| Set to `1` to enable [fullscreen rendering](</docs/en/fullscreen>), a research preview that reduces flicker and keeps memory flat in long conversations. Equivalent to the [`tui`](</docs/en/settings#available-settings>) setting; you can also switch with `/tui fullscreen` @@ -328,6 +330,7 @@ `CLAUDE_CODE_TEAM_TEARDOWN_PARK_TIMEOUT_MS`| Override, in milliseconds, how long a non-interactive session waits at exit for its [agent team](</docs/en/agent-teams>) to finish tearing down. Accepts 1000 to 60000; an out-of-range value is ignored and the default of 10000 applies. Requires Claude Code v2.1.206 or later `CLAUDE_CODE_TMPDIR`| Override the temp directory used for internal temp files. Claude Code appends `/claude-{uid}/` on Unix or `/claude/` on Windows to this path. Default: `/tmp` on macOS, `os.tmpdir()` on Linux and Windows. As of v2.1.161, on macOS and Linux, [sandboxed](</docs/en/sandboxing>) Bash subprocesses receive a short fallback `$TMPDIR` under the system default when your override is a long path, since some tools fail when temp paths get too long. Unsandboxed Bash commands inherit your shell’s `$TMPDIR` unchanged. Claude Code’s own temp files always use your override `CLAUDE_CODE_TMUX_TRUECOLOR`| Set to any non-empty value, such as `1`, to allow 24-bit truecolor output inside tmux. **Setting it to`0` or `false` still allows truecolor**, unlike most on/off variables; unset the variable to restore the 256-color clamp. By default, Claude Code clamps to 256 colors when `$TMUX` is set because tmux does not pass through truecolor escape sequences unless configured to. Set this after adding `set -ga terminal-overrides ',*:Tc'` to your `~/.tmux.conf`. See [Terminal configuration](</docs/en/terminal-config>) for other tmux settings +`CLAUDE_CODE_USER_DIALOG_TIMEOUT_MS`| Deadline in milliseconds for dialogs Claude Code forwards to a remote client, such as a [Remote Control](</docs/en/remote-control>) or SDK host, and for the approval dialog for a [held cross-session message](</docs/en/cross-session-messaging#control-inbound-messages>), before Claude Code cancels them; permission prompts and `AskUserQuestion` questions use their own flows and aren’t governed by it. Overrides the [`dialogExpiry`](</docs/en/settings#available-settings>) setting; `0` or a negative value disables the deadline `CLAUDE_CODE_USE_ANTHROPIC_AWS`| Use [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) `CLAUDE_CODE_USE_BEDROCK`| Use [Amazon Bedrock](</docs/en/amazon-bedrock>) `CLAUDE_CODE_USE_FOUNDRY`| Use [Microsoft Foundry](</docs/en/microsoft-foundry>) @@ -345,6 +348,7 @@ `CLAUDE_PID`| Claude Code sets this to its own process ID in the subprocesses it spawns: Bash and PowerShell tool commands and hook commands. On Linux, the Bash tool’s shell integration uses it to refuse a `pkill` pattern that would match the Claude Code process itself; see [the error reference](</docs/en/errors#pkill-pattern-matches-the-claude-code-process>). Read it from your own scripts to identify or signal the parent Claude Code process deliberately. Requires Claude Code v2.1.214 or later `CLAUDE_REMOTE_CONTROL_SESSION_NAME_PREFIX`| Prefix for auto-generated [Remote Control](</docs/en/remote-control>) session names when no explicit name is provided. Defaults to your machine’s hostname, producing names like `myhost-graceful-unicorn`. The `--remote-control-session-name-prefix` CLI flag sets the same value for a single invocation `CLAUDE_STREAM_IDLE_TIMEOUT_MS`| Timeout in milliseconds before the event- and byte-level streaming idle watchdogs close a stalled connection. When you set this variable explicitly, the minimum is `300000` (5 minutes); lower values are silently clamped to absorb extended thinking pauses and proxy buffering, and the byte-level watchdog caps the value at 30 minutes. `CLAUDE_BYTE_STREAM_IDLE_TIMEOUT_MS` takes precedence over this variable for the byte-level watchdog. For the per-watchdog unset defaults, see [Streaming idle watchdogs](</docs/en/network-config#streaming-idle-watchdogs>) +`CLAUDE_SUBAGENT_BG_SHELL_MAX_MS`| Maximum lifetime in milliseconds for a [background shell command](</docs/en/interactive-mode#background-bash-commands>) that a [subagent](</docs/en/sub-agents>) started, after which Claude Code terminates the command. Default `3600000` (60 minutes). Setting `0` doesn’t disable the cap: Claude Code applies the 60-minute default instead. Claude Code doesn’t apply a lifetime cap to background commands in the main session; `CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP` covers the separate memory-pressure limit that applies to them. Requires Claude Code v2.1.133 or later `DEBUG`| Set to `1` to enable debug mode, equivalent to launching with [`--debug`](</docs/en/cli-reference#cli-flags>). Debug logs are written to `~/.claude/debug/<session-id>.txt`, or to the path set by `CLAUDE_CODE_DEBUG_LOGS_DIR`. Only the truthy values `1`, `true`, `yes`, and `on` enable debug mode, so namespace patterns like `DEBUG=express:*` set for other tools do not trigger it `DISABLE_AUTOUPDATER`| Set to `1` to disable automatic background updates. Manual `claude update` still works. Use `DISABLE_UPDATES` to block both `DISABLE_AUTO_COMPACT`| Set to `1` to disable automatic compaction when approaching the context limit. The manual `/compact` command remains available. Use when you want explicit control over when compaction occurs. Overrides the [`autoCompactEnabled`](</docs/en/settings#available-settings>) setting @@ -354,7 +358,7 @@ `DISABLE_ERROR_REPORTING`| Set to any non-empty value, such as `1`, to opt out of error reporting. **Setting it to`0` or `false` still opts out**, unlike most on/off variables; unset the variable to turn error reporting back on `DISABLE_EXTRA_USAGE_COMMAND`| Set to `1` to hide the `/usage-credits` command that lets users purchase additional usage beyond rate limits `DISABLE_FEEDBACK_COMMAND`| Set to `1` to disable the `/feedback` command. Also disables `/bug` and `/share`, which report through the same path; before v2.1.212 they were aliases of `/feedback`, so the command was disabled under every name. The older name `DISABLE_BUG_COMMAND` is also accepted -`DISABLE_GROWTHBOOK`| Set to `1` to disable GrowthBook feature-flag fetching and use code defaults for every flag. This makes [Remote Control](</docs/en/remote-control#requirements>) unavailable. Telemetry event logging stays on unless `DISABLE_TELEMETRY` is also set +`DISABLE_GROWTHBOOK`| Set to `1` to disable GrowthBook feature-flag fetching and use code defaults for every flag. This makes [Remote Control](</docs/en/remote-control#requirements>) and [cross-session messaging](</docs/en/cross-session-messaging#availability>) unavailable. Telemetry event logging stays on unless `DISABLE_TELEMETRY` is also set `DISABLE_INSTALLATION_CHECKS`| Set to `1` to disable installation warnings. Use only when manually managing the installation location, as this can mask issues with standard installations `DISABLE_INSTALL_GITHUB_APP_COMMAND`| Set to `1` to hide the `/install-github-app` command. Already hidden when using third-party providers (Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry) `DISABLE_INTERLEAVED_THINKING`| Set to `1` to prevent sending the interleaved-thinking beta header. Useful when your LLM gateway or provider does not support [interleaved thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking#interleaved-thinking>) @@ -365,12 +369,12 @@ `DISABLE_PROMPT_CACHING_HAIKU`| Set to `1` to disable prompt caching for Haiku models `DISABLE_PROMPT_CACHING_OPUS`| Set to `1` to disable prompt caching for Opus models `DISABLE_PROMPT_CACHING_SONNET`| Set to `1` to disable prompt caching for Sonnet models -`DISABLE_TELEMETRY`| Set to any non-empty value, such as `1`, to opt out of telemetry. **Setting it to`0` or `false` still opts out**, unlike most on/off variables; unset the variable to turn telemetry back on. Telemetry events do not include user data like code, file paths, or bash commands. Also disables feature-flag fetching with the same effect as `DISABLE_GROWTHBOOK`, which makes [Remote Control](</docs/en/remote-control#requirements>) unavailable +`DISABLE_TELEMETRY`| Set to any non-empty value, such as `1`, to opt out of telemetry. **Setting it to`0` or `false` still opts out**, unlike most on/off variables; unset the variable to turn telemetry back on. Telemetry events do not include user data like code, file paths, or bash commands. Also disables feature-flag fetching with the same effect as `DISABLE_GROWTHBOOK`, which makes [Remote Control](</docs/en/remote-control#requirements>) and [cross-session messaging](</docs/en/cross-session-messaging#availability>) unavailable `DISABLE_UPDATES`| Set to `1` to block all updates including manual `claude update` and `claude install`. Stricter than `DISABLE_AUTOUPDATER`. Use when distributing Claude Code through your own channels and users should not self-update `DISABLE_UPGRADE_COMMAND`| Set to `1` to hide the `/upgrade` command -`DO_NOT_TRACK`| Set to `1` to opt out of telemetry, with the same effect as `DISABLE_TELEMETRY`, including making [Remote Control](</docs/en/remote-control#requirements>) unavailable. Claude Code reads this variable as a standard boolean, so `0` leaves telemetry on, and honors it as the cross-tool convention recognized by many developer CLIs +`DO_NOT_TRACK`| Set to `1` to opt out of telemetry, with the same effect as `DISABLE_TELEMETRY`, including making [Remote Control](</docs/en/remote-control#requirements>) and [cross-session messaging](</docs/en/cross-session-messaging#availability>) unavailable. Claude Code reads this variable as a standard boolean, so `0` leaves telemetry on, and honors it as the cross-tool convention recognized by many developer CLIs `ENABLE_CLAUDEAI_MCP_SERVERS`| Set to `false` to disable [claude.ai MCP servers](</docs/en/mcp#use-mcp-servers-from-claude-ai>) in Claude Code. Enabled by default for logged-in users. To disable per-project or per-org, set [`disableClaudeAiConnectors`](</docs/en/settings#available-settings>) in settings instead -`ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) instead of the default 5 minutes. Intended for API key, [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), [Microsoft Foundry](</docs/en/microsoft-foundry>), and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) users. Subscription users within included usage receive 1-hour TTL automatically. 1-hour cache writes are billed at a higher rate +`ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) instead of the default 5 minutes. Intended for API key, [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), [Microsoft Foundry](</docs/en/microsoft-foundry>), and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) users. Subscription users within included usage receive 1-hour TTL automatically. Subscription users drawing on [usage credits](<https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans>) can set it to keep the 1-hour TTL. 1-hour cache writes are billed at a higher rate `ENABLE_PROMPT_CACHING_1H_BEDROCK`| Deprecated. Use `ENABLE_PROMPT_CACHING_1H` instead `ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset: all MCP tools deferred by default, but loaded upfront on Google Cloud’s Agent Platform models earlier than the Claude 4.5 generation, when `ANTHROPIC_BASE_URL` points to a non-first-party host, or on a Microsoft Foundry deployment hosted on Azure. Values: `true` (always defer and send the beta header, except on a Microsoft Foundry deployment hosted on Azure and on Google Cloud’s Agent Platform models earlier than the Claude 4.5 generation, where Claude Code still loads tools upfront; requests fail on proxies that don’t support `tool_reference`), `auto` (threshold mode: load upfront if tools fit within 10% of context), `auto:N` (custom threshold, e.g., `auto:5` for 5%), `false` (load all upfront). Ignored when `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS` is set, which forces all tools to load upfront. Before v2.1.221, Claude Code disabled tool search for all models on Google Cloud’s Agent Platform unless you set this variable to `true` `FALLBACK_FOR_ALL_PRIMARY_MODELS`| Set to any non-empty value, such as `1`, to make every model stop retrying with a repeated-overload error when no fallback model is configured. **Setting it to`0` or `false` still enables this**, unlike most on/off variables; unset the variable to restore the default retry behavior. Without it, models Claude Code recognizes as Opus, Fable 5, or Mythos models stop retrying this way when you authenticate with an API key or a [third-party provider](</docs/en/third-party-integrations>) rather than a Claude subscription. As of v2.1.160, a configured [fallback model chain](</docs/en/model-config#fallback-model-chains>) triggers on repeated overload errors for any primary model, so this variable does not affect switching to a fallback model
modified
--- a/env-vars.md +++ b/env-vars.md @@ -192,7 +192,8 @@ `CLAUDE_CODE_DEBUG_LOGS_DIR`| Override the debug log file path. Despite the name, this is a file path, not a directory. Requires debug mode to be enabled separately via `--debug`, `/debug`, or the `DEBUG` environment variable: setting this variable alone does not enable logging. The [`--debug-file`](</docs/en/cli-reference#cli-flags>) flag does both at once. Defaults to `~/.claude/debug/<session-id>.txt` `CLAUDE_CODE_DEBUG_LOG_LEVEL`| Minimum log level written to the debug log file. Values: `verbose`, `debug` (default), `info`, `warn`, `error`. Set to `verbose` to include high-volume diagnostics like full status line command output, or raise to `error` to reduce noise `CLAUDE_CODE_DISABLE_1M_CONTEXT`| Set to `1` to disable [1M context window](</docs/en/model-config#extended-context>) support. When set, 1M model variants are unavailable in the model picker, and [Sonnet 5](</docs/en/model-config#sonnet-5-context-window>) sessions are treated as having a 200K window. Useful for enterprise environments with compliance requirements -`CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING`| Set to `1` to disable [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) on Opus 4.6 and Sonnet 4.6 and fall back to the fixed thinking budget controlled by `MAX_THINKING_TOKENS`. From v2.1.111, has no effect on Fable 5, Sonnet 5, or Opus 4.7 and later, which always use adaptive reasoning +`CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING`| Set to `1` to disable [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) on Opus 4.6 and Sonnet 4.6 and fall back to the fixed thinking budget controlled by `MAX_THINKING_TOKENS`. Has no effect on Fable 5, Sonnet 5, or Opus 4.7 and later, which always use adaptive reasoning +`CLAUDE_CODE_DISABLE_ADMIN_ENV_UNION`| Set to `1` to stop Claude Code from merging [managed settings](</docs/en/settings#settings-precedence>) `env` blocks per key across admin sources, so only the highest-priority source’s whole `env` block applies, as before v2.1.223. Set it in the environment that launches Claude Code, since Claude Code ignores a copy delivered through a settings `env` block. Requires Claude Code v2.1.223 or later `CLAUDE_CODE_DISABLE_ADVISOR_TOOL`| Set to `1` to disable the [advisor tool](</docs/en/advisor>). The `/advisor` command becomes unavailable, any configured `advisorModel` is ignored, and the `--advisor` flag is accepted but has no effect, so existing scripts that pass it continue to work without errors `CLAUDE_CODE_DISABLE_AGENT_VIEW`| Set to `1` to turn off [background agents and agent view](</docs/en/agent-view>): `claude agents`, `--bg`, `/background`, and the on-demand supervisor. Equivalent to the [`disableAgentView`](</docs/en/settings#available-settings>) setting `CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN`| Set to `1` to disable [fullscreen rendering](</docs/en/fullscreen>) and use the classic main-screen renderer. The conversation stays in your terminal’s native scrollback so `Cmd+f` and tmux copy mode work as usual. Takes precedence over `CLAUDE_CODE_NO_FLICKER` and the [`tui`](</docs/en/settings#available-settings>) setting. You can also switch with `/tui default`. Does not apply to background sessions opened from [agent view](</docs/en/agent-view>), which always use fullscreen rendering @@ -257,7 +258,7 @@ `CLAUDE_CODE_MAX_CONTEXT_TOKENS`| Override the context window size Claude Code assumes for the active model. As of v2.1.193, applied directly for model names Claude Code does not recognize as a Claude model; for recognized Claude models it only takes effect when `DISABLE_COMPACT` is also set. Use this when routing to a model through `ANTHROPIC_BASE_URL` whose context window does not match the built-in size for its name `CLAUDE_CODE_MAX_OUTPUT_TOKENS`| Set the maximum number of output tokens for most requests. Defaults and caps vary by model; see [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>). Claude Code defaults to 32000 for model IDs it doesn’t recognize, such as gateway-specific names, and lowers values above a model’s cap to the cap. Increasing this value reduces the effective context window available before [auto-compaction](</docs/en/costs#reduce-token-usage>) triggers `CLAUDE_CODE_MAX_RETRIES`| Override the number of times to retry failed API requests (default: 10). Capped at 15 as of v2.1.186; as of v2.1.199, `CLAUDE_CODE_RETRY_WATCHDOG` raises the default and removes the cap. For unattended sessions that need to wait through longer outages, set `CLAUDE_CODE_RETRY_WATCHDOG` instead -`CLAUDE_CODE_MAX_SUBAGENTS_PER_SESSION`| Cap on the number of [subagents](</docs/en/sub-agents#session-subagent-limit>) one session can spawn with the Agent tool (default: 200). When Claude reaches the cap, spawning another subagent fails with an error telling Claude to finish the remaining work directly. Accepts a positive whole number in plain digits with no upper bound; this variable doesn’t take the scientific notation or digit-separator spellings. Anything else is ignored and the default applies, so the cap can be raised but not turned off. Requires Claude Code v2.1.212 or later +`CLAUDE_CODE_MAX_SUBAGENTS_PER_SESSION`| Removed in v2.1.224 and now a no-op. Previously capped the total number of [subagents](</docs/en/sub-agents>) Claude could spawn with the Agent tool in one session (default: 200); spawning past the cap failed with `Subagent spawn limit reached`. The [concurrent subagent limit](</docs/en/sub-agents#concurrent-subagent-limit>) and the [depth limit](</docs/en/sub-agents#let-subagents-spawn-their-own-subagents>) still apply `CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH`| Number of [subagent layers](</docs/en/sub-agents#let-subagents-spawn-their-own-subagents>) allowed below the main conversation (default: 3). At the default, subagents can spawn their own subagents, and a subagent at the third layer can’t spawn further; set `1` to turn nesting off. In v2.1.217 through v2.1.218, the default was 1, so a subagent couldn’t spawn its own unless you raised the limit; v2.1.219 raised the default to 3. Accepts a positive whole number in plain digits; anything else is ignored, so the limit can be adjusted but not removed. Requires Claude Code v2.1.217 or later `CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY`| Maximum number of read-only tools and subagents that can execute in parallel (default: 10). Higher values increase parallelism but consume more resources `CLAUDE_CODE_MAX_TURNS`| Cap the number of agentic turns when no explicit limit is passed. Equivalent to passing [`--max-turns`](</docs/en/cli-reference#cli-flags>), which takes precedence when both are set. A value that is not a positive integer is rejected at startup with an error rather than treated as no cap @@ -416,7 +417,7 @@ `VERTEX_REGION_CLAUDE_4_5_SONNET`| Override region for Claude Sonnet 4.5 when using Google Cloud’s Agent Platform `VERTEX_REGION_CLAUDE_4_6_OPUS`| Override region for Claude Opus 4.6 when using Google Cloud’s Agent Platform `VERTEX_REGION_CLAUDE_4_6_SONNET`| Override region for Claude Sonnet 4.6 when using Google Cloud’s Agent Platform -`VERTEX_REGION_CLAUDE_4_7_OPUS`| Override region for Claude Opus 4.7 when using Google Cloud’s Agent Platform. Added in v2.1.111 +`VERTEX_REGION_CLAUDE_4_7_OPUS`| Override region for Claude Opus 4.7 when using Google Cloud’s Agent Platform `VERTEX_REGION_CLAUDE_4_8_OPUS`| Override region for Claude Opus 4.8 when using Google Cloud’s Agent Platform. Added in v2.1.154 `VERTEX_REGION_CLAUDE_5_OPUS`| Override region for Claude Opus 5 when using Google Cloud’s Agent Platform. Added in v2.1.219 `VERTEX_REGION_CLAUDE_5_SONNET`| Override region for Claude Sonnet 5 when using Google Cloud’s Agent Platform. Added in v2.1.197
modified
--- a/env-vars.md +++ b/env-vars.md @@ -153,7 +153,7 @@ `ANTHROPIC_VERTEX_BASE_URL`| Override Google Cloud’s Agent Platform endpoint URL. Use for custom Google Cloud’s Agent Platform endpoints or when routing through an [LLM gateway](</docs/en/llm-gateway>). See [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>) `ANTHROPIC_VERTEX_PROJECT_ID`| GCP project ID for Google Cloud’s Agent Platform requests. Overridden by `GCLOUD_PROJECT`, `GOOGLE_CLOUD_PROJECT`, or the project in your `GOOGLE_APPLICATION_CREDENTIALS` credential file. See [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>) `ANTHROPIC_WORKSPACE_ID`| Workspace ID for [workload identity federation](<https://platform.claude.com/docs/en/manage-claude/workload-identity-federation>). Set this when your federation rule is scoped to more than one workspace so the token exchange knows which workspace to target -`API_FORCE_IDLE_TIMEOUT`| Override the 5-minute idle timeout that aborts a streaming model response when no bytes arrive. Set to `0` to disable the timeout, for example when a slow [gateway](</docs/en/llm-gateway>) or local model pauses longer than 5 minutes between chunks. Set to `1` to keep the timeout on every provider. When unset, the timeout is inactive on direct Anthropic API and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) connections, where Claude Code’s own byte-level stream watchdog runs, and active on every other provider, including [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), [Microsoft Foundry](</docs/en/microsoft-foundry>), [Mantle](</docs/en/amazon-bedrock#use-the-mantle-endpoint>), [Amazon Bedrock](</docs/en/amazon-bedrock>), and gateway connections, so a stalled stream aborts instead of hanging. As of v2.1.169 +`API_FORCE_IDLE_TIMEOUT`| Override the 5-minute body idle timeout that aborts a streaming model response when no bytes arrive. Set to `0` to turn the timeout off, for example when a slow [gateway](</docs/en/llm-gateway>) or local model pauses longer than 5 minutes between chunks, or `1` to keep it on for every provider. When unset, the timeout is active on providers other than the direct Anthropic API and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>). The [stream watchdogs](</docs/en/network-config#streaming-idle-watchdogs>) run independently of it and abort a long silent pause even when you set `0` here. Requires Claude Code v2.1.169 or later `API_TIMEOUT_MS`| Timeout for API requests in milliseconds (default: 600000, or 10 minutes; maximum: 2147483647). Increase this when requests time out on slow networks or when routing through a proxy. Values above the maximum overflow the underlying timer and cause requests to fail immediately `AWS_BEARER_TOKEN_BEDROCK`| Amazon Bedrock API key for authentication (see [Amazon Bedrock API keys](<https://aws.amazon.com/blogs/machine-learning/accelerate-ai-development-with-amazon-bedrock-api-keys/>)) `BASH_DEFAULT_TIMEOUT_MS`| Default timeout for long-running bash commands (default: 120000, or 2 minutes) @@ -170,6 +170,7 @@ `CLAUDE_AUTO_BACKGROUND_TASKS`| Set to `1` to force-enable automatic backgrounding of long-running agent tasks. When enabled, subagents are moved to the background after running for approximately two minutes. Also enables [automatic backgrounding of long MCP tool calls](</docs/en/mcp#automatic-backgrounding-of-long-tool-calls>) in non-interactive mode on Claude Code v2.1.212 or later `CLAUDE_AX_SCREEN_READER`| Set to `1` to render screen-reader friendly output: flat text without decorative borders or animations. Set to `0` to force screen-reader mode off even when [`axScreenReader`](</docs/en/settings#available-settings>) is `true`. The [`--ax-screen-reader`](</docs/en/cli-reference#cli-flags>) flag takes precedence. Requires Claude Code v2.1.181 or later `CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR`| Return to the original working directory after each Bash or PowerShell command in the main session +`CLAUDE_BYTE_STREAM_IDLE_TIMEOUT_MS`| Timeout in milliseconds for the byte-level streaming idle watchdog only; when set, it takes precedence over `CLAUDE_STREAM_IDLE_TIMEOUT_MS` for that watchdog and leaves the event-level watchdog unchanged. Claude Code clamps this variable to between 10 seconds and 30 minutes. Requires Claude Code v2.1.210 or later `CLAUDE_CLIENT_PRESENCE_FILE`| Path to a file that an external tool, such as a screen-lock listener, creates when you unlock your screen and deletes when you lock it. While the file exists, Claude Code skips [Remote Control mobile push notifications](</docs/en/remote-control#mobile-push-notifications>), so you stop getting pushes while you are actively using the computer. When the file is absent or unreadable, notifications are sent as normal. Claude Code checks the file once per push-triggering event rather than polling it. Requires Claude Code v2.1.181 or later `CLAUDE_CODE_ACCESSIBILITY`| Set to `1` to keep the native terminal cursor visible and disable the inverted-text cursor indicator. Allows screen magnifiers like macOS Zoom to track cursor position `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD`| Set to `1` to load memory files from directories specified with `--add-dir`. Loads `CLAUDE.md`, `.claude/CLAUDE.md`, `.claude/rules/*.md`, and `CLAUDE.local.md`. By default, additional directories do not load memory files @@ -287,7 +288,7 @@ `CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS`| Maximum time in milliseconds that [non-interactive mode](</docs/en/headless#background-tasks-at-exit>) with the `-p` flag waits after the final turn for background subagents and workflows whose result is part of the output. Default: `600000`, or 10 minutes. When the cap is exceeded, remaining background tasks are terminated and the process exits. Set to `0` to wait indefinitely. This cap is separate from the five-second grace period that applies to plain background shells `CLAUDE_CODE_PROCESS_WRAPPER`| Launch the processes Claude Code starts from its own binary, such as the background service that hosts [agent view](</docs/en/agent-view>) sessions, through a corporate launcher given as an argv prefix like `/opt/corp/launcher`. Set it in the `env` block of user or [managed settings](</docs/en/permissions#managed-settings>), not as a shell export, so the detached background service inherits it; project and local settings can’t set it. Equivalent to the [`processWrapper` setting](</docs/en/settings#available-settings>), which requires Claude Code v2.1.210 or later; this variable takes precedence when both are set. The VS Code extension configures its own launcher separately through its `claudeProcessWrapper` setting. Ignored on Windows. See [Run Claude Code behind a corporate launcher](</docs/en/corporate-launcher>) for the value format, what the launcher covers, and the contract the launcher must satisfy. Requires Claude Code v2.1.208 or later `CLAUDE_CODE_PROPAGATE_TRACEPARENT`| Set to `1` to propagate W3C trace context when `ANTHROPIC_BASE_URL` points at a custom proxy. Propagation covers the `traceparent` header on model and HTTP MCP requests and the `TRACEPARENT` environment variable for Bash, PowerShell, and hook subprocesses. By default, propagation is enabled only when connected directly to the Anthropic API. Added in v2.1.152. See [Traces (beta)](</docs/en/monitoring-usage#traces-beta>) -`CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`| Set by host platforms that embed Claude Code and manage model provider routing on its behalf. When set, provider-selection, endpoint, and authentication variables such as `CLAUDE_CODE_USE_BEDROCK`, `ANTHROPIC_BASE_URL`, and `ANTHROPIC_API_KEY` in settings files are ignored so user settings cannot override the host’s routing. The automatic telemetry opt-out for Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry is also skipped, so telemetry follows the standard `DISABLE_TELEMETRY` opt-out. See [Default behaviors by API provider](</docs/en/data-usage#default-behaviors-by-api-provider>) +`CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`| Set by host platforms that embed Claude Code and manage model provider routing on its behalf. When set, Claude Code ignores provider-selection, endpoint, and authentication variables such as `CLAUDE_CODE_USE_BEDROCK`, `ANTHROPIC_BASE_URL`, and `ANTHROPIC_API_KEY` in settings files, so user settings can’t override the host’s routing. Claude Code also ignores model-selection keys such as `model`, `fallbackModel`, and `modelOverrides` in [managed settings](</docs/en/permissions#managed-settings>), whichever managed source delivers them, so the host’s model configuration takes precedence over an out-of-date managed model pin; an [`availableModels`](</docs/en/model-config#restrict-model-selection>) allowlist in managed settings still applies unless the host supplies its own. Claude Code also skips the automatic telemetry opt-out for Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry, so telemetry follows the standard `DISABLE_TELEMETRY` opt-out. See [Default behaviors by API provider](</docs/en/data-usage#default-behaviors-by-api-provider>) `CLAUDE_CODE_PROXY_RESOLVES_HOSTS`| Set to `1` to allow the proxy to perform DNS resolution instead of the caller. Opt-in for environments where the proxy should handle hostname resolution `CLAUDE_CODE_REMOTE`| Set automatically to `true` when Claude Code is running as a [cloud session](</docs/en/claude-code-on-the-web>). Read this from a hook or setup script to detect whether you are in a cloud session `CLAUDE_CODE_REMOTE_SESSION_ID`| Set automatically in [cloud sessions](</docs/en/claude-code-on-the-web>) to the current session’s ID. Read this to construct a link back to the session transcript. See [Link output back to the session](</docs/en/cloud-environments#link-output-back-to-the-session>) @@ -336,13 +337,13 @@ `CLAUDE_CONFIG_DIR`| Override the configuration directory (default: `~/.claude`). All settings, session history, and plugins are stored under this path, as are credentials on Linux and Windows; on macOS, credentials are in the system Keychain. Useful for running multiple accounts side by side: for example, `alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'` `CLAUDE_DISABLE_ADOPT`| Set to `1` to stop in-flight background work instead of carrying it over when you background a session by pressing `←` or with [`/background`](</docs/en/agent-view#from-inside-a-session>). Claude Code asks you to confirm before backgrounding, then stops the tasks that would otherwise carry over. Requires Claude Code v2.1.195 or later `CLAUDE_EFFORT`| Set automatically in Bash tool subprocesses and hook commands to the active [effort level](</docs/en/model-config#adjust-effort-level>) for the turn: `low`, `medium`, `high`, `xhigh`, or `max`. Ultracode is not a distinct level and reports as `xhigh`. Matches the `effort.level` field passed to [hooks](</docs/en/hooks>). Only set when the current model supports the effort parameter -`CLAUDE_ENABLE_BYTE_WATCHDOG`| Set to `1` to force-enable the byte-level streaming idle watchdog, or set to `0` to force-disable it. When unset, the watchdog is enabled by default for direct Anthropic API and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) connections. The byte watchdog aborts a connection when no bytes arrive on the wire for 180 seconds by default on direct Anthropic API connections, 300 seconds on Claude Platform on AWS and when enabled on Amazon Bedrock, or for the value of `CLAUDE_STREAM_IDLE_TIMEOUT_MS` when that is set, which is clamped to a minimum of 5 minutes, independent of the event-level watchdog +`CLAUDE_ENABLE_BYTE_WATCHDOG`| Set to `1` to force-enable the byte-level streaming idle watchdog, or set to `0` to force-disable it. When unset, the watchdog is enabled by default for direct Anthropic API and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) connections, and for streaming responses on [gateway](</docs/en/gateways>) connections reached through `ANTHROPIC_BASE_URL` or `ANTHROPIC_AWS_BASE_URL`; before v2.1.222 it didn’t run on those gateway connections, so the event-level watchdog could report a stall there even while keep-alive pings were arriving. For timeouts and how the timers interact, see [Streaming idle watchdogs](</docs/en/network-config#streaming-idle-watchdogs>) `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK`| Set to `1` to enable the byte-level streaming idle watchdog on Amazon Bedrock `vnd.amazon.eventstream` responses. Off by default. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS` -`CLAUDE_ENABLE_STREAM_WATCHDOG`| Set to `0` to force-disable the event-level streaming idle watchdog, or set to `1` to force-enable it. When unset, the watchdog is on by default for all providers. Before v2.1.196, the unset default was server-controlled on the direct Anthropic API and off on other providers. As of v2.1.169, providers other than the direct Anthropic API and Claude Platform on AWS also have a default-on 5-minute body idle timeout independent of this variable; see `API_FORCE_IDLE_TIMEOUT`. On Amazon Bedrock, you can also enable the independent byte-level watchdog with `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK`; the two run together when both are set. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS` +`CLAUDE_ENABLE_STREAM_WATCHDOG`| Set to `0` to force-disable the event-level streaming idle watchdog, or set to `1` to force-enable it. When unset, the watchdog is on by default for all providers. Before v2.1.196, the unset default was server-controlled on the direct Anthropic API and off on other providers. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS`; for the other stall timers that run alongside this one, see [Streaming idle watchdogs](</docs/en/network-config#streaming-idle-watchdogs>) `CLAUDE_ENV_FILE`| Path to a shell script whose contents Claude Code runs before each Bash command in the same shell process, so exports in the file are visible to the command. Use to persist virtualenv or conda activation across commands. Also populated dynamically by [SessionStart](</docs/en/hooks#persist-environment-variables>), [Setup](</docs/en/hooks#setup>), [CwdChanged](</docs/en/hooks#cwdchanged>), and [FileChanged](</docs/en/hooks#filechanged>) hooks `CLAUDE_PID`| Claude Code sets this to its own process ID in the subprocesses it spawns: Bash and PowerShell tool commands and hook commands. On Linux, the Bash tool’s shell integration uses it to refuse a `pkill` pattern that would match the Claude Code process itself; see [the error reference](</docs/en/errors#pkill-pattern-matches-the-claude-code-process>). Read it from your own scripts to identify or signal the parent Claude Code process deliberately. Requires Claude Code v2.1.214 or later `CLAUDE_REMOTE_CONTROL_SESSION_NAME_PREFIX`| Prefix for auto-generated [Remote Control](</docs/en/remote-control>) session names when no explicit name is provided. Defaults to your machine’s hostname, producing names like `myhost-graceful-unicorn`. The `--remote-control-session-name-prefix` CLI flag sets the same value for a single invocation -`CLAUDE_STREAM_IDLE_TIMEOUT_MS`| Timeout in milliseconds before the streaming idle watchdog closes a stalled connection. When you set this variable explicitly, the minimum is `300000` (5 minutes); lower values are silently clamped to absorb extended thinking pauses and proxy buffering. When unset, the event-level watchdog defaults to 300 seconds and the byte-level watchdog defaults to 180 seconds on direct Anthropic API connections (300 seconds on Claude Platform on AWS and other providers). The unset 180-second byte-watchdog default is a separate value and is not subject to the 5-minute clamp. The body idle timeout described under `API_FORCE_IDLE_TIMEOUT` applies independently. On Amazon Bedrock, also applies when `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK=1` +`CLAUDE_STREAM_IDLE_TIMEOUT_MS`| Timeout in milliseconds before the event- and byte-level streaming idle watchdogs close a stalled connection. When you set this variable explicitly, the minimum is `300000` (5 minutes); lower values are silently clamped to absorb extended thinking pauses and proxy buffering, and the byte-level watchdog caps the value at 30 minutes. `CLAUDE_BYTE_STREAM_IDLE_TIMEOUT_MS` takes precedence over this variable for the byte-level watchdog. For the per-watchdog unset defaults, see [Streaming idle watchdogs](</docs/en/network-config#streaming-idle-watchdogs>) `DEBUG`| Set to `1` to enable debug mode, equivalent to launching with [`--debug`](</docs/en/cli-reference#cli-flags>). Debug logs are written to `~/.claude/debug/<session-id>.txt`, or to the path set by `CLAUDE_CODE_DEBUG_LOGS_DIR`. Only the truthy values `1`, `true`, `yes`, and `on` enable debug mode, so namespace patterns like `DEBUG=express:*` set for other tools do not trigger it `DISABLE_AUTOUPDATER`| Set to `1` to disable automatic background updates. Manual `claude update` still works. Use `DISABLE_UPDATES` to block both `DISABLE_AUTO_COMPACT`| Set to `1` to disable automatic compaction when approaching the context limit. The manual `/compact` command remains available. Use when you want explicit control over when compaction occurs. Overrides the [`autoCompactEnabled`](</docs/en/settings#available-settings>) setting @@ -382,8 +383,9 @@ `MAX_STRUCTURED_OUTPUT_RETRIES`| Number of times to retry when the model’s response fails validation against the [`--json-schema`](</docs/en/cli-reference#cli-flags>) in non-interactive mode (the `-p` flag). Defaults to 5 `MAX_THINKING_TOKENS`| Fixed token budget for [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>). Claude Code caps it at one token below the request’s max output tokens and never below 1,024; see `CLAUDE_CODE_MAX_OUTPUT_TOKENS` for how that limit is set. When unset and thinking is enabled, models with [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) choose their own thinking depth, and other models use the cap. Set to `0` to disable thinking on the Anthropic API, except on Fable 5, which cannot have thinking turned off; on [third-party providers](</docs/en/third-party-integrations>), `0` omits the `thinking` parameter instead. Nonzero values are ignored on adaptive reasoning models unless `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` is set `MCP_CLIENT_SECRET`| OAuth client secret for MCP servers that require [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>). Avoids the interactive prompt when adding a server with `--client-secret` -`MCP_CONNECTION_NONBLOCKING`| Controls whether startup waits for MCP servers to connect before the first query. As of Claude Code v2.1.142, MCP startup is non-blocking by default: servers connect in the background and their tools become available as they finish. Set to `0` to restore the blocking 5-second connection wait. Servers configured with [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>) still block startup regardless, since their tools must be present when the first prompt is built -`MCP_CONNECT_TIMEOUT_MS`| How long blocking MCP startup waits, in milliseconds, for the connection batch before snapshotting the tool list (default: 5000). Applies when `MCP_CONNECTION_NONBLOCKING=0` or for servers marked [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>). Servers still pending at the deadline keep connecting in the background but won’t appear until the next query. Distinct from `MCP_TIMEOUT`, which bounds an individual server’s connect attempt +`MCP_CONNECTION_NONBLOCKING`| Controls whether startup waits for MCP servers to connect before the first query. MCP startup is non-blocking by default: servers connect in the background and their tools become available as they finish; before v2.1.142, the blocking wait was the default. Set to `0` to restore the blocking 5-second connection wait. Servers configured with [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>) still make startup wait regardless, except when served from the [discovery cache](</docs/en/mcp#managing-your-servers>), since their tools must be present when the first prompt is built. In non-interactive mode (`-p`), Claude Code also waits for still-pending servers before the first turn regardless of this variable, with a longer deadline when you pass [`--mcp-config`](</docs/en/cli-reference#cli-flags>) explicitly; see that flag’s entry for the cached-server exception +`MCP_CONNECT_TIMEOUT_MS`| How long blocking MCP startup waits, in milliseconds, for the connection batch before snapshotting the tool list (default: 5000). Applies when `MCP_CONNECTION_NONBLOCKING=0` or for servers marked [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>). Servers still pending at the deadline keep connecting in the background. Distinct from `MCP_TIMEOUT`, which bounds an individual server’s connect attempt +`MCP_DISCOVERY_CACHE`| Set to `0` to turn off the cross-process MCP discovery cache, so every server connects at startup instead of showing the [`connects on first use` cached status](</docs/en/mcp#managing-your-servers>) and connecting on its first tool call. The cached status requires Claude Code v2.1.221 or later `MCP_OAUTH_CALLBACK_PORT`| Fixed port for the OAuth redirect callback, as an alternative to `--callback-port` when adding an MCP server with [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>) `MCP_REMOTE_SERVER_CONNECTION_BATCH_SIZE`| Maximum number of remote MCP servers (HTTP/SSE) to connect in parallel during startup (default: 20) `MCP_SERVER_CONNECTION_BATCH_SIZE`| Maximum number of local MCP servers (stdio) to connect in parallel during startup (default: 3)
modified
--- a/env-vars.md +++ b/env-vars.md @@ -157,8 +157,8 @@ `API_TIMEOUT_MS`| Timeout for API requests in milliseconds (default: 600000, or 10 minutes; maximum: 2147483647). Increase this when requests time out on slow networks or when routing through a proxy. Values above the maximum overflow the underlying timer and cause requests to fail immediately `AWS_BEARER_TOKEN_BEDROCK`| Amazon Bedrock API key for authentication (see [Amazon Bedrock API keys](<https://aws.amazon.com/blogs/machine-learning/accelerate-ai-development-with-amazon-bedrock-api-keys/>)) `BASH_DEFAULT_TIMEOUT_MS`| Default timeout for long-running bash commands (default: 120000, or 2 minutes) -`BASH_MAX_OUTPUT_LENGTH`| Maximum number of characters in bash outputs before the full output is saved to a file and Claude receives the path plus a short preview. See [Bash tool behavior](</docs/en/tools-reference#bash-tool-behavior>) -`BASH_MAX_TIMEOUT_MS`| Maximum timeout the model can set for long-running bash commands (default: 600000, or 10 minutes) +`BASH_MAX_OUTPUT_LENGTH`| Maximum number of characters of bash output that Claude Code reads back into a command’s result (default: 30000; maximum: 150000). See [Output limits](</docs/en/tools-reference#output-limits>) +`BASH_MAX_TIMEOUT_MS`| Maximum timeout the model can set for long-running bash commands (default: 600000, or 10 minutes). The effective ceiling is the larger of this and `BASH_DEFAULT_TIMEOUT_MS` `CCR_FORCE_BUNDLE`| Set to `1` to force [`claude --cloud`](</docs/en/claude-code-on-the-web#send-local-repositories-without-github>) to bundle and upload your local repository even when GitHub access is available `CLAUDECODE`| Set to `1` in subprocesses Claude Code spawns (Bash and PowerShell tools, tmux sessions, [hook](</docs/en/hooks>) commands, [status line](</docs/en/statusline>) commands, stdio [MCP server](</docs/en/mcp>) subprocesses). IDE extensions also set this in their integrated terminals. Use to detect when a script is running inside a subprocess spawned by Claude Code. To check whether the current process was spawned directly by a tool call or hook, rather than inside a stdio MCP server that Claude Code started, use `CLAUDE_CODE_CHILD_SESSION` instead `CLAUDE_AFK_COUNTDOWN_MS`| How many milliseconds before auto-continue the on-screen countdown appears on an unanswered [`AskUserQuestion`](</docs/en/tools-reference>) dialog. Default `20000` (20 seconds), capped at the auto-continue timeout. Has no effect unless auto-continue is on; see the [`askUserQuestionTimeout`](</docs/en/settings#available-settings>) setting and `CLAUDE_AFK_TIMEOUT_MS`. Requires Claude Code v2.1.198 or later @@ -166,7 +166,7 @@ `CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS`| Set to `1` to disable all built-in [subagent](</docs/en/sub-agents>) types such as Explore and Plan. Only applies in non-interactive mode (the `-p` flag). Useful for SDK users who want a blank slate `CLAUDE_AGENT_SDK_MCP_NO_PREFIX`| Set to `1` to skip the `mcp__<server>__` prefix on tool names from SDK-created MCP servers. Tools use their original names. SDK usage only `CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS`| Stall timeout in milliseconds for background subagents. Default `600000` (10 minutes). The timer resets on each streaming progress event; if no progress arrives within the window, the subagent is aborted and the task is marked failed, surfacing any partial result to the parent -`CLAUDE_AUTOCOMPACT_PCT_OVERRIDE`| Set the percentage (1-100) of the auto-compaction window at which auto-compaction triggers. Use lower values like `50` to compact earlier. This variable only causes earlier compaction when Claude Code compacts proactively: when `CLAUDE_CODE_AUTO_COMPACT_WINDOW` is set, in [cloud sessions](</docs/en/claude-code-on-the-web>), and on Sonnet 4.6 and Opus 4.6 without [extended context](</docs/en/model-config#extended-context>), which compact at the 200K boundary by default. On Sonnet 5, proactive compaction applies at the model’s [default threshold](</docs/en/model-config#sonnet-5-context-window>). In other cases, such as a local session on Opus 4.8, auto-compaction triggers when the conversation reaches the model’s context limit. The override can only lower the threshold, so values above the default have no effect. Applies to both main conversations and subagents +`CLAUDE_AUTOCOMPACT_PCT_OVERRIDE`| Set the percentage (1-100) of the auto-compact window at which auto-compaction triggers. Use lower values like `50` to compact earlier; the variable can’t raise the threshold, so values above the default percentage are ignored. It applies only in sessions that [compact before the model’s context limit](</docs/en/context-window#set-the-auto-compact-window>). Applies to both main conversations and subagents `CLAUDE_AUTO_BACKGROUND_TASKS`| Set to `1` to force-enable automatic backgrounding of long-running agent tasks. When enabled, subagents are moved to the background after running for approximately two minutes. Also enables [automatic backgrounding of long MCP tool calls](</docs/en/mcp#automatic-backgrounding-of-long-tool-calls>) in non-interactive mode on Claude Code v2.1.212 or later `CLAUDE_AX_SCREEN_READER`| Set to `1` to render screen-reader friendly output: flat text without decorative borders or animations. Set to `0` to force screen-reader mode off even when [`axScreenReader`](</docs/en/settings#available-settings>) is `true`. The [`--ax-screen-reader`](</docs/en/cli-reference#cli-flags>) flag takes precedence. Requires Claude Code v2.1.181 or later `CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR`| Return to the original working directory after each Bash or PowerShell command in the main session @@ -178,7 +178,7 @@ `CLAUDE_CODE_API_KEY_HELPER_TTL_MS`| Interval in milliseconds at which credentials should be refreshed (when using [`apiKeyHelper`](</docs/en/settings#available-settings>)) `CLAUDE_CODE_ARTIFACT_AUTO_OPEN`| Set to `0` to stop Claude Code from opening the browser automatically when a new [artifact](</docs/en/artifacts>) is published. Republishing an existing artifact does not open the browser regardless of this setting `CLAUDE_CODE_ATTRIBUTION_HEADER`| Set to `0` to omit the [attribution block](</docs/en/llm-gateway-protocol#system-prompt-attribution-block>), which carries the client version and a prompt fingerprint, from the start of the system prompt. Caching on a direct connection to the Anthropic API is unaffected either way. Before v2.1.181 the block included a per-request token on custom base URLs and Microsoft Foundry connections, so on those versions set it to `0` when your [LLM gateway](</docs/en/llm-gateway>) caches on the request body or forwards requests to a third-party provider, or when you connect to Microsoft Foundry directly -`CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the context capacity in tokens used for auto-compaction calculations. Defaults to the model’s context window, 200K for standard models or 1M for [extended context](</docs/en/model-config#extended-context>) models, except on Sonnet 5, which has its own [default threshold](</docs/en/model-config#sonnet-5-context-window>). Use a lower value like `500000` on a 1M model to treat the window as 500K for compaction purposes. The value is capped at the model’s actual context window. `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` is applied as a percentage of this value. Setting this variable decouples the compaction threshold from the status line’s `used_percentage`, which always uses the model’s full context window +`CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the [auto-compact window](</docs/en/context-window#set-the-auto-compact-window>) in tokens, from `100000` to `1000000`. Accepts a plain integer such as `500000` only: a value like `500k` reads as `500` and clamps to the 100K minimum. Takes precedence over the `/autocompact` command, the `--autocompact` flag, and the `autoCompactWindow` setting. The status line’s `used_percentage` always measures against the model’s full context window, so once this variable is set, that percentage no longer indicates when compaction will run `CLAUDE_CODE_AUTO_CONNECT_IDE`| Override automatic [IDE connection](</docs/en/vs-code>). By default, Claude Code connects automatically when launched inside a supported IDE’s integrated terminal. Set to `false` to prevent this. Set to `true` to force a connection attempt when auto-detection fails, such as when tmux obscures the parent terminal. Takes precedence over the [`autoConnectIde`](</docs/en/settings#global-config-settings>) global config setting `CLAUDE_CODE_AWS_CHAIN_RESOLVE_TIMEOUT_MS`| Time in milliseconds Claude Code waits for the AWS default credential provider chain to produce credentials before the request fails with [`AWS default-chain credential resolve timed out`](</docs/en/errors#aws-default-chain-credential-resolve-timed-out>) (default: `60000`). Raise it when a step in your chain legitimately needs longer, such as a browser-based SSO sign-in with MFA through a wrapper like `aws-vault`. Applies wherever Claude Code signs with the default chain: [Amazon Bedrock](</docs/en/amazon-bedrock#credential-caching-and-resolution-timeout>), [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), and the [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>). Requires Claude Code v2.1.207 or later `CLAUDE_CODE_BRIDGE_SESSION_ID`| Set automatically in Bash tool and [hook command](</docs/en/hooks>) subprocesses while the session has an active [Remote Control](</docs/en/remote-control>) connection, and removed when the connection ends. The value is the session’s ID in `session_` form, the same identifier that appears in the session’s `claude.ai/code` URL, so a script can link back to the session that ran it. Requires Claude Code v2.1.199 or later. In [cloud sessions](</docs/en/claude-code-on-the-web>), read `CLAUDE_CODE_REMOTE_SESSION_ID` instead @@ -291,7 +291,7 @@ `CLAUDE_CODE_PROXY_RESOLVES_HOSTS`| Set to `1` to allow the proxy to perform DNS resolution instead of the caller. Opt-in for environments where the proxy should handle hostname resolution `CLAUDE_CODE_REMOTE`| Set automatically to `true` when Claude Code is running as a [cloud session](</docs/en/claude-code-on-the-web>). Read this from a hook or setup script to detect whether you are in a cloud session `CLAUDE_CODE_REMOTE_SESSION_ID`| Set automatically in [cloud sessions](</docs/en/claude-code-on-the-web>) to the current session’s ID. Read this to construct a link back to the session transcript. See [Link output back to the session](</docs/en/cloud-environments#link-output-back-to-the-session>) -`CLAUDE_CODE_RESUME_INTERRUPTED_TURN`| Set to `1` to automatically resume if the previous session ended mid-turn. Used in SDK mode so the model continues without requiring the SDK to re-send the prompt. To turn this off, unset the variable, because setting it to `0` still triggers the resume in non-interactive mode +`CLAUDE_CODE_RESUME_INTERRUPTED_TURN`| Set to `1` to automatically resume if the previous session ended mid-turn. Used in SDK mode so the model continues without requiring the SDK to re-send the prompt. To turn this off, unset the variable or set it to `0`. Before v2.1.221, Claude Code ignored `0` and other falsy values, so setting `0` still triggered the resume in non-interactive mode and unsetting the variable was the only way to turn it off `CLAUDE_CODE_RESUME_INTERRUPTED_TURN_MAX_AGE_MS`| Maximum age in milliseconds of the last transcript message for a session that ended mid-turn to continue automatically on resume. When the last message is older than this bound, Claude Code skips both the `CLAUDE_CODE_RESUME_INTERRUPTED_TURN` automatic resume and the injected `CLAUDE_CODE_RESUME_PROMPT` continuation message, and the session starts idle so you continue explicitly. Unset or `0` means no bound; a negative or non-numeric value applies a one-hour bound. Spawn scripts for long-running agents can set this so a restart against an old transcript doesn’t re-run a stale prompt. Claude Code sets a one-hour bound itself when it restarts a crashed [agent view](</docs/en/agent-view>) session that inherited its conversation from an interactive session. Requires Claude Code v2.1.211 or later `CLAUDE_CODE_RESUME_PROMPT`| Override the continuation message injected when resuming a session that ended mid-turn. Defaults to `Continue from where you left off.`. Spawn scripts for long-running agents can set this to a more directive boot message. An empty string uses the default `CLAUDE_CODE_RETRY_WATCHDOG`| Set to `1` for unattended sessions such as eval harnesses, CI jobs, or remote workers. Retries `429` and `529` capacity errors indefinitely instead of failing after `CLAUDE_CODE_MAX_RETRIES` attempts. The watchdog backs off up to 5 minutes between attempts, or until the limit resets when the response carries a rate-limit reset time, so a session that hits a usage limit waits out the remaining window. As of v2.1.199 it also raises the default retry count for other transient errors, such as server errors, timeouts, and dropped connections, to 300, roughly three hours of backoff, and removes the cap of 15 on `CLAUDE_CODE_MAX_RETRIES` if you set that variable explicitly. Requires Claude Code v2.1.186 or later @@ -370,7 +370,7 @@ `ENABLE_CLAUDEAI_MCP_SERVERS`| Set to `false` to disable [claude.ai MCP servers](</docs/en/mcp#use-mcp-servers-from-claude-ai>) in Claude Code. Enabled by default for logged-in users. To disable per-project or per-org, set [`disableClaudeAiConnectors`](</docs/en/settings#available-settings>) in settings instead `ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) instead of the default 5 minutes. Intended for API key, [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), [Microsoft Foundry](</docs/en/microsoft-foundry>), and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) users. Subscription users within included usage receive 1-hour TTL automatically. 1-hour cache writes are billed at a higher rate `ENABLE_PROMPT_CACHING_1H_BEDROCK`| Deprecated. Use `ENABLE_PROMPT_CACHING_1H` instead -`ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset: all MCP tools deferred by default, but loaded upfront on Google Cloud’s Agent Platform, when `ANTHROPIC_BASE_URL` points to a non-first-party host, or on a Microsoft Foundry deployment hosted on Azure. Values: `true` (always defer and send the beta header, except on a Microsoft Foundry deployment hosted on Azure, where the server-side rejection still forces upfront loading; requests fail on Google Cloud’s Agent Platform models earlier than Sonnet 4.5 or Opus 4.5, or on proxies that do not support `tool_reference`), `auto` (threshold mode: load upfront if tools fit within 10% of context), `auto:N` (custom threshold, e.g., `auto:5` for 5%), `false` (load all upfront). Ignored when `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS` is set, which forces all tools to load upfront +`ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset: all MCP tools deferred by default, but loaded upfront on Google Cloud’s Agent Platform models earlier than the Claude 4.5 generation, when `ANTHROPIC_BASE_URL` points to a non-first-party host, or on a Microsoft Foundry deployment hosted on Azure. Values: `true` (always defer and send the beta header, except on a Microsoft Foundry deployment hosted on Azure and on Google Cloud’s Agent Platform models earlier than the Claude 4.5 generation, where Claude Code still loads tools upfront; requests fail on proxies that don’t support `tool_reference`), `auto` (threshold mode: load upfront if tools fit within 10% of context), `auto:N` (custom threshold, e.g., `auto:5` for 5%), `false` (load all upfront). Ignored when `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS` is set, which forces all tools to load upfront. Before v2.1.221, Claude Code disabled tool search for all models on Google Cloud’s Agent Platform unless you set this variable to `true` `FALLBACK_FOR_ALL_PRIMARY_MODELS`| Set to any non-empty value, such as `1`, to make every model stop retrying with a repeated-overload error when no fallback model is configured. **Setting it to`0` or `false` still enables this**, unlike most on/off variables; unset the variable to restore the default retry behavior. Without it, models Claude Code recognizes as Opus, Fable 5, or Mythos models stop retrying this way when you authenticate with an API key or a [third-party provider](</docs/en/third-party-integrations>) rather than a Claude subscription. As of v2.1.160, a configured [fallback model chain](</docs/en/model-config#fallback-model-chains>) triggers on repeated overload errors for any primary model, so this variable does not affect switching to a fallback model `FORCE_AUTOUPDATE_PLUGINS`| Set to `1` to force plugin auto-updates even when the main auto-updater is disabled via `DISABLE_AUTOUPDATER` `FORCE_HYPERLINK`| Set to `1` to enable clickable OSC 8 hyperlinks when your terminal supports them but isn’t auto-detected, or `0` to disable them. Claude Code parses this value as a number, not a boolean, so word spellings such as `false`, `no`, or `off` enable hyperlinks rather than disabling them
modified
--- a/env-vars.md +++ b/env-vars.md @@ -217,7 +217,7 @@ `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`| Set to any non-empty value, such as `1`, to disable nonessential network traffic: auto-updates, telemetry, error reporting, the `/feedback` command, release notes, [gateway model discovery](</docs/en/llm-gateway-connect#add-gateway-models-to-the-model-picker>) refreshes, and availability checks such as the [fast mode](</docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways>) check. **Setting it to`0` or `false` still disables this traffic**, unlike most on/off variables; unset the variable to allow it again. Also disables feature-flag fetching, which makes [Remote Control](</docs/en/remote-control#requirements>) unavailable. Official plugin marketplace auto-install isn’t covered; disable it with `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL` `CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK`| Set to `1` to disable the non-streaming fallback when a streaming request fails mid-stream. Streaming errors propagate to the retry layer instead. Useful when a proxy or gateway causes the fallback to produce duplicate tool execution `CLAUDE_CODE_DISABLE_NOTIFICATION_PRESENCE_CHECK`| Set to `1` to send the `PushNotification` tool’s desktop notification even while you are typing in or focused on the terminal. By default the tool skips both the desktop notification and the [mobile push](</docs/en/remote-control#mobile-push-notifications>) when it detects recent keyboard activity or terminal focus. This variable disables only that local check, so the server can still suppress the mobile push when it detects that you are active. Requires Claude Code v2.1.193 or later -`CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL`| Set to `1` to skip automatic addition of the official plugin marketplace on first run +`CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL`| Set to `1` to disable automatic registration of the official plugin marketplace. Claude Code reads the variable when it is about to register the marketplace, usually during a machine’s first interactive launch. If the variable is set at that point, Claude Code skips the registration permanently. Unsetting the variable later doesn’t undo the skip. Run `claude plugin marketplace add anthropics/claude-plugins-official` to register the marketplace at any time `CLAUDE_CODE_DISABLE_POLICY_SKILLS`| Set to `1` to skip loading skills from the system-wide managed skills directory. Useful for container or CI sessions that should not load operator-provisioned skills `CLAUDE_CODE_DISABLE_TERMINAL_TITLE`| Set to `1` to disable automatic terminal title updates based on conversation context. In Agent SDK and `claude -p` sessions, this also skips the background small/fast-model request that generates the session title `CLAUDE_CODE_DISABLE_THINKING`| Set to `1` to omit the `thinking` parameter from API requests entirely. This is a compatibility option for proxies and gateways that reject the parameter. The variable’s behavior is unchanged from earlier versions; on models that think by default, omitting the parameter means the model may still think. To explicitly disable [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) on the Anthropic API, use `MAX_THINKING_TOKENS=0` instead, which is also ineffective on Fable 5 since it cannot have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `0` likewise omits the parameter, so the two variables behave the same there
modified
Show diff (201 lines)
--- a/env-vars.md +++ b/env-vars.md @@ -78,7 +78,7 @@ ---|--- `~/.claude/settings.json`| You, in every project `.claude/settings.json`| Everyone working in the project, checked into source control -`.claude/settings.local.json`| You, in this project only (add it to your gitignore if you create it by hand) +`.claude/settings.local.json`| You, in this project only, gitignored when Claude Code saves a setting to it; add it to your gitignore if you create it by hand Managed settings| Everyone in your organization, deployed by an admin See [Settings files](</docs/en/settings#settings-files>) for where each file lives and [Settings precedence](</docs/en/settings#settings-precedence>) for how they combine when more than one sets the same variable. @@ -89,7 +89,7 @@ Precedence -Where the same behavior has both an environment variable and a settings field, the environment variable takes precedence. For example, `ANTHROPIC_MODEL` overrides the `model` setting, and `CLAUDE_CODE_AUTO_CONNECT_IDE` overrides `autoConnectIde`. The settings field applies when the environment variable is not set. When the same variable is set in both your shell and a settings file `env` block, the settings file value applies. Claude Code writes each `env` entry into the process environment at startup and again when the file changes, replacing the value inherited from the shell. A few variables are special-cased; the [`env` setting](</docs/en/settings#available-settings>) lists the exceptions. Between settings files, `env` values follow [settings precedence](</docs/en/settings#settings-precedence>), so a managed settings entry overrides the same variable in user or project settings. How an environment variable interacts with CLI flags and in-session commands varies per feature: `--model` and `/model` override `ANTHROPIC_MODEL`, while `CLAUDE_CODE_EFFORT_LEVEL` overrides `/effort`. When a variable interacts with another configuration source, its row in the Variables list states the precedence or links to the page that documents it. Claude Code reads shell environment variables at startup, so changes to them take effect the next time you launch `claude`. Variables set under the `env` key in settings files are reapplied to a running session when the file changes, with the startup-only exception described in In settings files. +Some behaviors have both an environment variable and a dedicated settings key. If you set both, the environment variable takes precedence. For example, `ANTHROPIC_MODEL` overrides the `model` setting, and `CLAUDE_CODE_AUTO_CONNECT_IDE` overrides `autoConnectIde`. Claude Code uses the settings key only when the environment variable is unset. When the same variable is set in both your shell and a settings file `env` block, the settings file value applies. Claude Code writes each `env` entry into the process environment at startup and again when the file changes, replacing the value inherited from the shell. A few variables are special-cased; the [`env` setting](</docs/en/settings#available-settings>) lists the exceptions. In a settings file you can set a variable but you can’t remove one. To override a variable you can’t unset, such as a stale `CLAUDE_CODE_USE_VERTEX` exported by a shell profile you don’t control, set it to an empty string in the `env` block: `"CLAUDE_CODE_USE_VERTEX": ""`. Claude Code treats the empty value as unset for provider selection. Subprocesses still inherit the empty value. Between settings files, `env` values follow [settings precedence](</docs/en/settings#settings-precedence>), so a managed settings entry overrides the same variable in user or project settings. How an environment variable interacts with CLI flags and in-session commands varies per feature: `--model` and `/model` override `ANTHROPIC_MODEL`, while `CLAUDE_CODE_EFFORT_LEVEL` overrides `/effort`. When a variable interacts with another configuration source, its row in the Variables list states the precedence or links to the page that documents it. Claude Code reads shell environment variables at startup, so changes to them take effect the next time you launch `claude`. Variables set under the `env` key in settings files are reapplied to a running session when the file changes, with the startup-only exception described in In settings files. ## @@ -98,6 +98,17 @@ Variables Numeric variables such as timeouts, token budgets, and retry counts accept scientific notation and digit-separator spellings in addition to plain digits, except where a variable’s row notes it takes plain digits only. For example, Claude Code reads `2e3` as 2000 and `64_000` as 64000. Before v2.1.211, these spellings could silently set a much smaller value, such as `1e6` setting a timeout to 1. + +For variables that turn a behavior on or off, set `1` or `true` to turn it on and `0` or `false` to turn it off, in any casing.Some variables read only whether you set them at all, so any non-empty value including `0` turns the behavior on, and you turn the behavior off by unsetting the variable or setting it to an empty value. These variables work that way: + + * `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` + * `DISABLE_TELEMETRY` + * `DISABLE_ERROR_REPORTING` + * `CLAUDE_CODE_TMUX_TRUECOLOR` + * `FALLBACK_FOR_ALL_PRIMARY_MODELS` + * `IS_DEMO` + +One other variable has its own rule: `FORCE_HYPERLINK` reads a number, so only `0` turns it off. Each variable’s row also states its own rule. Variable| Purpose ---|--- @@ -115,23 +126,23 @@ `ANTHROPIC_CUSTOM_MODEL_OPTION`| Model ID to add as a custom entry in the `/model` picker. Use this to make a non-standard or gateway-specific model selectable without replacing built-in aliases. See [Model configuration](</docs/en/model-config#add-a-custom-model-option>) `ANTHROPIC_CUSTOM_MODEL_OPTION_DESCRIPTION`| Display description for the custom model entry in the `/model` picker. Defaults to `Custom model (<model-id>)` when not set `ANTHROPIC_CUSTOM_MODEL_OPTION_NAME`| Display name for the custom model entry in the `/model` picker. Defaults to the model ID when not set -`ANTHROPIC_CUSTOM_MODEL_OPTION_SUPPORTED_CAPABILITIES`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) -`ANTHROPIC_DEFAULT_FABLE_MODEL`| See [Model configuration](</docs/en/model-config#environment-variables>) -`ANTHROPIC_DEFAULT_FABLE_MODEL_DESCRIPTION`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) -`ANTHROPIC_DEFAULT_FABLE_MODEL_NAME`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) -`ANTHROPIC_DEFAULT_FABLE_MODEL_SUPPORTED_CAPABILITIES`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) -`ANTHROPIC_DEFAULT_HAIKU_MODEL`| See [Model configuration](</docs/en/model-config#environment-variables>) -`ANTHROPIC_DEFAULT_HAIKU_MODEL_DESCRIPTION`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) -`ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) -`ANTHROPIC_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) -`ANTHROPIC_DEFAULT_OPUS_MODEL`| See [Model configuration](</docs/en/model-config#environment-variables>) -`ANTHROPIC_DEFAULT_OPUS_MODEL_DESCRIPTION`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) -`ANTHROPIC_DEFAULT_OPUS_MODEL_NAME`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) -`ANTHROPIC_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) -`ANTHROPIC_DEFAULT_SONNET_MODEL`| See [Model configuration](</docs/en/model-config#environment-variables>) -`ANTHROPIC_DEFAULT_SONNET_MODEL_DESCRIPTION`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) -`ANTHROPIC_DEFAULT_SONNET_MODEL_NAME`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) -`ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) +`ANTHROPIC_CUSTOM_MODEL_OPTION_SUPPORTED_CAPABILITIES`| Comma-separated list of [capabilities](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) the custom model supports, for example `effort,thinking`. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) +`ANTHROPIC_DEFAULT_FABLE_MODEL`| Model ID that the `fable` alias resolves to, and the ID Claude Code recognizes as Fable 5 for [automatic model fallback](</docs/en/model-config#automatic-model-fallback>) on third-party providers. See [Model configuration](</docs/en/model-config#environment-variables>) +`ANTHROPIC_DEFAULT_FABLE_MODEL_DESCRIPTION`| Display description for the pinned Fable model in the `/model` picker. Defaults to `Custom Fable model` when not set. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) +`ANTHROPIC_DEFAULT_FABLE_MODEL_NAME`| Display name for the pinned Fable model in the `/model` picker. Defaults to the model ID when not set. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) +`ANTHROPIC_DEFAULT_FABLE_MODEL_SUPPORTED_CAPABILITIES`| Comma-separated list of [capabilities](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) the pinned Fable model supports, for example `effort,thinking`. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) +`ANTHROPIC_DEFAULT_HAIKU_MODEL`| Model ID that the `haiku` alias resolves to, also used for [background functionality](</docs/en/costs#background-token-usage>). See [Model configuration](</docs/en/model-config#environment-variables>) +`ANTHROPIC_DEFAULT_HAIKU_MODEL_DESCRIPTION`| Display description for the pinned Haiku model in the `/model` picker. Defaults to `Custom Haiku model` when not set. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) +`ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME`| Display name for the pinned Haiku model in the `/model` picker. Defaults to the model ID when not set. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) +`ANTHROPIC_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES`| Comma-separated list of [capabilities](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) the pinned Haiku model supports, for example `effort,thinking`. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) +`ANTHROPIC_DEFAULT_OPUS_MODEL`| Model ID that the `opus` alias resolves to, and that `opusplan` uses while Plan Mode is active. See [Model configuration](</docs/en/model-config#environment-variables>) +`ANTHROPIC_DEFAULT_OPUS_MODEL_DESCRIPTION`| Display description for the pinned Opus model in the `/model` picker. When not set, defaults to `Custom Opus model`, or `Custom Opus model (1M context)` if the pinned model ID has the `[1m]` suffix and `CLAUDE_CODE_DISABLE_1M_CONTEXT` isn’t turned on. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) +`ANTHROPIC_DEFAULT_OPUS_MODEL_NAME`| Display name for the pinned Opus model in the `/model` picker. Defaults to the model ID when not set. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) +`ANTHROPIC_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES`| Comma-separated list of [capabilities](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) the pinned Opus model supports, for example `effort,thinking`. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) +`ANTHROPIC_DEFAULT_SONNET_MODEL`| Model ID that the `sonnet` alias resolves to, and that `opusplan` uses when Plan Mode is not active. See [Model configuration](</docs/en/model-config#environment-variables>) +`ANTHROPIC_DEFAULT_SONNET_MODEL_DESCRIPTION`| Display description for the pinned Sonnet model in the `/model` picker. When not set, defaults to `Custom Sonnet model`, or `Custom Sonnet model (1M context)` if the pinned model ID has the `[1m]` suffix and `CLAUDE_CODE_DISABLE_1M_CONTEXT` isn’t turned on. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) +`ANTHROPIC_DEFAULT_SONNET_MODEL_NAME`| Display name for the pinned Sonnet model in the `/model` picker. Defaults to the model ID when not set. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) +`ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES`| Comma-separated list of [capabilities](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) the pinned Sonnet model supports, for example `effort,thinking`. See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) `ANTHROPIC_FOUNDRY_API_KEY`| API key for Microsoft Foundry authentication (see [Microsoft Foundry](</docs/en/microsoft-foundry>)) `ANTHROPIC_FOUNDRY_AUTH_TOKEN`| Bearer token for Microsoft Foundry authentication, such as a Microsoft Entra access token. Claude Code sends it as the `Authorization: Bearer` header. Takes precedence over `ANTHROPIC_FOUNDRY_API_KEY` and over the Azure default credential chain. See [Microsoft Foundry](</docs/en/microsoft-foundry>). Requires Claude Code v2.1.203 or later `ANTHROPIC_FOUNDRY_BASE_URL`| Full base URL for the Microsoft Foundry resource (for example, `https://my-resource.services.ai.azure.com/anthropic`). Alternative to `ANTHROPIC_FOUNDRY_RESOURCE` (see [Microsoft Foundry](</docs/en/microsoft-foundry>)) @@ -166,7 +177,7 @@ `CLAUDE_CODE_ALWAYS_ENABLE_EFFORT`| Set to `1` to send the [effort](</docs/en/model-config#adjust-effort-level>) parameter with every request, even when Claude Code does not recognize the model ID as effort-capable. Use this when routing through an [LLM gateway](</docs/en/llm-gateway>) or third-party provider that serves models under custom identifiers. Models that reject the effort parameter at the API, including Claude 3 models, Sonnet 4.0 and 4.5, Opus 4.0 and 4.1, and Haiku 4.5, are still excluded so requests do not fail `CLAUDE_CODE_API_KEY_HELPER_TTL_MS`| Interval in milliseconds at which credentials should be refreshed (when using [`apiKeyHelper`](</docs/en/settings#available-settings>)) `CLAUDE_CODE_ARTIFACT_AUTO_OPEN`| Set to `0` to stop Claude Code from opening the browser automatically when a new [artifact](</docs/en/artifacts>) is published. Republishing an existing artifact does not open the browser regardless of this setting -`CLAUDE_CODE_ATTRIBUTION_HEADER`| Set to `0` to omit the attribution block (client version and prompt fingerprint) from the start of the system prompt. Disabling it improves prompt-cache hit rates when routing through an [LLM gateway](</docs/en/llm-gateway>). Caching on a direct connection to the Anthropic API is unaffected either way +`CLAUDE_CODE_ATTRIBUTION_HEADER`| Set to `0` to omit the [attribution block](</docs/en/llm-gateway-protocol#system-prompt-attribution-block>), which carries the client version and a prompt fingerprint, from the start of the system prompt. Caching on a direct connection to the Anthropic API is unaffected either way. Before v2.1.181 the block included a per-request token on custom base URLs and Microsoft Foundry connections, so on those versions set it to `0` when your [LLM gateway](</docs/en/llm-gateway>) caches on the request body or forwards requests to a third-party provider, or when you connect to Microsoft Foundry directly `CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the context capacity in tokens used for auto-compaction calculations. Defaults to the model’s context window, 200K for standard models or 1M for [extended context](</docs/en/model-config#extended-context>) models, except on Sonnet 5, which has its own [default threshold](</docs/en/model-config#sonnet-5-context-window>). Use a lower value like `500000` on a 1M model to treat the window as 500K for compaction purposes. The value is capped at the model’s actual context window. `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` is applied as a percentage of this value. Setting this variable decouples the compaction threshold from the status line’s `used_percentage`, which always uses the model’s full context window `CLAUDE_CODE_AUTO_CONNECT_IDE`| Override automatic [IDE connection](</docs/en/vs-code>). By default, Claude Code connects automatically when launched inside a supported IDE’s integrated terminal. Set to `false` to prevent this. Set to `true` to force a connection attempt when auto-detection fails, such as when tmux obscures the parent terminal. Takes precedence over the [`autoConnectIde`](</docs/en/settings#global-config-settings>) global config setting `CLAUDE_CODE_AWS_CHAIN_RESOLVE_TIMEOUT_MS`| Time in milliseconds Claude Code waits for the AWS default credential provider chain to produce credentials before the request fails with [`AWS default-chain credential resolve timed out`](</docs/en/errors#aws-default-chain-credential-resolve-timed-out>) (default: `60000`). Raise it when a step in your chain legitimately needs longer, such as a browser-based SSO sign-in with MFA through a wrapper like `aws-vault`. Applies wherever Claude Code signs with the default chain: [Amazon Bedrock](</docs/en/amazon-bedrock#credential-caching-and-resolution-timeout>), [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), and the [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>). Requires Claude Code v2.1.207 or later @@ -191,19 +202,19 @@ `CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_GUARD`| Set to `1` to skip the check that an [Amazon Bedrock](</docs/en/amazon-bedrock>) streaming response carries the `application/vnd.amazon.eventstream` content-type. Without this variable, a response with a different content-type fails with an error naming that content-type, which means a [gateway or proxy is transforming the response](</docs/en/amazon-bedrock#streaming-errors-behind-a-gateway-or-proxy>). Set it only when the gateway rewrites the `Content-Type` header but passes the binary event-stream body through unmodified; if the body itself was transformed, requests fail with `Truncated event message received` instead. Requires Claude Code v2.1.208 or later `CLAUDE_CODE_DISABLE_BG_EXIT_HANDOFF`| Set to `1` to stop a [background session’s](</docs/en/agent-view>) running background shell commands, dynamic workflows, and, as of v2.1.198, background subagents when the [supervisor](</docs/en/agent-view#the-supervisor-process>) stops, restarts, or updates that session’s process, instead of handing them to the session’s next process. Affects only that handoff: backgrounding a session with `←` or [`/background`](</docs/en/agent-view#from-inside-a-session>) still carries in-flight work over, and `CLAUDE_DISABLE_ADOPT` turns off both. Requires Claude Code v2.1.196 or later `CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP`| Set to `1` to stop Claude Code from terminating [background shell commands](</docs/en/interactive-mode#background-bash-commands>) when the operating system reports memory pressure. By default, on macOS and Linux, Claude Code terminates a background shell started in the main session on a memory-pressure signal once the session has been idle for 30 minutes and no turn or subagent is running. Windows has no memory-pressure signal, so this variable has no effect there. Requires Claude Code v2.1.193 or later -`CLAUDE_CODE_DISABLE_BUNDLED_SKILLS`| Set to `1` to disable the [skills](</docs/en/skills>) and workflows included with Claude Code: bundled skills and workflows are removed entirely, while built-in commands like `/init` stay typable but are hidden from the model. `/doctor` stays typable like the built-in commands; hide it with `DISABLE_DOCTOR_COMMAND` instead. Skills from plugins, `.claude/skills/`, and `.claude/commands/` are unaffected. Equivalent to the [`disableBundledSkills`](</docs/en/settings#available-settings>) setting; `0` doesn’t override it +`CLAUDE_CODE_DISABLE_BUNDLED_SKILLS`| Set to `1` to disable the [skills](</docs/en/skills>) and workflows included with Claude Code: bundled skills and workflows are removed entirely, while built-in commands like `/init` stay typable but are hidden from the model. `/doctor` stays typable like the built-in commands; hide it with `DISABLE_DOCTOR_COMMAND` instead. Skills from plugins, `.claude/skills/`, and `.claude/commands/` are unaffected. Equivalent to the [`disableBundledSkills`](</docs/en/settings#available-settings>) setting `CLAUDE_CODE_DISABLE_CLAUDE_MDS`| Set to `1` to prevent loading any CLAUDE.md memory files into context, including user, project, and auto-memory files `CLAUDE_CODE_DISABLE_CRON`| Set to `1` to disable [scheduled tasks](</docs/en/scheduled-tasks>). The `/loop` skill and cron tools become unavailable and any already-scheduled tasks stop firing, including tasks that are already running mid-session `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`| Set to `1` to strip Anthropic-specific `anthropic-beta` request headers and beta tool-schema fields (such as `defer_loading` and `eager_input_streaming`) from API requests. Use this when a proxy gateway rejects requests with errors like “Unexpected value(s) for the `anthropic-beta` header” or “Extra inputs are not permitted”. Standard fields (`name`, `description`, `input_schema`, `cache_control`) are preserved. [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) is disabled and all MCP tools load upfront, even when `ENABLE_TOOL_SEARCH` is set `CLAUDE_CODE_DISABLE_EXPLORE_PLAN_AGENTS`| Set to `1` to disable the built-in [Explore and Plan subagents](</docs/en/sub-agents#built-in-subagents>). Claude explores with its search tools or the general-purpose subagent instead, and [plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>) reads files directly rather than launching Explore and Plan agents. Custom subagents named `Explore` or `Plan` are unaffected. To remove every built-in subagent type in the Agent SDK or non-interactive mode, use `CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS` instead. Requires Claude Code v2.1.198 or later `CLAUDE_CODE_DISABLE_FAST_MODE`| Set to `1` to disable [fast mode](</docs/en/fast-mode>) `CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY`| Set to `1` to disable the “How is Claude doing?” session quality surveys. Surveys are also disabled when `DISABLE_TELEMETRY`, `DO_NOT_TRACK`, or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` is set, unless `CLAUDE_CODE_ENABLE_FEEDBACK_SURVEY_FOR_OTEL` opts back in. To set a sample rate instead of disabling outright, use the [`feedbackSurveyRate`](</docs/en/settings#available-settings>) setting. See [Session quality surveys](</docs/en/data-usage#session-quality-surveys>) -`CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING`| Set to `1` to disable file [checkpointing](</docs/en/checkpointing>). The `/rewind` command will not be able to restore code changes +`CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING`| Set to `1` to disable file [checkpointing](</docs/en/checkpointing>). The `/rewind` command will not be able to restore code changes. Overrides the [`fileCheckpointingEnabled`](</docs/en/settings#available-settings>) setting `CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS`| Set to `1` to remove built-in commit and PR workflow instructions and the git status snapshot from Claude’s system prompt. Useful when using your own git workflow skills. Takes precedence over the [`includeGitInstructions`](</docs/en/settings#available-settings>) setting when set `CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP`| Set to `1` to prevent automatic remapping of Opus 4.0 and 4.1 to the current Opus version on the Anthropic API. Use when you intentionally want to pin an older model. The remap does not run on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry `CLAUDE_CODE_DISABLE_MOUSE`| Set to `1` to disable mouse tracking in [fullscreen rendering](</docs/en/fullscreen>). Keyboard scrolling with `PgUp` and `PgDn` still works. Use this to keep your terminal’s native copy-on-select behavior `CLAUDE_CODE_DISABLE_MOUSE_CLICKS`| Set to `1` to disable click, drag, and hover handling in [fullscreen rendering](</docs/en/fullscreen>) while keeping mouse-wheel scrolling. Use this when you want wheel scroll to work inside Claude Code but don’t want clicks to position the cursor, expand tool output, or open links. `CLAUDE_CODE_DISABLE_MOUSE` takes precedence when both are set. Requires Claude Code v2.1.195 or later -`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`| Set to any non-empty value to disable nonessential network traffic: auto-updates, telemetry, error reporting, the `/feedback` command, release notes, [gateway model discovery](</docs/en/llm-gateway-connect#add-gateway-models-to-the-model-picker>) refreshes, and availability checks such as the [fast mode](</docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways>) check. Official plugin marketplace auto-install isn’t covered; disable it with `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL` +`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`| Set to any non-empty value, such as `1`, to disable nonessential network traffic: auto-updates, telemetry, error reporting, the `/feedback` command, release notes, [gateway model discovery](</docs/en/llm-gateway-connect#add-gateway-models-to-the-model-picker>) refreshes, and availability checks such as the [fast mode](</docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways>) check. **Setting it to`0` or `false` still disables this traffic**, unlike most on/off variables; unset the variable to allow it again. Also disables feature-flag fetching, which makes [Remote Control](</docs/en/remote-control#requirements>) unavailable. Official plugin marketplace auto-install isn’t covered; disable it with `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL` `CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK`| Set to `1` to disable the non-streaming fallback when a streaming request fails mid-stream. Streaming errors propagate to the retry layer instead. Useful when a proxy or gateway causes the fallback to produce duplicate tool execution `CLAUDE_CODE_DISABLE_NOTIFICATION_PRESENCE_CHECK`| Set to `1` to send the `PushNotification` tool’s desktop notification even while you are typing in or focused on the terminal. By default the tool skips both the desktop notification and the [mobile push](</docs/en/remote-control#mobile-push-notifications>) when it detects recent keyboard activity or terminal focus. This variable disables only that local check, so the server can still suppress the mobile push when it detects that you are active. Requires Claude Code v2.1.193 or later `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL`| Set to `1` to skip automatic addition of the official plugin marketplace on first run @@ -243,7 +254,7 @@ `CLAUDE_CODE_IDE_SKIP_VALID_CHECK`| Set to `1` to skip validation of IDE lockfile entries during connection. Use when auto-connect fails to find your IDE despite it running `CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS`| How many [subagents](</docs/en/sub-agents#concurrent-subagent-limit>) can be running in one session before the Agent tool refuses to spawn another (default: 20). Accepts a positive whole number in plain digits; anything else is ignored, so the variable can adjust the cap but can’t disable it. Requires Claude Code v2.1.217 or later `CLAUDE_CODE_MAX_CONTEXT_TOKENS`| Override the context window size Claude Code assumes for the active model. As of v2.1.193, applied directly for model names Claude Code does not recognize as a Claude model; for recognized Claude models it only takes effect when `DISABLE_COMPACT` is also set. Use this when routing to a model through `ANTHROPIC_BASE_URL` whose context window does not match the built-in size for its name -`CLAUDE_CODE_MAX_OUTPUT_TOKENS`| Set the maximum number of output tokens for most requests. Defaults and caps vary by model; see [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>). Increasing this value reduces the effective context window available before [auto-compaction](</docs/en/costs#reduce-token-usage>) triggers +`CLAUDE_CODE_MAX_OUTPUT_TOKENS`| Set the maximum number of output tokens for most requests. Defaults and caps vary by model; see [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>). Claude Code defaults to 32000 for model IDs it doesn’t recognize, such as gateway-specific names, and lowers values above a model’s cap to the cap. Increasing this value reduces the effective context window available before [auto-compaction](</docs/en/costs#reduce-token-usage>) triggers `CLAUDE_CODE_MAX_RETRIES`| Override the number of times to retry failed API requests (default: 10). Capped at 15 as of v2.1.186; as of v2.1.199, `CLAUDE_CODE_RETRY_WATCHDOG` raises the default and removes the cap. For unattended sessions that need to wait through longer outages, set `CLAUDE_CODE_RETRY_WATCHDOG` instead `CLAUDE_CODE_MAX_SUBAGENTS_PER_SESSION`| Cap on the number of [subagents](</docs/en/sub-agents#session-subagent-limit>) one session can spawn with the Agent tool (default: 200). When Claude reaches the cap, spawning another subagent fails with an error telling Claude to finish the remaining work directly. Accepts a positive whole number in plain digits with no upper bound; this variable doesn’t take the scientific notation or digit-separator spellings. Anything else is ignored and the default applies, so the cap can be raised but not turned off. Requires Claude Code v2.1.212 or later `CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH`| Number of [subagent layers](</docs/en/sub-agents#let-subagents-spawn-their-own-subagents>) allowed below the main conversation (default: 3). At the default, subagents can spawn their own subagents, and a subagent at the third layer can’t spawn further; set `1` to turn nesting off. In v2.1.217 through v2.1.218, the default was 1, so a subagent couldn’t spawn its own unless you raised the limit; v2.1.219 raised the default to 3. Accepts a positive whole number in plain digits; anything else is ignored, so the limit can be adjusted but not removed. Requires Claude Code v2.1.217 or later @@ -278,9 +289,9 @@ `CLAUDE_CODE_PROPAGATE_TRACEPARENT`| Set to `1` to propagate W3C trace context when `ANTHROPIC_BASE_URL` points at a custom proxy. Propagation covers the `traceparent` header on model and HTTP MCP requests and the `TRACEPARENT` environment variable for Bash, PowerShell, and hook subprocesses. By default, propagation is enabled only when connected directly to the Anthropic API. Added in v2.1.152. See [Traces (beta)](</docs/en/monitoring-usage#traces-beta>) `CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`| Set by host platforms that embed Claude Code and manage model provider routing on its behalf. When set, provider-selection, endpoint, and authentication variables such as `CLAUDE_CODE_USE_BEDROCK`, `ANTHROPIC_BASE_URL`, and `ANTHROPIC_API_KEY` in settings files are ignored so user settings cannot override the host’s routing. The automatic telemetry opt-out for Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry is also skipped, so telemetry follows the standard `DISABLE_TELEMETRY` opt-out. See [Default behaviors by API provider](</docs/en/data-usage#default-behaviors-by-api-provider>) `CLAUDE_CODE_PROXY_RESOLVES_HOSTS`| Set to `1` to allow the proxy to perform DNS resolution instead of the caller. Opt-in for environments where the proxy should handle hostname resolution -`CLAUDE_CODE_REMOTE`| Set automatically to `true` when Claude Code is running as a [cloud session](</docs/en/claude-code-on-the-web>). Read this from a hook or setup script to detect whether you are in a cloud environment -`CLAUDE_CODE_REMOTE_SESSION_ID`| Set automatically in [cloud sessions](</docs/en/claude-code-on-the-web>) to the current session’s ID. Read this to construct a link back to the session transcript. See [Link output back to the session](</docs/en/claude-code-on-the-web#link-output-back-to-the-session>) -`CLAUDE_CODE_RESUME_INTERRUPTED_TURN`| Set to `1` to automatically resume if the previous session ended mid-turn. Used in SDK mode so the model continues without requiring the SDK to re-send the prompt +`CLAUDE_CODE_REMOTE`| Set automatically to `true` when Claude Code is running as a [cloud session](</docs/en/claude-code-on-the-web>). Read this from a hook or setup script to detect whether you are in a cloud session +`CLAUDE_CODE_REMOTE_SESSION_ID`| Set automatically in [cloud sessions](</docs/en/claude-code-on-the-web>) to the current session’s ID. Read this to construct a link back to the session transcript. See [Link output back to the session](</docs/en/cloud-environments#link-output-back-to-the-session>) +`CLAUDE_CODE_RESUME_INTERRUPTED_TURN`| Set to `1` to automatically resume if the previous session ended mid-turn. Used in SDK mode so the model continues without requiring the SDK to re-send the prompt. To turn this off, unset the variable, because setting it to `0` still triggers the resume in non-interactive mode `CLAUDE_CODE_RESUME_INTERRUPTED_TURN_MAX_AGE_MS`| Maximum age in milliseconds of the last transcript message for a session that ended mid-turn to continue automatically on resume. When the last message is older than this bound, Claude Code skips both the `CLAUDE_CODE_RESUME_INTERRUPTED_TURN` automatic resume and the injected `CLAUDE_CODE_RESUME_PROMPT` continuation message, and the session starts idle so you continue explicitly. Unset or `0` means no bound; a negative or non-numeric value applies a one-hour bound. Spawn scripts for long-running agents can set this so a restart against an old transcript doesn’t re-run a stale prompt. Claude Code sets a one-hour bound itself when it restarts a crashed [agent view](</docs/en/agent-view>) session that inherited its conversation from an interactive session. Requires Claude Code v2.1.211 or later `CLAUDE_CODE_RESUME_PROMPT`| Override the continuation message injected when resuming a session that ended mid-turn. Defaults to `Continue from where you left off.`. Spawn scripts for long-running agents can set this to a more directive boot message. An empty string uses the default `CLAUDE_CODE_RETRY_WATCHDOG`| Set to `1` for unattended sessions such as eval harnesses, CI jobs, or remote workers. Retries `429` and `529` capacity errors indefinitely instead of failing after `CLAUDE_CODE_MAX_RETRIES` attempts. The watchdog backs off up to 5 minutes between attempts, or until the limit resets when the response carries a rate-limit reset time, so a session that hits a usage limit waits out the remaining window. As of v2.1.199 it also raises the default retry count for other transient errors, such as server errors, timeouts, and dropped connections, to 300, roughly three hours of backoff, and removes the cap of 15 on `CLAUDE_CODE_MAX_RETRIES` if you set that variable explicitly. Requires Claude Code v2.1.186 or later @@ -303,7 +314,7 @@ `CLAUDE_CODE_SKIP_PROMPT_HISTORY`| Set to `1` to skip writing prompt history and session transcripts to disk. Sessions started with this variable set do not appear in `--resume`, `--continue`, or up-arrow history. Useful for ephemeral scripted sessions `CLAUDE_CODE_SKIP_VERTEX_AUTH`| Skip Google authentication for Google Cloud’s Agent Platform (for example, when using an LLM gateway) `CLAUDE_CODE_STOP_HOOK_BLOCK_CAP`| Maximum number of consecutive times a [Stop](</docs/en/hooks#stop>) or [SubagentStop](</docs/en/hooks#subagentstop>) hook may block the turn from ending before Claude Code overrides it and ends the turn anyway (default: 8). Set to `0` to disable the cap. Raise this if your hook legitimately needs more iterations to resolve -`CLAUDE_CODE_SUBAGENT_MODEL`| See [Model configuration](</docs/en/model-config>). As of v2.1.196, setting it to `inherit` is the same as leaving it unset; earlier versions treated `inherit` as an override that forced every subagent onto the main conversation’s model +`CLAUDE_CODE_SUBAGENT_MODEL`| The model Claude Code uses for all [subagents](</docs/en/sub-agents#choose-a-model>), [agent teams](</docs/en/agent-teams>), and agents in a [workflow](</docs/en/workflows>). Accepts an alias such as `haiku` or a full model name, and takes precedence over the per-invocation `model` parameter and the subagent definition’s `model` frontmatter. See [Model configuration](</docs/en/model-config#environment-variables>). Setting it to `inherit` is the same as leaving it unset; before v2.1.196, `inherit` was an override that forced every subagent onto the main conversation’s model `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB`| Set to `1` to strip Anthropic and cloud provider credentials from subprocess environments (Bash tool, hooks, MCP stdio servers). The parent Claude process keeps these credentials for API calls, but child processes cannot read them, reducing exposure to prompt injection attacks that attempt to exfiltrate secrets via shell expansion. On Linux, this also runs Bash subprocesses in an isolated PID namespace so they cannot read host process environments via `/proc`; as a side effect, `ps`, `pgrep`, and `kill` cannot see or signal host processes. `claude-code-action` sets this automatically when `allowed_non_write_users` is configured `CLAUDE_CODE_SYNC_PLUGIN_INSTALL`| Set to `1` in non-interactive mode (the `-p` flag) to wait for plugin installation to complete before the first query. Without this, plugins install in the background and may not be available on the first turn. Combine with `CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS` to bound the wait `CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS`| Timeout in milliseconds for synchronous plugin installation. When exceeded, Claude Code proceeds without plugins and logs an error. No default: without this variable, synchronous installation waits until complete @@ -314,7 +325,7 @@ `CLAUDE_CODE_TASK_LIST_ID`| Share a task list across sessions. Set the same ID in multiple Claude Code instances to coordinate on a shared task list. See [Task list](</docs/en/interactive-mode#task-list>) `CLAUDE_CODE_TEAM_TEARDOWN_PARK_TIMEOUT_MS`| Override, in milliseconds, how long a non-interactive session waits at exit for its [agent team](</docs/en/agent-teams>) to finish tearing down. Accepts 1000 to 60000; an out-of-range value is ignored and the default of 10000 applies. Requires Claude Code v2.1.206 or later `CLAUDE_CODE_TMPDIR`| Override the temp directory used for internal temp files. Claude Code appends `/claude-{uid}/` on Unix or `/claude/` on Windows to this path. Default: `/tmp` on macOS, `os.tmpdir()` on Linux and Windows. As of v2.1.161, on macOS and Linux, [sandboxed](</docs/en/sandboxing>) Bash subprocesses receive a short fallback `$TMPDIR` under the system default when your override is a long path, since some tools fail when temp paths get too long. Unsandboxed Bash commands inherit your shell’s `$TMPDIR` unchanged. Claude Code’s own temp files always use your override -`CLAUDE_CODE_TMUX_TRUECOLOR`| Set to `1` to allow 24-bit truecolor output inside tmux. By default, Claude Code clamps to 256 colors when `$TMUX` is set because tmux does not pass through truecolor escape sequences unless configured to. Set this after adding `set -ga terminal-overrides ',*:Tc'` to your `~/.tmux.conf`. See [Terminal configuration](</docs/en/terminal-config>) for other tmux settings +`CLAUDE_CODE_TMUX_TRUECOLOR`| Set to any non-empty value, such as `1`, to allow 24-bit truecolor output inside tmux. **Setting it to`0` or `false` still allows truecolor**, unlike most on/off variables; unset the variable to restore the 256-color clamp. By default, Claude Code clamps to 256 colors when `$TMUX` is set because tmux does not pass through truecolor escape sequences unless configured to. Set this after adding `set -ga terminal-overrides ',*:Tc'` to your `~/.tmux.conf`. See [Terminal configuration](</docs/en/terminal-config>) for other tmux settings `CLAUDE_CODE_USE_ANTHROPIC_AWS`| Use [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) `CLAUDE_CODE_USE_BEDROCK`| Use [Amazon Bedrock](</docs/en/amazon-bedrock>) `CLAUDE_CODE_USE_FOUNDRY`| Use [Microsoft Foundry](</docs/en/microsoft-foundry>) @@ -334,14 +345,14 @@ `CLAUDE_STREAM_IDLE_TIMEOUT_MS`| Timeout in milliseconds before the streaming idle watchdog closes a stalled connection. When you set this variable explicitly, the minimum is `300000` (5 minutes); lower values are silently clamped to absorb extended thinking pauses and proxy buffering. When unset, the event-level watchdog defaults to 300 seconds and the byte-level watchdog defaults to 180 seconds on direct Anthropic API connections (300 seconds on Claude Platform on AWS and other providers). The unset 180-second byte-watchdog default is a separate value and is not subject to the 5-minute clamp. The body idle timeout described under `API_FORCE_IDLE_TIMEOUT` applies independently. On Amazon Bedrock, also applies when `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK=1` `DEBUG`| Set to `1` to enable debug mode, equivalent to launching with [`--debug`](</docs/en/cli-reference#cli-flags>). Debug logs are written to `~/.claude/debug/<session-id>.txt`, or to the path set by `CLAUDE_CODE_DEBUG_LOGS_DIR`. Only the truthy values `1`, `true`, `yes`, and `on` enable debug mode, so namespace patterns like `DEBUG=express:*` set for other tools do not trigger it `DISABLE_AUTOUPDATER`| Set to `1` to disable automatic background updates. Manual `claude update` still works. Use `DISABLE_UPDATES` to block both -`DISABLE_AUTO_COMPACT`| Set to `1` to disable automatic compaction when approaching the context limit. The manual `/compact` command remains available. Use when you want explicit control over when compaction occurs +`DISABLE_AUTO_COMPACT`| Set to `1` to disable automatic compaction when approaching the context limit. The manual `/compact` command remains available. Use when you want explicit control over when compaction occurs. Overrides the [`autoCompactEnabled`](</docs/en/settings#available-settings>) setting `DISABLE_COMPACT`| Set to `1` to disable all compaction: both automatic compaction and the manual `/compact` command `DISABLE_COST_WARNINGS`| Set to `1` to disable cost warning messages `DISABLE_DOCTOR_COMMAND`| Set to `1` to hide the [`/doctor`](</docs/en/commands#all-commands>) setup checkup skill and its `/checkup` alias. Useful for managed deployments where users shouldn’t run setup diagnostics from a session. Doesn’t affect the `claude doctor` terminal command. Before v2.1.205, this variable hid the `/doctor` diagnostics screen command -`DISABLE_ERROR_REPORTING`| Set to `1` to opt out of error reporting +`DISABLE_ERROR_REPORTING`| Set to any non-empty value, such as `1`, to opt out of error reporting. **Setting it to`0` or `false` still opts out**, unlike most on/off variables; unset the variable to turn error reporting back on `DISABLE_EXTRA_USAGE_COMMAND`| Set to `1` to hide the `/usage-credits` command that lets users purchase additional usage beyond rate limits `DISABLE_FEEDBACK_COMMAND`| Set to `1` to disable the `/feedback` command. Also disables `/bug` and `/share`, which report through the same path; before v2.1.212 they were aliases of `/feedback`, so the command was disabled under every name. The older name `DISABLE_BUG_COMMAND` is also accepted -`DISABLE_GROWTHBOOK`| Set to `1` to disable GrowthBook feature-flag fetching and use code defaults for every flag. Telemetry event logging stays on unless `DISABLE_TELEMETRY` is also set +`DISABLE_GROWTHBOOK`| Set to `1` to disable GrowthBook feature-flag fetching and use code defaults for every flag. This makes [Remote Control](</docs/en/remote-control#requirements>) unavailable. Telemetry event logging stays on unless `DISABLE_TELEMETRY` is also set `DISABLE_INSTALLATION_CHECKS`| Set to `1` to disable installation warnings. Use only when manually managing the installation location, as this can mask issues with standard installations `DISABLE_INSTALL_GITHUB_APP_COMMAND`| Set to `1` to hide the `/install-github-app` command. Already hidden when using third-party providers (Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry) `DISABLE_INTERLEAVED_THINKING`| Set to `1` to prevent sending the interleaved-thinking beta header. Useful when your LLM gateway or provider does not support [interleaved thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking#interleaved-thinking>) @@ -352,24 +363,24 @@ `DISABLE_PROMPT_CACHING_HAIKU`| Set to `1` to disable prompt caching for Haiku models `DISABLE_PROMPT_CACHING_OPUS`| Set to `1` to disable prompt caching for Opus models `DISABLE_PROMPT_CACHING_SONNET`| Set to `1` to disable prompt caching for Sonnet models -`DISABLE_TELEMETRY`| Set to `1` to opt out of telemetry. Telemetry events do not include user data like code, file paths, or bash commands. Also disables feature-flag fetching with the same effect as `DISABLE_GROWTHBOOK`, so some flagged features may be unavailable +`DISABLE_TELEMETRY`| Set to any non-empty value, such as `1`, to opt out of telemetry. **Setting it to`0` or `false` still opts out**, unlike most on/off variables; unset the variable to turn telemetry back on. Telemetry events do not include user data like code, file paths, or bash commands. Also disables feature-flag fetching with the same effect as `DISABLE_GROWTHBOOK`, which makes [Remote Control](</docs/en/remote-control#requirements>) unavailable `DISABLE_UPDATES`| Set to `1` to block all updates including manual `claude update` and `claude install`. Stricter than `DISABLE_AUTOUPDATER`. Use when distributing Claude Code through your own channels and users should not self-update `DISABLE_UPGRADE_COMMAND`| Set to `1` to hide the `/upgrade` command -`DO_NOT_TRACK`| Set to `1` to opt out of telemetry. Equivalent to setting `DISABLE_TELEMETRY`. Claude Code honors this as the cross-tool convention recognized by many developer CLIs +`DO_NOT_TRACK`| Set to `1` to opt out of telemetry, with the same effect as `DISABLE_TELEMETRY`, including making [Remote Control](</docs/en/remote-control#requirements>) unavailable. Claude Code reads this variable as a standard boolean, so `0` leaves telemetry on, and honors it as the cross-tool convention recognized by many developer CLIs `ENABLE_CLAUDEAI_MCP_SERVERS`| Set to `false` to disable [claude.ai MCP servers](</docs/en/mcp#use-mcp-servers-from-claude-ai>) in Claude Code. Enabled by default for logged-in users. To disable per-project or per-org, set [`disableClaudeAiConnectors`](</docs/en/settings#available-settings>) in settings instead `ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) instead of the default 5 minutes. Intended for API key, [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), [Microsoft Foundry](</docs/en/microsoft-foundry>), and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) users. Subscription users within included usage receive 1-hour TTL automatically. 1-hour cache writes are billed at a higher rate `ENABLE_PROMPT_CACHING_1H_BEDROCK`| Deprecated. Use `ENABLE_PROMPT_CACHING_1H` instead -`ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset: all MCP tools deferred by default, but loaded upfront on Google Cloud’s Agent Platform or when `ANTHROPIC_BASE_URL` points to a non-first-party host. Values: `true` (always defer and send the beta header, requests fail on Google Cloud’s Agent Platform models earlier than Sonnet 4.5 or Opus 4.5, or on proxies that do not support `tool_reference`), `auto` (threshold mode: load upfront if tools fit within 10% of context), `auto:N` (custom threshold, e.g., `auto:5` for 5%), `false` (load all upfront). Ignored when `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS` is set, which forces all tools to load upfront -`FALLBACK_FOR_ALL_PRIMARY_MODELS`| Set to any non-empty value to make all models, not only Opus, stop retrying with a repeated-overload error when no fallback model is configured. As of v2.1.160, a configured [fallback model chain](</docs/en/model-config#fallback-model-chains>) triggers on repeated overload errors for any primary model, so this variable does not affect switching to a fallback model +`ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset: all MCP tools deferred by default, but loaded upfront on Google Cloud’s Agent Platform, when `ANTHROPIC_BASE_URL` points to a non-first-party host, or on a Microsoft Foundry deployment hosted on Azure. Values: `true` (always defer and send the beta header, except on a Microsoft Foundry deployment hosted on Azure, where the server-side rejection still forces upfront loading; requests fail on Google Cloud’s Agent Platform models earlier than Sonnet 4.5 or Opus 4.5, or on proxies that do not support `tool_reference`), `auto` (threshold mode: load upfront if tools fit within 10% of context), `auto:N` (custom threshold, e.g., `auto:5` for 5%), `false` (load all upfront). Ignored when `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS` is set, which forces all tools to load upfront +`FALLBACK_FOR_ALL_PRIMARY_MODELS`| Set to any non-empty value, such as `1`, to make every model stop retrying with a repeated-overload error when no fallback model is configured. **Setting it to`0` or `false` still enables this**, unlike most on/off variables; unset the variable to restore the default retry behavior. Without it, models Claude Code recognizes as Opus, Fable 5, or Mythos models stop retrying this way when you authenticate with an API key or a [third-party provider](</docs/en/third-party-integrations>) rather than a Claude subscription. As of v2.1.160, a configured [fallback model chain](</docs/en/model-config#fallback-model-chains>) triggers on repeated overload errors for any primary model, so this variable does not affect switching to a fallback model `FORCE_AUTOUPDATE_PLUGINS`| Set to `1` to force plugin auto-updates even when the main auto-updater is disabled via `DISABLE_AUTOUPDATER` -`FORCE_HYPERLINK`| Set to `1` to enable clickable OSC 8 hyperlinks when your terminal supports them but isn’t auto-detected, or `0` to disable them +`FORCE_HYPERLINK`| Set to `1` to enable clickable OSC 8 hyperlinks when your terminal supports them but isn’t auto-detected, or `0` to disable them. Claude Code parses this value as a number, not a boolean, so word spellings such as `false`, `no`, or `off` enable hyperlinks rather than disabling them `FORCE_PROMPT_CACHING_5M`| Set to `1` to force the 5-minute prompt cache TTL even when 1-hour TTL would otherwise apply. Overrides `ENABLE_PROMPT_CACHING_1H` `HTTP_PROXY`| Specify HTTP proxy server for network connections `HTTPS_PROXY`| Specify HTTPS proxy server for network connections -`IS_DEMO`| Set to `1` to enable demo mode: hides your email and organization name from the header and `/status` output, and skips onboarding. Useful when streaming or recording a session +`IS_DEMO`| Set to any non-empty value, such as `1`, to enable demo mode: hides your email and organization name from the header and `/status` output, and skips onboarding. **Setting it to`0` or `false` still enables demo mode**, unlike most on/off variables; unset the variable to turn it off. Useful when streaming or recording a session `MAX_MCP_OUTPUT_TOKENS`| Maximum number of tokens allowed in MCP tool responses. Claude Code displays a warning when output exceeds 10,000 tokens. Tools that declare [`anthropic/maxResultSizeChars`](</docs/en/mcp#raise-the-limit-for-a-specific-tool>) use that character limit for text content instead, but image content from those tools is still subject to this variable (default: 25000) `MAX_STRUCTURED_OUTPUT_RETRIES`| Number of times to retry when the model’s response fails validation against the [`--json-schema`](</docs/en/cli-reference#cli-flags>) in non-interactive mode (the `-p` flag). Defaults to 5 -`MAX_THINKING_TOKENS`| Override the [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) token budget. The ceiling is the model’s [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>) minus one. Set to `0` to disable thinking on the Anthropic API except on Fable 5, which cannot have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `0` omits the `thinking` parameter instead, and models with [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) may still think. For nonzero values on adaptive reasoning models, the budget is ignored unless adaptive reasoning is disabled via `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` +`MAX_THINKING_TOKENS`| Fixed token budget for [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>). Claude Code caps it at one token below the request’s max output tokens and never below 1,024; see `CLAUDE_CODE_MAX_OUTPUT_TOKENS` for how that limit is set. When unset and thinking is enabled, models with [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) choose their own thinking depth, and other models use the cap. Set to `0` to disable thinking on the Anthropic API, except on Fable 5, which cannot have thinking turned off; on [third-party providers](</docs/en/third-party-integrations>), `0` omits the `thinking` parameter instead. Nonzero values are ignored on adaptive reasoning models unless `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` is set `MCP_CLIENT_SECRET`| OAuth client secret for MCP servers that require [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>). Avoids the interactive prompt when adding a server with `--client-secret` `MCP_CONNECTION_NONBLOCKING`| Controls whether startup waits for MCP servers to connect before the first query. As of Claude Code v2.1.142, MCP startup is non-blocking by default: servers connect in the background and their tools become available as they finish. Set to `0` to restore the blocking 5-second connection wait. Servers configured with [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>) still block startup regardless, since their tools must be present when the first prompt is built `MCP_CONNECT_TIMEOUT_MS`| How long blocking MCP startup waits, in milliseconds, for the connection batch before snapshotting the tool list (default: 5000). Applies when `MCP_CONNECTION_NONBLOCKING=0` or for servers marked [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>). Servers still pending at the deadline keep connecting in the background but won’t appear until the next query. Distinct from `MCP_TIMEOUT`, which bounds an individual server’s connect attempt
modified
--- a/env-vars.md +++ b/env-vars.md @@ -246,7 +246,7 @@ `CLAUDE_CODE_MAX_OUTPUT_TOKENS`| Set the maximum number of output tokens for most requests. Defaults and caps vary by model; see [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>). Increasing this value reduces the effective context window available before [auto-compaction](</docs/en/costs#reduce-token-usage>) triggers `CLAUDE_CODE_MAX_RETRIES`| Override the number of times to retry failed API requests (default: 10). Capped at 15 as of v2.1.186; as of v2.1.199, `CLAUDE_CODE_RETRY_WATCHDOG` raises the default and removes the cap. For unattended sessions that need to wait through longer outages, set `CLAUDE_CODE_RETRY_WATCHDOG` instead `CLAUDE_CODE_MAX_SUBAGENTS_PER_SESSION`| Cap on the number of [subagents](</docs/en/sub-agents#session-subagent-limit>) one session can spawn with the Agent tool (default: 200). When Claude reaches the cap, spawning another subagent fails with an error telling Claude to finish the remaining work directly. Accepts a positive whole number in plain digits with no upper bound; this variable doesn’t take the scientific notation or digit-separator spellings. Anything else is ignored and the default applies, so the cap can be raised but not turned off. Requires Claude Code v2.1.212 or later -`CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH`| Number of [subagent layers](</docs/en/sub-agents#let-subagents-spawn-their-own-subagents>) allowed below the main conversation (default: 1). At the default, subagents can’t spawn their own subagents; set `2` or higher to allow it. Accepts a positive whole number in plain digits; anything else is ignored, so the limit can be raised but not turned off. Requires Claude Code v2.1.217 or later +`CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH`| Number of [subagent layers](</docs/en/sub-agents#let-subagents-spawn-their-own-subagents>) allowed below the main conversation (default: 3). At the default, subagents can spawn their own subagents, and a subagent at the third layer can’t spawn further; set `1` to turn nesting off. In v2.1.217 through v2.1.218, the default was 1, so a subagent couldn’t spawn its own unless you raised the limit; v2.1.219 raised the default to 3. Accepts a positive whole number in plain digits; anything else is ignored, so the limit can be adjusted but not removed. Requires Claude Code v2.1.217 or later `CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY`| Maximum number of read-only tools and subagents that can execute in parallel (default: 10). Higher values increase parallelism but consume more resources `CLAUDE_CODE_MAX_TURNS`| Cap the number of agentic turns when no explicit limit is passed. Equivalent to passing [`--max-turns`](</docs/en/cli-reference#cli-flags>), which takes precedence when both are set. A value that is not a positive integer is rejected at startup with an error rather than treated as no cap `CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSION`| Cap on the total number of [WebSearch](</docs/en/tools-reference#websearch-tool-behavior>) calls one session can make (default: 200). When Claude reaches the cap, further WebSearch calls return a notice telling it to continue with the information it already gathered. Accepts a positive whole number with no upper bound. Anything else is ignored and the default applies, so the cap can be raised but not turned off. Requires Claude Code v2.1.212 or later
modified
--- a/env-vars.md +++ b/env-vars.md @@ -233,7 +233,7 @@ `CLAUDE_CODE_FORCE_SYNC_OUTPUT`| Set to `1` to force-enable DEC private mode 2026 [synchronized output](<https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036>) when your terminal supports it but is not auto-detected. Useful for emulators such as Emacs `eat` that implement BSU/ESU but do not reply to the capability probe. Has no effect under tmux. Unlike `CLAUDE_CODE_NO_FLICKER`, which switches to [fullscreen rendering](</docs/en/fullscreen>), this doesn’t change the renderer `CLAUDE_CODE_FORK_SUBAGENT`| Set to `1` to let Claude spawn [forked subagents](</docs/en/sub-agents#fork-the-current-conversation>), or `0` to disable them, overriding any server-side rollout. When enabled, Claude can request the `fork` subagent type to spawn a fork, a subagent that inherits the full conversation context instead of starting fresh. When Claude doesn’t request a subagent type, it still gets the general-purpose subagent, and every subagent runs in the background. The explicit [`/subtask`](</docs/en/commands#all-commands>) command, named `/fork` on v2.1.161 through v2.1.211, works without this variable; on v2.1.117 through v2.1.160, `/fork` is the forked-subagent command only when this variable is set to `1` or a server-side rollout enabled it. Works in interactive mode and via the SDK or `claude -p`. When [agent view is turned off](</docs/en/agent-view#turn-off-agent-view>), `/subtask` isn’t available and the command stays `/fork` `CLAUDE_CODE_FORWARD_SUBAGENT_TEXT`| Set to `1` to emit [subagent](</docs/en/sub-agents>) text and thinking blocks in `claude -p --output-format stream-json` output, the same behavior as the [`--forward-subagent-text`](</docs/en/cli-reference#cli-flags>) flag. Use the variable when a harness invokes `claude` and can’t pass the flag itself. Unlike the flag, which exits with an error outside non-interactive mode with stream-json output, the variable is ignored there so that nested invocations keep working when it’s set process-wide. Requires Claude Code v2.1.211 or later -`CLAUDE_CODE_GIT_BASH_PATH`| Windows only: path to the Git Bash executable (`bash.exe`). Use when Git Bash is installed but not in your PATH. See [Windows setup](</docs/en/setup#set-up-on-windows>) +`CLAUDE_CODE_GIT_BASH_PATH`| Windows only: path to the Git Bash executable (`bash.exe`). Use when Git Bash is installed but not in your PATH. If the path doesn’t exist or the file isn’t named `bash.exe`, `sh.exe`, `bash`, or `sh`, Claude Code ignores the variable and auto-detects Git Bash as if it were unset, logging a warning visible with `--debug`. Before v2.1.219, Claude Code exited at startup when the path didn’t exist, and used any existing file as the shell without checking that it was bash or sh. See [Windows setup](</docs/en/setup#set-up-on-windows>) `CLAUDE_CODE_GLOB_HIDDEN`| Set to `false` to exclude dotfiles from results when Claude invokes the [Glob tool](</docs/en/tools-reference#glob-tool-behavior>). Included by default. Does not affect `@` file autocomplete, `ls`, Grep, or Read `CLAUDE_CODE_GLOB_NO_IGNORE`| Set to `false` to make the [Glob tool](</docs/en/tools-reference#glob-tool-behavior>) respect `.gitignore` patterns. By default, Glob returns all matching files including gitignored ones. Does not affect `@` file autocomplete, which has its own [`respectGitignore` setting](</docs/en/settings#available-settings>) `CLAUDE_CODE_GLOB_TIMEOUT_SECONDS`| Timeout in seconds for Glob tool file discovery. Defaults to 20 seconds on most platforms and 60 seconds on WSL
modified
--- a/env-vars.md +++ b/env-vars.md @@ -405,6 +405,7 @@ `VERTEX_REGION_CLAUDE_4_6_SONNET`| Override region for Claude Sonnet 4.6 when using Google Cloud’s Agent Platform `VERTEX_REGION_CLAUDE_4_7_OPUS`| Override region for Claude Opus 4.7 when using Google Cloud’s Agent Platform. Added in v2.1.111 `VERTEX_REGION_CLAUDE_4_8_OPUS`| Override region for Claude Opus 4.8 when using Google Cloud’s Agent Platform. Added in v2.1.154 +`VERTEX_REGION_CLAUDE_5_OPUS`| Override region for Claude Opus 5 when using Google Cloud’s Agent Platform. Added in v2.1.219 `VERTEX_REGION_CLAUDE_5_SONNET`| Override region for Claude Sonnet 5 when using Google Cloud’s Agent Platform. Added in v2.1.197 `VERTEX_REGION_CLAUDE_FABLE_5`| Override region for Claude Fable 5 when using Google Cloud’s Agent Platform. Added in v2.1.170 `VERTEX_REGION_CLAUDE_HAIKU_4_5`| Override region for Claude Haiku 4.5 when using Google Cloud’s Agent Platform
modified
--- a/env-vars.md +++ b/env-vars.md @@ -241,10 +241,12 @@ `CLAUDE_CODE_IDE_HOST_OVERRIDE`| Override the host address used to connect to the IDE extension. By default Claude Code auto-detects the correct address, including WSL-to-Windows routing `CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL`| Set to `1` to skip auto-installation of IDE extensions. Equivalent to setting [`autoInstallIdeExtension`](</docs/en/settings#global-config-settings>) to `false` `CLAUDE_CODE_IDE_SKIP_VALID_CHECK`| Set to `1` to skip validation of IDE lockfile entries during connection. Use when auto-connect fails to find your IDE despite it running +`CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS`| How many [subagents](</docs/en/sub-agents#concurrent-subagent-limit>) can be running in one session before the Agent tool refuses to spawn another (default: 20). Accepts a positive whole number in plain digits; anything else is ignored, so the variable can adjust the cap but can’t disable it. Requires Claude Code v2.1.217 or later `CLAUDE_CODE_MAX_CONTEXT_TOKENS`| Override the context window size Claude Code assumes for the active model. As of v2.1.193, applied directly for model names Claude Code does not recognize as a Claude model; for recognized Claude models it only takes effect when `DISABLE_COMPACT` is also set. Use this when routing to a model through `ANTHROPIC_BASE_URL` whose context window does not match the built-in size for its name `CLAUDE_CODE_MAX_OUTPUT_TOKENS`| Set the maximum number of output tokens for most requests. Defaults and caps vary by model; see [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>). Increasing this value reduces the effective context window available before [auto-compaction](</docs/en/costs#reduce-token-usage>) triggers `CLAUDE_CODE_MAX_RETRIES`| Override the number of times to retry failed API requests (default: 10). Capped at 15 as of v2.1.186; as of v2.1.199, `CLAUDE_CODE_RETRY_WATCHDOG` raises the default and removes the cap. For unattended sessions that need to wait through longer outages, set `CLAUDE_CODE_RETRY_WATCHDOG` instead `CLAUDE_CODE_MAX_SUBAGENTS_PER_SESSION`| Cap on the number of [subagents](</docs/en/sub-agents#session-subagent-limit>) one session can spawn with the Agent tool (default: 200). When Claude reaches the cap, spawning another subagent fails with an error telling Claude to finish the remaining work directly. Accepts a positive whole number in plain digits with no upper bound; this variable doesn’t take the scientific notation or digit-separator spellings. Anything else is ignored and the default applies, so the cap can be raised but not turned off. Requires Claude Code v2.1.212 or later +`CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH`| Number of [subagent layers](</docs/en/sub-agents#let-subagents-spawn-their-own-subagents>) allowed below the main conversation (default: 1). At the default, subagents can’t spawn their own subagents; set `2` or higher to allow it. Accepts a positive whole number in plain digits; anything else is ignored, so the limit can be raised but not turned off. Requires Claude Code v2.1.217 or later `CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY`| Maximum number of read-only tools and subagents that can execute in parallel (default: 10). Higher values increase parallelism but consume more resources `CLAUDE_CODE_MAX_TURNS`| Cap the number of agentic turns when no explicit limit is passed. Equivalent to passing [`--max-turns`](</docs/en/cli-reference#cli-flags>), which takes precedence when both are set. A value that is not a positive integer is rejected at startup with an error rather than treated as no cap `CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSION`| Cap on the total number of [WebSearch](</docs/en/tools-reference#websearch-tool-behavior>) calls one session can make (default: 200). When Claude reaches the cap, further WebSearch calls return a notice telling it to continue with the information it already gathered. Accepts a positive whole number with no upper bound. Anything else is ignored and the default applies, so the cap can be raised but not turned off. Requires Claude Code v2.1.212 or later
modified
--- a/env-vars.md +++ b/env-vars.md @@ -258,6 +258,7 @@ `CLAUDE_CODE_OAUTH_SCOPES`| Space-separated OAuth scopes the refresh token was issued with, such as `"user:profile user:inference user:sessions:claude_code"`. Required when `CLAUDE_CODE_OAUTH_REFRESH_TOKEN` is set `CLAUDE_CODE_OAUTH_TOKEN`| OAuth access token for Claude.ai authentication. Alternative to `/login` for SDK and automated environments. Takes precedence over keychain-stored credentials. Generate one with [`claude setup-token`](</docs/en/authentication#generate-a-long-lived-token>) `CLAUDE_CODE_OPUS_4_6_FAST_MODE_OVERRIDE`| Removed in v2.1.160 and now a no-op. Previously pinned [fast mode](</docs/en/fast-mode>) to Claude Opus 4.6 instead of the current default. Opus 4.6 no longer supports fast mode +`CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH`| Maximum length of content-bearing OpenTelemetry attributes (model responses, tool content, system prompts, raw API bodies), truncation marker included, in UTF-16 code units (default: 61440, i.e. 60 KB). Raise it only if your telemetry backend accepts attribute values larger than 64 KB, or lower it to cut telemetry volume. Requires Claude Code v2.1.214 or later. See [Monitoring](</docs/en/monitoring-usage>) `CLAUDE_CODE_OTEL_DIAG_STDERR`| Set to `1` to write OpenTelemetry exporter diagnostic errors to stderr. By default these errors only appear with `--debug`, so a misconfigured exporter such as a Prometheus port collision otherwise fails silently. Requires Claude Code v2.1.179 or later. See [Monitoring](</docs/en/monitoring-usage>) `CLAUDE_CODE_OTEL_FLUSH_TIMEOUT_MS`| Timeout in milliseconds for flushing pending OpenTelemetry spans (default: 5000). See [Monitoring](</docs/en/monitoring-usage>) `CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS`| Interval for refreshing dynamic OpenTelemetry headers in milliseconds (default: 1740000 / 29 minutes). See [Dynamic headers](</docs/en/monitoring-usage#dynamic-headers>) @@ -326,6 +327,7 @@ `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK`| Set to `1` to enable the byte-level streaming idle watchdog on Amazon Bedrock `vnd.amazon.eventstream` responses. Off by default. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS` `CLAUDE_ENABLE_STREAM_WATCHDOG`| Set to `0` to force-disable the event-level streaming idle watchdog, or set to `1` to force-enable it. When unset, the watchdog is on by default for all providers. Before v2.1.196, the unset default was server-controlled on the direct Anthropic API and off on other providers. As of v2.1.169, providers other than the direct Anthropic API and Claude Platform on AWS also have a default-on 5-minute body idle timeout independent of this variable; see `API_FORCE_IDLE_TIMEOUT`. On Amazon Bedrock, you can also enable the independent byte-level watchdog with `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK`; the two run together when both are set. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS` `CLAUDE_ENV_FILE`| Path to a shell script whose contents Claude Code runs before each Bash command in the same shell process, so exports in the file are visible to the command. Use to persist virtualenv or conda activation across commands. Also populated dynamically by [SessionStart](</docs/en/hooks#persist-environment-variables>), [Setup](</docs/en/hooks#setup>), [CwdChanged](</docs/en/hooks#cwdchanged>), and [FileChanged](</docs/en/hooks#filechanged>) hooks +`CLAUDE_PID`| Claude Code sets this to its own process ID in the subprocesses it spawns: Bash and PowerShell tool commands and hook commands. On Linux, the Bash tool’s shell integration uses it to refuse a `pkill` pattern that would match the Claude Code process itself; see [the error reference](</docs/en/errors#pkill-pattern-matches-the-claude-code-process>). Read it from your own scripts to identify or signal the parent Claude Code process deliberately. Requires Claude Code v2.1.214 or later `CLAUDE_REMOTE_CONTROL_SESSION_NAME_PREFIX`| Prefix for auto-generated [Remote Control](</docs/en/remote-control>) session names when no explicit name is provided. Defaults to your machine’s hostname, producing names like `myhost-graceful-unicorn`. The `--remote-control-session-name-prefix` CLI flag sets the same value for a single invocation `CLAUDE_STREAM_IDLE_TIMEOUT_MS`| Timeout in milliseconds before the streaming idle watchdog closes a stalled connection. When you set this variable explicitly, the minimum is `300000` (5 minutes); lower values are silently clamped to absorb extended thinking pauses and proxy buffering. When unset, the event-level watchdog defaults to 300 seconds and the byte-level watchdog defaults to 180 seconds on direct Anthropic API connections (300 seconds on Claude Platform on AWS and other providers). The unset 180-second byte-watchdog default is a separate value and is not subject to the 5-minute clamp. The body idle timeout described under `API_FORCE_IDLE_TIMEOUT` applies independently. On Amazon Bedrock, also applies when `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK=1` `DEBUG`| Set to `1` to enable debug mode, equivalent to launching with [`--debug`](</docs/en/cli-reference#cli-flags>). Debug logs are written to `~/.claude/debug/<session-id>.txt`, or to the path set by `CLAUDE_CODE_DEBUG_LOGS_DIR`. Only the truthy values `1`, `true`, `yes`, and `on` enable debug mode, so namespace patterns like `DEBUG=express:*` set for other tools do not trigger it @@ -375,8 +377,9 @@ `MCP_TIMEOUT`| Timeout in milliseconds for MCP server startup (default: 30000, or 30 seconds) `MCP_TOOL_TIMEOUT`| Timeout in milliseconds for MCP tool execution (default: 100000000, about 28 hours). For an HTTP, SSE, or claude.ai connector server, each request also times out after 60 seconds by default; set this variable, or the per-server `timeout`, above 60000 to raise that per-request limit. A lower value still shortens the overall tool-execution timeout but leaves the per-request limit at 60 seconds. Stdio and WebSocket servers have no per-request timer. A per-server `timeout` field in `.mcp.json` overrides this for that server. A per-server `timeout` of at least 1000 also sets the minimum idle window for that server’s tool calls, so `CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT` never aborts them sooner; this floor requires Claude Code v2.1.203 or later. For the env variable, values below 1000 are floored to one second; for the per-server field, values below 1000 are ignored `NO_PROXY`| List of domains and IPs to which requests will be directly issued, bypassing proxy +`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`| Standard OpenTelemetry SDK limit on attribute value length. Claude Code caps content-bearing telemetry attributes at the smaller of this and `CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH`, so the truncation marker stays within the SDK limit. Claude Code reads the `OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT` and `OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT` variants the same way, and the smallest set value applies to all signals. Requires Claude Code v2.1.214 or later. See [Monitoring](</docs/en/monitoring-usage#common-configuration-variables>) `OTEL_LOG_ASSISTANT_RESPONSES`| Set to `1` to include the model’s response text on `assistant_response` OpenTelemetry log events. When unset, the value of `OTEL_LOG_USER_PROMPTS` is used instead. Set to `0` to keep responses redacted even when `OTEL_LOG_USER_PROMPTS` is set. Requires Claude Code v2.1.193 or later. See [Monitoring](</docs/en/monitoring-usage#assistant-response-event>) -`OTEL_LOG_RAW_API_BODIES`| Emit Anthropic Messages API request and response JSON as `api_request_body` / `api_response_body` log events. Set to `1` for inline bodies truncated at 60 KB, or `file:<dir>` to write untruncated bodies to disk and emit a `body_ref` path instead. Disabled by default; bodies include the entire conversation history. See [Monitoring](</docs/en/monitoring-usage#api-request-body-event>) +`OTEL_LOG_RAW_API_BODIES`| Emit Anthropic Messages API request and response JSON as `api_request_body` / `api_response_body` log events. Set to `1` for inline bodies truncated at the content limit, or `file:<dir>` to write untruncated bodies to disk and emit a `body_ref` path instead. `CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH` configures the content limit, 60 KB by default. Disabled by default; bodies include the entire conversation history. See [Monitoring](</docs/en/monitoring-usage#api-request-body-event>) `OTEL_LOG_TOOL_CONTENT`| Set to `1` to include tool input and output content in OpenTelemetry span events. Disabled by default to protect sensitive data. See [Monitoring](</docs/en/monitoring-usage>) `OTEL_LOG_TOOL_DETAILS`| Set to `1` to include tool input arguments, MCP server names, user-authored workflow names, raw error strings on tool failures, the refusal `category` on `api_refusal` events, and other tool details in OpenTelemetry traces and logs. Disabled by default to protect PII. See [Monitoring](</docs/en/monitoring-usage>) `OTEL_LOG_USER_PROMPTS`| Set to `1` to include user prompt text in OpenTelemetry traces and logs. Disabled by default (prompts are redacted). See [Monitoring](</docs/en/monitoring-usage>)
modified
--- a/env-vars.md +++ b/env-vars.md @@ -97,7 +97,7 @@ Variables -Numeric variables such as timeouts, token budgets, and retry counts accept scientific notation and digit-separator spellings in addition to plain digits. For example, Claude Code reads `2e3` as 2000 and `64_000` as 64000. Before v2.1.211, these spellings could silently set a much smaller value, such as `1e6` setting a timeout to 1. +Numeric variables such as timeouts, token budgets, and retry counts accept scientific notation and digit-separator spellings in addition to plain digits, except where a variable’s row notes it takes plain digits only. For example, Claude Code reads `2e3` as 2000 and `64_000` as 64000. Before v2.1.211, these spellings could silently set a much smaller value, such as `1e6` setting a timeout to 1. Variable| Purpose ---|--- @@ -156,7 +156,7 @@ `CLAUDE_AGENT_SDK_MCP_NO_PREFIX`| Set to `1` to skip the `mcp__<server>__` prefix on tool names from SDK-created MCP servers. Tools use their original names. SDK usage only `CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS`| Stall timeout in milliseconds for background subagents. Default `600000` (10 minutes). The timer resets on each streaming progress event; if no progress arrives within the window, the subagent is aborted and the task is marked failed, surfacing any partial result to the parent `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE`| Set the percentage (1-100) of the auto-compaction window at which auto-compaction triggers. Use lower values like `50` to compact earlier. This variable only causes earlier compaction when Claude Code compacts proactively: when `CLAUDE_CODE_AUTO_COMPACT_WINDOW` is set, in [cloud sessions](</docs/en/claude-code-on-the-web>), and on Sonnet 4.6 and Opus 4.6 without [extended context](</docs/en/model-config#extended-context>), which compact at the 200K boundary by default. On Sonnet 5, proactive compaction applies at the model’s [default threshold](</docs/en/model-config#sonnet-5-context-window>). In other cases, such as a local session on Opus 4.8, auto-compaction triggers when the conversation reaches the model’s context limit. The override can only lower the threshold, so values above the default have no effect. Applies to both main conversations and subagents -`CLAUDE_AUTO_BACKGROUND_TASKS`| Set to `1` to force-enable automatic backgrounding of long-running agent tasks. When enabled, subagents are moved to the background after running for approximately two minutes +`CLAUDE_AUTO_BACKGROUND_TASKS`| Set to `1` to force-enable automatic backgrounding of long-running agent tasks. When enabled, subagents are moved to the background after running for approximately two minutes. Also enables [automatic backgrounding of long MCP tool calls](</docs/en/mcp#automatic-backgrounding-of-long-tool-calls>) in non-interactive mode on Claude Code v2.1.212 or later `CLAUDE_AX_SCREEN_READER`| Set to `1` to render screen-reader friendly output: flat text without decorative borders or animations. Set to `0` to force screen-reader mode off even when [`axScreenReader`](</docs/en/settings#available-settings>) is `true`. The [`--ax-screen-reader`](</docs/en/cli-reference#cli-flags>) flag takes precedence. Requires Claude Code v2.1.181 or later `CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR`| Return to the original working directory after each Bash or PowerShell command in the main session `CLAUDE_CLIENT_PRESENCE_FILE`| Path to a file that an external tool, such as a screen-lock listener, creates when you unlock your screen and deletes when you lock it. While the file exists, Claude Code skips [Remote Control mobile push notifications](</docs/en/remote-control#mobile-push-notifications>), so you stop getting pushes while you are actively using the computer. When the file is absent or unreadable, notifications are sent as normal. Claude Code checks the file once per push-triggering event rather than polling it. Requires Claude Code v2.1.181 or later @@ -203,12 +203,12 @@ `CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP`| Set to `1` to prevent automatic remapping of Opus 4.0 and 4.1 to the current Opus version on the Anthropic API. Use when you intentionally want to pin an older model. The remap does not run on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry `CLAUDE_CODE_DISABLE_MOUSE`| Set to `1` to disable mouse tracking in [fullscreen rendering](</docs/en/fullscreen>). Keyboard scrolling with `PgUp` and `PgDn` still works. Use this to keep your terminal’s native copy-on-select behavior `CLAUDE_CODE_DISABLE_MOUSE_CLICKS`| Set to `1` to disable click, drag, and hover handling in [fullscreen rendering](</docs/en/fullscreen>) while keeping mouse-wheel scrolling. Use this when you want wheel scroll to work inside Claude Code but don’t want clicks to position the cursor, expand tool output, or open links. `CLAUDE_CODE_DISABLE_MOUSE` takes precedence when both are set. Requires Claude Code v2.1.195 or later -`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`| Equivalent of setting `DISABLE_AUTOUPDATER`, `DISABLE_FEEDBACK_COMMAND`, `DISABLE_ERROR_REPORTING`, and `DISABLE_TELEMETRY` +`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`| Set to any non-empty value to disable nonessential network traffic: auto-updates, telemetry, error reporting, the `/feedback` command, release notes, [gateway model discovery](</docs/en/llm-gateway-connect#add-gateway-models-to-the-model-picker>) refreshes, and availability checks such as the [fast mode](</docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways>) check. Official plugin marketplace auto-install isn’t covered; disable it with `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL` `CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK`| Set to `1` to disable the non-streaming fallback when a streaming request fails mid-stream. Streaming errors propagate to the retry layer instead. Useful when a proxy or gateway causes the fallback to produce duplicate tool execution `CLAUDE_CODE_DISABLE_NOTIFICATION_PRESENCE_CHECK`| Set to `1` to send the `PushNotification` tool’s desktop notification even while you are typing in or focused on the terminal. By default the tool skips both the desktop notification and the [mobile push](</docs/en/remote-control#mobile-push-notifications>) when it detects recent keyboard activity or terminal focus. This variable disables only that local check, so the server can still suppress the mobile push when it detects that you are active. Requires Claude Code v2.1.193 or later `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL`| Set to `1` to skip automatic addition of the official plugin marketplace on first run `CLAUDE_CODE_DISABLE_POLICY_SKILLS`| Set to `1` to skip loading skills from the system-wide managed skills directory. Useful for container or CI sessions that should not load operator-provisioned skills -`CLAUDE_CODE_DISABLE_TERMINAL_TITLE`| Set to `1` to disable automatic terminal title updates based on conversation context. In Agent SDK and `claude -p` sessions, this also skips the background Haiku request that generates the session title +`CLAUDE_CODE_DISABLE_TERMINAL_TITLE`| Set to `1` to disable automatic terminal title updates based on conversation context. In Agent SDK and `claude -p` sessions, this also skips the background small/fast-model request that generates the session title `CLAUDE_CODE_DISABLE_THINKING`| Set to `1` to omit the `thinking` parameter from API requests entirely. This is a compatibility option for proxies and gateways that reject the parameter. The variable’s behavior is unchanged from earlier versions; on models that think by default, omitting the parameter means the model may still think. To explicitly disable [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) on the Anthropic API, use `MAX_THINKING_TOKENS=0` instead, which is also ineffective on Fable 5 since it cannot have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `0` likewise omits the parameter, so the two variables behave the same there `CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL`| Set to `1` to disable virtual scrolling in [fullscreen rendering](</docs/en/fullscreen>) and render every message in the transcript. Use this if scrolling in fullscreen mode shows blank regions where messages should appear `CLAUDE_CODE_DISABLE_WORKFLOWS`| Set to `1` to disable [workflows](</docs/en/workflows#turn-workflows-off>). Equivalent to the [`disableWorkflows`](</docs/en/settings#available-settings>) setting @@ -231,7 +231,7 @@ `CLAUDE_CODE_FORCE_SESSION_PERSISTENCE`| Set to `1` to force transcript persistence, prompt history, and `claude agents` registration even when this `claude` was launched from inside another Claude Code session. Use when an inherited `CLAUDE_CODE_CHILD_SESSION` value, for example from a `screen` session or a background launcher first started by Claude Code’s Bash tool, causes a genuine top-level session to be misclassified as nested. As of v2.1.178, Claude Code detects the tmux case automatically and ignores the inherited marker, so tmux no longer needs this variable. Also honored on v2.1.169 and earlier; has no effect on v2.1.170 and v2.1.171, where the nested-session detection it overrides was removed `CLAUDE_CODE_FORCE_STRIKETHROUGH`| Set to `1` to force strikethrough rendering for `~~text~~` in Claude’s responses when your terminal supports it but is not auto-detected, such as over SSH without `TERM_PROGRAM` forwarded. Without this, undetected terminals show the literal `~~` markers instead of rendering the text as strikethrough. Requires Claude Code v2.1.186 or later `CLAUDE_CODE_FORCE_SYNC_OUTPUT`| Set to `1` to force-enable DEC private mode 2026 [synchronized output](<https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036>) when your terminal supports it but is not auto-detected. Useful for emulators such as Emacs `eat` that implement BSU/ESU but do not reply to the capability probe. Has no effect under tmux. Unlike `CLAUDE_CODE_NO_FLICKER`, which switches to [fullscreen rendering](</docs/en/fullscreen>), this doesn’t change the renderer -`CLAUDE_CODE_FORK_SUBAGENT`| Set to `1` to let Claude spawn [forked subagents](</docs/en/sub-agents#fork-the-current-conversation>), or `0` to disable them, overriding any server-side rollout. When enabled, Claude can request the `fork` subagent type to spawn a fork, a subagent that inherits the full conversation context instead of starting fresh. Spawns without a subagent type still use the general-purpose subagent, and all subagent spawns run in the background. The explicit [`/fork`](</docs/en/commands>) command works without this variable. Works in interactive mode and via the SDK or `claude -p` +`CLAUDE_CODE_FORK_SUBAGENT`| Set to `1` to let Claude spawn [forked subagents](</docs/en/sub-agents#fork-the-current-conversation>), or `0` to disable them, overriding any server-side rollout. When enabled, Claude can request the `fork` subagent type to spawn a fork, a subagent that inherits the full conversation context instead of starting fresh. When Claude doesn’t request a subagent type, it still gets the general-purpose subagent, and every subagent runs in the background. The explicit [`/subtask`](</docs/en/commands#all-commands>) command, named `/fork` on v2.1.161 through v2.1.211, works without this variable; on v2.1.117 through v2.1.160, `/fork` is the forked-subagent command only when this variable is set to `1` or a server-side rollout enabled it. Works in interactive mode and via the SDK or `claude -p`. When [agent view is turned off](</docs/en/agent-view#turn-off-agent-view>), `/subtask` isn’t available and the command stays `/fork` `CLAUDE_CODE_FORWARD_SUBAGENT_TEXT`| Set to `1` to emit [subagent](</docs/en/sub-agents>) text and thinking blocks in `claude -p --output-format stream-json` output, the same behavior as the [`--forward-subagent-text`](</docs/en/cli-reference#cli-flags>) flag. Use the variable when a harness invokes `claude` and can’t pass the flag itself. Unlike the flag, which exits with an error outside non-interactive mode with stream-json output, the variable is ignored there so that nested invocations keep working when it’s set process-wide. Requires Claude Code v2.1.211 or later `CLAUDE_CODE_GIT_BASH_PATH`| Windows only: path to the Git Bash executable (`bash.exe`). Use when Git Bash is installed but not in your PATH. See [Windows setup](</docs/en/setup#set-up-on-windows>) `CLAUDE_CODE_GLOB_HIDDEN`| Set to `false` to exclude dotfiles from results when Claude invokes the [Glob tool](</docs/en/tools-reference#glob-tool-behavior>). Included by default. Does not affect `@` file autocomplete, `ls`, Grep, or Read @@ -244,9 +244,12 @@ `CLAUDE_CODE_MAX_CONTEXT_TOKENS`| Override the context window size Claude Code assumes for the active model. As of v2.1.193, applied directly for model names Claude Code does not recognize as a Claude model; for recognized Claude models it only takes effect when `DISABLE_COMPACT` is also set. Use this when routing to a model through `ANTHROPIC_BASE_URL` whose context window does not match the built-in size for its name `CLAUDE_CODE_MAX_OUTPUT_TOKENS`| Set the maximum number of output tokens for most requests. Defaults and caps vary by model; see [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>). Increasing this value reduces the effective context window available before [auto-compaction](</docs/en/costs#reduce-token-usage>) triggers `CLAUDE_CODE_MAX_RETRIES`| Override the number of times to retry failed API requests (default: 10). Capped at 15 as of v2.1.186; as of v2.1.199, `CLAUDE_CODE_RETRY_WATCHDOG` raises the default and removes the cap. For unattended sessions that need to wait through longer outages, set `CLAUDE_CODE_RETRY_WATCHDOG` instead +`CLAUDE_CODE_MAX_SUBAGENTS_PER_SESSION`| Cap on the number of [subagents](</docs/en/sub-agents#session-subagent-limit>) one session can spawn with the Agent tool (default: 200). When Claude reaches the cap, spawning another subagent fails with an error telling Claude to finish the remaining work directly. Accepts a positive whole number in plain digits with no upper bound; this variable doesn’t take the scientific notation or digit-separator spellings. Anything else is ignored and the default applies, so the cap can be raised but not turned off. Requires Claude Code v2.1.212 or later `CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY`| Maximum number of read-only tools and subagents that can execute in parallel (default: 10). Higher values increase parallelism but consume more resources `CLAUDE_CODE_MAX_TURNS`| Cap the number of agentic turns when no explicit limit is passed. Equivalent to passing [`--max-turns`](</docs/en/cli-reference#cli-flags>), which takes precedence when both are set. A value that is not a positive integer is rejected at startup with an error rather than treated as no cap +`CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSION`| Cap on the total number of [WebSearch](</docs/en/tools-reference#websearch-tool-behavior>) calls one session can make (default: 200). When Claude reaches the cap, further WebSearch calls return a notice telling it to continue with the information it already gathered. Accepts a positive whole number with no upper bound. Anything else is ignored and the default applies, so the cap can be raised but not turned off. Requires Claude Code v2.1.212 or later `CLAUDE_CODE_MCP_ALLOWLIST_ENV`| Set to `1` to spawn stdio MCP servers with only a safe baseline environment plus the server’s configured `env`, instead of inheriting your shell environment +`CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS`| Elapsed time in milliseconds before a still-running MCP tool call [moves to a background task](</docs/en/mcp#automatic-backgrounding-of-long-tool-calls>) (default: 120000, or 2 minutes). Set to `0` to turn automatic backgrounding off. Requires Claude Code v2.1.212 or later `CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT`| Idle timeout in milliseconds for MCP tool calls. When a stdio, HTTP, SSE, WebSocket, or [claude.ai connector](</docs/en/mcp#use-mcp-servers-from-claude-ai>) MCP server sends no response and no progress notification for this long, the tool call aborts with an error instead of waiting for the overall `MCP_TOOL_TIMEOUT`. Overrides the per-transport defaults of 300000 (5 minutes) for network servers and 1800000 (30 minutes) for stdio servers. Set to `0` to disable the idle check. Values below 1000 are raised to one second, and the value is capped at the effective `MCP_TOOL_TIMEOUT`. A per-server `timeout` in `.mcp.json` of at least 1000 raises that server’s idle window to at least the `timeout` value. Doesn’t apply to IDE servers or SDK in-process servers. Requires Claude Code v2.1.187 or later. Before v2.1.203, stdio servers were exempt from the idle timeout `CLAUDE_CODE_NATIVE_CURSOR`| Set to `1` to show the terminal’s own cursor at the input caret instead of a drawn block. The cursor respects the terminal’s blink, shape, and focus settings `CLAUDE_CODE_NEW_INIT`| Set to `1` to make `/init` run an interactive setup flow. The flow asks which files to generate, including CLAUDE.md, skills, and hooks, before exploring the codebase and writing them. Without this variable, `/init` generates a CLAUDE.md automatically without prompting @@ -290,6 +293,8 @@ `CLAUDE_CODE_SKIP_ANTHROPIC_AWS_AUTH`| Skip client-side authentication for [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), for gateways that sign requests themselves `CLAUDE_CODE_SKIP_AWS_CRED_CACHE`| Set to `1` to turn off the in-process cache of credentials resolved from the AWS default credential provider chain, so Claude Code resolves the chain on every API request. With the cache off, an SSO-backed profile requests credentials from IAM Identity Center on every request. See [credential caching and resolution timeout](</docs/en/amazon-bedrock#credential-caching-and-resolution-timeout>). Requires Claude Code v2.1.207 or later `CLAUDE_CODE_SKIP_BEDROCK_AUTH`| Skip AWS authentication for Amazon Bedrock (for example, when using an LLM gateway) +`CLAUDE_CODE_SKIP_FAST_MODE_NETWORK_ERRORS`| Set to `1` to treat a failed [fast mode](</docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways>) availability check as available, for networks that block the check’s direct request to `api.anthropic.com`. Claude Code still honors a “disabled by your organization” response +`CLAUDE_CODE_SKIP_FAST_MODE_ORG_CHECK`| Set to `1` to skip the client-side [fast mode](</docs/en/fast-mode#use-fast-mode-behind-proxies-and-llm-gateways>) availability check, for proxies that intercept the check’s request rather than refuse it. The API still rejects fast mode requests when your organization has fast mode disabled `CLAUDE_CODE_SKIP_FOUNDRY_AUTH`| Skip Azure authentication for Microsoft Foundry, for a proxy or gateway that injects its own `Authorization` header. Claude Code sends requests without an Azure credential and preserves the `Authorization` header you supply, for example through `ANTHROPIC_CUSTOM_HEADERS`. Ignored when `ANTHROPIC_FOUNDRY_API_KEY` or `ANTHROPIC_FOUNDRY_AUTH_TOKEN` is set. Before v2.1.203, this variable left the Microsoft Foundry client unable to send requests unless an API key was also set `CLAUDE_CODE_SKIP_MANTLE_AUTH`| Skip AWS authentication for Amazon Bedrock Mantle (for example, when using an LLM gateway) `CLAUDE_CODE_SKIP_PROMPT_HISTORY`| Set to `1` to skip writing prompt history and session transcripts to disk. Sessions started with this variable set do not appear in `--resume`, `--continue`, or up-arrow history. Useful for ephemeral scripted sessions @@ -331,7 +336,7 @@ `DISABLE_DOCTOR_COMMAND`| Set to `1` to hide the [`/doctor`](</docs/en/commands#all-commands>) setup checkup skill and its `/checkup` alias. Useful for managed deployments where users shouldn’t run setup diagnostics from a session. Doesn’t affect the `claude doctor` terminal command. Before v2.1.205, this variable hid the `/doctor` diagnostics screen command `DISABLE_ERROR_REPORTING`| Set to `1` to opt out of error reporting `DISABLE_EXTRA_USAGE_COMMAND`| Set to `1` to hide the `/usage-credits` command that lets users purchase additional usage beyond rate limits -`DISABLE_FEEDBACK_COMMAND`| Set to `1` to disable the `/feedback` command. The older name `DISABLE_BUG_COMMAND` is also accepted +`DISABLE_FEEDBACK_COMMAND`| Set to `1` to disable the `/feedback` command. Also disables `/bug` and `/share`, which report through the same path; before v2.1.212 they were aliases of `/feedback`, so the command was disabled under every name. The older name `DISABLE_BUG_COMMAND` is also accepted `DISABLE_GROWTHBOOK`| Set to `1` to disable GrowthBook feature-flag fetching and use code defaults for every flag. Telemetry event logging stays on unless `DISABLE_TELEMETRY` is also set `DISABLE_INSTALLATION_CHECKS`| Set to `1` to disable installation warnings. Use only when manually managing the installation location, as this can mask issues with standard installations `DISABLE_INSTALL_GITHUB_APP_COMMAND`| Set to `1` to hide the `/install-github-app` command. Already hidden when using third-party providers (Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry)
modified
--- a/env-vars.md +++ b/env-vars.md @@ -41,13 +41,27 @@ To set it for every session, run `setx API_TIMEOUT_MS "1200000"` and open a new terminal. +The assignment line prints nothing on success, so confirm the variable is set by printing it in the same shell before you run `claude`: + + * macOS, Linux, WSL + + * Windows PowerShell + + * Windows CMD + + echo $API_TIMEOUT_MS + + echo $env:API_TIMEOUT_MS + + echo %API_TIMEOUT_MS% + ### ​ In settings files -Add variables under the `env` key in a `settings.json` file. Claude Code reads them directly from the file at startup, so they take effect no matter how `claude` was launched. +Add variables under the `env` key in a `settings.json` file, creating the file if it doesn’t exist. Claude Code reads them directly from the file, so they take effect no matter how `claude` was launched. A running session applies new and changed values to its environment when you save the file, but a feature that reads its variables once at startup, such as [OpenTelemetry monitoring](</docs/en/monitoring-usage>), keeps its startup values until you relaunch. Removing a variable from the file doesn’t unset it in a running session; the removal takes effect the next time you launch `claude`. ~/.claude/settings.json @@ -75,13 +89,15 @@ Precedence -Where the same behavior has both an environment variable and a settings field, the environment variable takes precedence. For example, `ANTHROPIC_MODEL` overrides the `model` setting, and `CLAUDE_CODE_AUTO_CONNECT_IDE` overrides `autoConnectIde`. The settings field applies when the environment variable is not set. When the same variable is set in both your shell and a settings file `env` block, the settings file value applies. Claude Code writes each `env` entry into the process environment at startup, replacing the value inherited from the shell. A few variables are special-cased; the [`env` setting](</docs/en/settings#available-settings>) lists the exceptions. Between settings files, `env` values follow [settings precedence](</docs/en/settings#settings-precedence>), so a managed settings entry overrides the same variable in user or project settings. How an environment variable interacts with CLI flags and in-session commands varies per feature: `--model` and `/model` override `ANTHROPIC_MODEL`, while `CLAUDE_CODE_EFFORT_LEVEL` overrides `/effort`. When a variable interacts with another configuration source, its row in the Variables list states the precedence or links to the page that documents it. Claude Code reads environment variables at startup, so changes take effect the next time you launch `claude`. +Where the same behavior has both an environment variable and a settings field, the environment variable takes precedence. For example, `ANTHROPIC_MODEL` overrides the `model` setting, and `CLAUDE_CODE_AUTO_CONNECT_IDE` overrides `autoConnectIde`. The settings field applies when the environment variable is not set. When the same variable is set in both your shell and a settings file `env` block, the settings file value applies. Claude Code writes each `env` entry into the process environment at startup and again when the file changes, replacing the value inherited from the shell. A few variables are special-cased; the [`env` setting](</docs/en/settings#available-settings>) lists the exceptions. Between settings files, `env` values follow [settings precedence](</docs/en/settings#settings-precedence>), so a managed settings entry overrides the same variable in user or project settings. How an environment variable interacts with CLI flags and in-session commands varies per feature: `--model` and `/model` override `ANTHROPIC_MODEL`, while `CLAUDE_CODE_EFFORT_LEVEL` overrides `/effort`. When a variable interacts with another configuration source, its row in the Variables list states the precedence or links to the page that documents it. Claude Code reads shell environment variables at startup, so changes to them take effect the next time you launch `claude`. Variables set under the `env` key in settings files are reapplied to a running session when the file changes, with the startup-only exception described in In settings files. ## ​ Variables + +Numeric variables such as timeouts, token budgets, and retry counts accept scientific notation and digit-separator spellings in addition to plain digits. For example, Claude Code reads `2e3` as 2000 and `64_000` as 64000. Before v2.1.211, these spellings could silently set a much smaller value, such as `1e6` setting a timeout to 1. Variable| Purpose ---|--- @@ -216,6 +232,7 @@ `CLAUDE_CODE_FORCE_STRIKETHROUGH`| Set to `1` to force strikethrough rendering for `~~text~~` in Claude’s responses when your terminal supports it but is not auto-detected, such as over SSH without `TERM_PROGRAM` forwarded. Without this, undetected terminals show the literal `~~` markers instead of rendering the text as strikethrough. Requires Claude Code v2.1.186 or later `CLAUDE_CODE_FORCE_SYNC_OUTPUT`| Set to `1` to force-enable DEC private mode 2026 [synchronized output](<https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036>) when your terminal supports it but is not auto-detected. Useful for emulators such as Emacs `eat` that implement BSU/ESU but do not reply to the capability probe. Has no effect under tmux. Unlike `CLAUDE_CODE_NO_FLICKER`, which switches to [fullscreen rendering](</docs/en/fullscreen>), this doesn’t change the renderer `CLAUDE_CODE_FORK_SUBAGENT`| Set to `1` to let Claude spawn [forked subagents](</docs/en/sub-agents#fork-the-current-conversation>), or `0` to disable them, overriding any server-side rollout. When enabled, Claude can request the `fork` subagent type to spawn a fork, a subagent that inherits the full conversation context instead of starting fresh. Spawns without a subagent type still use the general-purpose subagent, and all subagent spawns run in the background. The explicit [`/fork`](</docs/en/commands>) command works without this variable. Works in interactive mode and via the SDK or `claude -p` +`CLAUDE_CODE_FORWARD_SUBAGENT_TEXT`| Set to `1` to emit [subagent](</docs/en/sub-agents>) text and thinking blocks in `claude -p --output-format stream-json` output, the same behavior as the [`--forward-subagent-text`](</docs/en/cli-reference#cli-flags>) flag. Use the variable when a harness invokes `claude` and can’t pass the flag itself. Unlike the flag, which exits with an error outside non-interactive mode with stream-json output, the variable is ignored there so that nested invocations keep working when it’s set process-wide. Requires Claude Code v2.1.211 or later `CLAUDE_CODE_GIT_BASH_PATH`| Windows only: path to the Git Bash executable (`bash.exe`). Use when Git Bash is installed but not in your PATH. See [Windows setup](</docs/en/setup#set-up-on-windows>) `CLAUDE_CODE_GLOB_HIDDEN`| Set to `false` to exclude dotfiles from results when Claude invokes the [Glob tool](</docs/en/tools-reference#glob-tool-behavior>). Included by default. Does not affect `@` file autocomplete, `ls`, Grep, or Read `CLAUDE_CODE_GLOB_NO_IGNORE`| Set to `false` to make the [Glob tool](</docs/en/tools-reference#glob-tool-behavior>) respect `.gitignore` patterns. By default, Glob returns all matching files including gitignored ones. Does not affect `@` file autocomplete, which has its own [`respectGitignore` setting](</docs/en/settings#available-settings>) @@ -251,18 +268,19 @@ `CLAUDE_CODE_PLUGIN_SEED_DIR`| Path to one or more read-only plugin seed directories, separated by `:` on Unix or `;` on Windows. Use this to bundle a pre-populated plugins directory into a container image. Claude Code registers marketplaces from these directories at startup and uses pre-cached plugins without re-cloning. See [Pre-populate plugins for containers](</docs/en/plugin-marketplaces#pre-populate-plugins-for-containers>) `CLAUDE_CODE_POWERSHELL_RESPECT_EXECUTION_POLICY`| Set to `1` to stop Claude Code from passing `-ExecutionPolicy Bypass` when spawning PowerShell for tool calls, hooks, and status line commands, and respect the machine’s effective execution policy instead. By default Claude Code bypasses execution policy at process scope so `.ps1` scripts and module imports work on default-Restricted Windows installs. Process-scope bypass never overrides Group Policy `MachinePolicy` or `UserPolicy` regardless of this setting `CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS`| Maximum time in milliseconds that [non-interactive mode](</docs/en/headless#background-tasks-at-exit>) with the `-p` flag waits after the final turn for background subagents and workflows whose result is part of the output. Default: `600000`, or 10 minutes. When the cap is exceeded, remaining background tasks are terminated and the process exits. Set to `0` to wait indefinitely. This cap is separate from the five-second grace period that applies to plain background shells -`CLAUDE_CODE_PROCESS_WRAPPER`| Launch the processes Claude Code starts from its own binary through a wrapper executable, given as an argv prefix such as `/opt/corp/launcher`. Covers the background service that hosts [agent view](</docs/en/agent-view>) sessions, every session it spawns, and the relaunch Claude Code performs of itself to finish installing an update. The first token must be the absolute path of an executable that ends by running `exec "$@"`, and most launchers are that single path. The value is an argument list, not a shell command: whitespace separates tokens, double quotes group a path that contains spaces, and a value that starts with `[` is read as a JSON string array. Set it in the `env` block of user or [managed settings](</docs/en/permissions#managed-settings>), not as a shell export, so the detached background service inherits it; project and local settings can’t set it. The VS Code extension configures its own launcher separately through its `claudeProcessWrapper` setting. Ignored on Windows. `CLAUDE_CODE_SHELL_PREFIX` is a separate control: it wraps the shell commands Claude runs as a single quoted string, while this variable wraps Claude Code’s own processes as an argv prefix. See [Run Claude Code behind a corporate launcher](</docs/en/corporate-launcher>) +`CLAUDE_CODE_PROCESS_WRAPPER`| Launch the processes Claude Code starts from its own binary, such as the background service that hosts [agent view](</docs/en/agent-view>) sessions, through a corporate launcher given as an argv prefix like `/opt/corp/launcher`. Set it in the `env` block of user or [managed settings](</docs/en/permissions#managed-settings>), not as a shell export, so the detached background service inherits it; project and local settings can’t set it. Equivalent to the [`processWrapper` setting](</docs/en/settings#available-settings>), which requires Claude Code v2.1.210 or later; this variable takes precedence when both are set. The VS Code extension configures its own launcher separately through its `claudeProcessWrapper` setting. Ignored on Windows. See [Run Claude Code behind a corporate launcher](</docs/en/corporate-launcher>) for the value format, what the launcher covers, and the contract the launcher must satisfy. Requires Claude Code v2.1.208 or later `CLAUDE_CODE_PROPAGATE_TRACEPARENT`| Set to `1` to propagate W3C trace context when `ANTHROPIC_BASE_URL` points at a custom proxy. Propagation covers the `traceparent` header on model and HTTP MCP requests and the `TRACEPARENT` environment variable for Bash, PowerShell, and hook subprocesses. By default, propagation is enabled only when connected directly to the Anthropic API. Added in v2.1.152. See [Traces (beta)](</docs/en/monitoring-usage#traces-beta>) `CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`| Set by host platforms that embed Claude Code and manage model provider routing on its behalf. When set, provider-selection, endpoint, and authentication variables such as `CLAUDE_CODE_USE_BEDROCK`, `ANTHROPIC_BASE_URL`, and `ANTHROPIC_API_KEY` in settings files are ignored so user settings cannot override the host’s routing. The automatic telemetry opt-out for Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry is also skipped, so telemetry follows the standard `DISABLE_TELEMETRY` opt-out. See [Default behaviors by API provider](</docs/en/data-usage#default-behaviors-by-api-provider>) `CLAUDE_CODE_PROXY_RESOLVES_HOSTS`| Set to `1` to allow the proxy to perform DNS resolution instead of the caller. Opt-in for environments where the proxy should handle hostname resolution `CLAUDE_CODE_REMOTE`| Set automatically to `true` when Claude Code is running as a [cloud session](</docs/en/claude-code-on-the-web>). Read this from a hook or setup script to detect whether you are in a cloud environment `CLAUDE_CODE_REMOTE_SESSION_ID`| Set automatically in [cloud sessions](</docs/en/claude-code-on-the-web>) to the current session’s ID. Read this to construct a link back to the session transcript. See [Link output back to the session](</docs/en/claude-code-on-the-web#link-output-back-to-the-session>) `CLAUDE_CODE_RESUME_INTERRUPTED_TURN`| Set to `1` to automatically resume if the previous session ended mid-turn. Used in SDK mode so the model continues without requiring the SDK to re-send the prompt +`CLAUDE_CODE_RESUME_INTERRUPTED_TURN_MAX_AGE_MS`| Maximum age in milliseconds of the last transcript message for a session that ended mid-turn to continue automatically on resume. When the last message is older than this bound, Claude Code skips both the `CLAUDE_CODE_RESUME_INTERRUPTED_TURN` automatic resume and the injected `CLAUDE_CODE_RESUME_PROMPT` continuation message, and the session starts idle so you continue explicitly. Unset or `0` means no bound; a negative or non-numeric value applies a one-hour bound. Spawn scripts for long-running agents can set this so a restart against an old transcript doesn’t re-run a stale prompt. Claude Code sets a one-hour bound itself when it restarts a crashed [agent view](</docs/en/agent-view>) session that inherited its conversation from an interactive session. Requires Claude Code v2.1.211 or later `CLAUDE_CODE_RESUME_PROMPT`| Override the continuation message injected when resuming a session that ended mid-turn. Defaults to `Continue from where you left off.`. Spawn scripts for long-running agents can set this to a more directive boot message. An empty string uses the default `CLAUDE_CODE_RETRY_WATCHDOG`| Set to `1` for unattended sessions such as eval harnesses, CI jobs, or remote workers. Retries `429` and `529` capacity errors indefinitely instead of failing after `CLAUDE_CODE_MAX_RETRIES` attempts. The watchdog backs off up to 5 minutes between attempts, or until the limit resets when the response carries a rate-limit reset time, so a session that hits a usage limit waits out the remaining window. As of v2.1.199 it also raises the default retry count for other transient errors, such as server errors, timeouts, and dropped connections, to 300, roughly three hours of backoff, and removes the cap of 15 on `CLAUDE_CODE_MAX_RETRIES` if you set that variable explicitly. Requires Claude Code v2.1.186 or later `CLAUDE_CODE_SAFE_MODE`| Set to `1` to start in safe mode: CLAUDE.md, skills, plugins, hooks, MCP servers, custom commands and agents, output styles, workflows, custom themes, custom keybindings, status line and file-suggestion commands, LSP servers, and auto-memory do not load, for troubleshooting a broken configuration. Managed settings policy still applies, including policy-configured hooks, status line, and file-suggestion commands; managed plugins, managed skills, managed CLAUDE.md, and policy-configured MCP servers do not. Equivalent to passing [`--safe-mode`](</docs/en/cli-reference#cli-flags>). Directly spawned child processes inherit the variable `CLAUDE_CODE_SCRIPT_CAPS`| JSON object limiting how many times specific scripts may be invoked per session when `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB` is set. Keys are substrings matched against the command text; values are integer call limits. For example, `{"deploy.sh": 2}` allows `deploy.sh` to be called at most twice. Matching is substring-based so shell-expansion tricks like `./scripts/deploy.sh $(evil)` still count against the cap. Runtime fan-out via `xargs` or `find -exec` is not detected; this is a defense-in-depth control -`CLAUDE_CODE_SCROLL_SPEED`| Set the mouse wheel scroll multiplier in [fullscreen rendering](</docs/en/fullscreen#mouse-wheel-scrolling>). Accepts values from 1 to 20, and fractional values below 1 such as `0.5` to slow accelerated trackpad and wheel scrolling in terminals that already amplify wheel events. Set to `3` to match `vim` if your terminal sends one wheel event per notch without amplification. Ignored in the JetBrains IDE terminal, where Claude Code uses its own scroll handling +`CLAUDE_CODE_SCROLL_SPEED`| Set the mouse wheel scroll multiplier in [fullscreen rendering](</docs/en/fullscreen#mouse-wheel-scrolling>). Accepts any positive value up to 20, including fractional values below 1 such as `0.5` to slow accelerated trackpad and wheel scrolling in terminals that already amplify wheel events. Set to `3` to match `vim` if your terminal sends one wheel event per notch without amplification. Ignored in the JetBrains IDE terminal, where Claude Code uses its own scroll handling `CLAUDE_CODE_SESSIONEND_HOOKS_TIMEOUT_MS`| Override the time budget in milliseconds for [SessionEnd](</docs/en/hooks#sessionend>) hooks. Applies to session exit, `/clear`, and switching sessions via interactive `/resume`. By default the budget is 1.5 seconds, automatically raised to the highest per-hook `timeout` configured in settings files, up to 60 seconds. Timeouts on plugin-provided hooks do not raise the budget `CLAUDE_CODE_SESSION_ID`| Set automatically to the current session ID in Bash and PowerShell tool subprocesses, [hook command](</docs/en/hooks>) subprocesses, and stdio [MCP server](</docs/en/mcp>) subprocesses. For Bash, PowerShell, and hooks this matches the `session_id` field in the hook JSON input and is updated on `/clear`. An MCP server subprocess retains the ID it was spawned with. On `--resume <session-id>` it receives the resumed ID, matching hooks and Bash. On `--continue` or `--resume` without an explicit ID it may receive the initial startup ID instead. Use to correlate scripts and external tools with the Claude Code session that launched them `CLAUDE_CODE_SHELL`| Set the shell Claude Code uses to run Bash tool commands. Accepts a path to a `bash` or `zsh` binary, for example `/opt/homebrew/bin/bash`. Other shells such as `fish` are not supported. If the value is not a working `bash` or `zsh` path, Claude Code ignores it and falls back to auto-detection. Auto-detection uses your `$SHELL` when it points to `bash` or `zsh`, otherwise it picks the first working `zsh` then `bash` found on your `PATH` and standard install locations @@ -286,7 +304,6 @@ `CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS`| Timeout in milliseconds for the first query to wait on the initial skills sync when `CLAUDE_CODE_SYNC_SKILLS` is set (default: 5000). When exceeded, the query proceeds and remaining skill downloads continue in the background `CLAUDE_CODE_SYNTAX_HIGHLIGHT`| Set to `false` to disable syntax highlighting in diff output. Useful when colors interfere with your terminal setup. To also disable highlighting in code blocks and file previews, use the [`syntaxHighlightingDisabled`](</docs/en/settings>) setting `CLAUDE_CODE_TASK_LIST_ID`| Share a task list across sessions. Set the same ID in multiple Claude Code instances to coordinate on a shared task list. See [Task list](</docs/en/interactive-mode#task-list>) -`CLAUDE_CODE_TEAM_NAME`| Name of the agent team this teammate belongs to. Set automatically on [agent team](</docs/en/agent-teams>) members `CLAUDE_CODE_TEAM_TEARDOWN_PARK_TIMEOUT_MS`| Override, in milliseconds, how long a non-interactive session waits at exit for its [agent team](</docs/en/agent-teams>) to finish tearing down. Accepts 1000 to 60000; an out-of-range value is ignored and the default of 10000 applies. Requires Claude Code v2.1.206 or later `CLAUDE_CODE_TMPDIR`| Override the temp directory used for internal temp files. Claude Code appends `/claude-{uid}/` on Unix or `/claude/` on Windows to this path. Default: `/tmp` on macOS, `os.tmpdir()` on Linux and Windows. As of v2.1.161, on macOS and Linux, [sandboxed](</docs/en/sandboxing>) Bash subprocesses receive a short fallback `$TMPDIR` under the system default when your override is a long path, since some tools fail when temp paths get too long. Unsandboxed Bash commands inherit your shell’s `$TMPDIR` unchanged. Claude Code’s own temp files always use your override `CLAUDE_CODE_TMUX_TRUECOLOR`| Set to `1` to allow 24-bit truecolor output inside tmux. By default, Claude Code clamps to 256 colors when `$TMUX` is set because tmux does not pass through truecolor escape sequences unless configured to. Set this after adding `set -ga terminal-overrides ',*:Tc'` to your `~/.tmux.conf`. See [Terminal configuration](</docs/en/terminal-config>) for other tmux settings
modified
--- a/env-vars.md +++ b/env-vars.md @@ -178,7 +178,7 @@ `CLAUDE_CODE_DISABLE_BUNDLED_SKILLS`| Set to `1` to disable the [skills](</docs/en/skills>) and workflows included with Claude Code: bundled skills and workflows are removed entirely, while built-in commands like `/init` stay typable but are hidden from the model. `/doctor` stays typable like the built-in commands; hide it with `DISABLE_DOCTOR_COMMAND` instead. Skills from plugins, `.claude/skills/`, and `.claude/commands/` are unaffected. Equivalent to the [`disableBundledSkills`](</docs/en/settings#available-settings>) setting; `0` doesn’t override it `CLAUDE_CODE_DISABLE_CLAUDE_MDS`| Set to `1` to prevent loading any CLAUDE.md memory files into context, including user, project, and auto-memory files `CLAUDE_CODE_DISABLE_CRON`| Set to `1` to disable [scheduled tasks](</docs/en/scheduled-tasks>). The `/loop` skill and cron tools become unavailable and any already-scheduled tasks stop firing, including tasks that are already running mid-session -`CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`| Set to `1` to strip Anthropic-specific `anthropic-beta` request headers and beta tool-schema fields (such as `defer_loading` and `eager_input_streaming`) from API requests. Use this when a proxy gateway rejects requests with errors like “Unexpected value(s) for the `anthropic-beta` header” or “Extra inputs are not permitted”. Standard fields (`name`, `description`, `input_schema`, `cache_control`) are preserved +`CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`| Set to `1` to strip Anthropic-specific `anthropic-beta` request headers and beta tool-schema fields (such as `defer_loading` and `eager_input_streaming`) from API requests. Use this when a proxy gateway rejects requests with errors like “Unexpected value(s) for the `anthropic-beta` header” or “Extra inputs are not permitted”. Standard fields (`name`, `description`, `input_schema`, `cache_control`) are preserved. [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) is disabled and all MCP tools load upfront, even when `ENABLE_TOOL_SEARCH` is set `CLAUDE_CODE_DISABLE_EXPLORE_PLAN_AGENTS`| Set to `1` to disable the built-in [Explore and Plan subagents](</docs/en/sub-agents#built-in-subagents>). Claude explores with its search tools or the general-purpose subagent instead, and [plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>) reads files directly rather than launching Explore and Plan agents. Custom subagents named `Explore` or `Plan` are unaffected. To remove every built-in subagent type in the Agent SDK or non-interactive mode, use `CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS` instead. Requires Claude Code v2.1.198 or later `CLAUDE_CODE_DISABLE_FAST_MODE`| Set to `1` to disable [fast mode](</docs/en/fast-mode>) `CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY`| Set to `1` to disable the “How is Claude doing?” session quality surveys. Surveys are also disabled when `DISABLE_TELEMETRY`, `DO_NOT_TRACK`, or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` is set, unless `CLAUDE_CODE_ENABLE_FEEDBACK_SURVEY_FOR_OTEL` opts back in. To set a sample rate instead of disabling outright, use the [`feedbackSurveyRate`](</docs/en/settings#available-settings>) setting. See [Session quality surveys](</docs/en/data-usage#session-quality-surveys>) @@ -214,7 +214,7 @@ `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 `CLAUDE_CODE_FORCE_SESSION_PERSISTENCE`| Set to `1` to force transcript persistence, prompt history, and `claude agents` registration even when this `claude` was launched from inside another Claude Code session. Use when an inherited `CLAUDE_CODE_CHILD_SESSION` value, for example from a `screen` session or a background launcher first started by Claude Code’s Bash tool, causes a genuine top-level session to be misclassified as nested. As of v2.1.178, Claude Code detects the tmux case automatically and ignores the inherited marker, so tmux no longer needs this variable. Also honored on v2.1.169 and earlier; has no effect on v2.1.170 and v2.1.171, where the nested-session detection it overrides was removed `CLAUDE_CODE_FORCE_STRIKETHROUGH`| Set to `1` to force strikethrough rendering for `~~text~~` in Claude’s responses when your terminal supports it but is not auto-detected, such as over SSH without `TERM_PROGRAM` forwarded. Without this, undetected terminals show the literal `~~` markers instead of rendering the text as strikethrough. Requires Claude Code v2.1.186 or later -`CLAUDE_CODE_FORCE_SYNC_OUTPUT`| Set to `1` to force-enable DEC private mode 2026 [synchronized output](<https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036>) when your terminal supports it but is not auto-detected. Useful for emulators such as Emacs `eat` that implement BSU/ESU but do not reply to the capability probe. Has no effect under tmux +`CLAUDE_CODE_FORCE_SYNC_OUTPUT`| Set to `1` to force-enable DEC private mode 2026 [synchronized output](<https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036>) when your terminal supports it but is not auto-detected. Useful for emulators such as Emacs `eat` that implement BSU/ESU but do not reply to the capability probe. Has no effect under tmux. Unlike `CLAUDE_CODE_NO_FLICKER`, which switches to [fullscreen rendering](</docs/en/fullscreen>), this doesn’t change the renderer `CLAUDE_CODE_FORK_SUBAGENT`| Set to `1` to let Claude spawn [forked subagents](</docs/en/sub-agents#fork-the-current-conversation>), or `0` to disable them, overriding any server-side rollout. When enabled, Claude can request the `fork` subagent type to spawn a fork, a subagent that inherits the full conversation context instead of starting fresh. Spawns without a subagent type still use the general-purpose subagent, and all subagent spawns run in the background. The explicit [`/fork`](</docs/en/commands>) command works without this variable. Works in interactive mode and via the SDK or `claude -p` `CLAUDE_CODE_GIT_BASH_PATH`| Windows only: path to the Git Bash executable (`bash.exe`). Use when Git Bash is installed but not in your PATH. See [Windows setup](</docs/en/setup#set-up-on-windows>) `CLAUDE_CODE_GLOB_HIDDEN`| Set to `false` to exclude dotfiles from results when Claude invokes the [Glob tool](</docs/en/tools-reference#glob-tool-behavior>). Included by default. Does not affect `@` file autocomplete, `ls`, Grep, or Read @@ -312,7 +312,7 @@ `DISABLE_COMPACT`| Set to `1` to disable all compaction: both automatic compaction and the manual `/compact` command `DISABLE_COST_WARNINGS`| Set to `1` to disable cost warning messages `DISABLE_DOCTOR_COMMAND`| Set to `1` to hide the [`/doctor`](</docs/en/commands#all-commands>) setup checkup skill and its `/checkup` alias. Useful for managed deployments where users shouldn’t run setup diagnostics from a session. Doesn’t affect the `claude doctor` terminal command. Before v2.1.205, this variable hid the `/doctor` diagnostics screen command -`DISABLE_ERROR_REPORTING`| Set to `1` to opt out of Sentry error reporting +`DISABLE_ERROR_REPORTING`| Set to `1` to opt out of error reporting `DISABLE_EXTRA_USAGE_COMMAND`| Set to `1` to hide the `/usage-credits` command that lets users purchase additional usage beyond rate limits `DISABLE_FEEDBACK_COMMAND`| Set to `1` to disable the `/feedback` command. The older name `DISABLE_BUG_COMMAND` is also accepted `DISABLE_GROWTHBOOK`| Set to `1` to disable GrowthBook feature-flag fetching and use code defaults for every flag. Telemetry event logging stays on unless `DISABLE_TELEMETRY` is also set @@ -333,9 +333,10 @@ `ENABLE_CLAUDEAI_MCP_SERVERS`| Set to `false` to disable [claude.ai MCP servers](</docs/en/mcp#use-mcp-servers-from-claude-ai>) in Claude Code. Enabled by default for logged-in users. To disable per-project or per-org, set [`disableClaudeAiConnectors`](</docs/en/settings#available-settings>) in settings instead `ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) instead of the default 5 minutes. Intended for API key, [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), [Microsoft Foundry](</docs/en/microsoft-foundry>), and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) users. Subscription users within included usage receive 1-hour TTL automatically. 1-hour cache writes are billed at a higher rate `ENABLE_PROMPT_CACHING_1H_BEDROCK`| Deprecated. Use `ENABLE_PROMPT_CACHING_1H` instead -`ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset: all MCP tools deferred by default, but loaded upfront on Google Cloud’s Agent Platform or when `ANTHROPIC_BASE_URL` points to a non-first-party host. Values: `true` (always defer and send the beta header, requests fail on Google Cloud’s Agent Platform models earlier than Sonnet 4.5 or Opus 4.5, or on proxies that do not support `tool_reference`), `auto` (threshold mode: load upfront if tools fit within 10% of context), `auto:N` (custom threshold, e.g., `auto:5` for 5%), `false` (load all upfront) +`ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset: all MCP tools deferred by default, but loaded upfront on Google Cloud’s Agent Platform or when `ANTHROPIC_BASE_URL` points to a non-first-party host. Values: `true` (always defer and send the beta header, requests fail on Google Cloud’s Agent Platform models earlier than Sonnet 4.5 or Opus 4.5, or on proxies that do not support `tool_reference`), `auto` (threshold mode: load upfront if tools fit within 10% of context), `auto:N` (custom threshold, e.g., `auto:5` for 5%), `false` (load all upfront). Ignored when `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS` is set, which forces all tools to load upfront `FALLBACK_FOR_ALL_PRIMARY_MODELS`| Set to any non-empty value to make all models, not only Opus, stop retrying with a repeated-overload error when no fallback model is configured. As of v2.1.160, a configured [fallback model chain](</docs/en/model-config#fallback-model-chains>) triggers on repeated overload errors for any primary model, so this variable does not affect switching to a fallback model `FORCE_AUTOUPDATE_PLUGINS`| Set to `1` to force plugin auto-updates even when the main auto-updater is disabled via `DISABLE_AUTOUPDATER` +`FORCE_HYPERLINK`| Set to `1` to enable clickable OSC 8 hyperlinks when your terminal supports them but isn’t auto-detected, or `0` to disable them `FORCE_PROMPT_CACHING_5M`| Set to `1` to force the 5-minute prompt cache TTL even when 1-hour TTL would otherwise apply. Overrides `ENABLE_PROMPT_CACHING_1H` `HTTP_PROXY`| Specify HTTP proxy server for network connections `HTTPS_PROXY`| Specify HTTPS proxy server for network connections
modified
--- a/env-vars.md +++ b/env-vars.md @@ -75,7 +75,7 @@ Precedence -Where the same behavior has both an environment variable and a settings field, the environment variable takes precedence. For example, `ANTHROPIC_MODEL` overrides the `model` setting, and `CLAUDE_CODE_AUTO_CONNECT_IDE` overrides `autoConnectIde`. The settings field applies when the environment variable is not set. How an environment variable interacts with CLI flags and in-session commands varies per feature: `--model` and `/model` override `ANTHROPIC_MODEL`, while `CLAUDE_CODE_EFFORT_LEVEL` overrides `/effort`. When a variable interacts with another configuration source, its row in the Variables list states the precedence or links to the page that documents it. Claude Code reads environment variables at startup, so changes take effect the next time you launch `claude`. +Where the same behavior has both an environment variable and a settings field, the environment variable takes precedence. For example, `ANTHROPIC_MODEL` overrides the `model` setting, and `CLAUDE_CODE_AUTO_CONNECT_IDE` overrides `autoConnectIde`. The settings field applies when the environment variable is not set. When the same variable is set in both your shell and a settings file `env` block, the settings file value applies. Claude Code writes each `env` entry into the process environment at startup, replacing the value inherited from the shell. A few variables are special-cased; the [`env` setting](</docs/en/settings#available-settings>) lists the exceptions. Between settings files, `env` values follow [settings precedence](</docs/en/settings#settings-precedence>), so a managed settings entry overrides the same variable in user or project settings. How an environment variable interacts with CLI flags and in-session commands varies per feature: `--model` and `/model` override `ANTHROPIC_MODEL`, while `CLAUDE_CODE_EFFORT_LEVEL` overrides `/effort`. When a variable interacts with another configuration source, its row in the Variables list states the precedence or links to the page that documents it. Claude Code reads environment variables at startup, so changes take effect the next time you launch `claude`. ## @@ -172,6 +172,7 @@ `CLAUDE_CODE_DISABLE_ATTACHMENTS`| Set to `1` to disable attachment processing. File mentions with `@` syntax are sent as plain text instead of being expanded into file content `CLAUDE_CODE_DISABLE_AUTO_MEMORY`| Set to `1` to disable [auto memory](</docs/en/memory#auto-memory>). Set to `0` to force auto memory on even when `--bare` mode or [`autoMemoryEnabled: false`](</docs/en/settings#available-settings>) would otherwise disable it. When disabled, Claude does not create or load auto memory files `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 +`CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_GUARD`| Set to `1` to skip the check that an [Amazon Bedrock](</docs/en/amazon-bedrock>) streaming response carries the `application/vnd.amazon.eventstream` content-type. Without this variable, a response with a different content-type fails with an error naming that content-type, which means a [gateway or proxy is transforming the response](</docs/en/amazon-bedrock#streaming-errors-behind-a-gateway-or-proxy>). Set it only when the gateway rewrites the `Content-Type` header but passes the binary event-stream body through unmodified; if the body itself was transformed, requests fail with `Truncated event message received` instead. Requires Claude Code v2.1.208 or later `CLAUDE_CODE_DISABLE_BG_EXIT_HANDOFF`| Set to `1` to stop a [background session’s](</docs/en/agent-view>) running background shell commands, dynamic workflows, and, as of v2.1.198, background subagents when the [supervisor](</docs/en/agent-view#the-supervisor-process>) stops, restarts, or updates that session’s process, instead of handing them to the session’s next process. Affects only that handoff: backgrounding a session with `←` or [`/background`](</docs/en/agent-view#from-inside-a-session>) still carries in-flight work over, and `CLAUDE_DISABLE_ADOPT` turns off both. Requires Claude Code v2.1.196 or later `CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP`| Set to `1` to stop Claude Code from terminating [background shell commands](</docs/en/interactive-mode#background-bash-commands>) when the operating system reports memory pressure. By default, on macOS and Linux, Claude Code terminates a background shell started in the main session on a memory-pressure signal once the session has been idle for 30 minutes and no turn or subagent is running. Windows has no memory-pressure signal, so this variable has no effect there. Requires Claude Code v2.1.193 or later `CLAUDE_CODE_DISABLE_BUNDLED_SKILLS`| Set to `1` to disable the [skills](</docs/en/skills>) and workflows included with Claude Code: bundled skills and workflows are removed entirely, while built-in commands like `/init` stay typable but are hidden from the model. `/doctor` stays typable like the built-in commands; hide it with `DISABLE_DOCTOR_COMMAND` instead. Skills from plugins, `.claude/skills/`, and `.claude/commands/` are unaffected. Equivalent to the [`disableBundledSkills`](</docs/en/settings#available-settings>) setting; `0` doesn’t override it @@ -250,6 +251,7 @@ `CLAUDE_CODE_PLUGIN_SEED_DIR`| Path to one or more read-only plugin seed directories, separated by `:` on Unix or `;` on Windows. Use this to bundle a pre-populated plugins directory into a container image. Claude Code registers marketplaces from these directories at startup and uses pre-cached plugins without re-cloning. See [Pre-populate plugins for containers](</docs/en/plugin-marketplaces#pre-populate-plugins-for-containers>) `CLAUDE_CODE_POWERSHELL_RESPECT_EXECUTION_POLICY`| Set to `1` to stop Claude Code from passing `-ExecutionPolicy Bypass` when spawning PowerShell for tool calls, hooks, and status line commands, and respect the machine’s effective execution policy instead. By default Claude Code bypasses execution policy at process scope so `.ps1` scripts and module imports work on default-Restricted Windows installs. Process-scope bypass never overrides Group Policy `MachinePolicy` or `UserPolicy` regardless of this setting `CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS`| Maximum time in milliseconds that [non-interactive mode](</docs/en/headless#background-tasks-at-exit>) with the `-p` flag waits after the final turn for background subagents and workflows whose result is part of the output. Default: `600000`, or 10 minutes. When the cap is exceeded, remaining background tasks are terminated and the process exits. Set to `0` to wait indefinitely. This cap is separate from the five-second grace period that applies to plain background shells +`CLAUDE_CODE_PROCESS_WRAPPER`| Launch the processes Claude Code starts from its own binary through a wrapper executable, given as an argv prefix such as `/opt/corp/launcher`. Covers the background service that hosts [agent view](</docs/en/agent-view>) sessions, every session it spawns, and the relaunch Claude Code performs of itself to finish installing an update. The first token must be the absolute path of an executable that ends by running `exec "$@"`, and most launchers are that single path. The value is an argument list, not a shell command: whitespace separates tokens, double quotes group a path that contains spaces, and a value that starts with `[` is read as a JSON string array. Set it in the `env` block of user or [managed settings](</docs/en/permissions#managed-settings>), not as a shell export, so the detached background service inherits it; project and local settings can’t set it. The VS Code extension configures its own launcher separately through its `claudeProcessWrapper` setting. Ignored on Windows. `CLAUDE_CODE_SHELL_PREFIX` is a separate control: it wraps the shell commands Claude runs as a single quoted string, while this variable wraps Claude Code’s own processes as an argv prefix. See [Run Claude Code behind a corporate launcher](</docs/en/corporate-launcher>) `CLAUDE_CODE_PROPAGATE_TRACEPARENT`| Set to `1` to propagate W3C trace context when `ANTHROPIC_BASE_URL` points at a custom proxy. Propagation covers the `traceparent` header on model and HTTP MCP requests and the `TRACEPARENT` environment variable for Bash, PowerShell, and hook subprocesses. By default, propagation is enabled only when connected directly to the Anthropic API. Added in v2.1.152. See [Traces (beta)](</docs/en/monitoring-usage#traces-beta>) `CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`| Set by host platforms that embed Claude Code and manage model provider routing on its behalf. When set, provider-selection, endpoint, and authentication variables such as `CLAUDE_CODE_USE_BEDROCK`, `ANTHROPIC_BASE_URL`, and `ANTHROPIC_API_KEY` in settings files are ignored so user settings cannot override the host’s routing. The automatic telemetry opt-out for Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry is also skipped, so telemetry follows the standard `DISABLE_TELEMETRY` opt-out. See [Default behaviors by API provider](</docs/en/data-usage#default-behaviors-by-api-provider>) `CLAUDE_CODE_PROXY_RESOLVES_HOSTS`| Set to `1` to allow the proxy to perform DNS resolution instead of the caller. Opt-in for environments where the proxy should handle hostname resolution
modified
--- a/env-vars.md +++ b/env-vars.md @@ -122,7 +122,7 @@ `ANTHROPIC_FOUNDRY_RESOURCE`| Microsoft Foundry resource name (for example, `my-resource`). Required if `ANTHROPIC_FOUNDRY_BASE_URL` is not set (see [Microsoft Foundry](</docs/en/microsoft-foundry>)) `ANTHROPIC_MODEL`| Name of the model setting to use (see [Model Configuration](</docs/en/model-config#environment-variables>)) `ANTHROPIC_SMALL_FAST_MODEL`| [DEPRECATED] Name of [Haiku-class model for background tasks](</docs/en/costs>) -`ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION`| Override AWS region for the Haiku-class model when using Amazon Bedrock or Amazon Bedrock Mantle. On Amazon Bedrock, this only takes effect when `ANTHROPIC_DEFAULT_HAIKU_MODEL` or the deprecated `ANTHROPIC_SMALL_FAST_MODEL` is also set, since Amazon Bedrock otherwise uses the primary model for background tasks +`ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION`| Override AWS region for the Haiku-class model when using Amazon Bedrock or Amazon Bedrock Mantle. On Amazon Bedrock, this only takes effect when `ANTHROPIC_DEFAULT_HAIKU_MODEL` or the deprecated `ANTHROPIC_SMALL_FAST_MODEL` is also set, since Amazon Bedrock otherwise runs background tasks on the [default Sonnet model or the primary model](</docs/en/amazon-bedrock#4-pin-model-versions>) in the session region `ANTHROPIC_VERTEX_BASE_URL`| Override Google Cloud’s Agent Platform endpoint URL. Use for custom Google Cloud’s Agent Platform endpoints or when routing through an [LLM gateway](</docs/en/llm-gateway>). See [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>) `ANTHROPIC_VERTEX_PROJECT_ID`| GCP project ID for Google Cloud’s Agent Platform requests. Overridden by `GCLOUD_PROJECT`, `GOOGLE_CLOUD_PROJECT`, or the project in your `GOOGLE_APPLICATION_CREDENTIALS` credential file. See [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>) `ANTHROPIC_WORKSPACE_ID`| Workspace ID for [workload identity federation](<https://platform.claude.com/docs/en/manage-claude/workload-identity-federation>). Set this when your federation rule is scoped to more than one workspace so the token exchange knows which workspace to target @@ -153,6 +153,7 @@ `CLAUDE_CODE_ATTRIBUTION_HEADER`| Set to `0` to omit the attribution block (client version and prompt fingerprint) from the start of the system prompt. Disabling it improves prompt-cache hit rates when routing through an [LLM gateway](</docs/en/llm-gateway>). Caching on a direct connection to the Anthropic API is unaffected either way `CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the context capacity in tokens used for auto-compaction calculations. Defaults to the model’s context window, 200K for standard models or 1M for [extended context](</docs/en/model-config#extended-context>) models, except on Sonnet 5, which has its own [default threshold](</docs/en/model-config#sonnet-5-context-window>). Use a lower value like `500000` on a 1M model to treat the window as 500K for compaction purposes. The value is capped at the model’s actual context window. `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` is applied as a percentage of this value. Setting this variable decouples the compaction threshold from the status line’s `used_percentage`, which always uses the model’s full context window `CLAUDE_CODE_AUTO_CONNECT_IDE`| Override automatic [IDE connection](</docs/en/vs-code>). By default, Claude Code connects automatically when launched inside a supported IDE’s integrated terminal. Set to `false` to prevent this. Set to `true` to force a connection attempt when auto-detection fails, such as when tmux obscures the parent terminal. Takes precedence over the [`autoConnectIde`](</docs/en/settings#global-config-settings>) global config setting +`CLAUDE_CODE_AWS_CHAIN_RESOLVE_TIMEOUT_MS`| Time in milliseconds Claude Code waits for the AWS default credential provider chain to produce credentials before the request fails with [`AWS default-chain credential resolve timed out`](</docs/en/errors#aws-default-chain-credential-resolve-timed-out>) (default: `60000`). Raise it when a step in your chain legitimately needs longer, such as a browser-based SSO sign-in with MFA through a wrapper like `aws-vault`. Applies wherever Claude Code signs with the default chain: [Amazon Bedrock](</docs/en/amazon-bedrock#credential-caching-and-resolution-timeout>), [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), and the [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>). Requires Claude Code v2.1.207 or later `CLAUDE_CODE_BRIDGE_SESSION_ID`| Set automatically in Bash tool and [hook command](</docs/en/hooks>) subprocesses while the session has an active [Remote Control](</docs/en/remote-control>) connection, and removed when the connection ends. The value is the session’s ID in `session_` form, the same identifier that appears in the session’s `claude.ai/code` URL, so a script can link back to the session that ran it. Requires Claude Code v2.1.199 or later. In [cloud sessions](</docs/en/claude-code-on-the-web>), read `CLAUDE_CODE_REMOTE_SESSION_ID` instead `CLAUDE_CODE_CERT_STORE`| Comma-separated list of CA certificate sources for TLS connections. `bundled` is the Mozilla CA set shipped with Claude Code. `system` is the operating system trust store, read only on runtimes with `tls.getCACertificates`: the native binary, or Node 22.15 or later for npm installs. See [CA certificate store](</docs/en/network-config#ca-certificate-store>). Default is `bundled,system` `CLAUDE_CODE_CHILD_SESSION`| Set to `1` in subprocesses Claude Code spawns via the Bash, PowerShell, and Monitor tools, [hook](</docs/en/hooks>) commands, and [status line](</docs/en/statusline>) commands. Not set for stdio [MCP server](</docs/en/mcp>) subprocesses, which are long-lived and outlive the session that spawned them. Unlike `CLAUDECODE`, this is only set by Claude Code itself when it launches a subprocess and not by IDE extensions, so it reliably distinguishes a nested session from a top-level `claude` launched in an IDE-integrated terminal. A nested interactive `claude` TUI started this way is automatically excluded from `--resume`, `--continue`, up-arrow history, and the `claude agents` list. Non-interactive `claude -p` sessions still persist. Set `CLAUDE_CODE_FORCE_SESSION_PERSISTENCE=1` to override this exclusion. Requires Claude Code v2.1.172 or later @@ -164,7 +165,7 @@ `CLAUDE_CODE_DEBUG_LOG_LEVEL`| Minimum log level written to the debug log file. Values: `verbose`, `debug` (default), `info`, `warn`, `error`. Set to `verbose` to include high-volume diagnostics like full status line command output, or raise to `error` to reduce noise `CLAUDE_CODE_DISABLE_1M_CONTEXT`| Set to `1` to disable [1M context window](</docs/en/model-config#extended-context>) support. When set, 1M model variants are unavailable in the model picker, and [Sonnet 5](</docs/en/model-config#sonnet-5-context-window>) sessions are treated as having a 200K window. Useful for enterprise environments with compliance requirements `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING`| Set to `1` to disable [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) on Opus 4.6 and Sonnet 4.6 and fall back to the fixed thinking budget controlled by `MAX_THINKING_TOKENS`. From v2.1.111, has no effect on Fable 5, Sonnet 5, or Opus 4.7 and later, which always use adaptive reasoning -`CLAUDE_CODE_DISABLE_ADVISOR_TOOL`| Set to `1` to disable the [advisor tool](</docs/en/advisor>). The `/advisor` command becomes unavailable, any configured `advisorModel` is ignored, and the `--advisor` flag is accepted but has no effect, so existing scripts that pass it continue to work without errors. Requires Claude Code v2.1.98 or later +`CLAUDE_CODE_DISABLE_ADVISOR_TOOL`| Set to `1` to disable the [advisor tool](</docs/en/advisor>). The `/advisor` command becomes unavailable, any configured `advisorModel` is ignored, and the `--advisor` flag is accepted but has no effect, so existing scripts that pass it continue to work without errors `CLAUDE_CODE_DISABLE_AGENT_VIEW`| Set to `1` to turn off [background agents and agent view](</docs/en/agent-view>): `claude agents`, `--bg`, `/background`, and the on-demand supervisor. Equivalent to the [`disableAgentView`](</docs/en/settings#available-settings>) setting `CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN`| Set to `1` to disable [fullscreen rendering](</docs/en/fullscreen>) and use the classic main-screen renderer. The conversation stays in your terminal’s native scrollback so `Cmd+f` and tmux copy mode work as usual. Takes precedence over `CLAUDE_CODE_NO_FLICKER` and the [`tui`](</docs/en/settings#available-settings>) setting. You can also switch with `/tui default`. Does not apply to background sessions opened from [agent view](</docs/en/agent-view>), which always use fullscreen rendering `CLAUDE_CODE_DISABLE_ARTIFACT`| Set to `1` to disable the [Artifact](</docs/en/artifacts>) tool, which publishes session output as a private web page on claude.ai. Equivalent to the [`disableArtifact`](</docs/en/settings#available-settings>) setting @@ -196,7 +197,7 @@ `CLAUDE_CODE_DISABLE_WORKFLOWS`| Set to `1` to disable [workflows](</docs/en/workflows#turn-workflows-off>). Equivalent to the [`disableWorkflows`](</docs/en/settings#available-settings>) setting `CLAUDE_CODE_EFFORT_LEVEL`| Set the effort level for supported models. Values: `low`, `medium`, `high`, `xhigh`, `max`, or `auto` to use the model default. Available levels depend on the model. Takes precedence over `/effort` and the `effortLevel` setting. See [Adjust effort level](</docs/en/model-config#adjust-effort-level>) `CLAUDE_CODE_ENABLE_APPEND_SUBAGENT_PROMPT`| Set to `1` to enable appending extra text to the end of every [subagent](</docs/en/sub-agents>)’s system prompt. The [`--append-subagent-system-prompt`](</docs/en/cli-reference#cli-flags>) flag supplies the appended text and sets this variable automatically, so you don’t need to set it yourself. Requires Claude Code v2.1.205 or later -`CLAUDE_CODE_ENABLE_AUTO_MODE`| Set to `1` to make [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) available on Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and signed-in [Claude apps gateway](</docs/en/claude-apps-gateway>) sessions. Requires Claude Code v2.1.158 or later. Has no effect on the Anthropic API, where auto mode is available by default. See [Enable auto mode on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry](</docs/en/permission-modes#enable-auto-mode-on-bedrock-agent-platform-or-foundry>) +`CLAUDE_CODE_ENABLE_AUTO_MODE`| Accepted for compatibility with older releases and has no effect. Auto mode is available by default on every provider, including Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and signed-in [Claude apps gateway](</docs/en/claude-apps-gateway>) sessions. In v2.1.158 through v2.1.206, setting this to `1` was required to make [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) available on those providers `CLAUDE_CODE_ENABLE_AWAY_SUMMARY`| Override [session recap](</docs/en/interactive-mode#session-recap>) availability. Set to `0` to force recaps off regardless of the `/config` toggle. Set to `1` to force recaps on when [`awaySummaryEnabled`](</docs/en/settings#available-settings>) is `false`. Takes precedence over the setting and `/config` toggle `CLAUDE_CODE_ENABLE_BACKGROUND_PLUGIN_REFRESH`| Set to `1` to refresh plugin state at turn boundaries in [non-interactive mode](</docs/en/headless>) after a background install completes. Off by default because the refresh changes the system prompt mid-session, which invalidates [prompt caching](</docs/en/prompt-caching>) for that turn `CLAUDE_CODE_ENABLE_FEEDBACK_SURVEY_FOR_OTEL`| Set to `1` to route the “How is Claude doing?” session quality survey to your own [OpenTelemetry collector](</docs/en/monitoring-usage>) when Anthropic-bound nonessential traffic is blocked. Survey ratings are emitted only as OTEL events to your configured collector. No survey data is sent to Anthropic in this mode. Applies when `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`, `DISABLE_TELEMETRY`, or `DO_NOT_TRACK` is set, and has no effect otherwise. `CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY` and the organization product feedback policy take precedence @@ -208,7 +209,7 @@ `CLAUDE_CODE_ENABLE_TELEMETRY`| Set to `1` to enable OpenTelemetry data collection for metrics and logging. Required before configuring OTel exporters. See [Monitoring](</docs/en/monitoring-usage>) `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 `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS`| Set to `1` to enable [agent teams](</docs/en/agent-teams>). Agent teams are experimental and disabled by default -`CLAUDE_CODE_EXTRA_BODY`| JSON object to merge into the top level of every API request body. Useful for passing provider-specific parameters that Claude Code does not expose directly +`CLAUDE_CODE_EXTRA_BODY`| JSON object to merge into the top level of every API request body. Useful for passing provider-specific parameters that Claude Code doesn’t expose directly. A value exported in your shell also applies to the [background sessions](</docs/en/agent-view>) you dispatch with `claude agents` or `--bg`. Before v2.1.206, background sessions ignored a shell-exported value and used whatever copy the background supervisor process inherited `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 `CLAUDE_CODE_FORCE_SESSION_PERSISTENCE`| Set to `1` to force transcript persistence, prompt history, and `claude agents` registration even when this `claude` was launched from inside another Claude Code session. Use when an inherited `CLAUDE_CODE_CHILD_SESSION` value, for example from a `screen` session or a background launcher first started by Claude Code’s Bash tool, causes a genuine top-level session to be misclassified as nested. As of v2.1.178, Claude Code detects the tmux case automatically and ignores the inherited marker, so tmux no longer needs this variable. Also honored on v2.1.169 and earlier; has no effect on v2.1.170 and v2.1.171, where the nested-session detection it overrides was removed `CLAUDE_CODE_FORCE_STRIKETHROUGH`| Set to `1` to force strikethrough rendering for `~~text~~` in Claude’s responses when your terminal supports it but is not auto-detected, such as over SSH without `TERM_PROGRAM` forwarded. Without this, undetected terminals show the literal `~~` markers instead of rendering the text as strikethrough. Requires Claude Code v2.1.186 or later @@ -244,7 +245,7 @@ `CLAUDE_CODE_PERFORCE_MODE`| Set to `1` to enable Perforce-aware write protection. When set, Edit, Write, and NotebookEdit fail with a `p4 edit <file>` hint if the target file lacks the owner-write bit, which Perforce clears on synced files until `p4 edit` opens them. This prevents Claude Code from bypassing Perforce change tracking `CLAUDE_CODE_PLUGIN_CACHE_DIR`| Override the plugins root directory. Despite the name, this sets the parent directory, not the cache itself: marketplaces and the plugin cache live in subdirectories under this path. Defaults to `~/.claude/plugins` `CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS`| Timeout in milliseconds for git operations when installing or updating plugins (default: 120000). Increase this value for large repositories or slow network connections. See [Git operations time out](</docs/en/plugin-marketplaces#git-operations-time-out>) -`CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE`| Set to `1` to keep the existing marketplace cache when a `git pull` fails instead of wiping and re-cloning. Useful in offline or airgapped environments where re-cloning would fail the same way. See [Marketplace updates fail in offline environments](</docs/en/plugin-marketplaces#marketplace-updates-fail-in-offline-environments>) +`CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE`| Set to `1` to skip the re-clone attempt and keep using the existing marketplace cache when a `git pull` fails. Useful in offline or airgapped environments where re-cloning would fail the same way. See [Marketplace updates fail in offline environments](</docs/en/plugin-marketplaces#marketplace-updates-fail-in-offline-environments>) `CLAUDE_CODE_PLUGIN_PREFER_HTTPS`| Set to `1` to clone GitHub `owner/repo` shorthand sources over HTTPS instead of SSH. Applies to plugin install and update, and to `/plugin marketplace add` and `update`. Useful in CI runners, containers, or any environment without a configured SSH key for `github.com` `CLAUDE_CODE_PLUGIN_SEED_DIR`| Path to one or more read-only plugin seed directories, separated by `:` on Unix or `;` on Windows. Use this to bundle a pre-populated plugins directory into a container image. Claude Code registers marketplaces from these directories at startup and uses pre-cached plugins without re-cloning. See [Pre-populate plugins for containers](</docs/en/plugin-marketplaces#pre-populate-plugins-for-containers>) `CLAUDE_CODE_POWERSHELL_RESPECT_EXECUTION_POLICY`| Set to `1` to stop Claude Code from passing `-ExecutionPolicy Bypass` when spawning PowerShell for tool calls, hooks, and status line commands, and respect the machine’s effective execution policy instead. By default Claude Code bypasses execution policy at process scope so `.ps1` scripts and module imports work on default-Restricted Windows installs. Process-scope bypass never overrides Group Policy `MachinePolicy` or `UserPolicy` regardless of this setting @@ -267,6 +268,7 @@ `CLAUDE_CODE_SIMPLE`| Set to `1` to run with a minimal system prompt and only the Bash, file read, and file edit tools. MCP tools from `--mcp-config` are still available. Disables auto-discovery of hooks, skills, plugins, MCP servers, auto memory, and CLAUDE.md. OAuth tokens and keychain credentials are not read, so Anthropic authentication must come from `ANTHROPIC_API_KEY` or an `apiKeyHelper` in `--settings`. Equivalent to passing [`--bare`](</docs/en/headless#start-faster-with-bare-mode>) `CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT`| Set to `1` to use a shorter system prompt and abbreviated tool descriptions on any model. Set to `0`, `false`, `no`, or `off` to opt out even on models where the experiment or server configuration would otherwise enable it. The full tool set, hooks, MCP servers, and CLAUDE.md discovery remain enabled `CLAUDE_CODE_SKIP_ANTHROPIC_AWS_AUTH`| Skip client-side authentication for [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), for gateways that sign requests themselves +`CLAUDE_CODE_SKIP_AWS_CRED_CACHE`| Set to `1` to turn off the in-process cache of credentials resolved from the AWS default credential provider chain, so Claude Code resolves the chain on every API request. With the cache off, an SSO-backed profile requests credentials from IAM Identity Center on every request. See [credential caching and resolution timeout](</docs/en/amazon-bedrock#credential-caching-and-resolution-timeout>). Requires Claude Code v2.1.207 or later `CLAUDE_CODE_SKIP_BEDROCK_AUTH`| Skip AWS authentication for Amazon Bedrock (for example, when using an LLM gateway) `CLAUDE_CODE_SKIP_FOUNDRY_AUTH`| Skip Azure authentication for Microsoft Foundry, for a proxy or gateway that injects its own `Authorization` header. Claude Code sends requests without an Azure credential and preserves the `Authorization` header you supply, for example through `ANTHROPIC_CUSTOM_HEADERS`. Ignored when `ANTHROPIC_FOUNDRY_API_KEY` or `ANTHROPIC_FOUNDRY_AUTH_TOKEN` is set. Before v2.1.203, this variable left the Microsoft Foundry client unable to send requests unless an API key was also set `CLAUDE_CODE_SKIP_MANTLE_AUTH`| Skip AWS authentication for Amazon Bedrock Mantle (for example, when using an LLM gateway) @@ -283,6 +285,7 @@ `CLAUDE_CODE_SYNTAX_HIGHLIGHT`| Set to `false` to disable syntax highlighting in diff output. Useful when colors interfere with your terminal setup. To also disable highlighting in code blocks and file previews, use the [`syntaxHighlightingDisabled`](</docs/en/settings>) setting `CLAUDE_CODE_TASK_LIST_ID`| Share a task list across sessions. Set the same ID in multiple Claude Code instances to coordinate on a shared task list. See [Task list](</docs/en/interactive-mode#task-list>) `CLAUDE_CODE_TEAM_NAME`| Name of the agent team this teammate belongs to. Set automatically on [agent team](</docs/en/agent-teams>) members +`CLAUDE_CODE_TEAM_TEARDOWN_PARK_TIMEOUT_MS`| Override, in milliseconds, how long a non-interactive session waits at exit for its [agent team](</docs/en/agent-teams>) to finish tearing down. Accepts 1000 to 60000; an out-of-range value is ignored and the default of 10000 applies. Requires Claude Code v2.1.206 or later `CLAUDE_CODE_TMPDIR`| Override the temp directory used for internal temp files. Claude Code appends `/claude-{uid}/` on Unix or `/claude/` on Windows to this path. Default: `/tmp` on macOS, `os.tmpdir()` on Linux and Windows. As of v2.1.161, on macOS and Linux, [sandboxed](</docs/en/sandboxing>) Bash subprocesses receive a short fallback `$TMPDIR` under the system default when your override is a long path, since some tools fail when temp paths get too long. Unsandboxed Bash commands inherit your shell’s `$TMPDIR` unchanged. Claude Code’s own temp files always use your override `CLAUDE_CODE_TMUX_TRUECOLOR`| Set to `1` to allow 24-bit truecolor output inside tmux. By default, Claude Code clamps to 256 colors when `$TMUX` is set because tmux does not pass through truecolor escape sequences unless configured to. Set this after adding `set -ga terminal-overrides ',*:Tc'` to your `~/.tmux.conf`. See [Terminal configuration](</docs/en/terminal-config>) for other tmux settings `CLAUDE_CODE_USE_ANTHROPIC_AWS`| Use [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) @@ -345,7 +348,7 @@ `MCP_REMOTE_SERVER_CONNECTION_BATCH_SIZE`| Maximum number of remote MCP servers (HTTP/SSE) to connect in parallel during startup (default: 20) `MCP_SERVER_CONNECTION_BATCH_SIZE`| Maximum number of local MCP servers (stdio) to connect in parallel during startup (default: 3) `MCP_TIMEOUT`| Timeout in milliseconds for MCP server startup (default: 30000, or 30 seconds) -`MCP_TOOL_TIMEOUT`| Timeout in milliseconds for MCP tool execution (default: 100000000, about 28 hours). A per-server `timeout` field in `.mcp.json` overrides this for that server. A per-server `timeout` of at least 1000 also sets the minimum idle window for that server’s tool calls, so `CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT` never aborts them sooner; this floor requires Claude Code v2.1.203 or later. For the env variable, values below 1000 are floored to one second; for the per-server field, values below 1000 are ignored +`MCP_TOOL_TIMEOUT`| Timeout in milliseconds for MCP tool execution (default: 100000000, about 28 hours). For an HTTP, SSE, or claude.ai connector server, each request also times out after 60 seconds by default; set this variable, or the per-server `timeout`, above 60000 to raise that per-request limit. A lower value still shortens the overall tool-execution timeout but leaves the per-request limit at 60 seconds. Stdio and WebSocket servers have no per-request timer. A per-server `timeout` field in `.mcp.json` overrides this for that server. A per-server `timeout` of at least 1000 also sets the minimum idle window for that server’s tool calls, so `CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT` never aborts them sooner; this floor requires Claude Code v2.1.203 or later. For the env variable, values below 1000 are floored to one second; for the per-server field, values below 1000 are ignored `NO_PROXY`| List of domains and IPs to which requests will be directly issued, bypassing proxy `OTEL_LOG_ASSISTANT_RESPONSES`| Set to `1` to include the model’s response text on `assistant_response` OpenTelemetry log events. When unset, the value of `OTEL_LOG_USER_PROMPTS` is used instead. Set to `0` to keep responses redacted even when `OTEL_LOG_USER_PROMPTS` is set. Requires Claude Code v2.1.193 or later. See [Monitoring](</docs/en/monitoring-usage#assistant-response-event>) `OTEL_LOG_RAW_API_BODIES`| Emit Anthropic Messages API request and response JSON as `api_request_body` / `api_response_body` log events. Set to `1` for inline bodies truncated at 60 KB, or `file:<dir>` to write untruncated bodies to disk and emit a `body_ref` path instead. Disabled by default; bodies include the entire conversation history. See [Monitoring](</docs/en/monitoring-usage#api-request-body-event>)
modified
--- a/env-vars.md +++ b/env-vars.md @@ -173,7 +173,7 @@ `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 `CLAUDE_CODE_DISABLE_BG_EXIT_HANDOFF`| Set to `1` to stop a [background session’s](</docs/en/agent-view>) running background shell commands, dynamic workflows, and, as of v2.1.198, background subagents when the [supervisor](</docs/en/agent-view#the-supervisor-process>) stops, restarts, or updates that session’s process, instead of handing them to the session’s next process. Affects only that handoff: backgrounding a session with `←` or [`/background`](</docs/en/agent-view#from-inside-a-session>) still carries in-flight work over, and `CLAUDE_DISABLE_ADOPT` turns off both. Requires Claude Code v2.1.196 or later `CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP`| Set to `1` to stop Claude Code from terminating [background shell commands](</docs/en/interactive-mode#background-bash-commands>) when the operating system reports memory pressure. By default, on macOS and Linux, Claude Code terminates a background shell started in the main session on a memory-pressure signal once the session has been idle for 30 minutes and no turn or subagent is running. Windows has no memory-pressure signal, so this variable has no effect there. Requires Claude Code v2.1.193 or later -`CLAUDE_CODE_DISABLE_BUNDLED_SKILLS`| Set to `1` to disable the [skills](</docs/en/skills>) and workflows that ship with Claude Code: bundled skills and workflows are removed entirely, while built-in slash commands like `/init` stay typable but are hidden from the model. Skills from plugins, `.claude/skills/`, and `.claude/commands/` are unaffected. Equivalent to the [`disableBundledSkills`](</docs/en/settings#available-settings>) setting; `0` does not override it +`CLAUDE_CODE_DISABLE_BUNDLED_SKILLS`| Set to `1` to disable the [skills](</docs/en/skills>) and workflows included with Claude Code: bundled skills and workflows are removed entirely, while built-in commands like `/init` stay typable but are hidden from the model. `/doctor` stays typable like the built-in commands; hide it with `DISABLE_DOCTOR_COMMAND` instead. Skills from plugins, `.claude/skills/`, and `.claude/commands/` are unaffected. Equivalent to the [`disableBundledSkills`](</docs/en/settings#available-settings>) setting; `0` doesn’t override it `CLAUDE_CODE_DISABLE_CLAUDE_MDS`| Set to `1` to prevent loading any CLAUDE.md memory files into context, including user, project, and auto-memory files `CLAUDE_CODE_DISABLE_CRON`| Set to `1` to disable [scheduled tasks](</docs/en/scheduled-tasks>). The `/loop` skill and cron tools become unavailable and any already-scheduled tasks stop firing, including tasks that are already running mid-session `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`| Set to `1` to strip Anthropic-specific `anthropic-beta` request headers and beta tool-schema fields (such as `defer_loading` and `eager_input_streaming`) from API requests. Use this when a proxy gateway rejects requests with errors like “Unexpected value(s) for the `anthropic-beta` header” or “Extra inputs are not permitted”. Standard fields (`name`, `description`, `input_schema`, `cache_control`) are preserved @@ -195,6 +195,7 @@ `CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL`| Set to `1` to disable virtual scrolling in [fullscreen rendering](</docs/en/fullscreen>) and render every message in the transcript. Use this if scrolling in fullscreen mode shows blank regions where messages should appear `CLAUDE_CODE_DISABLE_WORKFLOWS`| Set to `1` to disable [workflows](</docs/en/workflows#turn-workflows-off>). Equivalent to the [`disableWorkflows`](</docs/en/settings#available-settings>) setting `CLAUDE_CODE_EFFORT_LEVEL`| Set the effort level for supported models. Values: `low`, `medium`, `high`, `xhigh`, `max`, or `auto` to use the model default. Available levels depend on the model. Takes precedence over `/effort` and the `effortLevel` setting. See [Adjust effort level](</docs/en/model-config#adjust-effort-level>) +`CLAUDE_CODE_ENABLE_APPEND_SUBAGENT_PROMPT`| Set to `1` to enable appending extra text to the end of every [subagent](</docs/en/sub-agents>)’s system prompt. The [`--append-subagent-system-prompt`](</docs/en/cli-reference#cli-flags>) flag supplies the appended text and sets this variable automatically, so you don’t need to set it yourself. Requires Claude Code v2.1.205 or later `CLAUDE_CODE_ENABLE_AUTO_MODE`| Set to `1` to make [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) available on Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and signed-in [Claude apps gateway](</docs/en/claude-apps-gateway>) sessions. Requires Claude Code v2.1.158 or later. Has no effect on the Anthropic API, where auto mode is available by default. See [Enable auto mode on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry](</docs/en/permission-modes#enable-auto-mode-on-bedrock-agent-platform-or-foundry>) `CLAUDE_CODE_ENABLE_AWAY_SUMMARY`| Override [session recap](</docs/en/interactive-mode#session-recap>) availability. Set to `0` to force recaps off regardless of the `/config` toggle. Set to `1` to force recaps on when [`awaySummaryEnabled`](</docs/en/settings#available-settings>) is `false`. Takes precedence over the setting and `/config` toggle `CLAUDE_CODE_ENABLE_BACKGROUND_PLUGIN_REFRESH`| Set to `1` to refresh plugin state at turn boundaries in [non-interactive mode](</docs/en/headless>) after a background install completes. Off by default because the refresh changes the system prompt mid-session, which invalidates [prompt caching](</docs/en/prompt-caching>) for that turn @@ -305,7 +306,7 @@ `DISABLE_AUTO_COMPACT`| Set to `1` to disable automatic compaction when approaching the context limit. The manual `/compact` command remains available. Use when you want explicit control over when compaction occurs `DISABLE_COMPACT`| Set to `1` to disable all compaction: both automatic compaction and the manual `/compact` command `DISABLE_COST_WARNINGS`| Set to `1` to disable cost warning messages -`DISABLE_DOCTOR_COMMAND`| Set to `1` to hide the `/doctor` command. Useful for managed deployments where users should not run installation diagnostics +`DISABLE_DOCTOR_COMMAND`| Set to `1` to hide the [`/doctor`](</docs/en/commands#all-commands>) setup checkup skill and its `/checkup` alias. Useful for managed deployments where users shouldn’t run setup diagnostics from a session. Doesn’t affect the `claude doctor` terminal command. Before v2.1.205, this variable hid the `/doctor` diagnostics screen command `DISABLE_ERROR_REPORTING`| Set to `1` to opt out of Sentry error reporting `DISABLE_EXTRA_USAGE_COMMAND`| Set to `1` to hide the `/usage-credits` command that lets users purchase additional usage beyond rate limits `DISABLE_FEEDBACK_COMMAND`| Set to `1` to disable the `/feedback` command. The older name `DISABLE_BUG_COMMAND` is also accepted
modified
--- a/env-vars.md +++ b/env-vars.md @@ -117,6 +117,7 @@ `ANTHROPIC_DEFAULT_SONNET_MODEL_NAME`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) `ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) `ANTHROPIC_FOUNDRY_API_KEY`| API key for Microsoft Foundry authentication (see [Microsoft Foundry](</docs/en/microsoft-foundry>)) +`ANTHROPIC_FOUNDRY_AUTH_TOKEN`| Bearer token for Microsoft Foundry authentication, such as a Microsoft Entra access token. Claude Code sends it as the `Authorization: Bearer` header. Takes precedence over `ANTHROPIC_FOUNDRY_API_KEY` and over the Azure default credential chain. See [Microsoft Foundry](</docs/en/microsoft-foundry>). Requires Claude Code v2.1.203 or later `ANTHROPIC_FOUNDRY_BASE_URL`| Full base URL for the Microsoft Foundry resource (for example, `https://my-resource.services.ai.azure.com/anthropic`). Alternative to `ANTHROPIC_FOUNDRY_RESOURCE` (see [Microsoft Foundry](</docs/en/microsoft-foundry>)) `ANTHROPIC_FOUNDRY_RESOURCE`| Microsoft Foundry resource name (for example, `my-resource`). Required if `ANTHROPIC_FOUNDRY_BASE_URL` is not set (see [Microsoft Foundry](</docs/en/microsoft-foundry>)) `ANTHROPIC_MODEL`| Name of the model setting to use (see [Model Configuration](</docs/en/model-config#environment-variables>)) @@ -226,7 +227,7 @@ `CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY`| Maximum number of read-only tools and subagents that can execute in parallel (default: 10). Higher values increase parallelism but consume more resources `CLAUDE_CODE_MAX_TURNS`| Cap the number of agentic turns when no explicit limit is passed. Equivalent to passing [`--max-turns`](</docs/en/cli-reference#cli-flags>), which takes precedence when both are set. A value that is not a positive integer is rejected at startup with an error rather than treated as no cap `CLAUDE_CODE_MCP_ALLOWLIST_ENV`| Set to `1` to spawn stdio MCP servers with only a safe baseline environment plus the server’s configured `env`, instead of inheriting your shell environment -`CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT`| Idle timeout in milliseconds for remote MCP tool calls (default: 300000, or 5 minutes). When an HTTP, SSE, WebSocket, or [claude.ai connector](</docs/en/mcp#use-mcp-servers-from-claude-ai>) MCP server sends no response and no progress notification for this long, the tool call aborts with an error instead of waiting for the overall `MCP_TOOL_TIMEOUT`. Set to `0` to disable the idle check. Values below 1000 are raised to one second, and the value is capped at the effective `MCP_TOOL_TIMEOUT`. Does not apply to stdio or IDE servers. Requires Claude Code v2.1.187 or later +`CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT`| Idle timeout in milliseconds for MCP tool calls. When a stdio, HTTP, SSE, WebSocket, or [claude.ai connector](</docs/en/mcp#use-mcp-servers-from-claude-ai>) MCP server sends no response and no progress notification for this long, the tool call aborts with an error instead of waiting for the overall `MCP_TOOL_TIMEOUT`. Overrides the per-transport defaults of 300000 (5 minutes) for network servers and 1800000 (30 minutes) for stdio servers. Set to `0` to disable the idle check. Values below 1000 are raised to one second, and the value is capped at the effective `MCP_TOOL_TIMEOUT`. A per-server `timeout` in `.mcp.json` of at least 1000 raises that server’s idle window to at least the `timeout` value. Doesn’t apply to IDE servers or SDK in-process servers. Requires Claude Code v2.1.187 or later. Before v2.1.203, stdio servers were exempt from the idle timeout `CLAUDE_CODE_NATIVE_CURSOR`| Set to `1` to show the terminal’s own cursor at the input caret instead of a drawn block. The cursor respects the terminal’s blink, shape, and focus settings `CLAUDE_CODE_NEW_INIT`| Set to `1` to make `/init` run an interactive setup flow. The flow asks which files to generate, including CLAUDE.md, skills, and hooks, before exploring the codebase and writing them. Without this variable, `/init` generates a CLAUDE.md automatically without prompting `CLAUDE_CODE_NO_FLICKER`| Set to `1` to enable [fullscreen rendering](</docs/en/fullscreen>), a research preview that reduces flicker and keeps memory flat in long conversations. Equivalent to the [`tui`](</docs/en/settings#available-settings>) setting; you can also switch with `/tui fullscreen` @@ -266,7 +267,7 @@ `CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT`| Set to `1` to use a shorter system prompt and abbreviated tool descriptions on any model. Set to `0`, `false`, `no`, or `off` to opt out even on models where the experiment or server configuration would otherwise enable it. The full tool set, hooks, MCP servers, and CLAUDE.md discovery remain enabled `CLAUDE_CODE_SKIP_ANTHROPIC_AWS_AUTH`| Skip client-side authentication for [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), for gateways that sign requests themselves `CLAUDE_CODE_SKIP_BEDROCK_AUTH`| Skip AWS authentication for Amazon Bedrock (for example, when using an LLM gateway) -`CLAUDE_CODE_SKIP_FOUNDRY_AUTH`| Skip Azure authentication for Microsoft Foundry. For a gateway, set the credential in `ANTHROPIC_FOUNDRY_API_KEY` instead; without an API key this variable leaves the Microsoft Foundry client unable to send requests +`CLAUDE_CODE_SKIP_FOUNDRY_AUTH`| Skip Azure authentication for Microsoft Foundry, for a proxy or gateway that injects its own `Authorization` header. Claude Code sends requests without an Azure credential and preserves the `Authorization` header you supply, for example through `ANTHROPIC_CUSTOM_HEADERS`. Ignored when `ANTHROPIC_FOUNDRY_API_KEY` or `ANTHROPIC_FOUNDRY_AUTH_TOKEN` is set. Before v2.1.203, this variable left the Microsoft Foundry client unable to send requests unless an API key was also set `CLAUDE_CODE_SKIP_MANTLE_AUTH`| Skip AWS authentication for Amazon Bedrock Mantle (for example, when using an LLM gateway) `CLAUDE_CODE_SKIP_PROMPT_HISTORY`| Set to `1` to skip writing prompt history and session transcripts to disk. Sessions started with this variable set do not appear in `--resume`, `--continue`, or up-arrow history. Useful for ephemeral scripted sessions `CLAUDE_CODE_SKIP_VERTEX_AUTH`| Skip Google authentication for Google Cloud’s Agent Platform (for example, when using an LLM gateway) @@ -343,7 +344,7 @@ `MCP_REMOTE_SERVER_CONNECTION_BATCH_SIZE`| Maximum number of remote MCP servers (HTTP/SSE) to connect in parallel during startup (default: 20) `MCP_SERVER_CONNECTION_BATCH_SIZE`| Maximum number of local MCP servers (stdio) to connect in parallel during startup (default: 3) `MCP_TIMEOUT`| Timeout in milliseconds for MCP server startup (default: 30000, or 30 seconds) -`MCP_TOOL_TIMEOUT`| Timeout in milliseconds for MCP tool execution (default: 100000000, about 28 hours). A per-server `timeout` field in `.mcp.json` overrides this for that server. For the env variable, values below 1000 are floored to one second; for the per-server field, values below 1000 are ignored +`MCP_TOOL_TIMEOUT`| Timeout in milliseconds for MCP tool execution (default: 100000000, about 28 hours). A per-server `timeout` field in `.mcp.json` overrides this for that server. A per-server `timeout` of at least 1000 also sets the minimum idle window for that server’s tool calls, so `CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT` never aborts them sooner; this floor requires Claude Code v2.1.203 or later. For the env variable, values below 1000 are floored to one second; for the per-server field, values below 1000 are ignored `NO_PROXY`| List of domains and IPs to which requests will be directly issued, bypassing proxy `OTEL_LOG_ASSISTANT_RESPONSES`| Set to `1` to include the model’s response text on `assistant_response` OpenTelemetry log events. When unset, the value of `OTEL_LOG_USER_PROMPTS` is used instead. Set to `0` to keep responses redacted even when `OTEL_LOG_USER_PROMPTS` is set. Requires Claude Code v2.1.193 or later. See [Monitoring](</docs/en/monitoring-usage#assistant-response-event>) `OTEL_LOG_RAW_API_BODIES`| Emit Anthropic Messages API request and response JSON as `api_request_body` / `api_response_body` log events. Set to `1` for inline bodies truncated at 60 KB, or `file:<dir>` to write untruncated bodies to disk and emit a `body_ref` path instead. Disabled by default; bodies include the entire conversation history. See [Monitoring](</docs/en/monitoring-usage#api-request-body-event>)
modified
--- a/env-vars.md +++ b/env-vars.md @@ -348,7 +348,7 @@ `OTEL_LOG_ASSISTANT_RESPONSES`| Set to `1` to include the model’s response text on `assistant_response` OpenTelemetry log events. When unset, the value of `OTEL_LOG_USER_PROMPTS` is used instead. Set to `0` to keep responses redacted even when `OTEL_LOG_USER_PROMPTS` is set. Requires Claude Code v2.1.193 or later. See [Monitoring](</docs/en/monitoring-usage#assistant-response-event>) `OTEL_LOG_RAW_API_BODIES`| Emit Anthropic Messages API request and response JSON as `api_request_body` / `api_response_body` log events. Set to `1` for inline bodies truncated at 60 KB, or `file:<dir>` to write untruncated bodies to disk and emit a `body_ref` path instead. Disabled by default; bodies include the entire conversation history. See [Monitoring](</docs/en/monitoring-usage#api-request-body-event>) `OTEL_LOG_TOOL_CONTENT`| Set to `1` to include tool input and output content in OpenTelemetry span events. Disabled by default to protect sensitive data. See [Monitoring](</docs/en/monitoring-usage>) -`OTEL_LOG_TOOL_DETAILS`| Set to `1` to include tool input arguments, MCP server names, raw error strings on tool failures, the refusal `category` on `api_refusal` events, and other tool details in OpenTelemetry traces and logs. Disabled by default to protect PII. See [Monitoring](</docs/en/monitoring-usage>) +`OTEL_LOG_TOOL_DETAILS`| Set to `1` to include tool input arguments, MCP server names, user-authored workflow names, raw error strings on tool failures, the refusal `category` on `api_refusal` events, and other tool details in OpenTelemetry traces and logs. Disabled by default to protect PII. See [Monitoring](</docs/en/monitoring-usage>) `OTEL_LOG_USER_PROMPTS`| Set to `1` to include user prompt text in OpenTelemetry traces and logs. Disabled by default (prompts are redacted). See [Monitoring](</docs/en/monitoring-usage>) `OTEL_METRICS_INCLUDE_ACCOUNT_UUID`| Set to `false` to exclude account UUID from metrics attributes (default: included). See [Monitoring](</docs/en/monitoring-usage>) `OTEL_METRICS_INCLUDE_ENTRYPOINT`| Set to `true` to include the session entrypoint in metrics attributes (default: excluded). Added in v2.1.152. See [Monitoring](</docs/en/monitoring-usage>)
modified
Show diff (195 lines)
--- a/env-vars.md +++ b/env-vars.md @@ -90,10 +90,10 @@ `ANTHROPIC_AWS_API_KEY`| Workspace API key for [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), generated in the AWS Console. Sent as `x-api-key` and takes precedence over AWS SigV4 `ANTHROPIC_AWS_BASE_URL`| Override the [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) endpoint URL. Use for custom regions or when routing through an [LLM gateway](</docs/en/llm-gateway>). Defaults to `https://aws-external-anthropic.{AWS_REGION}.api.aws` `ANTHROPIC_AWS_WORKSPACE_ID`| Required for [Claude Platform on AWS](</docs/en/claude-platform-on-aws>). Sent on every request as the `anthropic-workspace-id` header -`ANTHROPIC_BASE_URL`| Override the API endpoint to route requests through a proxy or gateway. When set to a non-first-party host, [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) is disabled by default. Set `ENABLE_TOOL_SEARCH=true` if your proxy forwards `tool_reference` blocks. As of v2.1.196, [Remote Control](</docs/en/remote-control#requirements>) is disabled when this points at a host other than `api.anthropic.com`, matching its behavior on Bedrock, Vertex AI, and Foundry -`ANTHROPIC_BEDROCK_BASE_URL`| Override the Bedrock endpoint URL. Use for custom Bedrock endpoints or when routing through an [LLM gateway](</docs/en/llm-gateway>). See [Amazon Bedrock](</docs/en/amazon-bedrock>) -`ANTHROPIC_BEDROCK_MANTLE_BASE_URL`| Override the Bedrock Mantle endpoint URL. See [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>) -`ANTHROPIC_BEDROCK_SERVICE_TIER`| Bedrock [service tier](<https://docs.aws.amazon.com/bedrock/latest/userguide/service-tiers-inference.html>) (`default`, `flex`, or `priority`). Sent as the `X-Amzn-Bedrock-Service-Tier` header. See [Amazon Bedrock](</docs/en/amazon-bedrock#service-tiers>) +`ANTHROPIC_BASE_URL`| Override the API endpoint to route requests through a proxy or gateway. When set to a non-first-party host, [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) is disabled by default. Set `ENABLE_TOOL_SEARCH=true` if your proxy forwards `tool_reference` blocks. As of v2.1.196, [Remote Control](</docs/en/remote-control#requirements>) is disabled when this points at a host other than `api.anthropic.com`, matching its behavior on Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry +`ANTHROPIC_BEDROCK_BASE_URL`| Override the Amazon Bedrock endpoint URL. Use for custom Amazon Bedrock endpoints or when routing through an [LLM gateway](</docs/en/llm-gateway>). See [Amazon Bedrock](</docs/en/amazon-bedrock>) +`ANTHROPIC_BEDROCK_MANTLE_BASE_URL`| Override the Amazon Bedrock Mantle endpoint URL. See [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>) +`ANTHROPIC_BEDROCK_SERVICE_TIER`| Amazon Bedrock [service tier](<https://docs.aws.amazon.com/bedrock/latest/userguide/service-tiers-inference.html>) (`default`, `flex`, or `priority`). Sent as the `X-Amzn-Bedrock-Service-Tier` header. See [Amazon Bedrock](</docs/en/amazon-bedrock#service-tiers>) `ANTHROPIC_BETAS`| Comma-separated list of additional `anthropic-beta` header values to include in API requests. Claude Code already sends the beta headers it needs; use this to opt into an [Anthropic API beta](<https://platform.claude.com/docs/en/api/beta-headers>) before Claude Code adds native support. Unlike the [`--betas` flag](</docs/en/cli-reference#cli-flags>), which requires API key authentication, this variable works with all auth methods including Claude.ai subscription `ANTHROPIC_CUSTOM_HEADERS`| Custom headers to add to requests (`Name: Value` format, newline-separated for multiple headers) `ANTHROPIC_CUSTOM_MODEL_OPTION`| Model ID to add as a custom entry in the `/model` picker. Use this to make a non-standard or gateway-specific model selectable without replacing built-in aliases. See [Model configuration](</docs/en/model-config#add-a-custom-model-option>) @@ -117,24 +117,24 @@ `ANTHROPIC_DEFAULT_SONNET_MODEL_NAME`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) `ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) `ANTHROPIC_FOUNDRY_API_KEY`| API key for Microsoft Foundry authentication (see [Microsoft Foundry](</docs/en/microsoft-foundry>)) -`ANTHROPIC_FOUNDRY_BASE_URL`| Full base URL for the Foundry resource (for example, `https://my-resource.services.ai.azure.com/anthropic`). Alternative to `ANTHROPIC_FOUNDRY_RESOURCE` (see [Microsoft Foundry](</docs/en/microsoft-foundry>)) -`ANTHROPIC_FOUNDRY_RESOURCE`| Foundry resource name (for example, `my-resource`). Required if `ANTHROPIC_FOUNDRY_BASE_URL` is not set (see [Microsoft Foundry](</docs/en/microsoft-foundry>)) +`ANTHROPIC_FOUNDRY_BASE_URL`| Full base URL for the Microsoft Foundry resource (for example, `https://my-resource.services.ai.azure.com/anthropic`). Alternative to `ANTHROPIC_FOUNDRY_RESOURCE` (see [Microsoft Foundry](</docs/en/microsoft-foundry>)) +`ANTHROPIC_FOUNDRY_RESOURCE`| Microsoft Foundry resource name (for example, `my-resource`). Required if `ANTHROPIC_FOUNDRY_BASE_URL` is not set (see [Microsoft Foundry](</docs/en/microsoft-foundry>)) `ANTHROPIC_MODEL`| Name of the model setting to use (see [Model Configuration](</docs/en/model-config#environment-variables>)) `ANTHROPIC_SMALL_FAST_MODEL`| [DEPRECATED] Name of [Haiku-class model for background tasks](</docs/en/costs>) -`ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION`| Override AWS region for the Haiku-class model when using Bedrock or Bedrock Mantle. On Bedrock, this only takes effect when `ANTHROPIC_DEFAULT_HAIKU_MODEL` or the deprecated `ANTHROPIC_SMALL_FAST_MODEL` is also set, since Bedrock otherwise uses the primary model for background tasks -`ANTHROPIC_VERTEX_BASE_URL`| Override the Vertex AI endpoint URL. Use for custom Vertex endpoints or when routing through an [LLM gateway](</docs/en/llm-gateway>). See [Google Vertex AI](</docs/en/google-vertex-ai>) -`ANTHROPIC_VERTEX_PROJECT_ID`| GCP project ID for Vertex AI requests. Overridden by `GCLOUD_PROJECT`, `GOOGLE_CLOUD_PROJECT`, or the project in your `GOOGLE_APPLICATION_CREDENTIALS` credential file. See [Google Vertex AI](</docs/en/google-vertex-ai>) +`ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION`| Override AWS region for the Haiku-class model when using Amazon Bedrock or Amazon Bedrock Mantle. On Amazon Bedrock, this only takes effect when `ANTHROPIC_DEFAULT_HAIKU_MODEL` or the deprecated `ANTHROPIC_SMALL_FAST_MODEL` is also set, since Amazon Bedrock otherwise uses the primary model for background tasks +`ANTHROPIC_VERTEX_BASE_URL`| Override Google Cloud’s Agent Platform endpoint URL. Use for custom Google Cloud’s Agent Platform endpoints or when routing through an [LLM gateway](</docs/en/llm-gateway>). See [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>) +`ANTHROPIC_VERTEX_PROJECT_ID`| GCP project ID for Google Cloud’s Agent Platform requests. Overridden by `GCLOUD_PROJECT`, `GOOGLE_CLOUD_PROJECT`, or the project in your `GOOGLE_APPLICATION_CREDENTIALS` credential file. See [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>) `ANTHROPIC_WORKSPACE_ID`| Workspace ID for [workload identity federation](<https://platform.claude.com/docs/en/manage-claude/workload-identity-federation>). Set this when your federation rule is scoped to more than one workspace so the token exchange knows which workspace to target -`API_FORCE_IDLE_TIMEOUT`| Override the 5-minute idle timeout that aborts a streaming model response when no bytes arrive. Set to `0` to disable the timeout, for example when a slow [gateway](</docs/en/llm-gateway>) or local model pauses longer than 5 minutes between chunks. Set to `1` to keep the timeout on every provider. When unset, the timeout is inactive on direct Anthropic API and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) connections, where Claude Code’s own byte-level stream watchdog runs, and active on every other provider, including [Vertex AI](</docs/en/google-vertex-ai>), [Foundry](</docs/en/microsoft-foundry>), [Mantle](</docs/en/amazon-bedrock#use-the-mantle-endpoint>), [Bedrock](</docs/en/amazon-bedrock>), and gateway connections, so a stalled stream aborts instead of hanging. As of v2.1.169 +`API_FORCE_IDLE_TIMEOUT`| Override the 5-minute idle timeout that aborts a streaming model response when no bytes arrive. Set to `0` to disable the timeout, for example when a slow [gateway](</docs/en/llm-gateway>) or local model pauses longer than 5 minutes between chunks. Set to `1` to keep the timeout on every provider. When unset, the timeout is inactive on direct Anthropic API and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) connections, where Claude Code’s own byte-level stream watchdog runs, and active on every other provider, including [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), [Microsoft Foundry](</docs/en/microsoft-foundry>), [Mantle](</docs/en/amazon-bedrock#use-the-mantle-endpoint>), [Amazon Bedrock](</docs/en/amazon-bedrock>), and gateway connections, so a stalled stream aborts instead of hanging. As of v2.1.169 `API_TIMEOUT_MS`| Timeout for API requests in milliseconds (default: 600000, or 10 minutes; maximum: 2147483647). Increase this when requests time out on slow networks or when routing through a proxy. Values above the maximum overflow the underlying timer and cause requests to fail immediately -`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/>)) +`AWS_BEARER_TOKEN_BEDROCK`| Amazon Bedrock API key for authentication (see [Amazon Bedrock API keys](<https://aws.amazon.com/blogs/machine-learning/accelerate-ai-development-with-amazon-bedrock-api-keys/>)) `BASH_DEFAULT_TIMEOUT_MS`| Default timeout for long-running bash commands (default: 120000, or 2 minutes) `BASH_MAX_OUTPUT_LENGTH`| Maximum number of characters in bash outputs before the full output is saved to a file and Claude receives the path plus a short preview. See [Bash tool behavior](</docs/en/tools-reference#bash-tool-behavior>) `BASH_MAX_TIMEOUT_MS`| Maximum timeout the model can set for long-running bash commands (default: 600000, or 10 minutes) -`CCR_FORCE_BUNDLE`| Set to `1` to force [`claude --remote`](</docs/en/claude-code-on-the-web#send-local-repositories-without-github>) to bundle and upload your local repository even when GitHub access is available +`CCR_FORCE_BUNDLE`| Set to `1` to force [`claude --cloud`](</docs/en/claude-code-on-the-web#send-local-repositories-without-github>) to bundle and upload your local repository even when GitHub access is available `CLAUDECODE`| Set to `1` in subprocesses Claude Code spawns (Bash and PowerShell tools, tmux sessions, [hook](</docs/en/hooks>) commands, [status line](</docs/en/statusline>) commands, stdio [MCP server](</docs/en/mcp>) subprocesses). IDE extensions also set this in their integrated terminals. Use to detect when a script is running inside a subprocess spawned by Claude Code. To check whether the current process was spawned directly by a tool call or hook, rather than inside a stdio MCP server that Claude Code started, use `CLAUDE_CODE_CHILD_SESSION` instead -`CLAUDE_AFK_COUNTDOWN_MS`| How many milliseconds before auto-continue the on-screen countdown appears on an unanswered `AskUserQuestion` dialog. Default `20000` (20 seconds). See `CLAUDE_AFK_TIMEOUT_MS`. Requires Claude Code v2.1.198 or later -`CLAUDE_AFK_TIMEOUT_MS`| How many milliseconds of idle time before an unanswered [`AskUserQuestion`](</docs/en/tools-reference>) dialog auto-continues without you. Default `60000` (60 seconds). To keep questions open while you’re away, set a large value like `86400000` (24 hours). Setting `0` doesn’t turn the timeout off; it closes the dialog immediately. Requires Claude Code v2.1.198 or later +`CLAUDE_AFK_COUNTDOWN_MS`| How many milliseconds before auto-continue the on-screen countdown appears on an unanswered [`AskUserQuestion`](</docs/en/tools-reference>) dialog. Default `20000` (20 seconds), capped at the auto-continue timeout. Has no effect unless auto-continue is on; see the [`askUserQuestionTimeout`](</docs/en/settings#available-settings>) setting and `CLAUDE_AFK_TIMEOUT_MS`. Requires Claude Code v2.1.198 or later +`CLAUDE_AFK_TIMEOUT_MS`| How many milliseconds of idle time before an unanswered [`AskUserQuestion`](</docs/en/tools-reference>) dialog auto-continues without you. Auto-continue is off by default; opt in with the [`askUserQuestionTimeout`](</docs/en/settings#available-settings>) setting. This variable is an override for demos and automated tests: when set, it takes precedence over that setting and turns auto-continue on even when the setting is unset or `never`. Setting `0` doesn’t turn the timeout off; it closes the dialog immediately. In v2.1.198 and v2.1.199, auto-continue was on by default with a `60000` (60 seconds) timeout. Requires Claude Code v2.1.198 or later `CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS`| Set to `1` to disable all built-in [subagent](</docs/en/sub-agents>) types such as Explore and Plan. Only applies in non-interactive mode (the `-p` flag). Useful for SDK users who want a blank slate `CLAUDE_AGENT_SDK_MCP_NO_PREFIX`| Set to `1` to skip the `mcp__<server>__` prefix on tool names from SDK-created MCP servers. Tools use their original names. SDK usage only `CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS`| Stall timeout in milliseconds for background subagents. Default `600000` (10 minutes). The timer resets on each streaming progress event; if no progress arrives within the window, the subagent is aborted and the task is marked failed, surfacing any partial result to the parent @@ -149,7 +149,7 @@ `CLAUDE_CODE_ALWAYS_ENABLE_EFFORT`| Set to `1` to send the [effort](</docs/en/model-config#adjust-effort-level>) parameter with every request, even when Claude Code does not recognize the model ID as effort-capable. Use this when routing through an [LLM gateway](</docs/en/llm-gateway>) or third-party provider that serves models under custom identifiers. Models that reject the effort parameter at the API, including Claude 3 models, Sonnet 4.0 and 4.5, Opus 4.0 and 4.1, and Haiku 4.5, are still excluded so requests do not fail `CLAUDE_CODE_API_KEY_HELPER_TTL_MS`| Interval in milliseconds at which credentials should be refreshed (when using [`apiKeyHelper`](</docs/en/settings#available-settings>)) `CLAUDE_CODE_ARTIFACT_AUTO_OPEN`| Set to `0` to stop Claude Code from opening the browser automatically when a new [artifact](</docs/en/artifacts>) is published. Republishing an existing artifact does not open the browser regardless of this setting -`CLAUDE_CODE_ATTRIBUTION_HEADER`| Set to `0` to omit the attribution block (client version and prompt fingerprint) from the start of the system prompt. Disabling it improves prompt-cache hit rates when routing through an [LLM gateway](</docs/en/llm-gateway>). Anthropic API caching is unaffected +`CLAUDE_CODE_ATTRIBUTION_HEADER`| Set to `0` to omit the attribution block (client version and prompt fingerprint) from the start of the system prompt. Disabling it improves prompt-cache hit rates when routing through an [LLM gateway](</docs/en/llm-gateway>). Caching on a direct connection to the Anthropic API is unaffected either way `CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the context capacity in tokens used for auto-compaction calculations. Defaults to the model’s context window, 200K for standard models or 1M for [extended context](</docs/en/model-config#extended-context>) models, except on Sonnet 5, which has its own [default threshold](</docs/en/model-config#sonnet-5-context-window>). Use a lower value like `500000` on a 1M model to treat the window as 500K for compaction purposes. The value is capped at the model’s actual context window. `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` is applied as a percentage of this value. Setting this variable decouples the compaction threshold from the status line’s `used_percentage`, which always uses the model’s full context window `CLAUDE_CODE_AUTO_CONNECT_IDE`| Override automatic [IDE connection](</docs/en/vs-code>). By default, Claude Code connects automatically when launched inside a supported IDE’s integrated terminal. Set to `false` to prevent this. Set to `true` to force a connection attempt when auto-detection fails, such as when tmux obscures the parent terminal. Takes precedence over the [`autoConnectIde`](</docs/en/settings#global-config-settings>) global config setting `CLAUDE_CODE_BRIDGE_SESSION_ID`| Set automatically in Bash tool and [hook command](</docs/en/hooks>) subprocesses while the session has an active [Remote Control](</docs/en/remote-control>) connection, and removed when the connection ends. The value is the session’s ID in `session_` form, the same identifier that appears in the session’s `claude.ai/code` URL, so a script can link back to the session that ran it. Requires Claude Code v2.1.199 or later. In [cloud sessions](</docs/en/claude-code-on-the-web>), read `CLAUDE_CODE_REMOTE_SESSION_ID` instead @@ -181,7 +181,7 @@ `CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY`| Set to `1` to disable the “How is Claude doing?” session quality surveys. Surveys are also disabled when `DISABLE_TELEMETRY`, `DO_NOT_TRACK`, or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` is set, unless `CLAUDE_CODE_ENABLE_FEEDBACK_SURVEY_FOR_OTEL` opts back in. To set a sample rate instead of disabling outright, use the [`feedbackSurveyRate`](</docs/en/settings#available-settings>) setting. See [Session quality surveys](</docs/en/data-usage#session-quality-surveys>) `CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING`| Set to `1` to disable file [checkpointing](</docs/en/checkpointing>). The `/rewind` command will not be able to restore code changes `CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS`| Set to `1` to remove built-in commit and PR workflow instructions and the git status snapshot from Claude’s system prompt. Useful when using your own git workflow skills. Takes precedence over the [`includeGitInstructions`](</docs/en/settings#available-settings>) setting when set -`CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP`| Set to `1` to prevent automatic remapping of Opus 4.0 and 4.1 to the current Opus version on the Anthropic API. Use when you intentionally want to pin an older model. The remap does not run on Bedrock, Vertex, or Foundry +`CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP`| Set to `1` to prevent automatic remapping of Opus 4.0 and 4.1 to the current Opus version on the Anthropic API. Use when you intentionally want to pin an older model. The remap does not run on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry `CLAUDE_CODE_DISABLE_MOUSE`| Set to `1` to disable mouse tracking in [fullscreen rendering](</docs/en/fullscreen>). Keyboard scrolling with `PgUp` and `PgDn` still works. Use this to keep your terminal’s native copy-on-select behavior `CLAUDE_CODE_DISABLE_MOUSE_CLICKS`| Set to `1` to disable click, drag, and hover handling in [fullscreen rendering](</docs/en/fullscreen>) while keeping mouse-wheel scrolling. Use this when you want wheel scroll to work inside Claude Code but don’t want clicks to position the cursor, expand tool output, or open links. `CLAUDE_CODE_DISABLE_MOUSE` takes precedence when both are set. Requires Claude Code v2.1.195 or later `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`| Equivalent of setting `DISABLE_AUTOUPDATER`, `DISABLE_FEEDBACK_COMMAND`, `DISABLE_ERROR_REPORTING`, and `DISABLE_TELEMETRY` @@ -194,11 +194,11 @@ `CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL`| Set to `1` to disable virtual scrolling in [fullscreen rendering](</docs/en/fullscreen>) and render every message in the transcript. Use this if scrolling in fullscreen mode shows blank regions where messages should appear `CLAUDE_CODE_DISABLE_WORKFLOWS`| Set to `1` to disable [workflows](</docs/en/workflows#turn-workflows-off>). Equivalent to the [`disableWorkflows`](</docs/en/settings#available-settings>) setting `CLAUDE_CODE_EFFORT_LEVEL`| Set the effort level for supported models. Values: `low`, `medium`, `high`, `xhigh`, `max`, or `auto` to use the model default. Available levels depend on the model. Takes precedence over `/effort` and the `effortLevel` setting. See [Adjust effort level](</docs/en/model-config#adjust-effort-level>) -`CLAUDE_CODE_ENABLE_AUTO_MODE`| Set to `1` to make [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) available on Amazon Bedrock, Google Cloud Vertex AI, Microsoft Foundry, and signed-in [Claude apps gateway](</docs/en/claude-apps-gateway>) sessions. Requires Claude Code v2.1.158 or later. Has no effect on the Anthropic API, where auto mode is available by default. See [Enable auto mode on Bedrock, Vertex AI, or Foundry](</docs/en/permission-modes#enable-auto-mode-on-bedrock-vertex-ai-or-foundry>) +`CLAUDE_CODE_ENABLE_AUTO_MODE`| Set to `1` to make [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) available on Amazon Bedrock, Google Cloud’s Agent Platform, Microsoft Foundry, and signed-in [Claude apps gateway](</docs/en/claude-apps-gateway>) sessions. Requires Claude Code v2.1.158 or later. Has no effect on the Anthropic API, where auto mode is available by default. See [Enable auto mode on Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry](</docs/en/permission-modes#enable-auto-mode-on-bedrock-agent-platform-or-foundry>) `CLAUDE_CODE_ENABLE_AWAY_SUMMARY`| Override [session recap](</docs/en/interactive-mode#session-recap>) availability. Set to `0` to force recaps off regardless of the `/config` toggle. Set to `1` to force recaps on when [`awaySummaryEnabled`](</docs/en/settings#available-settings>) is `false`. Takes precedence over the setting and `/config` toggle `CLAUDE_CODE_ENABLE_BACKGROUND_PLUGIN_REFRESH`| Set to `1` to refresh plugin state at turn boundaries in [non-interactive mode](</docs/en/headless>) after a background install completes. Off by default because the refresh changes the system prompt mid-session, which invalidates [prompt caching](</docs/en/prompt-caching>) for that turn `CLAUDE_CODE_ENABLE_FEEDBACK_SURVEY_FOR_OTEL`| Set to `1` to route the “How is Claude doing?” session quality survey to your own [OpenTelemetry collector](</docs/en/monitoring-usage>) when Anthropic-bound nonessential traffic is blocked. Survey ratings are emitted only as OTEL events to your configured collector. No survey data is sent to Anthropic in this mode. Applies when `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`, `DISABLE_TELEMETRY`, or `DO_NOT_TRACK` is set, and has no effect otherwise. `CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY` and the organization product feedback policy take precedence -`CLAUDE_CODE_ENABLE_FINE_GRAINED_TOOL_STREAMING`| Controls whether tool call inputs stream from the API as Claude generates them. With this off, a large tool input such as a long file write arrives only after Claude finishes generating it, which can look like it’s hanging. Enabled by default on the Anthropic API. On Bedrock and Vertex, enabled per model where the deployed container supports it. Set to `0` to opt out. Set to `1` to force on when routing through a proxy via `ANTHROPIC_BASE_URL`, `ANTHROPIC_VERTEX_BASE_URL`, or `ANTHROPIC_BEDROCK_BASE_URL`. Off by default on Foundry and [gateway](</docs/en/llm-gateway>) connections +`CLAUDE_CODE_ENABLE_FINE_GRAINED_TOOL_STREAMING`| Controls whether tool call inputs stream from the API as Claude generates them. With this off, a large tool input such as a long file write arrives only after Claude finishes generating it, which can look like it’s hanging. Enabled by default on the Anthropic API. On Amazon Bedrock and Google Cloud’s Agent Platform, enabled per model where the deployed container supports it. Set to `0` to opt out. Set to `1` to force on when routing through a proxy via `ANTHROPIC_BASE_URL`, `ANTHROPIC_VERTEX_BASE_URL`, or `ANTHROPIC_BEDROCK_BASE_URL`. Off by default on Microsoft Foundry and [gateway](</docs/en/llm-gateway>) connections `CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY`| Set to `1` to populate the `/model` picker from your gateway’s `/v1/models` endpoint when `ANTHROPIC_BASE_URL` points at an Anthropic-compatible gateway such as LiteLLM, Kong, or an internal proxy. Off by default because gateways backed by a shared API key would otherwise show every user every model the key can access. Discovered models are still filtered by an [`availableModels`](</docs/en/settings#available-settings>) allowlist the session receives; deliver the list through [MDM or a managed settings file](</docs/en/settings#settings-files>), since [server-managed delivery is not available on gateway configurations](</docs/en/server-managed-settings#platform-availability>) `CLAUDE_CODE_ENABLE_OPUS_4_7_FAST_MODE`| Removed in v2.1.142, when the [fast mode](</docs/en/fast-mode>) default moved from Opus 4.6 to Opus 4.7 `CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION`| Set to `false` to disable prompt suggestions (the “Prompt suggestions” toggle in `/config`). These are the grayed-out predictions that appear in your prompt input after Claude responds. See [Prompt suggestions](</docs/en/interactive-mode#prompt-suggestions>) @@ -248,7 +248,7 @@ `CLAUDE_CODE_POWERSHELL_RESPECT_EXECUTION_POLICY`| Set to `1` to stop Claude Code from passing `-ExecutionPolicy Bypass` when spawning PowerShell for tool calls, hooks, and status line commands, and respect the machine’s effective execution policy instead. By default Claude Code bypasses execution policy at process scope so `.ps1` scripts and module imports work on default-Restricted Windows installs. Process-scope bypass never overrides Group Policy `MachinePolicy` or `UserPolicy` regardless of this setting `CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS`| Maximum time in milliseconds that [non-interactive mode](</docs/en/headless#background-tasks-at-exit>) with the `-p` flag waits after the final turn for background subagents and workflows whose result is part of the output. Default: `600000`, or 10 minutes. When the cap is exceeded, remaining background tasks are terminated and the process exits. Set to `0` to wait indefinitely. This cap is separate from the five-second grace period that applies to plain background shells `CLAUDE_CODE_PROPAGATE_TRACEPARENT`| Set to `1` to propagate W3C trace context when `ANTHROPIC_BASE_URL` points at a custom proxy. Propagation covers the `traceparent` header on model and HTTP MCP requests and the `TRACEPARENT` environment variable for Bash, PowerShell, and hook subprocesses. By default, propagation is enabled only when connected directly to the Anthropic API. Added in v2.1.152. See [Traces (beta)](</docs/en/monitoring-usage#traces-beta>) -`CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`| Set by host platforms that embed Claude Code and manage model provider routing on its behalf. When set, provider-selection, endpoint, and authentication variables such as `CLAUDE_CODE_USE_BEDROCK`, `ANTHROPIC_BASE_URL`, and `ANTHROPIC_API_KEY` in settings files are ignored so user settings cannot override the host’s routing. The automatic telemetry opt-out for Bedrock, Vertex, and Foundry is also skipped, so telemetry follows the standard `DISABLE_TELEMETRY` opt-out. See [Default behaviors by API provider](</docs/en/data-usage#default-behaviors-by-api-provider>) +`CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`| Set by host platforms that embed Claude Code and manage model provider routing on its behalf. When set, provider-selection, endpoint, and authentication variables such as `CLAUDE_CODE_USE_BEDROCK`, `ANTHROPIC_BASE_URL`, and `ANTHROPIC_API_KEY` in settings files are ignored so user settings cannot override the host’s routing. The automatic telemetry opt-out for Amazon Bedrock, Google Cloud’s Agent Platform, and Microsoft Foundry is also skipped, so telemetry follows the standard `DISABLE_TELEMETRY` opt-out. See [Default behaviors by API provider](</docs/en/data-usage#default-behaviors-by-api-provider>) `CLAUDE_CODE_PROXY_RESOLVES_HOSTS`| Set to `1` to allow the proxy to perform DNS resolution instead of the caller. Opt-in for environments where the proxy should handle hostname resolution `CLAUDE_CODE_REMOTE`| Set automatically to `true` when Claude Code is running as a [cloud session](</docs/en/claude-code-on-the-web>). Read this from a hook or setup script to detect whether you are in a cloud environment `CLAUDE_CODE_REMOTE_SESSION_ID`| Set automatically in [cloud sessions](</docs/en/claude-code-on-the-web>) to the current session’s ID. Read this to construct a link back to the session transcript. See [Link output back to the session](</docs/en/claude-code-on-the-web#link-output-back-to-the-session>) @@ -265,11 +265,11 @@ `CLAUDE_CODE_SIMPLE`| Set to `1` to run with a minimal system prompt and only the Bash, file read, and file edit tools. MCP tools from `--mcp-config` are still available. Disables auto-discovery of hooks, skills, plugins, MCP servers, auto memory, and CLAUDE.md. OAuth tokens and keychain credentials are not read, so Anthropic authentication must come from `ANTHROPIC_API_KEY` or an `apiKeyHelper` in `--settings`. Equivalent to passing [`--bare`](</docs/en/headless#start-faster-with-bare-mode>) `CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT`| Set to `1` to use a shorter system prompt and abbreviated tool descriptions on any model. Set to `0`, `false`, `no`, or `off` to opt out even on models where the experiment or server configuration would otherwise enable it. The full tool set, hooks, MCP servers, and CLAUDE.md discovery remain enabled `CLAUDE_CODE_SKIP_ANTHROPIC_AWS_AUTH`| Skip client-side authentication for [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), for gateways that sign requests themselves -`CLAUDE_CODE_SKIP_BEDROCK_AUTH`| Skip AWS authentication for Bedrock (for example, when using an LLM gateway) -`CLAUDE_CODE_SKIP_FOUNDRY_AUTH`| Skip Azure authentication for Microsoft Foundry. For a gateway, set the credential in `ANTHROPIC_FOUNDRY_API_KEY` instead; without an API key this variable leaves the Foundry client unable to send requests -`CLAUDE_CODE_SKIP_MANTLE_AUTH`| Skip AWS authentication for Bedrock Mantle (for example, when using an LLM gateway) +`CLAUDE_CODE_SKIP_BEDROCK_AUTH`| Skip AWS authentication for Amazon Bedrock (for example, when using an LLM gateway) +`CLAUDE_CODE_SKIP_FOUNDRY_AUTH`| Skip Azure authentication for Microsoft Foundry. For a gateway, set the credential in `ANTHROPIC_FOUNDRY_API_KEY` instead; without an API key this variable leaves the Microsoft Foundry client unable to send requests +`CLAUDE_CODE_SKIP_MANTLE_AUTH`| Skip AWS authentication for Amazon Bedrock Mantle (for example, when using an LLM gateway) `CLAUDE_CODE_SKIP_PROMPT_HISTORY`| Set to `1` to skip writing prompt history and session transcripts to disk. Sessions started with this variable set do not appear in `--resume`, `--continue`, or up-arrow history. Useful for ephemeral scripted sessions -`CLAUDE_CODE_SKIP_VERTEX_AUTH`| Skip Google authentication for Vertex (for example, when using an LLM gateway) +`CLAUDE_CODE_SKIP_VERTEX_AUTH`| Skip Google authentication for Google Cloud’s Agent Platform (for example, when using an LLM gateway) `CLAUDE_CODE_STOP_HOOK_BLOCK_CAP`| Maximum number of consecutive times a [Stop](</docs/en/hooks#stop>) or [SubagentStop](</docs/en/hooks#subagentstop>) hook may block the turn from ending before Claude Code overrides it and ends the turn anyway (default: 8). Set to `0` to disable the cap. Raise this if your hook legitimately needs more iterations to resolve `CLAUDE_CODE_SUBAGENT_MODEL`| See [Model configuration](</docs/en/model-config>). As of v2.1.196, setting it to `inherit` is the same as leaving it unset; earlier versions treated `inherit` as an override that forced every subagent onto the main conversation’s model `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB`| Set to `1` to strip Anthropic and cloud provider credentials from subprocess environments (Bash tool, hooks, MCP stdio servers). The parent Claude process keeps these credentials for API calls, but child processes cannot read them, reducing exposure to prompt injection attacks that attempt to exfiltrate secrets via shell expansion. On Linux, this also runs Bash subprocesses in an isolated PID namespace so they cannot read host process environments via `/proc`; as a side effect, `ps`, `pgrep`, and `kill` cannot see or signal host processes. `claude-code-action` sets this automatically when `allowed_non_write_users` is configured @@ -284,21 +284,21 @@ `CLAUDE_CODE_TMPDIR`| Override the temp directory used for internal temp files. Claude Code appends `/claude-{uid}/` on Unix or `/claude/` on Windows to this path. Default: `/tmp` on macOS, `os.tmpdir()` on Linux and Windows. As of v2.1.161, on macOS and Linux, [sandboxed](</docs/en/sandboxing>) Bash subprocesses receive a short fallback `$TMPDIR` under the system default when your override is a long path, since some tools fail when temp paths get too long. Unsandboxed Bash commands inherit your shell’s `$TMPDIR` unchanged. Claude Code’s own temp files always use your override `CLAUDE_CODE_TMUX_TRUECOLOR`| Set to `1` to allow 24-bit truecolor output inside tmux. By default, Claude Code clamps to 256 colors when `$TMUX` is set because tmux does not pass through truecolor escape sequences unless configured to. Set this after adding `set -ga terminal-overrides ',*:Tc'` to your `~/.tmux.conf`. See [Terminal configuration](</docs/en/terminal-config>) for other tmux settings `CLAUDE_CODE_USE_ANTHROPIC_AWS`| Use [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) -`CLAUDE_CODE_USE_BEDROCK`| Use [Bedrock](</docs/en/amazon-bedrock>) +`CLAUDE_CODE_USE_BEDROCK`| Use [Amazon Bedrock](</docs/en/amazon-bedrock>) `CLAUDE_CODE_USE_FOUNDRY`| Use [Microsoft Foundry](</docs/en/microsoft-foundry>) -`CLAUDE_CODE_USE_MANTLE`| Use the Bedrock [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>) +`CLAUDE_CODE_USE_MANTLE`| Use the Amazon Bedrock [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>) `CLAUDE_CODE_USE_NATIVE_FILE_SEARCH`| Set to `1` to discover custom commands, subagents, and output styles using Node.js file APIs instead of ripgrep. Set this if the bundled ripgrep binary is unavailable or blocked in your environment. Does not affect the Grep or file search tools `CLAUDE_CODE_USE_POWERSHELL_TOOL`| Controls the PowerShell tool. On Windows without Git Bash, the tool is enabled automatically; set to `0` to disable it. On Windows with Git Bash installed, the tool is rolling out progressively: set to `1` to opt in or `0` to opt out. On Linux, macOS, and WSL, set to `1` to enable it, which requires `pwsh` on your `PATH`. When enabled on Windows, Claude can run PowerShell commands natively instead of routing through Git Bash. See [PowerShell tool](</docs/en/tools-reference#powershell-tool>) -`CLAUDE_CODE_USE_VERTEX`| Use [Vertex](</docs/en/google-vertex-ai>) +`CLAUDE_CODE_USE_VERTEX`| Use [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>) `CLAUDE_CONFIG_DIR`| Override the configuration directory (default: `~/.claude`). All settings, session history, and plugins are stored under this path, as are credentials on Linux and Windows; on macOS, credentials are in the system Keychain. Useful for running multiple accounts side by side: for example, `alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'` `CLAUDE_DISABLE_ADOPT`| Set to `1` to stop in-flight background work instead of carrying it over when you background a session by pressing `←` or with [`/background`](</docs/en/agent-view#from-inside-a-session>). Claude Code asks you to confirm before backgrounding, then stops the tasks that would otherwise carry over. Requires Claude Code v2.1.195 or later `CLAUDE_EFFORT`| Set automatically in Bash tool subprocesses and hook commands to the active [effort level](</docs/en/model-config#adjust-effort-level>) for the turn: `low`, `medium`, `high`, `xhigh`, or `max`. Ultracode is not a distinct level and reports as `xhigh`. Matches the `effort.level` field passed to [hooks](</docs/en/hooks>). Only set when the current model supports the effort parameter -`CLAUDE_ENABLE_BYTE_WATCHDOG`| Set to `1` to force-enable the byte-level streaming idle watchdog, or set to `0` to force-disable it. When unset, the watchdog is enabled by default for direct Anthropic API and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) connections. The byte watchdog aborts a connection when no bytes arrive on the wire for 180 seconds by default on direct Anthropic API connections, 300 seconds on Claude Platform on AWS and when enabled on Bedrock, or for the value of `CLAUDE_STREAM_IDLE_TIMEOUT_MS` when that is set, which is clamped to a minimum of 5 minutes, independent of the event-level watchdog +`CLAUDE_ENABLE_BYTE_WATCHDOG`| Set to `1` to force-enable the byte-level streaming idle watchdog, or set to `0` to force-disable it. When unset, the watchdog is enabled by default for direct Anthropic API and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) connections. The byte watchdog aborts a connection when no bytes arrive on the wire for 180 seconds by default on direct Anthropic API connections, 300 seconds on Claude Platform on AWS and when enabled on Amazon Bedrock, or for the value of `CLAUDE_STREAM_IDLE_TIMEOUT_MS` when that is set, which is clamped to a minimum of 5 minutes, independent of the event-level watchdog `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK`| Set to `1` to enable the byte-level streaming idle watchdog on Amazon Bedrock `vnd.amazon.eventstream` responses. Off by default. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS` -`CLAUDE_ENABLE_STREAM_WATCHDOG`| Set to `0` to force-disable the event-level streaming idle watchdog, or set to `1` to force-enable it. When unset, the watchdog is on by default for all providers. Before v2.1.196, the unset default was server-controlled on the direct Anthropic API and off on other providers. As of v2.1.169, providers other than the direct Anthropic API and Claude Platform on AWS also have a default-on 5-minute body idle timeout independent of this variable; see `API_FORCE_IDLE_TIMEOUT`. On Bedrock, you can also enable the independent byte-level watchdog with `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK`; the two run together when both are set. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS` +`CLAUDE_ENABLE_STREAM_WATCHDOG`| Set to `0` to force-disable the event-level streaming idle watchdog, or set to `1` to force-enable it. When unset, the watchdog is on by default for all providers. Before v2.1.196, the unset default was server-controlled on the direct Anthropic API and off on other providers. As of v2.1.169, providers other than the direct Anthropic API and Claude Platform on AWS also have a default-on 5-minute body idle timeout independent of this variable; see `API_FORCE_IDLE_TIMEOUT`. On Amazon Bedrock, you can also enable the independent byte-level watchdog with `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK`; the two run together when both are set. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS` `CLAUDE_ENV_FILE`| Path to a shell script whose contents Claude Code runs before each Bash command in the same shell process, so exports in the file are visible to the command. Use to persist virtualenv or conda activation across commands. Also populated dynamically by [SessionStart](</docs/en/hooks#persist-environment-variables>), [Setup](</docs/en/hooks#setup>), [CwdChanged](</docs/en/hooks#cwdchanged>), and [FileChanged](</docs/en/hooks#filechanged>) hooks `CLAUDE_REMOTE_CONTROL_SESSION_NAME_PREFIX`| Prefix for auto-generated [Remote Control](</docs/en/remote-control>) session names when no explicit name is provided. Defaults to your machine’s hostname, producing names like `myhost-graceful-unicorn`. The `--remote-control-session-name-prefix` CLI flag sets the same value for a single invocation -`CLAUDE_STREAM_IDLE_TIMEOUT_MS`| Timeout in milliseconds before the streaming idle watchdog closes a stalled connection. When you set this variable explicitly, the minimum is `300000` (5 minutes); lower values are silently clamped to absorb extended thinking pauses and proxy buffering. When unset, the event-level watchdog defaults to 300 seconds and the byte-level watchdog defaults to 180 seconds on direct Anthropic API connections (300 seconds on Claude Platform on AWS and other providers). The unset 180-second byte-watchdog default is a separate value and is not subject to the 5-minute clamp. The body idle timeout described under `API_FORCE_IDLE_TIMEOUT` applies independently. On Bedrock, also applies when `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK=1` +`CLAUDE_STREAM_IDLE_TIMEOUT_MS`| Timeout in milliseconds before the streaming idle watchdog closes a stalled connection. When you set this variable explicitly, the minimum is `300000` (5 minutes); lower values are silently clamped to absorb extended thinking pauses and proxy buffering. When unset, the event-level watchdog defaults to 300 seconds and the byte-level watchdog defaults to 180 seconds on direct Anthropic API connections (300 seconds on Claude Platform on AWS and other providers). The unset 180-second byte-watchdog default is a separate value and is not subject to the 5-minute clamp. The body idle timeout described under `API_FORCE_IDLE_TIMEOUT` applies independently. On Amazon Bedrock, also applies when `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK=1` `DEBUG`| Set to `1` to enable debug mode, equivalent to launching with [`--debug`](</docs/en/cli-reference#cli-flags>). Debug logs are written to `~/.claude/debug/<session-id>.txt`, or to the path set by `CLAUDE_CODE_DEBUG_LOGS_DIR`. Only the truthy values `1`, `true`, `yes`, and `on` enable debug mode, so namespace patterns like `DEBUG=express:*` set for other tools do not trigger it `DISABLE_AUTOUPDATER`| Set to `1` to disable automatic background updates. Manual `claude update` still works. Use `DISABLE_UPDATES` to block both `DISABLE_AUTO_COMPACT`| Set to `1` to disable automatic compaction when approaching the context limit. The manual `/compact` command remains available. Use when you want explicit control over when compaction occurs @@ -310,7 +310,7 @@ `DISABLE_FEEDBACK_COMMAND`| Set to `1` to disable the `/feedback` command. The older name `DISABLE_BUG_COMMAND` is also accepted `DISABLE_GROWTHBOOK`| Set to `1` to disable GrowthBook feature-flag fetching and use code defaults for every flag. Telemetry event logging stays on unless `DISABLE_TELEMETRY` is also set `DISABLE_INSTALLATION_CHECKS`| Set to `1` to disable installation warnings. Use only when manually managing the installation location, as this can mask issues with standard installations -`DISABLE_INSTALL_GITHUB_APP_COMMAND`| Set to `1` to hide the `/install-github-app` command. Already hidden when using third-party providers (Bedrock, Vertex, or Foundry) +`DISABLE_INSTALL_GITHUB_APP_COMMAND`| Set to `1` to hide the `/install-github-app` command. Already hidden when using third-party providers (Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry) `DISABLE_INTERLEAVED_THINKING`| Set to `1` to prevent sending the interleaved-thinking beta header. Useful when your LLM gateway or provider does not support [interleaved thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking#interleaved-thinking>) `DISABLE_LOGIN_COMMAND`| Set to `1` to hide the `/login` command. Useful when authentication is handled externally via API keys or `apiKeyHelper` `DISABLE_LOGOUT_COMMAND`| Set to `1` to hide the `/logout` command @@ -324,9 +324,9 @@ `DISABLE_UPGRADE_COMMAND`| Set to `1` to hide the `/upgrade` command `DO_NOT_TRACK`| Set to `1` to opt out of telemetry. Equivalent to setting `DISABLE_TELEMETRY`. Claude Code honors this as the cross-tool convention recognized by many developer CLIs `ENABLE_CLAUDEAI_MCP_SERVERS`| Set to `false` to disable [claude.ai MCP servers](</docs/en/mcp#use-mcp-servers-from-claude-ai>) in Claude Code. Enabled by default for logged-in users. To disable per-project or per-org, set [`disableClaudeAiConnectors`](</docs/en/settings#available-settings>) in settings instead -`ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) instead of the default 5 minutes. Intended for API key, [Bedrock](</docs/en/amazon-bedrock>), [Vertex](</docs/en/google-vertex-ai>), [Foundry](</docs/en/microsoft-foundry>), and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) users. Subscription users within included usage receive 1-hour TTL automatically. 1-hour cache writes are billed at a higher rate +`ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) instead of the default 5 minutes. Intended for API key, [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), [Microsoft Foundry](</docs/en/microsoft-foundry>), and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) users. Subscription users within included usage receive 1-hour TTL automatically. 1-hour cache writes are billed at a higher rate `ENABLE_PROMPT_CACHING_1H_BEDROCK`| Deprecated. Use `ENABLE_PROMPT_CACHING_1H` instead -`ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset: all MCP tools deferred by default, but loaded upfront on Vertex AI or when `ANTHROPIC_BASE_URL` points to a non-first-party host. Values: `true` (always defer and send the beta header, requests fail on Vertex AI models earlier than Sonnet 4.5 or Opus 4.5, or on proxies that do not support `tool_reference`), `auto` (threshold mode: load upfront if tools fit within 10% of context), `auto:N` (custom threshold, e.g., `auto:5` for 5%), `false` (load all upfront) +`ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset: all MCP tools deferred by default, but loaded upfront on Google Cloud’s Agent Platform or when `ANTHROPIC_BASE_URL` points to a non-first-party host. Values: `true` (always defer and send the beta header, requests fail on Google Cloud’s Agent Platform models earlier than Sonnet 4.5 or Opus 4.5, or on proxies that do not support `tool_reference`), `auto` (threshold mode: load upfront if tools fit within 10% of context), `auto:N` (custom threshold, e.g., `auto:5` for 5%), `false` (load all upfront) `FALLBACK_FOR_ALL_PRIMARY_MODELS`| Set to any non-empty value to make all models, not only Opus, stop retrying with a repeated-overload error when no fallback model is configured. As of v2.1.160, a configured [fallback model chain](</docs/en/model-config#fallback-model-chains>) triggers on repeated overload errors for any primary model, so this variable does not affect switching to a fallback model `FORCE_AUTOUPDATE_PLUGINS`| Set to `1` to force plugin auto-updates even when the main auto-updater is disabled via `DISABLE_AUTOUPDATER` `FORCE_PROMPT_CACHING_5M`| Set to `1` to force the 5-minute prompt cache TTL even when 1-hour TTL would otherwise apply. Overrides `ENABLE_PROMPT_CACHING_1H` @@ -358,21 +358,21 @@ `SLASH_COMMAND_TOOL_CHAR_BUDGET`| Override the character budget for skill metadata shown to the [Skill tool](</docs/en/skills#control-who-invokes-a-skill>). The budget scales dynamically at 1% of the context window, with a fallback of 8,000 characters. Legacy name kept for backwards compatibility `TASK_MAX_OUTPUT_LENGTH`| Maximum number of characters in [subagent](</docs/en/sub-agents>) output before truncation (default: 32000, maximum: 160000). When truncated, the full output is saved to disk and the path is included in the truncated response `USE_BUILTIN_RIPGREP`| Set to `0` to use system-installed `rg` instead of `rg` included with Claude Code -`VERTEX_REGION_CLAUDE_3_5_HAIKU`| Override region for Claude 3.5 Haiku when using Vertex AI -`VERTEX_REGION_CLAUDE_3_5_SONNET`| Override region for Claude 3.5 Sonnet when using Vertex AI -`VERTEX_REGION_CLAUDE_3_7_SONNET`| Override region for Claude 3.7 Sonnet when using Vertex AI -`VERTEX_REGION_CLAUDE_4_0_OPUS`| Override region for Claude 4.0 Opus when using Vertex AI -`VERTEX_REGION_CLAUDE_4_0_SONNET`| Override region for Claude 4.0 Sonnet when using Vertex AI -`VERTEX_REGION_CLAUDE_4_1_OPUS`| Override region for Claude 4.1 Opus when using Vertex AI -`VERTEX_REGION_CLAUDE_4_5_OPUS`| Override region for Claude Opus 4.5 when using Vertex AI -`VERTEX_REGION_CLAUDE_4_5_SONNET`| Override region for Claude Sonnet 4.5 when using Vertex AI -`VERTEX_REGION_CLAUDE_4_6_OPUS`| Override region for Claude Opus 4.6 when using Vertex AI -`VERTEX_REGION_CLAUDE_4_6_SONNET`| Override region for Claude Sonnet 4.6 when using Vertex AI -`VERTEX_REGION_CLAUDE_4_7_OPUS`| Override region for Claude Opus 4.7 when using Vertex AI. Added in v2.1.111 -`VERTEX_REGION_CLAUDE_4_8_OPUS`| Override region for Claude Opus 4.8 when using Vertex AI. Added in v2.1.154 -`VERTEX_REGION_CLAUDE_5_SONNET`| Override region for Claude Sonnet 5 when using Vertex AI. Added in v2.1.197 -`VERTEX_REGION_CLAUDE_FABLE_5`| Override region for Claude Fable 5 when using Vertex AI. Added in v2.1.170 -`VERTEX_REGION_CLAUDE_HAIKU_4_5`| Override region for Claude Haiku 4.5 when using Vertex AI +`VERTEX_REGION_CLAUDE_3_5_HAIKU`| Override region for Claude 3.5 Haiku when using Google Cloud’s Agent Platform +`VERTEX_REGION_CLAUDE_3_5_SONNET`| Override region for Claude 3.5 Sonnet when using Google Cloud’s Agent Platform +`VERTEX_REGION_CLAUDE_3_7_SONNET`| Override region for Claude 3.7 Sonnet when using Google Cloud’s Agent Platform +`VERTEX_REGION_CLAUDE_4_0_OPUS`| Override region for Claude 4.0 Opus when using Google Cloud’s Agent Platform +`VERTEX_REGION_CLAUDE_4_0_SONNET`| Override region for Claude 4.0 Sonnet when using Google Cloud’s Agent Platform +`VERTEX_REGION_CLAUDE_4_1_OPUS`| Override region for Claude 4.1 Opus when using Google Cloud’s Agent Platform +`VERTEX_REGION_CLAUDE_4_5_OPUS`| Override region for Claude Opus 4.5 when using Google Cloud’s Agent Platform +`VERTEX_REGION_CLAUDE_4_5_SONNET`| Override region for Claude Sonnet 4.5 when using Google Cloud’s Agent Platform +`VERTEX_REGION_CLAUDE_4_6_OPUS`| Override region for Claude Opus 4.6 when using Google Cloud’s Agent Platform +`VERTEX_REGION_CLAUDE_4_6_SONNET`| Override region for Claude Sonnet 4.6 when using Google Cloud’s Agent Platform +`VERTEX_REGION_CLAUDE_4_7_OPUS`| Override region for Claude Opus 4.7 when using Google Cloud’s Agent Platform. Added in v2.1.111 +`VERTEX_REGION_CLAUDE_4_8_OPUS`| Override region for Claude Opus 4.8 when using Google Cloud’s Agent Platform. Added in v2.1.154 +`VERTEX_REGION_CLAUDE_5_SONNET`| Override region for Claude Sonnet 5 when using Google Cloud’s Agent Platform. Added in v2.1.197 +`VERTEX_REGION_CLAUDE_FABLE_5`| Override region for Claude Fable 5 when using Google Cloud’s Agent Platform. Added in v2.1.170 +`VERTEX_REGION_CLAUDE_HAIKU_4_5`| Override region for Claude Haiku 4.5 when using Google Cloud’s Agent Platform Standard OpenTelemetry exporter variables (`OTEL_METRICS_EXPORTER`, `OTEL_LOGS_EXPORTER`, `OTEL_EXPORTER_OTLP_ENDPOINT`, `OTEL_EXPORTER_OTLP_PROTOCOL`, `OTEL_EXPORTER_OTLP_HEADERS`, `OTEL_METRIC_EXPORT_INTERVAL`, `OTEL_RESOURCE_ATTRIBUTES`, and signal-specific variants) are also supported. See [Monitoring](</docs/en/monitoring-usage>) for configuration details.
modified
--- a/env-vars.md +++ b/env-vars.md @@ -133,6 +133,8 @@ `BASH_MAX_TIMEOUT_MS`| Maximum timeout the model can set for long-running bash commands (default: 600000, or 10 minutes) `CCR_FORCE_BUNDLE`| Set to `1` to force [`claude --remote`](</docs/en/claude-code-on-the-web#send-local-repositories-without-github>) to bundle and upload your local repository even when GitHub access is available `CLAUDECODE`| Set to `1` in subprocesses Claude Code spawns (Bash and PowerShell tools, tmux sessions, [hook](</docs/en/hooks>) commands, [status line](</docs/en/statusline>) commands, stdio [MCP server](</docs/en/mcp>) subprocesses). IDE extensions also set this in their integrated terminals. Use to detect when a script is running inside a subprocess spawned by Claude Code. To check whether the current process was spawned directly by a tool call or hook, rather than inside a stdio MCP server that Claude Code started, use `CLAUDE_CODE_CHILD_SESSION` instead +`CLAUDE_AFK_COUNTDOWN_MS`| How many milliseconds before auto-continue the on-screen countdown appears on an unanswered `AskUserQuestion` dialog. Default `20000` (20 seconds). See `CLAUDE_AFK_TIMEOUT_MS`. Requires Claude Code v2.1.198 or later +`CLAUDE_AFK_TIMEOUT_MS`| How many milliseconds of idle time before an unanswered [`AskUserQuestion`](</docs/en/tools-reference>) dialog auto-continues without you. Default `60000` (60 seconds). To keep questions open while you’re away, set a large value like `86400000` (24 hours). Setting `0` doesn’t turn the timeout off; it closes the dialog immediately. Requires Claude Code v2.1.198 or later `CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS`| Set to `1` to disable all built-in [subagent](</docs/en/sub-agents>) types such as Explore and Plan. Only applies in non-interactive mode (the `-p` flag). Useful for SDK users who want a blank slate `CLAUDE_AGENT_SDK_MCP_NO_PREFIX`| Set to `1` to skip the `mcp__<server>__` prefix on tool names from SDK-created MCP servers. Tools use their original names. SDK usage only `CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS`| Stall timeout in milliseconds for background subagents. Default `600000` (10 minutes). The timer resets on each streaming progress event; if no progress arrives within the window, the subagent is aborted and the task is marked failed, surfacing any partial result to the parent @@ -150,6 +152,7 @@ `CLAUDE_CODE_ATTRIBUTION_HEADER`| Set to `0` to omit the attribution block (client version and prompt fingerprint) from the start of the system prompt. Disabling it improves prompt-cache hit rates when routing through an [LLM gateway](</docs/en/llm-gateway>). Anthropic API caching is unaffected `CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the context capacity in tokens used for auto-compaction calculations. Defaults to the model’s context window, 200K for standard models or 1M for [extended context](</docs/en/model-config#extended-context>) models, except on Sonnet 5, which has its own [default threshold](</docs/en/model-config#sonnet-5-context-window>). Use a lower value like `500000` on a 1M model to treat the window as 500K for compaction purposes. The value is capped at the model’s actual context window. `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` is applied as a percentage of this value. Setting this variable decouples the compaction threshold from the status line’s `used_percentage`, which always uses the model’s full context window `CLAUDE_CODE_AUTO_CONNECT_IDE`| Override automatic [IDE connection](</docs/en/vs-code>). By default, Claude Code connects automatically when launched inside a supported IDE’s integrated terminal. Set to `false` to prevent this. Set to `true` to force a connection attempt when auto-detection fails, such as when tmux obscures the parent terminal. Takes precedence over the [`autoConnectIde`](</docs/en/settings#global-config-settings>) global config setting +`CLAUDE_CODE_BRIDGE_SESSION_ID`| Set automatically in Bash tool and [hook command](</docs/en/hooks>) subprocesses while the session has an active [Remote Control](</docs/en/remote-control>) connection, and removed when the connection ends. The value is the session’s ID in `session_` form, the same identifier that appears in the session’s `claude.ai/code` URL, so a script can link back to the session that ran it. Requires Claude Code v2.1.199 or later. In [cloud sessions](</docs/en/claude-code-on-the-web>), read `CLAUDE_CODE_REMOTE_SESSION_ID` instead `CLAUDE_CODE_CERT_STORE`| Comma-separated list of CA certificate sources for TLS connections. `bundled` is the Mozilla CA set shipped with Claude Code. `system` is the operating system trust store, read only on runtimes with `tls.getCACertificates`: the native binary, or Node 22.15 or later for npm installs. See [CA certificate store](</docs/en/network-config#ca-certificate-store>). Default is `bundled,system` `CLAUDE_CODE_CHILD_SESSION`| Set to `1` in subprocesses Claude Code spawns via the Bash, PowerShell, and Monitor tools, [hook](</docs/en/hooks>) commands, and [status line](</docs/en/statusline>) commands. Not set for stdio [MCP server](</docs/en/mcp>) subprocesses, which are long-lived and outlive the session that spawned them. Unlike `CLAUDECODE`, this is only set by Claude Code itself when it launches a subprocess and not by IDE extensions, so it reliably distinguishes a nested session from a top-level `claude` launched in an IDE-integrated terminal. A nested interactive `claude` TUI started this way is automatically excluded from `--resume`, `--continue`, up-arrow history, and the `claude agents` list. Non-interactive `claude -p` sessions still persist. Set `CLAUDE_CODE_FORCE_SESSION_PERSISTENCE=1` to override this exclusion. Requires Claude Code v2.1.172 or later `CLAUDE_CODE_CLIENT_CERT`| Path to client certificate file for mTLS authentication @@ -160,19 +163,20 @@ `CLAUDE_CODE_DEBUG_LOG_LEVEL`| Minimum log level written to the debug log file. Values: `verbose`, `debug` (default), `info`, `warn`, `error`. Set to `verbose` to include high-volume diagnostics like full status line command output, or raise to `error` to reduce noise `CLAUDE_CODE_DISABLE_1M_CONTEXT`| Set to `1` to disable [1M context window](</docs/en/model-config#extended-context>) support. When set, 1M model variants are unavailable in the model picker, and [Sonnet 5](</docs/en/model-config#sonnet-5-context-window>) sessions are treated as having a 200K window. Useful for enterprise environments with compliance requirements `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING`| Set to `1` to disable [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) on Opus 4.6 and Sonnet 4.6 and fall back to the fixed thinking budget controlled by `MAX_THINKING_TOKENS`. From v2.1.111, has no effect on Fable 5, Sonnet 5, or Opus 4.7 and later, which always use adaptive reasoning -`CLAUDE_CODE_DISABLE_ADVISOR_TOOL`| Set to `1` to disable the [advisor tool](</docs/en/advisor>). The `/advisor` command and `--advisor` flag become unavailable and any configured `advisorModel` is ignored. Requires Claude Code v2.1.98 or later +`CLAUDE_CODE_DISABLE_ADVISOR_TOOL`| Set to `1` to disable the [advisor tool](</docs/en/advisor>). The `/advisor` command becomes unavailable, any configured `advisorModel` is ignored, and the `--advisor` flag is accepted but has no effect, so existing scripts that pass it continue to work without errors. Requires Claude Code v2.1.98 or later `CLAUDE_CODE_DISABLE_AGENT_VIEW`| Set to `1` to turn off [background agents and agent view](</docs/en/agent-view>): `claude agents`, `--bg`, `/background`, and the on-demand supervisor. Equivalent to the [`disableAgentView`](</docs/en/settings#available-settings>) setting `CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN`| Set to `1` to disable [fullscreen rendering](</docs/en/fullscreen>) and use the classic main-screen renderer. The conversation stays in your terminal’s native scrollback so `Cmd+f` and tmux copy mode work as usual. Takes precedence over `CLAUDE_CODE_NO_FLICKER` and the [`tui`](</docs/en/settings#available-settings>) setting. You can also switch with `/tui default`. Does not apply to background sessions opened from [agent view](</docs/en/agent-view>), which always use fullscreen rendering `CLAUDE_CODE_DISABLE_ARTIFACT`| Set to `1` to disable the [Artifact](</docs/en/artifacts>) tool, which publishes session output as a private web page on claude.ai. Equivalent to the [`disableArtifact`](</docs/en/settings#available-settings>) setting `CLAUDE_CODE_DISABLE_ATTACHMENTS`| Set to `1` to disable attachment processing. File mentions with `@` syntax are sent as plain text instead of being expanded into file content `CLAUDE_CODE_DISABLE_AUTO_MEMORY`| Set to `1` to disable [auto memory](</docs/en/memory#auto-memory>). Set to `0` to force auto memory on even when `--bare` mode or [`autoMemoryEnabled: false`](</docs/en/settings#available-settings>) would otherwise disable it. When disabled, Claude does not create or load auto memory files `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 -`CLAUDE_CODE_DISABLE_BG_EXIT_HANDOFF`| Set to `1` to stop a [background session’s](</docs/en/agent-view>) running background shell commands and dynamic workflows when the [supervisor](</docs/en/agent-view#the-supervisor-process>) stops, restarts, or updates that session’s process, instead of handing them to the session’s next process. Affects only that handoff: backgrounding a session with `←` or [`/background`](</docs/en/agent-view#from-inside-a-session>) still carries in-flight work over, and `CLAUDE_DISABLE_ADOPT` turns off both. Requires Claude Code v2.1.196 or later +`CLAUDE_CODE_DISABLE_BG_EXIT_HANDOFF`| Set to `1` to stop a [background session’s](</docs/en/agent-view>) running background shell commands, dynamic workflows, and, as of v2.1.198, background subagents when the [supervisor](</docs/en/agent-view#the-supervisor-process>) stops, restarts, or updates that session’s process, instead of handing them to the session’s next process. Affects only that handoff: backgrounding a session with `←` or [`/background`](</docs/en/agent-view#from-inside-a-session>) still carries in-flight work over, and `CLAUDE_DISABLE_ADOPT` turns off both. Requires Claude Code v2.1.196 or later `CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP`| Set to `1` to stop Claude Code from terminating [background shell commands](</docs/en/interactive-mode#background-bash-commands>) when the operating system reports memory pressure. By default, on macOS and Linux, Claude Code terminates a background shell started in the main session on a memory-pressure signal once the session has been idle for 30 minutes and no turn or subagent is running. Windows has no memory-pressure signal, so this variable has no effect there. Requires Claude Code v2.1.193 or later `CLAUDE_CODE_DISABLE_BUNDLED_SKILLS`| Set to `1` to disable the [skills](</docs/en/skills>) and workflows that ship with Claude Code: bundled skills and workflows are removed entirely, while built-in slash commands like `/init` stay typable but are hidden from the model. Skills from plugins, `.claude/skills/`, and `.claude/commands/` are unaffected. Equivalent to the [`disableBundledSkills`](</docs/en/settings#available-settings>) setting; `0` does not override it `CLAUDE_CODE_DISABLE_CLAUDE_MDS`| Set to `1` to prevent loading any CLAUDE.md memory files into context, including user, project, and auto-memory files `CLAUDE_CODE_DISABLE_CRON`| Set to `1` to disable [scheduled tasks](</docs/en/scheduled-tasks>). The `/loop` skill and cron tools become unavailable and any already-scheduled tasks stop firing, including tasks that are already running mid-session `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`| Set to `1` to strip Anthropic-specific `anthropic-beta` request headers and beta tool-schema fields (such as `defer_loading` and `eager_input_streaming`) from API requests. Use this when a proxy gateway rejects requests with errors like “Unexpected value(s) for the `anthropic-beta` header” or “Extra inputs are not permitted”. Standard fields (`name`, `description`, `input_schema`, `cache_control`) are preserved +`CLAUDE_CODE_DISABLE_EXPLORE_PLAN_AGENTS`| Set to `1` to disable the built-in [Explore and Plan subagents](</docs/en/sub-agents#built-in-subagents>). Claude explores with its search tools or the general-purpose subagent instead, and [plan mode](</docs/en/permission-modes#analyze-before-you-edit-with-plan-mode>) reads files directly rather than launching Explore and Plan agents. Custom subagents named `Explore` or `Plan` are unaffected. To remove every built-in subagent type in the Agent SDK or non-interactive mode, use `CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS` instead. Requires Claude Code v2.1.198 or later `CLAUDE_CODE_DISABLE_FAST_MODE`| Set to `1` to disable [fast mode](</docs/en/fast-mode>) `CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY`| Set to `1` to disable the “How is Claude doing?” session quality surveys. Surveys are also disabled when `DISABLE_TELEMETRY`, `DO_NOT_TRACK`, or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` is set, unless `CLAUDE_CODE_ENABLE_FEEDBACK_SURVEY_FOR_OTEL` opts back in. To set a sample rate instead of disabling outright, use the [`feedbackSurveyRate`](</docs/en/settings#available-settings>) setting. See [Session quality surveys](</docs/en/data-usage#session-quality-surveys>) `CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING`| Set to `1` to disable file [checkpointing](</docs/en/checkpointing>). The `/rewind` command will not be able to restore code changes @@ -218,7 +222,7 @@ `CLAUDE_CODE_IDE_SKIP_VALID_CHECK`| Set to `1` to skip validation of IDE lockfile entries during connection. Use when auto-connect fails to find your IDE despite it running `CLAUDE_CODE_MAX_CONTEXT_TOKENS`| Override the context window size Claude Code assumes for the active model. As of v2.1.193, applied directly for model names Claude Code does not recognize as a Claude model; for recognized Claude models it only takes effect when `DISABLE_COMPACT` is also set. Use this when routing to a model through `ANTHROPIC_BASE_URL` whose context window does not match the built-in size for its name `CLAUDE_CODE_MAX_OUTPUT_TOKENS`| Set the maximum number of output tokens for most requests. Defaults and caps vary by model; see [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>). Increasing this value reduces the effective context window available before [auto-compaction](</docs/en/costs#reduce-token-usage>) triggers -`CLAUDE_CODE_MAX_RETRIES`| Override the number of times to retry failed API requests (default: 10). Capped at 15 as of v2.1.186. For unattended sessions that need to wait through longer outages, set `CLAUDE_CODE_RETRY_WATCHDOG` instead +`CLAUDE_CODE_MAX_RETRIES`| Override the number of times to retry failed API requests (default: 10). Capped at 15 as of v2.1.186; as of v2.1.199, `CLAUDE_CODE_RETRY_WATCHDOG` raises the default and removes the cap. For unattended sessions that need to wait through longer outages, set `CLAUDE_CODE_RETRY_WATCHDOG` instead `CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY`| Maximum number of read-only tools and subagents that can execute in parallel (default: 10). Higher values increase parallelism but consume more resources `CLAUDE_CODE_MAX_TURNS`| Cap the number of agentic turns when no explicit limit is passed. Equivalent to passing [`--max-turns`](</docs/en/cli-reference#cli-flags>), which takes precedence when both are set. A value that is not a positive integer is rejected at startup with an error rather than treated as no cap `CLAUDE_CODE_MCP_ALLOWLIST_ENV`| Set to `1` to spawn stdio MCP servers with only a safe baseline environment plus the server’s configured `env`, instead of inheriting your shell environment @@ -250,7 +254,7 @@ `CLAUDE_CODE_REMOTE_SESSION_ID`| Set automatically in [cloud sessions](</docs/en/claude-code-on-the-web>) to the current session’s ID. Read this to construct a link back to the session transcript. See [Link output back to the session](</docs/en/claude-code-on-the-web#link-output-back-to-the-session>) `CLAUDE_CODE_RESUME_INTERRUPTED_TURN`| Set to `1` to automatically resume if the previous session ended mid-turn. Used in SDK mode so the model continues without requiring the SDK to re-send the prompt `CLAUDE_CODE_RESUME_PROMPT`| Override the continuation message injected when resuming a session that ended mid-turn. Defaults to `Continue from where you left off.`. Spawn scripts for long-running agents can set this to a more directive boot message. An empty string uses the default -`CLAUDE_CODE_RETRY_WATCHDOG`| Set to `1` for unattended sessions such as eval harnesses, CI jobs, or remote workers. Retries `429` and `529` capacity errors indefinitely instead of failing after `CLAUDE_CODE_MAX_RETRIES` attempts. The watchdog backs off up to 5 minutes between attempts, or until the limit resets when the response carries a rate-limit reset time, so a session that hits a usage limit waits out the remaining window. Requires Claude Code v2.1.186 or later +`CLAUDE_CODE_RETRY_WATCHDOG`| Set to `1` for unattended sessions such as eval harnesses, CI jobs, or remote workers. Retries `429` and `529` capacity errors indefinitely instead of failing after `CLAUDE_CODE_MAX_RETRIES` attempts. The watchdog backs off up to 5 minutes between attempts, or until the limit resets when the response carries a rate-limit reset time, so a session that hits a usage limit waits out the remaining window. As of v2.1.199 it also raises the default retry count for other transient errors, such as server errors, timeouts, and dropped connections, to 300, roughly three hours of backoff, and removes the cap of 15 on `CLAUDE_CODE_MAX_RETRIES` if you set that variable explicitly. Requires Claude Code v2.1.186 or later `CLAUDE_CODE_SAFE_MODE`| Set to `1` to start in safe mode: CLAUDE.md, skills, plugins, hooks, MCP servers, custom commands and agents, output styles, workflows, custom themes, custom keybindings, status line and file-suggestion commands, LSP servers, and auto-memory do not load, for troubleshooting a broken configuration. Managed settings policy still applies, including policy-configured hooks, status line, and file-suggestion commands; managed plugins, managed skills, managed CLAUDE.md, and policy-configured MCP servers do not. Equivalent to passing [`--safe-mode`](</docs/en/cli-reference#cli-flags>). Directly spawned child processes inherit the variable `CLAUDE_CODE_SCRIPT_CAPS`| JSON object limiting how many times specific scripts may be invoked per session when `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB` is set. Keys are substrings matched against the command text; values are integer call limits. For example, `{"deploy.sh": 2}` allows `deploy.sh` to be called at most twice. Matching is substring-based so shell-expansion tricks like `./scripts/deploy.sh $(evil)` still count against the cap. Runtime fan-out via `xargs` or `find -exec` is not detected; this is a defense-in-depth control `CLAUDE_CODE_SCROLL_SPEED`| Set the mouse wheel scroll multiplier in [fullscreen rendering](</docs/en/fullscreen#mouse-wheel-scrolling>). Accepts values from 1 to 20, and fractional values below 1 such as `0.5` to slow accelerated trackpad and wheel scrolling in terminals that already amplify wheel events. Set to `3` to match `vim` if your terminal sends one wheel event per notch without amplification. Ignored in the JetBrains IDE terminal, where Claude Code uses its own scroll handling @@ -286,7 +290,7 @@ `CLAUDE_CODE_USE_NATIVE_FILE_SEARCH`| Set to `1` to discover custom commands, subagents, and output styles using Node.js file APIs instead of ripgrep. Set this if the bundled ripgrep binary is unavailable or blocked in your environment. Does not affect the Grep or file search tools `CLAUDE_CODE_USE_POWERSHELL_TOOL`| Controls the PowerShell tool. On Windows without Git Bash, the tool is enabled automatically; set to `0` to disable it. On Windows with Git Bash installed, the tool is rolling out progressively: set to `1` to opt in or `0` to opt out. On Linux, macOS, and WSL, set to `1` to enable it, which requires `pwsh` on your `PATH`. When enabled on Windows, Claude can run PowerShell commands natively instead of routing through Git Bash. See [PowerShell tool](</docs/en/tools-reference#powershell-tool>) `CLAUDE_CODE_USE_VERTEX`| Use [Vertex](</docs/en/google-vertex-ai>) -`CLAUDE_CONFIG_DIR`| Override the configuration directory (default: `~/.claude`). All settings, credentials, session history, and plugins are stored under this path. Useful for running multiple accounts side by side: for example, `alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'` +`CLAUDE_CONFIG_DIR`| Override the configuration directory (default: `~/.claude`). All settings, session history, and plugins are stored under this path, as are credentials on Linux and Windows; on macOS, credentials are in the system Keychain. Useful for running multiple accounts side by side: for example, `alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'` `CLAUDE_DISABLE_ADOPT`| Set to `1` to stop in-flight background work instead of carrying it over when you background a session by pressing `←` or with [`/background`](</docs/en/agent-view#from-inside-a-session>). Claude Code asks you to confirm before backgrounding, then stops the tasks that would otherwise carry over. Requires Claude Code v2.1.195 or later `CLAUDE_EFFORT`| Set automatically in Bash tool subprocesses and hook commands to the active [effort level](</docs/en/model-config#adjust-effort-level>) for the turn: `low`, `medium`, `high`, `xhigh`, or `max`. Ultracode is not a distinct level and reports as `xhigh`. Matches the `effort.level` field passed to [hooks](</docs/en/hooks>). Only set when the current model supports the effort parameter `CLAUDE_ENABLE_BYTE_WATCHDOG`| Set to `1` to force-enable the byte-level streaming idle watchdog, or set to `0` to force-disable it. When unset, the watchdog is enabled by default for direct Anthropic API and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) connections. The byte watchdog aborts a connection when no bytes arrive on the wire for 180 seconds by default on direct Anthropic API connections, 300 seconds on Claude Platform on AWS and when enabled on Bedrock, or for the value of `CLAUDE_STREAM_IDLE_TIMEOUT_MS` when that is set, which is clamped to a minimum of 5 minutes, independent of the event-level watchdog
modified
--- a/env-vars.md +++ b/env-vars.md @@ -214,7 +214,7 @@ `CLAUDE_CODE_GLOB_TIMEOUT_SECONDS`| Timeout in seconds for Glob tool file discovery. Defaults to 20 seconds on most platforms and 60 seconds on WSL `CLAUDE_CODE_HIDE_CWD`| Set to `1` to hide the working directory in the startup logo. Useful for screenshares or recordings where the path exposes your OS username `CLAUDE_CODE_IDE_HOST_OVERRIDE`| Override the host address used to connect to the IDE extension. By default Claude Code auto-detects the correct address, including WSL-to-Windows routing -`CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL`| Skip auto-installation of IDE extensions. Equivalent to setting [`autoInstallIdeExtension`](</docs/en/settings#global-config-settings>) to `false` +`CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL`| Set to `1` to skip auto-installation of IDE extensions. Equivalent to setting [`autoInstallIdeExtension`](</docs/en/settings#global-config-settings>) to `false` `CLAUDE_CODE_IDE_SKIP_VALID_CHECK`| Set to `1` to skip validation of IDE lockfile entries during connection. Use when auto-connect fails to find your IDE despite it running `CLAUDE_CODE_MAX_CONTEXT_TOKENS`| Override the context window size Claude Code assumes for the active model. As of v2.1.193, applied directly for model names Claude Code does not recognize as a Claude model; for recognized Claude models it only takes effect when `DISABLE_COMPACT` is also set. Use this when routing to a model through `ANTHROPIC_BASE_URL` whose context window does not match the built-in size for its name `CLAUDE_CODE_MAX_OUTPUT_TOKENS`| Set the maximum number of output tokens for most requests. Defaults and caps vary by model; see [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>). Increasing this value reduces the effective context window available before [auto-compaction](</docs/en/costs#reduce-token-usage>) triggers @@ -366,6 +366,7 @@ `VERTEX_REGION_CLAUDE_4_6_SONNET`| Override region for Claude Sonnet 4.6 when using Vertex AI `VERTEX_REGION_CLAUDE_4_7_OPUS`| Override region for Claude Opus 4.7 when using Vertex AI. Added in v2.1.111 `VERTEX_REGION_CLAUDE_4_8_OPUS`| Override region for Claude Opus 4.8 when using Vertex AI. Added in v2.1.154 +`VERTEX_REGION_CLAUDE_5_SONNET`| Override region for Claude Sonnet 5 when using Vertex AI. Added in v2.1.197 `VERTEX_REGION_CLAUDE_FABLE_5`| Override region for Claude Fable 5 when using Vertex AI. Added in v2.1.170 `VERTEX_REGION_CLAUDE_HAIKU_4_5`| Override region for Claude Haiku 4.5 when using Vertex AI
modified
--- a/env-vars.md +++ b/env-vars.md @@ -136,7 +136,7 @@ `CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS`| Set to `1` to disable all built-in [subagent](</docs/en/sub-agents>) types such as Explore and Plan. Only applies in non-interactive mode (the `-p` flag). Useful for SDK users who want a blank slate `CLAUDE_AGENT_SDK_MCP_NO_PREFIX`| Set to `1` to skip the `mcp__<server>__` prefix on tool names from SDK-created MCP servers. Tools use their original names. SDK usage only `CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS`| Stall timeout in milliseconds for background subagents. Default `600000` (10 minutes). The timer resets on each streaming progress event; if no progress arrives within the window, the subagent is aborted and the task is marked failed, surfacing any partial result to the parent -`CLAUDE_AUTOCOMPACT_PCT_OVERRIDE`| Set the percentage (1-100) of the auto-compaction window at which auto-compaction triggers. Use lower values like `50` to compact earlier. This variable only causes earlier compaction when Claude Code compacts proactively: when `CLAUDE_CODE_AUTO_COMPACT_WINDOW` is set, in [cloud sessions](</docs/en/claude-code-on-the-web>), and on Sonnet 4.6 and Opus 4.6 without [extended context](</docs/en/model-config#extended-context>), which compact at the 200K boundary by default. In other cases, such as a local session on Opus 4.8 or any model with extended context, auto-compaction triggers when the conversation reaches the model’s context limit. The override can only lower the threshold, so values above the default have no effect. Applies to both main conversations and subagents +`CLAUDE_AUTOCOMPACT_PCT_OVERRIDE`| Set the percentage (1-100) of the auto-compaction window at which auto-compaction triggers. Use lower values like `50` to compact earlier. This variable only causes earlier compaction when Claude Code compacts proactively: when `CLAUDE_CODE_AUTO_COMPACT_WINDOW` is set, in [cloud sessions](</docs/en/claude-code-on-the-web>), and on Sonnet 4.6 and Opus 4.6 without [extended context](</docs/en/model-config#extended-context>), which compact at the 200K boundary by default. On Sonnet 5, proactive compaction applies at the model’s [default threshold](</docs/en/model-config#sonnet-5-context-window>). In other cases, such as a local session on Opus 4.8, auto-compaction triggers when the conversation reaches the model’s context limit. The override can only lower the threshold, so values above the default have no effect. Applies to both main conversations and subagents `CLAUDE_AUTO_BACKGROUND_TASKS`| Set to `1` to force-enable automatic backgrounding of long-running agent tasks. When enabled, subagents are moved to the background after running for approximately two minutes `CLAUDE_AX_SCREEN_READER`| Set to `1` to render screen-reader friendly output: flat text without decorative borders or animations. Set to `0` to force screen-reader mode off even when [`axScreenReader`](</docs/en/settings#available-settings>) is `true`. The [`--ax-screen-reader`](</docs/en/cli-reference#cli-flags>) flag takes precedence. Requires Claude Code v2.1.181 or later `CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR`| Return to the original working directory after each Bash or PowerShell command in the main session @@ -148,7 +148,7 @@ `CLAUDE_CODE_API_KEY_HELPER_TTL_MS`| Interval in milliseconds at which credentials should be refreshed (when using [`apiKeyHelper`](</docs/en/settings#available-settings>)) `CLAUDE_CODE_ARTIFACT_AUTO_OPEN`| Set to `0` to stop Claude Code from opening the browser automatically when a new [artifact](</docs/en/artifacts>) is published. Republishing an existing artifact does not open the browser regardless of this setting `CLAUDE_CODE_ATTRIBUTION_HEADER`| Set to `0` to omit the attribution block (client version and prompt fingerprint) from the start of the system prompt. Disabling it improves prompt-cache hit rates when routing through an [LLM gateway](</docs/en/llm-gateway>). Anthropic API caching is unaffected -`CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the context capacity in tokens used for auto-compaction calculations. Defaults to the model’s context window: 200K for standard models or 1M for [extended context](</docs/en/model-config#extended-context>) models. Use a lower value like `500000` on a 1M model to treat the window as 500K for compaction purposes. The value is capped at the model’s actual context window. `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` is applied as a percentage of this value. Setting this variable decouples the compaction threshold from the status line’s `used_percentage`, which always uses the model’s full context window +`CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the context capacity in tokens used for auto-compaction calculations. Defaults to the model’s context window, 200K for standard models or 1M for [extended context](</docs/en/model-config#extended-context>) models, except on Sonnet 5, which has its own [default threshold](</docs/en/model-config#sonnet-5-context-window>). Use a lower value like `500000` on a 1M model to treat the window as 500K for compaction purposes. The value is capped at the model’s actual context window. `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` is applied as a percentage of this value. Setting this variable decouples the compaction threshold from the status line’s `used_percentage`, which always uses the model’s full context window `CLAUDE_CODE_AUTO_CONNECT_IDE`| Override automatic [IDE connection](</docs/en/vs-code>). By default, Claude Code connects automatically when launched inside a supported IDE’s integrated terminal. Set to `false` to prevent this. Set to `true` to force a connection attempt when auto-detection fails, such as when tmux obscures the parent terminal. Takes precedence over the [`autoConnectIde`](</docs/en/settings#global-config-settings>) global config setting `CLAUDE_CODE_CERT_STORE`| Comma-separated list of CA certificate sources for TLS connections. `bundled` is the Mozilla CA set shipped with Claude Code. `system` is the operating system trust store, read only on runtimes with `tls.getCACertificates`: the native binary, or Node 22.15 or later for npm installs. See [CA certificate store](</docs/en/network-config#ca-certificate-store>). Default is `bundled,system` `CLAUDE_CODE_CHILD_SESSION`| Set to `1` in subprocesses Claude Code spawns via the Bash, PowerShell, and Monitor tools, [hook](</docs/en/hooks>) commands, and [status line](</docs/en/statusline>) commands. Not set for stdio [MCP server](</docs/en/mcp>) subprocesses, which are long-lived and outlive the session that spawned them. Unlike `CLAUDECODE`, this is only set by Claude Code itself when it launches a subprocess and not by IDE extensions, so it reliably distinguishes a nested session from a top-level `claude` launched in an IDE-integrated terminal. A nested interactive `claude` TUI started this way is automatically excluded from `--resume`, `--continue`, up-arrow history, and the `claude agents` list. Non-interactive `claude -p` sessions still persist. Set `CLAUDE_CODE_FORCE_SESSION_PERSISTENCE=1` to override this exclusion. Requires Claude Code v2.1.172 or later @@ -158,8 +158,8 @@ `CLAUDE_CODE_CONNECT_TIMEOUT_MS`| Removed in v2.1.186 and now a no-op. Previously set a separate timeout for the connect, TLS, and response-header phase of a streaming API request. Use `API_TIMEOUT_MS` for the per-request timeout `CLAUDE_CODE_DEBUG_LOGS_DIR`| Override the debug log file path. Despite the name, this is a file path, not a directory. Requires debug mode to be enabled separately via `--debug`, `/debug`, or the `DEBUG` environment variable: setting this variable alone does not enable logging. The [`--debug-file`](</docs/en/cli-reference#cli-flags>) flag does both at once. Defaults to `~/.claude/debug/<session-id>.txt` `CLAUDE_CODE_DEBUG_LOG_LEVEL`| Minimum log level written to the debug log file. Values: `verbose`, `debug` (default), `info`, `warn`, `error`. Set to `verbose` to include high-volume diagnostics like full status line command output, or raise to `error` to reduce noise -`CLAUDE_CODE_DISABLE_1M_CONTEXT`| Set to `1` to disable [1M context window](</docs/en/model-config#extended-context>) support. When set, 1M model variants are unavailable in the model picker. Useful for enterprise environments with compliance requirements -`CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING`| Set to `1` to disable [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) on Opus 4.6 and Sonnet 4.6 and fall back to the fixed thinking budget controlled by `MAX_THINKING_TOKENS`. From v2.1.111, has no effect on Fable 5, or on Opus 4.7 and later, which always use adaptive reasoning +`CLAUDE_CODE_DISABLE_1M_CONTEXT`| Set to `1` to disable [1M context window](</docs/en/model-config#extended-context>) support. When set, 1M model variants are unavailable in the model picker, and [Sonnet 5](</docs/en/model-config#sonnet-5-context-window>) sessions are treated as having a 200K window. Useful for enterprise environments with compliance requirements +`CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING`| Set to `1` to disable [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) on Opus 4.6 and Sonnet 4.6 and fall back to the fixed thinking budget controlled by `MAX_THINKING_TOKENS`. From v2.1.111, has no effect on Fable 5, Sonnet 5, or Opus 4.7 and later, which always use adaptive reasoning `CLAUDE_CODE_DISABLE_ADVISOR_TOOL`| Set to `1` to disable the [advisor tool](</docs/en/advisor>). The `/advisor` command and `--advisor` flag become unavailable and any configured `advisorModel` is ignored. Requires Claude Code v2.1.98 or later `CLAUDE_CODE_DISABLE_AGENT_VIEW`| Set to `1` to turn off [background agents and agent view](</docs/en/agent-view>): `claude agents`, `--bg`, `/background`, and the on-demand supervisor. Equivalent to the [`disableAgentView`](</docs/en/settings#available-settings>) setting `CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN`| Set to `1` to disable [fullscreen rendering](</docs/en/fullscreen>) and use the classic main-screen renderer. The conversation stays in your terminal’s native scrollback so `Cmd+f` and tmux copy mode work as usual. Takes precedence over `CLAUDE_CODE_NO_FLICKER` and the [`tui`](</docs/en/settings#available-settings>) setting. You can also switch with `/tui default`. Does not apply to background sessions opened from [agent view](</docs/en/agent-view>), which always use fullscreen rendering @@ -256,7 +256,7 @@ `CLAUDE_CODE_SCROLL_SPEED`| Set the mouse wheel scroll multiplier in [fullscreen rendering](</docs/en/fullscreen#mouse-wheel-scrolling>). Accepts values from 1 to 20, and fractional values below 1 such as `0.5` to slow accelerated trackpad and wheel scrolling in terminals that already amplify wheel events. Set to `3` to match `vim` if your terminal sends one wheel event per notch without amplification. Ignored in the JetBrains IDE terminal, where Claude Code uses its own scroll handling `CLAUDE_CODE_SESSIONEND_HOOKS_TIMEOUT_MS`| Override the time budget in milliseconds for [SessionEnd](</docs/en/hooks#sessionend>) hooks. Applies to session exit, `/clear`, and switching sessions via interactive `/resume`. By default the budget is 1.5 seconds, automatically raised to the highest per-hook `timeout` configured in settings files, up to 60 seconds. Timeouts on plugin-provided hooks do not raise the budget `CLAUDE_CODE_SESSION_ID`| Set automatically to the current session ID in Bash and PowerShell tool subprocesses, [hook command](</docs/en/hooks>) subprocesses, and stdio [MCP server](</docs/en/mcp>) subprocesses. For Bash, PowerShell, and hooks this matches the `session_id` field in the hook JSON input and is updated on `/clear`. An MCP server subprocess retains the ID it was spawned with. On `--resume <session-id>` it receives the resumed ID, matching hooks and Bash. On `--continue` or `--resume` without an explicit ID it may receive the initial startup ID instead. Use to correlate scripts and external tools with the Claude Code session that launched them -`CLAUDE_CODE_SHELL`| Override automatic shell detection. Useful when your login shell differs from your preferred working shell (for example, `bash` vs `zsh`) +`CLAUDE_CODE_SHELL`| Set the shell Claude Code uses to run Bash tool commands. Accepts a path to a `bash` or `zsh` binary, for example `/opt/homebrew/bin/bash`. Other shells such as `fish` are not supported. If the value is not a working `bash` or `zsh` path, Claude Code ignores it and falls back to auto-detection. Auto-detection uses your `$SHELL` when it points to `bash` or `zsh`, otherwise it picks the first working `zsh` then `bash` found on your `PATH` and standard install locations `CLAUDE_CODE_SHELL_PREFIX`| Command prefix that wraps shell commands Claude Code spawns: Bash tool calls, [hook](</docs/en/hooks>) commands, [status line](</docs/en/statusline>) commands, and stdio [MCP server](</docs/en/mcp>) startup commands. PowerShell hooks and exec-form hooks run without the prefix. Useful for logging or auditing. Setting a bare executable path such as `/path/to/logger.sh` runs each command as `/path/to/logger.sh '<command>'`. The wrapper receives the command line as a single shell-quoted argument in `$1`, so the wrapper must re-evaluate `$1` with a shell, for example `exec bash -c "$1"`. Treating `$1` as a bare executable path breaks stdio MCP servers that pass arguments such as `npx -y <package>`. For Bash tool calls, `$1` contains the full shell invocation Claude Code assembles, including environment setup, not only the command Claude ran `CLAUDE_CODE_SIMPLE`| Set to `1` to run with a minimal system prompt and only the Bash, file read, and file edit tools. MCP tools from `--mcp-config` are still available. Disables auto-discovery of hooks, skills, plugins, MCP servers, auto memory, and CLAUDE.md. OAuth tokens and keychain credentials are not read, so Anthropic authentication must come from `ANTHROPIC_API_KEY` or an `apiKeyHelper` in `--settings`. Equivalent to passing [`--bare`](</docs/en/headless#start-faster-with-bare-mode>) `CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT`| Set to `1` to use a shorter system prompt and abbreviated tool descriptions on any model. Set to `0`, `false`, `no`, or `off` to opt out even on models where the experiment or server configuration would otherwise enable it. The full tool set, hooks, MCP servers, and CLAUDE.md discovery remain enabled
modified
Show diff (101 lines)
--- a/env-vars.md +++ b/env-vars.md @@ -90,7 +90,7 @@ `ANTHROPIC_AWS_API_KEY`| Workspace API key for [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), generated in the AWS Console. Sent as `x-api-key` and takes precedence over AWS SigV4 `ANTHROPIC_AWS_BASE_URL`| Override the [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) endpoint URL. Use for custom regions or when routing through an [LLM gateway](</docs/en/llm-gateway>). Defaults to `https://aws-external-anthropic.{AWS_REGION}.api.aws` `ANTHROPIC_AWS_WORKSPACE_ID`| Required for [Claude Platform on AWS](</docs/en/claude-platform-on-aws>). Sent on every request as the `anthropic-workspace-id` header -`ANTHROPIC_BASE_URL`| Override the API endpoint to route requests through a proxy or gateway. When set to a non-first-party host, [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) is disabled by default. Set `ENABLE_TOOL_SEARCH=true` if your proxy forwards `tool_reference` blocks +`ANTHROPIC_BASE_URL`| Override the API endpoint to route requests through a proxy or gateway. When set to a non-first-party host, [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) is disabled by default. Set `ENABLE_TOOL_SEARCH=true` if your proxy forwards `tool_reference` blocks. As of v2.1.196, [Remote Control](</docs/en/remote-control#requirements>) is disabled when this points at a host other than `api.anthropic.com`, matching its behavior on Bedrock, Vertex AI, and Foundry `ANTHROPIC_BEDROCK_BASE_URL`| Override the Bedrock endpoint URL. Use for custom Bedrock endpoints or when routing through an [LLM gateway](</docs/en/llm-gateway>). See [Amazon Bedrock](</docs/en/amazon-bedrock>) `ANTHROPIC_BEDROCK_MANTLE_BASE_URL`| Override the Bedrock Mantle endpoint URL. See [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>) `ANTHROPIC_BEDROCK_SERVICE_TIER`| Bedrock [service tier](<https://docs.aws.amazon.com/bedrock/latest/userguide/service-tiers-inference.html>) (`default`, `flex`, or `priority`). Sent as the `X-Amzn-Bedrock-Service-Tier` header. See [Amazon Bedrock](</docs/en/amazon-bedrock#service-tiers>) @@ -150,7 +150,7 @@ `CLAUDE_CODE_ATTRIBUTION_HEADER`| Set to `0` to omit the attribution block (client version and prompt fingerprint) from the start of the system prompt. Disabling it improves prompt-cache hit rates when routing through an [LLM gateway](</docs/en/llm-gateway>). Anthropic API caching is unaffected `CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the context capacity in tokens used for auto-compaction calculations. Defaults to the model’s context window: 200K for standard models or 1M for [extended context](</docs/en/model-config#extended-context>) models. Use a lower value like `500000` on a 1M model to treat the window as 500K for compaction purposes. The value is capped at the model’s actual context window. `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` is applied as a percentage of this value. Setting this variable decouples the compaction threshold from the status line’s `used_percentage`, which always uses the model’s full context window `CLAUDE_CODE_AUTO_CONNECT_IDE`| Override automatic [IDE connection](</docs/en/vs-code>). By default, Claude Code connects automatically when launched inside a supported IDE’s integrated terminal. Set to `false` to prevent this. Set to `true` to force a connection attempt when auto-detection fails, such as when tmux obscures the parent terminal. Takes precedence over the [`autoConnectIde`](</docs/en/settings#global-config-settings>) global config setting -`CLAUDE_CODE_CERT_STORE`| Comma-separated list of CA certificate sources for TLS connections. `bundled` is the Mozilla CA set shipped with Claude Code. `system` is the operating system trust store. Default is `bundled,system` +`CLAUDE_CODE_CERT_STORE`| Comma-separated list of CA certificate sources for TLS connections. `bundled` is the Mozilla CA set shipped with Claude Code. `system` is the operating system trust store, read only on runtimes with `tls.getCACertificates`: the native binary, or Node 22.15 or later for npm installs. See [CA certificate store](</docs/en/network-config#ca-certificate-store>). Default is `bundled,system` `CLAUDE_CODE_CHILD_SESSION`| Set to `1` in subprocesses Claude Code spawns via the Bash, PowerShell, and Monitor tools, [hook](</docs/en/hooks>) commands, and [status line](</docs/en/statusline>) commands. Not set for stdio [MCP server](</docs/en/mcp>) subprocesses, which are long-lived and outlive the session that spawned them. Unlike `CLAUDECODE`, this is only set by Claude Code itself when it launches a subprocess and not by IDE extensions, so it reliably distinguishes a nested session from a top-level `claude` launched in an IDE-integrated terminal. A nested interactive `claude` TUI started this way is automatically excluded from `--resume`, `--continue`, up-arrow history, and the `claude agents` list. Non-interactive `claude -p` sessions still persist. Set `CLAUDE_CODE_FORCE_SESSION_PERSISTENCE=1` to override this exclusion. Requires Claude Code v2.1.172 or later `CLAUDE_CODE_CLIENT_CERT`| Path to client certificate file for mTLS authentication `CLAUDE_CODE_CLIENT_KEY`| Path to client private key file for mTLS authentication @@ -167,6 +167,8 @@ `CLAUDE_CODE_DISABLE_ATTACHMENTS`| Set to `1` to disable attachment processing. File mentions with `@` syntax are sent as plain text instead of being expanded into file content `CLAUDE_CODE_DISABLE_AUTO_MEMORY`| Set to `1` to disable [auto memory](</docs/en/memory#auto-memory>). Set to `0` to force auto memory on even when `--bare` mode or [`autoMemoryEnabled: false`](</docs/en/settings#available-settings>) would otherwise disable it. When disabled, Claude does not create or load auto memory files `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 +`CLAUDE_CODE_DISABLE_BG_EXIT_HANDOFF`| Set to `1` to stop a [background session’s](</docs/en/agent-view>) running background shell commands and dynamic workflows when the [supervisor](</docs/en/agent-view#the-supervisor-process>) stops, restarts, or updates that session’s process, instead of handing them to the session’s next process. Affects only that handoff: backgrounding a session with `←` or [`/background`](</docs/en/agent-view#from-inside-a-session>) still carries in-flight work over, and `CLAUDE_DISABLE_ADOPT` turns off both. Requires Claude Code v2.1.196 or later +`CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP`| Set to `1` to stop Claude Code from terminating [background shell commands](</docs/en/interactive-mode#background-bash-commands>) when the operating system reports memory pressure. By default, on macOS and Linux, Claude Code terminates a background shell started in the main session on a memory-pressure signal once the session has been idle for 30 minutes and no turn or subagent is running. Windows has no memory-pressure signal, so this variable has no effect there. Requires Claude Code v2.1.193 or later `CLAUDE_CODE_DISABLE_BUNDLED_SKILLS`| Set to `1` to disable the [skills](</docs/en/skills>) and workflows that ship with Claude Code: bundled skills and workflows are removed entirely, while built-in slash commands like `/init` stay typable but are hidden from the model. Skills from plugins, `.claude/skills/`, and `.claude/commands/` are unaffected. Equivalent to the [`disableBundledSkills`](</docs/en/settings#available-settings>) setting; `0` does not override it `CLAUDE_CODE_DISABLE_CLAUDE_MDS`| Set to `1` to prevent loading any CLAUDE.md memory files into context, including user, project, and auto-memory files `CLAUDE_CODE_DISABLE_CRON`| Set to `1` to disable [scheduled tasks](</docs/en/scheduled-tasks>). The `/loop` skill and cron tools become unavailable and any already-scheduled tasks stop firing, including tasks that are already running mid-session @@ -177,8 +179,10 @@ `CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS`| Set to `1` to remove built-in commit and PR workflow instructions and the git status snapshot from Claude’s system prompt. Useful when using your own git workflow skills. Takes precedence over the [`includeGitInstructions`](</docs/en/settings#available-settings>) setting when set `CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP`| Set to `1` to prevent automatic remapping of Opus 4.0 and 4.1 to the current Opus version on the Anthropic API. Use when you intentionally want to pin an older model. The remap does not run on Bedrock, Vertex, or Foundry `CLAUDE_CODE_DISABLE_MOUSE`| Set to `1` to disable mouse tracking in [fullscreen rendering](</docs/en/fullscreen>). Keyboard scrolling with `PgUp` and `PgDn` still works. Use this to keep your terminal’s native copy-on-select behavior +`CLAUDE_CODE_DISABLE_MOUSE_CLICKS`| Set to `1` to disable click, drag, and hover handling in [fullscreen rendering](</docs/en/fullscreen>) while keeping mouse-wheel scrolling. Use this when you want wheel scroll to work inside Claude Code but don’t want clicks to position the cursor, expand tool output, or open links. `CLAUDE_CODE_DISABLE_MOUSE` takes precedence when both are set. Requires Claude Code v2.1.195 or later `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`| Equivalent of setting `DISABLE_AUTOUPDATER`, `DISABLE_FEEDBACK_COMMAND`, `DISABLE_ERROR_REPORTING`, and `DISABLE_TELEMETRY` `CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK`| Set to `1` to disable the non-streaming fallback when a streaming request fails mid-stream. Streaming errors propagate to the retry layer instead. Useful when a proxy or gateway causes the fallback to produce duplicate tool execution +`CLAUDE_CODE_DISABLE_NOTIFICATION_PRESENCE_CHECK`| Set to `1` to send the `PushNotification` tool’s desktop notification even while you are typing in or focused on the terminal. By default the tool skips both the desktop notification and the [mobile push](</docs/en/remote-control#mobile-push-notifications>) when it detects recent keyboard activity or terminal focus. This variable disables only that local check, so the server can still suppress the mobile push when it detects that you are active. Requires Claude Code v2.1.193 or later `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL`| Set to `1` to skip automatic addition of the official plugin marketplace on first run `CLAUDE_CODE_DISABLE_POLICY_SKILLS`| Set to `1` to skip loading skills from the system-wide managed skills directory. Useful for container or CI sessions that should not load operator-provisioned skills `CLAUDE_CODE_DISABLE_TERMINAL_TITLE`| Set to `1` to disable automatic terminal title updates based on conversation context. In Agent SDK and `claude -p` sessions, this also skips the background Haiku request that generates the session title @@ -186,7 +190,7 @@ `CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL`| Set to `1` to disable virtual scrolling in [fullscreen rendering](</docs/en/fullscreen>) and render every message in the transcript. Use this if scrolling in fullscreen mode shows blank regions where messages should appear `CLAUDE_CODE_DISABLE_WORKFLOWS`| Set to `1` to disable [workflows](</docs/en/workflows#turn-workflows-off>). Equivalent to the [`disableWorkflows`](</docs/en/settings#available-settings>) setting `CLAUDE_CODE_EFFORT_LEVEL`| Set the effort level for supported models. Values: `low`, `medium`, `high`, `xhigh`, `max`, or `auto` to use the model default. Available levels depend on the model. Takes precedence over `/effort` and the `effortLevel` setting. See [Adjust effort level](</docs/en/model-config#adjust-effort-level>) -`CLAUDE_CODE_ENABLE_AUTO_MODE`| Set to `1` to make [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) available on Amazon Bedrock, Google Cloud Vertex AI, and Microsoft Foundry. Requires Claude Code v2.1.158 or later. Has no effect on the Anthropic API, where auto mode is available by default. See [Enable auto mode on Bedrock, Vertex AI, or Foundry](</docs/en/permission-modes#enable-auto-mode-on-bedrock-vertex-ai-or-foundry>) +`CLAUDE_CODE_ENABLE_AUTO_MODE`| Set to `1` to make [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) available on Amazon Bedrock, Google Cloud Vertex AI, Microsoft Foundry, and signed-in [Claude apps gateway](</docs/en/claude-apps-gateway>) sessions. Requires Claude Code v2.1.158 or later. Has no effect on the Anthropic API, where auto mode is available by default. See [Enable auto mode on Bedrock, Vertex AI, or Foundry](</docs/en/permission-modes#enable-auto-mode-on-bedrock-vertex-ai-or-foundry>) `CLAUDE_CODE_ENABLE_AWAY_SUMMARY`| Override [session recap](</docs/en/interactive-mode#session-recap>) availability. Set to `0` to force recaps off regardless of the `/config` toggle. Set to `1` to force recaps on when [`awaySummaryEnabled`](</docs/en/settings#available-settings>) is `false`. Takes precedence over the setting and `/config` toggle `CLAUDE_CODE_ENABLE_BACKGROUND_PLUGIN_REFRESH`| Set to `1` to refresh plugin state at turn boundaries in [non-interactive mode](</docs/en/headless>) after a background install completes. Off by default because the refresh changes the system prompt mid-session, which invalidates [prompt caching](</docs/en/prompt-caching>) for that turn `CLAUDE_CODE_ENABLE_FEEDBACK_SURVEY_FOR_OTEL`| Set to `1` to route the “How is Claude doing?” session quality survey to your own [OpenTelemetry collector](</docs/en/monitoring-usage>) when Anthropic-bound nonessential traffic is blocked. Survey ratings are emitted only as OTEL events to your configured collector. No survey data is sent to Anthropic in this mode. Applies when `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`, `DISABLE_TELEMETRY`, or `DO_NOT_TRACK` is set, and has no effect otherwise. `CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY` and the organization product feedback policy take precedence @@ -212,7 +216,7 @@ `CLAUDE_CODE_IDE_HOST_OVERRIDE`| Override the host address used to connect to the IDE extension. By default Claude Code auto-detects the correct address, including WSL-to-Windows routing `CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL`| Skip auto-installation of IDE extensions. Equivalent to setting [`autoInstallIdeExtension`](</docs/en/settings#global-config-settings>) to `false` `CLAUDE_CODE_IDE_SKIP_VALID_CHECK`| Set to `1` to skip validation of IDE lockfile entries during connection. Use when auto-connect fails to find your IDE despite it running -`CLAUDE_CODE_MAX_CONTEXT_TOKENS`| Override the context window size Claude Code assumes for the active model. Only takes effect when `DISABLE_COMPACT` is also set. Use this when routing to a model through `ANTHROPIC_BASE_URL` whose context window does not match the built-in size for its name +`CLAUDE_CODE_MAX_CONTEXT_TOKENS`| Override the context window size Claude Code assumes for the active model. As of v2.1.193, applied directly for model names Claude Code does not recognize as a Claude model; for recognized Claude models it only takes effect when `DISABLE_COMPACT` is also set. Use this when routing to a model through `ANTHROPIC_BASE_URL` whose context window does not match the built-in size for its name `CLAUDE_CODE_MAX_OUTPUT_TOKENS`| Set the maximum number of output tokens for most requests. Defaults and caps vary by model; see [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>). Increasing this value reduces the effective context window available before [auto-compaction](</docs/en/costs#reduce-token-usage>) triggers `CLAUDE_CODE_MAX_RETRIES`| Override the number of times to retry failed API requests (default: 10). Capped at 15 as of v2.1.186. For unattended sessions that need to wait through longer outages, set `CLAUDE_CODE_RETRY_WATCHDOG` instead `CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY`| Maximum number of read-only tools and subagents that can execute in parallel (default: 10). Higher values increase parallelism but consume more resources @@ -225,7 +229,7 @@ `CLAUDE_CODE_OAUTH_REFRESH_TOKEN`| OAuth refresh token for Claude.ai authentication. When set, `claude auth login` exchanges this token directly instead of opening a browser. Requires `CLAUDE_CODE_OAUTH_SCOPES`. Useful for provisioning authentication in automated environments `CLAUDE_CODE_OAUTH_SCOPES`| Space-separated OAuth scopes the refresh token was issued with, such as `"user:profile user:inference user:sessions:claude_code"`. Required when `CLAUDE_CODE_OAUTH_REFRESH_TOKEN` is set `CLAUDE_CODE_OAUTH_TOKEN`| OAuth access token for Claude.ai authentication. Alternative to `/login` for SDK and automated environments. Takes precedence over keychain-stored credentials. Generate one with [`claude setup-token`](</docs/en/authentication#generate-a-long-lived-token>) -`CLAUDE_CODE_OPUS_4_6_FAST_MODE_OVERRIDE`| Removed in v2.1.160 and now a no-op. Previously pinned [fast mode](</docs/en/fast-mode>) to Claude Opus 4.6 instead of the current default +`CLAUDE_CODE_OPUS_4_6_FAST_MODE_OVERRIDE`| Removed in v2.1.160 and now a no-op. Previously pinned [fast mode](</docs/en/fast-mode>) to Claude Opus 4.6 instead of the current default. Opus 4.6 no longer supports fast mode `CLAUDE_CODE_OTEL_DIAG_STDERR`| Set to `1` to write OpenTelemetry exporter diagnostic errors to stderr. By default these errors only appear with `--debug`, so a misconfigured exporter such as a Prometheus port collision otherwise fails silently. Requires Claude Code v2.1.179 or later. See [Monitoring](</docs/en/monitoring-usage>) `CLAUDE_CODE_OTEL_FLUSH_TIMEOUT_MS`| Timeout in milliseconds for flushing pending OpenTelemetry spans (default: 5000). See [Monitoring](</docs/en/monitoring-usage>) `CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS`| Interval for refreshing dynamic OpenTelemetry headers in milliseconds (default: 1740000 / 29 minutes). See [Dynamic headers](</docs/en/monitoring-usage#dynamic-headers>) @@ -263,7 +267,7 @@ `CLAUDE_CODE_SKIP_PROMPT_HISTORY`| Set to `1` to skip writing prompt history and session transcripts to disk. Sessions started with this variable set do not appear in `--resume`, `--continue`, or up-arrow history. Useful for ephemeral scripted sessions `CLAUDE_CODE_SKIP_VERTEX_AUTH`| Skip Google authentication for Vertex (for example, when using an LLM gateway) `CLAUDE_CODE_STOP_HOOK_BLOCK_CAP`| Maximum number of consecutive times a [Stop](</docs/en/hooks#stop>) or [SubagentStop](</docs/en/hooks#subagentstop>) hook may block the turn from ending before Claude Code overrides it and ends the turn anyway (default: 8). Set to `0` to disable the cap. Raise this if your hook legitimately needs more iterations to resolve -`CLAUDE_CODE_SUBAGENT_MODEL`| See [Model configuration](</docs/en/model-config>) +`CLAUDE_CODE_SUBAGENT_MODEL`| See [Model configuration](</docs/en/model-config>). As of v2.1.196, setting it to `inherit` is the same as leaving it unset; earlier versions treated `inherit` as an override that forced every subagent onto the main conversation’s model `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB`| Set to `1` to strip Anthropic and cloud provider credentials from subprocess environments (Bash tool, hooks, MCP stdio servers). The parent Claude process keeps these credentials for API calls, but child processes cannot read them, reducing exposure to prompt injection attacks that attempt to exfiltrate secrets via shell expansion. On Linux, this also runs Bash subprocesses in an isolated PID namespace so they cannot read host process environments via `/proc`; as a side effect, `ps`, `pgrep`, and `kill` cannot see or signal host processes. `claude-code-action` sets this automatically when `allowed_non_write_users` is configured `CLAUDE_CODE_SYNC_PLUGIN_INSTALL`| Set to `1` in non-interactive mode (the `-p` flag) to wait for plugin installation to complete before the first query. Without this, plugins install in the background and may not be available on the first turn. Combine with `CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS` to bound the wait `CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS`| Timeout in milliseconds for synchronous plugin installation. When exceeded, Claude Code proceeds without plugins and logs an error. No default: without this variable, synchronous installation waits until complete @@ -283,13 +287,14 @@ `CLAUDE_CODE_USE_POWERSHELL_TOOL`| Controls the PowerShell tool. On Windows without Git Bash, the tool is enabled automatically; set to `0` to disable it. On Windows with Git Bash installed, the tool is rolling out progressively: set to `1` to opt in or `0` to opt out. On Linux, macOS, and WSL, set to `1` to enable it, which requires `pwsh` on your `PATH`. When enabled on Windows, Claude can run PowerShell commands natively instead of routing through Git Bash. See [PowerShell tool](</docs/en/tools-reference#powershell-tool>) `CLAUDE_CODE_USE_VERTEX`| Use [Vertex](</docs/en/google-vertex-ai>) `CLAUDE_CONFIG_DIR`| Override the configuration directory (default: `~/.claude`). All settings, credentials, session history, and plugins are stored under this path. Useful for running multiple accounts side by side: for example, `alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'` +`CLAUDE_DISABLE_ADOPT`| Set to `1` to stop in-flight background work instead of carrying it over when you background a session by pressing `←` or with [`/background`](</docs/en/agent-view#from-inside-a-session>). Claude Code asks you to confirm before backgrounding, then stops the tasks that would otherwise carry over. Requires Claude Code v2.1.195 or later `CLAUDE_EFFORT`| Set automatically in Bash tool subprocesses and hook commands to the active [effort level](</docs/en/model-config#adjust-effort-level>) for the turn: `low`, `medium`, `high`, `xhigh`, or `max`. Ultracode is not a distinct level and reports as `xhigh`. Matches the `effort.level` field passed to [hooks](</docs/en/hooks>). Only set when the current model supports the effort parameter `CLAUDE_ENABLE_BYTE_WATCHDOG`| Set to `1` to force-enable the byte-level streaming idle watchdog, or set to `0` to force-disable it. When unset, the watchdog is enabled by default for direct Anthropic API and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) connections. The byte watchdog aborts a connection when no bytes arrive on the wire for 180 seconds by default on direct Anthropic API connections, 300 seconds on Claude Platform on AWS and when enabled on Bedrock, or for the value of `CLAUDE_STREAM_IDLE_TIMEOUT_MS` when that is set, which is clamped to a minimum of 5 minutes, independent of the event-level watchdog `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK`| Set to `1` to enable the byte-level streaming idle watchdog on Amazon Bedrock `vnd.amazon.eventstream` responses. Off by default. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS` -`CLAUDE_ENABLE_STREAM_WATCHDOG`| Set to `1` to force-enable the event-level streaming idle watchdog, or set to `0` to force-disable it. When unset, the default is server-controlled on the direct Anthropic API and off on other providers. As of v2.1.169, providers other than the direct Anthropic API and Claude Platform on AWS also have a default-on 5-minute body idle timeout independent of this variable; see `API_FORCE_IDLE_TIMEOUT`. On Bedrock, you can also enable the independent byte-level watchdog with `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK`; the two run together when both are set. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS` +`CLAUDE_ENABLE_STREAM_WATCHDOG`| Set to `0` to force-disable the event-level streaming idle watchdog, or set to `1` to force-enable it. When unset, the watchdog is on by default for all providers. Before v2.1.196, the unset default was server-controlled on the direct Anthropic API and off on other providers. As of v2.1.169, providers other than the direct Anthropic API and Claude Platform on AWS also have a default-on 5-minute body idle timeout independent of this variable; see `API_FORCE_IDLE_TIMEOUT`. On Bedrock, you can also enable the independent byte-level watchdog with `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK`; the two run together when both are set. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS` `CLAUDE_ENV_FILE`| Path to a shell script whose contents Claude Code runs before each Bash command in the same shell process, so exports in the file are visible to the command. Use to persist virtualenv or conda activation across commands. Also populated dynamically by [SessionStart](</docs/en/hooks#persist-environment-variables>), [Setup](</docs/en/hooks#setup>), [CwdChanged](</docs/en/hooks#cwdchanged>), and [FileChanged](</docs/en/hooks#filechanged>) hooks `CLAUDE_REMOTE_CONTROL_SESSION_NAME_PREFIX`| Prefix for auto-generated [Remote Control](</docs/en/remote-control>) session names when no explicit name is provided. Defaults to your machine’s hostname, producing names like `myhost-graceful-unicorn`. The `--remote-control-session-name-prefix` CLI flag sets the same value for a single invocation -`CLAUDE_STREAM_IDLE_TIMEOUT_MS`| Timeout in milliseconds before the streaming idle watchdog closes a stalled connection. When you set this variable explicitly, the minimum is `300000` (5 minutes); lower values are silently clamped to absorb extended thinking pauses and proxy buffering. When unset, the event-level watchdog defaults to 300 seconds and the byte-level watchdog defaults to 180 seconds on direct Anthropic API connections (300 seconds on Claude Platform on AWS and other providers). The unset 180-second byte-watchdog default is a separate value and is not subject to the 5-minute clamp. For the event-level watchdog on third-party providers, requires `CLAUDE_ENABLE_STREAM_WATCHDOG=1`; the body idle timeout described under `API_FORCE_IDLE_TIMEOUT` applies independently. On Bedrock, also applies when `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK=1` +`CLAUDE_STREAM_IDLE_TIMEOUT_MS`| Timeout in milliseconds before the streaming idle watchdog closes a stalled connection. When you set this variable explicitly, the minimum is `300000` (5 minutes); lower values are silently clamped to absorb extended thinking pauses and proxy buffering. When unset, the event-level watchdog defaults to 300 seconds and the byte-level watchdog defaults to 180 seconds on direct Anthropic API connections (300 seconds on Claude Platform on AWS and other providers). The unset 180-second byte-watchdog default is a separate value and is not subject to the 5-minute clamp. The body idle timeout described under `API_FORCE_IDLE_TIMEOUT` applies independently. On Bedrock, also applies when `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK=1` `DEBUG`| Set to `1` to enable debug mode, equivalent to launching with [`--debug`](</docs/en/cli-reference#cli-flags>). Debug logs are written to `~/.claude/debug/<session-id>.txt`, or to the path set by `CLAUDE_CODE_DEBUG_LOGS_DIR`. Only the truthy values `1`, `true`, `yes`, and `on` enable debug mode, so namespace patterns like `DEBUG=express:*` set for other tools do not trigger it `DISABLE_AUTOUPDATER`| Set to `1` to disable automatic background updates. Manual `claude update` still works. Use `DISABLE_UPDATES` to block both `DISABLE_AUTO_COMPACT`| Set to `1` to disable automatic compaction when approaching the context limit. The manual `/compact` command remains available. Use when you want explicit control over when compaction occurs @@ -336,6 +341,7 @@ `MCP_TIMEOUT`| Timeout in milliseconds for MCP server startup (default: 30000, or 30 seconds) `MCP_TOOL_TIMEOUT`| Timeout in milliseconds for MCP tool execution (default: 100000000, about 28 hours). A per-server `timeout` field in `.mcp.json` overrides this for that server. For the env variable, values below 1000 are floored to one second; for the per-server field, values below 1000 are ignored `NO_PROXY`| List of domains and IPs to which requests will be directly issued, bypassing proxy +`OTEL_LOG_ASSISTANT_RESPONSES`| Set to `1` to include the model’s response text on `assistant_response` OpenTelemetry log events. When unset, the value of `OTEL_LOG_USER_PROMPTS` is used instead. Set to `0` to keep responses redacted even when `OTEL_LOG_USER_PROMPTS` is set. Requires Claude Code v2.1.193 or later. See [Monitoring](</docs/en/monitoring-usage#assistant-response-event>) `OTEL_LOG_RAW_API_BODIES`| Emit Anthropic Messages API request and response JSON as `api_request_body` / `api_response_body` log events. Set to `1` for inline bodies truncated at 60 KB, or `file:<dir>` to write untruncated bodies to disk and emit a `body_ref` path instead. Disabled by default; bodies include the entire conversation history. See [Monitoring](</docs/en/monitoring-usage#api-request-body-event>) `OTEL_LOG_TOOL_CONTENT`| Set to `1` to include tool input and output content in OpenTelemetry span events. Disabled by default to protect sensitive data. See [Monitoring](</docs/en/monitoring-usage>) `OTEL_LOG_TOOL_DETAILS`| Set to `1` to include tool input arguments, MCP server names, raw error strings on tool failures, the refusal `category` on `api_refusal` events, and other tool details in OpenTelemetry traces and logs. Disabled by default to protect PII. See [Monitoring](</docs/en/monitoring-usage>)
modified
--- a/env-vars.md +++ b/env-vars.md @@ -170,7 +170,7 @@ `CLAUDE_CODE_DISABLE_BUNDLED_SKILLS`| Set to `1` to disable the [skills](</docs/en/skills>) and workflows that ship with Claude Code: bundled skills and workflows are removed entirely, while built-in slash commands like `/init` stay typable but are hidden from the model. Skills from plugins, `.claude/skills/`, and `.claude/commands/` are unaffected. Equivalent to the [`disableBundledSkills`](</docs/en/settings#available-settings>) setting; `0` does not override it `CLAUDE_CODE_DISABLE_CLAUDE_MDS`| Set to `1` to prevent loading any CLAUDE.md memory files into context, including user, project, and auto-memory files `CLAUDE_CODE_DISABLE_CRON`| Set to `1` to disable [scheduled tasks](</docs/en/scheduled-tasks>). The `/loop` skill and cron tools become unavailable and any already-scheduled tasks stop firing, including tasks that are already running mid-session -`CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`| Set to `1` to strip Anthropic-specific `anthropic-beta` request headers and beta tool-schema fields (such as `defer_loading` and `eager_input_streaming`) from API requests. Use this when a proxy gateway rejects requests with errors like “Unexpected value(s) for the `anthropic-beta` header” or “Extra inputs are not permitted”. Standard fields (`name`, `description`, `input_schema`, `cache_control`) are preserved. +`CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`| Set to `1` to strip Anthropic-specific `anthropic-beta` request headers and beta tool-schema fields (such as `defer_loading` and `eager_input_streaming`) from API requests. Use this when a proxy gateway rejects requests with errors like “Unexpected value(s) for the `anthropic-beta` header” or “Extra inputs are not permitted”. Standard fields (`name`, `description`, `input_schema`, `cache_control`) are preserved `CLAUDE_CODE_DISABLE_FAST_MODE`| Set to `1` to disable [fast mode](</docs/en/fast-mode>) `CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY`| Set to `1` to disable the “How is Claude doing?” session quality surveys. Surveys are also disabled when `DISABLE_TELEMETRY`, `DO_NOT_TRACK`, or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` is set, unless `CLAUDE_CODE_ENABLE_FEEDBACK_SURVEY_FOR_OTEL` opts back in. To set a sample rate instead of disabling outright, use the [`feedbackSurveyRate`](</docs/en/settings#available-settings>) setting. See [Session quality surveys](</docs/en/data-usage#session-quality-surveys>) `CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING`| Set to `1` to disable file [checkpointing](</docs/en/checkpointing>). The `/rewind` command will not be able to restore code changes @@ -213,19 +213,19 @@ `CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL`| Skip auto-installation of IDE extensions. Equivalent to setting [`autoInstallIdeExtension`](</docs/en/settings#global-config-settings>) to `false` `CLAUDE_CODE_IDE_SKIP_VALID_CHECK`| Set to `1` to skip validation of IDE lockfile entries during connection. Use when auto-connect fails to find your IDE despite it running `CLAUDE_CODE_MAX_CONTEXT_TOKENS`| Override the context window size Claude Code assumes for the active model. Only takes effect when `DISABLE_COMPACT` is also set. Use this when routing to a model through `ANTHROPIC_BASE_URL` whose context window does not match the built-in size for its name -`CLAUDE_CODE_MAX_OUTPUT_TOKENS`| Set the maximum number of output tokens for most requests. Defaults and caps vary by model; see [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>). Increasing this value reduces the effective context window available before [auto-compaction](</docs/en/costs#reduce-token-usage>) triggers. +`CLAUDE_CODE_MAX_OUTPUT_TOKENS`| Set the maximum number of output tokens for most requests. Defaults and caps vary by model; see [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>). Increasing this value reduces the effective context window available before [auto-compaction](</docs/en/costs#reduce-token-usage>) triggers `CLAUDE_CODE_MAX_RETRIES`| Override the number of times to retry failed API requests (default: 10). Capped at 15 as of v2.1.186. For unattended sessions that need to wait through longer outages, set `CLAUDE_CODE_RETRY_WATCHDOG` instead `CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY`| Maximum number of read-only tools and subagents that can execute in parallel (default: 10). Higher values increase parallelism but consume more resources `CLAUDE_CODE_MAX_TURNS`| Cap the number of agentic turns when no explicit limit is passed. Equivalent to passing [`--max-turns`](</docs/en/cli-reference#cli-flags>), which takes precedence when both are set. A value that is not a positive integer is rejected at startup with an error rather than treated as no cap `CLAUDE_CODE_MCP_ALLOWLIST_ENV`| Set to `1` to spawn stdio MCP servers with only a safe baseline environment plus the server’s configured `env`, instead of inheriting your shell environment `CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT`| Idle timeout in milliseconds for remote MCP tool calls (default: 300000, or 5 minutes). When an HTTP, SSE, WebSocket, or [claude.ai connector](</docs/en/mcp#use-mcp-servers-from-claude-ai>) MCP server sends no response and no progress notification for this long, the tool call aborts with an error instead of waiting for the overall `MCP_TOOL_TIMEOUT`. Set to `0` to disable the idle check. Values below 1000 are raised to one second, and the value is capped at the effective `MCP_TOOL_TIMEOUT`. Does not apply to stdio or IDE servers. Requires Claude Code v2.1.187 or later `CLAUDE_CODE_NATIVE_CURSOR`| Set to `1` to show the terminal’s own cursor at the input caret instead of a drawn block. The cursor respects the terminal’s blink, shape, and focus settings -`CLAUDE_CODE_NEW_INIT`| Set to `1` to make `/init` run an interactive setup flow. The flow asks which files to generate, including CLAUDE.md, skills, and hooks, before exploring the codebase and writing them. Without this variable, `/init` generates a CLAUDE.md automatically without prompting. +`CLAUDE_CODE_NEW_INIT`| Set to `1` to make `/init` run an interactive setup flow. The flow asks which files to generate, including CLAUDE.md, skills, and hooks, before exploring the codebase and writing them. Without this variable, `/init` generates a CLAUDE.md automatically without prompting `CLAUDE_CODE_NO_FLICKER`| Set to `1` to enable [fullscreen rendering](</docs/en/fullscreen>), a research preview that reduces flicker and keeps memory flat in long conversations. Equivalent to the [`tui`](</docs/en/settings#available-settings>) setting; you can also switch with `/tui fullscreen` `CLAUDE_CODE_OAUTH_REFRESH_TOKEN`| OAuth refresh token for Claude.ai authentication. When set, `claude auth login` exchanges this token directly instead of opening a browser. Requires `CLAUDE_CODE_OAUTH_SCOPES`. Useful for provisioning authentication in automated environments `CLAUDE_CODE_OAUTH_SCOPES`| Space-separated OAuth scopes the refresh token was issued with, such as `"user:profile user:inference user:sessions:claude_code"`. Required when `CLAUDE_CODE_OAUTH_REFRESH_TOKEN` is set `CLAUDE_CODE_OAUTH_TOKEN`| OAuth access token for Claude.ai authentication. Alternative to `/login` for SDK and automated environments. Takes precedence over keychain-stored credentials. Generate one with [`claude setup-token`](</docs/en/authentication#generate-a-long-lived-token>) -`CLAUDE_CODE_OPUS_4_6_FAST_MODE_OVERRIDE`| Removed in v2.1.160 and now a no-op. Previously pinned [fast mode](</docs/en/fast-mode>) to Claude Opus 4.6 instead of the current default. To run fast mode on Opus 4.6 until it is retired, select the model with `/model` first, then `/fast on` +`CLAUDE_CODE_OPUS_4_6_FAST_MODE_OVERRIDE`| Removed in v2.1.160 and now a no-op. Previously pinned [fast mode](</docs/en/fast-mode>) to Claude Opus 4.6 instead of the current default `CLAUDE_CODE_OTEL_DIAG_STDERR`| Set to `1` to write OpenTelemetry exporter diagnostic errors to stderr. By default these errors only appear with `--debug`, so a misconfigured exporter such as a Prometheus port collision otherwise fails silently. Requires Claude Code v2.1.179 or later. See [Monitoring](</docs/en/monitoring-usage>) `CLAUDE_CODE_OTEL_FLUSH_TIMEOUT_MS`| Timeout in milliseconds for flushing pending OpenTelemetry spans (default: 5000). See [Monitoring](</docs/en/monitoring-usage>) `CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS`| Interval for refreshing dynamic OpenTelemetry headers in milliseconds (default: 1740000 / 29 minutes). See [Dynamic headers](</docs/en/monitoring-usage#dynamic-headers>)
modified
--- a/env-vars.md +++ b/env-vars.md @@ -191,7 +191,7 @@ `CLAUDE_CODE_ENABLE_BACKGROUND_PLUGIN_REFRESH`| Set to `1` to refresh plugin state at turn boundaries in [non-interactive mode](</docs/en/headless>) after a background install completes. Off by default because the refresh changes the system prompt mid-session, which invalidates [prompt caching](</docs/en/prompt-caching>) for that turn `CLAUDE_CODE_ENABLE_FEEDBACK_SURVEY_FOR_OTEL`| Set to `1` to route the “How is Claude doing?” session quality survey to your own [OpenTelemetry collector](</docs/en/monitoring-usage>) when Anthropic-bound nonessential traffic is blocked. Survey ratings are emitted only as OTEL events to your configured collector. No survey data is sent to Anthropic in this mode. Applies when `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`, `DISABLE_TELEMETRY`, or `DO_NOT_TRACK` is set, and has no effect otherwise. `CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY` and the organization product feedback policy take precedence `CLAUDE_CODE_ENABLE_FINE_GRAINED_TOOL_STREAMING`| Controls whether tool call inputs stream from the API as Claude generates them. With this off, a large tool input such as a long file write arrives only after Claude finishes generating it, which can look like it’s hanging. Enabled by default on the Anthropic API. On Bedrock and Vertex, enabled per model where the deployed container supports it. Set to `0` to opt out. Set to `1` to force on when routing through a proxy via `ANTHROPIC_BASE_URL`, `ANTHROPIC_VERTEX_BASE_URL`, or `ANTHROPIC_BEDROCK_BASE_URL`. Off by default on Foundry and [gateway](</docs/en/llm-gateway>) connections -`CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY`| Set to `1` to populate the `/model` picker from your gateway’s `/v1/models` endpoint when `ANTHROPIC_BASE_URL` points at an Anthropic-compatible gateway such as LiteLLM, Kong, or an internal proxy. Off by default because gateways backed by a shared API key would otherwise show every user every model the key can access. Discovered models are still filtered by the [`availableModels`](</docs/en/settings#available-settings>) allowlist +`CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY`| Set to `1` to populate the `/model` picker from your gateway’s `/v1/models` endpoint when `ANTHROPIC_BASE_URL` points at an Anthropic-compatible gateway such as LiteLLM, Kong, or an internal proxy. Off by default because gateways backed by a shared API key would otherwise show every user every model the key can access. Discovered models are still filtered by an [`availableModels`](</docs/en/settings#available-settings>) allowlist the session receives; deliver the list through [MDM or a managed settings file](</docs/en/settings#settings-files>), since [server-managed delivery is not available on gateway configurations](</docs/en/server-managed-settings#platform-availability>) `CLAUDE_CODE_ENABLE_OPUS_4_7_FAST_MODE`| Removed in v2.1.142, when the [fast mode](</docs/en/fast-mode>) default moved from Opus 4.6 to Opus 4.7 `CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION`| Set to `false` to disable prompt suggestions (the “Prompt suggestions” toggle in `/config`). These are the grayed-out predictions that appear in your prompt input after Claude responds. See [Prompt suggestions](</docs/en/interactive-mode#prompt-suggestions>) `CLAUDE_CODE_ENABLE_TASKS`| Controls whether sessions use the structured Task tools (`TaskCreate`, `TaskUpdate`, `TaskGet`, `TaskList`) or the legacy `TodoWrite` tool. As of Claude Code v2.1.142, Task tools are the default in all modes. Set to `0` to revert to `TodoWrite`. See [Task list](</docs/en/interactive-mode#task-list>) and [Migrate to Task tools](</docs/en/agent-sdk/todo-tracking#migrate-to-task-tools>) @@ -218,6 +218,7 @@ `CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY`| Maximum number of read-only tools and subagents that can execute in parallel (default: 10). Higher values increase parallelism but consume more resources `CLAUDE_CODE_MAX_TURNS`| Cap the number of agentic turns when no explicit limit is passed. Equivalent to passing [`--max-turns`](</docs/en/cli-reference#cli-flags>), which takes precedence when both are set. A value that is not a positive integer is rejected at startup with an error rather than treated as no cap `CLAUDE_CODE_MCP_ALLOWLIST_ENV`| Set to `1` to spawn stdio MCP servers with only a safe baseline environment plus the server’s configured `env`, instead of inheriting your shell environment +`CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT`| Idle timeout in milliseconds for remote MCP tool calls (default: 300000, or 5 minutes). When an HTTP, SSE, WebSocket, or [claude.ai connector](</docs/en/mcp#use-mcp-servers-from-claude-ai>) MCP server sends no response and no progress notification for this long, the tool call aborts with an error instead of waiting for the overall `MCP_TOOL_TIMEOUT`. Set to `0` to disable the idle check. Values below 1000 are raised to one second, and the value is capped at the effective `MCP_TOOL_TIMEOUT`. Does not apply to stdio or IDE servers. Requires Claude Code v2.1.187 or later `CLAUDE_CODE_NATIVE_CURSOR`| Set to `1` to show the terminal’s own cursor at the input caret instead of a drawn block. The cursor respects the terminal’s blink, shape, and focus settings `CLAUDE_CODE_NEW_INIT`| Set to `1` to make `/init` run an interactive setup flow. The flow asks which files to generate, including CLAUDE.md, skills, and hooks, before exploring the codebase and writing them. Without this variable, `/init` generates a CLAUDE.md automatically without prompting. `CLAUDE_CODE_NO_FLICKER`| Set to `1` to enable [fullscreen rendering](</docs/en/fullscreen>), a research preview that reduces flicker and keeps memory flat in long conversations. Equivalent to the [`tui`](</docs/en/settings#available-settings>) setting; you can also switch with `/tui fullscreen` @@ -257,7 +258,7 @@ `CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT`| Set to `1` to use a shorter system prompt and abbreviated tool descriptions on any model. Set to `0`, `false`, `no`, or `off` to opt out even on models where the experiment or server configuration would otherwise enable it. The full tool set, hooks, MCP servers, and CLAUDE.md discovery remain enabled `CLAUDE_CODE_SKIP_ANTHROPIC_AWS_AUTH`| Skip client-side authentication for [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), for gateways that sign requests themselves `CLAUDE_CODE_SKIP_BEDROCK_AUTH`| Skip AWS authentication for Bedrock (for example, when using an LLM gateway) -`CLAUDE_CODE_SKIP_FOUNDRY_AUTH`| Skip Azure authentication for Microsoft Foundry (for example, when using an LLM gateway) +`CLAUDE_CODE_SKIP_FOUNDRY_AUTH`| Skip Azure authentication for Microsoft Foundry. For a gateway, set the credential in `ANTHROPIC_FOUNDRY_API_KEY` instead; without an API key this variable leaves the Foundry client unable to send requests `CLAUDE_CODE_SKIP_MANTLE_AUTH`| Skip AWS authentication for Bedrock Mantle (for example, when using an LLM gateway) `CLAUDE_CODE_SKIP_PROMPT_HISTORY`| Set to `1` to skip writing prompt history and session transcripts to disk. Sessions started with this variable set do not appear in `--resume`, `--continue`, or up-arrow history. Useful for ephemeral scripted sessions `CLAUDE_CODE_SKIP_VERTEX_AUTH`| Skip Google authentication for Vertex (for example, when using an LLM gateway)
modified
--- a/env-vars.md +++ b/env-vars.md @@ -155,7 +155,7 @@ `CLAUDE_CODE_CLIENT_CERT`| Path to client certificate file for mTLS authentication `CLAUDE_CODE_CLIENT_KEY`| Path to client private key file for mTLS authentication `CLAUDE_CODE_CLIENT_KEY_PASSPHRASE`| Passphrase for encrypted CLAUDE_CODE_CLIENT_KEY (optional) -`CLAUDE_CODE_CONNECT_TIMEOUT_MS`| Timeout in milliseconds for the connect, TLS, and response-header phase of a streaming API request (default: 60000, or 60 seconds). If no response headers arrive within this window, the request is aborted and retried. Set to `0` to disable and rely on `API_TIMEOUT_MS` alone +`CLAUDE_CODE_CONNECT_TIMEOUT_MS`| Removed in v2.1.186 and now a no-op. Previously set a separate timeout for the connect, TLS, and response-header phase of a streaming API request. Use `API_TIMEOUT_MS` for the per-request timeout `CLAUDE_CODE_DEBUG_LOGS_DIR`| Override the debug log file path. Despite the name, this is a file path, not a directory. Requires debug mode to be enabled separately via `--debug`, `/debug`, or the `DEBUG` environment variable: setting this variable alone does not enable logging. The [`--debug-file`](</docs/en/cli-reference#cli-flags>) flag does both at once. Defaults to `~/.claude/debug/<session-id>.txt` `CLAUDE_CODE_DEBUG_LOG_LEVEL`| Minimum log level written to the debug log file. Values: `verbose`, `debug` (default), `info`, `warn`, `error`. Set to `verbose` to include high-volume diagnostics like full status line command output, or raise to `error` to reduce noise `CLAUDE_CODE_DISABLE_1M_CONTEXT`| Set to `1` to disable [1M context window](</docs/en/model-config#extended-context>) support. When set, 1M model variants are unavailable in the model picker. Useful for enterprise environments with compliance requirements @@ -200,7 +200,8 @@ `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS`| Set to `1` to enable [agent teams](</docs/en/agent-teams>). Agent teams are experimental and disabled by default `CLAUDE_CODE_EXTRA_BODY`| JSON object to merge into the top level of every API request body. Useful for passing provider-specific parameters that Claude Code does not expose directly `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 -`CLAUDE_CODE_FORCE_SESSION_PERSISTENCE`| Set to `1` to force transcript persistence, prompt history, and `claude agents` registration even when this `claude` was launched from inside another Claude Code session. Use when an inherited `CLAUDE_CODE_CHILD_SESSION` value, for example from a tmux server first started by Claude Code’s Bash tool, causes a genuine top-level session to be misclassified as nested. Also honored on v2.1.169 and earlier; has no effect on v2.1.170 and v2.1.171, where the nested-session detection it overrides was removed +`CLAUDE_CODE_FORCE_SESSION_PERSISTENCE`| Set to `1` to force transcript persistence, prompt history, and `claude agents` registration even when this `claude` was launched from inside another Claude Code session. Use when an inherited `CLAUDE_CODE_CHILD_SESSION` value, for example from a `screen` session or a background launcher first started by Claude Code’s Bash tool, causes a genuine top-level session to be misclassified as nested. As of v2.1.178, Claude Code detects the tmux case automatically and ignores the inherited marker, so tmux no longer needs this variable. Also honored on v2.1.169 and earlier; has no effect on v2.1.170 and v2.1.171, where the nested-session detection it overrides was removed +`CLAUDE_CODE_FORCE_STRIKETHROUGH`| Set to `1` to force strikethrough rendering for `~~text~~` in Claude’s responses when your terminal supports it but is not auto-detected, such as over SSH without `TERM_PROGRAM` forwarded. Without this, undetected terminals show the literal `~~` markers instead of rendering the text as strikethrough. Requires Claude Code v2.1.186 or later `CLAUDE_CODE_FORCE_SYNC_OUTPUT`| Set to `1` to force-enable DEC private mode 2026 [synchronized output](<https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036>) when your terminal supports it but is not auto-detected. Useful for emulators such as Emacs `eat` that implement BSU/ESU but do not reply to the capability probe. Has no effect under tmux `CLAUDE_CODE_FORK_SUBAGENT`| Set to `1` to let Claude spawn [forked subagents](</docs/en/sub-agents#fork-the-current-conversation>), or `0` to disable them, overriding any server-side rollout. When enabled, Claude can request the `fork` subagent type to spawn a fork, a subagent that inherits the full conversation context instead of starting fresh. Spawns without a subagent type still use the general-purpose subagent, and all subagent spawns run in the background. The explicit [`/fork`](</docs/en/commands>) command works without this variable. Works in interactive mode and via the SDK or `claude -p` `CLAUDE_CODE_GIT_BASH_PATH`| Windows only: path to the Git Bash executable (`bash.exe`). Use when Git Bash is installed but not in your PATH. See [Windows setup](</docs/en/setup#set-up-on-windows>) @@ -213,7 +214,7 @@ `CLAUDE_CODE_IDE_SKIP_VALID_CHECK`| Set to `1` to skip validation of IDE lockfile entries during connection. Use when auto-connect fails to find your IDE despite it running `CLAUDE_CODE_MAX_CONTEXT_TOKENS`| Override the context window size Claude Code assumes for the active model. Only takes effect when `DISABLE_COMPACT` is also set. Use this when routing to a model through `ANTHROPIC_BASE_URL` whose context window does not match the built-in size for its name `CLAUDE_CODE_MAX_OUTPUT_TOKENS`| Set the maximum number of output tokens for most requests. Defaults and caps vary by model; see [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>). Increasing this value reduces the effective context window available before [auto-compaction](</docs/en/costs#reduce-token-usage>) triggers. -`CLAUDE_CODE_MAX_RETRIES`| Override the number of times to retry failed API requests (default: 10) +`CLAUDE_CODE_MAX_RETRIES`| Override the number of times to retry failed API requests (default: 10). Capped at 15 as of v2.1.186. For unattended sessions that need to wait through longer outages, set `CLAUDE_CODE_RETRY_WATCHDOG` instead `CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY`| Maximum number of read-only tools and subagents that can execute in parallel (default: 10). Higher values increase parallelism but consume more resources `CLAUDE_CODE_MAX_TURNS`| Cap the number of agentic turns when no explicit limit is passed. Equivalent to passing [`--max-turns`](</docs/en/cli-reference#cli-flags>), which takes precedence when both are set. A value that is not a positive integer is rejected at startup with an error rather than treated as no cap `CLAUDE_CODE_MCP_ALLOWLIST_ENV`| Set to `1` to spawn stdio MCP servers with only a safe baseline environment plus the server’s configured `env`, instead of inheriting your shell environment @@ -244,6 +245,7 @@ `CLAUDE_CODE_REMOTE_SESSION_ID`| Set automatically in [cloud sessions](</docs/en/claude-code-on-the-web>) to the current session’s ID. Read this to construct a link back to the session transcript. See [Link output back to the session](</docs/en/claude-code-on-the-web#link-output-back-to-the-session>) `CLAUDE_CODE_RESUME_INTERRUPTED_TURN`| Set to `1` to automatically resume if the previous session ended mid-turn. Used in SDK mode so the model continues without requiring the SDK to re-send the prompt `CLAUDE_CODE_RESUME_PROMPT`| Override the continuation message injected when resuming a session that ended mid-turn. Defaults to `Continue from where you left off.`. Spawn scripts for long-running agents can set this to a more directive boot message. An empty string uses the default +`CLAUDE_CODE_RETRY_WATCHDOG`| Set to `1` for unattended sessions such as eval harnesses, CI jobs, or remote workers. Retries `429` and `529` capacity errors indefinitely instead of failing after `CLAUDE_CODE_MAX_RETRIES` attempts. The watchdog backs off up to 5 minutes between attempts, or until the limit resets when the response carries a rate-limit reset time, so a session that hits a usage limit waits out the remaining window. Requires Claude Code v2.1.186 or later `CLAUDE_CODE_SAFE_MODE`| Set to `1` to start in safe mode: CLAUDE.md, skills, plugins, hooks, MCP servers, custom commands and agents, output styles, workflows, custom themes, custom keybindings, status line and file-suggestion commands, LSP servers, and auto-memory do not load, for troubleshooting a broken configuration. Managed settings policy still applies, including policy-configured hooks, status line, and file-suggestion commands; managed plugins, managed skills, managed CLAUDE.md, and policy-configured MCP servers do not. Equivalent to passing [`--safe-mode`](</docs/en/cli-reference#cli-flags>). Directly spawned child processes inherit the variable `CLAUDE_CODE_SCRIPT_CAPS`| JSON object limiting how many times specific scripts may be invoked per session when `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB` is set. Keys are substrings matched against the command text; values are integer call limits. For example, `{"deploy.sh": 2}` allows `deploy.sh` to be called at most twice. Matching is substring-based so shell-expansion tricks like `./scripts/deploy.sh $(evil)` still count against the cap. Runtime fan-out via `xargs` or `find -exec` is not detected; this is a defense-in-depth control `CLAUDE_CODE_SCROLL_SPEED`| Set the mouse wheel scroll multiplier in [fullscreen rendering](</docs/en/fullscreen#mouse-wheel-scrolling>). Accepts values from 1 to 20, and fractional values below 1 such as `0.5` to slow accelerated trackpad and wheel scrolling in terminals that already amplify wheel events. Set to `3` to match `vim` if your terminal sends one wheel event per notch without amplification. Ignored in the JetBrains IDE terminal, where Claude Code uses its own scroll handling
modified
--- a/env-vars.md +++ b/env-vars.md @@ -155,6 +155,7 @@ `CLAUDE_CODE_CLIENT_CERT`| Path to client certificate file for mTLS authentication `CLAUDE_CODE_CLIENT_KEY`| Path to client private key file for mTLS authentication `CLAUDE_CODE_CLIENT_KEY_PASSPHRASE`| Passphrase for encrypted CLAUDE_CODE_CLIENT_KEY (optional) +`CLAUDE_CODE_CONNECT_TIMEOUT_MS`| Timeout in milliseconds for the connect, TLS, and response-header phase of a streaming API request (default: 60000, or 60 seconds). If no response headers arrive within this window, the request is aborted and retried. Set to `0` to disable and rely on `API_TIMEOUT_MS` alone `CLAUDE_CODE_DEBUG_LOGS_DIR`| Override the debug log file path. Despite the name, this is a file path, not a directory. Requires debug mode to be enabled separately via `--debug`, `/debug`, or the `DEBUG` environment variable: setting this variable alone does not enable logging. The [`--debug-file`](</docs/en/cli-reference#cli-flags>) flag does both at once. Defaults to `~/.claude/debug/<session-id>.txt` `CLAUDE_CODE_DEBUG_LOG_LEVEL`| Minimum log level written to the debug log file. Values: `verbose`, `debug` (default), `info`, `warn`, `error`. Set to `verbose` to include high-volume diagnostics like full status line command output, or raise to `error` to reduce noise `CLAUDE_CODE_DISABLE_1M_CONTEXT`| Set to `1` to disable [1M context window](</docs/en/model-config#extended-context>) support. When set, 1M model variants are unavailable in the model picker. Useful for enterprise environments with compliance requirements @@ -235,6 +236,7 @@ `CLAUDE_CODE_PLUGIN_PREFER_HTTPS`| Set to `1` to clone GitHub `owner/repo` shorthand sources over HTTPS instead of SSH. Applies to plugin install and update, and to `/plugin marketplace add` and `update`. Useful in CI runners, containers, or any environment without a configured SSH key for `github.com` `CLAUDE_CODE_PLUGIN_SEED_DIR`| Path to one or more read-only plugin seed directories, separated by `:` on Unix or `;` on Windows. Use this to bundle a pre-populated plugins directory into a container image. Claude Code registers marketplaces from these directories at startup and uses pre-cached plugins without re-cloning. See [Pre-populate plugins for containers](</docs/en/plugin-marketplaces#pre-populate-plugins-for-containers>) `CLAUDE_CODE_POWERSHELL_RESPECT_EXECUTION_POLICY`| Set to `1` to stop Claude Code from passing `-ExecutionPolicy Bypass` when spawning PowerShell for tool calls, hooks, and status line commands, and respect the machine’s effective execution policy instead. By default Claude Code bypasses execution policy at process scope so `.ps1` scripts and module imports work on default-Restricted Windows installs. Process-scope bypass never overrides Group Policy `MachinePolicy` or `UserPolicy` regardless of this setting +`CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS`| Maximum time in milliseconds that [non-interactive mode](</docs/en/headless#background-tasks-at-exit>) with the `-p` flag waits after the final turn for background subagents and workflows whose result is part of the output. Default: `600000`, or 10 minutes. When the cap is exceeded, remaining background tasks are terminated and the process exits. Set to `0` to wait indefinitely. This cap is separate from the five-second grace period that applies to plain background shells `CLAUDE_CODE_PROPAGATE_TRACEPARENT`| Set to `1` to propagate W3C trace context when `ANTHROPIC_BASE_URL` points at a custom proxy. Propagation covers the `traceparent` header on model and HTTP MCP requests and the `TRACEPARENT` environment variable for Bash, PowerShell, and hook subprocesses. By default, propagation is enabled only when connected directly to the Anthropic API. Added in v2.1.152. See [Traces (beta)](</docs/en/monitoring-usage#traces-beta>) `CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`| Set by host platforms that embed Claude Code and manage model provider routing on its behalf. When set, provider-selection, endpoint, and authentication variables such as `CLAUDE_CODE_USE_BEDROCK`, `ANTHROPIC_BASE_URL`, and `ANTHROPIC_API_KEY` in settings files are ignored so user settings cannot override the host’s routing. The automatic telemetry opt-out for Bedrock, Vertex, and Foundry is also skipped, so telemetry follows the standard `DISABLE_TELEMETRY` opt-out. See [Default behaviors by API provider](</docs/en/data-usage#default-behaviors-by-api-provider>) `CLAUDE_CODE_PROXY_RESOLVES_HOSTS`| Set to `1` to allow the proxy to perform DNS resolution instead of the caller. Opt-in for environments where the proxy should handle hostname resolution @@ -309,7 +311,7 @@ `DISABLE_UPDATES`| Set to `1` to block all updates including manual `claude update` and `claude install`. Stricter than `DISABLE_AUTOUPDATER`. Use when distributing Claude Code through your own channels and users should not self-update `DISABLE_UPGRADE_COMMAND`| Set to `1` to hide the `/upgrade` command `DO_NOT_TRACK`| Set to `1` to opt out of telemetry. Equivalent to setting `DISABLE_TELEMETRY`. Claude Code honors this as the cross-tool convention recognized by many developer CLIs -`ENABLE_CLAUDEAI_MCP_SERVERS`| Set to `false` to disable [claude.ai MCP servers](</docs/en/mcp#use-mcp-servers-from-claude-ai>) in Claude Code. Enabled by default for logged-in users +`ENABLE_CLAUDEAI_MCP_SERVERS`| Set to `false` to disable [claude.ai MCP servers](</docs/en/mcp#use-mcp-servers-from-claude-ai>) in Claude Code. Enabled by default for logged-in users. To disable per-project or per-org, set [`disableClaudeAiConnectors`](</docs/en/settings#available-settings>) in settings instead `ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) instead of the default 5 minutes. Intended for API key, [Bedrock](</docs/en/amazon-bedrock>), [Vertex](</docs/en/google-vertex-ai>), [Foundry](</docs/en/microsoft-foundry>), and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) users. Subscription users within included usage receive 1-hour TTL automatically. 1-hour cache writes are billed at a higher rate `ENABLE_PROMPT_CACHING_1H_BEDROCK`| Deprecated. Use `ENABLE_PROMPT_CACHING_1H` instead `ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset: all MCP tools deferred by default, but loaded upfront on Vertex AI or when `ANTHROPIC_BASE_URL` points to a non-first-party host. Values: `true` (always defer and send the beta header, requests fail on Vertex AI models earlier than Sonnet 4.5 or Opus 4.5, or on proxies that do not support `tool_reference`), `auto` (threshold mode: load upfront if tools fit within 10% of context), `auto:N` (custom threshold, e.g., `auto:5` for 5%), `false` (load all upfront)
modified
--- a/env-vars.md +++ b/env-vars.md @@ -136,14 +136,17 @@ `CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS`| Set to `1` to disable all built-in [subagent](</docs/en/sub-agents>) types such as Explore and Plan. Only applies in non-interactive mode (the `-p` flag). Useful for SDK users who want a blank slate `CLAUDE_AGENT_SDK_MCP_NO_PREFIX`| Set to `1` to skip the `mcp__<server>__` prefix on tool names from SDK-created MCP servers. Tools use their original names. SDK usage only `CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS`| Stall timeout in milliseconds for background subagents. Default `600000` (10 minutes). The timer resets on each streaming progress event; if no progress arrives within the window, the subagent is aborted and the task is marked failed, surfacing any partial result to the parent -`CLAUDE_AUTOCOMPACT_PCT_OVERRIDE`| Set the percentage (1-100) of the auto-compaction window at which auto-compaction triggers. Use lower values like `50` to compact earlier. This variable only causes earlier compaction when Claude Code compacts proactively: when `CLAUDE_CODE_AUTO_COMPACT_WINDOW` is set, in [cloud sessions](</docs/en/claude-code-on-the-web>), in [Remote Control](</docs/en/remote-control>) sessions, and on Sonnet 4.6 and Opus 4.6 without [extended context](</docs/en/model-config#extended-context>), which compact at the 200K boundary by default. In other cases, such as a local session on Opus 4.8 or any model with extended context, auto-compaction triggers when the conversation reaches the model’s context limit. The override can only lower the threshold, so values above the default have no effect. Applies to both main conversations and subagents +`CLAUDE_AUTOCOMPACT_PCT_OVERRIDE`| Set the percentage (1-100) of the auto-compaction window at which auto-compaction triggers. Use lower values like `50` to compact earlier. This variable only causes earlier compaction when Claude Code compacts proactively: when `CLAUDE_CODE_AUTO_COMPACT_WINDOW` is set, in [cloud sessions](</docs/en/claude-code-on-the-web>), and on Sonnet 4.6 and Opus 4.6 without [extended context](</docs/en/model-config#extended-context>), which compact at the 200K boundary by default. In other cases, such as a local session on Opus 4.8 or any model with extended context, auto-compaction triggers when the conversation reaches the model’s context limit. The override can only lower the threshold, so values above the default have no effect. Applies to both main conversations and subagents `CLAUDE_AUTO_BACKGROUND_TASKS`| Set to `1` to force-enable automatic backgrounding of long-running agent tasks. When enabled, subagents are moved to the background after running for approximately two minutes +`CLAUDE_AX_SCREEN_READER`| Set to `1` to render screen-reader friendly output: flat text without decorative borders or animations. Set to `0` to force screen-reader mode off even when [`axScreenReader`](</docs/en/settings#available-settings>) is `true`. The [`--ax-screen-reader`](</docs/en/cli-reference#cli-flags>) flag takes precedence. Requires Claude Code v2.1.181 or later `CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR`| Return to the original working directory after each Bash or PowerShell command in the main session +`CLAUDE_CLIENT_PRESENCE_FILE`| Path to a file that an external tool, such as a screen-lock listener, creates when you unlock your screen and deletes when you lock it. While the file exists, Claude Code skips [Remote Control mobile push notifications](</docs/en/remote-control#mobile-push-notifications>), so you stop getting pushes while you are actively using the computer. When the file is absent or unreadable, notifications are sent as normal. Claude Code checks the file once per push-triggering event rather than polling it. Requires Claude Code v2.1.181 or later `CLAUDE_CODE_ACCESSIBILITY`| Set to `1` to keep the native terminal cursor visible and disable the inverted-text cursor indicator. Allows screen magnifiers like macOS Zoom to track cursor position `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD`| Set to `1` to load memory files from directories specified with `--add-dir`. Loads `CLAUDE.md`, `.claude/CLAUDE.md`, `.claude/rules/*.md`, and `CLAUDE.local.md`. By default, additional directories do not load memory files `CLAUDE_CODE_ALT_SCREEN_FULL_REPAINT`| Set to `1` to repaint the entire screen on every frame in [fullscreen rendering](</docs/en/fullscreen>) instead of sending incremental updates. Use this if fullscreen mode shows stale or misplaced text fragments. Claude Code enables this automatically for background sessions and [agent view](</docs/en/agent-view>) on Windows `CLAUDE_CODE_ALWAYS_ENABLE_EFFORT`| Set to `1` to send the [effort](</docs/en/model-config#adjust-effort-level>) parameter with every request, even when Claude Code does not recognize the model ID as effort-capable. Use this when routing through an [LLM gateway](</docs/en/llm-gateway>) or third-party provider that serves models under custom identifiers. Models that reject the effort parameter at the API, including Claude 3 models, Sonnet 4.0 and 4.5, Opus 4.0 and 4.1, and Haiku 4.5, are still excluded so requests do not fail `CLAUDE_CODE_API_KEY_HELPER_TTL_MS`| Interval in milliseconds at which credentials should be refreshed (when using [`apiKeyHelper`](</docs/en/settings#available-settings>)) +`CLAUDE_CODE_ARTIFACT_AUTO_OPEN`| Set to `0` to stop Claude Code from opening the browser automatically when a new [artifact](</docs/en/artifacts>) is published. Republishing an existing artifact does not open the browser regardless of this setting `CLAUDE_CODE_ATTRIBUTION_HEADER`| Set to `0` to omit the attribution block (client version and prompt fingerprint) from the start of the system prompt. Disabling it improves prompt-cache hit rates when routing through an [LLM gateway](</docs/en/llm-gateway>). Anthropic API caching is unaffected `CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the context capacity in tokens used for auto-compaction calculations. Defaults to the model’s context window: 200K for standard models or 1M for [extended context](</docs/en/model-config#extended-context>) models. Use a lower value like `500000` on a 1M model to treat the window as 500K for compaction purposes. The value is capped at the model’s actual context window. `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` is applied as a percentage of this value. Setting this variable decouples the compaction threshold from the status line’s `used_percentage`, which always uses the model’s full context window `CLAUDE_CODE_AUTO_CONNECT_IDE`| Override automatic [IDE connection](</docs/en/vs-code>). By default, Claude Code connects automatically when launched inside a supported IDE’s integrated terminal. Set to `false` to prevent this. Set to `true` to force a connection attempt when auto-detection fails, such as when tmux obscures the parent terminal. Takes precedence over the [`autoConnectIde`](</docs/en/settings#global-config-settings>) global config setting @@ -159,6 +162,7 @@ `CLAUDE_CODE_DISABLE_ADVISOR_TOOL`| Set to `1` to disable the [advisor tool](</docs/en/advisor>). The `/advisor` command and `--advisor` flag become unavailable and any configured `advisorModel` is ignored. Requires Claude Code v2.1.98 or later `CLAUDE_CODE_DISABLE_AGENT_VIEW`| Set to `1` to turn off [background agents and agent view](</docs/en/agent-view>): `claude agents`, `--bg`, `/background`, and the on-demand supervisor. Equivalent to the [`disableAgentView`](</docs/en/settings#available-settings>) setting `CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN`| Set to `1` to disable [fullscreen rendering](</docs/en/fullscreen>) and use the classic main-screen renderer. The conversation stays in your terminal’s native scrollback so `Cmd+f` and tmux copy mode work as usual. Takes precedence over `CLAUDE_CODE_NO_FLICKER` and the [`tui`](</docs/en/settings#available-settings>) setting. You can also switch with `/tui default`. Does not apply to background sessions opened from [agent view](</docs/en/agent-view>), which always use fullscreen rendering +`CLAUDE_CODE_DISABLE_ARTIFACT`| Set to `1` to disable the [Artifact](</docs/en/artifacts>) tool, which publishes session output as a private web page on claude.ai. Equivalent to the [`disableArtifact`](</docs/en/settings#available-settings>) setting `CLAUDE_CODE_DISABLE_ATTACHMENTS`| Set to `1` to disable attachment processing. File mentions with `@` syntax are sent as plain text instead of being expanded into file content `CLAUDE_CODE_DISABLE_AUTO_MEMORY`| Set to `1` to disable [auto memory](</docs/en/memory#auto-memory>). Set to `0` to force auto memory on even when `--bare` mode or [`autoMemoryEnabled: false`](</docs/en/settings#available-settings>) would otherwise disable it. When disabled, Claude does not create or load auto memory files `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 @@ -219,6 +223,7 @@ `CLAUDE_CODE_OAUTH_SCOPES`| Space-separated OAuth scopes the refresh token was issued with, such as `"user:profile user:inference user:sessions:claude_code"`. Required when `CLAUDE_CODE_OAUTH_REFRESH_TOKEN` is set `CLAUDE_CODE_OAUTH_TOKEN`| OAuth access token for Claude.ai authentication. Alternative to `/login` for SDK and automated environments. Takes precedence over keychain-stored credentials. Generate one with [`claude setup-token`](</docs/en/authentication#generate-a-long-lived-token>) `CLAUDE_CODE_OPUS_4_6_FAST_MODE_OVERRIDE`| Removed in v2.1.160 and now a no-op. Previously pinned [fast mode](</docs/en/fast-mode>) to Claude Opus 4.6 instead of the current default. To run fast mode on Opus 4.6 until it is retired, select the model with `/model` first, then `/fast on` +`CLAUDE_CODE_OTEL_DIAG_STDERR`| Set to `1` to write OpenTelemetry exporter diagnostic errors to stderr. By default these errors only appear with `--debug`, so a misconfigured exporter such as a Prometheus port collision otherwise fails silently. Requires Claude Code v2.1.179 or later. See [Monitoring](</docs/en/monitoring-usage>) `CLAUDE_CODE_OTEL_FLUSH_TIMEOUT_MS`| Timeout in milliseconds for flushing pending OpenTelemetry spans (default: 5000). See [Monitoring](</docs/en/monitoring-usage>) `CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS`| Interval for refreshing dynamic OpenTelemetry headers in milliseconds (default: 1740000 / 29 minutes). See [Dynamic headers](</docs/en/monitoring-usage#dynamic-headers>) `CLAUDE_CODE_OTEL_SHUTDOWN_TIMEOUT_MS`| Timeout in milliseconds for the OpenTelemetry exporter to finish on shutdown (default: 2000). Increase if metrics are dropped at exit. See [Monitoring](</docs/en/monitoring-usage>) @@ -234,7 +239,7 @@ `CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`| Set by host platforms that embed Claude Code and manage model provider routing on its behalf. When set, provider-selection, endpoint, and authentication variables such as `CLAUDE_CODE_USE_BEDROCK`, `ANTHROPIC_BASE_URL`, and `ANTHROPIC_API_KEY` in settings files are ignored so user settings cannot override the host’s routing. The automatic telemetry opt-out for Bedrock, Vertex, and Foundry is also skipped, so telemetry follows the standard `DISABLE_TELEMETRY` opt-out. See [Default behaviors by API provider](</docs/en/data-usage#default-behaviors-by-api-provider>) `CLAUDE_CODE_PROXY_RESOLVES_HOSTS`| Set to `1` to allow the proxy to perform DNS resolution instead of the caller. Opt-in for environments where the proxy should handle hostname resolution `CLAUDE_CODE_REMOTE`| Set automatically to `true` when Claude Code is running as a [cloud session](</docs/en/claude-code-on-the-web>). Read this from a hook or setup script to detect whether you are in a cloud environment -`CLAUDE_CODE_REMOTE_SESSION_ID`| Set automatically in [cloud sessions](</docs/en/claude-code-on-the-web>) to the current session’s ID. Read this to construct a link back to the session transcript. See [Link artifacts back to the session](</docs/en/claude-code-on-the-web#link-artifacts-back-to-the-session>) +`CLAUDE_CODE_REMOTE_SESSION_ID`| Set automatically in [cloud sessions](</docs/en/claude-code-on-the-web>) to the current session’s ID. Read this to construct a link back to the session transcript. See [Link output back to the session](</docs/en/claude-code-on-the-web#link-output-back-to-the-session>) `CLAUDE_CODE_RESUME_INTERRUPTED_TURN`| Set to `1` to automatically resume if the previous session ended mid-turn. Used in SDK mode so the model continues without requiring the SDK to re-send the prompt `CLAUDE_CODE_RESUME_PROMPT`| Override the continuation message injected when resuming a session that ended mid-turn. Defaults to `Continue from where you left off.`. Spawn scripts for long-running agents can set this to a more directive boot message. An empty string uses the default `CLAUDE_CODE_SAFE_MODE`| Set to `1` to start in safe mode: CLAUDE.md, skills, plugins, hooks, MCP servers, custom commands and agents, output styles, workflows, custom themes, custom keybindings, status line and file-suggestion commands, LSP servers, and auto-memory do not load, for troubleshooting a broken configuration. Managed settings policy still applies, including policy-configured hooks, status line, and file-suggestion commands; managed plugins, managed skills, managed CLAUDE.md, and policy-configured MCP servers do not. Equivalent to passing [`--safe-mode`](</docs/en/cli-reference#cli-flags>). Directly spawned child processes inherit the variable @@ -328,7 +333,7 @@ `NO_PROXY`| List of domains and IPs to which requests will be directly issued, bypassing proxy `OTEL_LOG_RAW_API_BODIES`| Emit Anthropic Messages API request and response JSON as `api_request_body` / `api_response_body` log events. Set to `1` for inline bodies truncated at 60 KB, or `file:<dir>` to write untruncated bodies to disk and emit a `body_ref` path instead. Disabled by default; bodies include the entire conversation history. See [Monitoring](</docs/en/monitoring-usage#api-request-body-event>) `OTEL_LOG_TOOL_CONTENT`| Set to `1` to include tool input and output content in OpenTelemetry span events. Disabled by default to protect sensitive data. See [Monitoring](</docs/en/monitoring-usage>) -`OTEL_LOG_TOOL_DETAILS`| Set to `1` to include tool input arguments, MCP server names, raw error strings on tool failures, and other tool details in OpenTelemetry traces and logs. Disabled by default to protect PII. See [Monitoring](</docs/en/monitoring-usage>) +`OTEL_LOG_TOOL_DETAILS`| Set to `1` to include tool input arguments, MCP server names, raw error strings on tool failures, the refusal `category` on `api_refusal` events, and other tool details in OpenTelemetry traces and logs. Disabled by default to protect PII. See [Monitoring](</docs/en/monitoring-usage>) `OTEL_LOG_USER_PROMPTS`| Set to `1` to include user prompt text in OpenTelemetry traces and logs. Disabled by default (prompts are redacted). See [Monitoring](</docs/en/monitoring-usage>) `OTEL_METRICS_INCLUDE_ACCOUNT_UUID`| Set to `false` to exclude account UUID from metrics attributes (default: included). See [Monitoring](</docs/en/monitoring-usage>) `OTEL_METRICS_INCLUDE_ENTRYPOINT`| Set to `true` to include the session entrypoint in metrics attributes (default: excluded). Added in v2.1.152. See [Monitoring](</docs/en/monitoring-usage>)
modified
--- a/env-vars.md +++ b/env-vars.md @@ -136,7 +136,7 @@ `CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS`| Set to `1` to disable all built-in [subagent](</docs/en/sub-agents>) types such as Explore and Plan. Only applies in non-interactive mode (the `-p` flag). Useful for SDK users who want a blank slate `CLAUDE_AGENT_SDK_MCP_NO_PREFIX`| Set to `1` to skip the `mcp__<server>__` prefix on tool names from SDK-created MCP servers. Tools use their original names. SDK usage only `CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS`| Stall timeout in milliseconds for background subagents. Default `600000` (10 minutes). The timer resets on each streaming progress event; if no progress arrives within the window, the subagent is aborted and the task is marked failed, surfacing any partial result to the parent -`CLAUDE_AUTOCOMPACT_PCT_OVERRIDE`| Set the percentage (1-100) of the auto-compaction window at which auto-compaction triggers. Use lower values like `50` to compact earlier. This variable only causes earlier compaction when Claude Code compacts proactively: when `CLAUDE_CODE_AUTO_COMPACT_WINDOW` is set, in [cloud sessions](</docs/en/claude-code-on-the-web>), in [Remote Control](</docs/en/remote-control>) sessions, and on Sonnet 4.6 and Opus 4.6 without [extended context](</docs/en/model-config#extended-context>), which compact at the 200K boundary by default. In other cases, such as a default local session, auto-compaction triggers when the conversation reaches the model’s context limit. The override can only lower the threshold, so values above the default have no effect. Applies to both main conversations and subagents +`CLAUDE_AUTOCOMPACT_PCT_OVERRIDE`| Set the percentage (1-100) of the auto-compaction window at which auto-compaction triggers. Use lower values like `50` to compact earlier. This variable only causes earlier compaction when Claude Code compacts proactively: when `CLAUDE_CODE_AUTO_COMPACT_WINDOW` is set, in [cloud sessions](</docs/en/claude-code-on-the-web>), in [Remote Control](</docs/en/remote-control>) sessions, and on Sonnet 4.6 and Opus 4.6 without [extended context](</docs/en/model-config#extended-context>), which compact at the 200K boundary by default. In other cases, such as a local session on Opus 4.8 or any model with extended context, auto-compaction triggers when the conversation reaches the model’s context limit. The override can only lower the threshold, so values above the default have no effect. Applies to both main conversations and subagents `CLAUDE_AUTO_BACKGROUND_TASKS`| Set to `1` to force-enable automatic backgrounding of long-running agent tasks. When enabled, subagents are moved to the background after running for approximately two minutes `CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR`| Return to the original working directory after each Bash or PowerShell command in the main session `CLAUDE_CODE_ACCESSIBILITY`| Set to `1` to keep the native terminal cursor visible and disable the inverted-text cursor indicator. Allows screen magnifiers like macOS Zoom to track cursor position @@ -148,7 +148,7 @@ `CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the context capacity in tokens used for auto-compaction calculations. Defaults to the model’s context window: 200K for standard models or 1M for [extended context](</docs/en/model-config#extended-context>) models. Use a lower value like `500000` on a 1M model to treat the window as 500K for compaction purposes. The value is capped at the model’s actual context window. `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` is applied as a percentage of this value. Setting this variable decouples the compaction threshold from the status line’s `used_percentage`, which always uses the model’s full context window `CLAUDE_CODE_AUTO_CONNECT_IDE`| Override automatic [IDE connection](</docs/en/vs-code>). By default, Claude Code connects automatically when launched inside a supported IDE’s integrated terminal. Set to `false` to prevent this. Set to `true` to force a connection attempt when auto-detection fails, such as when tmux obscures the parent terminal. Takes precedence over the [`autoConnectIde`](</docs/en/settings#global-config-settings>) global config setting `CLAUDE_CODE_CERT_STORE`| Comma-separated list of CA certificate sources for TLS connections. `bundled` is the Mozilla CA set shipped with Claude Code. `system` is the operating system trust store. Default is `bundled,system` -`CLAUDE_CODE_CHILD_SESSION`| Set to `1` in subprocesses Claude Code spawns via the Bash, PowerShell, and Monitor tools, [hook](</docs/en/hooks>) commands, and [status line](</docs/en/statusline>) commands. Not set for stdio [MCP server](</docs/en/mcp>) subprocesses, which are long-lived and outlive the session that spawned them. Unlike `CLAUDECODE`, this is only set by Claude Code’s own spawn path and not by IDE extensions, so it reliably distinguishes a nested session from a top-level `claude` launched in an IDE-integrated terminal. A nested interactive `claude` TUI started this way is automatically excluded from `--resume`, `--continue`, up-arrow history, and the `claude agents` list. Non-interactive `claude -p` sessions still persist. Set `CLAUDE_CODE_FORCE_SESSION_PERSISTENCE=1` to override this exclusion. Requires Claude Code v2.1.172 or later +`CLAUDE_CODE_CHILD_SESSION`| Set to `1` in subprocesses Claude Code spawns via the Bash, PowerShell, and Monitor tools, [hook](</docs/en/hooks>) commands, and [status line](</docs/en/statusline>) commands. Not set for stdio [MCP server](</docs/en/mcp>) subprocesses, which are long-lived and outlive the session that spawned them. Unlike `CLAUDECODE`, this is only set by Claude Code itself when it launches a subprocess and not by IDE extensions, so it reliably distinguishes a nested session from a top-level `claude` launched in an IDE-integrated terminal. A nested interactive `claude` TUI started this way is automatically excluded from `--resume`, `--continue`, up-arrow history, and the `claude agents` list. Non-interactive `claude -p` sessions still persist. Set `CLAUDE_CODE_FORCE_SESSION_PERSISTENCE=1` to override this exclusion. Requires Claude Code v2.1.172 or later `CLAUDE_CODE_CLIENT_CERT`| Path to client certificate file for mTLS authentication `CLAUDE_CODE_CLIENT_KEY`| Path to client private key file for mTLS authentication `CLAUDE_CODE_CLIENT_KEY_PASSPHRASE`| Passphrase for encrypted CLAUDE_CODE_CLIENT_KEY (optional) @@ -197,7 +197,7 @@ `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 `CLAUDE_CODE_FORCE_SESSION_PERSISTENCE`| Set to `1` to force transcript persistence, prompt history, and `claude agents` registration even when this `claude` was launched from inside another Claude Code session. Use when an inherited `CLAUDE_CODE_CHILD_SESSION` value, for example from a tmux server first started by Claude Code’s Bash tool, causes a genuine top-level session to be misclassified as nested. Also honored on v2.1.169 and earlier; has no effect on v2.1.170 and v2.1.171, where the nested-session detection it overrides was removed `CLAUDE_CODE_FORCE_SYNC_OUTPUT`| Set to `1` to force-enable DEC private mode 2026 [synchronized output](<https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036>) when your terminal supports it but is not auto-detected. Useful for emulators such as Emacs `eat` that implement BSU/ESU but do not reply to the capability probe. Has no effect under tmux -`CLAUDE_CODE_FORK_SUBAGENT`| Set to `1` to make [forked subagents](</docs/en/sub-agents#fork-the-current-conversation>) the model’s default, or `0` to disable them, overriding any server-side rollout. When enabled, Claude spawns a fork, a subagent that inherits the full conversation context instead of starting fresh, whenever it would otherwise use the general-purpose subagent, and all subagent spawns run in the background. The explicit [`/fork`](</docs/en/commands>) command works without this variable. Works in interactive mode and via the SDK or `claude -p` +`CLAUDE_CODE_FORK_SUBAGENT`| Set to `1` to let Claude spawn [forked subagents](</docs/en/sub-agents#fork-the-current-conversation>), or `0` to disable them, overriding any server-side rollout. When enabled, Claude can request the `fork` subagent type to spawn a fork, a subagent that inherits the full conversation context instead of starting fresh. Spawns without a subagent type still use the general-purpose subagent, and all subagent spawns run in the background. The explicit [`/fork`](</docs/en/commands>) command works without this variable. Works in interactive mode and via the SDK or `claude -p` `CLAUDE_CODE_GIT_BASH_PATH`| Windows only: path to the Git Bash executable (`bash.exe`). Use when Git Bash is installed but not in your PATH. See [Windows setup](</docs/en/setup#set-up-on-windows>) `CLAUDE_CODE_GLOB_HIDDEN`| Set to `false` to exclude dotfiles from results when Claude invokes the [Glob tool](</docs/en/tools-reference#glob-tool-behavior>). Included by default. Does not affect `@` file autocomplete, `ls`, Grep, or Read `CLAUDE_CODE_GLOB_NO_IGNORE`| Set to `false` to make the [Glob tool](</docs/en/tools-reference#glob-tool-behavior>) respect `.gitignore` patterns. By default, Glob returns all matching files including gitignored ones. Does not affect `@` file autocomplete, which has its own [`respectGitignore` setting](</docs/en/settings#available-settings>) @@ -239,7 +239,7 @@ `CLAUDE_CODE_RESUME_PROMPT`| Override the continuation message injected when resuming a session that ended mid-turn. Defaults to `Continue from where you left off.`. Spawn scripts for long-running agents can set this to a more directive boot message. An empty string uses the default `CLAUDE_CODE_SAFE_MODE`| Set to `1` to start in safe mode: CLAUDE.md, skills, plugins, hooks, MCP servers, custom commands and agents, output styles, workflows, custom themes, custom keybindings, status line and file-suggestion commands, LSP servers, and auto-memory do not load, for troubleshooting a broken configuration. Managed settings policy still applies, including policy-configured hooks, status line, and file-suggestion commands; managed plugins, managed skills, managed CLAUDE.md, and policy-configured MCP servers do not. Equivalent to passing [`--safe-mode`](</docs/en/cli-reference#cli-flags>). Directly spawned child processes inherit the variable `CLAUDE_CODE_SCRIPT_CAPS`| JSON object limiting how many times specific scripts may be invoked per session when `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB` is set. Keys are substrings matched against the command text; values are integer call limits. For example, `{"deploy.sh": 2}` allows `deploy.sh` to be called at most twice. Matching is substring-based so shell-expansion tricks like `./scripts/deploy.sh $(evil)` still count against the cap. Runtime fan-out via `xargs` or `find -exec` is not detected; this is a defense-in-depth control -`CLAUDE_CODE_SCROLL_SPEED`| Set the mouse wheel scroll multiplier in [fullscreen rendering](</docs/en/fullscreen#mouse-wheel-scrolling>). Accepts values from 1 to 20, and fractional values below 1 such as `0.5` to slow accelerated trackpad and wheel scrolling in terminals on the native scroll path. Set to `3` to match `vim` if your terminal sends one wheel event per notch without amplification. Ignored in the JetBrains IDE terminal, where Claude Code uses its own scroll handling +`CLAUDE_CODE_SCROLL_SPEED`| Set the mouse wheel scroll multiplier in [fullscreen rendering](</docs/en/fullscreen#mouse-wheel-scrolling>). Accepts values from 1 to 20, and fractional values below 1 such as `0.5` to slow accelerated trackpad and wheel scrolling in terminals that already amplify wheel events. Set to `3` to match `vim` if your terminal sends one wheel event per notch without amplification. Ignored in the JetBrains IDE terminal, where Claude Code uses its own scroll handling `CLAUDE_CODE_SESSIONEND_HOOKS_TIMEOUT_MS`| Override the time budget in milliseconds for [SessionEnd](</docs/en/hooks#sessionend>) hooks. Applies to session exit, `/clear`, and switching sessions via interactive `/resume`. By default the budget is 1.5 seconds, automatically raised to the highest per-hook `timeout` configured in settings files, up to 60 seconds. Timeouts on plugin-provided hooks do not raise the budget `CLAUDE_CODE_SESSION_ID`| Set automatically to the current session ID in Bash and PowerShell tool subprocesses, [hook command](</docs/en/hooks>) subprocesses, and stdio [MCP server](</docs/en/mcp>) subprocesses. For Bash, PowerShell, and hooks this matches the `session_id` field in the hook JSON input and is updated on `/clear`. An MCP server subprocess retains the ID it was spawned with. On `--resume <session-id>` it receives the resumed ID, matching hooks and Bash. On `--continue` or `--resume` without an explicit ID it may receive the initial startup ID instead. Use to correlate scripts and external tools with the Claude Code session that launched them `CLAUDE_CODE_SHELL`| Override automatic shell detection. Useful when your login shell differs from your preferred working shell (for example, `bash` vs `zsh`)
modified
--- a/env-vars.md +++ b/env-vars.md @@ -132,11 +132,11 @@ `BASH_MAX_OUTPUT_LENGTH`| Maximum number of characters in bash outputs before the full output is saved to a file and Claude receives the path plus a short preview. See [Bash tool behavior](</docs/en/tools-reference#bash-tool-behavior>) `BASH_MAX_TIMEOUT_MS`| Maximum timeout the model can set for long-running bash commands (default: 600000, or 10 minutes) `CCR_FORCE_BUNDLE`| Set to `1` to force [`claude --remote`](</docs/en/claude-code-on-the-web#send-local-repositories-without-github>) to bundle and upload your local repository even when GitHub access is available -`CLAUDECODE`| Set to `1` in subprocesses Claude Code spawns (Bash and PowerShell tools, tmux sessions, [hook](</docs/en/hooks>) commands, [status line](</docs/en/statusline>) commands, stdio [MCP server](</docs/en/mcp>) subprocesses). Use to detect when a script is running inside a subprocess spawned by Claude Code +`CLAUDECODE`| Set to `1` in subprocesses Claude Code spawns (Bash and PowerShell tools, tmux sessions, [hook](</docs/en/hooks>) commands, [status line](</docs/en/statusline>) commands, stdio [MCP server](</docs/en/mcp>) subprocesses). IDE extensions also set this in their integrated terminals. Use to detect when a script is running inside a subprocess spawned by Claude Code. To check whether the current process was spawned directly by a tool call or hook, rather than inside a stdio MCP server that Claude Code started, use `CLAUDE_CODE_CHILD_SESSION` instead `CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS`| Set to `1` to disable all built-in [subagent](</docs/en/sub-agents>) types such as Explore and Plan. Only applies in non-interactive mode (the `-p` flag). Useful for SDK users who want a blank slate `CLAUDE_AGENT_SDK_MCP_NO_PREFIX`| Set to `1` to skip the `mcp__<server>__` prefix on tool names from SDK-created MCP servers. Tools use their original names. SDK usage only `CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS`| Stall timeout in milliseconds for background subagents. Default `600000` (10 minutes). The timer resets on each streaming progress event; if no progress arrives within the window, the subagent is aborted and the task is marked failed, surfacing any partial result to the parent -`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](</docs/en/statusline>) +`CLAUDE_AUTOCOMPACT_PCT_OVERRIDE`| Set the percentage (1-100) of the auto-compaction window at which auto-compaction triggers. Use lower values like `50` to compact earlier. This variable only causes earlier compaction when Claude Code compacts proactively: when `CLAUDE_CODE_AUTO_COMPACT_WINDOW` is set, in [cloud sessions](</docs/en/claude-code-on-the-web>), in [Remote Control](</docs/en/remote-control>) sessions, and on Sonnet 4.6 and Opus 4.6 without [extended context](</docs/en/model-config#extended-context>), which compact at the 200K boundary by default. In other cases, such as a default local session, auto-compaction triggers when the conversation reaches the model’s context limit. The override can only lower the threshold, so values above the default have no effect. Applies to both main conversations and subagents `CLAUDE_AUTO_BACKGROUND_TASKS`| Set to `1` to force-enable automatic backgrounding of long-running agent tasks. When enabled, subagents are moved to the background after running for approximately two minutes `CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR`| Return to the original working directory after each Bash or PowerShell command in the main session `CLAUDE_CODE_ACCESSIBILITY`| Set to `1` to keep the native terminal cursor visible and disable the inverted-text cursor indicator. Allows screen magnifiers like macOS Zoom to track cursor position @@ -148,6 +148,7 @@ `CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the context capacity in tokens used for auto-compaction calculations. Defaults to the model’s context window: 200K for standard models or 1M for [extended context](</docs/en/model-config#extended-context>) models. Use a lower value like `500000` on a 1M model to treat the window as 500K for compaction purposes. The value is capped at the model’s actual context window. `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` is applied as a percentage of this value. Setting this variable decouples the compaction threshold from the status line’s `used_percentage`, which always uses the model’s full context window `CLAUDE_CODE_AUTO_CONNECT_IDE`| Override automatic [IDE connection](</docs/en/vs-code>). By default, Claude Code connects automatically when launched inside a supported IDE’s integrated terminal. Set to `false` to prevent this. Set to `true` to force a connection attempt when auto-detection fails, such as when tmux obscures the parent terminal. Takes precedence over the [`autoConnectIde`](</docs/en/settings#global-config-settings>) global config setting `CLAUDE_CODE_CERT_STORE`| Comma-separated list of CA certificate sources for TLS connections. `bundled` is the Mozilla CA set shipped with Claude Code. `system` is the operating system trust store. Default is `bundled,system` +`CLAUDE_CODE_CHILD_SESSION`| Set to `1` in subprocesses Claude Code spawns via the Bash, PowerShell, and Monitor tools, [hook](</docs/en/hooks>) commands, and [status line](</docs/en/statusline>) commands. Not set for stdio [MCP server](</docs/en/mcp>) subprocesses, which are long-lived and outlive the session that spawned them. Unlike `CLAUDECODE`, this is only set by Claude Code’s own spawn path and not by IDE extensions, so it reliably distinguishes a nested session from a top-level `claude` launched in an IDE-integrated terminal. A nested interactive `claude` TUI started this way is automatically excluded from `--resume`, `--continue`, up-arrow history, and the `claude agents` list. Non-interactive `claude -p` sessions still persist. Set `CLAUDE_CODE_FORCE_SESSION_PERSISTENCE=1` to override this exclusion. Requires Claude Code v2.1.172 or later `CLAUDE_CODE_CLIENT_CERT`| Path to client certificate file for mTLS authentication `CLAUDE_CODE_CLIENT_KEY`| Path to client private key file for mTLS authentication `CLAUDE_CODE_CLIENT_KEY_PASSPHRASE`| Passphrase for encrypted CLAUDE_CODE_CLIENT_KEY (optional) @@ -194,7 +195,7 @@ `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS`| Set to `1` to enable [agent teams](</docs/en/agent-teams>). Agent teams are experimental and disabled by default `CLAUDE_CODE_EXTRA_BODY`| JSON object to merge into the top level of every API request body. Useful for passing provider-specific parameters that Claude Code does not expose directly `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 -`CLAUDE_CODE_FORCE_SESSION_PERSISTENCE`| Removed in v2.1.170. This variable forced transcript persistence when an inherited `CLAUDECODE` value caused a top-level session to be misclassified as nested. The nested-session detection it overrode was removed in v2.1.170, so the variable no longer applies +`CLAUDE_CODE_FORCE_SESSION_PERSISTENCE`| Set to `1` to force transcript persistence, prompt history, and `claude agents` registration even when this `claude` was launched from inside another Claude Code session. Use when an inherited `CLAUDE_CODE_CHILD_SESSION` value, for example from a tmux server first started by Claude Code’s Bash tool, causes a genuine top-level session to be misclassified as nested. Also honored on v2.1.169 and earlier; has no effect on v2.1.170 and v2.1.171, where the nested-session detection it overrides was removed `CLAUDE_CODE_FORCE_SYNC_OUTPUT`| Set to `1` to force-enable DEC private mode 2026 [synchronized output](<https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036>) when your terminal supports it but is not auto-detected. Useful for emulators such as Emacs `eat` that implement BSU/ESU but do not reply to the capability probe. Has no effect under tmux `CLAUDE_CODE_FORK_SUBAGENT`| Set to `1` to make [forked subagents](</docs/en/sub-agents#fork-the-current-conversation>) the model’s default, or `0` to disable them, overriding any server-side rollout. When enabled, Claude spawns a fork, a subagent that inherits the full conversation context instead of starting fresh, whenever it would otherwise use the general-purpose subagent, and all subagent spawns run in the background. The explicit [`/fork`](</docs/en/commands>) command works without this variable. Works in interactive mode and via the SDK or `claude -p` `CLAUDE_CODE_GIT_BASH_PATH`| Windows only: path to the Git Bash executable (`bash.exe`). Use when Git Bash is installed but not in your PATH. See [Windows setup](</docs/en/setup#set-up-on-windows>) @@ -238,7 +239,7 @@ `CLAUDE_CODE_RESUME_PROMPT`| Override the continuation message injected when resuming a session that ended mid-turn. Defaults to `Continue from where you left off.`. Spawn scripts for long-running agents can set this to a more directive boot message. An empty string uses the default `CLAUDE_CODE_SAFE_MODE`| Set to `1` to start in safe mode: CLAUDE.md, skills, plugins, hooks, MCP servers, custom commands and agents, output styles, workflows, custom themes, custom keybindings, status line and file-suggestion commands, LSP servers, and auto-memory do not load, for troubleshooting a broken configuration. Managed settings policy still applies, including policy-configured hooks, status line, and file-suggestion commands; managed plugins, managed skills, managed CLAUDE.md, and policy-configured MCP servers do not. Equivalent to passing [`--safe-mode`](</docs/en/cli-reference#cli-flags>). Directly spawned child processes inherit the variable `CLAUDE_CODE_SCRIPT_CAPS`| JSON object limiting how many times specific scripts may be invoked per session when `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB` is set. Keys are substrings matched against the command text; values are integer call limits. For example, `{"deploy.sh": 2}` allows `deploy.sh` to be called at most twice. Matching is substring-based so shell-expansion tricks like `./scripts/deploy.sh $(evil)` still count against the cap. Runtime fan-out via `xargs` or `find -exec` is not detected; this is a defense-in-depth control -`CLAUDE_CODE_SCROLL_SPEED`| Set the mouse wheel scroll multiplier in [fullscreen rendering](</docs/en/fullscreen#mouse-wheel-scrolling>). Accepts values from 1 to 20. Set to `3` to match `vim` if your terminal sends one wheel event per notch without amplification. Ignored in the JetBrains IDE terminal, where Claude Code uses its own scroll handling +`CLAUDE_CODE_SCROLL_SPEED`| Set the mouse wheel scroll multiplier in [fullscreen rendering](</docs/en/fullscreen#mouse-wheel-scrolling>). Accepts values from 1 to 20, and fractional values below 1 such as `0.5` to slow accelerated trackpad and wheel scrolling in terminals on the native scroll path. Set to `3` to match `vim` if your terminal sends one wheel event per notch without amplification. Ignored in the JetBrains IDE terminal, where Claude Code uses its own scroll handling `CLAUDE_CODE_SESSIONEND_HOOKS_TIMEOUT_MS`| Override the time budget in milliseconds for [SessionEnd](</docs/en/hooks#sessionend>) hooks. Applies to session exit, `/clear`, and switching sessions via interactive `/resume`. By default the budget is 1.5 seconds, automatically raised to the highest per-hook `timeout` configured in settings files, up to 60 seconds. Timeouts on plugin-provided hooks do not raise the budget `CLAUDE_CODE_SESSION_ID`| Set automatically to the current session ID in Bash and PowerShell tool subprocesses, [hook command](</docs/en/hooks>) subprocesses, and stdio [MCP server](</docs/en/mcp>) subprocesses. For Bash, PowerShell, and hooks this matches the `session_id` field in the hook JSON input and is updated on `/clear`. An MCP server subprocess retains the ID it was spawned with. On `--resume <session-id>` it receives the resumed ID, matching hooks and Bash. On `--continue` or `--resume` without an explicit ID it may receive the initial startup ID instead. Use to correlate scripts and external tools with the Claude Code session that launched them `CLAUDE_CODE_SHELL`| Override automatic shell detection. Useful when your login shell differs from your preferred working shell (for example, `bash` vs `zsh`)
modified
Show diff (146 lines)
--- a/env-vars.md +++ b/env-vars.md @@ -64,7 +64,7 @@ ---|--- `~/.claude/settings.json`| You, in every project `.claude/settings.json`| Everyone working in the project, checked into source control -`.claude/settings.local.json`| You, in this project only, not checked in +`.claude/settings.local.json`| You, in this project only (add it to your gitignore if you create it by hand) Managed settings| Everyone in your organization, deployed by an admin See [Settings files](</docs/en/settings#settings-files>) for where each file lives and [Settings precedence](</docs/en/settings#settings-precedence>) for how they combine when more than one sets the same variable. @@ -100,6 +100,10 @@ `ANTHROPIC_CUSTOM_MODEL_OPTION_DESCRIPTION`| Display description for the custom model entry in the `/model` picker. Defaults to `Custom model (<model-id>)` when not set `ANTHROPIC_CUSTOM_MODEL_OPTION_NAME`| Display name for the custom model entry in the `/model` picker. Defaults to the model ID when not set `ANTHROPIC_CUSTOM_MODEL_OPTION_SUPPORTED_CAPABILITIES`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) +`ANTHROPIC_DEFAULT_FABLE_MODEL`| See [Model configuration](</docs/en/model-config#environment-variables>) +`ANTHROPIC_DEFAULT_FABLE_MODEL_DESCRIPTION`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) +`ANTHROPIC_DEFAULT_FABLE_MODEL_NAME`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) +`ANTHROPIC_DEFAULT_FABLE_MODEL_SUPPORTED_CAPABILITIES`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) `ANTHROPIC_DEFAULT_HAIKU_MODEL`| See [Model configuration](</docs/en/model-config#environment-variables>) `ANTHROPIC_DEFAULT_HAIKU_MODEL_DESCRIPTION`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) `ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) @@ -121,6 +125,7 @@ `ANTHROPIC_VERTEX_BASE_URL`| Override the Vertex AI endpoint URL. Use for custom Vertex endpoints or when routing through an [LLM gateway](</docs/en/llm-gateway>). See [Google Vertex AI](</docs/en/google-vertex-ai>) `ANTHROPIC_VERTEX_PROJECT_ID`| GCP project ID for Vertex AI requests. Overridden by `GCLOUD_PROJECT`, `GOOGLE_CLOUD_PROJECT`, or the project in your `GOOGLE_APPLICATION_CREDENTIALS` credential file. See [Google Vertex AI](</docs/en/google-vertex-ai>) `ANTHROPIC_WORKSPACE_ID`| Workspace ID for [workload identity federation](<https://platform.claude.com/docs/en/manage-claude/workload-identity-federation>). Set this when your federation rule is scoped to more than one workspace so the token exchange knows which workspace to target +`API_FORCE_IDLE_TIMEOUT`| Override the 5-minute idle timeout that aborts a streaming model response when no bytes arrive. Set to `0` to disable the timeout, for example when a slow [gateway](</docs/en/llm-gateway>) or local model pauses longer than 5 minutes between chunks. Set to `1` to keep the timeout on every provider. When unset, the timeout is inactive on direct Anthropic API and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) connections, where Claude Code’s own byte-level stream watchdog runs, and active on every other provider, including [Vertex AI](</docs/en/google-vertex-ai>), [Foundry](</docs/en/microsoft-foundry>), [Mantle](</docs/en/amazon-bedrock#use-the-mantle-endpoint>), [Bedrock](</docs/en/amazon-bedrock>), and gateway connections, so a stalled stream aborts instead of hanging. As of v2.1.169 `API_TIMEOUT_MS`| Timeout for API requests in milliseconds (default: 600000, or 10 minutes; maximum: 2147483647). Increase this when requests time out on slow networks or when routing through a proxy. Values above the maximum overflow the underlying timer and cause requests to fail immediately `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/>)) `BASH_DEFAULT_TIMEOUT_MS`| Default timeout for long-running bash commands (default: 120000, or 2 minutes) @@ -137,6 +142,7 @@ `CLAUDE_CODE_ACCESSIBILITY`| Set to `1` to keep the native terminal cursor visible and disable the inverted-text cursor indicator. Allows screen magnifiers like macOS Zoom to track cursor position `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD`| Set to `1` to load memory files from directories specified with `--add-dir`. Loads `CLAUDE.md`, `.claude/CLAUDE.md`, `.claude/rules/*.md`, and `CLAUDE.local.md`. By default, additional directories do not load memory files `CLAUDE_CODE_ALT_SCREEN_FULL_REPAINT`| Set to `1` to repaint the entire screen on every frame in [fullscreen rendering](</docs/en/fullscreen>) instead of sending incremental updates. Use this if fullscreen mode shows stale or misplaced text fragments. Claude Code enables this automatically for background sessions and [agent view](</docs/en/agent-view>) on Windows +`CLAUDE_CODE_ALWAYS_ENABLE_EFFORT`| Set to `1` to send the [effort](</docs/en/model-config#adjust-effort-level>) parameter with every request, even when Claude Code does not recognize the model ID as effort-capable. Use this when routing through an [LLM gateway](</docs/en/llm-gateway>) or third-party provider that serves models under custom identifiers. Models that reject the effort parameter at the API, including Claude 3 models, Sonnet 4.0 and 4.5, Opus 4.0 and 4.1, and Haiku 4.5, are still excluded so requests do not fail `CLAUDE_CODE_API_KEY_HELPER_TTL_MS`| Interval in milliseconds at which credentials should be refreshed (when using [`apiKeyHelper`](</docs/en/settings#available-settings>)) `CLAUDE_CODE_ATTRIBUTION_HEADER`| Set to `0` to omit the attribution block (client version and prompt fingerprint) from the start of the system prompt. Disabling it improves prompt-cache hit rates when routing through an [LLM gateway](</docs/en/llm-gateway>). Anthropic API caching is unaffected `CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the context capacity in tokens used for auto-compaction calculations. Defaults to the model’s context window: 200K for standard models or 1M for [extended context](</docs/en/model-config#extended-context>) models. Use a lower value like `500000` on a 1M model to treat the window as 500K for compaction purposes. The value is capped at the model’s actual context window. `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` is applied as a percentage of this value. Setting this variable decouples the compaction threshold from the status line’s `used_percentage`, which always uses the model’s full context window @@ -148,12 +154,14 @@ `CLAUDE_CODE_DEBUG_LOGS_DIR`| Override the debug log file path. Despite the name, this is a file path, not a directory. Requires debug mode to be enabled separately via `--debug`, `/debug`, or the `DEBUG` environment variable: setting this variable alone does not enable logging. The [`--debug-file`](</docs/en/cli-reference#cli-flags>) flag does both at once. Defaults to `~/.claude/debug/<session-id>.txt` `CLAUDE_CODE_DEBUG_LOG_LEVEL`| Minimum log level written to the debug log file. Values: `verbose`, `debug` (default), `info`, `warn`, `error`. Set to `verbose` to include high-volume diagnostics like full status line command output, or raise to `error` to reduce noise `CLAUDE_CODE_DISABLE_1M_CONTEXT`| Set to `1` to disable [1M context window](</docs/en/model-config#extended-context>) support. When set, 1M model variants are unavailable in the model picker. Useful for enterprise environments with compliance requirements -`CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING`| Set to `1` to disable [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) on Opus 4.6 and Sonnet 4.6 and fall back to the fixed thinking budget controlled by `MAX_THINKING_TOKENS`. From v2.1.111, has no effect on Opus 4.7 and later, which always use adaptive reasoning +`CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING`| Set to `1` to disable [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) on Opus 4.6 and Sonnet 4.6 and fall back to the fixed thinking budget controlled by `MAX_THINKING_TOKENS`. From v2.1.111, has no effect on Fable 5, or on Opus 4.7 and later, which always use adaptive reasoning +`CLAUDE_CODE_DISABLE_ADVISOR_TOOL`| Set to `1` to disable the [advisor tool](</docs/en/advisor>). The `/advisor` command and `--advisor` flag become unavailable and any configured `advisorModel` is ignored. Requires Claude Code v2.1.98 or later `CLAUDE_CODE_DISABLE_AGENT_VIEW`| Set to `1` to turn off [background agents and agent view](</docs/en/agent-view>): `claude agents`, `--bg`, `/background`, and the on-demand supervisor. Equivalent to the [`disableAgentView`](</docs/en/settings#available-settings>) setting `CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN`| Set to `1` to disable [fullscreen rendering](</docs/en/fullscreen>) and use the classic main-screen renderer. The conversation stays in your terminal’s native scrollback so `Cmd+f` and tmux copy mode work as usual. Takes precedence over `CLAUDE_CODE_NO_FLICKER` and the [`tui`](</docs/en/settings#available-settings>) setting. You can also switch with `/tui default`. Does not apply to background sessions opened from [agent view](</docs/en/agent-view>), which always use fullscreen rendering `CLAUDE_CODE_DISABLE_ATTACHMENTS`| Set to `1` to disable attachment processing. File mentions with `@` syntax are sent as plain text instead of being expanded into file content `CLAUDE_CODE_DISABLE_AUTO_MEMORY`| Set to `1` to disable [auto memory](</docs/en/memory#auto-memory>). Set to `0` to force auto memory on even when `--bare` mode or [`autoMemoryEnabled: false`](</docs/en/settings#available-settings>) would otherwise disable it. When disabled, Claude does not create or load auto memory files `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 +`CLAUDE_CODE_DISABLE_BUNDLED_SKILLS`| Set to `1` to disable the [skills](</docs/en/skills>) and workflows that ship with Claude Code: bundled skills and workflows are removed entirely, while built-in slash commands like `/init` stay typable but are hidden from the model. Skills from plugins, `.claude/skills/`, and `.claude/commands/` are unaffected. Equivalent to the [`disableBundledSkills`](</docs/en/settings#available-settings>) setting; `0` does not override it `CLAUDE_CODE_DISABLE_CLAUDE_MDS`| Set to `1` to prevent loading any CLAUDE.md memory files into context, including user, project, and auto-memory files `CLAUDE_CODE_DISABLE_CRON`| Set to `1` to disable [scheduled tasks](</docs/en/scheduled-tasks>). The `/loop` skill and cron tools become unavailable and any already-scheduled tasks stop firing, including tasks that are already running mid-session `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`| Set to `1` to strip Anthropic-specific `anthropic-beta` request headers and beta tool-schema fields (such as `defer_loading` and `eager_input_streaming`) from API requests. Use this when a proxy gateway rejects requests with errors like “Unexpected value(s) for the `anthropic-beta` header” or “Extra inputs are not permitted”. Standard fields (`name`, `description`, `input_schema`, `cache_control`) are preserved. @@ -168,7 +176,7 @@ `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL`| Set to `1` to skip automatic addition of the official plugin marketplace on first run `CLAUDE_CODE_DISABLE_POLICY_SKILLS`| Set to `1` to skip loading skills from the system-wide managed skills directory. Useful for container or CI sessions that should not load operator-provisioned skills `CLAUDE_CODE_DISABLE_TERMINAL_TITLE`| Set to `1` to disable automatic terminal title updates based on conversation context. In Agent SDK and `claude -p` sessions, this also skips the background Haiku request that generates the session title -`CLAUDE_CODE_DISABLE_THINKING`| Set to `1` to force-disable [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) regardless of model support or other settings. More direct than `MAX_THINKING_TOKENS=0` +`CLAUDE_CODE_DISABLE_THINKING`| Set to `1` to omit the `thinking` parameter from API requests entirely. This is a compatibility option for proxies and gateways that reject the parameter. The variable’s behavior is unchanged from earlier versions; on models that think by default, omitting the parameter means the model may still think. To explicitly disable [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) on the Anthropic API, use `MAX_THINKING_TOKENS=0` instead, which is also ineffective on Fable 5 since it cannot have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `0` likewise omits the parameter, so the two variables behave the same there `CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL`| Set to `1` to disable virtual scrolling in [fullscreen rendering](</docs/en/fullscreen>) and render every message in the transcript. Use this if scrolling in fullscreen mode shows blank regions where messages should appear `CLAUDE_CODE_DISABLE_WORKFLOWS`| Set to `1` to disable [workflows](</docs/en/workflows#turn-workflows-off>). Equivalent to the [`disableWorkflows`](</docs/en/settings#available-settings>) setting `CLAUDE_CODE_EFFORT_LEVEL`| Set the effort level for supported models. Values: `low`, `medium`, `high`, `xhigh`, `max`, or `auto` to use the model default. Available levels depend on the model. Takes precedence over `/effort` and the `effortLevel` setting. See [Adjust effort level](</docs/en/model-config#adjust-effort-level>) @@ -186,6 +194,7 @@ `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS`| Set to `1` to enable [agent teams](</docs/en/agent-teams>). Agent teams are experimental and disabled by default `CLAUDE_CODE_EXTRA_BODY`| JSON object to merge into the top level of every API request body. Useful for passing provider-specific parameters that Claude Code does not expose directly `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 +`CLAUDE_CODE_FORCE_SESSION_PERSISTENCE`| Removed in v2.1.170. This variable forced transcript persistence when an inherited `CLAUDECODE` value caused a top-level session to be misclassified as nested. The nested-session detection it overrode was removed in v2.1.170, so the variable no longer applies `CLAUDE_CODE_FORCE_SYNC_OUTPUT`| Set to `1` to force-enable DEC private mode 2026 [synchronized output](<https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036>) when your terminal supports it but is not auto-detected. Useful for emulators such as Emacs `eat` that implement BSU/ESU but do not reply to the capability probe. Has no effect under tmux `CLAUDE_CODE_FORK_SUBAGENT`| Set to `1` to make [forked subagents](</docs/en/sub-agents#fork-the-current-conversation>) the model’s default, or `0` to disable them, overriding any server-side rollout. When enabled, Claude spawns a fork, a subagent that inherits the full conversation context instead of starting fresh, whenever it would otherwise use the general-purpose subagent, and all subagent spawns run in the background. The explicit [`/fork`](</docs/en/commands>) command works without this variable. Works in interactive mode and via the SDK or `claude -p` `CLAUDE_CODE_GIT_BASH_PATH`| Windows only: path to the Git Bash executable (`bash.exe`). Use when Git Bash is installed but not in your PATH. See [Windows setup](</docs/en/setup#set-up-on-windows>) @@ -227,12 +236,13 @@ `CLAUDE_CODE_REMOTE_SESSION_ID`| Set automatically in [cloud sessions](</docs/en/claude-code-on-the-web>) to the current session’s ID. Read this to construct a link back to the session transcript. See [Link artifacts back to the session](</docs/en/claude-code-on-the-web#link-artifacts-back-to-the-session>) `CLAUDE_CODE_RESUME_INTERRUPTED_TURN`| Set to `1` to automatically resume if the previous session ended mid-turn. Used in SDK mode so the model continues without requiring the SDK to re-send the prompt `CLAUDE_CODE_RESUME_PROMPT`| Override the continuation message injected when resuming a session that ended mid-turn. Defaults to `Continue from where you left off.`. Spawn scripts for long-running agents can set this to a more directive boot message. An empty string uses the default +`CLAUDE_CODE_SAFE_MODE`| Set to `1` to start in safe mode: CLAUDE.md, skills, plugins, hooks, MCP servers, custom commands and agents, output styles, workflows, custom themes, custom keybindings, status line and file-suggestion commands, LSP servers, and auto-memory do not load, for troubleshooting a broken configuration. Managed settings policy still applies, including policy-configured hooks, status line, and file-suggestion commands; managed plugins, managed skills, managed CLAUDE.md, and policy-configured MCP servers do not. Equivalent to passing [`--safe-mode`](</docs/en/cli-reference#cli-flags>). Directly spawned child processes inherit the variable `CLAUDE_CODE_SCRIPT_CAPS`| JSON object limiting how many times specific scripts may be invoked per session when `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB` is set. Keys are substrings matched against the command text; values are integer call limits. For example, `{"deploy.sh": 2}` allows `deploy.sh` to be called at most twice. Matching is substring-based so shell-expansion tricks like `./scripts/deploy.sh $(evil)` still count against the cap. Runtime fan-out via `xargs` or `find -exec` is not detected; this is a defense-in-depth control `CLAUDE_CODE_SCROLL_SPEED`| Set the mouse wheel scroll multiplier in [fullscreen rendering](</docs/en/fullscreen#mouse-wheel-scrolling>). Accepts values from 1 to 20. Set to `3` to match `vim` if your terminal sends one wheel event per notch without amplification. Ignored in the JetBrains IDE terminal, where Claude Code uses its own scroll handling `CLAUDE_CODE_SESSIONEND_HOOKS_TIMEOUT_MS`| Override the time budget in milliseconds for [SessionEnd](</docs/en/hooks#sessionend>) hooks. Applies to session exit, `/clear`, and switching sessions via interactive `/resume`. By default the budget is 1.5 seconds, automatically raised to the highest per-hook `timeout` configured in settings files, up to 60 seconds. Timeouts on plugin-provided hooks do not raise the budget `CLAUDE_CODE_SESSION_ID`| Set automatically to the current session ID in Bash and PowerShell tool subprocesses, [hook command](</docs/en/hooks>) subprocesses, and stdio [MCP server](</docs/en/mcp>) subprocesses. For Bash, PowerShell, and hooks this matches the `session_id` field in the hook JSON input and is updated on `/clear`. An MCP server subprocess retains the ID it was spawned with. On `--resume <session-id>` it receives the resumed ID, matching hooks and Bash. On `--continue` or `--resume` without an explicit ID it may receive the initial startup ID instead. Use to correlate scripts and external tools with the Claude Code session that launched them `CLAUDE_CODE_SHELL`| Override automatic shell detection. Useful when your login shell differs from your preferred working shell (for example, `bash` vs `zsh`) -`CLAUDE_CODE_SHELL_PREFIX`| Command prefix that wraps shell commands Claude Code spawns: Bash tool calls, [hook](</docs/en/hooks>) commands, and stdio [MCP server](</docs/en/mcp>) startup commands. Useful for logging or auditing. Example: setting `/path/to/logger.sh` runs each command as `/path/to/logger.sh <command>` +`CLAUDE_CODE_SHELL_PREFIX`| Command prefix that wraps shell commands Claude Code spawns: Bash tool calls, [hook](</docs/en/hooks>) commands, [status line](</docs/en/statusline>) commands, and stdio [MCP server](</docs/en/mcp>) startup commands. PowerShell hooks and exec-form hooks run without the prefix. Useful for logging or auditing. Setting a bare executable path such as `/path/to/logger.sh` runs each command as `/path/to/logger.sh '<command>'`. The wrapper receives the command line as a single shell-quoted argument in `$1`, so the wrapper must re-evaluate `$1` with a shell, for example `exec bash -c "$1"`. Treating `$1` as a bare executable path breaks stdio MCP servers that pass arguments such as `npx -y <package>`. For Bash tool calls, `$1` contains the full shell invocation Claude Code assembles, including environment setup, not only the command Claude ran `CLAUDE_CODE_SIMPLE`| Set to `1` to run with a minimal system prompt and only the Bash, file read, and file edit tools. MCP tools from `--mcp-config` are still available. Disables auto-discovery of hooks, skills, plugins, MCP servers, auto memory, and CLAUDE.md. OAuth tokens and keychain credentials are not read, so Anthropic authentication must come from `ANTHROPIC_API_KEY` or an `apiKeyHelper` in `--settings`. Equivalent to passing [`--bare`](</docs/en/headless#start-faster-with-bare-mode>) `CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT`| Set to `1` to use a shorter system prompt and abbreviated tool descriptions on any model. Set to `0`, `false`, `no`, or `off` to opt out even on models where the experiment or server configuration would otherwise enable it. The full tool set, hooks, MCP servers, and CLAUDE.md discovery remain enabled `CLAUDE_CODE_SKIP_ANTHROPIC_AWS_AUTH`| Skip client-side authentication for [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), for gateways that sign requests themselves @@ -246,7 +256,7 @@ `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB`| Set to `1` to strip Anthropic and cloud provider credentials from subprocess environments (Bash tool, hooks, MCP stdio servers). The parent Claude process keeps these credentials for API calls, but child processes cannot read them, reducing exposure to prompt injection attacks that attempt to exfiltrate secrets via shell expansion. On Linux, this also runs Bash subprocesses in an isolated PID namespace so they cannot read host process environments via `/proc`; as a side effect, `ps`, `pgrep`, and `kill` cannot see or signal host processes. `claude-code-action` sets this automatically when `allowed_non_write_users` is configured `CLAUDE_CODE_SYNC_PLUGIN_INSTALL`| Set to `1` in non-interactive mode (the `-p` flag) to wait for plugin installation to complete before the first query. Without this, plugins install in the background and may not be available on the first turn. Combine with `CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS` to bound the wait `CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS`| Timeout in milliseconds for synchronous plugin installation. When exceeded, Claude Code proceeds without plugins and logs an error. No default: without this variable, synchronous installation waits until complete -`CLAUDE_CODE_SYNC_SKILLS`| Set to `1` to download your enabled claude.ai skills into `~/.claude/skills/` before the first query and resync every 10 minutes. Applies only in non-interactive mode with the `-p` flag. Set automatically in [Claude Code on the web](</docs/en/claude-code-on-the-web>) sessions. Requires claude.ai authentication +`CLAUDE_CODE_SYNC_SKILLS`| Set to `1` to download your enabled claude.ai skills into `~/.claude/skills/` before the first query and resync every 10 minutes. Applies only in non-interactive mode with the `-p` flag. Requires claude.ai authentication. [Claude Code on the web](</docs/en/claude-code-on-the-web>) sessions receive your enabled claude.ai skills automatically; you don’t need to set this there `CLAUDE_CODE_SYNC_SKILLS_INSTALL_TIMEOUT_MS`| Timeout in milliseconds for a mid-session skills resync when `CLAUDE_CODE_SYNC_SKILLS` is set (default: 30000). Bounds the download triggered when the host requests a skill reload during the session. When exceeded, the resync stops and remaining downloads continue in the background `CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS`| Timeout in milliseconds for the first query to wait on the initial skills sync when `CLAUDE_CODE_SYNC_SKILLS` is set (default: 5000). When exceeded, the query proceeds and remaining skill downloads continue in the background `CLAUDE_CODE_SYNTAX_HIGHLIGHT`| Set to `false` to disable syntax highlighting in diff output. Useful when colors interfere with your terminal setup. To also disable highlighting in code blocks and file previews, use the [`syntaxHighlightingDisabled`](</docs/en/settings>) setting @@ -263,12 +273,12 @@ `CLAUDE_CODE_USE_VERTEX`| Use [Vertex](</docs/en/google-vertex-ai>) `CLAUDE_CONFIG_DIR`| Override the configuration directory (default: `~/.claude`). All settings, credentials, session history, and plugins are stored under this path. Useful for running multiple accounts side by side: for example, `alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'` `CLAUDE_EFFORT`| Set automatically in Bash tool subprocesses and hook commands to the active [effort level](</docs/en/model-config#adjust-effort-level>) for the turn: `low`, `medium`, `high`, `xhigh`, or `max`. Ultracode is not a distinct level and reports as `xhigh`. Matches the `effort.level` field passed to [hooks](</docs/en/hooks>). Only set when the current model supports the effort parameter -`CLAUDE_ENABLE_BYTE_WATCHDOG`| Set to `1` to force-enable the byte-level streaming idle watchdog, or set to `0` to force-disable it. When unset, the watchdog is enabled by default for Anthropic API connections. The byte watchdog aborts a connection when no bytes arrive on the wire for the duration set by `CLAUDE_STREAM_IDLE_TIMEOUT_MS`, with a minimum of 5 minutes, independent of the event-level watchdog +`CLAUDE_ENABLE_BYTE_WATCHDOG`| Set to `1` to force-enable the byte-level streaming idle watchdog, or set to `0` to force-disable it. When unset, the watchdog is enabled by default for direct Anthropic API and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) connections. The byte watchdog aborts a connection when no bytes arrive on the wire for 180 seconds by default on direct Anthropic API connections, 300 seconds on Claude Platform on AWS and when enabled on Bedrock, or for the value of `CLAUDE_STREAM_IDLE_TIMEOUT_MS` when that is set, which is clamped to a minimum of 5 minutes, independent of the event-level watchdog `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK`| Set to `1` to enable the byte-level streaming idle watchdog on Amazon Bedrock `vnd.amazon.eventstream` responses. Off by default. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS` -`CLAUDE_ENABLE_STREAM_WATCHDOG`| Set to `1` to enable the event-level streaming idle watchdog. Off by default. Applies to all providers, including Bedrock. For Vertex and Foundry, this is the only idle watchdog available. On Bedrock, you can also enable the independent byte-level watchdog with `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK`; the two run together when both are set. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS` +`CLAUDE_ENABLE_STREAM_WATCHDOG`| Set to `1` to force-enable the event-level streaming idle watchdog, or set to `0` to force-disable it. When unset, the default is server-controlled on the direct Anthropic API and off on other providers. As of v2.1.169, providers other than the direct Anthropic API and Claude Platform on AWS also have a default-on 5-minute body idle timeout independent of this variable; see `API_FORCE_IDLE_TIMEOUT`. On Bedrock, you can also enable the independent byte-level watchdog with `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK`; the two run together when both are set. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS` `CLAUDE_ENV_FILE`| Path to a shell script whose contents Claude Code runs before each Bash command in the same shell process, so exports in the file are visible to the command. Use to persist virtualenv or conda activation across commands. Also populated dynamically by [SessionStart](</docs/en/hooks#persist-environment-variables>), [Setup](</docs/en/hooks#setup>), [CwdChanged](</docs/en/hooks#cwdchanged>), and [FileChanged](</docs/en/hooks#filechanged>) hooks `CLAUDE_REMOTE_CONTROL_SESSION_NAME_PREFIX`| Prefix for auto-generated [Remote Control](</docs/en/remote-control>) session names when no explicit name is provided. Defaults to your machine’s hostname, producing names like `myhost-graceful-unicorn`. The `--remote-control-session-name-prefix` CLI flag sets the same value for a single invocation -`CLAUDE_STREAM_IDLE_TIMEOUT_MS`| Timeout in milliseconds before the streaming idle watchdog closes a stalled connection. Default and minimum `300000` (5 minutes) for both the byte-level and event-level watchdogs; lower values are silently clamped to absorb extended thinking pauses and proxy buffering. For third-party providers, requires `CLAUDE_ENABLE_STREAM_WATCHDOG=1`. On Bedrock, also applies when `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK=1` +`CLAUDE_STREAM_IDLE_TIMEOUT_MS`| Timeout in milliseconds before the streaming idle watchdog closes a stalled connection. When you set this variable explicitly, the minimum is `300000` (5 minutes); lower values are silently clamped to absorb extended thinking pauses and proxy buffering. When unset, the event-level watchdog defaults to 300 seconds and the byte-level watchdog defaults to 180 seconds on direct Anthropic API connections (300 seconds on Claude Platform on AWS and other providers). The unset 180-second byte-watchdog default is a separate value and is not subject to the 5-minute clamp. For the event-level watchdog on third-party providers, requires `CLAUDE_ENABLE_STREAM_WATCHDOG=1`; the body idle timeout described under `API_FORCE_IDLE_TIMEOUT` applies independently. On Bedrock, also applies when `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK=1` `DEBUG`| Set to `1` to enable debug mode, equivalent to launching with [`--debug`](</docs/en/cli-reference#cli-flags>). Debug logs are written to `~/.claude/debug/<session-id>.txt`, or to the path set by `CLAUDE_CODE_DEBUG_LOGS_DIR`. Only the truthy values `1`, `true`, `yes`, and `on` enable debug mode, so namespace patterns like `DEBUG=express:*` set for other tools do not trigger it `DISABLE_AUTOUPDATER`| Set to `1` to disable automatic background updates. Manual `claude update` still works. Use `DISABLE_UPDATES` to block both `DISABLE_AUTO_COMPACT`| Set to `1` to disable automatic compaction when approaching the context limit. The manual `/compact` command remains available. Use when you want explicit control over when compaction occurs @@ -285,6 +295,7 @@ `DISABLE_LOGIN_COMMAND`| Set to `1` to hide the `/login` command. Useful when authentication is handled externally via API keys or `apiKeyHelper` `DISABLE_LOGOUT_COMMAND`| Set to `1` to hide the `/logout` command `DISABLE_PROMPT_CACHING`| Set to `1` to disable [prompt caching](</docs/en/prompt-caching#disable-prompt-caching>) for all models (takes precedence over per-model settings) +`DISABLE_PROMPT_CACHING_FABLE`| Set to `1` to disable prompt caching for Fable models `DISABLE_PROMPT_CACHING_HAIKU`| Set to `1` to disable prompt caching for Haiku models `DISABLE_PROMPT_CACHING_OPUS`| Set to `1` to disable prompt caching for Opus models `DISABLE_PROMPT_CACHING_SONNET`| Set to `1` to disable prompt caching for Sonnet models @@ -296,7 +307,7 @@ `ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) instead of the default 5 minutes. Intended for API key, [Bedrock](</docs/en/amazon-bedrock>), [Vertex](</docs/en/google-vertex-ai>), [Foundry](</docs/en/microsoft-foundry>), and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) users. Subscription users within included usage receive 1-hour TTL automatically. 1-hour cache writes are billed at a higher rate `ENABLE_PROMPT_CACHING_1H_BEDROCK`| Deprecated. Use `ENABLE_PROMPT_CACHING_1H` instead `ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset: all MCP tools deferred by default, but loaded upfront on Vertex AI or when `ANTHROPIC_BASE_URL` points to a non-first-party host. Values: `true` (always defer and send the beta header, requests fail on Vertex AI models earlier than Sonnet 4.5 or Opus 4.5, or on proxies that do not support `tool_reference`), `auto` (threshold mode: load upfront if tools fit within 10% of context), `auto:N` (custom threshold, e.g., `auto:5` for 5%), `false` (load all upfront) -`FALLBACK_FOR_ALL_PRIMARY_MODELS`| Set to any non-empty value to trigger fallback to [`--fallback-model`](</docs/en/cli-reference#cli-flags>) after repeated overload errors on any primary model. By default, only Opus models trigger the fallback +`FALLBACK_FOR_ALL_PRIMARY_MODELS`| Set to any non-empty value to make all models, not only Opus, stop retrying with a repeated-overload error when no fallback model is configured. As of v2.1.160, a configured [fallback model chain](</docs/en/model-config#fallback-model-chains>) triggers on repeated overload errors for any primary model, so this variable does not affect switching to a fallback model `FORCE_AUTOUPDATE_PLUGINS`| Set to `1` to force plugin auto-updates even when the main auto-updater is disabled via `DISABLE_AUTOUPDATER` `FORCE_PROMPT_CACHING_5M`| Set to `1` to force the 5-minute prompt cache TTL even when 1-hour TTL would otherwise apply. Overrides `ENABLE_PROMPT_CACHING_1H` `HTTP_PROXY`| Specify HTTP proxy server for network connections @@ -304,7 +315,7 @@ `IS_DEMO`| Set to `1` to enable demo mode: hides your email and organization name from the header and `/status` output, and skips onboarding. Useful when streaming or recording a session `MAX_MCP_OUTPUT_TOKENS`| Maximum number of tokens allowed in MCP tool responses. Claude Code displays a warning when output exceeds 10,000 tokens. Tools that declare [`anthropic/maxResultSizeChars`](</docs/en/mcp#raise-the-limit-for-a-specific-tool>) use that character limit for text content instead, but image content from those tools is still subject to this variable (default: 25000) `MAX_STRUCTURED_OUTPUT_RETRIES`| Number of times to retry when the model’s response fails validation against the [`--json-schema`](</docs/en/cli-reference#cli-flags>) in non-interactive mode (the `-p` flag). Defaults to 5 -`MAX_THINKING_TOKENS`| Override the [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) token budget. The ceiling is the model’s [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>) minus one. Set to `0` to disable thinking entirely. On models with [adaptive reasoning](</docs/en/model-config#adjust-effort-level>), the budget is ignored unless adaptive reasoning is disabled via `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` +`MAX_THINKING_TOKENS`| Override the [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) token budget. The ceiling is the model’s [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>) minus one. Set to `0` to disable thinking on the Anthropic API except on Fable 5, which cannot have thinking turned off. On [third-party providers](</docs/en/third-party-integrations>), `0` omits the `thinking` parameter instead, and models with [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) may still think. For nonzero values on adaptive reasoning models, the budget is ignored unless adaptive reasoning is disabled via `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` `MCP_CLIENT_SECRET`| OAuth client secret for MCP servers that require [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>). Avoids the interactive prompt when adding a server with `--client-secret` `MCP_CONNECTION_NONBLOCKING`| Controls whether startup waits for MCP servers to connect before the first query. As of Claude Code v2.1.142, MCP startup is non-blocking by default: servers connect in the background and their tools become available as they finish. Set to `0` to restore the blocking 5-second connection wait. Servers configured with [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>) still block startup regardless, since their tools must be present when the first prompt is built `MCP_CONNECT_TIMEOUT_MS`| How long blocking MCP startup waits, in milliseconds, for the connection batch before snapshotting the tool list (default: 5000). Applies when `MCP_CONNECTION_NONBLOCKING=0` or for servers marked [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>). Servers still pending at the deadline keep connecting in the background but won’t appear until the next query. Distinct from `MCP_TIMEOUT`, which bounds an individual server’s connect attempt @@ -337,6 +348,8 @@ `VERTEX_REGION_CLAUDE_4_6_OPUS`| Override region for Claude Opus 4.6 when using Vertex AI `VERTEX_REGION_CLAUDE_4_6_SONNET`| Override region for Claude Sonnet 4.6 when using Vertex AI `VERTEX_REGION_CLAUDE_4_7_OPUS`| Override region for Claude Opus 4.7 when using Vertex AI. Added in v2.1.111 +`VERTEX_REGION_CLAUDE_4_8_OPUS`| Override region for Claude Opus 4.8 when using Vertex AI. Added in v2.1.154 +`VERTEX_REGION_CLAUDE_FABLE_5`| Override region for Claude Fable 5 when using Vertex AI. Added in v2.1.170 `VERTEX_REGION_CLAUDE_HAIKU_4_5`| Override region for Claude Haiku 4.5 when using Vertex AI Standard OpenTelemetry exporter variables (`OTEL_METRICS_EXPORTER`, `OTEL_LOGS_EXPORTER`, `OTEL_EXPORTER_OTLP_ENDPOINT`, `OTEL_EXPORTER_OTLP_PROTOCOL`, `OTEL_EXPORTER_OTLP_HEADERS`, `OTEL_METRIC_EXPORT_INTERVAL`, `OTEL_RESOURCE_ATTRIBUTES`, and signal-specific variants) are also supported. See [Monitoring](</docs/en/monitoring-usage>) for configuration details.
modified
--- a/env-vars.md +++ b/env-vars.md @@ -187,7 +187,7 @@ `CLAUDE_CODE_EXTRA_BODY`| JSON object to merge into the top level of every API request body. Useful for passing provider-specific parameters that Claude Code does not expose directly `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 `CLAUDE_CODE_FORCE_SYNC_OUTPUT`| Set to `1` to force-enable DEC private mode 2026 [synchronized output](<https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036>) when your terminal supports it but is not auto-detected. Useful for emulators such as Emacs `eat` that implement BSU/ESU but do not reply to the capability probe. Has no effect under tmux -`CLAUDE_CODE_FORK_SUBAGENT`| Set to `1` to make [forked subagents](</docs/en/sub-agents#fork-the-current-conversation>) the model’s default: Claude spawns a fork, a subagent that inherits the full conversation context instead of starting fresh, whenever it would otherwise use the general-purpose subagent, and all subagent spawns run in the background. The explicit [`/fork`](</docs/en/commands>) command works without this variable. Works in interactive mode and via the SDK or `claude -p` +`CLAUDE_CODE_FORK_SUBAGENT`| Set to `1` to make [forked subagents](</docs/en/sub-agents#fork-the-current-conversation>) the model’s default, or `0` to disable them, overriding any server-side rollout. When enabled, Claude spawns a fork, a subagent that inherits the full conversation context instead of starting fresh, whenever it would otherwise use the general-purpose subagent, and all subagent spawns run in the background. The explicit [`/fork`](</docs/en/commands>) command works without this variable. Works in interactive mode and via the SDK or `claude -p` `CLAUDE_CODE_GIT_BASH_PATH`| Windows only: path to the Git Bash executable (`bash.exe`). Use when Git Bash is installed but not in your PATH. See [Windows setup](</docs/en/setup#set-up-on-windows>) `CLAUDE_CODE_GLOB_HIDDEN`| Set to `false` to exclude dotfiles from results when Claude invokes the [Glob tool](</docs/en/tools-reference#glob-tool-behavior>). Included by default. Does not affect `@` file autocomplete, `ls`, Grep, or Read `CLAUDE_CODE_GLOB_NO_IGNORE`| Set to `false` to make the [Glob tool](</docs/en/tools-reference#glob-tool-behavior>) respect `.gitignore` patterns. By default, Glob returns all matching files including gitignored ones. Does not affect `@` file autocomplete, which has its own [`respectGitignore` setting](</docs/en/settings#available-settings>) @@ -230,7 +230,7 @@ `CLAUDE_CODE_SCRIPT_CAPS`| JSON object limiting how many times specific scripts may be invoked per session when `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB` is set. Keys are substrings matched against the command text; values are integer call limits. For example, `{"deploy.sh": 2}` allows `deploy.sh` to be called at most twice. Matching is substring-based so shell-expansion tricks like `./scripts/deploy.sh $(evil)` still count against the cap. Runtime fan-out via `xargs` or `find -exec` is not detected; this is a defense-in-depth control `CLAUDE_CODE_SCROLL_SPEED`| Set the mouse wheel scroll multiplier in [fullscreen rendering](</docs/en/fullscreen#mouse-wheel-scrolling>). Accepts values from 1 to 20. Set to `3` to match `vim` if your terminal sends one wheel event per notch without amplification. Ignored in the JetBrains IDE terminal, where Claude Code uses its own scroll handling `CLAUDE_CODE_SESSIONEND_HOOKS_TIMEOUT_MS`| Override the time budget in milliseconds for [SessionEnd](</docs/en/hooks#sessionend>) hooks. Applies to session exit, `/clear`, and switching sessions via interactive `/resume`. By default the budget is 1.5 seconds, automatically raised to the highest per-hook `timeout` configured in settings files, up to 60 seconds. Timeouts on plugin-provided hooks do not raise the budget -`CLAUDE_CODE_SESSION_ID`| Set automatically to the current session ID in Bash and PowerShell tool subprocesses, [hook command](</docs/en/hooks>) subprocesses, and stdio [MCP server](</docs/en/mcp>) subprocesses. For Bash, PowerShell, and hooks this matches the `session_id` field in the hook JSON input and is updated on `/clear`. An MCP server subprocess retains the ID it was spawned with, and may receive the initial startup ID rather than the resumed ID when launched via `--resume` or `--continue`. Use to correlate scripts and external tools with the Claude Code session that launched them +`CLAUDE_CODE_SESSION_ID`| Set automatically to the current session ID in Bash and PowerShell tool subprocesses, [hook command](</docs/en/hooks>) subprocesses, and stdio [MCP server](</docs/en/mcp>) subprocesses. For Bash, PowerShell, and hooks this matches the `session_id` field in the hook JSON input and is updated on `/clear`. An MCP server subprocess retains the ID it was spawned with. On `--resume <session-id>` it receives the resumed ID, matching hooks and Bash. On `--continue` or `--resume` without an explicit ID it may receive the initial startup ID instead. Use to correlate scripts and external tools with the Claude Code session that launched them `CLAUDE_CODE_SHELL`| Override automatic shell detection. Useful when your login shell differs from your preferred working shell (for example, `bash` vs `zsh`) `CLAUDE_CODE_SHELL_PREFIX`| Command prefix that wraps shell commands Claude Code spawns: Bash tool calls, [hook](</docs/en/hooks>) commands, and stdio [MCP server](</docs/en/mcp>) startup commands. Useful for logging or auditing. Example: setting `/path/to/logger.sh` runs each command as `/path/to/logger.sh <command>` `CLAUDE_CODE_SIMPLE`| Set to `1` to run with a minimal system prompt and only the Bash, file read, and file edit tools. MCP tools from `--mcp-config` are still available. Disables auto-discovery of hooks, skills, plugins, MCP servers, auto memory, and CLAUDE.md. OAuth tokens and keychain credentials are not read, so Anthropic authentication must come from `ANTHROPIC_API_KEY` or an `apiKeyHelper` in `--settings`. Equivalent to passing [`--bare`](</docs/en/headless#start-faster-with-bare-mode>) @@ -247,11 +247,12 @@ `CLAUDE_CODE_SYNC_PLUGIN_INSTALL`| Set to `1` in non-interactive mode (the `-p` flag) to wait for plugin installation to complete before the first query. Without this, plugins install in the background and may not be available on the first turn. Combine with `CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS` to bound the wait `CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS`| Timeout in milliseconds for synchronous plugin installation. When exceeded, Claude Code proceeds without plugins and logs an error. No default: without this variable, synchronous installation waits until complete `CLAUDE_CODE_SYNC_SKILLS`| Set to `1` to download your enabled claude.ai skills into `~/.claude/skills/` before the first query and resync every 10 minutes. Applies only in non-interactive mode with the `-p` flag. Set automatically in [Claude Code on the web](</docs/en/claude-code-on-the-web>) sessions. Requires claude.ai authentication +`CLAUDE_CODE_SYNC_SKILLS_INSTALL_TIMEOUT_MS`| Timeout in milliseconds for a mid-session skills resync when `CLAUDE_CODE_SYNC_SKILLS` is set (default: 30000). Bounds the download triggered when the host requests a skill reload during the session. When exceeded, the resync stops and remaining downloads continue in the background `CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS`| Timeout in milliseconds for the first query to wait on the initial skills sync when `CLAUDE_CODE_SYNC_SKILLS` is set (default: 5000). When exceeded, the query proceeds and remaining skill downloads continue in the background `CLAUDE_CODE_SYNTAX_HIGHLIGHT`| Set to `false` to disable syntax highlighting in diff output. Useful when colors interfere with your terminal setup. To also disable highlighting in code blocks and file previews, use the [`syntaxHighlightingDisabled`](</docs/en/settings>) setting `CLAUDE_CODE_TASK_LIST_ID`| Share a task list across sessions. Set the same ID in multiple Claude Code instances to coordinate on a shared task list. See [Task list](</docs/en/interactive-mode#task-list>) `CLAUDE_CODE_TEAM_NAME`| Name of the agent team this teammate belongs to. Set automatically on [agent team](</docs/en/agent-teams>) members -`CLAUDE_CODE_TMPDIR`| Override the temp directory used for internal temp files. Claude Code appends `/claude-{uid}/` on Unix or `/claude/` on Windows to this path. Default: `/tmp` on macOS, `os.tmpdir()` on Linux and Windows. As of v2.1.161, on macOS and Linux, Bash subprocesses receive a short fallback `$TMPDIR` under the system default when your override is a long path, since some tools fail when temp paths get too long. Claude Code’s own temp files always use your override +`CLAUDE_CODE_TMPDIR`| Override the temp directory used for internal temp files. Claude Code appends `/claude-{uid}/` on Unix or `/claude/` on Windows to this path. Default: `/tmp` on macOS, `os.tmpdir()` on Linux and Windows. As of v2.1.161, on macOS and Linux, [sandboxed](</docs/en/sandboxing>) Bash subprocesses receive a short fallback `$TMPDIR` under the system default when your override is a long path, since some tools fail when temp paths get too long. Unsandboxed Bash commands inherit your shell’s `$TMPDIR` unchanged. Claude Code’s own temp files always use your override `CLAUDE_CODE_TMUX_TRUECOLOR`| Set to `1` to allow 24-bit truecolor output inside tmux. By default, Claude Code clamps to 256 colors when `$TMUX` is set because tmux does not pass through truecolor escape sequences unless configured to. Set this after adding `set -ga terminal-overrides ',*:Tc'` to your `~/.tmux.conf`. See [Terminal configuration](</docs/en/terminal-config>) for other tmux settings `CLAUDE_CODE_USE_ANTHROPIC_AWS`| Use [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) `CLAUDE_CODE_USE_BEDROCK`| Use [Bedrock](</docs/en/amazon-bedrock>)
modified
--- a/env-vars.md +++ b/env-vars.md @@ -311,7 +311,7 @@ `MCP_REMOTE_SERVER_CONNECTION_BATCH_SIZE`| Maximum number of remote MCP servers (HTTP/SSE) to connect in parallel during startup (default: 20) `MCP_SERVER_CONNECTION_BATCH_SIZE`| Maximum number of local MCP servers (stdio) to connect in parallel during startup (default: 3) `MCP_TIMEOUT`| Timeout in milliseconds for MCP server startup (default: 30000, or 30 seconds) -`MCP_TOOL_TIMEOUT`| Timeout in milliseconds for MCP tool execution (default: 100000000, about 28 hours). A per-server `timeout` field in `.mcp.json` overrides this for that server. Values below 1000 are floored to one second +`MCP_TOOL_TIMEOUT`| Timeout in milliseconds for MCP tool execution (default: 100000000, about 28 hours). A per-server `timeout` field in `.mcp.json` overrides this for that server. For the env variable, values below 1000 are floored to one second; for the per-server field, values below 1000 are ignored `NO_PROXY`| List of domains and IPs to which requests will be directly issued, bypassing proxy `OTEL_LOG_RAW_API_BODIES`| Emit Anthropic Messages API request and response JSON as `api_request_body` / `api_response_body` log events. Set to `1` for inline bodies truncated at 60 KB, or `file:<dir>` to write untruncated bodies to disk and emit a `body_ref` path instead. Disabled by default; bodies include the entire conversation history. See [Monitoring](</docs/en/monitoring-usage#api-request-body-event>) `OTEL_LOG_TOOL_CONTENT`| Set to `1` to include tool input and output content in OpenTelemetry span events. Disabled by default to protect sensitive data. See [Monitoring](</docs/en/monitoring-usage>)
modified
--- a/env-vars.md +++ b/env-vars.md @@ -1,9 +1,3 @@ -> ## Documentation Index -> -> Fetch the complete documentation index at: <https://code.claude.com/docs/llms.txt> -> -> Use this file to discover all available pages before exploring further. - Environment variables can control Claude Code behavior such as model selection, authentication, request routing, and feature toggles. Many of the same behaviors can also be configured through a [settings file](</docs/en/settings>) field, a [CLI flag](</docs/en/cli-reference>), or an in-session command like `/model`. This page covers how to: * Set environment variables in your shell or in a settings file @@ -154,7 +148,7 @@ `CLAUDE_CODE_DEBUG_LOGS_DIR`| Override the debug log file path. Despite the name, this is a file path, not a directory. Requires debug mode to be enabled separately via `--debug`, `/debug`, or the `DEBUG` environment variable: setting this variable alone does not enable logging. The [`--debug-file`](</docs/en/cli-reference#cli-flags>) flag does both at once. Defaults to `~/.claude/debug/<session-id>.txt` `CLAUDE_CODE_DEBUG_LOG_LEVEL`| Minimum log level written to the debug log file. Values: `verbose`, `debug` (default), `info`, `warn`, `error`. Set to `verbose` to include high-volume diagnostics like full status line command output, or raise to `error` to reduce noise `CLAUDE_CODE_DISABLE_1M_CONTEXT`| Set to `1` to disable [1M context window](</docs/en/model-config#extended-context>) support. When set, 1M model variants are unavailable in the model picker. Useful for enterprise environments with compliance requirements -`CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING`| Set to `1` to disable [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) on Opus 4.6 and Sonnet 4.6 and fall back to the fixed thinking budget controlled by `MAX_THINKING_TOKENS`. Has no effect on Opus 4.7 and later, which always use adaptive reasoning +`CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING`| Set to `1` to disable [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) on Opus 4.6 and Sonnet 4.6 and fall back to the fixed thinking budget controlled by `MAX_THINKING_TOKENS`. From v2.1.111, has no effect on Opus 4.7 and later, which always use adaptive reasoning `CLAUDE_CODE_DISABLE_AGENT_VIEW`| Set to `1` to turn off [background agents and agent view](</docs/en/agent-view>): `claude agents`, `--bg`, `/background`, and the on-demand supervisor. Equivalent to the [`disableAgentView`](</docs/en/settings#available-settings>) setting `CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN`| Set to `1` to disable [fullscreen rendering](</docs/en/fullscreen>) and use the classic main-screen renderer. The conversation stays in your terminal’s native scrollback so `Cmd+f` and tmux copy mode work as usual. Takes precedence over `CLAUDE_CODE_NO_FLICKER` and the [`tui`](</docs/en/settings#available-settings>) setting. You can also switch with `/tui default`. Does not apply to background sessions opened from [agent view](</docs/en/agent-view>), which always use fullscreen rendering `CLAUDE_CODE_DISABLE_ATTACHMENTS`| Set to `1` to disable attachment processing. File mentions with `@` syntax are sent as plain text instead of being expanded into file content @@ -178,7 +172,7 @@ `CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL`| Set to `1` to disable virtual scrolling in [fullscreen rendering](</docs/en/fullscreen>) and render every message in the transcript. Use this if scrolling in fullscreen mode shows blank regions where messages should appear `CLAUDE_CODE_DISABLE_WORKFLOWS`| Set to `1` to disable [workflows](</docs/en/workflows#turn-workflows-off>). Equivalent to the [`disableWorkflows`](</docs/en/settings#available-settings>) setting `CLAUDE_CODE_EFFORT_LEVEL`| Set the effort level for supported models. Values: `low`, `medium`, `high`, `xhigh`, `max`, or `auto` to use the model default. Available levels depend on the model. Takes precedence over `/effort` and the `effortLevel` setting. See [Adjust effort level](</docs/en/model-config#adjust-effort-level>) -`CLAUDE_CODE_ENABLE_AUTO_MODE`| Set to `1` to make [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) available on Amazon Bedrock, Google Cloud Vertex AI, and Microsoft Foundry. Has no effect on the Anthropic API, where auto mode is available by default. See [Enable auto mode on Bedrock, Vertex AI, or Foundry](</docs/en/permission-modes#enable-auto-mode-on-bedrock-vertex-ai-or-foundry>) +`CLAUDE_CODE_ENABLE_AUTO_MODE`| Set to `1` to make [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) available on Amazon Bedrock, Google Cloud Vertex AI, and Microsoft Foundry. Requires Claude Code v2.1.158 or later. Has no effect on the Anthropic API, where auto mode is available by default. See [Enable auto mode on Bedrock, Vertex AI, or Foundry](</docs/en/permission-modes#enable-auto-mode-on-bedrock-vertex-ai-or-foundry>) `CLAUDE_CODE_ENABLE_AWAY_SUMMARY`| Override [session recap](</docs/en/interactive-mode#session-recap>) availability. Set to `0` to force recaps off regardless of the `/config` toggle. Set to `1` to force recaps on when [`awaySummaryEnabled`](</docs/en/settings#available-settings>) is `false`. Takes precedence over the setting and `/config` toggle `CLAUDE_CODE_ENABLE_BACKGROUND_PLUGIN_REFRESH`| Set to `1` to refresh plugin state at turn boundaries in [non-interactive mode](</docs/en/headless>) after a background install completes. Off by default because the refresh changes the system prompt mid-session, which invalidates [prompt caching](</docs/en/prompt-caching>) for that turn `CLAUDE_CODE_ENABLE_FEEDBACK_SURVEY_FOR_OTEL`| Set to `1` to route the “How is Claude doing?” session quality survey to your own [OpenTelemetry collector](</docs/en/monitoring-usage>) when Anthropic-bound nonessential traffic is blocked. Survey ratings are emitted only as OTEL events to your configured collector. No survey data is sent to Anthropic in this mode. Applies when `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`, `DISABLE_TELEMETRY`, or `DO_NOT_TRACK` is set, and has no effect otherwise. `CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY` and the organization product feedback policy take precedence @@ -193,7 +187,7 @@ `CLAUDE_CODE_EXTRA_BODY`| JSON object to merge into the top level of every API request body. Useful for passing provider-specific parameters that Claude Code does not expose directly `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 `CLAUDE_CODE_FORCE_SYNC_OUTPUT`| Set to `1` to force-enable DEC private mode 2026 [synchronized output](<https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036>) when your terminal supports it but is not auto-detected. Useful for emulators such as Emacs `eat` that implement BSU/ESU but do not reply to the capability probe. Has no effect under tmux -`CLAUDE_CODE_FORK_SUBAGENT`| Set to `1` to enable [forked subagents](</docs/en/sub-agents#fork-the-current-conversation>). A forked subagent inherits the full conversation context from the main session instead of starting fresh. When enabled, `/fork` spawns a forked subagent rather than acting as an alias for [`/branch`](</docs/en/commands>), and all subagent spawns run in the background. Works in interactive mode and via the SDK or `claude -p` +`CLAUDE_CODE_FORK_SUBAGENT`| Set to `1` to make [forked subagents](</docs/en/sub-agents#fork-the-current-conversation>) the model’s default: Claude spawns a fork, a subagent that inherits the full conversation context instead of starting fresh, whenever it would otherwise use the general-purpose subagent, and all subagent spawns run in the background. The explicit [`/fork`](</docs/en/commands>) command works without this variable. Works in interactive mode and via the SDK or `claude -p` `CLAUDE_CODE_GIT_BASH_PATH`| Windows only: path to the Git Bash executable (`bash.exe`). Use when Git Bash is installed but not in your PATH. See [Windows setup](</docs/en/setup#set-up-on-windows>) `CLAUDE_CODE_GLOB_HIDDEN`| Set to `false` to exclude dotfiles from results when Claude invokes the [Glob tool](</docs/en/tools-reference#glob-tool-behavior>). Included by default. Does not affect `@` file autocomplete, `ls`, Grep, or Read `CLAUDE_CODE_GLOB_NO_IGNORE`| Set to `false` to make the [Glob tool](</docs/en/tools-reference#glob-tool-behavior>) respect `.gitignore` patterns. By default, Glob returns all matching files including gitignored ones. Does not affect `@` file autocomplete, which has its own [`respectGitignore` setting](</docs/en/settings#available-settings>) @@ -226,7 +220,7 @@ `CLAUDE_CODE_PLUGIN_PREFER_HTTPS`| Set to `1` to clone GitHub `owner/repo` shorthand sources over HTTPS instead of SSH. Applies to plugin install and update, and to `/plugin marketplace add` and `update`. Useful in CI runners, containers, or any environment without a configured SSH key for `github.com` `CLAUDE_CODE_PLUGIN_SEED_DIR`| Path to one or more read-only plugin seed directories, separated by `:` on Unix or `;` on Windows. Use this to bundle a pre-populated plugins directory into a container image. Claude Code registers marketplaces from these directories at startup and uses pre-cached plugins without re-cloning. See [Pre-populate plugins for containers](</docs/en/plugin-marketplaces#pre-populate-plugins-for-containers>) `CLAUDE_CODE_POWERSHELL_RESPECT_EXECUTION_POLICY`| Set to `1` to stop Claude Code from passing `-ExecutionPolicy Bypass` when spawning PowerShell for tool calls, hooks, and status line commands, and respect the machine’s effective execution policy instead. By default Claude Code bypasses execution policy at process scope so `.ps1` scripts and module imports work on default-Restricted Windows installs. Process-scope bypass never overrides Group Policy `MachinePolicy` or `UserPolicy` regardless of this setting -`CLAUDE_CODE_PROPAGATE_TRACEPARENT`| Set to `1` to propagate W3C trace context when `ANTHROPIC_BASE_URL` points at a custom proxy. Propagation covers the `traceparent` header on model and HTTP MCP requests and the `TRACEPARENT` environment variable for Bash, PowerShell, and hook subprocesses. By default, propagation is enabled only when connected directly to the Anthropic API. See [Traces (beta)](</docs/en/monitoring-usage#traces-beta>) +`CLAUDE_CODE_PROPAGATE_TRACEPARENT`| Set to `1` to propagate W3C trace context when `ANTHROPIC_BASE_URL` points at a custom proxy. Propagation covers the `traceparent` header on model and HTTP MCP requests and the `TRACEPARENT` environment variable for Bash, PowerShell, and hook subprocesses. By default, propagation is enabled only when connected directly to the Anthropic API. Added in v2.1.152. See [Traces (beta)](</docs/en/monitoring-usage#traces-beta>) `CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`| Set by host platforms that embed Claude Code and manage model provider routing on its behalf. When set, provider-selection, endpoint, and authentication variables such as `CLAUDE_CODE_USE_BEDROCK`, `ANTHROPIC_BASE_URL`, and `ANTHROPIC_API_KEY` in settings files are ignored so user settings cannot override the host’s routing. The automatic telemetry opt-out for Bedrock, Vertex, and Foundry is also skipped, so telemetry follows the standard `DISABLE_TELEMETRY` opt-out. See [Default behaviors by API provider](</docs/en/data-usage#default-behaviors-by-api-provider>) `CLAUDE_CODE_PROXY_RESOLVES_HOSTS`| Set to `1` to allow the proxy to perform DNS resolution instead of the caller. Opt-in for environments where the proxy should handle hostname resolution `CLAUDE_CODE_REMOTE`| Set automatically to `true` when Claude Code is running as a [cloud session](</docs/en/claude-code-on-the-web>). Read this from a hook or setup script to detect whether you are in a cloud environment @@ -257,7 +251,7 @@ `CLAUDE_CODE_SYNTAX_HIGHLIGHT`| Set to `false` to disable syntax highlighting in diff output. Useful when colors interfere with your terminal setup. To also disable highlighting in code blocks and file previews, use the [`syntaxHighlightingDisabled`](</docs/en/settings>) setting `CLAUDE_CODE_TASK_LIST_ID`| Share a task list across sessions. Set the same ID in multiple Claude Code instances to coordinate on a shared task list. See [Task list](</docs/en/interactive-mode#task-list>) `CLAUDE_CODE_TEAM_NAME`| Name of the agent team this teammate belongs to. Set automatically on [agent team](</docs/en/agent-teams>) members -`CLAUDE_CODE_TMPDIR`| Override the temp directory used for internal temp files. Claude Code appends `/claude-{uid}/` (Unix) or `/claude/` (Windows) to this path. Default: `/tmp` on macOS, `os.tmpdir()` on Linux/Windows +`CLAUDE_CODE_TMPDIR`| Override the temp directory used for internal temp files. Claude Code appends `/claude-{uid}/` on Unix or `/claude/` on Windows to this path. Default: `/tmp` on macOS, `os.tmpdir()` on Linux and Windows. As of v2.1.161, on macOS and Linux, Bash subprocesses receive a short fallback `$TMPDIR` under the system default when your override is a long path, since some tools fail when temp paths get too long. Claude Code’s own temp files always use your override `CLAUDE_CODE_TMUX_TRUECOLOR`| Set to `1` to allow 24-bit truecolor output inside tmux. By default, Claude Code clamps to 256 colors when `$TMUX` is set because tmux does not pass through truecolor escape sequences unless configured to. Set this after adding `set -ga terminal-overrides ',*:Tc'` to your `~/.tmux.conf`. See [Terminal configuration](</docs/en/terminal-config>) for other tmux settings `CLAUDE_CODE_USE_ANTHROPIC_AWS`| Use [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) `CLAUDE_CODE_USE_BEDROCK`| Use [Bedrock](</docs/en/amazon-bedrock>) @@ -324,7 +318,8 @@ `OTEL_LOG_TOOL_DETAILS`| Set to `1` to include tool input arguments, MCP server names, raw error strings on tool failures, and other tool details in OpenTelemetry traces and logs. Disabled by default to protect PII. See [Monitoring](</docs/en/monitoring-usage>) `OTEL_LOG_USER_PROMPTS`| Set to `1` to include user prompt text in OpenTelemetry traces and logs. Disabled by default (prompts are redacted). See [Monitoring](</docs/en/monitoring-usage>) `OTEL_METRICS_INCLUDE_ACCOUNT_UUID`| Set to `false` to exclude account UUID from metrics attributes (default: included). See [Monitoring](</docs/en/monitoring-usage>) -`OTEL_METRICS_INCLUDE_ENTRYPOINT`| Set to `true` to include the session entrypoint in metrics attributes (default: excluded). See [Monitoring](</docs/en/monitoring-usage>) +`OTEL_METRICS_INCLUDE_ENTRYPOINT`| Set to `true` to include the session entrypoint in metrics attributes (default: excluded). Added in v2.1.152. See [Monitoring](</docs/en/monitoring-usage>) +`OTEL_METRICS_INCLUDE_RESOURCE_ATTRIBUTES`| As of v2.1.161, Claude Code attaches `OTEL_RESOURCE_ATTRIBUTES` keys to metric datapoint labels. Set to `false` to exclude them (default: included). See [Monitoring](</docs/en/monitoring-usage#multi-team-organization-support>) `OTEL_METRICS_INCLUDE_SESSION_ID`| Set to `false` to exclude session ID from metrics attributes (default: included). See [Monitoring](</docs/en/monitoring-usage>) `OTEL_METRICS_INCLUDE_VERSION`| Set to `true` to include Claude Code version in metrics attributes (default: excluded). See [Monitoring](</docs/en/monitoring-usage>) `SLASH_COMMAND_TOOL_CHAR_BUDGET`| Override the character budget for skill metadata shown to the [Skill tool](</docs/en/skills#control-who-invokes-a-skill>). The budget scales dynamically at 1% of the context window, with a fallback of 8,000 characters. Legacy name kept for backwards compatibility @@ -340,7 +335,7 @@ `VERTEX_REGION_CLAUDE_4_5_SONNET`| Override region for Claude Sonnet 4.5 when using Vertex AI `VERTEX_REGION_CLAUDE_4_6_OPUS`| Override region for Claude Opus 4.6 when using Vertex AI `VERTEX_REGION_CLAUDE_4_6_SONNET`| Override region for Claude Sonnet 4.6 when using Vertex AI -`VERTEX_REGION_CLAUDE_4_7_OPUS`| Override region for Claude Opus 4.7 when using Vertex AI +`VERTEX_REGION_CLAUDE_4_7_OPUS`| Override region for Claude Opus 4.7 when using Vertex AI. Added in v2.1.111 `VERTEX_REGION_CLAUDE_HAIKU_4_5`| Override region for Claude Haiku 4.5 when using Vertex AI Standard OpenTelemetry exporter variables (`OTEL_METRICS_EXPORTER`, `OTEL_LOGS_EXPORTER`, `OTEL_EXPORTER_OTLP_ENDPOINT`, `OTEL_EXPORTER_OTLP_PROTOCOL`, `OTEL_EXPORTER_OTLP_HEADERS`, `OTEL_METRIC_EXPORT_INTERVAL`, `OTEL_RESOURCE_ATTRIBUTES`, and signal-specific variants) are also supported. See [Monitoring](</docs/en/monitoring-usage>) for configuration details.
modified
--- a/env-vars.md +++ b/env-vars.md @@ -156,7 +156,7 @@ `CLAUDE_CODE_DISABLE_1M_CONTEXT`| Set to `1` to disable [1M context window](</docs/en/model-config#extended-context>) support. When set, 1M model variants are unavailable in the model picker. Useful for enterprise environments with compliance requirements `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING`| Set to `1` to disable [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) on Opus 4.6 and Sonnet 4.6 and fall back to the fixed thinking budget controlled by `MAX_THINKING_TOKENS`. Has no effect on Opus 4.7 and later, which always use adaptive reasoning `CLAUDE_CODE_DISABLE_AGENT_VIEW`| Set to `1` to turn off [background agents and agent view](</docs/en/agent-view>): `claude agents`, `--bg`, `/background`, and the on-demand supervisor. Equivalent to the [`disableAgentView`](</docs/en/settings#available-settings>) setting -`CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN`| Set to `1` to disable [fullscreen rendering](</docs/en/fullscreen>) and use the classic main-screen renderer. The conversation stays in your terminal’s native scrollback so `Cmd+f` and tmux copy mode work as usual. Takes precedence over `CLAUDE_CODE_NO_FLICKER` and the [`tui`](</docs/en/settings#available-settings>) setting. You can also switch with `/tui default` +`CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN`| Set to `1` to disable [fullscreen rendering](</docs/en/fullscreen>) and use the classic main-screen renderer. The conversation stays in your terminal’s native scrollback so `Cmd+f` and tmux copy mode work as usual. Takes precedence over `CLAUDE_CODE_NO_FLICKER` and the [`tui`](</docs/en/settings#available-settings>) setting. You can also switch with `/tui default`. Does not apply to background sessions opened from [agent view](</docs/en/agent-view>), which always use fullscreen rendering `CLAUDE_CODE_DISABLE_ATTACHMENTS`| Set to `1` to disable attachment processing. File mentions with `@` syntax are sent as plain text instead of being expanded into file content `CLAUDE_CODE_DISABLE_AUTO_MEMORY`| Set to `1` to disable [auto memory](</docs/en/memory#auto-memory>). Set to `0` to force auto memory on even when `--bare` mode or [`autoMemoryEnabled: false`](</docs/en/settings#available-settings>) would otherwise disable it. When disabled, Claude does not create or load auto memory files `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 @@ -178,12 +178,13 @@ `CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL`| Set to `1` to disable virtual scrolling in [fullscreen rendering](</docs/en/fullscreen>) and render every message in the transcript. Use this if scrolling in fullscreen mode shows blank regions where messages should appear `CLAUDE_CODE_DISABLE_WORKFLOWS`| Set to `1` to disable [workflows](</docs/en/workflows#turn-workflows-off>). Equivalent to the [`disableWorkflows`](</docs/en/settings#available-settings>) setting `CLAUDE_CODE_EFFORT_LEVEL`| Set the effort level for supported models. Values: `low`, `medium`, `high`, `xhigh`, `max`, or `auto` to use the model default. Available levels depend on the model. Takes precedence over `/effort` and the `effortLevel` setting. See [Adjust effort level](</docs/en/model-config#adjust-effort-level>) +`CLAUDE_CODE_ENABLE_AUTO_MODE`| Set to `1` to make [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) available on Amazon Bedrock, Google Cloud Vertex AI, and Microsoft Foundry. Has no effect on the Anthropic API, where auto mode is available by default. See [Enable auto mode on Bedrock, Vertex AI, or Foundry](</docs/en/permission-modes#enable-auto-mode-on-bedrock-vertex-ai-or-foundry>) `CLAUDE_CODE_ENABLE_AWAY_SUMMARY`| Override [session recap](</docs/en/interactive-mode#session-recap>) availability. Set to `0` to force recaps off regardless of the `/config` toggle. Set to `1` to force recaps on when [`awaySummaryEnabled`](</docs/en/settings#available-settings>) is `false`. Takes precedence over the setting and `/config` toggle `CLAUDE_CODE_ENABLE_BACKGROUND_PLUGIN_REFRESH`| Set to `1` to refresh plugin state at turn boundaries in [non-interactive mode](</docs/en/headless>) after a background install completes. Off by default because the refresh changes the system prompt mid-session, which invalidates [prompt caching](</docs/en/prompt-caching>) for that turn `CLAUDE_CODE_ENABLE_FEEDBACK_SURVEY_FOR_OTEL`| Set to `1` to route the “How is Claude doing?” session quality survey to your own [OpenTelemetry collector](</docs/en/monitoring-usage>) when Anthropic-bound nonessential traffic is blocked. Survey ratings are emitted only as OTEL events to your configured collector. No survey data is sent to Anthropic in this mode. Applies when `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`, `DISABLE_TELEMETRY`, or `DO_NOT_TRACK` is set, and has no effect otherwise. `CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY` and the organization product feedback policy take precedence `CLAUDE_CODE_ENABLE_FINE_GRAINED_TOOL_STREAMING`| Controls whether tool call inputs stream from the API as Claude generates them. With this off, a large tool input such as a long file write arrives only after Claude finishes generating it, which can look like it’s hanging. Enabled by default on the Anthropic API. On Bedrock and Vertex, enabled per model where the deployed container supports it. Set to `0` to opt out. Set to `1` to force on when routing through a proxy via `ANTHROPIC_BASE_URL`, `ANTHROPIC_VERTEX_BASE_URL`, or `ANTHROPIC_BEDROCK_BASE_URL`. Off by default on Foundry and [gateway](</docs/en/llm-gateway>) connections `CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY`| Set to `1` to populate the `/model` picker from your gateway’s `/v1/models` endpoint when `ANTHROPIC_BASE_URL` points at an Anthropic-compatible gateway such as LiteLLM, Kong, or an internal proxy. Off by default because gateways backed by a shared API key would otherwise show every user every model the key can access. Discovered models are still filtered by the [`availableModels`](</docs/en/settings#available-settings>) allowlist -`CLAUDE_CODE_ENABLE_OPUS_4_7_FAST_MODE`| Removed in v2.1.142, when the [fast mode](</docs/en/fast-mode>) default moved from Opus 4.6 to Opus 4.7. Set `CLAUDE_CODE_OPUS_4_6_FAST_MODE_OVERRIDE=1` to keep Opus 4.6 instead +`CLAUDE_CODE_ENABLE_OPUS_4_7_FAST_MODE`| Removed in v2.1.142, when the [fast mode](</docs/en/fast-mode>) default moved from Opus 4.6 to Opus 4.7 `CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION`| Set to `false` to disable prompt suggestions (the “Prompt suggestions” toggle in `/config`). These are the grayed-out predictions that appear in your prompt input after Claude responds. See [Prompt suggestions](</docs/en/interactive-mode#prompt-suggestions>) `CLAUDE_CODE_ENABLE_TASKS`| Controls whether sessions use the structured Task tools (`TaskCreate`, `TaskUpdate`, `TaskGet`, `TaskList`) or the legacy `TodoWrite` tool. As of Claude Code v2.1.142, Task tools are the default in all modes. Set to `0` to revert to `TodoWrite`. See [Task list](</docs/en/interactive-mode#task-list>) and [Migrate to Task tools](</docs/en/agent-sdk/todo-tracking#migrate-to-task-tools>) `CLAUDE_CODE_ENABLE_TELEMETRY`| Set to `1` to enable OpenTelemetry data collection for metrics and logging. Required before configuring OTel exporters. See [Monitoring](</docs/en/monitoring-usage>) @@ -213,7 +214,7 @@ `CLAUDE_CODE_OAUTH_REFRESH_TOKEN`| OAuth refresh token for Claude.ai authentication. When set, `claude auth login` exchanges this token directly instead of opening a browser. Requires `CLAUDE_CODE_OAUTH_SCOPES`. Useful for provisioning authentication in automated environments `CLAUDE_CODE_OAUTH_SCOPES`| Space-separated OAuth scopes the refresh token was issued with, such as `"user:profile user:inference user:sessions:claude_code"`. Required when `CLAUDE_CODE_OAUTH_REFRESH_TOKEN` is set `CLAUDE_CODE_OAUTH_TOKEN`| OAuth access token for Claude.ai authentication. Alternative to `/login` for SDK and automated environments. Takes precedence over keychain-stored credentials. Generate one with [`claude setup-token`](</docs/en/authentication#generate-a-long-lived-token>) -`CLAUDE_CODE_OPUS_4_6_FAST_MODE_OVERRIDE`| Set to `1` to pin fast mode to Claude Opus 4.6 instead of the [current fast mode default](</docs/en/fast-mode#toggle-fast-mode>), which depends on your Claude Code version. With the variable set, `/fast` runs on Opus 4.6. Fast mode for Opus 4.6 is deprecated, and this variable will be removed when it is retired +`CLAUDE_CODE_OPUS_4_6_FAST_MODE_OVERRIDE`| Removed in v2.1.160 and now a no-op. Previously pinned [fast mode](</docs/en/fast-mode>) to Claude Opus 4.6 instead of the current default. To run fast mode on Opus 4.6 until it is retired, select the model with `/model` first, then `/fast on` `CLAUDE_CODE_OTEL_FLUSH_TIMEOUT_MS`| Timeout in milliseconds for flushing pending OpenTelemetry spans (default: 5000). See [Monitoring](</docs/en/monitoring-usage>) `CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS`| Interval for refreshing dynamic OpenTelemetry headers in milliseconds (default: 1740000 / 29 minutes). See [Dynamic headers](</docs/en/monitoring-usage#dynamic-headers>) `CLAUDE_CODE_OTEL_SHUTDOWN_TIMEOUT_MS`| Timeout in milliseconds for the OpenTelemetry exporter to finish on shutdown (default: 2000). Increase if metrics are dropped at exit. See [Monitoring](</docs/en/monitoring-usage>)
modified
--- a/env-vars.md +++ b/env-vars.md @@ -173,7 +173,7 @@ `CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK`| Set to `1` to disable the non-streaming fallback when a streaming request fails mid-stream. Streaming errors propagate to the retry layer instead. Useful when a proxy or gateway causes the fallback to produce duplicate tool execution `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL`| Set to `1` to skip automatic addition of the official plugin marketplace on first run `CLAUDE_CODE_DISABLE_POLICY_SKILLS`| Set to `1` to skip loading skills from the system-wide managed skills directory. Useful for container or CI sessions that should not load operator-provisioned skills -`CLAUDE_CODE_DISABLE_TERMINAL_TITLE`| Set to `1` to disable automatic terminal title updates based on conversation context +`CLAUDE_CODE_DISABLE_TERMINAL_TITLE`| Set to `1` to disable automatic terminal title updates based on conversation context. In Agent SDK and `claude -p` sessions, this also skips the background Haiku request that generates the session title `CLAUDE_CODE_DISABLE_THINKING`| Set to `1` to force-disable [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) regardless of model support or other settings. More direct than `MAX_THINKING_TOKENS=0` `CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL`| Set to `1` to disable virtual scrolling in [fullscreen rendering](</docs/en/fullscreen>) and render every message in the transcript. Use this if scrolling in fullscreen mode shows blank regions where messages should appear `CLAUDE_CODE_DISABLE_WORKFLOWS`| Set to `1` to disable [workflows](</docs/en/workflows#turn-workflows-off>). Equivalent to the [`disableWorkflows`](</docs/en/settings#available-settings>) setting @@ -266,7 +266,7 @@ `CLAUDE_CODE_USE_POWERSHELL_TOOL`| Controls the PowerShell tool. On Windows without Git Bash, the tool is enabled automatically; set to `0` to disable it. On Windows with Git Bash installed, the tool is rolling out progressively: set to `1` to opt in or `0` to opt out. On Linux, macOS, and WSL, set to `1` to enable it, which requires `pwsh` on your `PATH`. When enabled on Windows, Claude can run PowerShell commands natively instead of routing through Git Bash. See [PowerShell tool](</docs/en/tools-reference#powershell-tool>) `CLAUDE_CODE_USE_VERTEX`| Use [Vertex](</docs/en/google-vertex-ai>) `CLAUDE_CONFIG_DIR`| Override the configuration directory (default: `~/.claude`). All settings, credentials, session history, and plugins are stored under this path. Useful for running multiple accounts side by side: for example, `alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'` -`CLAUDE_EFFORT`| Set automatically in Bash tool subprocesses and hook commands to the active [effort level](</docs/en/model-config#adjust-effort-level>) for the turn: `low`, `medium`, `high`, `xhigh`, `max`, or `ultra`. The `ultra` value corresponds to ultracode in `/effort`; the variable reports the stored value, not the display label. Matches the `effort.level` field passed to [hooks](</docs/en/hooks>). Only set when the current model supports the effort parameter +`CLAUDE_EFFORT`| Set automatically in Bash tool subprocesses and hook commands to the active [effort level](</docs/en/model-config#adjust-effort-level>) for the turn: `low`, `medium`, `high`, `xhigh`, or `max`. Ultracode is not a distinct level and reports as `xhigh`. Matches the `effort.level` field passed to [hooks](</docs/en/hooks>). Only set when the current model supports the effort parameter `CLAUDE_ENABLE_BYTE_WATCHDOG`| Set to `1` to force-enable the byte-level streaming idle watchdog, or set to `0` to force-disable it. When unset, the watchdog is enabled by default for Anthropic API connections. The byte watchdog aborts a connection when no bytes arrive on the wire for the duration set by `CLAUDE_STREAM_IDLE_TIMEOUT_MS`, with a minimum of 5 minutes, independent of the event-level watchdog `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK`| Set to `1` to enable the byte-level streaming idle watchdog on Amazon Bedrock `vnd.amazon.eventstream` responses. Off by default. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS` `CLAUDE_ENABLE_STREAM_WATCHDOG`| Set to `1` to enable the event-level streaming idle watchdog. Off by default. Applies to all providers, including Bedrock. For Vertex and Foundry, this is the only idle watchdog available. On Bedrock, you can also enable the independent byte-level watchdog with `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK`; the two run together when both are set. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS`
modified
--- a/env-vars.md +++ b/env-vars.md @@ -133,7 +133,7 @@ `BASH_MAX_OUTPUT_LENGTH`| Maximum number of characters in bash outputs before the full output is saved to a file and Claude receives the path plus a short preview. See [Bash tool behavior](</docs/en/tools-reference#bash-tool-behavior>) `BASH_MAX_TIMEOUT_MS`| Maximum timeout the model can set for long-running bash commands (default: 600000, or 10 minutes) `CCR_FORCE_BUNDLE`| Set to `1` to force [`claude --remote`](</docs/en/claude-code-on-the-web#send-local-repositories-without-github>) to bundle and upload your local repository even when GitHub access is available -`CLAUDECODE`| Set to `1` in subprocesses Claude Code spawns (Bash and PowerShell tools, tmux sessions, [hook](</docs/en/hooks>) commands, [status line](</docs/en/statusline>) commands). Use to detect when a script is running inside a subprocess spawned by Claude Code +`CLAUDECODE`| Set to `1` in subprocesses Claude Code spawns (Bash and PowerShell tools, tmux sessions, [hook](</docs/en/hooks>) commands, [status line](</docs/en/statusline>) commands, stdio [MCP server](</docs/en/mcp>) subprocesses). Use to detect when a script is running inside a subprocess spawned by Claude Code `CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS`| Set to `1` to disable all built-in [subagent](</docs/en/sub-agents>) types such as Explore and Plan. Only applies in non-interactive mode (the `-p` flag). Useful for SDK users who want a blank slate `CLAUDE_AGENT_SDK_MCP_NO_PREFIX`| Set to `1` to skip the `mcp__<server>__` prefix on tool names from SDK-created MCP servers. Tools use their original names. SDK usage only `CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS`| Stall timeout in milliseconds for background subagents. Default `600000` (10 minutes). The timer resets on each streaming progress event; if no progress arrives within the window, the subagent is aborted and the task is marked failed, surfacing any partial result to the parent @@ -154,7 +154,7 @@ `CLAUDE_CODE_DEBUG_LOGS_DIR`| Override the debug log file path. Despite the name, this is a file path, not a directory. Requires debug mode to be enabled separately via `--debug`, `/debug`, or the `DEBUG` environment variable: setting this variable alone does not enable logging. The [`--debug-file`](</docs/en/cli-reference#cli-flags>) flag does both at once. Defaults to `~/.claude/debug/<session-id>.txt` `CLAUDE_CODE_DEBUG_LOG_LEVEL`| Minimum log level written to the debug log file. Values: `verbose`, `debug` (default), `info`, `warn`, `error`. Set to `verbose` to include high-volume diagnostics like full status line command output, or raise to `error` to reduce noise `CLAUDE_CODE_DISABLE_1M_CONTEXT`| Set to `1` to disable [1M context window](</docs/en/model-config#extended-context>) support. When set, 1M model variants are unavailable in the model picker. Useful for enterprise environments with compliance requirements -`CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING`| Set to `1` to disable [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) on Opus 4.6 and Sonnet 4.6 and fall back to the fixed thinking budget controlled by `MAX_THINKING_TOKENS`. Has no effect on Opus 4.7, which always uses adaptive reasoning +`CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING`| Set to `1` to disable [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) on Opus 4.6 and Sonnet 4.6 and fall back to the fixed thinking budget controlled by `MAX_THINKING_TOKENS`. Has no effect on Opus 4.7 and later, which always use adaptive reasoning `CLAUDE_CODE_DISABLE_AGENT_VIEW`| Set to `1` to turn off [background agents and agent view](</docs/en/agent-view>): `claude agents`, `--bg`, `/background`, and the on-demand supervisor. Equivalent to the [`disableAgentView`](</docs/en/settings#available-settings>) setting `CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN`| Set to `1` to disable [fullscreen rendering](</docs/en/fullscreen>) and use the classic main-screen renderer. The conversation stays in your terminal’s native scrollback so `Cmd+f` and tmux copy mode work as usual. Takes precedence over `CLAUDE_CODE_NO_FLICKER` and the [`tui`](</docs/en/settings#available-settings>) setting. You can also switch with `/tui default` `CLAUDE_CODE_DISABLE_ATTACHMENTS`| Set to `1` to disable attachment processing. File mentions with `@` syntax are sent as plain text instead of being expanded into file content @@ -176,13 +176,14 @@ `CLAUDE_CODE_DISABLE_TERMINAL_TITLE`| Set to `1` to disable automatic terminal title updates based on conversation context `CLAUDE_CODE_DISABLE_THINKING`| Set to `1` to force-disable [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) regardless of model support or other settings. More direct than `MAX_THINKING_TOKENS=0` `CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL`| Set to `1` to disable virtual scrolling in [fullscreen rendering](</docs/en/fullscreen>) and render every message in the transcript. Use this if scrolling in fullscreen mode shows blank regions where messages should appear +`CLAUDE_CODE_DISABLE_WORKFLOWS`| Set to `1` to disable [workflows](</docs/en/workflows#turn-workflows-off>). Equivalent to the [`disableWorkflows`](</docs/en/settings#available-settings>) setting `CLAUDE_CODE_EFFORT_LEVEL`| Set the effort level for supported models. Values: `low`, `medium`, `high`, `xhigh`, `max`, or `auto` to use the model default. Available levels depend on the model. Takes precedence over `/effort` and the `effortLevel` setting. See [Adjust effort level](</docs/en/model-config#adjust-effort-level>) `CLAUDE_CODE_ENABLE_AWAY_SUMMARY`| Override [session recap](</docs/en/interactive-mode#session-recap>) availability. Set to `0` to force recaps off regardless of the `/config` toggle. Set to `1` to force recaps on when [`awaySummaryEnabled`](</docs/en/settings#available-settings>) is `false`. Takes precedence over the setting and `/config` toggle `CLAUDE_CODE_ENABLE_BACKGROUND_PLUGIN_REFRESH`| Set to `1` to refresh plugin state at turn boundaries in [non-interactive mode](</docs/en/headless>) after a background install completes. Off by default because the refresh changes the system prompt mid-session, which invalidates [prompt caching](</docs/en/prompt-caching>) for that turn `CLAUDE_CODE_ENABLE_FEEDBACK_SURVEY_FOR_OTEL`| Set to `1` to route the “How is Claude doing?” session quality survey to your own [OpenTelemetry collector](</docs/en/monitoring-usage>) when Anthropic-bound nonessential traffic is blocked. Survey ratings are emitted only as OTEL events to your configured collector. No survey data is sent to Anthropic in this mode. Applies when `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`, `DISABLE_TELEMETRY`, or `DO_NOT_TRACK` is set, and has no effect otherwise. `CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY` and the organization product feedback policy take precedence `CLAUDE_CODE_ENABLE_FINE_GRAINED_TOOL_STREAMING`| Controls whether tool call inputs stream from the API as Claude generates them. With this off, a large tool input such as a long file write arrives only after Claude finishes generating it, which can look like it’s hanging. Enabled by default on the Anthropic API. On Bedrock and Vertex, enabled per model where the deployed container supports it. Set to `0` to opt out. Set to `1` to force on when routing through a proxy via `ANTHROPIC_BASE_URL`, `ANTHROPIC_VERTEX_BASE_URL`, or `ANTHROPIC_BEDROCK_BASE_URL`. Off by default on Foundry and [gateway](</docs/en/llm-gateway>) connections `CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY`| Set to `1` to populate the `/model` picker from your gateway’s `/v1/models` endpoint when `ANTHROPIC_BASE_URL` points at an Anthropic-compatible gateway such as LiteLLM, Kong, or an internal proxy. Off by default because gateways backed by a shared API key would otherwise show every user every model the key can access. Discovered models are still filtered by the [`availableModels`](</docs/en/settings#available-settings>) allowlist -`CLAUDE_CODE_ENABLE_OPUS_4_7_FAST_MODE`| Removed in v2.1.142. [Fast mode](</docs/en/fast-mode>) defaults to Opus 4.7. Set `CLAUDE_CODE_OPUS_4_6_FAST_MODE_OVERRIDE=1` to keep Opus 4.6 instead +`CLAUDE_CODE_ENABLE_OPUS_4_7_FAST_MODE`| Removed in v2.1.142, when the [fast mode](</docs/en/fast-mode>) default moved from Opus 4.6 to Opus 4.7. Set `CLAUDE_CODE_OPUS_4_6_FAST_MODE_OVERRIDE=1` to keep Opus 4.6 instead `CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION`| Set to `false` to disable prompt suggestions (the “Prompt suggestions” toggle in `/config`). These are the grayed-out predictions that appear in your prompt input after Claude responds. See [Prompt suggestions](</docs/en/interactive-mode#prompt-suggestions>) `CLAUDE_CODE_ENABLE_TASKS`| Controls whether sessions use the structured Task tools (`TaskCreate`, `TaskUpdate`, `TaskGet`, `TaskList`) or the legacy `TodoWrite` tool. As of Claude Code v2.1.142, Task tools are the default in all modes. Set to `0` to revert to `TodoWrite`. See [Task list](</docs/en/interactive-mode#task-list>) and [Migrate to Task tools](</docs/en/agent-sdk/todo-tracking#migrate-to-task-tools>) `CLAUDE_CODE_ENABLE_TELEMETRY`| Set to `1` to enable OpenTelemetry data collection for metrics and logging. Required before configuring OTel exporters. See [Monitoring](</docs/en/monitoring-usage>) @@ -212,7 +213,7 @@ `CLAUDE_CODE_OAUTH_REFRESH_TOKEN`| OAuth refresh token for Claude.ai authentication. When set, `claude auth login` exchanges this token directly instead of opening a browser. Requires `CLAUDE_CODE_OAUTH_SCOPES`. Useful for provisioning authentication in automated environments `CLAUDE_CODE_OAUTH_SCOPES`| Space-separated OAuth scopes the refresh token was issued with, such as `"user:profile user:inference user:sessions:claude_code"`. Required when `CLAUDE_CODE_OAUTH_REFRESH_TOKEN` is set `CLAUDE_CODE_OAUTH_TOKEN`| OAuth access token for Claude.ai authentication. Alternative to `/login` for SDK and automated environments. Takes precedence over keychain-stored credentials. Generate one with [`claude setup-token`](</docs/en/authentication#generate-a-long-lived-token>) -`CLAUDE_CODE_OPUS_4_6_FAST_MODE_OVERRIDE`| Set to `1` to pin [fast mode](</docs/en/fast-mode>) to Claude Opus 4.6 instead of the default Opus 4.7. With the variable set, `/fast` runs on Opus 4.6. Without it, `/fast` runs on Opus 4.7 +`CLAUDE_CODE_OPUS_4_6_FAST_MODE_OVERRIDE`| Set to `1` to pin fast mode to Claude Opus 4.6 instead of the [current fast mode default](</docs/en/fast-mode#toggle-fast-mode>), which depends on your Claude Code version. With the variable set, `/fast` runs on Opus 4.6. Fast mode for Opus 4.6 is deprecated, and this variable will be removed when it is retired `CLAUDE_CODE_OTEL_FLUSH_TIMEOUT_MS`| Timeout in milliseconds for flushing pending OpenTelemetry spans (default: 5000). See [Monitoring](</docs/en/monitoring-usage>) `CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS`| Interval for refreshing dynamic OpenTelemetry headers in milliseconds (default: 1740000 / 29 minutes). See [Dynamic headers](</docs/en/monitoring-usage#dynamic-headers>) `CLAUDE_CODE_OTEL_SHUTDOWN_TIMEOUT_MS`| Timeout in milliseconds for the OpenTelemetry exporter to finish on shutdown (default: 2000). Increase if metrics are dropped at exit. See [Monitoring](</docs/en/monitoring-usage>) @@ -234,7 +235,7 @@ `CLAUDE_CODE_SCRIPT_CAPS`| JSON object limiting how many times specific scripts may be invoked per session when `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB` is set. Keys are substrings matched against the command text; values are integer call limits. For example, `{"deploy.sh": 2}` allows `deploy.sh` to be called at most twice. Matching is substring-based so shell-expansion tricks like `./scripts/deploy.sh $(evil)` still count against the cap. Runtime fan-out via `xargs` or `find -exec` is not detected; this is a defense-in-depth control `CLAUDE_CODE_SCROLL_SPEED`| Set the mouse wheel scroll multiplier in [fullscreen rendering](</docs/en/fullscreen#mouse-wheel-scrolling>). Accepts values from 1 to 20. Set to `3` to match `vim` if your terminal sends one wheel event per notch without amplification. Ignored in the JetBrains IDE terminal, where Claude Code uses its own scroll handling `CLAUDE_CODE_SESSIONEND_HOOKS_TIMEOUT_MS`| Override the time budget in milliseconds for [SessionEnd](</docs/en/hooks#sessionend>) hooks. Applies to session exit, `/clear`, and switching sessions via interactive `/resume`. By default the budget is 1.5 seconds, automatically raised to the highest per-hook `timeout` configured in settings files, up to 60 seconds. Timeouts on plugin-provided hooks do not raise the budget -`CLAUDE_CODE_SESSION_ID`| Set automatically in Bash and PowerShell tool subprocesses and in [hook command](</docs/en/hooks>) subprocesses to the current session ID. Matches the `session_id` field in the hook JSON input. Updated on `/clear`. Use to correlate scripts and external tools with the Claude Code session that launched them +`CLAUDE_CODE_SESSION_ID`| Set automatically to the current session ID in Bash and PowerShell tool subprocesses, [hook command](</docs/en/hooks>) subprocesses, and stdio [MCP server](</docs/en/mcp>) subprocesses. For Bash, PowerShell, and hooks this matches the `session_id` field in the hook JSON input and is updated on `/clear`. An MCP server subprocess retains the ID it was spawned with, and may receive the initial startup ID rather than the resumed ID when launched via `--resume` or `--continue`. Use to correlate scripts and external tools with the Claude Code session that launched them `CLAUDE_CODE_SHELL`| Override automatic shell detection. Useful when your login shell differs from your preferred working shell (for example, `bash` vs `zsh`) `CLAUDE_CODE_SHELL_PREFIX`| Command prefix that wraps shell commands Claude Code spawns: Bash tool calls, [hook](</docs/en/hooks>) commands, and stdio [MCP server](</docs/en/mcp>) startup commands. Useful for logging or auditing. Example: setting `/path/to/logger.sh` runs each command as `/path/to/logger.sh <command>` `CLAUDE_CODE_SIMPLE`| Set to `1` to run with a minimal system prompt and only the Bash, file read, and file edit tools. MCP tools from `--mcp-config` are still available. Disables auto-discovery of hooks, skills, plugins, MCP servers, auto memory, and CLAUDE.md. OAuth tokens and keychain credentials are not read, so Anthropic authentication must come from `ANTHROPIC_API_KEY` or an `apiKeyHelper` in `--settings`. Equivalent to passing [`--bare`](</docs/en/headless#start-faster-with-bare-mode>) @@ -265,7 +266,7 @@ `CLAUDE_CODE_USE_POWERSHELL_TOOL`| Controls the PowerShell tool. On Windows without Git Bash, the tool is enabled automatically; set to `0` to disable it. On Windows with Git Bash installed, the tool is rolling out progressively: set to `1` to opt in or `0` to opt out. On Linux, macOS, and WSL, set to `1` to enable it, which requires `pwsh` on your `PATH`. When enabled on Windows, Claude can run PowerShell commands natively instead of routing through Git Bash. See [PowerShell tool](</docs/en/tools-reference#powershell-tool>) `CLAUDE_CODE_USE_VERTEX`| Use [Vertex](</docs/en/google-vertex-ai>) `CLAUDE_CONFIG_DIR`| Override the configuration directory (default: `~/.claude`). All settings, credentials, session history, and plugins are stored under this path. Useful for running multiple accounts side by side: for example, `alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'` -`CLAUDE_EFFORT`| Set automatically in Bash tool subprocesses and hook commands to the active [effort level](</docs/en/model-config#adjust-effort-level>) for the turn: `low`, `medium`, `high`, `xhigh`, or `max`. Matches the `effort.level` field passed to [hooks](</docs/en/hooks>). Only set when the current model supports the effort parameter +`CLAUDE_EFFORT`| Set automatically in Bash tool subprocesses and hook commands to the active [effort level](</docs/en/model-config#adjust-effort-level>) for the turn: `low`, `medium`, `high`, `xhigh`, `max`, or `ultra`. The `ultra` value corresponds to ultracode in `/effort`; the variable reports the stored value, not the display label. Matches the `effort.level` field passed to [hooks](</docs/en/hooks>). Only set when the current model supports the effort parameter `CLAUDE_ENABLE_BYTE_WATCHDOG`| Set to `1` to force-enable the byte-level streaming idle watchdog, or set to `0` to force-disable it. When unset, the watchdog is enabled by default for Anthropic API connections. The byte watchdog aborts a connection when no bytes arrive on the wire for the duration set by `CLAUDE_STREAM_IDLE_TIMEOUT_MS`, with a minimum of 5 minutes, independent of the event-level watchdog `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK`| Set to `1` to enable the byte-level streaming idle watchdog on Amazon Bedrock `vnd.amazon.eventstream` responses. Off by default. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS` `CLAUDE_ENABLE_STREAM_WATCHDOG`| Set to `1` to enable the event-level streaming idle watchdog. Off by default. Applies to all providers, including Bedrock. For Vertex and Foundry, this is the only idle watchdog available. On Bedrock, you can also enable the independent byte-level watchdog with `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK`; the two run together when both are set. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS`
modified
--- a/env-vars.md +++ b/env-vars.md @@ -224,6 +224,7 @@ `CLAUDE_CODE_PLUGIN_PREFER_HTTPS`| Set to `1` to clone GitHub `owner/repo` shorthand sources over HTTPS instead of SSH. Applies to plugin install and update, and to `/plugin marketplace add` and `update`. Useful in CI runners, containers, or any environment without a configured SSH key for `github.com` `CLAUDE_CODE_PLUGIN_SEED_DIR`| Path to one or more read-only plugin seed directories, separated by `:` on Unix or `;` on Windows. Use this to bundle a pre-populated plugins directory into a container image. Claude Code registers marketplaces from these directories at startup and uses pre-cached plugins without re-cloning. See [Pre-populate plugins for containers](</docs/en/plugin-marketplaces#pre-populate-plugins-for-containers>) `CLAUDE_CODE_POWERSHELL_RESPECT_EXECUTION_POLICY`| Set to `1` to stop Claude Code from passing `-ExecutionPolicy Bypass` when spawning PowerShell for tool calls, hooks, and status line commands, and respect the machine’s effective execution policy instead. By default Claude Code bypasses execution policy at process scope so `.ps1` scripts and module imports work on default-Restricted Windows installs. Process-scope bypass never overrides Group Policy `MachinePolicy` or `UserPolicy` regardless of this setting +`CLAUDE_CODE_PROPAGATE_TRACEPARENT`| Set to `1` to propagate W3C trace context when `ANTHROPIC_BASE_URL` points at a custom proxy. Propagation covers the `traceparent` header on model and HTTP MCP requests and the `TRACEPARENT` environment variable for Bash, PowerShell, and hook subprocesses. By default, propagation is enabled only when connected directly to the Anthropic API. See [Traces (beta)](</docs/en/monitoring-usage#traces-beta>) `CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`| Set by host platforms that embed Claude Code and manage model provider routing on its behalf. When set, provider-selection, endpoint, and authentication variables such as `CLAUDE_CODE_USE_BEDROCK`, `ANTHROPIC_BASE_URL`, and `ANTHROPIC_API_KEY` in settings files are ignored so user settings cannot override the host’s routing. The automatic telemetry opt-out for Bedrock, Vertex, and Foundry is also skipped, so telemetry follows the standard `DISABLE_TELEMETRY` opt-out. See [Default behaviors by API provider](</docs/en/data-usage#default-behaviors-by-api-provider>) `CLAUDE_CODE_PROXY_RESOLVES_HOSTS`| Set to `1` to allow the proxy to perform DNS resolution instead of the caller. Opt-in for environments where the proxy should handle hostname resolution `CLAUDE_CODE_REMOTE`| Set automatically to `true` when Claude Code is running as a [cloud session](</docs/en/claude-code-on-the-web>). Read this from a hook or setup script to detect whether you are in a cloud environment @@ -249,6 +250,8 @@ `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB`| Set to `1` to strip Anthropic and cloud provider credentials from subprocess environments (Bash tool, hooks, MCP stdio servers). The parent Claude process keeps these credentials for API calls, but child processes cannot read them, reducing exposure to prompt injection attacks that attempt to exfiltrate secrets via shell expansion. On Linux, this also runs Bash subprocesses in an isolated PID namespace so they cannot read host process environments via `/proc`; as a side effect, `ps`, `pgrep`, and `kill` cannot see or signal host processes. `claude-code-action` sets this automatically when `allowed_non_write_users` is configured `CLAUDE_CODE_SYNC_PLUGIN_INSTALL`| Set to `1` in non-interactive mode (the `-p` flag) to wait for plugin installation to complete before the first query. Without this, plugins install in the background and may not be available on the first turn. Combine with `CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS` to bound the wait `CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS`| Timeout in milliseconds for synchronous plugin installation. When exceeded, Claude Code proceeds without plugins and logs an error. No default: without this variable, synchronous installation waits until complete +`CLAUDE_CODE_SYNC_SKILLS`| Set to `1` to download your enabled claude.ai skills into `~/.claude/skills/` before the first query and resync every 10 minutes. Applies only in non-interactive mode with the `-p` flag. Set automatically in [Claude Code on the web](</docs/en/claude-code-on-the-web>) sessions. Requires claude.ai authentication +`CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS`| Timeout in milliseconds for the first query to wait on the initial skills sync when `CLAUDE_CODE_SYNC_SKILLS` is set (default: 5000). When exceeded, the query proceeds and remaining skill downloads continue in the background `CLAUDE_CODE_SYNTAX_HIGHLIGHT`| Set to `false` to disable syntax highlighting in diff output. Useful when colors interfere with your terminal setup. To also disable highlighting in code blocks and file previews, use the [`syntaxHighlightingDisabled`](</docs/en/settings>) setting `CLAUDE_CODE_TASK_LIST_ID`| Share a task list across sessions. Set the same ID in multiple Claude Code instances to coordinate on a shared task list. See [Task list](</docs/en/interactive-mode#task-list>) `CLAUDE_CODE_TEAM_NAME`| Name of the agent team this teammate belongs to. Set automatically on [agent team](</docs/en/agent-teams>) members @@ -291,7 +294,7 @@ `DISABLE_TELEMETRY`| Set to `1` to opt out of telemetry. Telemetry events do not include user data like code, file paths, or bash commands. Also disables feature-flag fetching with the same effect as `DISABLE_GROWTHBOOK`, so some flagged features may be unavailable `DISABLE_UPDATES`| Set to `1` to block all updates including manual `claude update` and `claude install`. Stricter than `DISABLE_AUTOUPDATER`. Use when distributing Claude Code through your own channels and users should not self-update `DISABLE_UPGRADE_COMMAND`| Set to `1` to hide the `/upgrade` command -`DO_NOT_TRACK`| Set to `1` to opt out of telemetry. Equivalent to setting `DISABLE_TELEMETRY`. Honored as the [standard cross-tool convention](<https://consoledonottrack.com/>) +`DO_NOT_TRACK`| Set to `1` to opt out of telemetry. Equivalent to setting `DISABLE_TELEMETRY`. Claude Code honors this as the cross-tool convention recognized by many developer CLIs `ENABLE_CLAUDEAI_MCP_SERVERS`| Set to `false` to disable [claude.ai MCP servers](</docs/en/mcp#use-mcp-servers-from-claude-ai>) in Claude Code. Enabled by default for logged-in users `ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) instead of the default 5 minutes. Intended for API key, [Bedrock](</docs/en/amazon-bedrock>), [Vertex](</docs/en/google-vertex-ai>), [Foundry](</docs/en/microsoft-foundry>), and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) users. Subscription users within included usage receive 1-hour TTL automatically. 1-hour cache writes are billed at a higher rate `ENABLE_PROMPT_CACHING_1H_BEDROCK`| Deprecated. Use `ENABLE_PROMPT_CACHING_1H` instead @@ -319,6 +322,7 @@ `OTEL_LOG_TOOL_DETAILS`| Set to `1` to include tool input arguments, MCP server names, raw error strings on tool failures, and other tool details in OpenTelemetry traces and logs. Disabled by default to protect PII. See [Monitoring](</docs/en/monitoring-usage>) `OTEL_LOG_USER_PROMPTS`| Set to `1` to include user prompt text in OpenTelemetry traces and logs. Disabled by default (prompts are redacted). See [Monitoring](</docs/en/monitoring-usage>) `OTEL_METRICS_INCLUDE_ACCOUNT_UUID`| Set to `false` to exclude account UUID from metrics attributes (default: included). See [Monitoring](</docs/en/monitoring-usage>) +`OTEL_METRICS_INCLUDE_ENTRYPOINT`| Set to `true` to include the session entrypoint in metrics attributes (default: excluded). See [Monitoring](</docs/en/monitoring-usage>) `OTEL_METRICS_INCLUDE_SESSION_ID`| Set to `false` to exclude session ID from metrics attributes (default: included). See [Monitoring](</docs/en/monitoring-usage>) `OTEL_METRICS_INCLUDE_VERSION`| Set to `true` to include Claude Code version in metrics attributes (default: excluded). See [Monitoring](</docs/en/monitoring-usage>) `SLASH_COMMAND_TOOL_CHAR_BUDGET`| Override the character budget for skill metadata shown to the [Skill tool](</docs/en/skills#control-who-invokes-a-skill>). The budget scales dynamically at 1% of the context window, with a fallback of 8,000 characters. Legacy name kept for backwards compatibility
modified
--- a/env-vars.md +++ b/env-vars.md @@ -142,7 +142,7 @@ `CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR`| Return to the original working directory after each Bash or PowerShell command in the main session `CLAUDE_CODE_ACCESSIBILITY`| Set to `1` to keep the native terminal cursor visible and disable the inverted-text cursor indicator. Allows screen magnifiers like macOS Zoom to track cursor position `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD`| Set to `1` to load memory files from directories specified with `--add-dir`. Loads `CLAUDE.md`, `.claude/CLAUDE.md`, `.claude/rules/*.md`, and `CLAUDE.local.md`. By default, additional directories do not load memory files -`CLAUDE_CODE_ALT_SCREEN_FULL_REPAINT`| Set to `1` to repaint the entire screen on every frame in [fullscreen rendering](</docs/en/fullscreen>) instead of sending incremental updates. Use this if fullscreen mode shows stale or misplaced text fragments. Claude Code enables this automatically for background sessions on Windows +`CLAUDE_CODE_ALT_SCREEN_FULL_REPAINT`| Set to `1` to repaint the entire screen on every frame in [fullscreen rendering](</docs/en/fullscreen>) instead of sending incremental updates. Use this if fullscreen mode shows stale or misplaced text fragments. Claude Code enables this automatically for background sessions and [agent view](</docs/en/agent-view>) on Windows `CLAUDE_CODE_API_KEY_HELPER_TTL_MS`| Interval in milliseconds at which credentials should be refreshed (when using [`apiKeyHelper`](</docs/en/settings#available-settings>)) `CLAUDE_CODE_ATTRIBUTION_HEADER`| Set to `0` to omit the attribution block (client version and prompt fingerprint) from the start of the system prompt. Disabling it improves prompt-cache hit rates when routing through an [LLM gateway](</docs/en/llm-gateway>). Anthropic API caching is unaffected `CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the context capacity in tokens used for auto-compaction calculations. Defaults to the model’s context window: 200K for standard models or 1M for [extended context](</docs/en/model-config#extended-context>) models. Use a lower value like `500000` on a 1M model to treat the window as 500K for compaction purposes. The value is capped at the model’s actual context window. `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` is applied as a percentage of this value. Setting this variable decouples the compaction threshold from the status line’s `used_percentage`, which always uses the model’s full context window @@ -312,7 +312,7 @@ `MCP_REMOTE_SERVER_CONNECTION_BATCH_SIZE`| Maximum number of remote MCP servers (HTTP/SSE) to connect in parallel during startup (default: 20) `MCP_SERVER_CONNECTION_BATCH_SIZE`| Maximum number of local MCP servers (stdio) to connect in parallel during startup (default: 3) `MCP_TIMEOUT`| Timeout in milliseconds for MCP server startup (default: 30000, or 30 seconds) -`MCP_TOOL_TIMEOUT`| Timeout in milliseconds for MCP tool execution (default: 100000000, about 28 hours) +`MCP_TOOL_TIMEOUT`| Timeout in milliseconds for MCP tool execution (default: 100000000, about 28 hours). A per-server `timeout` field in `.mcp.json` overrides this for that server. Values below 1000 are floored to one second `NO_PROXY`| List of domains and IPs to which requests will be directly issued, bypassing proxy `OTEL_LOG_RAW_API_BODIES`| Emit Anthropic Messages API request and response JSON as `api_request_body` / `api_response_body` log events. Set to `1` for inline bodies truncated at 60 KB, or `file:<dir>` to write untruncated bodies to disk and emit a `body_ref` path instead. Disabled by default; bodies include the entire conversation history. See [Monitoring](</docs/en/monitoring-usage#api-request-body-event>) `OTEL_LOG_TOOL_CONTENT`| Set to `1` to include tool input and output content in OpenTelemetry span events. Disabled by default to protect sensitive data. See [Monitoring](</docs/en/monitoring-usage>)
modified
Show diff (167 lines)
--- a/env-vars.md +++ b/env-vars.md @@ -4,7 +4,90 @@ > > Use this file to discover all available pages before exploring further. -Claude Code supports the following environment variables to control its behavior. Set them in your shell before launching `claude`, or configure them in [`settings.json`](</docs/en/settings#available-settings>) under the `env` key to apply them to every session or roll them out across your team. +Environment variables can control Claude Code behavior such as model selection, authentication, request routing, and feature toggles. Many of the same behaviors can also be configured through a [settings file](</docs/en/settings>) field, a [CLI flag](</docs/en/cli-reference>), or an in-session command like `/model`. This page covers how to: + + * Set environment variables in your shell or in a settings file + * Check which value applies when a behavior can be set more than one way + * Look up the variables Claude Code reads + +## + +​ + +Set environment variables + +A variable you set in your shell lasts for that terminal session, while a variable in a settings file applies every time `claude` runs. + +### + +​ + +In your shell + +Set the variable before launching `claude`: + + * macOS, Linux, WSL + + * Windows PowerShell + + * Windows CMD + + export API_TIMEOUT_MS="1200000" + claude + +To set it for every session, add the `export` line to `~/.bashrc`, `~/.zshrc`, or your shell’s profile file. + + $env:API_TIMEOUT_MS = "1200000" + claude + +To set it for every session, run `[Environment]::SetEnvironmentVariable("API_TIMEOUT_MS", "1200000", "User")` and open a new terminal. + + set API_TIMEOUT_MS=1200000 + claude + +To set it for every session, run `setx API_TIMEOUT_MS "1200000"` and open a new terminal. + +### + +​ + +In settings files + +Add variables under the `env` key in a `settings.json` file. Claude Code reads them directly from the file at startup, so they take effect no matter how `claude` was launched. + +~/.claude/settings.json + + { + "env": { + "API_TIMEOUT_MS": "1200000", + "BASH_DEFAULT_TIMEOUT_MS": "300000" + } + } + +The file you choose controls who the variables apply to: + +File| Applies to +---|--- +`~/.claude/settings.json`| You, in every project +`.claude/settings.json`| Everyone working in the project, checked into source control +`.claude/settings.local.json`| You, in this project only, not checked in +Managed settings| Everyone in your organization, deployed by an admin + +See [Settings files](</docs/en/settings#settings-files>) for where each file lives and [Settings precedence](</docs/en/settings#settings-precedence>) for how they combine when more than one sets the same variable. + +## + +​ + +Precedence + +Where the same behavior has both an environment variable and a settings field, the environment variable takes precedence. For example, `ANTHROPIC_MODEL` overrides the `model` setting, and `CLAUDE_CODE_AUTO_CONNECT_IDE` overrides `autoConnectIde`. The settings field applies when the environment variable is not set. How an environment variable interacts with CLI flags and in-session commands varies per feature: `--model` and `/model` override `ANTHROPIC_MODEL`, while `CLAUDE_CODE_EFFORT_LEVEL` overrides `/effort`. When a variable interacts with another configuration source, its row in the Variables list states the precedence or links to the page that documents it. Claude Code reads environment variables at startup, so changes take effect the next time you launch `claude`. + +## + +​ + +Variables Variable| Purpose ---|--- @@ -50,7 +133,7 @@ `BASH_MAX_OUTPUT_LENGTH`| Maximum number of characters in bash outputs before the full output is saved to a file and Claude receives the path plus a short preview. See [Bash tool behavior](</docs/en/tools-reference#bash-tool-behavior>) `BASH_MAX_TIMEOUT_MS`| Maximum timeout the model can set for long-running bash commands (default: 600000, or 10 minutes) `CCR_FORCE_BUNDLE`| Set to `1` to force [`claude --remote`](</docs/en/claude-code-on-the-web#send-local-repositories-without-github>) to bundle and upload your local repository even when GitHub access is available -`CLAUDECODE`| Set to `1` in shell environments Claude Code spawns (Bash tool, tmux sessions). Not set in [hooks](</docs/en/hooks>) or [status line](</docs/en/statusline>) commands. Use to detect when a script is running inside a shell spawned by Claude Code +`CLAUDECODE`| Set to `1` in subprocesses Claude Code spawns (Bash and PowerShell tools, tmux sessions, [hook](</docs/en/hooks>) commands, [status line](</docs/en/statusline>) commands). Use to detect when a script is running inside a subprocess spawned by Claude Code `CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS`| Set to `1` to disable all built-in [subagent](</docs/en/sub-agents>) types such as Explore and Plan. Only applies in non-interactive mode (the `-p` flag). Useful for SDK users who want a blank slate `CLAUDE_AGENT_SDK_MCP_NO_PREFIX`| Set to `1` to skip the `mcp__<server>__` prefix on tool names from SDK-created MCP servers. Tools use their original names. SDK usage only `CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS`| Stall timeout in milliseconds for background subagents. Default `600000` (10 minutes). The timer resets on each streaming progress event; if no progress arrives within the window, the subagent is aborted and the task is marked failed, surfacing any partial result to the parent @@ -59,6 +142,7 @@ `CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR`| Return to the original working directory after each Bash or PowerShell command in the main session `CLAUDE_CODE_ACCESSIBILITY`| Set to `1` to keep the native terminal cursor visible and disable the inverted-text cursor indicator. Allows screen magnifiers like macOS Zoom to track cursor position `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD`| Set to `1` to load memory files from directories specified with `--add-dir`. Loads `CLAUDE.md`, `.claude/CLAUDE.md`, `.claude/rules/*.md`, and `CLAUDE.local.md`. By default, additional directories do not load memory files +`CLAUDE_CODE_ALT_SCREEN_FULL_REPAINT`| Set to `1` to repaint the entire screen on every frame in [fullscreen rendering](</docs/en/fullscreen>) instead of sending incremental updates. Use this if fullscreen mode shows stale or misplaced text fragments. Claude Code enables this automatically for background sessions on Windows `CLAUDE_CODE_API_KEY_HELPER_TTL_MS`| Interval in milliseconds at which credentials should be refreshed (when using [`apiKeyHelper`](</docs/en/settings#available-settings>)) `CLAUDE_CODE_ATTRIBUTION_HEADER`| Set to `0` to omit the attribution block (client version and prompt fingerprint) from the start of the system prompt. Disabling it improves prompt-cache hit rates when routing through an [LLM gateway](</docs/en/llm-gateway>). Anthropic API caching is unaffected `CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the context capacity in tokens used for auto-compaction calculations. Defaults to the model’s context window: 200K for standard models or 1M for [extended context](</docs/en/model-config#extended-context>) models. Use a lower value like `500000` on a 1M model to treat the window as 500K for compaction purposes. The value is capped at the model’s actual context window. `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` is applied as a percentage of this value. Setting this variable decouples the compaction threshold from the status line’s `used_percentage`, which always uses the model’s full context window @@ -94,7 +178,7 @@ `CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL`| Set to `1` to disable virtual scrolling in [fullscreen rendering](</docs/en/fullscreen>) and render every message in the transcript. Use this if scrolling in fullscreen mode shows blank regions where messages should appear `CLAUDE_CODE_EFFORT_LEVEL`| Set the effort level for supported models. Values: `low`, `medium`, `high`, `xhigh`, `max`, or `auto` to use the model default. Available levels depend on the model. Takes precedence over `/effort` and the `effortLevel` setting. See [Adjust effort level](</docs/en/model-config#adjust-effort-level>) `CLAUDE_CODE_ENABLE_AWAY_SUMMARY`| Override [session recap](</docs/en/interactive-mode#session-recap>) availability. Set to `0` to force recaps off regardless of the `/config` toggle. Set to `1` to force recaps on when [`awaySummaryEnabled`](</docs/en/settings#available-settings>) is `false`. Takes precedence over the setting and `/config` toggle -`CLAUDE_CODE_ENABLE_BACKGROUND_PLUGIN_REFRESH`| Set to `1` to refresh plugin state at turn boundaries in [non-interactive mode](</docs/en/headless>) after a background install completes. Off by default because the refresh changes the system prompt mid-session, which invalidates [prompt caching](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching>) for that turn +`CLAUDE_CODE_ENABLE_BACKGROUND_PLUGIN_REFRESH`| Set to `1` to refresh plugin state at turn boundaries in [non-interactive mode](</docs/en/headless>) after a background install completes. Off by default because the refresh changes the system prompt mid-session, which invalidates [prompt caching](</docs/en/prompt-caching>) for that turn `CLAUDE_CODE_ENABLE_FEEDBACK_SURVEY_FOR_OTEL`| Set to `1` to route the “How is Claude doing?” session quality survey to your own [OpenTelemetry collector](</docs/en/monitoring-usage>) when Anthropic-bound nonessential traffic is blocked. Survey ratings are emitted only as OTEL events to your configured collector. No survey data is sent to Anthropic in this mode. Applies when `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`, `DISABLE_TELEMETRY`, or `DO_NOT_TRACK` is set, and has no effect otherwise. `CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY` and the organization product feedback policy take precedence `CLAUDE_CODE_ENABLE_FINE_GRAINED_TOOL_STREAMING`| Controls whether tool call inputs stream from the API as Claude generates them. With this off, a large tool input such as a long file write arrives only after Claude finishes generating it, which can look like it’s hanging. Enabled by default on the Anthropic API. On Bedrock and Vertex, enabled per model where the deployed container supports it. Set to `0` to opt out. Set to `1` to force on when routing through a proxy via `ANTHROPIC_BASE_URL`, `ANTHROPIC_VERTEX_BASE_URL`, or `ANTHROPIC_BEDROCK_BASE_URL`. Off by default on Foundry and [gateway](</docs/en/llm-gateway>) connections `CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY`| Set to `1` to populate the `/model` picker from your gateway’s `/v1/models` endpoint when `ANTHROPIC_BASE_URL` points at an Anthropic-compatible gateway such as LiteLLM, Kong, or an internal proxy. Off by default because gateways backed by a shared API key would otherwise show every user every model the key can access. Discovered models are still filtered by the [`availableModels`](</docs/en/settings#available-settings>) allowlist @@ -137,7 +221,7 @@ `CLAUDE_CODE_PLUGIN_CACHE_DIR`| Override the plugins root directory. Despite the name, this sets the parent directory, not the cache itself: marketplaces and the plugin cache live in subdirectories under this path. Defaults to `~/.claude/plugins` `CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS`| Timeout in milliseconds for git operations when installing or updating plugins (default: 120000). Increase this value for large repositories or slow network connections. See [Git operations time out](</docs/en/plugin-marketplaces#git-operations-time-out>) `CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE`| Set to `1` to keep the existing marketplace cache when a `git pull` fails instead of wiping and re-cloning. Useful in offline or airgapped environments where re-cloning would fail the same way. See [Marketplace updates fail in offline environments](</docs/en/plugin-marketplaces#marketplace-updates-fail-in-offline-environments>) -`CLAUDE_CODE_PLUGIN_PREFER_HTTPS`| Set to `1` to clone GitHub `owner/repo` plugin sources over HTTPS instead of SSH. Useful in CI runners, containers, or any environment without a configured SSH key for `github.com` +`CLAUDE_CODE_PLUGIN_PREFER_HTTPS`| Set to `1` to clone GitHub `owner/repo` shorthand sources over HTTPS instead of SSH. Applies to plugin install and update, and to `/plugin marketplace add` and `update`. Useful in CI runners, containers, or any environment without a configured SSH key for `github.com` `CLAUDE_CODE_PLUGIN_SEED_DIR`| Path to one or more read-only plugin seed directories, separated by `:` on Unix or `;` on Windows. Use this to bundle a pre-populated plugins directory into a container image. Claude Code registers marketplaces from these directories at startup and uses pre-cached plugins without re-cloning. See [Pre-populate plugins for containers](</docs/en/plugin-marketplaces#pre-populate-plugins-for-containers>) `CLAUDE_CODE_POWERSHELL_RESPECT_EXECUTION_POLICY`| Set to `1` to stop Claude Code from passing `-ExecutionPolicy Bypass` when spawning PowerShell for tool calls, hooks, and status line commands, and respect the machine’s effective execution policy instead. By default Claude Code bypasses execution policy at process scope so `.ps1` scripts and module imports work on default-Restricted Windows installs. Process-scope bypass never overrides Group Policy `MachinePolicy` or `UserPolicy` regardless of this setting `CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`| Set by host platforms that embed Claude Code and manage model provider routing on its behalf. When set, provider-selection, endpoint, and authentication variables such as `CLAUDE_CODE_USE_BEDROCK`, `ANTHROPIC_BASE_URL`, and `ANTHROPIC_API_KEY` in settings files are ignored so user settings cannot override the host’s routing. The automatic telemetry opt-out for Bedrock, Vertex, and Foundry is also skipped, so telemetry follows the standard `DISABLE_TELEMETRY` opt-out. See [Default behaviors by API provider](</docs/en/data-usage#default-behaviors-by-api-provider>) @@ -149,7 +233,7 @@ `CLAUDE_CODE_SCRIPT_CAPS`| JSON object limiting how many times specific scripts may be invoked per session when `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB` is set. Keys are substrings matched against the command text; values are integer call limits. For example, `{"deploy.sh": 2}` allows `deploy.sh` to be called at most twice. Matching is substring-based so shell-expansion tricks like `./scripts/deploy.sh $(evil)` still count against the cap. Runtime fan-out via `xargs` or `find -exec` is not detected; this is a defense-in-depth control `CLAUDE_CODE_SCROLL_SPEED`| Set the mouse wheel scroll multiplier in [fullscreen rendering](</docs/en/fullscreen#mouse-wheel-scrolling>). Accepts values from 1 to 20. Set to `3` to match `vim` if your terminal sends one wheel event per notch without amplification. Ignored in the JetBrains IDE terminal, where Claude Code uses its own scroll handling `CLAUDE_CODE_SESSIONEND_HOOKS_TIMEOUT_MS`| Override the time budget in milliseconds for [SessionEnd](</docs/en/hooks#sessionend>) hooks. Applies to session exit, `/clear`, and switching sessions via interactive `/resume`. By default the budget is 1.5 seconds, automatically raised to the highest per-hook `timeout` configured in settings files, up to 60 seconds. Timeouts on plugin-provided hooks do not raise the budget -`CLAUDE_CODE_SESSION_ID`| Set automatically in Bash and PowerShell tool subprocesses to the current session ID. Matches the `session_id` field passed to [hooks](</docs/en/hooks>). Updated on `/clear`. Use to correlate scripts and external tools with the Claude Code session that launched them +`CLAUDE_CODE_SESSION_ID`| Set automatically in Bash and PowerShell tool subprocesses and in [hook command](</docs/en/hooks>) subprocesses to the current session ID. Matches the `session_id` field in the hook JSON input. Updated on `/clear`. Use to correlate scripts and external tools with the Claude Code session that launched them `CLAUDE_CODE_SHELL`| Override automatic shell detection. Useful when your login shell differs from your preferred working shell (for example, `bash` vs `zsh`) `CLAUDE_CODE_SHELL_PREFIX`| Command prefix that wraps shell commands Claude Code spawns: Bash tool calls, [hook](</docs/en/hooks>) commands, and stdio [MCP server](</docs/en/mcp>) startup commands. Useful for logging or auditing. Example: setting `/path/to/logger.sh` runs each command as `/path/to/logger.sh <command>` `CLAUDE_CODE_SIMPLE`| Set to `1` to run with a minimal system prompt and only the Bash, file read, and file edit tools. MCP tools from `--mcp-config` are still available. Disables auto-discovery of hooks, skills, plugins, MCP servers, auto memory, and CLAUDE.md. OAuth tokens and keychain credentials are not read, so Anthropic authentication must come from `ANTHROPIC_API_KEY` or an `apiKeyHelper` in `--settings`. Equivalent to passing [`--bare`](</docs/en/headless#start-faster-with-bare-mode>) @@ -200,16 +284,16 @@ `DISABLE_INTERLEAVED_THINKING`| Set to `1` to prevent sending the interleaved-thinking beta header. Useful when your LLM gateway or provider does not support [interleaved thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking#interleaved-thinking>) `DISABLE_LOGIN_COMMAND`| Set to `1` to hide the `/login` command. Useful when authentication is handled externally via API keys or `apiKeyHelper` `DISABLE_LOGOUT_COMMAND`| Set to `1` to hide the `/logout` command -`DISABLE_PROMPT_CACHING`| Set to `1` to disable prompt caching for all models (takes precedence over per-model settings) +`DISABLE_PROMPT_CACHING`| Set to `1` to disable [prompt caching](</docs/en/prompt-caching#disable-prompt-caching>) for all models (takes precedence over per-model settings) `DISABLE_PROMPT_CACHING_HAIKU`| Set to `1` to disable prompt caching for Haiku models `DISABLE_PROMPT_CACHING_OPUS`| Set to `1` to disable prompt caching for Opus models `DISABLE_PROMPT_CACHING_SONNET`| Set to `1` to disable prompt caching for Sonnet models -`DISABLE_TELEMETRY`| Set to `1` to opt out of telemetry. Telemetry events do not include user data like code, file paths, or bash commands. Also disables feature flags, so some features that are still rolling out may not be available +`DISABLE_TELEMETRY`| Set to `1` to opt out of telemetry. Telemetry events do not include user data like code, file paths, or bash commands. Also disables feature-flag fetching with the same effect as `DISABLE_GROWTHBOOK`, so some flagged features may be unavailable `DISABLE_UPDATES`| Set to `1` to block all updates including manual `claude update` and `claude install`. Stricter than `DISABLE_AUTOUPDATER`. Use when distributing Claude Code through your own channels and users should not self-update `DISABLE_UPGRADE_COMMAND`| Set to `1` to hide the `/upgrade` command `DO_NOT_TRACK`| Set to `1` to opt out of telemetry. Equivalent to setting `DISABLE_TELEMETRY`. Honored as the [standard cross-tool convention](<https://consoledonottrack.com/>) `ENABLE_CLAUDEAI_MCP_SERVERS`| Set to `false` to disable [claude.ai MCP servers](</docs/en/mcp#use-mcp-servers-from-claude-ai>) in Claude Code. Enabled by default for logged-in users -`ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour prompt cache TTL instead of the default 5 minutes. Intended for API key, [Bedrock](</docs/en/amazon-bedrock>), [Vertex](</docs/en/google-vertex-ai>), [Foundry](</docs/en/microsoft-foundry>), and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) users. Subscription users receive 1-hour TTL automatically. 1-hour cache writes are billed at a higher rate +`ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour [prompt cache TTL](</docs/en/prompt-caching#cache-lifetime>) instead of the default 5 minutes. Intended for API key, [Bedrock](</docs/en/amazon-bedrock>), [Vertex](</docs/en/google-vertex-ai>), [Foundry](</docs/en/microsoft-foundry>), and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) users. Subscription users within included usage receive 1-hour TTL automatically. 1-hour cache writes are billed at a higher rate `ENABLE_PROMPT_CACHING_1H_BEDROCK`| Deprecated. Use `ENABLE_PROMPT_CACHING_1H` instead `ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset: all MCP tools deferred by default, but loaded upfront on Vertex AI or when `ANTHROPIC_BASE_URL` points to a non-first-party host. Values: `true` (always defer and send the beta header, requests fail on Vertex AI models earlier than Sonnet 4.5 or Opus 4.5, or on proxies that do not support `tool_reference`), `auto` (threshold mode: load upfront if tools fit within 10% of context), `auto:N` (custom threshold, e.g., `auto:5` for 5%), `false` (load all upfront) `FALLBACK_FOR_ALL_PRIMARY_MODELS`| Set to any non-empty value to trigger fallback to [`--fallback-model`](</docs/en/cli-reference#cli-flags>) after repeated overload errors on any primary model. By default, only Opus models trigger the fallback @@ -261,7 +345,7 @@ See also - * [Settings](</docs/en/settings>): configure environment variables in `settings.json` so they apply to every session + * [Settings](</docs/en/settings>): all `settings.json` configuration, including the `env` key * [CLI reference](</docs/en/cli-reference>): launch-time flags * [Network configuration](</docs/en/network-config>): proxy and TLS setup * [Monitoring](</docs/en/monitoring-usage>): OpenTelemetry configuration
modified
--- a/env-vars.md +++ b/env-vars.md @@ -98,9 +98,9 @@ `CLAUDE_CODE_ENABLE_FEEDBACK_SURVEY_FOR_OTEL`| Set to `1` to route the “How is Claude doing?” session quality survey to your own [OpenTelemetry collector](</docs/en/monitoring-usage>) when Anthropic-bound nonessential traffic is blocked. Survey ratings are emitted only as OTEL events to your configured collector. No survey data is sent to Anthropic in this mode. Applies when `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`, `DISABLE_TELEMETRY`, or `DO_NOT_TRACK` is set, and has no effect otherwise. `CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY` and the organization product feedback policy take precedence `CLAUDE_CODE_ENABLE_FINE_GRAINED_TOOL_STREAMING`| Controls whether tool call inputs stream from the API as Claude generates them. With this off, a large tool input such as a long file write arrives only after Claude finishes generating it, which can look like it’s hanging. Enabled by default on the Anthropic API. On Bedrock and Vertex, enabled per model where the deployed container supports it. Set to `0` to opt out. Set to `1` to force on when routing through a proxy via `ANTHROPIC_BASE_URL`, `ANTHROPIC_VERTEX_BASE_URL`, or `ANTHROPIC_BEDROCK_BASE_URL`. Off by default on Foundry and [gateway](</docs/en/llm-gateway>) connections `CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY`| Set to `1` to populate the `/model` picker from your gateway’s `/v1/models` endpoint when `ANTHROPIC_BASE_URL` points at an Anthropic-compatible gateway such as LiteLLM, Kong, or an internal proxy. Off by default because gateways backed by a shared API key would otherwise show every user every model the key can access. Discovered models are still filtered by the [`availableModels`](</docs/en/settings#available-settings>) allowlist -`CLAUDE_CODE_ENABLE_OPUS_4_7_FAST_MODE`| Set to `1` to run [fast mode](</docs/en/fast-mode>) on Claude Opus 4.7 instead of Opus 4.6. With the variable set, `/fast` switches to Opus 4.7; without it, `/fast` continues to use Opus 4.6 +`CLAUDE_CODE_ENABLE_OPUS_4_7_FAST_MODE`| Removed in v2.1.142. [Fast mode](</docs/en/fast-mode>) defaults to Opus 4.7. Set `CLAUDE_CODE_OPUS_4_6_FAST_MODE_OVERRIDE=1` to keep Opus 4.6 instead `CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION`| Set to `false` to disable prompt suggestions (the “Prompt suggestions” toggle in `/config`). These are the grayed-out predictions that appear in your prompt input after Claude responds. See [Prompt suggestions](</docs/en/interactive-mode#prompt-suggestions>) -`CLAUDE_CODE_ENABLE_TASKS`| Set to `1` to enable the task tracking system in non-interactive mode (the `-p` flag). Tasks are on by default in interactive mode. See [Task list](</docs/en/interactive-mode#task-list>) +`CLAUDE_CODE_ENABLE_TASKS`| Controls whether sessions use the structured Task tools (`TaskCreate`, `TaskUpdate`, `TaskGet`, `TaskList`) or the legacy `TodoWrite` tool. As of Claude Code v2.1.142, Task tools are the default in all modes. Set to `0` to revert to `TodoWrite`. See [Task list](</docs/en/interactive-mode#task-list>) and [Migrate to Task tools](</docs/en/agent-sdk/todo-tracking#migrate-to-task-tools>) `CLAUDE_CODE_ENABLE_TELEMETRY`| Set to `1` to enable OpenTelemetry data collection for metrics and logging. Required before configuring OTel exporters. See [Monitoring](</docs/en/monitoring-usage>) `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 `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS`| Set to `1` to enable [agent teams](</docs/en/agent-teams>). Agent teams are experimental and disabled by default @@ -128,7 +128,7 @@ `CLAUDE_CODE_OAUTH_REFRESH_TOKEN`| OAuth refresh token for Claude.ai authentication. When set, `claude auth login` exchanges this token directly instead of opening a browser. Requires `CLAUDE_CODE_OAUTH_SCOPES`. Useful for provisioning authentication in automated environments `CLAUDE_CODE_OAUTH_SCOPES`| Space-separated OAuth scopes the refresh token was issued with, such as `"user:profile user:inference user:sessions:claude_code"`. Required when `CLAUDE_CODE_OAUTH_REFRESH_TOKEN` is set `CLAUDE_CODE_OAUTH_TOKEN`| OAuth access token for Claude.ai authentication. Alternative to `/login` for SDK and automated environments. Takes precedence over keychain-stored credentials. Generate one with [`claude setup-token`](</docs/en/authentication#generate-a-long-lived-token>) -`CLAUDE_CODE_OPUS_4_6_FAST_MODE_OVERRIDE`| Set to `1` to keep [fast mode](</docs/en/fast-mode>) on Claude Opus 4.6. Takes precedence over `CLAUDE_CODE_ENABLE_OPUS_4_7_FAST_MODE`, so set this if you need to pin Opus 4.6 regardless of how the default changes +`CLAUDE_CODE_OPUS_4_6_FAST_MODE_OVERRIDE`| Set to `1` to pin [fast mode](</docs/en/fast-mode>) to Claude Opus 4.6 instead of the default Opus 4.7. With the variable set, `/fast` runs on Opus 4.6. Without it, `/fast` runs on Opus 4.7 `CLAUDE_CODE_OTEL_FLUSH_TIMEOUT_MS`| Timeout in milliseconds for flushing pending OpenTelemetry spans (default: 5000). See [Monitoring](</docs/en/monitoring-usage>) `CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS`| Interval for refreshing dynamic OpenTelemetry headers in milliseconds (default: 1740000 / 29 minutes). See [Dynamic headers](</docs/en/monitoring-usage#dynamic-headers>) `CLAUDE_CODE_OTEL_SHUTDOWN_TIMEOUT_MS`| Timeout in milliseconds for the OpenTelemetry exporter to finish on shutdown (default: 2000). Increase if metrics are dropped at exit. See [Monitoring](</docs/en/monitoring-usage>) @@ -139,6 +139,7 @@ `CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE`| Set to `1` to keep the existing marketplace cache when a `git pull` fails instead of wiping and re-cloning. Useful in offline or airgapped environments where re-cloning would fail the same way. See [Marketplace updates fail in offline environments](</docs/en/plugin-marketplaces#marketplace-updates-fail-in-offline-environments>) `CLAUDE_CODE_PLUGIN_PREFER_HTTPS`| Set to `1` to clone GitHub `owner/repo` plugin sources over HTTPS instead of SSH. Useful in CI runners, containers, or any environment without a configured SSH key for `github.com` `CLAUDE_CODE_PLUGIN_SEED_DIR`| Path to one or more read-only plugin seed directories, separated by `:` on Unix or `;` on Windows. Use this to bundle a pre-populated plugins directory into a container image. Claude Code registers marketplaces from these directories at startup and uses pre-cached plugins without re-cloning. See [Pre-populate plugins for containers](</docs/en/plugin-marketplaces#pre-populate-plugins-for-containers>) +`CLAUDE_CODE_POWERSHELL_RESPECT_EXECUTION_POLICY`| Set to `1` to stop Claude Code from passing `-ExecutionPolicy Bypass` when spawning PowerShell for tool calls, hooks, and status line commands, and respect the machine’s effective execution policy instead. By default Claude Code bypasses execution policy at process scope so `.ps1` scripts and module imports work on default-Restricted Windows installs. Process-scope bypass never overrides Group Policy `MachinePolicy` or `UserPolicy` regardless of this setting `CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`| Set by host platforms that embed Claude Code and manage model provider routing on its behalf. When set, provider-selection, endpoint, and authentication variables such as `CLAUDE_CODE_USE_BEDROCK`, `ANTHROPIC_BASE_URL`, and `ANTHROPIC_API_KEY` in settings files are ignored so user settings cannot override the host’s routing. The automatic telemetry opt-out for Bedrock, Vertex, and Foundry is also skipped, so telemetry follows the standard `DISABLE_TELEMETRY` opt-out. See [Default behaviors by API provider](</docs/en/data-usage#default-behaviors-by-api-provider>) `CLAUDE_CODE_PROXY_RESOLVES_HOSTS`| Set to `1` to allow the proxy to perform DNS resolution instead of the caller. Opt-in for environments where the proxy should handle hostname resolution `CLAUDE_CODE_REMOTE`| Set automatically to `true` when Claude Code is running as a [cloud session](</docs/en/claude-code-on-the-web>). Read this from a hook or setup script to detect whether you are in a cloud environment @@ -151,7 +152,7 @@ `CLAUDE_CODE_SESSION_ID`| Set automatically in Bash and PowerShell tool subprocesses to the current session ID. Matches the `session_id` field passed to [hooks](</docs/en/hooks>). Updated on `/clear`. Use to correlate scripts and external tools with the Claude Code session that launched them `CLAUDE_CODE_SHELL`| Override automatic shell detection. Useful when your login shell differs from your preferred working shell (for example, `bash` vs `zsh`) `CLAUDE_CODE_SHELL_PREFIX`| Command prefix that wraps shell commands Claude Code spawns: Bash tool calls, [hook](</docs/en/hooks>) commands, and stdio [MCP server](</docs/en/mcp>) startup commands. Useful for logging or auditing. Example: setting `/path/to/logger.sh` runs each command as `/path/to/logger.sh <command>` -`CLAUDE_CODE_SIMPLE`| Set to `1` to run with a minimal system prompt and only the Bash, file read, and file edit tools. MCP tools from `--mcp-config` are still available. Disables auto-discovery of hooks, skills, plugins, MCP servers, auto memory, and CLAUDE.md. The [`--bare`](</docs/en/headless#start-faster-with-bare-mode>) CLI flag sets this +`CLAUDE_CODE_SIMPLE`| Set to `1` to run with a minimal system prompt and only the Bash, file read, and file edit tools. MCP tools from `--mcp-config` are still available. Disables auto-discovery of hooks, skills, plugins, MCP servers, auto memory, and CLAUDE.md. OAuth tokens and keychain credentials are not read, so Anthropic authentication must come from `ANTHROPIC_API_KEY` or an `apiKeyHelper` in `--settings`. Equivalent to passing [`--bare`](</docs/en/headless#start-faster-with-bare-mode>) `CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT`| Set to `1` to use a shorter system prompt and abbreviated tool descriptions on any model. Set to `0`, `false`, `no`, or `off` to opt out even on models where the experiment or server configuration would otherwise enable it. The full tool set, hooks, MCP servers, and CLAUDE.md discovery remain enabled `CLAUDE_CODE_SKIP_ANTHROPIC_AWS_AUTH`| Skip client-side authentication for [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), for gateways that sign requests themselves `CLAUDE_CODE_SKIP_BEDROCK_AUTH`| Skip AWS authentication for Bedrock (for example, when using an LLM gateway) @@ -159,6 +160,7 @@ `CLAUDE_CODE_SKIP_MANTLE_AUTH`| Skip AWS authentication for Bedrock Mantle (for example, when using an LLM gateway) `CLAUDE_CODE_SKIP_PROMPT_HISTORY`| Set to `1` to skip writing prompt history and session transcripts to disk. Sessions started with this variable set do not appear in `--resume`, `--continue`, or up-arrow history. Useful for ephemeral scripted sessions `CLAUDE_CODE_SKIP_VERTEX_AUTH`| Skip Google authentication for Vertex (for example, when using an LLM gateway) +`CLAUDE_CODE_STOP_HOOK_BLOCK_CAP`| Maximum number of consecutive times a [Stop](</docs/en/hooks#stop>) or [SubagentStop](</docs/en/hooks#subagentstop>) hook may block the turn from ending before Claude Code overrides it and ends the turn anyway (default: 8). Set to `0` to disable the cap. Raise this if your hook legitimately needs more iterations to resolve `CLAUDE_CODE_SUBAGENT_MODEL`| See [Model configuration](</docs/en/model-config>) `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB`| Set to `1` to strip Anthropic and cloud provider credentials from subprocess environments (Bash tool, hooks, MCP stdio servers). The parent Claude process keeps these credentials for API calls, but child processes cannot read them, reducing exposure to prompt injection attacks that attempt to exfiltrate secrets via shell expansion. On Linux, this also runs Bash subprocesses in an isolated PID namespace so they cannot read host process environments via `/proc`; as a side effect, `ps`, `pgrep`, and `kill` cannot see or signal host processes. `claude-code-action` sets this automatically when `allowed_non_write_users` is configured `CLAUDE_CODE_SYNC_PLUGIN_INSTALL`| Set to `1` in non-interactive mode (the `-p` flag) to wait for plugin installation to complete before the first query. Without this, plugins install in the background and may not be available on the first turn. Combine with `CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS` to bound the wait @@ -178,10 +180,11 @@ `CLAUDE_CONFIG_DIR`| Override the configuration directory (default: `~/.claude`). All settings, credentials, session history, and plugins are stored under this path. Useful for running multiple accounts side by side: for example, `alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'` `CLAUDE_EFFORT`| Set automatically in Bash tool subprocesses and hook commands to the active [effort level](</docs/en/model-config#adjust-effort-level>) for the turn: `low`, `medium`, `high`, `xhigh`, or `max`. Matches the `effort.level` field passed to [hooks](</docs/en/hooks>). Only set when the current model supports the effort parameter `CLAUDE_ENABLE_BYTE_WATCHDOG`| Set to `1` to force-enable the byte-level streaming idle watchdog, or set to `0` to force-disable it. When unset, the watchdog is enabled by default for Anthropic API connections. The byte watchdog aborts a connection when no bytes arrive on the wire for the duration set by `CLAUDE_STREAM_IDLE_TIMEOUT_MS`, with a minimum of 5 minutes, independent of the event-level watchdog -`CLAUDE_ENABLE_STREAM_WATCHDOG`| Set to `1` to enable the event-level streaming idle watchdog. Off by default. For Bedrock, Vertex, and Foundry, this is the only idle watchdog available. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS` +`CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK`| Set to `1` to enable the byte-level streaming idle watchdog on Amazon Bedrock `vnd.amazon.eventstream` responses. Off by default. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS` +`CLAUDE_ENABLE_STREAM_WATCHDOG`| Set to `1` to enable the event-level streaming idle watchdog. Off by default. Applies to all providers, including Bedrock. For Vertex and Foundry, this is the only idle watchdog available. On Bedrock, you can also enable the independent byte-level watchdog with `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK`; the two run together when both are set. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS` `CLAUDE_ENV_FILE`| Path to a shell script whose contents Claude Code runs before each Bash command in the same shell process, so exports in the file are visible to the command. Use to persist virtualenv or conda activation across commands. Also populated dynamically by [SessionStart](</docs/en/hooks#persist-environment-variables>), [Setup](</docs/en/hooks#setup>), [CwdChanged](</docs/en/hooks#cwdchanged>), and [FileChanged](</docs/en/hooks#filechanged>) hooks `CLAUDE_REMOTE_CONTROL_SESSION_NAME_PREFIX`| Prefix for auto-generated [Remote Control](</docs/en/remote-control>) session names when no explicit name is provided. Defaults to your machine’s hostname, producing names like `myhost-graceful-unicorn`. The `--remote-control-session-name-prefix` CLI flag sets the same value for a single invocation -`CLAUDE_STREAM_IDLE_TIMEOUT_MS`| Timeout in milliseconds before the streaming idle watchdog closes a stalled connection. Default and minimum `300000` (5 minutes) for both the byte-level and event-level watchdogs; lower values are silently clamped to absorb extended thinking pauses and proxy buffering. For third-party providers, requires `CLAUDE_ENABLE_STREAM_WATCHDOG=1` +`CLAUDE_STREAM_IDLE_TIMEOUT_MS`| Timeout in milliseconds before the streaming idle watchdog closes a stalled connection. Default and minimum `300000` (5 minutes) for both the byte-level and event-level watchdogs; lower values are silently clamped to absorb extended thinking pauses and proxy buffering. For third-party providers, requires `CLAUDE_ENABLE_STREAM_WATCHDOG=1`. On Bedrock, also applies when `CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK=1` `DEBUG`| Set to `1` to enable debug mode, equivalent to launching with [`--debug`](</docs/en/cli-reference#cli-flags>). Debug logs are written to `~/.claude/debug/<session-id>.txt`, or to the path set by `CLAUDE_CODE_DEBUG_LOGS_DIR`. Only the truthy values `1`, `true`, `yes`, and `on` enable debug mode, so namespace patterns like `DEBUG=express:*` set for other tools do not trigger it `DISABLE_AUTOUPDATER`| Set to `1` to disable automatic background updates. Manual `claude update` still works. Use `DISABLE_UPDATES` to block both `DISABLE_AUTO_COMPACT`| Set to `1` to disable automatic compaction when approaching the context limit. The manual `/compact` command remains available. Use when you want explicit control over when compaction occurs @@ -189,7 +192,7 @@ `DISABLE_COST_WARNINGS`| Set to `1` to disable cost warning messages `DISABLE_DOCTOR_COMMAND`| Set to `1` to hide the `/doctor` command. Useful for managed deployments where users should not run installation diagnostics `DISABLE_ERROR_REPORTING`| Set to `1` to opt out of Sentry error reporting -`DISABLE_EXTRA_USAGE_COMMAND`| Set to `1` to hide the `/extra-usage` command that lets users purchase additional usage beyond rate limits +`DISABLE_EXTRA_USAGE_COMMAND`| Set to `1` to hide the `/usage-credits` command that lets users purchase additional usage beyond rate limits `DISABLE_FEEDBACK_COMMAND`| Set to `1` to disable the `/feedback` command. The older name `DISABLE_BUG_COMMAND` is also accepted `DISABLE_GROWTHBOOK`| Set to `1` to disable GrowthBook feature-flag fetching and use code defaults for every flag. Telemetry event logging stays on unless `DISABLE_TELEMETRY` is also set `DISABLE_INSTALLATION_CHECKS`| Set to `1` to disable installation warnings. Use only when manually managing the installation location, as this can mask issues with standard installations @@ -208,7 +211,7 @@ `ENABLE_CLAUDEAI_MCP_SERVERS`| Set to `false` to disable [claude.ai MCP servers](</docs/en/mcp#use-mcp-servers-from-claude-ai>) in Claude Code. Enabled by default for logged-in users `ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour prompt cache TTL instead of the default 5 minutes. Intended for API key, [Bedrock](</docs/en/amazon-bedrock>), [Vertex](</docs/en/google-vertex-ai>), [Foundry](</docs/en/microsoft-foundry>), and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) users. Subscription users receive 1-hour TTL automatically. 1-hour cache writes are billed at a higher rate `ENABLE_PROMPT_CACHING_1H_BEDROCK`| Deprecated. Use `ENABLE_PROMPT_CACHING_1H` instead -`ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset: all MCP tools deferred by default, but loaded upfront on Vertex AI or when `ANTHROPIC_BASE_URL` points to a non-first-party host. Values: `true` (always defer and send the beta header; supported on Vertex AI with Sonnet 4.5 and later or Opus 4.5 and later; requests fail on earlier Vertex AI models or on proxies that do not support `tool_reference`), `auto` (threshold mode: load upfront if tools fit within 10% of context), `auto:N` (custom threshold, e.g., `auto:5` for 5%), `false` (load all upfront) +`ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset: all MCP tools deferred by default, but loaded upfront on Vertex AI or when `ANTHROPIC_BASE_URL` points to a non-first-party host. Values: `true` (always defer and send the beta header, requests fail on Vertex AI models earlier than Sonnet 4.5 or Opus 4.5, or on proxies that do not support `tool_reference`), `auto` (threshold mode: load upfront if tools fit within 10% of context), `auto:N` (custom threshold, e.g., `auto:5` for 5%), `false` (load all upfront) `FALLBACK_FOR_ALL_PRIMARY_MODELS`| Set to any non-empty value to trigger fallback to [`--fallback-model`](</docs/en/cli-reference#cli-flags>) after repeated overload errors on any primary model. By default, only Opus models trigger the fallback `FORCE_AUTOUPDATE_PLUGINS`| Set to `1` to force plugin auto-updates even when the main auto-updater is disabled via `DISABLE_AUTOUPDATER` `FORCE_PROMPT_CACHING_5M`| Set to `1` to force the 5-minute prompt cache TTL even when 1-hour TTL would otherwise apply. Overrides `ENABLE_PROMPT_CACHING_1H` @@ -219,8 +222,8 @@ `MAX_STRUCTURED_OUTPUT_RETRIES`| Number of times to retry when the model’s response fails validation against the [`--json-schema`](</docs/en/cli-reference#cli-flags>) in non-interactive mode (the `-p` flag). Defaults to 5 `MAX_THINKING_TOKENS`| Override the [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) token budget. The ceiling is the model’s [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>) minus one. Set to `0` to disable thinking entirely. On models with [adaptive reasoning](</docs/en/model-config#adjust-effort-level>), the budget is ignored unless adaptive reasoning is disabled via `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` `MCP_CLIENT_SECRET`| OAuth client secret for MCP servers that require [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>). Avoids the interactive prompt when adding a server with `--client-secret` -`MCP_CONNECTION_NONBLOCKING`| Set to `true` in non-interactive mode (`-p`) to skip the MCP connection wait entirely. Useful for scripted pipelines where MCP tools are not needed. Without this variable, the first query waits up to 5 seconds for `--mcp-config` server connections. Servers configured with [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>) always block startup regardless of this variable, since their tools must be present when the first prompt is built -`MCP_CONNECT_TIMEOUT_MS`| How long the first query waits, in milliseconds, for the MCP connection batch before snapshotting the tool list (default: 5000). Servers still pending at the deadline keep connecting in the background but won’t appear until the next query. Distinct from `MCP_TIMEOUT`, which bounds an individual server’s connect attempt. Most relevant to non-interactive sessions that issue a single query and need slow-connecting servers to be visible +`MCP_CONNECTION_NONBLOCKING`| Controls whether startup waits for MCP servers to connect before the first query. As of Claude Code v2.1.142, MCP startup is non-blocking by default: servers connect in the background and their tools become available as they finish. Set to `0` to restore the blocking 5-second connection wait. Servers configured with [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>) still block startup regardless, since their tools must be present when the first prompt is built +`MCP_CONNECT_TIMEOUT_MS`| How long blocking MCP startup waits, in milliseconds, for the connection batch before snapshotting the tool list (default: 5000). Applies when `MCP_CONNECTION_NONBLOCKING=0` or for servers marked [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>). Servers still pending at the deadline keep connecting in the background but won’t appear until the next query. Distinct from `MCP_TIMEOUT`, which bounds an individual server’s connect attempt `MCP_OAUTH_CALLBACK_PORT`| Fixed port for the OAuth redirect callback, as an alternative to `--callback-port` when adding an MCP server with [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>) `MCP_REMOTE_SERVER_CONNECTION_BATCH_SIZE`| Maximum number of remote MCP servers (HTTP/SSE) to connect in parallel during startup (default: 20) `MCP_SERVER_CONNECTION_BATCH_SIZE`| Maximum number of local MCP servers (stdio) to connect in parallel during startup (default: 3)
modified
--- a/env-vars.md +++ b/env-vars.md @@ -40,7 +40,7 @@ `ANTHROPIC_FOUNDRY_RESOURCE`| Foundry resource name (for example, `my-resource`). Required if `ANTHROPIC_FOUNDRY_BASE_URL` is not set (see [Microsoft Foundry](</docs/en/microsoft-foundry>)) `ANTHROPIC_MODEL`| Name of the model setting to use (see [Model Configuration](</docs/en/model-config#environment-variables>)) `ANTHROPIC_SMALL_FAST_MODEL`| [DEPRECATED] Name of [Haiku-class model for background tasks](</docs/en/costs>) -`ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION`| Override AWS region for the Haiku-class model when using Bedrock or Bedrock Mantle +`ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION`| Override AWS region for the Haiku-class model when using Bedrock or Bedrock Mantle. On Bedrock, this only takes effect when `ANTHROPIC_DEFAULT_HAIKU_MODEL` or the deprecated `ANTHROPIC_SMALL_FAST_MODEL` is also set, since Bedrock otherwise uses the primary model for background tasks `ANTHROPIC_VERTEX_BASE_URL`| Override the Vertex AI endpoint URL. Use for custom Vertex endpoints or when routing through an [LLM gateway](</docs/en/llm-gateway>). See [Google Vertex AI](</docs/en/google-vertex-ai>) `ANTHROPIC_VERTEX_PROJECT_ID`| GCP project ID for Vertex AI requests. Overridden by `GCLOUD_PROJECT`, `GOOGLE_CLOUD_PROJECT`, or the project in your `GOOGLE_APPLICATION_CREDENTIALS` credential file. See [Google Vertex AI](</docs/en/google-vertex-ai>) `ANTHROPIC_WORKSPACE_ID`| Workspace ID for [workload identity federation](<https://platform.claude.com/docs/en/manage-claude/workload-identity-federation>). Set this when your federation rule is scoped to more than one workspace so the token exchange knows which workspace to target @@ -208,7 +208,7 @@ `ENABLE_CLAUDEAI_MCP_SERVERS`| Set to `false` to disable [claude.ai MCP servers](</docs/en/mcp#use-mcp-servers-from-claude-ai>) in Claude Code. Enabled by default for logged-in users `ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour prompt cache TTL instead of the default 5 minutes. Intended for API key, [Bedrock](</docs/en/amazon-bedrock>), [Vertex](</docs/en/google-vertex-ai>), [Foundry](</docs/en/microsoft-foundry>), and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) users. Subscription users receive 1-hour TTL automatically. 1-hour cache writes are billed at a higher rate `ENABLE_PROMPT_CACHING_1H_BEDROCK`| Deprecated. Use `ENABLE_PROMPT_CACHING_1H` instead -`ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset: all MCP tools deferred by default, but loaded upfront on Vertex AI or when `ANTHROPIC_BASE_URL` points to a non-first-party host. Values: `true` (always defer and send the beta header, requests fail on Vertex AI or proxies that do not support `tool_reference`), `auto` (threshold mode: load upfront if tools fit within 10% of context), `auto:N` (custom threshold, e.g., `auto:5` for 5%), `false` (load all upfront) +`ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset: all MCP tools deferred by default, but loaded upfront on Vertex AI or when `ANTHROPIC_BASE_URL` points to a non-first-party host. Values: `true` (always defer and send the beta header; supported on Vertex AI with Sonnet 4.5 and later or Opus 4.5 and later; requests fail on earlier Vertex AI models or on proxies that do not support `tool_reference`), `auto` (threshold mode: load upfront if tools fit within 10% of context), `auto:N` (custom threshold, e.g., `auto:5` for 5%), `false` (load all upfront) `FALLBACK_FOR_ALL_PRIMARY_MODELS`| Set to any non-empty value to trigger fallback to [`--fallback-model`](</docs/en/cli-reference#cli-flags>) after repeated overload errors on any primary model. By default, only Opus models trigger the fallback `FORCE_AUTOUPDATE_PLUGINS`| Set to `1` to force plugin auto-updates even when the main auto-updater is disabled via `DISABLE_AUTOUPDATER` `FORCE_PROMPT_CACHING_5M`| Set to `1` to force the 5-minute prompt cache TTL even when 1-hour TTL would otherwise apply. Overrides `ENABLE_PROMPT_CACHING_1H`
modified
--- a/env-vars.md +++ b/env-vars.md @@ -43,6 +43,7 @@ `ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION`| Override AWS region for the Haiku-class model when using Bedrock or Bedrock Mantle `ANTHROPIC_VERTEX_BASE_URL`| Override the Vertex AI endpoint URL. Use for custom Vertex endpoints or when routing through an [LLM gateway](</docs/en/llm-gateway>). See [Google Vertex AI](</docs/en/google-vertex-ai>) `ANTHROPIC_VERTEX_PROJECT_ID`| GCP project ID for Vertex AI requests. Overridden by `GCLOUD_PROJECT`, `GOOGLE_CLOUD_PROJECT`, or the project in your `GOOGLE_APPLICATION_CREDENTIALS` credential file. See [Google Vertex AI](</docs/en/google-vertex-ai>) +`ANTHROPIC_WORKSPACE_ID`| Workspace ID for [workload identity federation](<https://platform.claude.com/docs/en/manage-claude/workload-identity-federation>). Set this when your federation rule is scoped to more than one workspace so the token exchange knows which workspace to target `API_TIMEOUT_MS`| Timeout for API requests in milliseconds (default: 600000, or 10 minutes; maximum: 2147483647). Increase this when requests time out on slow networks or when routing through a proxy. Values above the maximum overflow the underlying timer and cause requests to fail immediately `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/>)) `BASH_DEFAULT_TIMEOUT_MS`| Default timeout for long-running bash commands (default: 120000, or 2 minutes) @@ -66,7 +67,7 @@ `CLAUDE_CODE_CLIENT_CERT`| Path to client certificate file for mTLS authentication `CLAUDE_CODE_CLIENT_KEY`| Path to client private key file for mTLS authentication `CLAUDE_CODE_CLIENT_KEY_PASSPHRASE`| Passphrase for encrypted CLAUDE_CODE_CLIENT_KEY (optional) -`CLAUDE_CODE_DEBUG_LOGS_DIR`| Override the debug log file path. Despite the name, this is a file path, not a directory. Requires debug mode to be enabled separately via `--debug` or `/debug`: setting this variable alone does not enable logging. The [`--debug-file`](</docs/en/cli-reference#cli-flags>) flag does both at once. Defaults to `~/.claude/debug/<session-id>.txt` +`CLAUDE_CODE_DEBUG_LOGS_DIR`| Override the debug log file path. Despite the name, this is a file path, not a directory. Requires debug mode to be enabled separately via `--debug`, `/debug`, or the `DEBUG` environment variable: setting this variable alone does not enable logging. The [`--debug-file`](</docs/en/cli-reference#cli-flags>) flag does both at once. Defaults to `~/.claude/debug/<session-id>.txt` `CLAUDE_CODE_DEBUG_LOG_LEVEL`| Minimum log level written to the debug log file. Values: `verbose`, `debug` (default), `info`, `warn`, `error`. Set to `verbose` to include high-volume diagnostics like full status line command output, or raise to `error` to reduce noise `CLAUDE_CODE_DISABLE_1M_CONTEXT`| Set to `1` to disable [1M context window](</docs/en/model-config#extended-context>) support. When set, 1M model variants are unavailable in the model picker. Useful for enterprise environments with compliance requirements `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING`| Set to `1` to disable [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) on Opus 4.6 and Sonnet 4.6 and fall back to the fixed thinking budget controlled by `MAX_THINKING_TOKENS`. Has no effect on Opus 4.7, which always uses adaptive reasoning @@ -136,6 +137,7 @@ `CLAUDE_CODE_PLUGIN_CACHE_DIR`| Override the plugins root directory. Despite the name, this sets the parent directory, not the cache itself: marketplaces and the plugin cache live in subdirectories under this path. Defaults to `~/.claude/plugins` `CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS`| Timeout in milliseconds for git operations when installing or updating plugins (default: 120000). Increase this value for large repositories or slow network connections. See [Git operations time out](</docs/en/plugin-marketplaces#git-operations-time-out>) `CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE`| Set to `1` to keep the existing marketplace cache when a `git pull` fails instead of wiping and re-cloning. Useful in offline or airgapped environments where re-cloning would fail the same way. See [Marketplace updates fail in offline environments](</docs/en/plugin-marketplaces#marketplace-updates-fail-in-offline-environments>) +`CLAUDE_CODE_PLUGIN_PREFER_HTTPS`| Set to `1` to clone GitHub `owner/repo` plugin sources over HTTPS instead of SSH. Useful in CI runners, containers, or any environment without a configured SSH key for `github.com` `CLAUDE_CODE_PLUGIN_SEED_DIR`| Path to one or more read-only plugin seed directories, separated by `:` on Unix or `;` on Windows. Use this to bundle a pre-populated plugins directory into a container image. Claude Code registers marketplaces from these directories at startup and uses pre-cached plugins without re-cloning. See [Pre-populate plugins for containers](</docs/en/plugin-marketplaces#pre-populate-plugins-for-containers>) `CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`| Set by host platforms that embed Claude Code and manage model provider routing on its behalf. When set, provider-selection, endpoint, and authentication variables such as `CLAUDE_CODE_USE_BEDROCK`, `ANTHROPIC_BASE_URL`, and `ANTHROPIC_API_KEY` in settings files are ignored so user settings cannot override the host’s routing. The automatic telemetry opt-out for Bedrock, Vertex, and Foundry is also skipped, so telemetry follows the standard `DISABLE_TELEMETRY` opt-out. See [Default behaviors by API provider](</docs/en/data-usage#default-behaviors-by-api-provider>) `CLAUDE_CODE_PROXY_RESOLVES_HOSTS`| Set to `1` to allow the proxy to perform DNS resolution instead of the caller. Opt-in for environments where the proxy should handle hostname resolution @@ -150,7 +152,7 @@ `CLAUDE_CODE_SHELL`| Override automatic shell detection. Useful when your login shell differs from your preferred working shell (for example, `bash` vs `zsh`) `CLAUDE_CODE_SHELL_PREFIX`| Command prefix that wraps shell commands Claude Code spawns: Bash tool calls, [hook](</docs/en/hooks>) commands, and stdio [MCP server](</docs/en/mcp>) startup commands. Useful for logging or auditing. Example: setting `/path/to/logger.sh` runs each command as `/path/to/logger.sh <command>` `CLAUDE_CODE_SIMPLE`| Set to `1` to run with a minimal system prompt and only the Bash, file read, and file edit tools. MCP tools from `--mcp-config` are still available. Disables auto-discovery of hooks, skills, plugins, MCP servers, auto memory, and CLAUDE.md. The [`--bare`](</docs/en/headless#start-faster-with-bare-mode>) CLI flag sets this -`CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT`| Set to `1` to use a shorter system prompt and abbreviated tool descriptions on Opus 4.7. Has no effect on other models. The full tool set, hooks, MCP servers, and CLAUDE.md discovery remain enabled +`CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT`| Set to `1` to use a shorter system prompt and abbreviated tool descriptions on any model. Set to `0`, `false`, `no`, or `off` to opt out even on models where the experiment or server configuration would otherwise enable it. The full tool set, hooks, MCP servers, and CLAUDE.md discovery remain enabled `CLAUDE_CODE_SKIP_ANTHROPIC_AWS_AUTH`| Skip client-side authentication for [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), for gateways that sign requests themselves `CLAUDE_CODE_SKIP_BEDROCK_AUTH`| Skip AWS authentication for Bedrock (for example, when using an LLM gateway) `CLAUDE_CODE_SKIP_FOUNDRY_AUTH`| Skip Azure authentication for Microsoft Foundry (for example, when using an LLM gateway) @@ -180,6 +182,7 @@ `CLAUDE_ENV_FILE`| Path to a shell script whose contents Claude Code runs before each Bash command in the same shell process, so exports in the file are visible to the command. Use to persist virtualenv or conda activation across commands. Also populated dynamically by [SessionStart](</docs/en/hooks#persist-environment-variables>), [Setup](</docs/en/hooks#setup>), [CwdChanged](</docs/en/hooks#cwdchanged>), and [FileChanged](</docs/en/hooks#filechanged>) hooks `CLAUDE_REMOTE_CONTROL_SESSION_NAME_PREFIX`| Prefix for auto-generated [Remote Control](</docs/en/remote-control>) session names when no explicit name is provided. Defaults to your machine’s hostname, producing names like `myhost-graceful-unicorn`. The `--remote-control-session-name-prefix` CLI flag sets the same value for a single invocation `CLAUDE_STREAM_IDLE_TIMEOUT_MS`| Timeout in milliseconds before the streaming idle watchdog closes a stalled connection. Default and minimum `300000` (5 minutes) for both the byte-level and event-level watchdogs; lower values are silently clamped to absorb extended thinking pauses and proxy buffering. For third-party providers, requires `CLAUDE_ENABLE_STREAM_WATCHDOG=1` +`DEBUG`| Set to `1` to enable debug mode, equivalent to launching with [`--debug`](</docs/en/cli-reference#cli-flags>). Debug logs are written to `~/.claude/debug/<session-id>.txt`, or to the path set by `CLAUDE_CODE_DEBUG_LOGS_DIR`. Only the truthy values `1`, `true`, `yes`, and `on` enable debug mode, so namespace patterns like `DEBUG=express:*` set for other tools do not trigger it `DISABLE_AUTOUPDATER`| Set to `1` to disable automatic background updates. Manual `claude update` still works. Use `DISABLE_UPDATES` to block both `DISABLE_AUTO_COMPACT`| Set to `1` to disable automatic compaction when approaching the context limit. The manual `/compact` command remains available. Use when you want explicit control over when compaction occurs `DISABLE_COMPACT`| Set to `1` to disable all compaction: both automatic compaction and the manual `/compact` command
modified
--- a/env-vars.md +++ b/env-vars.md @@ -79,7 +79,7 @@ `CLAUDE_CODE_DISABLE_CRON`| Set to `1` to disable [scheduled tasks](</docs/en/scheduled-tasks>). The `/loop` skill and cron tools become unavailable and any already-scheduled tasks stop firing, including tasks that are already running mid-session `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`| Set to `1` to strip Anthropic-specific `anthropic-beta` request headers and beta tool-schema fields (such as `defer_loading` and `eager_input_streaming`) from API requests. Use this when a proxy gateway rejects requests with errors like “Unexpected value(s) for the `anthropic-beta` header” or “Extra inputs are not permitted”. Standard fields (`name`, `description`, `input_schema`, `cache_control`) are preserved. `CLAUDE_CODE_DISABLE_FAST_MODE`| Set to `1` to disable [fast mode](</docs/en/fast-mode>) -`CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY`| Set to `1` to disable the “How is Claude doing?” session quality surveys. Surveys are also disabled when `DISABLE_TELEMETRY` or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` is set. To set a sample rate instead of disabling outright, use the [`feedbackSurveyRate`](</docs/en/settings#available-settings>) setting. See [Session quality surveys](</docs/en/data-usage#session-quality-surveys>) +`CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY`| Set to `1` to disable the “How is Claude doing?” session quality surveys. Surveys are also disabled when `DISABLE_TELEMETRY`, `DO_NOT_TRACK`, or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` is set, unless `CLAUDE_CODE_ENABLE_FEEDBACK_SURVEY_FOR_OTEL` opts back in. To set a sample rate instead of disabling outright, use the [`feedbackSurveyRate`](</docs/en/settings#available-settings>) setting. See [Session quality surveys](</docs/en/data-usage#session-quality-surveys>) `CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING`| Set to `1` to disable file [checkpointing](</docs/en/checkpointing>). The `/rewind` command will not be able to restore code changes `CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS`| Set to `1` to remove built-in commit and PR workflow instructions and the git status snapshot from Claude’s system prompt. Useful when using your own git workflow skills. Takes precedence over the [`includeGitInstructions`](</docs/en/settings#available-settings>) setting when set `CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP`| Set to `1` to prevent automatic remapping of Opus 4.0 and 4.1 to the current Opus version on the Anthropic API. Use when you intentionally want to pin an older model. The remap does not run on Bedrock, Vertex, or Foundry @@ -94,8 +94,10 @@ `CLAUDE_CODE_EFFORT_LEVEL`| Set the effort level for supported models. Values: `low`, `medium`, `high`, `xhigh`, `max`, or `auto` to use the model default. Available levels depend on the model. Takes precedence over `/effort` and the `effortLevel` setting. See [Adjust effort level](</docs/en/model-config#adjust-effort-level>) `CLAUDE_CODE_ENABLE_AWAY_SUMMARY`| Override [session recap](</docs/en/interactive-mode#session-recap>) availability. Set to `0` to force recaps off regardless of the `/config` toggle. Set to `1` to force recaps on when [`awaySummaryEnabled`](</docs/en/settings#available-settings>) is `false`. Takes precedence over the setting and `/config` toggle `CLAUDE_CODE_ENABLE_BACKGROUND_PLUGIN_REFRESH`| Set to `1` to refresh plugin state at turn boundaries in [non-interactive mode](</docs/en/headless>) after a background install completes. Off by default because the refresh changes the system prompt mid-session, which invalidates [prompt caching](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching>) for that turn +`CLAUDE_CODE_ENABLE_FEEDBACK_SURVEY_FOR_OTEL`| Set to `1` to route the “How is Claude doing?” session quality survey to your own [OpenTelemetry collector](</docs/en/monitoring-usage>) when Anthropic-bound nonessential traffic is blocked. Survey ratings are emitted only as OTEL events to your configured collector. No survey data is sent to Anthropic in this mode. Applies when `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`, `DISABLE_TELEMETRY`, or `DO_NOT_TRACK` is set, and has no effect otherwise. `CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY` and the organization product feedback policy take precedence `CLAUDE_CODE_ENABLE_FINE_GRAINED_TOOL_STREAMING`| Controls whether tool call inputs stream from the API as Claude generates them. With this off, a large tool input such as a long file write arrives only after Claude finishes generating it, which can look like it’s hanging. Enabled by default on the Anthropic API. On Bedrock and Vertex, enabled per model where the deployed container supports it. Set to `0` to opt out. Set to `1` to force on when routing through a proxy via `ANTHROPIC_BASE_URL`, `ANTHROPIC_VERTEX_BASE_URL`, or `ANTHROPIC_BEDROCK_BASE_URL`. Off by default on Foundry and [gateway](</docs/en/llm-gateway>) connections `CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY`| Set to `1` to populate the `/model` picker from your gateway’s `/v1/models` endpoint when `ANTHROPIC_BASE_URL` points at an Anthropic-compatible gateway such as LiteLLM, Kong, or an internal proxy. Off by default because gateways backed by a shared API key would otherwise show every user every model the key can access. Discovered models are still filtered by the [`availableModels`](</docs/en/settings#available-settings>) allowlist +`CLAUDE_CODE_ENABLE_OPUS_4_7_FAST_MODE`| Set to `1` to run [fast mode](</docs/en/fast-mode>) on Claude Opus 4.7 instead of Opus 4.6. With the variable set, `/fast` switches to Opus 4.7; without it, `/fast` continues to use Opus 4.6 `CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION`| Set to `false` to disable prompt suggestions (the “Prompt suggestions” toggle in `/config`). These are the grayed-out predictions that appear in your prompt input after Claude responds. See [Prompt suggestions](</docs/en/interactive-mode#prompt-suggestions>) `CLAUDE_CODE_ENABLE_TASKS`| Set to `1` to enable the task tracking system in non-interactive mode (the `-p` flag). Tasks are on by default in interactive mode. See [Task list](</docs/en/interactive-mode#task-list>) `CLAUDE_CODE_ENABLE_TELEMETRY`| Set to `1` to enable OpenTelemetry data collection for metrics and logging. Required before configuring OTel exporters. See [Monitoring](</docs/en/monitoring-usage>) @@ -125,6 +127,7 @@ `CLAUDE_CODE_OAUTH_REFRESH_TOKEN`| OAuth refresh token for Claude.ai authentication. When set, `claude auth login` exchanges this token directly instead of opening a browser. Requires `CLAUDE_CODE_OAUTH_SCOPES`. Useful for provisioning authentication in automated environments `CLAUDE_CODE_OAUTH_SCOPES`| Space-separated OAuth scopes the refresh token was issued with, such as `"user:profile user:inference user:sessions:claude_code"`. Required when `CLAUDE_CODE_OAUTH_REFRESH_TOKEN` is set `CLAUDE_CODE_OAUTH_TOKEN`| OAuth access token for Claude.ai authentication. Alternative to `/login` for SDK and automated environments. Takes precedence over keychain-stored credentials. Generate one with [`claude setup-token`](</docs/en/authentication#generate-a-long-lived-token>) +`CLAUDE_CODE_OPUS_4_6_FAST_MODE_OVERRIDE`| Set to `1` to keep [fast mode](</docs/en/fast-mode>) on Claude Opus 4.6. Takes precedence over `CLAUDE_CODE_ENABLE_OPUS_4_7_FAST_MODE`, so set this if you need to pin Opus 4.6 regardless of how the default changes `CLAUDE_CODE_OTEL_FLUSH_TIMEOUT_MS`| Timeout in milliseconds for flushing pending OpenTelemetry spans (default: 5000). See [Monitoring](</docs/en/monitoring-usage>) `CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS`| Interval for refreshing dynamic OpenTelemetry headers in milliseconds (default: 1740000 / 29 minutes). See [Dynamic headers](</docs/en/monitoring-usage#dynamic-headers>) `CLAUDE_CODE_OTEL_SHUTDOWN_TIMEOUT_MS`| Timeout in milliseconds for the OpenTelemetry exporter to finish on shutdown (default: 2000). Increase if metrics are dropped at exit. See [Monitoring](</docs/en/monitoring-usage>) @@ -139,6 +142,7 @@ `CLAUDE_CODE_REMOTE`| Set automatically to `true` when Claude Code is running as a [cloud session](</docs/en/claude-code-on-the-web>). Read this from a hook or setup script to detect whether you are in a cloud environment `CLAUDE_CODE_REMOTE_SESSION_ID`| Set automatically in [cloud sessions](</docs/en/claude-code-on-the-web>) to the current session’s ID. Read this to construct a link back to the session transcript. See [Link artifacts back to the session](</docs/en/claude-code-on-the-web#link-artifacts-back-to-the-session>) `CLAUDE_CODE_RESUME_INTERRUPTED_TURN`| Set to `1` to automatically resume if the previous session ended mid-turn. Used in SDK mode so the model continues without requiring the SDK to re-send the prompt +`CLAUDE_CODE_RESUME_PROMPT`| Override the continuation message injected when resuming a session that ended mid-turn. Defaults to `Continue from where you left off.`. Spawn scripts for long-running agents can set this to a more directive boot message. An empty string uses the default `CLAUDE_CODE_SCRIPT_CAPS`| JSON object limiting how many times specific scripts may be invoked per session when `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB` is set. Keys are substrings matched against the command text; values are integer call limits. For example, `{"deploy.sh": 2}` allows `deploy.sh` to be called at most twice. Matching is substring-based so shell-expansion tricks like `./scripts/deploy.sh $(evil)` still count against the cap. Runtime fan-out via `xargs` or `find -exec` is not detected; this is a defense-in-depth control `CLAUDE_CODE_SCROLL_SPEED`| Set the mouse wheel scroll multiplier in [fullscreen rendering](</docs/en/fullscreen#mouse-wheel-scrolling>). Accepts values from 1 to 20. Set to `3` to match `vim` if your terminal sends one wheel event per notch without amplification. Ignored in the JetBrains IDE terminal, where Claude Code uses its own scroll handling `CLAUDE_CODE_SESSIONEND_HOOKS_TIMEOUT_MS`| Override the time budget in milliseconds for [SessionEnd](</docs/en/hooks#sessionend>) hooks. Applies to session exit, `/clear`, and switching sessions via interactive `/resume`. By default the budget is 1.5 seconds, automatically raised to the highest per-hook `timeout` configured in settings files, up to 60 seconds. Timeouts on plugin-provided hooks do not raise the budget @@ -194,7 +198,7 @@ `DISABLE_PROMPT_CACHING_HAIKU`| Set to `1` to disable prompt caching for Haiku models `DISABLE_PROMPT_CACHING_OPUS`| Set to `1` to disable prompt caching for Opus models `DISABLE_PROMPT_CACHING_SONNET`| Set to `1` to disable prompt caching for Sonnet models -`DISABLE_TELEMETRY`| Set to `1` to opt out of telemetry. Telemetry events do not include user data like code, file paths, or bash commands +`DISABLE_TELEMETRY`| Set to `1` to opt out of telemetry. Telemetry events do not include user data like code, file paths, or bash commands. Also disables feature flags, so some features that are still rolling out may not be available `DISABLE_UPDATES`| Set to `1` to block all updates including manual `claude update` and `claude install`. Stricter than `DISABLE_AUTOUPDATER`. Use when distributing Claude Code through your own channels and users should not self-update `DISABLE_UPGRADE_COMMAND`| Set to `1` to hide the `/upgrade` command `DO_NOT_TRACK`| Set to `1` to opt out of telemetry. Equivalent to setting `DISABLE_TELEMETRY`. Honored as the [standard cross-tool convention](<https://consoledonottrack.com/>)
modified
--- a/env-vars.md +++ b/env-vars.md @@ -10,6 +10,9 @@ ---|--- `ANTHROPIC_API_KEY`| API key sent as `X-Api-Key` header. When set, this key is used instead of your Claude Pro, Max, Team, or Enterprise subscription even if you are logged in. In non-interactive mode (`-p`), the key is always used when present. In interactive mode, you are prompted to approve the key once before it overrides your subscription. To use your subscription instead, run `unset ANTHROPIC_API_KEY` `ANTHROPIC_AUTH_TOKEN`| Custom value for the `Authorization` header (the value you set here will be prefixed with `Bearer `) +`ANTHROPIC_AWS_API_KEY`| Workspace API key for [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), generated in the AWS Console. Sent as `x-api-key` and takes precedence over AWS SigV4 +`ANTHROPIC_AWS_BASE_URL`| Override the [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) endpoint URL. Use for custom regions or when routing through an [LLM gateway](</docs/en/llm-gateway>). Defaults to `https://aws-external-anthropic.{AWS_REGION}.api.aws` +`ANTHROPIC_AWS_WORKSPACE_ID`| Required for [Claude Platform on AWS](</docs/en/claude-platform-on-aws>). Sent on every request as the `anthropic-workspace-id` header `ANTHROPIC_BASE_URL`| Override the API endpoint to route requests through a proxy or gateway. When set to a non-first-party host, [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) is disabled by default. Set `ENABLE_TOOL_SEARCH=true` if your proxy forwards `tool_reference` blocks `ANTHROPIC_BEDROCK_BASE_URL`| Override the Bedrock endpoint URL. Use for custom Bedrock endpoints or when routing through an [LLM gateway](</docs/en/llm-gateway>). See [Amazon Bedrock](</docs/en/amazon-bedrock>) `ANTHROPIC_BEDROCK_MANTLE_BASE_URL`| Override the Bedrock Mantle endpoint URL. See [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>) @@ -43,7 +46,7 @@ `API_TIMEOUT_MS`| Timeout for API requests in milliseconds (default: 600000, or 10 minutes; maximum: 2147483647). Increase this when requests time out on slow networks or when routing through a proxy. Values above the maximum overflow the underlying timer and cause requests to fail immediately `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/>)) `BASH_DEFAULT_TIMEOUT_MS`| Default timeout for long-running bash commands (default: 120000, or 2 minutes) -`BASH_MAX_OUTPUT_LENGTH`| Maximum number of characters in bash outputs before they are middle-truncated +`BASH_MAX_OUTPUT_LENGTH`| Maximum number of characters in bash outputs before the full output is saved to a file and Claude receives the path plus a short preview. See [Bash tool behavior](</docs/en/tools-reference#bash-tool-behavior>) `BASH_MAX_TIMEOUT_MS`| Maximum timeout the model can set for long-running bash commands (default: 600000, or 10 minutes) `CCR_FORCE_BUNDLE`| Set to `1` to force [`claude --remote`](</docs/en/claude-code-on-the-web#send-local-repositories-without-github>) to bundle and upload your local repository even when GitHub access is available `CLAUDECODE`| Set to `1` in shell environments Claude Code spawns (Bash tool, tmux sessions). Not set in [hooks](</docs/en/hooks>) or [status line](</docs/en/statusline>) commands. Use to detect when a script is running inside a shell spawned by Claude Code @@ -67,6 +70,7 @@ `CLAUDE_CODE_DEBUG_LOG_LEVEL`| Minimum log level written to the debug log file. Values: `verbose`, `debug` (default), `info`, `warn`, `error`. Set to `verbose` to include high-volume diagnostics like full status line command output, or raise to `error` to reduce noise `CLAUDE_CODE_DISABLE_1M_CONTEXT`| Set to `1` to disable [1M context window](</docs/en/model-config#extended-context>) support. When set, 1M model variants are unavailable in the model picker. Useful for enterprise environments with compliance requirements `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING`| Set to `1` to disable [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) on Opus 4.6 and Sonnet 4.6 and fall back to the fixed thinking budget controlled by `MAX_THINKING_TOKENS`. Has no effect on Opus 4.7, which always uses adaptive reasoning +`CLAUDE_CODE_DISABLE_AGENT_VIEW`| Set to `1` to turn off [background agents and agent view](</docs/en/agent-view>): `claude agents`, `--bg`, `/background`, and the on-demand supervisor. Equivalent to the [`disableAgentView`](</docs/en/settings#available-settings>) setting `CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN`| Set to `1` to disable [fullscreen rendering](</docs/en/fullscreen>) and use the classic main-screen renderer. The conversation stays in your terminal’s native scrollback so `Cmd+f` and tmux copy mode work as usual. Takes precedence over `CLAUDE_CODE_NO_FLICKER` and the [`tui`](</docs/en/settings#available-settings>) setting. You can also switch with `/tui default` `CLAUDE_CODE_DISABLE_ATTACHMENTS`| Set to `1` to disable attachment processing. File mentions with `@` syntax are sent as plain text instead of being expanded into file content `CLAUDE_CODE_DISABLE_AUTO_MEMORY`| Set to `1` to disable [auto memory](</docs/en/memory#auto-memory>). Set to `0` to force auto memory on even when `--bare` mode or [`autoMemoryEnabled: false`](</docs/en/settings#available-settings>) would otherwise disable it. When disabled, Claude does not create or load auto memory files @@ -102,8 +106,8 @@ `CLAUDE_CODE_FORCE_SYNC_OUTPUT`| Set to `1` to force-enable DEC private mode 2026 [synchronized output](<https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036>) when your terminal supports it but is not auto-detected. Useful for emulators such as Emacs `eat` that implement BSU/ESU but do not reply to the capability probe. Has no effect under tmux `CLAUDE_CODE_FORK_SUBAGENT`| Set to `1` to enable [forked subagents](</docs/en/sub-agents#fork-the-current-conversation>). A forked subagent inherits the full conversation context from the main session instead of starting fresh. When enabled, `/fork` spawns a forked subagent rather than acting as an alias for [`/branch`](</docs/en/commands>), and all subagent spawns run in the background. Works in interactive mode and via the SDK or `claude -p` `CLAUDE_CODE_GIT_BASH_PATH`| Windows only: path to the Git Bash executable (`bash.exe`). Use when Git Bash is installed but not in your PATH. See [Windows setup](</docs/en/setup#set-up-on-windows>) -`CLAUDE_CODE_GLOB_HIDDEN`| Set to `false` to exclude dotfiles from results when Claude invokes the [Glob tool](</docs/en/tools-reference>). Included by default. Does not affect `@` file autocomplete, `ls`, Grep, or Read -`CLAUDE_CODE_GLOB_NO_IGNORE`| Set to `false` to make the [Glob tool](</docs/en/tools-reference>) respect `.gitignore` patterns. By default, Glob returns all matching files including gitignored ones. Does not affect `@` file autocomplete, which has its own [`respectGitignore` setting](</docs/en/settings#available-settings>) +`CLAUDE_CODE_GLOB_HIDDEN`| Set to `false` to exclude dotfiles from results when Claude invokes the [Glob tool](</docs/en/tools-reference#glob-tool-behavior>). Included by default. Does not affect `@` file autocomplete, `ls`, Grep, or Read +`CLAUDE_CODE_GLOB_NO_IGNORE`| Set to `false` to make the [Glob tool](</docs/en/tools-reference#glob-tool-behavior>) respect `.gitignore` patterns. By default, Glob returns all matching files including gitignored ones. Does not affect `@` file autocomplete, which has its own [`respectGitignore` setting](</docs/en/settings#available-settings>) `CLAUDE_CODE_GLOB_TIMEOUT_SECONDS`| Timeout in seconds for Glob tool file discovery. Defaults to 20 seconds on most platforms and 60 seconds on WSL `CLAUDE_CODE_HIDE_CWD`| Set to `1` to hide the working directory in the startup logo. Useful for screenshares or recordings where the path exposes your OS username `CLAUDE_CODE_IDE_HOST_OVERRIDE`| Override the host address used to connect to the IDE extension. By default Claude Code auto-detects the correct address, including WSL-to-Windows routing @@ -113,6 +117,7 @@ `CLAUDE_CODE_MAX_OUTPUT_TOKENS`| Set the maximum number of output tokens for most requests. Defaults and caps vary by model; see [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>). Increasing this value reduces the effective context window available before [auto-compaction](</docs/en/costs#reduce-token-usage>) triggers. `CLAUDE_CODE_MAX_RETRIES`| Override the number of times to retry failed API requests (default: 10) `CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY`| Maximum number of read-only tools and subagents that can execute in parallel (default: 10). Higher values increase parallelism but consume more resources +`CLAUDE_CODE_MAX_TURNS`| Cap the number of agentic turns when no explicit limit is passed. Equivalent to passing [`--max-turns`](</docs/en/cli-reference#cli-flags>), which takes precedence when both are set. A value that is not a positive integer is rejected at startup with an error rather than treated as no cap `CLAUDE_CODE_MCP_ALLOWLIST_ENV`| Set to `1` to spawn stdio MCP servers with only a safe baseline environment plus the server’s configured `env`, instead of inheriting your shell environment `CLAUDE_CODE_NATIVE_CURSOR`| Set to `1` to show the terminal’s own cursor at the input caret instead of a drawn block. The cursor respects the terminal’s blink, shape, and focus settings `CLAUDE_CODE_NEW_INIT`| Set to `1` to make `/init` run an interactive setup flow. The flow asks which files to generate, including CLAUDE.md, skills, and hooks, before exploring the codebase and writing them. Without this variable, `/init` generates a CLAUDE.md automatically without prompting. @@ -142,6 +147,7 @@ `CLAUDE_CODE_SHELL_PREFIX`| Command prefix that wraps shell commands Claude Code spawns: Bash tool calls, [hook](</docs/en/hooks>) commands, and stdio [MCP server](</docs/en/mcp>) startup commands. Useful for logging or auditing. Example: setting `/path/to/logger.sh` runs each command as `/path/to/logger.sh <command>` `CLAUDE_CODE_SIMPLE`| Set to `1` to run with a minimal system prompt and only the Bash, file read, and file edit tools. MCP tools from `--mcp-config` are still available. Disables auto-discovery of hooks, skills, plugins, MCP servers, auto memory, and CLAUDE.md. The [`--bare`](</docs/en/headless#start-faster-with-bare-mode>) CLI flag sets this `CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT`| Set to `1` to use a shorter system prompt and abbreviated tool descriptions on Opus 4.7. Has no effect on other models. The full tool set, hooks, MCP servers, and CLAUDE.md discovery remain enabled +`CLAUDE_CODE_SKIP_ANTHROPIC_AWS_AUTH`| Skip client-side authentication for [Claude Platform on AWS](</docs/en/claude-platform-on-aws>), for gateways that sign requests themselves `CLAUDE_CODE_SKIP_BEDROCK_AUTH`| Skip AWS authentication for Bedrock (for example, when using an LLM gateway) `CLAUDE_CODE_SKIP_FOUNDRY_AUTH`| Skip Azure authentication for Microsoft Foundry (for example, when using an LLM gateway) `CLAUDE_CODE_SKIP_MANTLE_AUTH`| Skip AWS authentication for Bedrock Mantle (for example, when using an LLM gateway) @@ -156,6 +162,7 @@ `CLAUDE_CODE_TEAM_NAME`| Name of the agent team this teammate belongs to. Set automatically on [agent team](</docs/en/agent-teams>) members `CLAUDE_CODE_TMPDIR`| Override the temp directory used for internal temp files. Claude Code appends `/claude-{uid}/` (Unix) or `/claude/` (Windows) to this path. Default: `/tmp` on macOS, `os.tmpdir()` on Linux/Windows `CLAUDE_CODE_TMUX_TRUECOLOR`| Set to `1` to allow 24-bit truecolor output inside tmux. By default, Claude Code clamps to 256 colors when `$TMUX` is set because tmux does not pass through truecolor escape sequences unless configured to. Set this after adding `set -ga terminal-overrides ',*:Tc'` to your `~/.tmux.conf`. See [Terminal configuration](</docs/en/terminal-config>) for other tmux settings +`CLAUDE_CODE_USE_ANTHROPIC_AWS`| Use [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) `CLAUDE_CODE_USE_BEDROCK`| Use [Bedrock](</docs/en/amazon-bedrock>) `CLAUDE_CODE_USE_FOUNDRY`| Use [Microsoft Foundry](</docs/en/microsoft-foundry>) `CLAUDE_CODE_USE_MANTLE`| Use the Bedrock [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>) @@ -192,9 +199,9 @@ `DISABLE_UPGRADE_COMMAND`| Set to `1` to hide the `/upgrade` command `DO_NOT_TRACK`| Set to `1` to opt out of telemetry. Equivalent to setting `DISABLE_TELEMETRY`. Honored as the [standard cross-tool convention](<https://consoledonottrack.com/>) `ENABLE_CLAUDEAI_MCP_SERVERS`| Set to `false` to disable [claude.ai MCP servers](</docs/en/mcp#use-mcp-servers-from-claude-ai>) in Claude Code. Enabled by default for logged-in users -`ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour prompt cache TTL instead of the default 5 minutes. Intended for API key, [Bedrock](</docs/en/amazon-bedrock>), [Vertex](</docs/en/google-vertex-ai>), and [Foundry](</docs/en/microsoft-foundry>) users. Subscription users receive 1-hour TTL automatically. 1-hour cache writes are billed at a higher rate +`ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour prompt cache TTL instead of the default 5 minutes. Intended for API key, [Bedrock](</docs/en/amazon-bedrock>), [Vertex](</docs/en/google-vertex-ai>), [Foundry](</docs/en/microsoft-foundry>), and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) users. Subscription users receive 1-hour TTL automatically. 1-hour cache writes are billed at a higher rate `ENABLE_PROMPT_CACHING_1H_BEDROCK`| Deprecated. Use `ENABLE_PROMPT_CACHING_1H` instead -`ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset: all MCP tools deferred by default, but loaded upfront on Vertex AI or when `ANTHROPIC_BASE_URL` points to a non-first-party host. Values: `true` (always defer including proxies and Vertex AI), `auto` (threshold mode: load upfront if tools fit within 10% of context), `auto:N` (custom threshold, e.g., `auto:5` for 5%), `false` (load all upfront) +`ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset: all MCP tools deferred by default, but loaded upfront on Vertex AI or when `ANTHROPIC_BASE_URL` points to a non-first-party host. Values: `true` (always defer and send the beta header, requests fail on Vertex AI or proxies that do not support `tool_reference`), `auto` (threshold mode: load upfront if tools fit within 10% of context), `auto:N` (custom threshold, e.g., `auto:5` for 5%), `false` (load all upfront) `FALLBACK_FOR_ALL_PRIMARY_MODELS`| Set to any non-empty value to trigger fallback to [`--fallback-model`](</docs/en/cli-reference#cli-flags>) after repeated overload errors on any primary model. By default, only Opus models trigger the fallback `FORCE_AUTOUPDATE_PLUGINS`| Set to `1` to force plugin auto-updates even when the main auto-updater is disabled via `DISABLE_AUTOUPDATER` `FORCE_PROMPT_CACHING_5M`| Set to `1` to force the 5-minute prompt cache TTL even when 1-hour TTL would otherwise apply. Overrides `ENABLE_PROMPT_CACHING_1H`
modified
--- a/env-vars.md +++ b/env-vars.md @@ -114,6 +114,7 @@ `CLAUDE_CODE_MAX_RETRIES`| Override the number of times to retry failed API requests (default: 10) `CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY`| Maximum number of read-only tools and subagents that can execute in parallel (default: 10). Higher values increase parallelism but consume more resources `CLAUDE_CODE_MCP_ALLOWLIST_ENV`| Set to `1` to spawn stdio MCP servers with only a safe baseline environment plus the server’s configured `env`, instead of inheriting your shell environment +`CLAUDE_CODE_NATIVE_CURSOR`| Set to `1` to show the terminal’s own cursor at the input caret instead of a drawn block. The cursor respects the terminal’s blink, shape, and focus settings `CLAUDE_CODE_NEW_INIT`| Set to `1` to make `/init` run an interactive setup flow. The flow asks which files to generate, including CLAUDE.md, skills, and hooks, before exploring the codebase and writing them. Without this variable, `/init` generates a CLAUDE.md automatically without prompting. `CLAUDE_CODE_NO_FLICKER`| Set to `1` to enable [fullscreen rendering](</docs/en/fullscreen>), a research preview that reduces flicker and keeps memory flat in long conversations. Equivalent to the [`tui`](</docs/en/settings#available-settings>) setting; you can also switch with `/tui fullscreen` `CLAUDE_CODE_OAUTH_REFRESH_TOKEN`| OAuth refresh token for Claude.ai authentication. When set, `claude auth login` exchanges this token directly instead of opening a browser. Requires `CLAUDE_CODE_OAUTH_SCOPES`. Useful for provisioning authentication in automated environments @@ -189,6 +190,7 @@ `DISABLE_TELEMETRY`| Set to `1` to opt out of telemetry. Telemetry events do not include user data like code, file paths, or bash commands `DISABLE_UPDATES`| Set to `1` to block all updates including manual `claude update` and `claude install`. Stricter than `DISABLE_AUTOUPDATER`. Use when distributing Claude Code through your own channels and users should not self-update `DISABLE_UPGRADE_COMMAND`| Set to `1` to hide the `/upgrade` command +`DO_NOT_TRACK`| Set to `1` to opt out of telemetry. Equivalent to setting `DISABLE_TELEMETRY`. Honored as the [standard cross-tool convention](<https://consoledonottrack.com/>) `ENABLE_CLAUDEAI_MCP_SERVERS`| Set to `false` to disable [claude.ai MCP servers](</docs/en/mcp#use-mcp-servers-from-claude-ai>) in Claude Code. Enabled by default for logged-in users `ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour prompt cache TTL instead of the default 5 minutes. Intended for API key, [Bedrock](</docs/en/amazon-bedrock>), [Vertex](</docs/en/google-vertex-ai>), and [Foundry](</docs/en/microsoft-foundry>) users. Subscription users receive 1-hour TTL automatically. 1-hour cache writes are billed at a higher rate `ENABLE_PROMPT_CACHING_1H_BEDROCK`| Deprecated. Use `ENABLE_PROMPT_CACHING_1H` instead
modified
--- a/env-vars.md +++ b/env-vars.md @@ -39,7 +39,7 @@ `ANTHROPIC_SMALL_FAST_MODEL`| [DEPRECATED] Name of [Haiku-class model for background tasks](</docs/en/costs>) `ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION`| Override AWS region for the Haiku-class model when using Bedrock or Bedrock Mantle `ANTHROPIC_VERTEX_BASE_URL`| Override the Vertex AI endpoint URL. Use for custom Vertex endpoints or when routing through an [LLM gateway](</docs/en/llm-gateway>). See [Google Vertex AI](</docs/en/google-vertex-ai>) -`ANTHROPIC_VERTEX_PROJECT_ID`| GCP project ID for Vertex AI. Required when using [Google Vertex AI](</docs/en/google-vertex-ai>) +`ANTHROPIC_VERTEX_PROJECT_ID`| GCP project ID for Vertex AI requests. Overridden by `GCLOUD_PROJECT`, `GOOGLE_CLOUD_PROJECT`, or the project in your `GOOGLE_APPLICATION_CREDENTIALS` credential file. See [Google Vertex AI](</docs/en/google-vertex-ai>) `API_TIMEOUT_MS`| Timeout for API requests in milliseconds (default: 600000, or 10 minutes; maximum: 2147483647). Increase this when requests time out on slow networks or when routing through a proxy. Values above the maximum overflow the underlying timer and cause requests to fail immediately `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/>)) `BASH_DEFAULT_TIMEOUT_MS`| Default timeout for long-running bash commands (default: 120000, or 2 minutes) @@ -90,7 +90,7 @@ `CLAUDE_CODE_EFFORT_LEVEL`| Set the effort level for supported models. Values: `low`, `medium`, `high`, `xhigh`, `max`, or `auto` to use the model default. Available levels depend on the model. Takes precedence over `/effort` and the `effortLevel` setting. See [Adjust effort level](</docs/en/model-config#adjust-effort-level>) `CLAUDE_CODE_ENABLE_AWAY_SUMMARY`| Override [session recap](</docs/en/interactive-mode#session-recap>) availability. Set to `0` to force recaps off regardless of the `/config` toggle. Set to `1` to force recaps on when [`awaySummaryEnabled`](</docs/en/settings#available-settings>) is `false`. Takes precedence over the setting and `/config` toggle `CLAUDE_CODE_ENABLE_BACKGROUND_PLUGIN_REFRESH`| Set to `1` to refresh plugin state at turn boundaries in [non-interactive mode](</docs/en/headless>) after a background install completes. Off by default because the refresh changes the system prompt mid-session, which invalidates [prompt caching](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching>) for that turn -`CLAUDE_CODE_ENABLE_FINE_GRAINED_TOOL_STREAMING`| Controls whether tool call inputs stream from the API as Claude generates them. With this off, a large tool input such as a long file write arrives only after Claude finishes generating it, which can look like it’s hanging. Enabled by default for direct Anthropic API connections. Set to `0` to opt out. Set to `1` to force-enable even when the server-side default is off. Has no effect on Bedrock, Vertex, Foundry, or [gateway](</docs/en/llm-gateway>) connections +`CLAUDE_CODE_ENABLE_FINE_GRAINED_TOOL_STREAMING`| Controls whether tool call inputs stream from the API as Claude generates them. With this off, a large tool input such as a long file write arrives only after Claude finishes generating it, which can look like it’s hanging. Enabled by default on the Anthropic API. On Bedrock and Vertex, enabled per model where the deployed container supports it. Set to `0` to opt out. Set to `1` to force on when routing through a proxy via `ANTHROPIC_BASE_URL`, `ANTHROPIC_VERTEX_BASE_URL`, or `ANTHROPIC_BEDROCK_BASE_URL`. Off by default on Foundry and [gateway](</docs/en/llm-gateway>) connections `CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY`| Set to `1` to populate the `/model` picker from your gateway’s `/v1/models` endpoint when `ANTHROPIC_BASE_URL` points at an Anthropic-compatible gateway such as LiteLLM, Kong, or an internal proxy. Off by default because gateways backed by a shared API key would otherwise show every user every model the key can access. Discovered models are still filtered by the [`availableModels`](</docs/en/settings#available-settings>) allowlist `CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION`| Set to `false` to disable prompt suggestions (the “Prompt suggestions” toggle in `/config`). These are the grayed-out predictions that appear in your prompt input after Claude responds. See [Prompt suggestions](</docs/en/interactive-mode#prompt-suggestions>) `CLAUDE_CODE_ENABLE_TASKS`| Set to `1` to enable the task tracking system in non-interactive mode (the `-p` flag). Tasks are on by default in interactive mode. See [Task list](</docs/en/interactive-mode#task-list>) @@ -150,7 +150,7 @@ `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB`| Set to `1` to strip Anthropic and cloud provider credentials from subprocess environments (Bash tool, hooks, MCP stdio servers). The parent Claude process keeps these credentials for API calls, but child processes cannot read them, reducing exposure to prompt injection attacks that attempt to exfiltrate secrets via shell expansion. On Linux, this also runs Bash subprocesses in an isolated PID namespace so they cannot read host process environments via `/proc`; as a side effect, `ps`, `pgrep`, and `kill` cannot see or signal host processes. `claude-code-action` sets this automatically when `allowed_non_write_users` is configured `CLAUDE_CODE_SYNC_PLUGIN_INSTALL`| Set to `1` in non-interactive mode (the `-p` flag) to wait for plugin installation to complete before the first query. Without this, plugins install in the background and may not be available on the first turn. Combine with `CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS` to bound the wait `CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS`| Timeout in milliseconds for synchronous plugin installation. When exceeded, Claude Code proceeds without plugins and logs an error. No default: without this variable, synchronous installation waits until complete -`CLAUDE_CODE_SYNTAX_HIGHLIGHT`| Set to `false` to disable syntax highlighting in diff output. Useful when colors interfere with your terminal setup +`CLAUDE_CODE_SYNTAX_HIGHLIGHT`| Set to `false` to disable syntax highlighting in diff output. Useful when colors interfere with your terminal setup. To also disable highlighting in code blocks and file previews, use the [`syntaxHighlightingDisabled`](</docs/en/settings>) setting `CLAUDE_CODE_TASK_LIST_ID`| Share a task list across sessions. Set the same ID in multiple Claude Code instances to coordinate on a shared task list. See [Task list](</docs/en/interactive-mode#task-list>) `CLAUDE_CODE_TEAM_NAME`| Name of the agent team this teammate belongs to. Set automatically on [agent team](</docs/en/agent-teams>) members `CLAUDE_CODE_TMPDIR`| Override the temp directory used for internal temp files. Claude Code appends `/claude-{uid}/` (Unix) or `/claude/` (Windows) to this path. Default: `/tmp` on macOS, `os.tmpdir()` on Linux/Windows @@ -162,6 +162,7 @@ `CLAUDE_CODE_USE_POWERSHELL_TOOL`| Controls the PowerShell tool. On Windows without Git Bash, the tool is enabled automatically; set to `0` to disable it. On Windows with Git Bash installed, the tool is rolling out progressively: set to `1` to opt in or `0` to opt out. On Linux, macOS, and WSL, set to `1` to enable it, which requires `pwsh` on your `PATH`. When enabled on Windows, Claude can run PowerShell commands natively instead of routing through Git Bash. See [PowerShell tool](</docs/en/tools-reference#powershell-tool>) `CLAUDE_CODE_USE_VERTEX`| Use [Vertex](</docs/en/google-vertex-ai>) `CLAUDE_CONFIG_DIR`| Override the configuration directory (default: `~/.claude`). All settings, credentials, session history, and plugins are stored under this path. Useful for running multiple accounts side by side: for example, `alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'` +`CLAUDE_EFFORT`| Set automatically in Bash tool subprocesses and hook commands to the active [effort level](</docs/en/model-config#adjust-effort-level>) for the turn: `low`, `medium`, `high`, `xhigh`, or `max`. Matches the `effort.level` field passed to [hooks](</docs/en/hooks>). Only set when the current model supports the effort parameter `CLAUDE_ENABLE_BYTE_WATCHDOG`| Set to `1` to force-enable the byte-level streaming idle watchdog, or set to `0` to force-disable it. When unset, the watchdog is enabled by default for Anthropic API connections. The byte watchdog aborts a connection when no bytes arrive on the wire for the duration set by `CLAUDE_STREAM_IDLE_TIMEOUT_MS`, with a minimum of 5 minutes, independent of the event-level watchdog `CLAUDE_ENABLE_STREAM_WATCHDOG`| Set to `1` to enable the event-level streaming idle watchdog. Off by default. For Bedrock, Vertex, and Foundry, this is the only idle watchdog available. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS` `CLAUDE_ENV_FILE`| Path to a shell script whose contents Claude Code runs before each Bash command in the same shell process, so exports in the file are visible to the command. Use to persist virtualenv or conda activation across commands. Also populated dynamically by [SessionStart](</docs/en/hooks#persist-environment-variables>), [Setup](</docs/en/hooks#setup>), [CwdChanged](</docs/en/hooks#cwdchanged>), and [FileChanged](</docs/en/hooks#filechanged>) hooks @@ -203,6 +204,7 @@ `MAX_THINKING_TOKENS`| Override the [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) token budget. The ceiling is the model’s [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>) minus one. Set to `0` to disable thinking entirely. On models with [adaptive reasoning](</docs/en/model-config#adjust-effort-level>), the budget is ignored unless adaptive reasoning is disabled via `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` `MCP_CLIENT_SECRET`| OAuth client secret for MCP servers that require [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>). Avoids the interactive prompt when adding a server with `--client-secret` `MCP_CONNECTION_NONBLOCKING`| Set to `true` in non-interactive mode (`-p`) to skip the MCP connection wait entirely. Useful for scripted pipelines where MCP tools are not needed. Without this variable, the first query waits up to 5 seconds for `--mcp-config` server connections. Servers configured with [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>) always block startup regardless of this variable, since their tools must be present when the first prompt is built +`MCP_CONNECT_TIMEOUT_MS`| How long the first query waits, in milliseconds, for the MCP connection batch before snapshotting the tool list (default: 5000). Servers still pending at the deadline keep connecting in the background but won’t appear until the next query. Distinct from `MCP_TIMEOUT`, which bounds an individual server’s connect attempt. Most relevant to non-interactive sessions that issue a single query and need slow-connecting servers to be visible `MCP_OAUTH_CALLBACK_PORT`| Fixed port for the OAuth redirect callback, as an alternative to `--callback-port` when adding an MCP server with [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>) `MCP_REMOTE_SERVER_CONNECTION_BATCH_SIZE`| Maximum number of remote MCP servers (HTTP/SSE) to connect in parallel during startup (default: 20) `MCP_SERVER_CONNECTION_BATCH_SIZE`| Maximum number of local MCP servers (stdio) to connect in parallel during startup (default: 3)
modified
--- a/env-vars.md +++ b/env-vars.md @@ -49,6 +49,7 @@ `CLAUDECODE`| Set to `1` in shell environments Claude Code spawns (Bash tool, tmux sessions). Not set in [hooks](</docs/en/hooks>) or [status line](</docs/en/statusline>) commands. Use to detect when a script is running inside a shell spawned by Claude Code `CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS`| Set to `1` to disable all built-in [subagent](</docs/en/sub-agents>) types such as Explore and Plan. Only applies in non-interactive mode (the `-p` flag). Useful for SDK users who want a blank slate `CLAUDE_AGENT_SDK_MCP_NO_PREFIX`| Set to `1` to skip the `mcp__<server>__` prefix on tool names from SDK-created MCP servers. Tools use their original names. SDK usage only +`CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS`| Stall timeout in milliseconds for background subagents. Default `600000` (10 minutes). The timer resets on each streaming progress event; if no progress arrives within the window, the subagent is aborted and the task is marked failed, surfacing any partial result to the parent `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](</docs/en/statusline>) `CLAUDE_AUTO_BACKGROUND_TASKS`| Set to `1` to force-enable automatic backgrounding of long-running agent tasks. When enabled, subagents are moved to the background after running for approximately two minutes `CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR`| Return to the original working directory after each Bash or PowerShell command in the main session @@ -57,7 +58,7 @@ `CLAUDE_CODE_API_KEY_HELPER_TTL_MS`| Interval in milliseconds at which credentials should be refreshed (when using [`apiKeyHelper`](</docs/en/settings#available-settings>)) `CLAUDE_CODE_ATTRIBUTION_HEADER`| Set to `0` to omit the attribution block (client version and prompt fingerprint) from the start of the system prompt. Disabling it improves prompt-cache hit rates when routing through an [LLM gateway](</docs/en/llm-gateway>). Anthropic API caching is unaffected `CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the context capacity in tokens used for auto-compaction calculations. Defaults to the model’s context window: 200K for standard models or 1M for [extended context](</docs/en/model-config#extended-context>) models. Use a lower value like `500000` on a 1M model to treat the window as 500K for compaction purposes. The value is capped at the model’s actual context window. `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` is applied as a percentage of this value. Setting this variable decouples the compaction threshold from the status line’s `used_percentage`, which always uses the model’s full context window -`CLAUDE_CODE_AUTO_CONNECT_IDE`| Override automatic [IDE connection](</docs/en/vs-code>). By default, Claude Code connects automatically when launched inside a supported IDE’s integrated terminal. Set to `false` to prevent this. Set to `true` to force a connection attempt when auto-detection fails, such as when tmux obscures the parent terminal +`CLAUDE_CODE_AUTO_CONNECT_IDE`| Override automatic [IDE connection](</docs/en/vs-code>). By default, Claude Code connects automatically when launched inside a supported IDE’s integrated terminal. Set to `false` to prevent this. Set to `true` to force a connection attempt when auto-detection fails, such as when tmux obscures the parent terminal. Takes precedence over the [`autoConnectIde`](</docs/en/settings#global-config-settings>) global config setting `CLAUDE_CODE_CERT_STORE`| Comma-separated list of CA certificate sources for TLS connections. `bundled` is the Mozilla CA set shipped with Claude Code. `system` is the operating system trust store. Default is `bundled,system` `CLAUDE_CODE_CLIENT_CERT`| Path to client certificate file for mTLS authentication `CLAUDE_CODE_CLIENT_KEY`| Path to client private key file for mTLS authentication @@ -66,14 +67,15 @@ `CLAUDE_CODE_DEBUG_LOG_LEVEL`| Minimum log level written to the debug log file. Values: `verbose`, `debug` (default), `info`, `warn`, `error`. Set to `verbose` to include high-volume diagnostics like full status line command output, or raise to `error` to reduce noise `CLAUDE_CODE_DISABLE_1M_CONTEXT`| Set to `1` to disable [1M context window](</docs/en/model-config#extended-context>) support. When set, 1M model variants are unavailable in the model picker. Useful for enterprise environments with compliance requirements `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING`| Set to `1` to disable [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) on Opus 4.6 and Sonnet 4.6 and fall back to the fixed thinking budget controlled by `MAX_THINKING_TOKENS`. Has no effect on Opus 4.7, which always uses adaptive reasoning +`CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN`| Set to `1` to disable [fullscreen rendering](</docs/en/fullscreen>) and use the classic main-screen renderer. The conversation stays in your terminal’s native scrollback so `Cmd+f` and tmux copy mode work as usual. Takes precedence over `CLAUDE_CODE_NO_FLICKER` and the [`tui`](</docs/en/settings#available-settings>) setting. You can also switch with `/tui default` `CLAUDE_CODE_DISABLE_ATTACHMENTS`| Set to `1` to disable attachment processing. File mentions with `@` syntax are sent as plain text instead of being expanded into file content -`CLAUDE_CODE_DISABLE_AUTO_MEMORY`| Set to `1` to disable [auto memory](</docs/en/memory#auto-memory>). Set to `0` to force auto memory on during the gradual rollout. When disabled, Claude does not create or load auto memory files +`CLAUDE_CODE_DISABLE_AUTO_MEMORY`| Set to `1` to disable [auto memory](</docs/en/memory#auto-memory>). Set to `0` to force auto memory on even when `--bare` mode or [`autoMemoryEnabled: false`](</docs/en/settings#available-settings>) would otherwise disable it. When disabled, Claude does not create or load auto memory files `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 `CLAUDE_CODE_DISABLE_CLAUDE_MDS`| Set to `1` to prevent loading any CLAUDE.md memory files into context, including user, project, and auto-memory files `CLAUDE_CODE_DISABLE_CRON`| Set to `1` to disable [scheduled tasks](</docs/en/scheduled-tasks>). The `/loop` skill and cron tools become unavailable and any already-scheduled tasks stop firing, including tasks that are already running mid-session `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`| Set to `1` to strip Anthropic-specific `anthropic-beta` request headers and beta tool-schema fields (such as `defer_loading` and `eager_input_streaming`) from API requests. Use this when a proxy gateway rejects requests with errors like “Unexpected value(s) for the `anthropic-beta` header” or “Extra inputs are not permitted”. Standard fields (`name`, `description`, `input_schema`, `cache_control`) are preserved. `CLAUDE_CODE_DISABLE_FAST_MODE`| Set to `1` to disable [fast mode](</docs/en/fast-mode>) -`CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY`| Set to `1` to disable the “How is Claude doing?” session quality surveys. Surveys are also disabled when `DISABLE_TELEMETRY` or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` is set. See [Session quality surveys](</docs/en/data-usage#session-quality-surveys>) +`CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY`| Set to `1` to disable the “How is Claude doing?” session quality surveys. Surveys are also disabled when `DISABLE_TELEMETRY` or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` is set. To set a sample rate instead of disabling outright, use the [`feedbackSurveyRate`](</docs/en/settings#available-settings>) setting. See [Session quality surveys](</docs/en/data-usage#session-quality-surveys>) `CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING`| Set to `1` to disable file [checkpointing](</docs/en/checkpointing>). The `/rewind` command will not be able to restore code changes `CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS`| Set to `1` to remove built-in commit and PR workflow instructions and the git status snapshot from Claude’s system prompt. Useful when using your own git workflow skills. Takes precedence over the [`includeGitInstructions`](</docs/en/settings#available-settings>) setting when set `CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP`| Set to `1` to prevent automatic remapping of Opus 4.0 and 4.1 to the current Opus version on the Anthropic API. Use when you intentionally want to pin an older model. The remap does not run on Bedrock, Vertex, or Foundry @@ -88,7 +90,8 @@ `CLAUDE_CODE_EFFORT_LEVEL`| Set the effort level for supported models. Values: `low`, `medium`, `high`, `xhigh`, `max`, or `auto` to use the model default. Available levels depend on the model. Takes precedence over `/effort` and the `effortLevel` setting. See [Adjust effort level](</docs/en/model-config#adjust-effort-level>) `CLAUDE_CODE_ENABLE_AWAY_SUMMARY`| Override [session recap](</docs/en/interactive-mode#session-recap>) availability. Set to `0` to force recaps off regardless of the `/config` toggle. Set to `1` to force recaps on when [`awaySummaryEnabled`](</docs/en/settings#available-settings>) is `false`. Takes precedence over the setting and `/config` toggle `CLAUDE_CODE_ENABLE_BACKGROUND_PLUGIN_REFRESH`| Set to `1` to refresh plugin state at turn boundaries in [non-interactive mode](</docs/en/headless>) after a background install completes. Off by default because the refresh changes the system prompt mid-session, which invalidates [prompt caching](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching>) for that turn -`CLAUDE_CODE_ENABLE_FINE_GRAINED_TOOL_STREAMING`| Set to `1` to force-enable fine-grained tool input streaming. Without this, the API buffers tool input parameters fully before sending delta events, which can delay display on large tool inputs. Anthropic API only: has no effect on Bedrock, Vertex, or Foundry +`CLAUDE_CODE_ENABLE_FINE_GRAINED_TOOL_STREAMING`| Controls whether tool call inputs stream from the API as Claude generates them. With this off, a large tool input such as a long file write arrives only after Claude finishes generating it, which can look like it’s hanging. Enabled by default for direct Anthropic API connections. Set to `0` to opt out. Set to `1` to force-enable even when the server-side default is off. Has no effect on Bedrock, Vertex, Foundry, or [gateway](</docs/en/llm-gateway>) connections +`CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY`| Set to `1` to populate the `/model` picker from your gateway’s `/v1/models` endpoint when `ANTHROPIC_BASE_URL` points at an Anthropic-compatible gateway such as LiteLLM, Kong, or an internal proxy. Off by default because gateways backed by a shared API key would otherwise show every user every model the key can access. Discovered models are still filtered by the [`availableModels`](</docs/en/settings#available-settings>) allowlist `CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION`| Set to `false` to disable prompt suggestions (the “Prompt suggestions” toggle in `/config`). These are the grayed-out predictions that appear in your prompt input after Claude responds. See [Prompt suggestions](</docs/en/interactive-mode#prompt-suggestions>) `CLAUDE_CODE_ENABLE_TASKS`| Set to `1` to enable the task tracking system in non-interactive mode (the `-p` flag). Tasks are on by default in interactive mode. See [Task list](</docs/en/interactive-mode#task-list>) `CLAUDE_CODE_ENABLE_TELEMETRY`| Set to `1` to enable OpenTelemetry data collection for metrics and logging. Required before configuring OTel exporters. See [Monitoring](</docs/en/monitoring-usage>) @@ -96,6 +99,7 @@ `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS`| Set to `1` to enable [agent teams](</docs/en/agent-teams>). Agent teams are experimental and disabled by default `CLAUDE_CODE_EXTRA_BODY`| JSON object to merge into the top level of every API request body. Useful for passing provider-specific parameters that Claude Code does not expose directly `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 +`CLAUDE_CODE_FORCE_SYNC_OUTPUT`| Set to `1` to force-enable DEC private mode 2026 [synchronized output](<https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036>) when your terminal supports it but is not auto-detected. Useful for emulators such as Emacs `eat` that implement BSU/ESU but do not reply to the capability probe. Has no effect under tmux `CLAUDE_CODE_FORK_SUBAGENT`| Set to `1` to enable [forked subagents](</docs/en/sub-agents#fork-the-current-conversation>). A forked subagent inherits the full conversation context from the main session instead of starting fresh. When enabled, `/fork` spawns a forked subagent rather than acting as an alias for [`/branch`](</docs/en/commands>), and all subagent spawns run in the background. Works in interactive mode and via the SDK or `claude -p` `CLAUDE_CODE_GIT_BASH_PATH`| Windows only: path to the Git Bash executable (`bash.exe`). Use when Git Bash is installed but not in your PATH. See [Windows setup](</docs/en/setup#set-up-on-windows>) `CLAUDE_CODE_GLOB_HIDDEN`| Set to `false` to exclude dotfiles from results when Claude invokes the [Glob tool](</docs/en/tools-reference>). Included by default. Does not affect `@` file autocomplete, `ls`, Grep, or Read @@ -118,6 +122,7 @@ `CLAUDE_CODE_OTEL_FLUSH_TIMEOUT_MS`| Timeout in milliseconds for flushing pending OpenTelemetry spans (default: 5000). See [Monitoring](</docs/en/monitoring-usage>) `CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS`| Interval for refreshing dynamic OpenTelemetry headers in milliseconds (default: 1740000 / 29 minutes). See [Dynamic headers](</docs/en/monitoring-usage#dynamic-headers>) `CLAUDE_CODE_OTEL_SHUTDOWN_TIMEOUT_MS`| Timeout in milliseconds for the OpenTelemetry exporter to finish on shutdown (default: 2000). Increase if metrics are dropped at exit. See [Monitoring](</docs/en/monitoring-usage>) +`CLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATE`| Set to `1` to let Claude Code run your package manager’s upgrade command in the background when a new version is available. Applies to Homebrew and WinGet installations. Other package managers continue to show the upgrade command without running it. See [Auto updates](</docs/en/setup#auto-updates>) `CLAUDE_CODE_PERFORCE_MODE`| Set to `1` to enable Perforce-aware write protection. When set, Edit, Write, and NotebookEdit fail with a `p4 edit <file>` hint if the target file lacks the owner-write bit, which Perforce clears on synced files until `p4 edit` opens them. This prevents Claude Code from bypassing Perforce change tracking `CLAUDE_CODE_PLUGIN_CACHE_DIR`| Override the plugins root directory. Despite the name, this sets the parent directory, not the cache itself: marketplaces and the plugin cache live in subdirectories under this path. Defaults to `~/.claude/plugins` `CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS`| Timeout in milliseconds for git operations when installing or updating plugins (default: 120000). Increase this value for large repositories or slow network connections. See [Git operations time out](</docs/en/plugin-marketplaces#git-operations-time-out>) @@ -129,8 +134,9 @@ `CLAUDE_CODE_REMOTE_SESSION_ID`| Set automatically in [cloud sessions](</docs/en/claude-code-on-the-web>) to the current session’s ID. Read this to construct a link back to the session transcript. See [Link artifacts back to the session](</docs/en/claude-code-on-the-web#link-artifacts-back-to-the-session>) `CLAUDE_CODE_RESUME_INTERRUPTED_TURN`| Set to `1` to automatically resume if the previous session ended mid-turn. Used in SDK mode so the model continues without requiring the SDK to re-send the prompt `CLAUDE_CODE_SCRIPT_CAPS`| JSON object limiting how many times specific scripts may be invoked per session when `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB` is set. Keys are substrings matched against the command text; values are integer call limits. For example, `{"deploy.sh": 2}` allows `deploy.sh` to be called at most twice. Matching is substring-based so shell-expansion tricks like `./scripts/deploy.sh $(evil)` still count against the cap. Runtime fan-out via `xargs` or `find -exec` is not detected; this is a defense-in-depth control -`CLAUDE_CODE_SCROLL_SPEED`| Set the mouse wheel scroll multiplier in [fullscreen rendering](</docs/en/fullscreen#mouse-wheel-scrolling>). Accepts values from 1 to 20. Set to `3` to match `vim` if your terminal sends one wheel event per notch without amplification +`CLAUDE_CODE_SCROLL_SPEED`| Set the mouse wheel scroll multiplier in [fullscreen rendering](</docs/en/fullscreen#mouse-wheel-scrolling>). Accepts values from 1 to 20. Set to `3` to match `vim` if your terminal sends one wheel event per notch without amplification. Ignored in the JetBrains IDE terminal, where Claude Code uses its own scroll handling `CLAUDE_CODE_SESSIONEND_HOOKS_TIMEOUT_MS`| Override the time budget in milliseconds for [SessionEnd](</docs/en/hooks#sessionend>) hooks. Applies to session exit, `/clear`, and switching sessions via interactive `/resume`. By default the budget is 1.5 seconds, automatically raised to the highest per-hook `timeout` configured in settings files, up to 60 seconds. Timeouts on plugin-provided hooks do not raise the budget +`CLAUDE_CODE_SESSION_ID`| Set automatically in Bash and PowerShell tool subprocesses to the current session ID. Matches the `session_id` field passed to [hooks](</docs/en/hooks>). Updated on `/clear`. Use to correlate scripts and external tools with the Claude Code session that launched them `CLAUDE_CODE_SHELL`| Override automatic shell detection. Useful when your login shell differs from your preferred working shell (for example, `bash` vs `zsh`) `CLAUDE_CODE_SHELL_PREFIX`| Command prefix that wraps shell commands Claude Code spawns: Bash tool calls, [hook](</docs/en/hooks>) commands, and stdio [MCP server](</docs/en/mcp>) startup commands. Useful for logging or auditing. Example: setting `/path/to/logger.sh` runs each command as `/path/to/logger.sh <command>` `CLAUDE_CODE_SIMPLE`| Set to `1` to run with a minimal system prompt and only the Bash, file read, and file edit tools. MCP tools from `--mcp-config` are still available. Disables auto-discovery of hooks, skills, plugins, MCP servers, auto memory, and CLAUDE.md. The [`--bare`](</docs/en/headless#start-faster-with-bare-mode>) CLI flag sets this
modified
--- a/env-vars.md +++ b/env-vars.md @@ -58,7 +58,7 @@ `CLAUDE_CODE_ATTRIBUTION_HEADER`| Set to `0` to omit the attribution block (client version and prompt fingerprint) from the start of the system prompt. Disabling it improves prompt-cache hit rates when routing through an [LLM gateway](</docs/en/llm-gateway>). Anthropic API caching is unaffected `CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the context capacity in tokens used for auto-compaction calculations. Defaults to the model’s context window: 200K for standard models or 1M for [extended context](</docs/en/model-config#extended-context>) models. Use a lower value like `500000` on a 1M model to treat the window as 500K for compaction purposes. The value is capped at the model’s actual context window. `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` is applied as a percentage of this value. Setting this variable decouples the compaction threshold from the status line’s `used_percentage`, which always uses the model’s full context window `CLAUDE_CODE_AUTO_CONNECT_IDE`| Override automatic [IDE connection](</docs/en/vs-code>). By default, Claude Code connects automatically when launched inside a supported IDE’s integrated terminal. Set to `false` to prevent this. Set to `true` to force a connection attempt when auto-detection fails, such as when tmux obscures the parent terminal -`CLAUDE_CODE_CERT_STORE`| Comma-separated list of CA certificate sources for TLS connections. `bundled` is the Mozilla CA set shipped with Claude Code. `system` is the operating system trust store. Default is `bundled,system`. The native binary distribution is required for system store integration. On the Node.js runtime, only the bundled set is used regardless of this value +`CLAUDE_CODE_CERT_STORE`| Comma-separated list of CA certificate sources for TLS connections. `bundled` is the Mozilla CA set shipped with Claude Code. `system` is the operating system trust store. Default is `bundled,system` `CLAUDE_CODE_CLIENT_CERT`| Path to client certificate file for mTLS authentication `CLAUDE_CODE_CLIENT_KEY`| Path to client private key file for mTLS authentication `CLAUDE_CODE_CLIENT_KEY_PASSPHRASE`| Passphrase for encrypted CLAUDE_CODE_CLIENT_KEY (optional) @@ -179,7 +179,7 @@ `DISABLE_PROMPT_CACHING_HAIKU`| Set to `1` to disable prompt caching for Haiku models `DISABLE_PROMPT_CACHING_OPUS`| Set to `1` to disable prompt caching for Opus models `DISABLE_PROMPT_CACHING_SONNET`| Set to `1` to disable prompt caching for Sonnet models -`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) +`DISABLE_TELEMETRY`| Set to `1` to opt out of telemetry. Telemetry events do not include user data like code, file paths, or bash commands `DISABLE_UPDATES`| Set to `1` to block all updates including manual `claude update` and `claude install`. Stricter than `DISABLE_AUTOUPDATER`. Use when distributing Claude Code through your own channels and users should not self-update `DISABLE_UPGRADE_COMMAND`| Set to `1` to hide the `/upgrade` command `ENABLE_CLAUDEAI_MCP_SERVERS`| Set to `false` to disable [claude.ai MCP servers](</docs/en/mcp#use-mcp-servers-from-claude-ai>) in Claude Code. Enabled by default for logged-in users @@ -196,7 +196,7 @@ `MAX_STRUCTURED_OUTPUT_RETRIES`| Number of times to retry when the model’s response fails validation against the [`--json-schema`](</docs/en/cli-reference#cli-flags>) in non-interactive mode (the `-p` flag). Defaults to 5 `MAX_THINKING_TOKENS`| Override the [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) token budget. The ceiling is the model’s [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>) minus one. Set to `0` to disable thinking entirely. On models with [adaptive reasoning](</docs/en/model-config#adjust-effort-level>), the budget is ignored unless adaptive reasoning is disabled via `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` `MCP_CLIENT_SECRET`| OAuth client secret for MCP servers that require [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>). Avoids the interactive prompt when adding a server with `--client-secret` -`MCP_CONNECTION_NONBLOCKING`| Set to `true` in non-interactive mode (`-p`) to skip the MCP connection wait entirely. Useful for scripted pipelines where MCP tools are not needed. Without this variable, the first query waits up to 5 seconds for `--mcp-config` server connections +`MCP_CONNECTION_NONBLOCKING`| Set to `true` in non-interactive mode (`-p`) to skip the MCP connection wait entirely. Useful for scripted pipelines where MCP tools are not needed. Without this variable, the first query waits up to 5 seconds for `--mcp-config` server connections. Servers configured with [`alwaysLoad: true`](</docs/en/mcp#exempt-a-server-from-deferral>) always block startup regardless of this variable, since their tools must be present when the first prompt is built `MCP_OAUTH_CALLBACK_PORT`| Fixed port for the OAuth redirect callback, as an alternative to `--callback-port` when adding an MCP server with [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>) `MCP_REMOTE_SERVER_CONNECTION_BATCH_SIZE`| Maximum number of remote MCP servers (HTTP/SSE) to connect in parallel during startup (default: 20) `MCP_SERVER_CONNECTION_BATCH_SIZE`| Maximum number of local MCP servers (stdio) to connect in parallel during startup (default: 3)
modified
--- a/env-vars.md +++ b/env-vars.md @@ -132,7 +132,7 @@ `CLAUDE_CODE_SCROLL_SPEED`| Set the mouse wheel scroll multiplier in [fullscreen rendering](</docs/en/fullscreen#mouse-wheel-scrolling>). Accepts values from 1 to 20. Set to `3` to match `vim` if your terminal sends one wheel event per notch without amplification `CLAUDE_CODE_SESSIONEND_HOOKS_TIMEOUT_MS`| Override the time budget in milliseconds for [SessionEnd](</docs/en/hooks#sessionend>) hooks. Applies to session exit, `/clear`, and switching sessions via interactive `/resume`. By default the budget is 1.5 seconds, automatically raised to the highest per-hook `timeout` configured in settings files, up to 60 seconds. Timeouts on plugin-provided hooks do not raise the budget `CLAUDE_CODE_SHELL`| Override automatic shell detection. Useful when your login shell differs from your preferred working shell (for example, `bash` vs `zsh`) -`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>` +`CLAUDE_CODE_SHELL_PREFIX`| Command prefix that wraps shell commands Claude Code spawns: Bash tool calls, [hook](</docs/en/hooks>) commands, and stdio [MCP server](</docs/en/mcp>) startup commands. Useful for logging or auditing. Example: setting `/path/to/logger.sh` runs each command as `/path/to/logger.sh <command>` `CLAUDE_CODE_SIMPLE`| Set to `1` to run with a minimal system prompt and only the Bash, file read, and file edit tools. MCP tools from `--mcp-config` are still available. Disables auto-discovery of hooks, skills, plugins, MCP servers, auto memory, and CLAUDE.md. The [`--bare`](</docs/en/headless#start-faster-with-bare-mode>) CLI flag sets this `CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT`| Set to `1` to use a shorter system prompt and abbreviated tool descriptions on Opus 4.7. Has no effect on other models. The full tool set, hooks, MCP servers, and CLAUDE.md discovery remain enabled `CLAUDE_CODE_SKIP_BEDROCK_AUTH`| Skip AWS authentication for Bedrock (for example, when using an LLM gateway)
modified
--- a/env-vars.md +++ b/env-vars.md @@ -123,6 +123,7 @@ `CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS`| Timeout in milliseconds for git operations when installing or updating plugins (default: 120000). Increase this value for large repositories or slow network connections. See [Git operations time out](</docs/en/plugin-marketplaces#git-operations-time-out>) `CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE`| Set to `1` to keep the existing marketplace cache when a `git pull` fails instead of wiping and re-cloning. Useful in offline or airgapped environments where re-cloning would fail the same way. See [Marketplace updates fail in offline environments](</docs/en/plugin-marketplaces#marketplace-updates-fail-in-offline-environments>) `CLAUDE_CODE_PLUGIN_SEED_DIR`| Path to one or more read-only plugin seed directories, separated by `:` on Unix or `;` on Windows. Use this to bundle a pre-populated plugins directory into a container image. Claude Code registers marketplaces from these directories at startup and uses pre-cached plugins without re-cloning. See [Pre-populate plugins for containers](</docs/en/plugin-marketplaces#pre-populate-plugins-for-containers>) +`CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST`| Set by host platforms that embed Claude Code and manage model provider routing on its behalf. When set, provider-selection, endpoint, and authentication variables such as `CLAUDE_CODE_USE_BEDROCK`, `ANTHROPIC_BASE_URL`, and `ANTHROPIC_API_KEY` in settings files are ignored so user settings cannot override the host’s routing. The automatic telemetry opt-out for Bedrock, Vertex, and Foundry is also skipped, so telemetry follows the standard `DISABLE_TELEMETRY` opt-out. See [Default behaviors by API provider](</docs/en/data-usage#default-behaviors-by-api-provider>) `CLAUDE_CODE_PROXY_RESOLVES_HOSTS`| Set to `1` to allow the proxy to perform DNS resolution instead of the caller. Opt-in for environments where the proxy should handle hostname resolution `CLAUDE_CODE_REMOTE`| Set automatically to `true` when Claude Code is running as a [cloud session](</docs/en/claude-code-on-the-web>). Read this from a hook or setup script to detect whether you are in a cloud environment `CLAUDE_CODE_REMOTE_SESSION_ID`| Set automatically in [cloud sessions](</docs/en/claude-code-on-the-web>) to the current session’s ID. Read this to construct a link back to the session transcript. See [Link artifacts back to the session](</docs/en/claude-code-on-the-web#link-artifacts-back-to-the-session>) @@ -159,7 +160,7 @@ `CLAUDE_ENABLE_STREAM_WATCHDOG`| Set to `1` to enable the event-level streaming idle watchdog. Off by default. For Bedrock, Vertex, and Foundry, this is the only idle watchdog available. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS` `CLAUDE_ENV_FILE`| Path to a shell script whose contents Claude Code runs before each Bash command in the same shell process, so exports in the file are visible to the command. Use to persist virtualenv or conda activation across commands. Also populated dynamically by [SessionStart](</docs/en/hooks#persist-environment-variables>), [Setup](</docs/en/hooks#setup>), [CwdChanged](</docs/en/hooks#cwdchanged>), and [FileChanged](</docs/en/hooks#filechanged>) hooks `CLAUDE_REMOTE_CONTROL_SESSION_NAME_PREFIX`| Prefix for auto-generated [Remote Control](</docs/en/remote-control>) session names when no explicit name is provided. Defaults to your machine’s hostname, producing names like `myhost-graceful-unicorn`. The `--remote-control-session-name-prefix` CLI flag sets the same value for a single invocation -`CLAUDE_STREAM_IDLE_TIMEOUT_MS`| Timeout in milliseconds before the streaming idle watchdog closes a stalled connection. For the byte-level watchdog on the Anthropic API: default and minimum `300000` (5 minutes); lower values are silently clamped to absorb extended thinking pauses and proxy buffering. For the event-level watchdog: default `90000` (90 seconds), no minimum. For third-party providers, requires `CLAUDE_ENABLE_STREAM_WATCHDOG=1` +`CLAUDE_STREAM_IDLE_TIMEOUT_MS`| Timeout in milliseconds before the streaming idle watchdog closes a stalled connection. Default and minimum `300000` (5 minutes) for both the byte-level and event-level watchdogs; lower values are silently clamped to absorb extended thinking pauses and proxy buffering. For third-party providers, requires `CLAUDE_ENABLE_STREAM_WATCHDOG=1` `DISABLE_AUTOUPDATER`| Set to `1` to disable automatic background updates. Manual `claude update` still works. Use `DISABLE_UPDATES` to block both `DISABLE_AUTO_COMPACT`| Set to `1` to disable automatic compaction when approaching the context limit. The manual `/compact` command remains available. Use when you want explicit control over when compaction occurs `DISABLE_COMPACT`| Set to `1` to disable all compaction: both automatic compaction and the manual `/compact` command @@ -168,6 +169,7 @@ `DISABLE_ERROR_REPORTING`| Set to `1` to opt out of Sentry error reporting `DISABLE_EXTRA_USAGE_COMMAND`| Set to `1` to hide the `/extra-usage` command that lets users purchase additional usage beyond rate limits `DISABLE_FEEDBACK_COMMAND`| Set to `1` to disable the `/feedback` command. The older name `DISABLE_BUG_COMMAND` is also accepted +`DISABLE_GROWTHBOOK`| Set to `1` to disable GrowthBook feature-flag fetching and use code defaults for every flag. Telemetry event logging stays on unless `DISABLE_TELEMETRY` is also set `DISABLE_INSTALLATION_CHECKS`| Set to `1` to disable installation warnings. Use only when manually managing the installation location, as this can mask issues with standard installations `DISABLE_INSTALL_GITHUB_APP_COMMAND`| Set to `1` to hide the `/install-github-app` command. Already hidden when using third-party providers (Bedrock, Vertex, or Foundry) `DISABLE_INTERLEAVED_THINKING`| Set to `1` to prevent sending the interleaved-thinking beta header. Useful when your LLM gateway or provider does not support [interleaved thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking#interleaved-thinking>)
modified
--- a/env-vars.md +++ b/env-vars.md @@ -1,3 +1,9 @@ +> ## Documentation Index +> +> Fetch the complete documentation index at: <https://code.claude.com/docs/llms.txt> +> +> Use this file to discover all available pages before exploring further. + Claude Code supports the following environment variables to control its behavior. Set them in your shell before launching `claude`, or configure them in [`settings.json`](</docs/en/settings#available-settings>) under the `env` key to apply them to every session or roll them out across your team. Variable| Purpose @@ -7,6 +13,7 @@ `ANTHROPIC_BASE_URL`| Override the API endpoint to route requests through a proxy or gateway. When set to a non-first-party host, [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) is disabled by default. Set `ENABLE_TOOL_SEARCH=true` if your proxy forwards `tool_reference` blocks `ANTHROPIC_BEDROCK_BASE_URL`| Override the Bedrock endpoint URL. Use for custom Bedrock endpoints or when routing through an [LLM gateway](</docs/en/llm-gateway>). See [Amazon Bedrock](</docs/en/amazon-bedrock>) `ANTHROPIC_BEDROCK_MANTLE_BASE_URL`| Override the Bedrock Mantle endpoint URL. See [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>) +`ANTHROPIC_BEDROCK_SERVICE_TIER`| Bedrock [service tier](<https://docs.aws.amazon.com/bedrock/latest/userguide/service-tiers-inference.html>) (`default`, `flex`, or `priority`). Sent as the `X-Amzn-Bedrock-Service-Tier` header. See [Amazon Bedrock](</docs/en/amazon-bedrock#service-tiers>) `ANTHROPIC_BETAS`| Comma-separated list of additional `anthropic-beta` header values to include in API requests. Claude Code already sends the beta headers it needs; use this to opt into an [Anthropic API beta](<https://platform.claude.com/docs/en/api/beta-headers>) before Claude Code adds native support. Unlike the [`--betas` flag](</docs/en/cli-reference#cli-flags>), which requires API key authentication, this variable works with all auth methods including Claude.ai subscription `ANTHROPIC_CUSTOM_HEADERS`| Custom headers to add to requests (`Name: Value` format, newline-separated for multiple headers) `ANTHROPIC_CUSTOM_MODEL_OPTION`| Model ID to add as a custom entry in the `/model` picker. Use this to make a non-standard or gateway-specific model selectable without replacing built-in aliases. See [Model configuration](</docs/en/model-config#add-a-custom-model-option>) @@ -48,6 +55,7 @@ `CLAUDE_CODE_ACCESSIBILITY`| Set to `1` to keep the native terminal cursor visible and disable the inverted-text cursor indicator. Allows screen magnifiers like macOS Zoom to track cursor position `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD`| Set to `1` to load memory files from directories specified with `--add-dir`. Loads `CLAUDE.md`, `.claude/CLAUDE.md`, `.claude/rules/*.md`, and `CLAUDE.local.md`. By default, additional directories do not load memory files `CLAUDE_CODE_API_KEY_HELPER_TTL_MS`| Interval in milliseconds at which credentials should be refreshed (when using [`apiKeyHelper`](</docs/en/settings#available-settings>)) +`CLAUDE_CODE_ATTRIBUTION_HEADER`| Set to `0` to omit the attribution block (client version and prompt fingerprint) from the start of the system prompt. Disabling it improves prompt-cache hit rates when routing through an [LLM gateway](</docs/en/llm-gateway>). Anthropic API caching is unaffected `CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the context capacity in tokens used for auto-compaction calculations. Defaults to the model’s context window: 200K for standard models or 1M for [extended context](</docs/en/model-config#extended-context>) models. Use a lower value like `500000` on a 1M model to treat the window as 500K for compaction purposes. The value is capped at the model’s actual context window. `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` is applied as a percentage of this value. Setting this variable decouples the compaction threshold from the status line’s `used_percentage`, which always uses the model’s full context window `CLAUDE_CODE_AUTO_CONNECT_IDE`| Override automatic [IDE connection](</docs/en/vs-code>). By default, Claude Code connects automatically when launched inside a supported IDE’s integrated terminal. Set to `false` to prevent this. Set to `true` to force a connection attempt when auto-detection fails, such as when tmux obscures the parent terminal `CLAUDE_CODE_CERT_STORE`| Comma-separated list of CA certificate sources for TLS connections. `bundled` is the Mozilla CA set shipped with Claude Code. `system` is the operating system trust store. Default is `bundled,system`. The native binary distribution is required for system store integration. On the Node.js runtime, only the bundled set is used regardless of this value @@ -73,6 +81,7 @@ `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`| Equivalent of setting `DISABLE_AUTOUPDATER`, `DISABLE_FEEDBACK_COMMAND`, `DISABLE_ERROR_REPORTING`, and `DISABLE_TELEMETRY` `CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK`| Set to `1` to disable the non-streaming fallback when a streaming request fails mid-stream. Streaming errors propagate to the retry layer instead. Useful when a proxy or gateway causes the fallback to produce duplicate tool execution `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL`| Set to `1` to skip automatic addition of the official plugin marketplace on first run +`CLAUDE_CODE_DISABLE_POLICY_SKILLS`| Set to `1` to skip loading skills from the system-wide managed skills directory. Useful for container or CI sessions that should not load operator-provisioned skills `CLAUDE_CODE_DISABLE_TERMINAL_TITLE`| Set to `1` to disable automatic terminal title updates based on conversation context `CLAUDE_CODE_DISABLE_THINKING`| Set to `1` to force-disable [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) regardless of model support or other settings. More direct than `MAX_THINKING_TOKENS=0` `CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL`| Set to `1` to disable virtual scrolling in [fullscreen rendering](</docs/en/fullscreen>) and render every message in the transcript. Use this if scrolling in fullscreen mode shows blank regions where messages should appear @@ -85,6 +94,7 @@ `CLAUDE_CODE_ENABLE_TELEMETRY`| Set to `1` to enable OpenTelemetry data collection for metrics and logging. Required before configuring OTel exporters. See [Monitoring](</docs/en/monitoring-usage>) `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 `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS`| Set to `1` to enable [agent teams](</docs/en/agent-teams>). Agent teams are experimental and disabled by default +`CLAUDE_CODE_EXTRA_BODY`| JSON object to merge into the top level of every API request body. Useful for passing provider-specific parameters that Claude Code does not expose directly `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 `CLAUDE_CODE_FORK_SUBAGENT`| Set to `1` to enable [forked subagents](</docs/en/sub-agents#fork-the-current-conversation>). A forked subagent inherits the full conversation context from the main session instead of starting fresh. When enabled, `/fork` spawns a forked subagent rather than acting as an alias for [`/branch`](</docs/en/commands>), and all subagent spawns run in the background. Works in interactive mode and via the SDK or `claude -p` `CLAUDE_CODE_GIT_BASH_PATH`| Windows only: path to the Git Bash executable (`bash.exe`). Use when Git Bash is installed but not in your PATH. See [Windows setup](</docs/en/setup#set-up-on-windows>) @@ -99,6 +109,7 @@ `CLAUDE_CODE_MAX_OUTPUT_TOKENS`| Set the maximum number of output tokens for most requests. Defaults and caps vary by model; see [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>). Increasing this value reduces the effective context window available before [auto-compaction](</docs/en/costs#reduce-token-usage>) triggers. `CLAUDE_CODE_MAX_RETRIES`| Override the number of times to retry failed API requests (default: 10) `CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY`| Maximum number of read-only tools and subagents that can execute in parallel (default: 10). Higher values increase parallelism but consume more resources +`CLAUDE_CODE_MCP_ALLOWLIST_ENV`| Set to `1` to spawn stdio MCP servers with only a safe baseline environment plus the server’s configured `env`, instead of inheriting your shell environment `CLAUDE_CODE_NEW_INIT`| Set to `1` to make `/init` run an interactive setup flow. The flow asks which files to generate, including CLAUDE.md, skills, and hooks, before exploring the codebase and writing them. Without this variable, `/init` generates a CLAUDE.md automatically without prompting. `CLAUDE_CODE_NO_FLICKER`| Set to `1` to enable [fullscreen rendering](</docs/en/fullscreen>), a research preview that reduces flicker and keeps memory flat in long conversations. Equivalent to the [`tui`](</docs/en/settings#available-settings>) setting; you can also switch with `/tui fullscreen` `CLAUDE_CODE_OAUTH_REFRESH_TOKEN`| OAuth refresh token for Claude.ai authentication. When set, `claude auth login` exchanges this token directly instead of opening a browser. Requires `CLAUDE_CODE_OAUTH_SCOPES`. Useful for provisioning authentication in automated environments @@ -140,12 +151,13 @@ `CLAUDE_CODE_USE_BEDROCK`| Use [Bedrock](</docs/en/amazon-bedrock>) `CLAUDE_CODE_USE_FOUNDRY`| Use [Microsoft Foundry](</docs/en/microsoft-foundry>) `CLAUDE_CODE_USE_MANTLE`| Use the Bedrock [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>) -`CLAUDE_CODE_USE_POWERSHELL_TOOL`| Controls the PowerShell tool. On Windows, the tool is rolling out progressively: set to `1` to opt in or `0` to opt out. On Linux, macOS, and WSL, set to `1` to enable it, which requires `pwsh` on your `PATH`. When enabled on Windows, Claude can run PowerShell commands natively instead of routing through Git Bash. See [PowerShell tool](</docs/en/tools-reference#powershell-tool>) +`CLAUDE_CODE_USE_NATIVE_FILE_SEARCH`| Set to `1` to discover custom commands, subagents, and output styles using Node.js file APIs instead of ripgrep. Set this if the bundled ripgrep binary is unavailable or blocked in your environment. Does not affect the Grep or file search tools +`CLAUDE_CODE_USE_POWERSHELL_TOOL`| Controls the PowerShell tool. On Windows without Git Bash, the tool is enabled automatically; set to `0` to disable it. On Windows with Git Bash installed, the tool is rolling out progressively: set to `1` to opt in or `0` to opt out. On Linux, macOS, and WSL, set to `1` to enable it, which requires `pwsh` on your `PATH`. When enabled on Windows, Claude can run PowerShell commands natively instead of routing through Git Bash. See [PowerShell tool](</docs/en/tools-reference#powershell-tool>) `CLAUDE_CODE_USE_VERTEX`| Use [Vertex](</docs/en/google-vertex-ai>) `CLAUDE_CONFIG_DIR`| Override the configuration directory (default: `~/.claude`). All settings, credentials, session history, and plugins are stored under this path. Useful for running multiple accounts side by side: for example, `alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'` `CLAUDE_ENABLE_BYTE_WATCHDOG`| Set to `1` to force-enable the byte-level streaming idle watchdog, or set to `0` to force-disable it. When unset, the watchdog is enabled by default for Anthropic API connections. The byte watchdog aborts a connection when no bytes arrive on the wire for the duration set by `CLAUDE_STREAM_IDLE_TIMEOUT_MS`, with a minimum of 5 minutes, independent of the event-level watchdog `CLAUDE_ENABLE_STREAM_WATCHDOG`| Set to `1` to enable the event-level streaming idle watchdog. Off by default. For Bedrock, Vertex, and Foundry, this is the only idle watchdog available. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS` -`CLAUDE_ENV_FILE`| Path to a shell script whose contents Claude Code runs before each Bash command in the same shell process, so exports in the file are visible to the command. Use to persist virtualenv or conda activation across commands. Also populated dynamically by [SessionStart](</docs/en/hooks#persist-environment-variables>), [CwdChanged](</docs/en/hooks#cwdchanged>), and [FileChanged](</docs/en/hooks#filechanged>) hooks +`CLAUDE_ENV_FILE`| Path to a shell script whose contents Claude Code runs before each Bash command in the same shell process, so exports in the file are visible to the command. Use to persist virtualenv or conda activation across commands. Also populated dynamically by [SessionStart](</docs/en/hooks#persist-environment-variables>), [Setup](</docs/en/hooks#setup>), [CwdChanged](</docs/en/hooks#cwdchanged>), and [FileChanged](</docs/en/hooks#filechanged>) hooks `CLAUDE_REMOTE_CONTROL_SESSION_NAME_PREFIX`| Prefix for auto-generated [Remote Control](</docs/en/remote-control>) session names when no explicit name is provided. Defaults to your machine’s hostname, producing names like `myhost-graceful-unicorn`. The `--remote-control-session-name-prefix` CLI flag sets the same value for a single invocation `CLAUDE_STREAM_IDLE_TIMEOUT_MS`| Timeout in milliseconds before the streaming idle watchdog closes a stalled connection. For the byte-level watchdog on the Anthropic API: default and minimum `300000` (5 minutes); lower values are silently clamped to absorb extended thinking pauses and proxy buffering. For the event-level watchdog: default `90000` (90 seconds), no minimum. For third-party providers, requires `CLAUDE_ENABLE_STREAM_WATCHDOG=1` `DISABLE_AUTOUPDATER`| Set to `1` to disable automatic background updates. Manual `claude update` still works. Use `DISABLE_UPDATES` to block both
modified
--- a/env-vars.md +++ b/env-vars.md @@ -86,7 +86,7 @@ `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 `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS`| Set to `1` to enable [agent teams](</docs/en/agent-teams>). Agent teams are experimental and disabled by default `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 -`CLAUDE_CODE_FORK_SUBAGENT`| Set to `1` to enable [forked subagents](</docs/en/sub-agents#fork-the-current-conversation>). A forked subagent inherits the full conversation context from the main session instead of starting fresh. When enabled, `/fork` spawns a forked subagent rather than acting as an alias for [`/branch`](</docs/en/commands>), and all subagent spawns run in the background. Interactive mode only +`CLAUDE_CODE_FORK_SUBAGENT`| Set to `1` to enable [forked subagents](</docs/en/sub-agents#fork-the-current-conversation>). A forked subagent inherits the full conversation context from the main session instead of starting fresh. When enabled, `/fork` spawns a forked subagent rather than acting as an alias for [`/branch`](</docs/en/commands>), and all subagent spawns run in the background. Works in interactive mode and via the SDK or `claude -p` `CLAUDE_CODE_GIT_BASH_PATH`| Windows only: path to the Git Bash executable (`bash.exe`). Use when Git Bash is installed but not in your PATH. See [Windows setup](</docs/en/setup#set-up-on-windows>) `CLAUDE_CODE_GLOB_HIDDEN`| Set to `false` to exclude dotfiles from results when Claude invokes the [Glob tool](</docs/en/tools-reference>). Included by default. Does not affect `@` file autocomplete, `ls`, Grep, or Read `CLAUDE_CODE_GLOB_NO_IGNORE`| Set to `false` to make the [Glob tool](</docs/en/tools-reference>) respect `.gitignore` patterns. By default, Glob returns all matching files including gitignored ones. Does not affect `@` file autocomplete, which has its own [`respectGitignore` setting](</docs/en/settings#available-settings>) @@ -122,7 +122,7 @@ `CLAUDE_CODE_SHELL`| Override automatic shell detection. Useful when your login shell differs from your preferred working shell (for example, `bash` vs `zsh`) `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>` `CLAUDE_CODE_SIMPLE`| Set to `1` to run with a minimal system prompt and only the Bash, file read, and file edit tools. MCP tools from `--mcp-config` are still available. Disables auto-discovery of hooks, skills, plugins, MCP servers, auto memory, and CLAUDE.md. The [`--bare`](</docs/en/headless#start-faster-with-bare-mode>) CLI flag sets this -`CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT`| Set to `1` to use the minimal system prompt and collapsed tool descriptions from `CLAUDE_CODE_SIMPLE` without the other simple-mode changes. The full tool set, hooks, MCP servers, and CLAUDE.md discovery remain enabled +`CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT`| Set to `1` to use a shorter system prompt and abbreviated tool descriptions on Opus 4.7. Has no effect on other models. The full tool set, hooks, MCP servers, and CLAUDE.md discovery remain enabled `CLAUDE_CODE_SKIP_BEDROCK_AUTH`| Skip AWS authentication for Bedrock (for example, when using an LLM gateway) `CLAUDE_CODE_SKIP_FOUNDRY_AUTH`| Skip Azure authentication for Microsoft Foundry (for example, when using an LLM gateway) `CLAUDE_CODE_SKIP_MANTLE_AUTH`| Skip AWS authentication for Bedrock Mantle (for example, when using an LLM gateway)
modified
--- a/env-vars.md +++ b/env-vars.md @@ -91,6 +91,7 @@ `CLAUDE_CODE_GLOB_HIDDEN`| Set to `false` to exclude dotfiles from results when Claude invokes the [Glob tool](</docs/en/tools-reference>). Included by default. Does not affect `@` file autocomplete, `ls`, Grep, or Read `CLAUDE_CODE_GLOB_NO_IGNORE`| Set to `false` to make the [Glob tool](</docs/en/tools-reference>) respect `.gitignore` patterns. By default, Glob returns all matching files including gitignored ones. Does not affect `@` file autocomplete, which has its own [`respectGitignore` setting](</docs/en/settings#available-settings>) `CLAUDE_CODE_GLOB_TIMEOUT_SECONDS`| Timeout in seconds for Glob tool file discovery. Defaults to 20 seconds on most platforms and 60 seconds on WSL +`CLAUDE_CODE_HIDE_CWD`| Set to `1` to hide the working directory in the startup logo. Useful for screenshares or recordings where the path exposes your OS username `CLAUDE_CODE_IDE_HOST_OVERRIDE`| Override the host address used to connect to the IDE extension. By default Claude Code auto-detects the correct address, including WSL-to-Windows routing `CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL`| Skip auto-installation of IDE extensions. Equivalent to setting [`autoInstallIdeExtension`](</docs/en/settings#global-config-settings>) to `false` `CLAUDE_CODE_IDE_SKIP_VALID_CHECK`| Set to `1` to skip validation of IDE lockfile entries during connection. Use when auto-connect fails to find your IDE despite it running @@ -170,7 +171,7 @@ `ENABLE_CLAUDEAI_MCP_SERVERS`| Set to `false` to disable [claude.ai MCP servers](</docs/en/mcp#use-mcp-servers-from-claude-ai>) in Claude Code. Enabled by default for logged-in users `ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour prompt cache TTL instead of the default 5 minutes. Intended for API key, [Bedrock](</docs/en/amazon-bedrock>), [Vertex](</docs/en/google-vertex-ai>), and [Foundry](</docs/en/microsoft-foundry>) users. Subscription users receive 1-hour TTL automatically. 1-hour cache writes are billed at a higher rate `ENABLE_PROMPT_CACHING_1H_BEDROCK`| Deprecated. Use `ENABLE_PROMPT_CACHING_1H` instead -`ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset: all MCP tools deferred by default, but loaded upfront when `ANTHROPIC_BASE_URL` points to a non-first-party host. Values: `true` (always defer including proxies), `auto` (threshold mode: load upfront if tools fit within 10% of context), `auto:N` (custom threshold, e.g., `auto:5` for 5%), `false` (load all upfront) +`ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset: all MCP tools deferred by default, but loaded upfront on Vertex AI or when `ANTHROPIC_BASE_URL` points to a non-first-party host. Values: `true` (always defer including proxies and Vertex AI), `auto` (threshold mode: load upfront if tools fit within 10% of context), `auto:N` (custom threshold, e.g., `auto:5` for 5%), `false` (load all upfront) `FALLBACK_FOR_ALL_PRIMARY_MODELS`| Set to any non-empty value to trigger fallback to [`--fallback-model`](</docs/en/cli-reference#cli-flags>) after repeated overload errors on any primary model. By default, only Opus models trigger the fallback `FORCE_AUTOUPDATE_PLUGINS`| Set to `1` to force plugin auto-updates even when the main auto-updater is disabled via `DISABLE_AUTOUPDATER` `FORCE_PROMPT_CACHING_5M`| Set to `1` to force the 5-minute prompt cache TTL even when 1-hour TTL would otherwise apply. Overrides `ENABLE_PROMPT_CACHING_1H`
modified
--- a/env-vars.md +++ b/env-vars.md @@ -86,6 +86,7 @@ `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 `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS`| Set to `1` to enable [agent teams](</docs/en/agent-teams>). Agent teams are experimental and disabled by default `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 +`CLAUDE_CODE_FORK_SUBAGENT`| Set to `1` to enable [forked subagents](</docs/en/sub-agents#fork-the-current-conversation>). A forked subagent inherits the full conversation context from the main session instead of starting fresh. When enabled, `/fork` spawns a forked subagent rather than acting as an alias for [`/branch`](</docs/en/commands>), and all subagent spawns run in the background. Interactive mode only `CLAUDE_CODE_GIT_BASH_PATH`| Windows only: path to the Git Bash executable (`bash.exe`). Use when Git Bash is installed but not in your PATH. See [Windows setup](</docs/en/setup#set-up-on-windows>) `CLAUDE_CODE_GLOB_HIDDEN`| Set to `false` to exclude dotfiles from results when Claude invokes the [Glob tool](</docs/en/tools-reference>). Included by default. Does not affect `@` file autocomplete, `ls`, Grep, or Read `CLAUDE_CODE_GLOB_NO_IGNORE`| Set to `false` to make the [Glob tool](</docs/en/tools-reference>) respect `.gitignore` patterns. By default, Glob returns all matching files including gitignored ones. Does not affect `@` file autocomplete, which has its own [`respectGitignore` setting](</docs/en/settings#available-settings>) @@ -146,7 +147,7 @@ `CLAUDE_ENV_FILE`| Path to a shell script whose contents Claude Code runs before each Bash command in the same shell process, so exports in the file are visible to the command. Use to persist virtualenv or conda activation across commands. Also populated dynamically by [SessionStart](</docs/en/hooks#persist-environment-variables>), [CwdChanged](</docs/en/hooks#cwdchanged>), and [FileChanged](</docs/en/hooks#filechanged>) hooks `CLAUDE_REMOTE_CONTROL_SESSION_NAME_PREFIX`| Prefix for auto-generated [Remote Control](</docs/en/remote-control>) session names when no explicit name is provided. Defaults to your machine’s hostname, producing names like `myhost-graceful-unicorn`. The `--remote-control-session-name-prefix` CLI flag sets the same value for a single invocation `CLAUDE_STREAM_IDLE_TIMEOUT_MS`| Timeout in milliseconds before the streaming idle watchdog closes a stalled connection. For the byte-level watchdog on the Anthropic API: default and minimum `300000` (5 minutes); lower values are silently clamped to absorb extended thinking pauses and proxy buffering. For the event-level watchdog: default `90000` (90 seconds), no minimum. For third-party providers, requires `CLAUDE_ENABLE_STREAM_WATCHDOG=1` -`DISABLE_AUTOUPDATER`| Set to `1` to disable automatic updates +`DISABLE_AUTOUPDATER`| Set to `1` to disable automatic background updates. Manual `claude update` still works. Use `DISABLE_UPDATES` to block both `DISABLE_AUTO_COMPACT`| Set to `1` to disable automatic compaction when approaching the context limit. The manual `/compact` command remains available. Use when you want explicit control over when compaction occurs `DISABLE_COMPACT`| Set to `1` to disable all compaction: both automatic compaction and the manual `/compact` command `DISABLE_COST_WARNINGS`| Set to `1` to disable cost warning messages @@ -164,6 +165,7 @@ `DISABLE_PROMPT_CACHING_OPUS`| Set to `1` to disable prompt caching for Opus models `DISABLE_PROMPT_CACHING_SONNET`| Set to `1` to disable prompt caching for Sonnet models `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) +`DISABLE_UPDATES`| Set to `1` to block all updates including manual `claude update` and `claude install`. Stricter than `DISABLE_AUTOUPDATER`. Use when distributing Claude Code through your own channels and users should not self-update `DISABLE_UPGRADE_COMMAND`| Set to `1` to hide the `/upgrade` command `ENABLE_CLAUDEAI_MCP_SERVERS`| Set to `false` to disable [claude.ai MCP servers](</docs/en/mcp#use-mcp-servers-from-claude-ai>) in Claude Code. Enabled by default for logged-in users `ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour prompt cache TTL instead of the default 5 minutes. Intended for API key, [Bedrock](</docs/en/amazon-bedrock>), [Vertex](</docs/en/google-vertex-ai>), and [Foundry](</docs/en/microsoft-foundry>) users. Subscription users receive 1-hour TTL automatically. 1-hour cache writes are billed at a higher rate
modified
--- a/env-vars.md +++ b/env-vars.md @@ -120,6 +120,7 @@ `CLAUDE_CODE_SHELL`| Override automatic shell detection. Useful when your login shell differs from your preferred working shell (for example, `bash` vs `zsh`) `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>` `CLAUDE_CODE_SIMPLE`| Set to `1` to run with a minimal system prompt and only the Bash, file read, and file edit tools. MCP tools from `--mcp-config` are still available. Disables auto-discovery of hooks, skills, plugins, MCP servers, auto memory, and CLAUDE.md. The [`--bare`](</docs/en/headless#start-faster-with-bare-mode>) CLI flag sets this +`CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT`| Set to `1` to use the minimal system prompt and collapsed tool descriptions from `CLAUDE_CODE_SIMPLE` without the other simple-mode changes. The full tool set, hooks, MCP servers, and CLAUDE.md discovery remain enabled `CLAUDE_CODE_SKIP_BEDROCK_AUTH`| Skip AWS authentication for Bedrock (for example, when using an LLM gateway) `CLAUDE_CODE_SKIP_FOUNDRY_AUTH`| Skip Azure authentication for Microsoft Foundry (for example, when using an LLM gateway) `CLAUDE_CODE_SKIP_MANTLE_AUTH`| Skip AWS authentication for Bedrock Mantle (for example, when using an LLM gateway) @@ -185,9 +186,9 @@ `MCP_TIMEOUT`| Timeout in milliseconds for MCP server startup (default: 30000, or 30 seconds) `MCP_TOOL_TIMEOUT`| Timeout in milliseconds for MCP tool execution (default: 100000000, about 28 hours) `NO_PROXY`| List of domains and IPs to which requests will be directly issued, bypassing proxy -`OTEL_LOG_RAW_API_BODIES`| Set to `1` to emit the full Anthropic Messages API request and response JSON as OpenTelemetry log events (`api_request_body`, `api_response_body`). Disabled by default; bodies include the entire conversation history. See [Monitoring](</docs/en/monitoring-usage>) +`OTEL_LOG_RAW_API_BODIES`| Emit Anthropic Messages API request and response JSON as `api_request_body` / `api_response_body` log events. Set to `1` for inline bodies truncated at 60 KB, or `file:<dir>` to write untruncated bodies to disk and emit a `body_ref` path instead. Disabled by default; bodies include the entire conversation history. See [Monitoring](</docs/en/monitoring-usage#api-request-body-event>) `OTEL_LOG_TOOL_CONTENT`| Set to `1` to include tool input and output content in OpenTelemetry span events. Disabled by default to protect sensitive data. See [Monitoring](</docs/en/monitoring-usage>) -`OTEL_LOG_TOOL_DETAILS`| Set to `1` to include tool input arguments, MCP server names, and tool details in OpenTelemetry traces and logs. Disabled by default to protect PII. See [Monitoring](</docs/en/monitoring-usage>) +`OTEL_LOG_TOOL_DETAILS`| Set to `1` to include tool input arguments, MCP server names, raw error strings on tool failures, and other tool details in OpenTelemetry traces and logs. Disabled by default to protect PII. See [Monitoring](</docs/en/monitoring-usage>) `OTEL_LOG_USER_PROMPTS`| Set to `1` to include user prompt text in OpenTelemetry traces and logs. Disabled by default (prompts are redacted). See [Monitoring](</docs/en/monitoring-usage>) `OTEL_METRICS_INCLUDE_ACCOUNT_UUID`| Set to `false` to exclude account UUID from metrics attributes (default: included). See [Monitoring](</docs/en/monitoring-usage>) `OTEL_METRICS_INCLUDE_SESSION_ID`| Set to `false` to exclude session ID from metrics attributes (default: included). See [Monitoring](</docs/en/monitoring-usage>)
modified
--- a/env-vars.md +++ b/env-vars.md @@ -142,7 +142,7 @@ `CLAUDE_CONFIG_DIR`| Override the configuration directory (default: `~/.claude`). All settings, credentials, session history, and plugins are stored under this path. Useful for running multiple accounts side by side: for example, `alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'` `CLAUDE_ENABLE_BYTE_WATCHDOG`| Set to `1` to force-enable the byte-level streaming idle watchdog, or set to `0` to force-disable it. When unset, the watchdog is enabled by default for Anthropic API connections. The byte watchdog aborts a connection when no bytes arrive on the wire for the duration set by `CLAUDE_STREAM_IDLE_TIMEOUT_MS`, with a minimum of 5 minutes, independent of the event-level watchdog `CLAUDE_ENABLE_STREAM_WATCHDOG`| Set to `1` to enable the event-level streaming idle watchdog. Off by default. For Bedrock, Vertex, and Foundry, this is the only idle watchdog available. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS` -`CLAUDE_ENV_FILE`| Path to a shell script that Claude Code sources before each Bash command. Use to persist virtualenv or conda activation across commands. Also populated dynamically by [SessionStart](</docs/en/hooks#persist-environment-variables>), [CwdChanged](</docs/en/hooks#cwdchanged>), and [FileChanged](</docs/en/hooks#filechanged>) hooks +`CLAUDE_ENV_FILE`| Path to a shell script whose contents Claude Code runs before each Bash command in the same shell process, so exports in the file are visible to the command. Use to persist virtualenv or conda activation across commands. Also populated dynamically by [SessionStart](</docs/en/hooks#persist-environment-variables>), [CwdChanged](</docs/en/hooks#cwdchanged>), and [FileChanged](</docs/en/hooks#filechanged>) hooks `CLAUDE_REMOTE_CONTROL_SESSION_NAME_PREFIX`| Prefix for auto-generated [Remote Control](</docs/en/remote-control>) session names when no explicit name is provided. Defaults to your machine’s hostname, producing names like `myhost-graceful-unicorn`. The `--remote-control-session-name-prefix` CLI flag sets the same value for a single invocation `CLAUDE_STREAM_IDLE_TIMEOUT_MS`| Timeout in milliseconds before the streaming idle watchdog closes a stalled connection. For the byte-level watchdog on the Anthropic API: default and minimum `300000` (5 minutes); lower values are silently clamped to absorb extended thinking pauses and proxy buffering. For the event-level watchdog: default `90000` (90 seconds), no minimum. For third-party providers, requires `CLAUDE_ENABLE_STREAM_WATCHDOG=1` `DISABLE_AUTOUPDATER`| Set to `1` to disable automatic updates
modified
--- a/env-vars.md +++ b/env-vars.md @@ -57,7 +57,7 @@ `CLAUDE_CODE_DEBUG_LOGS_DIR`| Override the debug log file path. Despite the name, this is a file path, not a directory. Requires debug mode to be enabled separately via `--debug` or `/debug`: setting this variable alone does not enable logging. The [`--debug-file`](</docs/en/cli-reference#cli-flags>) flag does both at once. Defaults to `~/.claude/debug/<session-id>.txt` `CLAUDE_CODE_DEBUG_LOG_LEVEL`| Minimum log level written to the debug log file. Values: `verbose`, `debug` (default), `info`, `warn`, `error`. Set to `verbose` to include high-volume diagnostics like full status line command output, or raise to `error` to reduce noise `CLAUDE_CODE_DISABLE_1M_CONTEXT`| Set to `1` to disable [1M context window](</docs/en/model-config#extended-context>) support. When set, 1M model variants are unavailable in the model picker. Useful for enterprise environments with compliance requirements -`CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING`| Set to `1` to disable [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) for Opus 4.6 and Sonnet 4.6. When disabled, these models fall back to the fixed thinking budget controlled by `MAX_THINKING_TOKENS` +`CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING`| Set to `1` to disable [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) on Opus 4.6 and Sonnet 4.6 and fall back to the fixed thinking budget controlled by `MAX_THINKING_TOKENS`. Has no effect on Opus 4.7, which always uses adaptive reasoning `CLAUDE_CODE_DISABLE_ATTACHMENTS`| Set to `1` to disable attachment processing. File mentions with `@` syntax are sent as plain text instead of being expanded into file content `CLAUDE_CODE_DISABLE_AUTO_MEMORY`| Set to `1` to disable [auto memory](</docs/en/memory#auto-memory>). Set to `0` to force auto memory on during the gradual rollout. When disabled, Claude does not create or load auto memory files `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 @@ -76,7 +76,9 @@ `CLAUDE_CODE_DISABLE_TERMINAL_TITLE`| Set to `1` to disable automatic terminal title updates based on conversation context `CLAUDE_CODE_DISABLE_THINKING`| Set to `1` to force-disable [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) regardless of model support or other settings. More direct than `MAX_THINKING_TOKENS=0` `CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL`| Set to `1` to disable virtual scrolling in [fullscreen rendering](</docs/en/fullscreen>) and render every message in the transcript. Use this if scrolling in fullscreen mode shows blank regions where messages should appear -`CLAUDE_CODE_EFFORT_LEVEL`| Set the effort level for supported models. Values: `low`, `medium`, `high`, `max` (Opus 4.6 only), or `auto` to use the model default. Takes precedence over `/effort` and the `effortLevel` setting. See [Adjust effort level](</docs/en/model-config#adjust-effort-level>) +`CLAUDE_CODE_EFFORT_LEVEL`| Set the effort level for supported models. Values: `low`, `medium`, `high`, `xhigh`, `max`, or `auto` to use the model default. Available levels depend on the model. Takes precedence over `/effort` and the `effortLevel` setting. See [Adjust effort level](</docs/en/model-config#adjust-effort-level>) +`CLAUDE_CODE_ENABLE_AWAY_SUMMARY`| Override [session recap](</docs/en/interactive-mode#session-recap>) availability. Set to `0` to force recaps off regardless of the `/config` toggle. Set to `1` to force recaps on when [`awaySummaryEnabled`](</docs/en/settings#available-settings>) is `false`. Takes precedence over the setting and `/config` toggle +`CLAUDE_CODE_ENABLE_BACKGROUND_PLUGIN_REFRESH`| Set to `1` to refresh plugin state at turn boundaries in [non-interactive mode](</docs/en/headless>) after a background install completes. Off by default because the refresh changes the system prompt mid-session, which invalidates [prompt caching](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching>) for that turn `CLAUDE_CODE_ENABLE_FINE_GRAINED_TOOL_STREAMING`| Set to `1` to force-enable fine-grained tool input streaming. Without this, the API buffers tool input parameters fully before sending delta events, which can delay display on large tool inputs. Anthropic API only: has no effect on Bedrock, Vertex, or Foundry `CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION`| Set to `false` to disable prompt suggestions (the “Prompt suggestions” toggle in `/config`). These are the grayed-out predictions that appear in your prompt input after Claude responds. See [Prompt suggestions](</docs/en/interactive-mode#prompt-suggestions>) `CLAUDE_CODE_ENABLE_TASKS`| Set to `1` to enable the task tracking system in non-interactive mode (the `-p` flag). Tasks are on by default in interactive mode. See [Task list](</docs/en/interactive-mode#task-list>) @@ -96,7 +98,7 @@ `CLAUDE_CODE_MAX_RETRIES`| Override the number of times to retry failed API requests (default: 10) `CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY`| Maximum number of read-only tools and subagents that can execute in parallel (default: 10). Higher values increase parallelism but consume more resources `CLAUDE_CODE_NEW_INIT`| Set to `1` to make `/init` run an interactive setup flow. The flow asks which files to generate, including CLAUDE.md, skills, and hooks, before exploring the codebase and writing them. Without this variable, `/init` generates a CLAUDE.md automatically without prompting. -`CLAUDE_CODE_NO_FLICKER`| Set to `1` to enable [fullscreen rendering](</docs/en/fullscreen>), a research preview that reduces flicker and keeps memory flat in long conversations +`CLAUDE_CODE_NO_FLICKER`| Set to `1` to enable [fullscreen rendering](</docs/en/fullscreen>), a research preview that reduces flicker and keeps memory flat in long conversations. Equivalent to the [`tui`](</docs/en/settings#available-settings>) setting; you can also switch with `/tui fullscreen` `CLAUDE_CODE_OAUTH_REFRESH_TOKEN`| OAuth refresh token for Claude.ai authentication. When set, `claude auth login` exchanges this token directly instead of opening a browser. Requires `CLAUDE_CODE_OAUTH_SCOPES`. Useful for provisioning authentication in automated environments `CLAUDE_CODE_OAUTH_SCOPES`| Space-separated OAuth scopes the refresh token was issued with, such as `"user:profile user:inference user:sessions:claude_code"`. Required when `CLAUDE_CODE_OAUTH_REFRESH_TOKEN` is set `CLAUDE_CODE_OAUTH_TOKEN`| OAuth access token for Claude.ai authentication. Alternative to `/login` for SDK and automated environments. Takes precedence over keychain-stored credentials. Generate one with [`claude setup-token`](</docs/en/authentication#generate-a-long-lived-token>) @@ -113,7 +115,7 @@ `CLAUDE_CODE_REMOTE_SESSION_ID`| Set automatically in [cloud sessions](</docs/en/claude-code-on-the-web>) to the current session’s ID. Read this to construct a link back to the session transcript. See [Link artifacts back to the session](</docs/en/claude-code-on-the-web#link-artifacts-back-to-the-session>) `CLAUDE_CODE_RESUME_INTERRUPTED_TURN`| Set to `1` to automatically resume if the previous session ended mid-turn. Used in SDK mode so the model continues without requiring the SDK to re-send the prompt `CLAUDE_CODE_SCRIPT_CAPS`| JSON object limiting how many times specific scripts may be invoked per session when `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB` is set. Keys are substrings matched against the command text; values are integer call limits. For example, `{"deploy.sh": 2}` allows `deploy.sh` to be called at most twice. Matching is substring-based so shell-expansion tricks like `./scripts/deploy.sh $(evil)` still count against the cap. Runtime fan-out via `xargs` or `find -exec` is not detected; this is a defense-in-depth control -`CLAUDE_CODE_SCROLL_SPEED`| Set the mouse wheel scroll multiplier in [fullscreen rendering](</docs/en/fullscreen#adjust-wheel-scroll-speed>). Accepts values from 1 to 20. Set to `3` to match `vim` if your terminal sends one wheel event per notch without amplification +`CLAUDE_CODE_SCROLL_SPEED`| Set the mouse wheel scroll multiplier in [fullscreen rendering](</docs/en/fullscreen#mouse-wheel-scrolling>). Accepts values from 1 to 20. Set to `3` to match `vim` if your terminal sends one wheel event per notch without amplification `CLAUDE_CODE_SESSIONEND_HOOKS_TIMEOUT_MS`| Override the time budget in milliseconds for [SessionEnd](</docs/en/hooks#sessionend>) hooks. Applies to session exit, `/clear`, and switching sessions via interactive `/resume`. By default the budget is 1.5 seconds, automatically raised to the highest per-hook `timeout` configured in settings files, up to 60 seconds. Timeouts on plugin-provided hooks do not raise the budget `CLAUDE_CODE_SHELL`| Override automatic shell detection. Useful when your login shell differs from your preferred working shell (for example, `bash` vs `zsh`) `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>` @@ -135,7 +137,7 @@ `CLAUDE_CODE_USE_BEDROCK`| Use [Bedrock](</docs/en/amazon-bedrock>) `CLAUDE_CODE_USE_FOUNDRY`| Use [Microsoft Foundry](</docs/en/microsoft-foundry>) `CLAUDE_CODE_USE_MANTLE`| Use the Bedrock [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>) -`CLAUDE_CODE_USE_POWERSHELL_TOOL`| Set to `1` to enable the PowerShell tool on Windows (opt-in preview). When enabled, Claude can run PowerShell commands natively instead of routing through Git Bash. Only supported on native Windows, not WSL. See [PowerShell tool](</docs/en/tools-reference#powershell-tool>) +`CLAUDE_CODE_USE_POWERSHELL_TOOL`| Controls the PowerShell tool. On Windows, the tool is rolling out progressively: set to `1` to opt in or `0` to opt out. On Linux, macOS, and WSL, set to `1` to enable it, which requires `pwsh` on your `PATH`. When enabled on Windows, Claude can run PowerShell commands natively instead of routing through Git Bash. See [PowerShell tool](</docs/en/tools-reference#powershell-tool>) `CLAUDE_CODE_USE_VERTEX`| Use [Vertex](</docs/en/google-vertex-ai>) `CLAUDE_CONFIG_DIR`| Override the configuration directory (default: `~/.claude`). All settings, credentials, session history, and plugins are stored under this path. Useful for running multiple accounts side by side: for example, `alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'` `CLAUDE_ENABLE_BYTE_WATCHDOG`| Set to `1` to force-enable the byte-level streaming idle watchdog, or set to `0` to force-disable it. When unset, the watchdog is enabled by default for Anthropic API connections. The byte watchdog aborts a connection when no bytes arrive on the wire for the duration set by `CLAUDE_STREAM_IDLE_TIMEOUT_MS`, with a minimum of 5 minutes, independent of the event-level watchdog @@ -163,16 +165,18 @@ `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) `DISABLE_UPGRADE_COMMAND`| Set to `1` to hide the `/upgrade` command `ENABLE_CLAUDEAI_MCP_SERVERS`| Set to `false` to disable [claude.ai MCP servers](</docs/en/mcp#use-mcp-servers-from-claude-ai>) in Claude Code. Enabled by default for logged-in users -`ENABLE_PROMPT_CACHING_1H_BEDROCK`| Set to `1` when using [Bedrock](</docs/en/amazon-bedrock>) to request a 1-hour prompt cache TTL instead of the default 5 minutes. Bedrock only +`ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour prompt cache TTL instead of the default 5 minutes. Intended for API key, [Bedrock](</docs/en/amazon-bedrock>), [Vertex](</docs/en/google-vertex-ai>), and [Foundry](</docs/en/microsoft-foundry>) users. Subscription users receive 1-hour TTL automatically. 1-hour cache writes are billed at a higher rate +`ENABLE_PROMPT_CACHING_1H_BEDROCK`| Deprecated. Use `ENABLE_PROMPT_CACHING_1H` instead `ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset: all MCP tools deferred by default, but loaded upfront when `ANTHROPIC_BASE_URL` points to a non-first-party host. Values: `true` (always defer including proxies), `auto` (threshold mode: load upfront if tools fit within 10% of context), `auto:N` (custom threshold, e.g., `auto:5` for 5%), `false` (load all upfront) `FALLBACK_FOR_ALL_PRIMARY_MODELS`| Set to any non-empty value to trigger fallback to [`--fallback-model`](</docs/en/cli-reference#cli-flags>) after repeated overload errors on any primary model. By default, only Opus models trigger the fallback `FORCE_AUTOUPDATE_PLUGINS`| Set to `1` to force plugin auto-updates even when the main auto-updater is disabled via `DISABLE_AUTOUPDATER` +`FORCE_PROMPT_CACHING_5M`| Set to `1` to force the 5-minute prompt cache TTL even when 1-hour TTL would otherwise apply. Overrides `ENABLE_PROMPT_CACHING_1H` `HTTP_PROXY`| Specify HTTP proxy server for network connections `HTTPS_PROXY`| Specify HTTPS proxy server for network connections `IS_DEMO`| Set to `1` to enable demo mode: hides your email and organization name from the header and `/status` output, and skips onboarding. Useful when streaming or recording a session `MAX_MCP_OUTPUT_TOKENS`| Maximum number of tokens allowed in MCP tool responses. Claude Code displays a warning when output exceeds 10,000 tokens. Tools that declare [`anthropic/maxResultSizeChars`](</docs/en/mcp#raise-the-limit-for-a-specific-tool>) use that character limit for text content instead, but image content from those tools is still subject to this variable (default: 25000) `MAX_STRUCTURED_OUTPUT_RETRIES`| Number of times to retry when the model’s response fails validation against the [`--json-schema`](</docs/en/cli-reference#cli-flags>) in non-interactive mode (the `-p` flag). Defaults to 5 -`MAX_THINKING_TOKENS`| Override the [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) token budget. The ceiling is the model’s [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>) minus one. Set to `0` to disable thinking entirely. On models with adaptive reasoning (Opus 4.6, Sonnet 4.6), the budget is ignored unless adaptive reasoning is disabled via `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` +`MAX_THINKING_TOKENS`| Override the [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) token budget. The ceiling is the model’s [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>) minus one. Set to `0` to disable thinking entirely. On models with [adaptive reasoning](</docs/en/model-config#adjust-effort-level>), the budget is ignored unless adaptive reasoning is disabled via `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` `MCP_CLIENT_SECRET`| OAuth client secret for MCP servers that require [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>). Avoids the interactive prompt when adding a server with `--client-secret` `MCP_CONNECTION_NONBLOCKING`| Set to `true` in non-interactive mode (`-p`) to skip the MCP connection wait entirely. Useful for scripted pipelines where MCP tools are not needed. Without this variable, the first query waits up to 5 seconds for `--mcp-config` server connections `MCP_OAUTH_CALLBACK_PORT`| Fixed port for the OAuth redirect callback, as an alternative to `--callback-port` when adding an MCP server with [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>) @@ -181,6 +185,7 @@ `MCP_TIMEOUT`| Timeout in milliseconds for MCP server startup (default: 30000, or 30 seconds) `MCP_TOOL_TIMEOUT`| Timeout in milliseconds for MCP tool execution (default: 100000000, about 28 hours) `NO_PROXY`| List of domains and IPs to which requests will be directly issued, bypassing proxy +`OTEL_LOG_RAW_API_BODIES`| Set to `1` to emit the full Anthropic Messages API request and response JSON as OpenTelemetry log events (`api_request_body`, `api_response_body`). Disabled by default; bodies include the entire conversation history. See [Monitoring](</docs/en/monitoring-usage>) `OTEL_LOG_TOOL_CONTENT`| Set to `1` to include tool input and output content in OpenTelemetry span events. Disabled by default to protect sensitive data. See [Monitoring](</docs/en/monitoring-usage>) `OTEL_LOG_TOOL_DETAILS`| Set to `1` to include tool input arguments, MCP server names, and tool details in OpenTelemetry traces and logs. Disabled by default to protect PII. See [Monitoring](</docs/en/monitoring-usage>) `OTEL_LOG_USER_PROMPTS`| Set to `1` to include user prompt text in OpenTelemetry traces and logs. Disabled by default (prompts are redacted). See [Monitoring](</docs/en/monitoring-usage>) @@ -200,6 +205,7 @@ `VERTEX_REGION_CLAUDE_4_5_SONNET`| Override region for Claude Sonnet 4.5 when using Vertex AI `VERTEX_REGION_CLAUDE_4_6_OPUS`| Override region for Claude Opus 4.6 when using Vertex AI `VERTEX_REGION_CLAUDE_4_6_SONNET`| Override region for Claude Sonnet 4.6 when using Vertex AI +`VERTEX_REGION_CLAUDE_4_7_OPUS`| Override region for Claude Opus 4.7 when using Vertex AI `VERTEX_REGION_CLAUDE_HAIKU_4_5`| Override region for Claude Haiku 4.5 when using Vertex AI Standard OpenTelemetry exporter variables (`OTEL_METRICS_EXPORTER`, `OTEL_LOGS_EXPORTER`, `OTEL_EXPORTER_OTLP_ENDPOINT`, `OTEL_EXPORTER_OTLP_PROTOCOL`, `OTEL_EXPORTER_OTLP_HEADERS`, `OTEL_METRIC_EXPORT_INTERVAL`, `OTEL_RESOURCE_ATTRIBUTES`, and signal-specific variants) are also supported. See [Monitoring](</docs/en/monitoring-usage>) for configuration details.
modified
--- a/env-vars.md +++ b/env-vars.md @@ -109,6 +109,8 @@ `CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE`| Set to `1` to keep the existing marketplace cache when a `git pull` fails instead of wiping and re-cloning. Useful in offline or airgapped environments where re-cloning would fail the same way. See [Marketplace updates fail in offline environments](</docs/en/plugin-marketplaces#marketplace-updates-fail-in-offline-environments>) `CLAUDE_CODE_PLUGIN_SEED_DIR`| Path to one or more read-only plugin seed directories, separated by `:` on Unix or `;` on Windows. Use this to bundle a pre-populated plugins directory into a container image. Claude Code registers marketplaces from these directories at startup and uses pre-cached plugins without re-cloning. See [Pre-populate plugins for containers](</docs/en/plugin-marketplaces#pre-populate-plugins-for-containers>) `CLAUDE_CODE_PROXY_RESOLVES_HOSTS`| Set to `1` to allow the proxy to perform DNS resolution instead of the caller. Opt-in for environments where the proxy should handle hostname resolution +`CLAUDE_CODE_REMOTE`| Set automatically to `true` when Claude Code is running as a [cloud session](</docs/en/claude-code-on-the-web>). Read this from a hook or setup script to detect whether you are in a cloud environment +`CLAUDE_CODE_REMOTE_SESSION_ID`| Set automatically in [cloud sessions](</docs/en/claude-code-on-the-web>) to the current session’s ID. Read this to construct a link back to the session transcript. See [Link artifacts back to the session](</docs/en/claude-code-on-the-web#link-artifacts-back-to-the-session>) `CLAUDE_CODE_RESUME_INTERRUPTED_TURN`| Set to `1` to automatically resume if the previous session ended mid-turn. Used in SDK mode so the model continues without requiring the SDK to re-send the prompt `CLAUDE_CODE_SCRIPT_CAPS`| JSON object limiting how many times specific scripts may be invoked per session when `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB` is set. Keys are substrings matched against the command text; values are integer call limits. For example, `{"deploy.sh": 2}` allows `deploy.sh` to be called at most twice. Matching is substring-based so shell-expansion tricks like `./scripts/deploy.sh $(evil)` still count against the cap. Runtime fan-out via `xargs` or `find -exec` is not detected; this is a defense-in-depth control `CLAUDE_CODE_SCROLL_SPEED`| Set the mouse wheel scroll multiplier in [fullscreen rendering](</docs/en/fullscreen#adjust-wheel-scroll-speed>). Accepts values from 1 to 20. Set to `3` to match `vim` if your terminal sends one wheel event per notch without amplification @@ -129,6 +131,7 @@ `CLAUDE_CODE_TASK_LIST_ID`| Share a task list across sessions. Set the same ID in multiple Claude Code instances to coordinate on a shared task list. See [Task list](</docs/en/interactive-mode#task-list>) `CLAUDE_CODE_TEAM_NAME`| Name of the agent team this teammate belongs to. Set automatically on [agent team](</docs/en/agent-teams>) members `CLAUDE_CODE_TMPDIR`| Override the temp directory used for internal temp files. Claude Code appends `/claude-{uid}/` (Unix) or `/claude/` (Windows) to this path. Default: `/tmp` on macOS, `os.tmpdir()` on Linux/Windows +`CLAUDE_CODE_TMUX_TRUECOLOR`| Set to `1` to allow 24-bit truecolor output inside tmux. By default, Claude Code clamps to 256 colors when `$TMUX` is set because tmux does not pass through truecolor escape sequences unless configured to. Set this after adding `set -ga terminal-overrides ',*:Tc'` to your `~/.tmux.conf`. See [Terminal configuration](</docs/en/terminal-config>) for other tmux settings `CLAUDE_CODE_USE_BEDROCK`| Use [Bedrock](</docs/en/amazon-bedrock>) `CLAUDE_CODE_USE_FOUNDRY`| Use [Microsoft Foundry](</docs/en/microsoft-foundry>) `CLAUDE_CODE_USE_MANTLE`| Use the Bedrock [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>)
modified
--- a/env-vars.md +++ b/env-vars.md @@ -75,6 +75,7 @@ `CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL`| Set to `1` to skip automatic addition of the official plugin marketplace on first run `CLAUDE_CODE_DISABLE_TERMINAL_TITLE`| Set to `1` to disable automatic terminal title updates based on conversation context `CLAUDE_CODE_DISABLE_THINKING`| Set to `1` to force-disable [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) regardless of model support or other settings. More direct than `MAX_THINKING_TOKENS=0` +`CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL`| Set to `1` to disable virtual scrolling in [fullscreen rendering](</docs/en/fullscreen>) and render every message in the transcript. Use this if scrolling in fullscreen mode shows blank regions where messages should appear `CLAUDE_CODE_EFFORT_LEVEL`| Set the effort level for supported models. Values: `low`, `medium`, `high`, `max` (Opus 4.6 only), or `auto` to use the model default. Takes precedence over `/effort` and the `effortLevel` setting. See [Adjust effort level](</docs/en/model-config#adjust-effort-level>) `CLAUDE_CODE_ENABLE_FINE_GRAINED_TOOL_STREAMING`| Set to `1` to force-enable fine-grained tool input streaming. Without this, the API buffers tool input parameters fully before sending delta events, which can delay display on large tool inputs. Anthropic API only: has no effect on Bedrock, Vertex, or Foundry `CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION`| Set to `false` to disable prompt suggestions (the “Prompt suggestions” toggle in `/config`). These are the grayed-out predictions that appear in your prompt input after Claude responds. See [Prompt suggestions](</docs/en/interactive-mode#prompt-suggestions>) @@ -90,6 +91,7 @@ `CLAUDE_CODE_IDE_HOST_OVERRIDE`| Override the host address used to connect to the IDE extension. By default Claude Code auto-detects the correct address, including WSL-to-Windows routing `CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL`| Skip auto-installation of IDE extensions. Equivalent to setting [`autoInstallIdeExtension`](</docs/en/settings#global-config-settings>) to `false` `CLAUDE_CODE_IDE_SKIP_VALID_CHECK`| Set to `1` to skip validation of IDE lockfile entries during connection. Use when auto-connect fails to find your IDE despite it running +`CLAUDE_CODE_MAX_CONTEXT_TOKENS`| Override the context window size Claude Code assumes for the active model. Only takes effect when `DISABLE_COMPACT` is also set. Use this when routing to a model through `ANTHROPIC_BASE_URL` whose context window does not match the built-in size for its name `CLAUDE_CODE_MAX_OUTPUT_TOKENS`| Set the maximum number of output tokens for most requests. Defaults and caps vary by model; see [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>). Increasing this value reduces the effective context window available before [auto-compaction](</docs/en/costs#reduce-token-usage>) triggers. `CLAUDE_CODE_MAX_RETRIES`| Override the number of times to retry failed API requests (default: 10) `CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY`| Maximum number of read-only tools and subagents that can execute in parallel (default: 10). Higher values increase parallelism but consume more resources @@ -117,6 +119,7 @@ `CLAUDE_CODE_SKIP_BEDROCK_AUTH`| Skip AWS authentication for Bedrock (for example, when using an LLM gateway) `CLAUDE_CODE_SKIP_FOUNDRY_AUTH`| Skip Azure authentication for Microsoft Foundry (for example, when using an LLM gateway) `CLAUDE_CODE_SKIP_MANTLE_AUTH`| Skip AWS authentication for Bedrock Mantle (for example, when using an LLM gateway) +`CLAUDE_CODE_SKIP_PROMPT_HISTORY`| Set to `1` to skip writing prompt history and session transcripts to disk. Sessions started with this variable set do not appear in `--resume`, `--continue`, or up-arrow history. Useful for ephemeral scripted sessions `CLAUDE_CODE_SKIP_VERTEX_AUTH`| Skip Google authentication for Vertex (for example, when using an LLM gateway) `CLAUDE_CODE_SUBAGENT_MODEL`| See [Model configuration](</docs/en/model-config>) `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB`| Set to `1` to strip Anthropic and cloud provider credentials from subprocess environments (Bash tool, hooks, MCP stdio servers). The parent Claude process keeps these credentials for API calls, but child processes cannot read them, reducing exposure to prompt injection attacks that attempt to exfiltrate secrets via shell expansion. On Linux, this also runs Bash subprocesses in an isolated PID namespace so they cannot read host process environments via `/proc`; as a side effect, `ps`, `pgrep`, and `kill` cannot see or signal host processes. `claude-code-action` sets this automatically when `allowed_non_write_users` is configured
modified
--- a/env-vars.md +++ b/env-vars.md @@ -12,6 +12,7 @@ `ANTHROPIC_CUSTOM_MODEL_OPTION`| Model ID to add as a custom entry in the `/model` picker. Use this to make a non-standard or gateway-specific model selectable without replacing built-in aliases. See [Model configuration](</docs/en/model-config#add-a-custom-model-option>) `ANTHROPIC_CUSTOM_MODEL_OPTION_DESCRIPTION`| Display description for the custom model entry in the `/model` picker. Defaults to `Custom model (<model-id>)` when not set `ANTHROPIC_CUSTOM_MODEL_OPTION_NAME`| Display name for the custom model entry in the `/model` picker. Defaults to the model ID when not set +`ANTHROPIC_CUSTOM_MODEL_OPTION_SUPPORTED_CAPABILITIES`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) `ANTHROPIC_DEFAULT_HAIKU_MODEL`| See [Model configuration](</docs/en/model-config#environment-variables>) `ANTHROPIC_DEFAULT_HAIKU_MODEL_DESCRIPTION`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) `ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) @@ -45,7 +46,7 @@ `CLAUDE_AUTO_BACKGROUND_TASKS`| Set to `1` to force-enable automatic backgrounding of long-running agent tasks. When enabled, subagents are moved to the background after running for approximately two minutes `CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR`| Return to the original working directory after each Bash or PowerShell command in the main session `CLAUDE_CODE_ACCESSIBILITY`| Set to `1` to keep the native terminal cursor visible and disable the inverted-text cursor indicator. Allows screen magnifiers like macOS Zoom to track cursor position -`CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD`| Set to `1` to load CLAUDE.md files from directories specified with `--add-dir`. By default, additional directories do not load memory files +`CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD`| Set to `1` to load memory files from directories specified with `--add-dir`. Loads `CLAUDE.md`, `.claude/CLAUDE.md`, `.claude/rules/*.md`, and `CLAUDE.local.md`. By default, additional directories do not load memory files `CLAUDE_CODE_API_KEY_HELPER_TTL_MS`| Interval in milliseconds at which credentials should be refreshed (when using [`apiKeyHelper`](</docs/en/settings#available-settings>)) `CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the context capacity in tokens used for auto-compaction calculations. Defaults to the model’s context window: 200K for standard models or 1M for [extended context](</docs/en/model-config#extended-context>) models. Use a lower value like `500000` on a 1M model to treat the window as 500K for compaction purposes. The value is capped at the model’s actual context window. `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` is applied as a percentage of this value. Setting this variable decouples the compaction threshold from the status line’s `used_percentage`, which always uses the model’s full context window `CLAUDE_CODE_AUTO_CONNECT_IDE`| Override automatic [IDE connection](</docs/en/vs-code>). By default, Claude Code connects automatically when launched inside a supported IDE’s integrated terminal. Set to `false` to prevent this. Set to `true` to force a connection attempt when auto-detection fails, such as when tmux obscures the parent terminal @@ -109,7 +110,7 @@ `CLAUDE_CODE_RESUME_INTERRUPTED_TURN`| Set to `1` to automatically resume if the previous session ended mid-turn. Used in SDK mode so the model continues without requiring the SDK to re-send the prompt `CLAUDE_CODE_SCRIPT_CAPS`| JSON object limiting how many times specific scripts may be invoked per session when `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB` is set. Keys are substrings matched against the command text; values are integer call limits. For example, `{"deploy.sh": 2}` allows `deploy.sh` to be called at most twice. Matching is substring-based so shell-expansion tricks like `./scripts/deploy.sh $(evil)` still count against the cap. Runtime fan-out via `xargs` or `find -exec` is not detected; this is a defense-in-depth control `CLAUDE_CODE_SCROLL_SPEED`| Set the mouse wheel scroll multiplier in [fullscreen rendering](</docs/en/fullscreen#adjust-wheel-scroll-speed>). Accepts values from 1 to 20. Set to `3` to match `vim` if your terminal sends one wheel event per notch without amplification -`CLAUDE_CODE_SESSIONEND_HOOKS_TIMEOUT_MS`| Maximum time in milliseconds for [SessionEnd](</docs/en/hooks#sessionend>) hooks to complete (default: `1500`). Applies to session exit, `/clear`, and switching sessions via interactive `/resume`. Per-hook `timeout` values are also capped by this budget +`CLAUDE_CODE_SESSIONEND_HOOKS_TIMEOUT_MS`| Override the time budget in milliseconds for [SessionEnd](</docs/en/hooks#sessionend>) hooks. Applies to session exit, `/clear`, and switching sessions via interactive `/resume`. By default the budget is 1.5 seconds, automatically raised to the highest per-hook `timeout` configured in settings files, up to 60 seconds. Timeouts on plugin-provided hooks do not raise the budget `CLAUDE_CODE_SHELL`| Override automatic shell detection. Useful when your login shell differs from your preferred working shell (for example, `bash` vs `zsh`) `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>` `CLAUDE_CODE_SIMPLE`| Set to `1` to run with a minimal system prompt and only the Bash, file read, and file edit tools. MCP tools from `--mcp-config` are still available. Disables auto-discovery of hooks, skills, plugins, MCP servers, auto memory, and CLAUDE.md. The [`--bare`](</docs/en/headless#start-faster-with-bare-mode>) CLI flag sets this @@ -131,10 +132,11 @@ `CLAUDE_CODE_USE_POWERSHELL_TOOL`| Set to `1` to enable the PowerShell tool on Windows (opt-in preview). When enabled, Claude can run PowerShell commands natively instead of routing through Git Bash. Only supported on native Windows, not WSL. See [PowerShell tool](</docs/en/tools-reference#powershell-tool>) `CLAUDE_CODE_USE_VERTEX`| Use [Vertex](</docs/en/google-vertex-ai>) `CLAUDE_CONFIG_DIR`| Override the configuration directory (default: `~/.claude`). All settings, credentials, session history, and plugins are stored under this path. Useful for running multiple accounts side by side: for example, `alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'` -`CLAUDE_ENABLE_STREAM_WATCHDOG`| Set to `1` to abort API response streams that stall with no data for 90 seconds. Useful in automated environments where a hung session would go unnoticed, or behind proxies that drop connections silently. Without this, a stalled stream can hang the session indefinitely since the request timeout only covers the initial connection. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS` +`CLAUDE_ENABLE_BYTE_WATCHDOG`| Set to `1` to force-enable the byte-level streaming idle watchdog, or set to `0` to force-disable it. When unset, the watchdog is enabled by default for Anthropic API connections. The byte watchdog aborts a connection when no bytes arrive on the wire for the duration set by `CLAUDE_STREAM_IDLE_TIMEOUT_MS`, with a minimum of 5 minutes, independent of the event-level watchdog +`CLAUDE_ENABLE_STREAM_WATCHDOG`| Set to `1` to enable the event-level streaming idle watchdog. Off by default. For Bedrock, Vertex, and Foundry, this is the only idle watchdog available. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS` `CLAUDE_ENV_FILE`| Path to a shell script that Claude Code sources before each Bash command. Use to persist virtualenv or conda activation across commands. Also populated dynamically by [SessionStart](</docs/en/hooks#persist-environment-variables>), [CwdChanged](</docs/en/hooks#cwdchanged>), and [FileChanged](</docs/en/hooks#filechanged>) hooks `CLAUDE_REMOTE_CONTROL_SESSION_NAME_PREFIX`| Prefix for auto-generated [Remote Control](</docs/en/remote-control>) session names when no explicit name is provided. Defaults to your machine’s hostname, producing names like `myhost-graceful-unicorn`. The `--remote-control-session-name-prefix` CLI flag sets the same value for a single invocation -`CLAUDE_STREAM_IDLE_TIMEOUT_MS`| Timeout in milliseconds before the streaming idle watchdog closes a stalled connection. Default: `90000` (90 seconds). Requires `CLAUDE_ENABLE_STREAM_WATCHDOG=1`. Increase this value if long-running tools or slow networks cause premature timeout errors +`CLAUDE_STREAM_IDLE_TIMEOUT_MS`| Timeout in milliseconds before the streaming idle watchdog closes a stalled connection. For the byte-level watchdog on the Anthropic API: default and minimum `300000` (5 minutes); lower values are silently clamped to absorb extended thinking pauses and proxy buffering. For the event-level watchdog: default `90000` (90 seconds), no minimum. For third-party providers, requires `CLAUDE_ENABLE_STREAM_WATCHDOG=1` `DISABLE_AUTOUPDATER`| Set to `1` to disable automatic updates `DISABLE_AUTO_COMPACT`| Set to `1` to disable automatic compaction when approaching the context limit. The manual `/compact` command remains available. Use when you want explicit control over when compaction occurs `DISABLE_COMPACT`| Set to `1` to disable all compaction: both automatic compaction and the manual `/compact` command @@ -174,7 +176,7 @@ `MCP_TOOL_TIMEOUT`| Timeout in milliseconds for MCP tool execution (default: 100000000, about 28 hours) `NO_PROXY`| List of domains and IPs to which requests will be directly issued, bypassing proxy `OTEL_LOG_TOOL_CONTENT`| Set to `1` to include tool input and output content in OpenTelemetry span events. Disabled by default to protect sensitive data. See [Monitoring](</docs/en/monitoring-usage>) -`OTEL_LOG_TOOL_DETAILS`| Set to `1` to include MCP server names and tool details in telemetry. Disabled by default to protect PII. See [Monitoring](</docs/en/monitoring-usage>) +`OTEL_LOG_TOOL_DETAILS`| Set to `1` to include tool input arguments, MCP server names, and tool details in OpenTelemetry traces and logs. Disabled by default to protect PII. See [Monitoring](</docs/en/monitoring-usage>) `OTEL_LOG_USER_PROMPTS`| Set to `1` to include user prompt text in OpenTelemetry traces and logs. Disabled by default (prompts are redacted). See [Monitoring](</docs/en/monitoring-usage>) `OTEL_METRICS_INCLUDE_ACCOUNT_UUID`| Set to `false` to exclude account UUID from metrics attributes (default: included). See [Monitoring](</docs/en/monitoring-usage>) `OTEL_METRICS_INCLUDE_SESSION_ID`| Set to `false` to exclude session ID from metrics attributes (default: included). See [Monitoring](</docs/en/monitoring-usage>) @@ -188,7 +190,9 @@ `VERTEX_REGION_CLAUDE_4_0_OPUS`| Override region for Claude 4.0 Opus when using Vertex AI `VERTEX_REGION_CLAUDE_4_0_SONNET`| Override region for Claude 4.0 Sonnet when using Vertex AI `VERTEX_REGION_CLAUDE_4_1_OPUS`| Override region for Claude 4.1 Opus when using Vertex AI +`VERTEX_REGION_CLAUDE_4_5_OPUS`| Override region for Claude Opus 4.5 when using Vertex AI `VERTEX_REGION_CLAUDE_4_5_SONNET`| Override region for Claude Sonnet 4.5 when using Vertex AI +`VERTEX_REGION_CLAUDE_4_6_OPUS`| Override region for Claude Opus 4.6 when using Vertex AI `VERTEX_REGION_CLAUDE_4_6_SONNET`| Override region for Claude Sonnet 4.6 when using Vertex AI `VERTEX_REGION_CLAUDE_HAIKU_4_5`| Override region for Claude Haiku 4.5 when using Vertex AI
modified
--- a/env-vars.md +++ b/env-vars.md @@ -29,7 +29,7 @@ `ANTHROPIC_FOUNDRY_RESOURCE`| Foundry resource name (for example, `my-resource`). Required if `ANTHROPIC_FOUNDRY_BASE_URL` is not set (see [Microsoft Foundry](</docs/en/microsoft-foundry>)) `ANTHROPIC_MODEL`| Name of the model setting to use (see [Model Configuration](</docs/en/model-config#environment-variables>)) `ANTHROPIC_SMALL_FAST_MODEL`| [DEPRECATED] Name of [Haiku-class model for background tasks](</docs/en/costs>) -`ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION`| Override AWS region for the Haiku-class model when using Bedrock +`ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION`| Override AWS region for the Haiku-class model when using Bedrock or Bedrock Mantle `ANTHROPIC_VERTEX_BASE_URL`| Override the Vertex AI endpoint URL. Use for custom Vertex endpoints or when routing through an [LLM gateway](</docs/en/llm-gateway>). See [Google Vertex AI](</docs/en/google-vertex-ai>) `ANTHROPIC_VERTEX_PROJECT_ID`| GCP project ID for Vertex AI. Required when using [Google Vertex AI](</docs/en/google-vertex-ai>) `API_TIMEOUT_MS`| Timeout for API requests in milliseconds (default: 600000, or 10 minutes; maximum: 2147483647). Increase this when requests time out on slow networks or when routing through a proxy. Values above the maximum overflow the underlying timer and cause requests to fail immediately @@ -43,12 +43,13 @@ `CLAUDE_AGENT_SDK_MCP_NO_PREFIX`| Set to `1` to skip the `mcp__<server>__` prefix on tool names from SDK-created MCP servers. Tools use their original names. SDK usage only `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](</docs/en/statusline>) `CLAUDE_AUTO_BACKGROUND_TASKS`| Set to `1` to force-enable automatic backgrounding of long-running agent tasks. When enabled, subagents are moved to the background after running for approximately two minutes -`CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR`| Return to the original working directory after each Bash command +`CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR`| Return to the original working directory after each Bash or PowerShell command in the main session `CLAUDE_CODE_ACCESSIBILITY`| Set to `1` to keep the native terminal cursor visible and disable the inverted-text cursor indicator. Allows screen magnifiers like macOS Zoom to track cursor position `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD`| Set to `1` to load CLAUDE.md files from directories specified with `--add-dir`. By default, additional directories do not load memory files `CLAUDE_CODE_API_KEY_HELPER_TTL_MS`| Interval in milliseconds at which credentials should be refreshed (when using [`apiKeyHelper`](</docs/en/settings#available-settings>)) `CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the context capacity in tokens used for auto-compaction calculations. Defaults to the model’s context window: 200K for standard models or 1M for [extended context](</docs/en/model-config#extended-context>) models. Use a lower value like `500000` on a 1M model to treat the window as 500K for compaction purposes. The value is capped at the model’s actual context window. `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` is applied as a percentage of this value. Setting this variable decouples the compaction threshold from the status line’s `used_percentage`, which always uses the model’s full context window `CLAUDE_CODE_AUTO_CONNECT_IDE`| Override automatic [IDE connection](</docs/en/vs-code>). By default, Claude Code connects automatically when launched inside a supported IDE’s integrated terminal. Set to `false` to prevent this. Set to `true` to force a connection attempt when auto-detection fails, such as when tmux obscures the parent terminal +`CLAUDE_CODE_CERT_STORE`| Comma-separated list of CA certificate sources for TLS connections. `bundled` is the Mozilla CA set shipped with Claude Code. `system` is the operating system trust store. Default is `bundled,system`. The native binary distribution is required for system store integration. On the Node.js runtime, only the bundled set is used regardless of this value `CLAUDE_CODE_CLIENT_CERT`| Path to client certificate file for mTLS authentication `CLAUDE_CODE_CLIENT_KEY`| Path to client private key file for mTLS authentication `CLAUDE_CODE_CLIENT_KEY_PASSPHRASE`| Passphrase for encrypted CLAUDE_CODE_CLIENT_KEY (optional)
modified
--- a/env-vars.md +++ b/env-vars.md @@ -95,16 +95,18 @@ `CLAUDE_CODE_NO_FLICKER`| Set to `1` to enable [fullscreen rendering](</docs/en/fullscreen>), a research preview that reduces flicker and keeps memory flat in long conversations `CLAUDE_CODE_OAUTH_REFRESH_TOKEN`| OAuth refresh token for Claude.ai authentication. When set, `claude auth login` exchanges this token directly instead of opening a browser. Requires `CLAUDE_CODE_OAUTH_SCOPES`. Useful for provisioning authentication in automated environments `CLAUDE_CODE_OAUTH_SCOPES`| Space-separated OAuth scopes the refresh token was issued with, such as `"user:profile user:inference user:sessions:claude_code"`. Required when `CLAUDE_CODE_OAUTH_REFRESH_TOKEN` is set -`CLAUDE_CODE_OAUTH_TOKEN`| OAuth access token for Claude.ai authentication. Alternative to `/login` for SDK and automated environments. Takes precedence over keychain-stored credentials +`CLAUDE_CODE_OAUTH_TOKEN`| OAuth access token for Claude.ai authentication. Alternative to `/login` for SDK and automated environments. Takes precedence over keychain-stored credentials. Generate one with [`claude setup-token`](</docs/en/authentication#generate-a-long-lived-token>) `CLAUDE_CODE_OTEL_FLUSH_TIMEOUT_MS`| Timeout in milliseconds for flushing pending OpenTelemetry spans (default: 5000). See [Monitoring](</docs/en/monitoring-usage>) `CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS`| Interval for refreshing dynamic OpenTelemetry headers in milliseconds (default: 1740000 / 29 minutes). See [Dynamic headers](</docs/en/monitoring-usage#dynamic-headers>) `CLAUDE_CODE_OTEL_SHUTDOWN_TIMEOUT_MS`| Timeout in milliseconds for the OpenTelemetry exporter to finish on shutdown (default: 2000). Increase if metrics are dropped at exit. See [Monitoring](</docs/en/monitoring-usage>) +`CLAUDE_CODE_PERFORCE_MODE`| Set to `1` to enable Perforce-aware write protection. When set, Edit, Write, and NotebookEdit fail with a `p4 edit <file>` hint if the target file lacks the owner-write bit, which Perforce clears on synced files until `p4 edit` opens them. This prevents Claude Code from bypassing Perforce change tracking `CLAUDE_CODE_PLUGIN_CACHE_DIR`| Override the plugins root directory. Despite the name, this sets the parent directory, not the cache itself: marketplaces and the plugin cache live in subdirectories under this path. Defaults to `~/.claude/plugins` `CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS`| Timeout in milliseconds for git operations when installing or updating plugins (default: 120000). Increase this value for large repositories or slow network connections. See [Git operations time out](</docs/en/plugin-marketplaces#git-operations-time-out>) `CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE`| Set to `1` to keep the existing marketplace cache when a `git pull` fails instead of wiping and re-cloning. Useful in offline or airgapped environments where re-cloning would fail the same way. See [Marketplace updates fail in offline environments](</docs/en/plugin-marketplaces#marketplace-updates-fail-in-offline-environments>) `CLAUDE_CODE_PLUGIN_SEED_DIR`| Path to one or more read-only plugin seed directories, separated by `:` on Unix or `;` on Windows. Use this to bundle a pre-populated plugins directory into a container image. Claude Code registers marketplaces from these directories at startup and uses pre-cached plugins without re-cloning. See [Pre-populate plugins for containers](</docs/en/plugin-marketplaces#pre-populate-plugins-for-containers>) `CLAUDE_CODE_PROXY_RESOLVES_HOSTS`| Set to `1` to allow the proxy to perform DNS resolution instead of the caller. Opt-in for environments where the proxy should handle hostname resolution `CLAUDE_CODE_RESUME_INTERRUPTED_TURN`| Set to `1` to automatically resume if the previous session ended mid-turn. Used in SDK mode so the model continues without requiring the SDK to re-send the prompt +`CLAUDE_CODE_SCRIPT_CAPS`| JSON object limiting how many times specific scripts may be invoked per session when `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB` is set. Keys are substrings matched against the command text; values are integer call limits. For example, `{"deploy.sh": 2}` allows `deploy.sh` to be called at most twice. Matching is substring-based so shell-expansion tricks like `./scripts/deploy.sh $(evil)` still count against the cap. Runtime fan-out via `xargs` or `find -exec` is not detected; this is a defense-in-depth control `CLAUDE_CODE_SCROLL_SPEED`| Set the mouse wheel scroll multiplier in [fullscreen rendering](</docs/en/fullscreen#adjust-wheel-scroll-speed>). Accepts values from 1 to 20. Set to `3` to match `vim` if your terminal sends one wheel event per notch without amplification `CLAUDE_CODE_SESSIONEND_HOOKS_TIMEOUT_MS`| Maximum time in milliseconds for [SessionEnd](</docs/en/hooks#sessionend>) hooks to complete (default: `1500`). Applies to session exit, `/clear`, and switching sessions via interactive `/resume`. Per-hook `timeout` values are also capped by this budget `CLAUDE_CODE_SHELL`| Override automatic shell detection. Useful when your login shell differs from your preferred working shell (for example, `bash` vs `zsh`) @@ -115,7 +117,7 @@ `CLAUDE_CODE_SKIP_MANTLE_AUTH`| Skip AWS authentication for Bedrock Mantle (for example, when using an LLM gateway) `CLAUDE_CODE_SKIP_VERTEX_AUTH`| Skip Google authentication for Vertex (for example, when using an LLM gateway) `CLAUDE_CODE_SUBAGENT_MODEL`| See [Model configuration](</docs/en/model-config>) -`CLAUDE_CODE_SUBPROCESS_ENV_SCRUB`| Set to `1` to strip Anthropic and cloud provider credentials from subprocess environments (Bash tool, hooks, MCP stdio servers). The parent Claude process keeps these credentials for API calls, but child processes cannot read them, reducing exposure to prompt injection attacks that attempt to exfiltrate secrets via shell expansion. `claude-code-action` sets this automatically when `allowed_non_write_users` is configured +`CLAUDE_CODE_SUBPROCESS_ENV_SCRUB`| Set to `1` to strip Anthropic and cloud provider credentials from subprocess environments (Bash tool, hooks, MCP stdio servers). The parent Claude process keeps these credentials for API calls, but child processes cannot read them, reducing exposure to prompt injection attacks that attempt to exfiltrate secrets via shell expansion. On Linux, this also runs Bash subprocesses in an isolated PID namespace so they cannot read host process environments via `/proc`; as a side effect, `ps`, `pgrep`, and `kill` cannot see or signal host processes. `claude-code-action` sets this automatically when `allowed_non_write_users` is configured `CLAUDE_CODE_SYNC_PLUGIN_INSTALL`| Set to `1` in non-interactive mode (the `-p` flag) to wait for plugin installation to complete before the first query. Without this, plugins install in the background and may not be available on the first turn. Combine with `CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS` to bound the wait `CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS`| Timeout in milliseconds for synchronous plugin installation. When exceeded, Claude Code proceeds without plugins and logs an error. No default: without this variable, synchronous installation waits until complete `CLAUDE_CODE_SYNTAX_HIGHLIGHT`| Set to `false` to disable syntax highlighting in diff output. Useful when colors interfere with your terminal setup
modified
--- a/env-vars.md +++ b/env-vars.md @@ -37,6 +37,7 @@ `BASH_DEFAULT_TIMEOUT_MS`| Default timeout for long-running bash commands (default: 120000, or 2 minutes) `BASH_MAX_OUTPUT_LENGTH`| Maximum number of characters in bash outputs before they are middle-truncated `BASH_MAX_TIMEOUT_MS`| Maximum timeout the model can set for long-running bash commands (default: 600000, or 10 minutes) +`CCR_FORCE_BUNDLE`| Set to `1` to force [`claude --remote`](</docs/en/claude-code-on-the-web#send-local-repositories-without-github>) to bundle and upload your local repository even when GitHub access is available `CLAUDECODE`| Set to `1` in shell environments Claude Code spawns (Bash tool, tmux sessions). Not set in [hooks](</docs/en/hooks>) or [status line](</docs/en/statusline>) commands. Use to detect when a script is running inside a shell spawned by Claude Code `CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS`| Set to `1` to disable all built-in [subagent](</docs/en/sub-agents>) types such as Explore and Plan. Only applies in non-interactive mode (the `-p` flag). Useful for SDK users who want a blank slate `CLAUDE_AGENT_SDK_MCP_NO_PREFIX`| Set to `1` to skip the `mcp__<server>__` prefix on tool names from SDK-created MCP servers. Tools use their original names. SDK usage only @@ -158,7 +159,7 @@ `HTTP_PROXY`| Specify HTTP proxy server for network connections `HTTPS_PROXY`| Specify HTTPS proxy server for network connections `IS_DEMO`| Set to `1` to enable demo mode: hides your email and organization name from the header and `/status` output, and skips onboarding. Useful when streaming or recording a session -`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) +`MAX_MCP_OUTPUT_TOKENS`| Maximum number of tokens allowed in MCP tool responses. Claude Code displays a warning when output exceeds 10,000 tokens. Tools that declare [`anthropic/maxResultSizeChars`](</docs/en/mcp#raise-the-limit-for-a-specific-tool>) use that character limit for text content instead, but image content from those tools is still subject to this variable (default: 25000) `MAX_STRUCTURED_OUTPUT_RETRIES`| Number of times to retry when the model’s response fails validation against the [`--json-schema`](</docs/en/cli-reference#cli-flags>) in non-interactive mode (the `-p` flag). Defaults to 5 `MAX_THINKING_TOKENS`| Override the [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) token budget. The ceiling is the model’s [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>) minus one. Set to `0` to disable thinking entirely. On models with adaptive reasoning (Opus 4.6, Sonnet 4.6), the budget is ignored unless adaptive reasoning is disabled via `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` `MCP_CLIENT_SECRET`| OAuth client secret for MCP servers that require [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>). Avoids the interactive prompt when adding a server with `--client-secret`
modified
--- a/env-vars.md +++ b/env-vars.md @@ -6,6 +6,7 @@ `ANTHROPIC_AUTH_TOKEN`| Custom value for the `Authorization` header (the value you set here will be prefixed with `Bearer `) `ANTHROPIC_BASE_URL`| Override the API endpoint to route requests through a proxy or gateway. When set to a non-first-party host, [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) is disabled by default. Set `ENABLE_TOOL_SEARCH=true` if your proxy forwards `tool_reference` blocks `ANTHROPIC_BEDROCK_BASE_URL`| Override the Bedrock endpoint URL. Use for custom Bedrock endpoints or when routing through an [LLM gateway](</docs/en/llm-gateway>). See [Amazon Bedrock](</docs/en/amazon-bedrock>) +`ANTHROPIC_BEDROCK_MANTLE_BASE_URL`| Override the Bedrock Mantle endpoint URL. See [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>) `ANTHROPIC_BETAS`| Comma-separated list of additional `anthropic-beta` header values to include in API requests. Claude Code already sends the beta headers it needs; use this to opt into an [Anthropic API beta](<https://platform.claude.com/docs/en/api/beta-headers>) before Claude Code adds native support. Unlike the [`--betas` flag](</docs/en/cli-reference#cli-flags>), which requires API key authentication, this variable works with all auth methods including Claude.ai subscription `ANTHROPIC_CUSTOM_HEADERS`| Custom headers to add to requests (`Name: Value` format, newline-separated for multiple headers) `ANTHROPIC_CUSTOM_MODEL_OPTION`| Model ID to add as a custom entry in the `/model` picker. Use this to make a non-standard or gateway-specific model selectable without replacing built-in aliases. See [Model configuration](</docs/en/model-config#add-a-custom-model-option>) @@ -31,11 +32,11 @@ `ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION`| Override AWS region for the Haiku-class model when using Bedrock `ANTHROPIC_VERTEX_BASE_URL`| Override the Vertex AI endpoint URL. Use for custom Vertex endpoints or when routing through an [LLM gateway](</docs/en/llm-gateway>). See [Google Vertex AI](</docs/en/google-vertex-ai>) `ANTHROPIC_VERTEX_PROJECT_ID`| GCP project ID for Vertex AI. Required when using [Google Vertex AI](</docs/en/google-vertex-ai>) -`API_TIMEOUT_MS`| Timeout for API requests in milliseconds (default: 600000, or 10 minutes). Increase this when requests time out on slow networks or when routing through a proxy +`API_TIMEOUT_MS`| Timeout for API requests in milliseconds (default: 600000, or 10 minutes; maximum: 2147483647). Increase this when requests time out on slow networks or when routing through a proxy. Values above the maximum overflow the underlying timer and cause requests to fail immediately `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/>)) -`BASH_DEFAULT_TIMEOUT_MS`| Default timeout for long-running bash commands +`BASH_DEFAULT_TIMEOUT_MS`| Default timeout for long-running bash commands (default: 120000, or 2 minutes) `BASH_MAX_OUTPUT_LENGTH`| Maximum number of characters in bash outputs before they are middle-truncated -`BASH_MAX_TIMEOUT_MS`| Maximum timeout the model can set for long-running bash commands +`BASH_MAX_TIMEOUT_MS`| Maximum timeout the model can set for long-running bash commands (default: 600000, or 10 minutes) `CLAUDECODE`| Set to `1` in shell environments Claude Code spawns (Bash tool, tmux sessions). Not set in [hooks](</docs/en/hooks>) or [status line](</docs/en/statusline>) commands. Use to detect when a script is running inside a shell spawned by Claude Code `CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS`| Set to `1` to disable all built-in [subagent](</docs/en/sub-agents>) types such as Explore and Plan. Only applies in non-interactive mode (the `-p` flag). Useful for SDK users who want a blank slate `CLAUDE_AGENT_SDK_MCP_NO_PREFIX`| Set to `1` to skip the `mcp__<server>__` prefix on tool names from SDK-created MCP servers. Tools use their original names. SDK usage only @@ -110,6 +111,7 @@ `CLAUDE_CODE_SIMPLE`| Set to `1` to run with a minimal system prompt and only the Bash, file read, and file edit tools. MCP tools from `--mcp-config` are still available. Disables auto-discovery of hooks, skills, plugins, MCP servers, auto memory, and CLAUDE.md. The [`--bare`](</docs/en/headless#start-faster-with-bare-mode>) CLI flag sets this `CLAUDE_CODE_SKIP_BEDROCK_AUTH`| Skip AWS authentication for Bedrock (for example, when using an LLM gateway) `CLAUDE_CODE_SKIP_FOUNDRY_AUTH`| Skip Azure authentication for Microsoft Foundry (for example, when using an LLM gateway) +`CLAUDE_CODE_SKIP_MANTLE_AUTH`| Skip AWS authentication for Bedrock Mantle (for example, when using an LLM gateway) `CLAUDE_CODE_SKIP_VERTEX_AUTH`| Skip Google authentication for Vertex (for example, when using an LLM gateway) `CLAUDE_CODE_SUBAGENT_MODEL`| See [Model configuration](</docs/en/model-config>) `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB`| Set to `1` to strip Anthropic and cloud provider credentials from subprocess environments (Bash tool, hooks, MCP stdio servers). The parent Claude process keeps these credentials for API calls, but child processes cannot read them, reducing exposure to prompt injection attacks that attempt to exfiltrate secrets via shell expansion. `claude-code-action` sets this automatically when `allowed_non_write_users` is configured @@ -121,6 +123,7 @@ `CLAUDE_CODE_TMPDIR`| Override the temp directory used for internal temp files. Claude Code appends `/claude-{uid}/` (Unix) or `/claude/` (Windows) to this path. Default: `/tmp` on macOS, `os.tmpdir()` on Linux/Windows `CLAUDE_CODE_USE_BEDROCK`| Use [Bedrock](</docs/en/amazon-bedrock>) `CLAUDE_CODE_USE_FOUNDRY`| Use [Microsoft Foundry](</docs/en/microsoft-foundry>) +`CLAUDE_CODE_USE_MANTLE`| Use the Bedrock [Mantle endpoint](</docs/en/amazon-bedrock#use-the-mantle-endpoint>) `CLAUDE_CODE_USE_POWERSHELL_TOOL`| Set to `1` to enable the PowerShell tool on Windows (opt-in preview). When enabled, Claude can run PowerShell commands natively instead of routing through Git Bash. Only supported on native Windows, not WSL. See [PowerShell tool](</docs/en/tools-reference#powershell-tool>) `CLAUDE_CODE_USE_VERTEX`| Use [Vertex](</docs/en/google-vertex-ai>) `CLAUDE_CONFIG_DIR`| Override the configuration directory (default: `~/.claude`). All settings, credentials, session history, and plugins are stored under this path. Useful for running multiple accounts side by side: for example, `alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'` @@ -163,8 +166,8 @@ `MCP_OAUTH_CALLBACK_PORT`| Fixed port for the OAuth redirect callback, as an alternative to `--callback-port` when adding an MCP server with [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>) `MCP_REMOTE_SERVER_CONNECTION_BATCH_SIZE`| Maximum number of remote MCP servers (HTTP/SSE) to connect in parallel during startup (default: 20) `MCP_SERVER_CONNECTION_BATCH_SIZE`| Maximum number of local MCP servers (stdio) to connect in parallel during startup (default: 3) -`MCP_TIMEOUT`| Timeout in milliseconds for MCP server startup -`MCP_TOOL_TIMEOUT`| Timeout in milliseconds for MCP tool execution +`MCP_TIMEOUT`| Timeout in milliseconds for MCP server startup (default: 30000, or 30 seconds) +`MCP_TOOL_TIMEOUT`| Timeout in milliseconds for MCP tool execution (default: 100000000, about 28 hours) `NO_PROXY`| List of domains and IPs to which requests will be directly issued, bypassing proxy `OTEL_LOG_TOOL_CONTENT`| Set to `1` to include tool input and output content in OpenTelemetry span events. Disabled by default to protect sensitive data. See [Monitoring](</docs/en/monitoring-usage>) `OTEL_LOG_TOOL_DETAILS`| Set to `1` to include MCP server names and tool details in telemetry. Disabled by default to protect PII. See [Monitoring](</docs/en/monitoring-usage>)
modified
--- a/env-vars.md +++ b/env-vars.md @@ -126,6 +126,7 @@ `CLAUDE_CONFIG_DIR`| Override the configuration directory (default: `~/.claude`). All settings, credentials, session history, and plugins are stored under this path. Useful for running multiple accounts side by side: for example, `alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'` `CLAUDE_ENABLE_STREAM_WATCHDOG`| Set to `1` to abort API response streams that stall with no data for 90 seconds. Useful in automated environments where a hung session would go unnoticed, or behind proxies that drop connections silently. Without this, a stalled stream can hang the session indefinitely since the request timeout only covers the initial connection. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS` `CLAUDE_ENV_FILE`| Path to a shell script that Claude Code sources before each Bash command. Use to persist virtualenv or conda activation across commands. Also populated dynamically by [SessionStart](</docs/en/hooks#persist-environment-variables>), [CwdChanged](</docs/en/hooks#cwdchanged>), and [FileChanged](</docs/en/hooks#filechanged>) hooks +`CLAUDE_REMOTE_CONTROL_SESSION_NAME_PREFIX`| Prefix for auto-generated [Remote Control](</docs/en/remote-control>) session names when no explicit name is provided. Defaults to your machine’s hostname, producing names like `myhost-graceful-unicorn`. The `--remote-control-session-name-prefix` CLI flag sets the same value for a single invocation `CLAUDE_STREAM_IDLE_TIMEOUT_MS`| Timeout in milliseconds before the streaming idle watchdog closes a stalled connection. Default: `90000` (90 seconds). Requires `CLAUDE_ENABLE_STREAM_WATCHDOG=1`. Increase this value if long-running tools or slow networks cause premature timeout errors `DISABLE_AUTOUPDATER`| Set to `1` to disable automatic updates `DISABLE_AUTO_COMPACT`| Set to `1` to disable automatic compaction when approaching the context limit. The manual `/compact` command remains available. Use when you want explicit control over when compaction occurs
modified
--- a/env-vars.md +++ b/env-vars.md @@ -109,7 +109,6 @@ `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>` `CLAUDE_CODE_SIMPLE`| Set to `1` to run with a minimal system prompt and only the Bash, file read, and file edit tools. MCP tools from `--mcp-config` are still available. Disables auto-discovery of hooks, skills, plugins, MCP servers, auto memory, and CLAUDE.md. The [`--bare`](</docs/en/headless#start-faster-with-bare-mode>) CLI flag sets this `CLAUDE_CODE_SKIP_BEDROCK_AUTH`| Skip AWS authentication for Bedrock (for example, when using an LLM gateway) -`CLAUDE_CODE_SKIP_FAST_MODE_NETWORK_ERRORS`| Set to `1` to allow [fast mode](</docs/en/fast-mode>) when the organization status check fails due to a network error. Useful when a corporate proxy blocks the status endpoint. The API still enforces organization-level disable separately `CLAUDE_CODE_SKIP_FOUNDRY_AUTH`| Skip Azure authentication for Microsoft Foundry (for example, when using an LLM gateway) `CLAUDE_CODE_SKIP_VERTEX_AUTH`| Skip Google authentication for Vertex (for example, when using an LLM gateway) `CLAUDE_CODE_SUBAGENT_MODEL`| See [Model configuration](</docs/en/model-config>) @@ -119,7 +118,7 @@ `CLAUDE_CODE_SYNTAX_HIGHLIGHT`| Set to `false` to disable syntax highlighting in diff output. Useful when colors interfere with your terminal setup `CLAUDE_CODE_TASK_LIST_ID`| Share a task list across sessions. Set the same ID in multiple Claude Code instances to coordinate on a shared task list. See [Task list](</docs/en/interactive-mode#task-list>) `CLAUDE_CODE_TEAM_NAME`| Name of the agent team this teammate belongs to. Set automatically on [agent team](</docs/en/agent-teams>) members -`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 +`CLAUDE_CODE_TMPDIR`| Override the temp directory used for internal temp files. Claude Code appends `/claude-{uid}/` (Unix) or `/claude/` (Windows) to this path. Default: `/tmp` on macOS, `os.tmpdir()` on Linux/Windows `CLAUDE_CODE_USE_BEDROCK`| Use [Bedrock](</docs/en/amazon-bedrock>) `CLAUDE_CODE_USE_FOUNDRY`| Use [Microsoft Foundry](</docs/en/microsoft-foundry>) `CLAUDE_CODE_USE_POWERSHELL_TOOL`| Set to `1` to enable the PowerShell tool on Windows (opt-in preview). When enabled, Claude can run PowerShell commands natively instead of routing through Git Bash. Only supported on native Windows, not WSL. See [PowerShell tool](</docs/en/tools-reference#powershell-tool>)
modified
--- a/env-vars.md +++ b/env-vars.md @@ -99,6 +99,7 @@ `CLAUDE_CODE_OTEL_SHUTDOWN_TIMEOUT_MS`| Timeout in milliseconds for the OpenTelemetry exporter to finish on shutdown (default: 2000). Increase if metrics are dropped at exit. See [Monitoring](</docs/en/monitoring-usage>) `CLAUDE_CODE_PLUGIN_CACHE_DIR`| Override the plugins root directory. Despite the name, this sets the parent directory, not the cache itself: marketplaces and the plugin cache live in subdirectories under this path. Defaults to `~/.claude/plugins` `CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS`| Timeout in milliseconds for git operations when installing or updating plugins (default: 120000). Increase this value for large repositories or slow network connections. See [Git operations time out](</docs/en/plugin-marketplaces#git-operations-time-out>) +`CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE`| Set to `1` to keep the existing marketplace cache when a `git pull` fails instead of wiping and re-cloning. Useful in offline or airgapped environments where re-cloning would fail the same way. See [Marketplace updates fail in offline environments](</docs/en/plugin-marketplaces#marketplace-updates-fail-in-offline-environments>) `CLAUDE_CODE_PLUGIN_SEED_DIR`| Path to one or more read-only plugin seed directories, separated by `:` on Unix or `;` on Windows. Use this to bundle a pre-populated plugins directory into a container image. Claude Code registers marketplaces from these directories at startup and uses pre-cached plugins without re-cloning. See [Pre-populate plugins for containers](</docs/en/plugin-marketplaces#pre-populate-plugins-for-containers>) `CLAUDE_CODE_PROXY_RESOLVES_HOSTS`| Set to `1` to allow the proxy to perform DNS resolution instead of the caller. Opt-in for environments where the proxy should handle hostname resolution `CLAUDE_CODE_RESUME_INTERRUPTED_TURN`| Set to `1` to automatically resume if the previous session ended mid-turn. Used in SDK mode so the model continues without requiring the SDK to re-send the prompt
modified
--- a/env-vars.md +++ b/env-vars.md @@ -158,6 +158,7 @@ `MAX_STRUCTURED_OUTPUT_RETRIES`| Number of times to retry when the model’s response fails validation against the [`--json-schema`](</docs/en/cli-reference#cli-flags>) in non-interactive mode (the `-p` flag). Defaults to 5 `MAX_THINKING_TOKENS`| Override the [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) token budget. The ceiling is the model’s [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>) minus one. Set to `0` to disable thinking entirely. On models with adaptive reasoning (Opus 4.6, Sonnet 4.6), the budget is ignored unless adaptive reasoning is disabled via `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` `MCP_CLIENT_SECRET`| OAuth client secret for MCP servers that require [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>). Avoids the interactive prompt when adding a server with `--client-secret` +`MCP_CONNECTION_NONBLOCKING`| Set to `true` in non-interactive mode (`-p`) to skip the MCP connection wait entirely. Useful for scripted pipelines where MCP tools are not needed. Without this variable, the first query waits up to 5 seconds for `--mcp-config` server connections `MCP_OAUTH_CALLBACK_PORT`| Fixed port for the OAuth redirect callback, as an alternative to `--callback-port` when adding an MCP server with [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>) `MCP_REMOTE_SERVER_CONNECTION_BATCH_SIZE`| Maximum number of remote MCP servers (HTTP/SSE) to connect in parallel during startup (default: 20) `MCP_SERVER_CONNECTION_BATCH_SIZE`| Maximum number of local MCP servers (stdio) to connect in parallel during startup (default: 3)
modified
Show diff (188 lines)
--- a/env-vars.md +++ b/env-vars.md @@ -5,6 +5,8 @@ `ANTHROPIC_API_KEY`| API key sent as `X-Api-Key` header. When set, this key is used instead of your Claude Pro, Max, Team, or Enterprise subscription even if you are logged in. In non-interactive mode (`-p`), the key is always used when present. In interactive mode, you are prompted to approve the key once before it overrides your subscription. To use your subscription instead, run `unset ANTHROPIC_API_KEY` `ANTHROPIC_AUTH_TOKEN`| Custom value for the `Authorization` header (the value you set here will be prefixed with `Bearer `) `ANTHROPIC_BASE_URL`| Override the API endpoint to route requests through a proxy or gateway. When set to a non-first-party host, [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) is disabled by default. Set `ENABLE_TOOL_SEARCH=true` if your proxy forwards `tool_reference` blocks +`ANTHROPIC_BEDROCK_BASE_URL`| Override the Bedrock endpoint URL. Use for custom Bedrock endpoints or when routing through an [LLM gateway](</docs/en/llm-gateway>). See [Amazon Bedrock](</docs/en/amazon-bedrock>) +`ANTHROPIC_BETAS`| Comma-separated list of additional `anthropic-beta` header values to include in API requests. Claude Code already sends the beta headers it needs; use this to opt into an [Anthropic API beta](<https://platform.claude.com/docs/en/api/beta-headers>) before Claude Code adds native support. Unlike the [`--betas` flag](</docs/en/cli-reference#cli-flags>), which requires API key authentication, this variable works with all auth methods including Claude.ai subscription `ANTHROPIC_CUSTOM_HEADERS`| Custom headers to add to requests (`Name: Value` format, newline-separated for multiple headers) `ANTHROPIC_CUSTOM_MODEL_OPTION`| Model ID to add as a custom entry in the `/model` picker. Use this to make a non-standard or gateway-specific model selectable without replacing built-in aliases. See [Model configuration](</docs/en/model-config#add-a-custom-model-option>) `ANTHROPIC_CUSTOM_MODEL_OPTION_DESCRIPTION`| Display description for the custom model entry in the `/model` picker. Defaults to `Custom model (<model-id>)` when not set @@ -27,50 +29,79 @@ `ANTHROPIC_MODEL`| Name of the model setting to use (see [Model Configuration](</docs/en/model-config#environment-variables>)) `ANTHROPIC_SMALL_FAST_MODEL`| [DEPRECATED] Name of [Haiku-class model for background tasks](</docs/en/costs>) `ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION`| Override AWS region for the Haiku-class model when using Bedrock +`ANTHROPIC_VERTEX_BASE_URL`| Override the Vertex AI endpoint URL. Use for custom Vertex endpoints or when routing through an [LLM gateway](</docs/en/llm-gateway>). See [Google Vertex AI](</docs/en/google-vertex-ai>) +`ANTHROPIC_VERTEX_PROJECT_ID`| GCP project ID for Vertex AI. Required when using [Google Vertex AI](</docs/en/google-vertex-ai>) +`API_TIMEOUT_MS`| Timeout for API requests in milliseconds (default: 600000, or 10 minutes). Increase this when requests time out on slow networks or when routing through a proxy `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/>)) `BASH_DEFAULT_TIMEOUT_MS`| Default timeout for long-running bash commands `BASH_MAX_OUTPUT_LENGTH`| Maximum number of characters in bash outputs before they are middle-truncated `BASH_MAX_TIMEOUT_MS`| Maximum timeout the model can set for long-running bash commands `CLAUDECODE`| Set to `1` in shell environments Claude Code spawns (Bash tool, tmux sessions). Not set in [hooks](</docs/en/hooks>) or [status line](</docs/en/statusline>) commands. Use to detect when a script is running inside a shell spawned by Claude Code +`CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS`| Set to `1` to disable all built-in [subagent](</docs/en/sub-agents>) types such as Explore and Plan. Only applies in non-interactive mode (the `-p` flag). Useful for SDK users who want a blank slate +`CLAUDE_AGENT_SDK_MCP_NO_PREFIX`| Set to `1` to skip the `mcp__<server>__` prefix on tool names from SDK-created MCP servers. Tools use their original names. SDK usage only `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](</docs/en/statusline>) +`CLAUDE_AUTO_BACKGROUND_TASKS`| Set to `1` to force-enable automatic backgrounding of long-running agent tasks. When enabled, subagents are moved to the background after running for approximately two minutes `CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR`| Return to the original working directory after each Bash command -`CLAUDE_CODE_ACCOUNT_UUID`| Account UUID for the authenticated user. Used by SDK callers to provide account information synchronously, avoiding a race condition where early telemetry events lack account metadata. Requires `CLAUDE_CODE_USER_EMAIL` and `CLAUDE_CODE_ORGANIZATION_UUID` to also be set +`CLAUDE_CODE_ACCESSIBILITY`| Set to `1` to keep the native terminal cursor visible and disable the inverted-text cursor indicator. Allows screen magnifiers like macOS Zoom to track cursor position `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD`| Set to `1` to load CLAUDE.md files from directories specified with `--add-dir`. By default, additional directories do not load memory files +`CLAUDE_CODE_API_KEY_HELPER_TTL_MS`| Interval in milliseconds at which credentials should be refreshed (when using [`apiKeyHelper`](</docs/en/settings#available-settings>)) `CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the context capacity in tokens used for auto-compaction calculations. Defaults to the model’s context window: 200K for standard models or 1M for [extended context](</docs/en/model-config#extended-context>) models. Use a lower value like `500000` on a 1M model to treat the window as 500K for compaction purposes. The value is capped at the model’s actual context window. `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` is applied as a percentage of this value. Setting this variable decouples the compaction threshold from the status line’s `used_percentage`, which always uses the model’s full context window -`CLAUDE_CODE_API_KEY_HELPER_TTL_MS`| Interval in milliseconds at which credentials should be refreshed (when using [`apiKeyHelper`](</docs/en/settings#available-settings>)) +`CLAUDE_CODE_AUTO_CONNECT_IDE`| Override automatic [IDE connection](</docs/en/vs-code>). By default, Claude Code connects automatically when launched inside a supported IDE’s integrated terminal. Set to `false` to prevent this. Set to `true` to force a connection attempt when auto-detection fails, such as when tmux obscures the parent terminal `CLAUDE_CODE_CLIENT_CERT`| Path to client certificate file for mTLS authentication `CLAUDE_CODE_CLIENT_KEY`| Path to client private key file for mTLS authentication `CLAUDE_CODE_CLIENT_KEY_PASSPHRASE`| Passphrase for encrypted CLAUDE_CODE_CLIENT_KEY (optional) +`CLAUDE_CODE_DEBUG_LOGS_DIR`| Override the debug log file path. Despite the name, this is a file path, not a directory. Requires debug mode to be enabled separately via `--debug` or `/debug`: setting this variable alone does not enable logging. The [`--debug-file`](</docs/en/cli-reference#cli-flags>) flag does both at once. Defaults to `~/.claude/debug/<session-id>.txt` +`CLAUDE_CODE_DEBUG_LOG_LEVEL`| Minimum log level written to the debug log file. Values: `verbose`, `debug` (default), `info`, `warn`, `error`. Set to `verbose` to include high-volume diagnostics like full status line command output, or raise to `error` to reduce noise `CLAUDE_CODE_DISABLE_1M_CONTEXT`| Set to `1` to disable [1M context window](</docs/en/model-config#extended-context>) support. When set, 1M model variants are unavailable in the model picker. Useful for enterprise environments with compliance requirements `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING`| Set to `1` to disable [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) for Opus 4.6 and Sonnet 4.6. When disabled, these models fall back to the fixed thinking budget controlled by `MAX_THINKING_TOKENS` +`CLAUDE_CODE_DISABLE_ATTACHMENTS`| Set to `1` to disable attachment processing. File mentions with `@` syntax are sent as plain text instead of being expanded into file content `CLAUDE_CODE_DISABLE_AUTO_MEMORY`| Set to `1` to disable [auto memory](</docs/en/memory#auto-memory>). Set to `0` to force auto memory on during the gradual rollout. When disabled, Claude does not create or load auto memory files -`CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS`| Set to `1` to remove built-in commit and PR workflow instructions and the git status snapshot from Claude’s system prompt. Useful when using your own git workflow skills. Takes precedence over the [`includeGitInstructions`](</docs/en/settings#available-settings>) setting when set `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 +`CLAUDE_CODE_DISABLE_CLAUDE_MDS`| Set to `1` to prevent loading any CLAUDE.md memory files into context, including user, project, and auto-memory files `CLAUDE_CODE_DISABLE_CRON`| Set to `1` to disable [scheduled tasks](</docs/en/scheduled-tasks>). The `/loop` skill and cron tools become unavailable and any already-scheduled tasks stop firing, including tasks that are already running mid-session `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`| Set to `1` to strip Anthropic-specific `anthropic-beta` request headers and beta tool-schema fields (such as `defer_loading` and `eager_input_streaming`) from API requests. Use this when a proxy gateway rejects requests with errors like “Unexpected value(s) for the `anthropic-beta` header” or “Extra inputs are not permitted”. Standard fields (`name`, `description`, `input_schema`, `cache_control`) are preserved. `CLAUDE_CODE_DISABLE_FAST_MODE`| Set to `1` to disable [fast mode](</docs/en/fast-mode>) `CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY`| Set to `1` to disable the “How is Claude doing?” session quality surveys. Surveys are also disabled when `DISABLE_TELEMETRY` or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` is set. See [Session quality surveys](</docs/en/data-usage#session-quality-surveys>) +`CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING`| Set to `1` to disable file [checkpointing](</docs/en/checkpointing>). The `/rewind` command will not be able to restore code changes +`CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS`| Set to `1` to remove built-in commit and PR workflow instructions and the git status snapshot from Claude’s system prompt. Useful when using your own git workflow skills. Takes precedence over the [`includeGitInstructions`](</docs/en/settings#available-settings>) setting when set +`CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP`| Set to `1` to prevent automatic remapping of Opus 4.0 and 4.1 to the current Opus version on the Anthropic API. Use when you intentionally want to pin an older model. The remap does not run on Bedrock, Vertex, or Foundry `CLAUDE_CODE_DISABLE_MOUSE`| Set to `1` to disable mouse tracking in [fullscreen rendering](</docs/en/fullscreen>). Keyboard scrolling with `PgUp` and `PgDn` still works. Use this to keep your terminal’s native copy-on-select behavior `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`| Equivalent of setting `DISABLE_AUTOUPDATER`, `DISABLE_FEEDBACK_COMMAND`, `DISABLE_ERROR_REPORTING`, and `DISABLE_TELEMETRY` `CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK`| Set to `1` to disable the non-streaming fallback when a streaming request fails mid-stream. Streaming errors propagate to the retry layer instead. Useful when a proxy or gateway causes the fallback to produce duplicate tool execution +`CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL`| Set to `1` to skip automatic addition of the official plugin marketplace on first run `CLAUDE_CODE_DISABLE_TERMINAL_TITLE`| Set to `1` to disable automatic terminal title updates based on conversation context +`CLAUDE_CODE_DISABLE_THINKING`| Set to `1` to force-disable [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) regardless of model support or other settings. More direct than `MAX_THINKING_TOKENS=0` `CLAUDE_CODE_EFFORT_LEVEL`| Set the effort level for supported models. Values: `low`, `medium`, `high`, `max` (Opus 4.6 only), or `auto` to use the model default. Takes precedence over `/effort` and the `effortLevel` setting. See [Adjust effort level](</docs/en/model-config#adjust-effort-level>) +`CLAUDE_CODE_ENABLE_FINE_GRAINED_TOOL_STREAMING`| Set to `1` to force-enable fine-grained tool input streaming. Without this, the API buffers tool input parameters fully before sending delta events, which can delay display on large tool inputs. Anthropic API only: has no effect on Bedrock, Vertex, or Foundry `CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION`| Set to `false` to disable prompt suggestions (the “Prompt suggestions” toggle in `/config`). These are the grayed-out predictions that appear in your prompt input after Claude responds. See [Prompt suggestions](</docs/en/interactive-mode#prompt-suggestions>) -`CLAUDE_CODE_ENABLE_TASKS`| Set to `true` to enable the task tracking system in non-interactive mode (the `-p` flag). Tasks are on by default in interactive mode. See [Task list](</docs/en/interactive-mode#task-list>) +`CLAUDE_CODE_ENABLE_TASKS`| Set to `1` to enable the task tracking system in non-interactive mode (the `-p` flag). Tasks are on by default in interactive mode. See [Task list](</docs/en/interactive-mode#task-list>) `CLAUDE_CODE_ENABLE_TELEMETRY`| Set to `1` to enable OpenTelemetry data collection for metrics and logging. Required before configuring OTel exporters. See [Monitoring](</docs/en/monitoring-usage>) `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 `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS`| Set to `1` to enable [agent teams](</docs/en/agent-teams>). Agent teams are experimental and disabled by default `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 +`CLAUDE_CODE_GIT_BASH_PATH`| Windows only: path to the Git Bash executable (`bash.exe`). Use when Git Bash is installed but not in your PATH. See [Windows setup](</docs/en/setup#set-up-on-windows>) +`CLAUDE_CODE_GLOB_HIDDEN`| Set to `false` to exclude dotfiles from results when Claude invokes the [Glob tool](</docs/en/tools-reference>). Included by default. Does not affect `@` file autocomplete, `ls`, Grep, or Read +`CLAUDE_CODE_GLOB_NO_IGNORE`| Set to `false` to make the [Glob tool](</docs/en/tools-reference>) respect `.gitignore` patterns. By default, Glob returns all matching files including gitignored ones. Does not affect `@` file autocomplete, which has its own [`respectGitignore` setting](</docs/en/settings#available-settings>) +`CLAUDE_CODE_GLOB_TIMEOUT_SECONDS`| Timeout in seconds for Glob tool file discovery. Defaults to 20 seconds on most platforms and 60 seconds on WSL +`CLAUDE_CODE_IDE_HOST_OVERRIDE`| Override the host address used to connect to the IDE extension. By default Claude Code auto-detects the correct address, including WSL-to-Windows routing `CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL`| Skip auto-installation of IDE extensions. Equivalent to setting [`autoInstallIdeExtension`](</docs/en/settings#global-config-settings>) to `false` +`CLAUDE_CODE_IDE_SKIP_VALID_CHECK`| Set to `1` to skip validation of IDE lockfile entries during connection. Use when auto-connect fails to find your IDE despite it running `CLAUDE_CODE_MAX_OUTPUT_TOKENS`| Set the maximum number of output tokens for most requests. Defaults and caps vary by model; see [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>). Increasing this value reduces the effective context window available before [auto-compaction](</docs/en/costs#reduce-token-usage>) triggers. -`CLAUDE_CODE_NEW_INIT`| Set to `true` to make `/init` run an interactive setup flow. The flow asks which files to generate, including CLAUDE.md, skills, and hooks, before exploring the codebase and writing them. Without this variable, `/init` generates a CLAUDE.md automatically without prompting. +`CLAUDE_CODE_MAX_RETRIES`| Override the number of times to retry failed API requests (default: 10) +`CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY`| Maximum number of read-only tools and subagents that can execute in parallel (default: 10). Higher values increase parallelism but consume more resources +`CLAUDE_CODE_NEW_INIT`| Set to `1` to make `/init` run an interactive setup flow. The flow asks which files to generate, including CLAUDE.md, skills, and hooks, before exploring the codebase and writing them. Without this variable, `/init` generates a CLAUDE.md automatically without prompting. `CLAUDE_CODE_NO_FLICKER`| Set to `1` to enable [fullscreen rendering](</docs/en/fullscreen>), a research preview that reduces flicker and keeps memory flat in long conversations -`CLAUDE_CODE_ORGANIZATION_UUID`| Organization UUID for the authenticated user. Used by SDK callers to provide account information synchronously. Requires `CLAUDE_CODE_ACCOUNT_UUID` and `CLAUDE_CODE_USER_EMAIL` to also be set +`CLAUDE_CODE_OAUTH_REFRESH_TOKEN`| OAuth refresh token for Claude.ai authentication. When set, `claude auth login` exchanges this token directly instead of opening a browser. Requires `CLAUDE_CODE_OAUTH_SCOPES`. Useful for provisioning authentication in automated environments +`CLAUDE_CODE_OAUTH_SCOPES`| Space-separated OAuth scopes the refresh token was issued with, such as `"user:profile user:inference user:sessions:claude_code"`. Required when `CLAUDE_CODE_OAUTH_REFRESH_TOKEN` is set +`CLAUDE_CODE_OAUTH_TOKEN`| OAuth access token for Claude.ai authentication. Alternative to `/login` for SDK and automated environments. Takes precedence over keychain-stored credentials +`CLAUDE_CODE_OTEL_FLUSH_TIMEOUT_MS`| Timeout in milliseconds for flushing pending OpenTelemetry spans (default: 5000). See [Monitoring](</docs/en/monitoring-usage>) `CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS`| Interval for refreshing dynamic OpenTelemetry headers in milliseconds (default: 1740000 / 29 minutes). See [Dynamic headers](</docs/en/monitoring-usage#dynamic-headers>) -`CLAUDE_CODE_PLAN_MODE_REQUIRED`| Auto-set to `true` on [agent team](</docs/en/agent-teams>) teammates that require plan approval. Read-only: set by Claude Code when spawning teammates. See [require plan approval](</docs/en/agent-teams#require-plan-approval-for-teammates>) +`CLAUDE_CODE_OTEL_SHUTDOWN_TIMEOUT_MS`| Timeout in milliseconds for the OpenTelemetry exporter to finish on shutdown (default: 2000). Increase if metrics are dropped at exit. See [Monitoring](</docs/en/monitoring-usage>) +`CLAUDE_CODE_PLUGIN_CACHE_DIR`| Override the plugins root directory. Despite the name, this sets the parent directory, not the cache itself: marketplaces and the plugin cache live in subdirectories under this path. Defaults to `~/.claude/plugins` `CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS`| Timeout in milliseconds for git operations when installing or updating plugins (default: 120000). Increase this value for large repositories or slow network connections. See [Git operations time out](</docs/en/plugin-marketplaces#git-operations-time-out>) `CLAUDE_CODE_PLUGIN_SEED_DIR`| Path to one or more read-only plugin seed directories, separated by `:` on Unix or `;` on Windows. Use this to bundle a pre-populated plugins directory into a container image. Claude Code registers marketplaces from these directories at startup and uses pre-cached plugins without re-cloning. See [Pre-populate plugins for containers](</docs/en/plugin-marketplaces#pre-populate-plugins-for-containers>) -`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 +`CLAUDE_CODE_PROXY_RESOLVES_HOSTS`| Set to `1` to allow the proxy to perform DNS resolution instead of the caller. Opt-in for environments where the proxy should handle hostname resolution +`CLAUDE_CODE_RESUME_INTERRUPTED_TURN`| Set to `1` to automatically resume if the previous session ended mid-turn. Used in SDK mode so the model continues without requiring the SDK to re-send the prompt `CLAUDE_CODE_SCROLL_SPEED`| Set the mouse wheel scroll multiplier in [fullscreen rendering](</docs/en/fullscreen#adjust-wheel-scroll-speed>). Accepts values from 1 to 20. Set to `3` to match `vim` if your terminal sends one wheel event per notch without amplification `CLAUDE_CODE_SESSIONEND_HOOKS_TIMEOUT_MS`| Maximum time in milliseconds for [SessionEnd](</docs/en/hooks#sessionend>) hooks to complete (default: `1500`). Applies to session exit, `/clear`, and switching sessions via interactive `/resume`. Per-hook `timeout` values are also capped by this budget `CLAUDE_CODE_SHELL`| Override automatic shell detection. Useful when your login shell differs from your preferred working shell (for example, `bash` vs `zsh`) @@ -82,47 +113,77 @@ `CLAUDE_CODE_SKIP_VERTEX_AUTH`| Skip Google authentication for Vertex (for example, when using an LLM gateway) `CLAUDE_CODE_SUBAGENT_MODEL`| See [Model configuration](</docs/en/model-config>) `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB`| Set to `1` to strip Anthropic and cloud provider credentials from subprocess environments (Bash tool, hooks, MCP stdio servers). The parent Claude process keeps these credentials for API calls, but child processes cannot read them, reducing exposure to prompt injection attacks that attempt to exfiltrate secrets via shell expansion. `claude-code-action` sets this automatically when `allowed_non_write_users` is configured +`CLAUDE_CODE_SYNC_PLUGIN_INSTALL`| Set to `1` in non-interactive mode (the `-p` flag) to wait for plugin installation to complete before the first query. Without this, plugins install in the background and may not be available on the first turn. Combine with `CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS` to bound the wait +`CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS`| Timeout in milliseconds for synchronous plugin installation. When exceeded, Claude Code proceeds without plugins and logs an error. No default: without this variable, synchronous installation waits until complete +`CLAUDE_CODE_SYNTAX_HIGHLIGHT`| Set to `false` to disable syntax highlighting in diff output. Useful when colors interfere with your terminal setup `CLAUDE_CODE_TASK_LIST_ID`| Share a task list across sessions. Set the same ID in multiple Claude Code instances to coordinate on a shared task list. See [Task list](</docs/en/interactive-mode#task-list>) `CLAUDE_CODE_TEAM_NAME`| Name of the agent team this teammate belongs to. Set automatically on [agent team](</docs/en/agent-teams>) members `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 -`CLAUDE_CODE_USER_EMAIL`| Email address for the authenticated user. Used by SDK callers to provide account information synchronously. Requires `CLAUDE_CODE_ACCOUNT_UUID` and `CLAUDE_CODE_ORGANIZATION_UUID` to also be set `CLAUDE_CODE_USE_BEDROCK`| Use [Bedrock](</docs/en/amazon-bedrock>) `CLAUDE_CODE_USE_FOUNDRY`| Use [Microsoft Foundry](</docs/en/microsoft-foundry>) `CLAUDE_CODE_USE_POWERSHELL_TOOL`| Set to `1` to enable the PowerShell tool on Windows (opt-in preview). When enabled, Claude can run PowerShell commands natively instead of routing through Git Bash. Only supported on native Windows, not WSL. See [PowerShell tool](</docs/en/tools-reference#powershell-tool>) `CLAUDE_CODE_USE_VERTEX`| Use [Vertex](</docs/en/google-vertex-ai>) -`CLAUDE_CONFIG_DIR`| Customize where Claude Code stores its configuration and data files +`CLAUDE_CONFIG_DIR`| Override the configuration directory (default: `~/.claude`). All settings, credentials, session history, and plugins are stored under this path. Useful for running multiple accounts side by side: for example, `alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'` +`CLAUDE_ENABLE_STREAM_WATCHDOG`| Set to `1` to abort API response streams that stall with no data for 90 seconds. Useful in automated environments where a hung session would go unnoticed, or behind proxies that drop connections silently. Without this, a stalled stream can hang the session indefinitely since the request timeout only covers the initial connection. Configure the timeout with `CLAUDE_STREAM_IDLE_TIMEOUT_MS` `CLAUDE_ENV_FILE`| Path to a shell script that Claude Code sources before each Bash command. Use to persist virtualenv or conda activation across commands. Also populated dynamically by [SessionStart](</docs/en/hooks#persist-environment-variables>), [CwdChanged](</docs/en/hooks#cwdchanged>), and [FileChanged](</docs/en/hooks#filechanged>) hooks -`CLAUDE_STREAM_IDLE_TIMEOUT_MS`| Timeout in milliseconds before the streaming idle watchdog closes a stalled connection. Default: `90000` (90 seconds). Increase this value if long-running tools or slow networks cause premature timeout errors -`DISABLE_AUTOUPDATER`| Set to `1` to disable automatic updates. +`CLAUDE_STREAM_IDLE_TIMEOUT_MS`| Timeout in milliseconds before the streaming idle watchdog closes a stalled connection. Default: `90000` (90 seconds). Requires `CLAUDE_ENABLE_STREAM_WATCHDOG=1`. Increase this value if long-running tools or slow networks cause premature timeout errors +`DISABLE_AUTOUPDATER`| Set to `1` to disable automatic updates +`DISABLE_AUTO_COMPACT`| Set to `1` to disable automatic compaction when approaching the context limit. The manual `/compact` command remains available. Use when you want explicit control over when compaction occurs +`DISABLE_COMPACT`| Set to `1` to disable all compaction: both automatic compaction and the manual `/compact` command `DISABLE_COST_WARNINGS`| Set to `1` to disable cost warning messages +`DISABLE_DOCTOR_COMMAND`| Set to `1` to hide the `/doctor` command. Useful for managed deployments where users should not run installation diagnostics `DISABLE_ERROR_REPORTING`| Set to `1` to opt out of Sentry error reporting +`DISABLE_EXTRA_USAGE_COMMAND`| Set to `1` to hide the `/extra-usage` command that lets users purchase additional usage beyond rate limits `DISABLE_FEEDBACK_COMMAND`| Set to `1` to disable the `/feedback` command. The older name `DISABLE_BUG_COMMAND` is also accepted `DISABLE_INSTALLATION_CHECKS`| Set to `1` to disable installation warnings. Use only when manually managing the installation location, as this can mask issues with standard installations +`DISABLE_INSTALL_GITHUB_APP_COMMAND`| Set to `1` to hide the `/install-github-app` command. Already hidden when using third-party providers (Bedrock, Vertex, or Foundry) +`DISABLE_INTERLEAVED_THINKING`| Set to `1` to prevent sending the interleaved-thinking beta header. Useful when your LLM gateway or provider does not support [interleaved thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking#interleaved-thinking>) +`DISABLE_LOGIN_COMMAND`| Set to `1` to hide the `/login` command. Useful when authentication is handled externally via API keys or `apiKeyHelper` +`DISABLE_LOGOUT_COMMAND`| Set to `1` to hide the `/logout` command `DISABLE_PROMPT_CACHING`| Set to `1` to disable prompt caching for all models (takes precedence over per-model settings) `DISABLE_PROMPT_CACHING_HAIKU`| Set to `1` to disable prompt caching for Haiku models `DISABLE_PROMPT_CACHING_OPUS`| Set to `1` to disable prompt caching for Opus models `DISABLE_PROMPT_CACHING_SONNET`| Set to `1` to disable prompt caching for Sonnet models `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) +`DISABLE_UPGRADE_COMMAND`| Set to `1` to hide the `/upgrade` command `ENABLE_CLAUDEAI_MCP_SERVERS`| Set to `false` to disable [claude.ai MCP servers](</docs/en/mcp#use-mcp-servers-from-claude-ai>) in Claude Code. Enabled by default for logged-in users +`ENABLE_PROMPT_CACHING_1H_BEDROCK`| Set to `1` when using [Bedrock](</docs/en/amazon-bedrock>) to request a 1-hour prompt cache TTL instead of the default 5 minutes. Bedrock only `ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset: all MCP tools deferred by default, but loaded upfront when `ANTHROPIC_BASE_URL` points to a non-first-party host. Values: `true` (always defer including proxies), `auto` (threshold mode: load upfront if tools fit within 10% of context), `auto:N` (custom threshold, e.g., `auto:5` for 5%), `false` (load all upfront) -`FORCE_AUTOUPDATE_PLUGINS`| Set to `true` to force plugin auto-updates even when the main auto-updater is disabled via `DISABLE_AUTOUPDATER` +`FALLBACK_FOR_ALL_PRIMARY_MODELS`| Set to any non-empty value to trigger fallback to [`--fallback-model`](</docs/en/cli-reference#cli-flags>) after repeated overload errors on any primary model. By default, only Opus models trigger the fallback +`FORCE_AUTOUPDATE_PLUGINS`| Set to `1` to force plugin auto-updates even when the main auto-updater is disabled via `DISABLE_AUTOUPDATER` `HTTP_PROXY`| Specify HTTP proxy server for network connections `HTTPS_PROXY`| Specify HTTPS proxy server for network connections -`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 +`IS_DEMO`| Set to `1` to enable demo mode: hides your email and organization name from the header and `/status` output, and skips onboarding. Useful when streaming or recording a session `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) +`MAX_STRUCTURED_OUTPUT_RETRIES`| Number of times to retry when the model’s response fails validation against the [`--json-schema`](</docs/en/cli-reference#cli-flags>) in non-interactive mode (the `-p` flag). Defaults to 5 `MAX_THINKING_TOKENS`| Override the [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) token budget. The ceiling is the model’s [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>) minus one. Set to `0` to disable thinking entirely. On models with adaptive reasoning (Opus 4.6, Sonnet 4.6), the budget is ignored unless adaptive reasoning is disabled via `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` `MCP_CLIENT_SECRET`| OAuth client secret for MCP servers that require [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>). Avoids the interactive prompt when adding a server with `--client-secret` `MCP_OAUTH_CALLBACK_PORT`| Fixed port for the OAuth redirect callback, as an alternative to `--callback-port` when adding an MCP server with [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>) +`MCP_REMOTE_SERVER_CONNECTION_BATCH_SIZE`| Maximum number of remote MCP servers (HTTP/SSE) to connect in parallel during startup (default: 20) +`MCP_SERVER_CONNECTION_BATCH_SIZE`| Maximum number of local MCP servers (stdio) to connect in parallel during startup (default: 3) `MCP_TIMEOUT`| Timeout in milliseconds for MCP server startup `MCP_TOOL_TIMEOUT`| Timeout in milliseconds for MCP tool execution `NO_PROXY`| List of domains and IPs to which requests will be directly issued, bypassing proxy +`OTEL_LOG_TOOL_CONTENT`| Set to `1` to include tool input and output content in OpenTelemetry span events. Disabled by default to protect sensitive data. See [Monitoring](</docs/en/monitoring-usage>) +`OTEL_LOG_TOOL_DETAILS`| Set to `1` to include MCP server names and tool details in telemetry. Disabled by default to protect PII. See [Monitoring](</docs/en/monitoring-usage>) +`OTEL_LOG_USER_PROMPTS`| Set to `1` to include user prompt text in OpenTelemetry traces and logs. Disabled by default (prompts are redacted). See [Monitoring](</docs/en/monitoring-usage>) +`OTEL_METRICS_INCLUDE_ACCOUNT_UUID`| Set to `false` to exclude account UUID from metrics attributes (default: included). See [Monitoring](</docs/en/monitoring-usage>) +`OTEL_METRICS_INCLUDE_SESSION_ID`| Set to `false` to exclude session ID from metrics attributes (default: included). See [Monitoring](</docs/en/monitoring-usage>) +`OTEL_METRICS_INCLUDE_VERSION`| Set to `true` to include Claude Code version in metrics attributes (default: excluded). See [Monitoring](</docs/en/monitoring-usage>) `SLASH_COMMAND_TOOL_CHAR_BUDGET`| Override the character budget for skill metadata shown to the [Skill tool](</docs/en/skills#control-who-invokes-a-skill>). The budget scales dynamically at 1% of the context window, with a fallback of 8,000 characters. Legacy name kept for backwards compatibility +`TASK_MAX_OUTPUT_LENGTH`| Maximum number of characters in [subagent](</docs/en/sub-agents>) output before truncation (default: 32000, maximum: 160000). When truncated, the full output is saved to disk and the path is included in the truncated response `USE_BUILTIN_RIPGREP`| Set to `0` to use system-installed `rg` instead of `rg` included with Claude Code `VERTEX_REGION_CLAUDE_3_5_HAIKU`| Override region for Claude 3.5 Haiku when using Vertex AI +`VERTEX_REGION_CLAUDE_3_5_SONNET`| Override region for Claude 3.5 Sonnet when using Vertex AI `VERTEX_REGION_CLAUDE_3_7_SONNET`| Override region for Claude 3.7 Sonnet when using Vertex AI `VERTEX_REGION_CLAUDE_4_0_OPUS`| Override region for Claude 4.0 Opus when using Vertex AI `VERTEX_REGION_CLAUDE_4_0_SONNET`| Override region for Claude 4.0 Sonnet when using Vertex AI `VERTEX_REGION_CLAUDE_4_1_OPUS`| Override region for Claude 4.1 Opus when using Vertex AI +`VERTEX_REGION_CLAUDE_4_5_SONNET`| Override region for Claude Sonnet 4.5 when using Vertex AI +`VERTEX_REGION_CLAUDE_4_6_SONNET`| Override region for Claude Sonnet 4.6 when using Vertex AI +`VERTEX_REGION_CLAUDE_HAIKU_4_5`| Override region for Claude Haiku 4.5 when using Vertex AI + +Standard OpenTelemetry exporter variables (`OTEL_METRICS_EXPORTER`, `OTEL_LOGS_EXPORTER`, `OTEL_EXPORTER_OTLP_ENDPOINT`, `OTEL_EXPORTER_OTLP_PROTOCOL`, `OTEL_EXPORTER_OTLP_HEADERS`, `OTEL_METRIC_EXPORT_INTERVAL`, `OTEL_RESOURCE_ATTRIBUTES`, and signal-specific variants) are also supported. See [Monitoring](</docs/en/monitoring-usage>) for configuration details. ## @@ -133,3 +194,4 @@ * [Settings](</docs/en/settings>): configure environment variables in `settings.json` so they apply to every session * [CLI reference](</docs/en/cli-reference>): launch-time flags * [Network configuration](</docs/en/network-config>): proxy and TLS setup + * [Monitoring](</docs/en/monitoring-usage>): OpenTelemetry configuration
modified
--- a/env-vars.md +++ b/env-vars.md @@ -50,6 +50,7 @@ `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`| Set to `1` to strip Anthropic-specific `anthropic-beta` request headers and beta tool-schema fields (such as `defer_loading` and `eager_input_streaming`) from API requests. Use this when a proxy gateway rejects requests with errors like “Unexpected value(s) for the `anthropic-beta` header” or “Extra inputs are not permitted”. Standard fields (`name`, `description`, `input_schema`, `cache_control`) are preserved. `CLAUDE_CODE_DISABLE_FAST_MODE`| Set to `1` to disable [fast mode](</docs/en/fast-mode>) `CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY`| Set to `1` to disable the “How is Claude doing?” session quality surveys. Surveys are also disabled when `DISABLE_TELEMETRY` or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` is set. See [Session quality surveys](</docs/en/data-usage#session-quality-surveys>) +`CLAUDE_CODE_DISABLE_MOUSE`| Set to `1` to disable mouse tracking in [fullscreen rendering](</docs/en/fullscreen>). Keyboard scrolling with `PgUp` and `PgDn` still works. Use this to keep your terminal’s native copy-on-select behavior `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`| Equivalent of setting `DISABLE_AUTOUPDATER`, `DISABLE_FEEDBACK_COMMAND`, `DISABLE_ERROR_REPORTING`, and `DISABLE_TELEMETRY` `CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK`| Set to `1` to disable the non-streaming fallback when a streaming request fails mid-stream. Streaming errors propagate to the retry layer instead. Useful when a proxy or gateway causes the fallback to produce duplicate tool execution `CLAUDE_CODE_DISABLE_TERMINAL_TITLE`| Set to `1` to disable automatic terminal title updates based on conversation context @@ -63,12 +64,14 @@ `CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL`| Skip auto-installation of IDE extensions. Equivalent to setting [`autoInstallIdeExtension`](</docs/en/settings#global-config-settings>) to `false` `CLAUDE_CODE_MAX_OUTPUT_TOKENS`| Set the maximum number of output tokens for most requests. Defaults and caps vary by model; see [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>). Increasing this value reduces the effective context window available before [auto-compaction](</docs/en/costs#reduce-token-usage>) triggers. `CLAUDE_CODE_NEW_INIT`| Set to `true` to make `/init` run an interactive setup flow. The flow asks which files to generate, including CLAUDE.md, skills, and hooks, before exploring the codebase and writing them. Without this variable, `/init` generates a CLAUDE.md automatically without prompting. +`CLAUDE_CODE_NO_FLICKER`| Set to `1` to enable [fullscreen rendering](</docs/en/fullscreen>), a research preview that reduces flicker and keeps memory flat in long conversations `CLAUDE_CODE_ORGANIZATION_UUID`| Organization UUID for the authenticated user. Used by SDK callers to provide account information synchronously. Requires `CLAUDE_CODE_ACCOUNT_UUID` and `CLAUDE_CODE_USER_EMAIL` to also be set `CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS`| Interval for refreshing dynamic OpenTelemetry headers in milliseconds (default: 1740000 / 29 minutes). See [Dynamic headers](</docs/en/monitoring-usage#dynamic-headers>) `CLAUDE_CODE_PLAN_MODE_REQUIRED`| Auto-set to `true` on [agent team](</docs/en/agent-teams>) teammates that require plan approval. Read-only: set by Claude Code when spawning teammates. See [require plan approval](</docs/en/agent-teams#require-plan-approval-for-teammates>) `CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS`| Timeout in milliseconds for git operations when installing or updating plugins (default: 120000). Increase this value for large repositories or slow network connections. See [Git operations time out](</docs/en/plugin-marketplaces#git-operations-time-out>) `CLAUDE_CODE_PLUGIN_SEED_DIR`| Path to one or more read-only plugin seed directories, separated by `:` on Unix or `;` on Windows. Use this to bundle a pre-populated plugins directory into a container image. Claude Code registers marketplaces from these directories at startup and uses pre-cached plugins without re-cloning. See [Pre-populate plugins for containers](</docs/en/plugin-marketplaces#pre-populate-plugins-for-containers>) `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 +`CLAUDE_CODE_SCROLL_SPEED`| Set the mouse wheel scroll multiplier in [fullscreen rendering](</docs/en/fullscreen#adjust-wheel-scroll-speed>). Accepts values from 1 to 20. Set to `3` to match `vim` if your terminal sends one wheel event per notch without amplification `CLAUDE_CODE_SESSIONEND_HOOKS_TIMEOUT_MS`| Maximum time in milliseconds for [SessionEnd](</docs/en/hooks#sessionend>) hooks to complete (default: `1500`). Applies to session exit, `/clear`, and switching sessions via interactive `/resume`. Per-hook `timeout` values are also capped by this budget `CLAUDE_CODE_SHELL`| Override automatic shell detection. Useful when your login shell differs from your preferred working shell (for example, `bash` vs `zsh`) `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>`
modified
--- a/env-vars.md +++ b/env-vars.md @@ -72,7 +72,7 @@ `CLAUDE_CODE_SESSIONEND_HOOKS_TIMEOUT_MS`| Maximum time in milliseconds for [SessionEnd](</docs/en/hooks#sessionend>) hooks to complete (default: `1500`). Applies to session exit, `/clear`, and switching sessions via interactive `/resume`. Per-hook `timeout` values are also capped by this budget `CLAUDE_CODE_SHELL`| Override automatic shell detection. Useful when your login shell differs from your preferred working shell (for example, `bash` vs `zsh`) `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>` -`CLAUDE_CODE_SIMPLE`| Set to `1` to run with a minimal system prompt and only the Bash, file read, and file edit tools. Disables auto-discovery of hooks, skills, plugins, MCP servers, auto memory, and CLAUDE.md. The [`--bare`](</docs/en/headless#start-faster-with-bare-mode>) CLI flag sets this +`CLAUDE_CODE_SIMPLE`| Set to `1` to run with a minimal system prompt and only the Bash, file read, and file edit tools. MCP tools from `--mcp-config` are still available. Disables auto-discovery of hooks, skills, plugins, MCP servers, auto memory, and CLAUDE.md. The [`--bare`](</docs/en/headless#start-faster-with-bare-mode>) CLI flag sets this `CLAUDE_CODE_SKIP_BEDROCK_AUTH`| Skip AWS authentication for Bedrock (for example, when using an LLM gateway) `CLAUDE_CODE_SKIP_FAST_MODE_NETWORK_ERRORS`| Set to `1` to allow [fast mode](</docs/en/fast-mode>) when the organization status check fails due to a network error. Useful when a corporate proxy blocks the status endpoint. The API still enforces organization-level disable separately `CLAUDE_CODE_SKIP_FOUNDRY_AUTH`| Skip Azure authentication for Microsoft Foundry (for example, when using an LLM gateway) @@ -113,7 +113,7 @@ `MCP_TIMEOUT`| Timeout in milliseconds for MCP server startup `MCP_TOOL_TIMEOUT`| Timeout in milliseconds for MCP tool execution `NO_PROXY`| List of domains and IPs to which requests will be directly issued, bypassing proxy -`SLASH_COMMAND_TOOL_CHAR_BUDGET`| Override the character budget for skill metadata shown to the [Skill tool](</docs/en/skills#control-who-invokes-a-skill>). The budget scales dynamically at 2% of the context window, with a fallback of 16,000 characters. Legacy name kept for backwards compatibility +`SLASH_COMMAND_TOOL_CHAR_BUDGET`| Override the character budget for skill metadata shown to the [Skill tool](</docs/en/skills#control-who-invokes-a-skill>). The budget scales dynamically at 1% of the context window, with a fallback of 8,000 characters. Legacy name kept for backwards compatibility `USE_BUILTIN_RIPGREP`| Set to `0` to use system-installed `rg` instead of `rg` included with Claude Code `VERTEX_REGION_CLAUDE_3_5_HAIKU`| Override region for Claude 3.5 Haiku when using Vertex AI `VERTEX_REGION_CLAUDE_3_7_SONNET`| Override region for Claude 3.7 Sonnet when using Vertex AI
modified
--- a/env-vars.md +++ b/env-vars.md @@ -101,7 +101,7 @@ `DISABLE_PROMPT_CACHING_SONNET`| Set to `1` to disable prompt caching for Sonnet models `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) `ENABLE_CLAUDEAI_MCP_SERVERS`| Set to `false` to disable [claude.ai MCP servers](</docs/en/mcp#use-mcp-servers-from-claude-ai>) in Claude Code. Enabled by default for logged-in users -`ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset: enabled by default, but disabled when `ANTHROPIC_BASE_URL` points to a non-first-party host. Values: `true` (always on including proxies), `auto` (enables at 10% context), `auto:N` (custom threshold, e.g., `auto:5` for 5%), `false` (disabled) +`ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset: all MCP tools deferred by default, but loaded upfront when `ANTHROPIC_BASE_URL` points to a non-first-party host. Values: `true` (always defer including proxies), `auto` (threshold mode: load upfront if tools fit within 10% of context), `auto:N` (custom threshold, e.g., `auto:5` for 5%), `false` (load all upfront) `FORCE_AUTOUPDATE_PLUGINS`| Set to `true` to force plugin auto-updates even when the main auto-updater is disabled via `DISABLE_AUTOUPDATER` `HTTP_PROXY`| Specify HTTP proxy server for network connections `HTTPS_PROXY`| Specify HTTPS proxy server for network connections
modified
--- a/env-vars.md +++ b/env-vars.md @@ -89,6 +89,7 @@ `CLAUDE_CODE_USE_VERTEX`| Use [Vertex](</docs/en/google-vertex-ai>) `CLAUDE_CONFIG_DIR`| Customize where Claude Code stores its configuration and data files `CLAUDE_ENV_FILE`| Path to a shell script that Claude Code sources before each Bash command. Use to persist virtualenv or conda activation across commands. Also populated dynamically by [SessionStart](</docs/en/hooks#persist-environment-variables>), [CwdChanged](</docs/en/hooks#cwdchanged>), and [FileChanged](</docs/en/hooks#filechanged>) hooks +`CLAUDE_STREAM_IDLE_TIMEOUT_MS`| Timeout in milliseconds before the streaming idle watchdog closes a stalled connection. Default: `90000` (90 seconds). Increase this value if long-running tools or slow networks cause premature timeout errors `DISABLE_AUTOUPDATER`| Set to `1` to disable automatic updates. `DISABLE_COST_WARNINGS`| Set to `1` to disable cost warning messages `DISABLE_ERROR_REPORTING`| Set to `1` to opt out of Sentry error reporting @@ -99,7 +100,7 @@ `DISABLE_PROMPT_CACHING_OPUS`| Set to `1` to disable prompt caching for Opus models `DISABLE_PROMPT_CACHING_SONNET`| Set to `1` to disable prompt caching for Sonnet models `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) -`ENABLE_CLAUDEAI_MCP_SERVERS`| Set to `false` to disable [claude.ai MCP servers](</docs/en/mcp#use-mcp-servers-from-claudeai>) in Claude Code. Enabled by default for logged-in users +`ENABLE_CLAUDEAI_MCP_SERVERS`| Set to `false` to disable [claude.ai MCP servers](</docs/en/mcp#use-mcp-servers-from-claude-ai>) in Claude Code. Enabled by default for logged-in users `ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset: enabled by default, but disabled when `ANTHROPIC_BASE_URL` points to a non-first-party host. Values: `true` (always on including proxies), `auto` (enables at 10% context), `auto:N` (custom threshold, e.g., `auto:5` for 5%), `false` (disabled) `FORCE_AUTOUPDATE_PLUGINS`| Set to `true` to force plugin auto-updates even when the main auto-updater is disabled via `DISABLE_AUTOUPDATER` `HTTP_PROXY`| Specify HTTP proxy server for network connections
modified
--- a/env-vars.md +++ b/env-vars.md @@ -10,8 +10,17 @@ `ANTHROPIC_CUSTOM_MODEL_OPTION_DESCRIPTION`| Display description for the custom model entry in the `/model` picker. Defaults to `Custom model (<model-id>)` when not set `ANTHROPIC_CUSTOM_MODEL_OPTION_NAME`| Display name for the custom model entry in the `/model` picker. Defaults to the model ID when not set `ANTHROPIC_DEFAULT_HAIKU_MODEL`| See [Model configuration](</docs/en/model-config#environment-variables>) +`ANTHROPIC_DEFAULT_HAIKU_MODEL_DESCRIPTION`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) +`ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) +`ANTHROPIC_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) `ANTHROPIC_DEFAULT_OPUS_MODEL`| See [Model configuration](</docs/en/model-config#environment-variables>) +`ANTHROPIC_DEFAULT_OPUS_MODEL_DESCRIPTION`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) +`ANTHROPIC_DEFAULT_OPUS_MODEL_NAME`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) +`ANTHROPIC_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) `ANTHROPIC_DEFAULT_SONNET_MODEL`| See [Model configuration](</docs/en/model-config#environment-variables>) +`ANTHROPIC_DEFAULT_SONNET_MODEL_DESCRIPTION`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) +`ANTHROPIC_DEFAULT_SONNET_MODEL_NAME`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) +`ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES`| See [Model configuration](</docs/en/model-config#customize-pinned-model-display-and-capabilities>) `ANTHROPIC_FOUNDRY_API_KEY`| API key for Microsoft Foundry authentication (see [Microsoft Foundry](</docs/en/microsoft-foundry>)) `ANTHROPIC_FOUNDRY_BASE_URL`| Full base URL for the Foundry resource (for example, `https://my-resource.services.ai.azure.com/anthropic`). Alternative to `ANTHROPIC_FOUNDRY_RESOURCE` (see [Microsoft Foundry](</docs/en/microsoft-foundry>)) `ANTHROPIC_FOUNDRY_RESOURCE`| Foundry resource name (for example, `my-resource`). Required if `ANTHROPIC_FOUNDRY_BASE_URL` is not set (see [Microsoft Foundry](</docs/en/microsoft-foundry>)) @@ -42,6 +51,7 @@ `CLAUDE_CODE_DISABLE_FAST_MODE`| Set to `1` to disable [fast mode](</docs/en/fast-mode>) `CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY`| Set to `1` to disable the “How is Claude doing?” session quality surveys. Surveys are also disabled when `DISABLE_TELEMETRY` or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` is set. See [Session quality surveys](</docs/en/data-usage#session-quality-surveys>) `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`| Equivalent of setting `DISABLE_AUTOUPDATER`, `DISABLE_FEEDBACK_COMMAND`, `DISABLE_ERROR_REPORTING`, and `DISABLE_TELEMETRY` +`CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK`| Set to `1` to disable the non-streaming fallback when a streaming request fails mid-stream. Streaming errors propagate to the retry layer instead. Useful when a proxy or gateway causes the fallback to produce duplicate tool execution `CLAUDE_CODE_DISABLE_TERMINAL_TITLE`| Set to `1` to disable automatic terminal title updates based on conversation context `CLAUDE_CODE_EFFORT_LEVEL`| Set the effort level for supported models. Values: `low`, `medium`, `high`, `max` (Opus 4.6 only), or `auto` to use the model default. Takes precedence over `/effort` and the `effortLevel` setting. See [Adjust effort level](</docs/en/model-config#adjust-effort-level>) `CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION`| Set to `false` to disable prompt suggestions (the “Prompt suggestions” toggle in `/config`). These are the grayed-out predictions that appear in your prompt input after Claude responds. See [Prompt suggestions](</docs/en/interactive-mode#prompt-suggestions>) @@ -68,15 +78,17 @@ `CLAUDE_CODE_SKIP_FOUNDRY_AUTH`| Skip Azure authentication for Microsoft Foundry (for example, when using an LLM gateway) `CLAUDE_CODE_SKIP_VERTEX_AUTH`| Skip Google authentication for Vertex (for example, when using an LLM gateway) `CLAUDE_CODE_SUBAGENT_MODEL`| See [Model configuration](</docs/en/model-config>) +`CLAUDE_CODE_SUBPROCESS_ENV_SCRUB`| Set to `1` to strip Anthropic and cloud provider credentials from subprocess environments (Bash tool, hooks, MCP stdio servers). The parent Claude process keeps these credentials for API calls, but child processes cannot read them, reducing exposure to prompt injection attacks that attempt to exfiltrate secrets via shell expansion. `claude-code-action` sets this automatically when `allowed_non_write_users` is configured `CLAUDE_CODE_TASK_LIST_ID`| Share a task list across sessions. Set the same ID in multiple Claude Code instances to coordinate on a shared task list. See [Task list](</docs/en/interactive-mode#task-list>) `CLAUDE_CODE_TEAM_NAME`| Name of the agent team this teammate belongs to. Set automatically on [agent team](</docs/en/agent-teams>) members `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 `CLAUDE_CODE_USER_EMAIL`| Email address for the authenticated user. Used by SDK callers to provide account information synchronously. Requires `CLAUDE_CODE_ACCOUNT_UUID` and `CLAUDE_CODE_ORGANIZATION_UUID` to also be set `CLAUDE_CODE_USE_BEDROCK`| Use [Bedrock](</docs/en/amazon-bedrock>) `CLAUDE_CODE_USE_FOUNDRY`| Use [Microsoft Foundry](</docs/en/microsoft-foundry>) +`CLAUDE_CODE_USE_POWERSHELL_TOOL`| Set to `1` to enable the PowerShell tool on Windows (opt-in preview). When enabled, Claude can run PowerShell commands natively instead of routing through Git Bash. Only supported on native Windows, not WSL. See [PowerShell tool](</docs/en/tools-reference#powershell-tool>) `CLAUDE_CODE_USE_VERTEX`| Use [Vertex](</docs/en/google-vertex-ai>) `CLAUDE_CONFIG_DIR`| Customize where Claude Code stores its configuration and data files -`CLAUDE_ENV_FILE`| Path to a shell script that Claude Code sources before each Bash command. Use to persist virtualenv or conda activation across commands. Also populated dynamically by [SessionStart hooks](</docs/en/hooks#persist-environment-variables>) +`CLAUDE_ENV_FILE`| Path to a shell script that Claude Code sources before each Bash command. Use to persist virtualenv or conda activation across commands. Also populated dynamically by [SessionStart](</docs/en/hooks#persist-environment-variables>), [CwdChanged](</docs/en/hooks#cwdchanged>), and [FileChanged](</docs/en/hooks#filechanged>) hooks `DISABLE_AUTOUPDATER`| Set to `1` to disable automatic updates. `DISABLE_COST_WARNINGS`| Set to `1` to disable cost warning messages `DISABLE_ERROR_REPORTING`| Set to `1` to opt out of Sentry error reporting
added
Show diff (122 lines)
--- a/env-vars.md +++ b/env-vars.md @@ -0,0 +1,119 @@ +Claude Code supports the following environment variables to control its behavior. Set them in your shell before launching `claude`, or configure them in [`settings.json`](</docs/en/settings#available-settings>) under the `env` key to apply them to every session or roll them out across your team. + +Variable| Purpose +---|--- +`ANTHROPIC_API_KEY`| API key sent as `X-Api-Key` header. When set, this key is used instead of your Claude Pro, Max, Team, or Enterprise subscription even if you are logged in. In non-interactive mode (`-p`), the key is always used when present. In interactive mode, you are prompted to approve the key once before it overrides your subscription. To use your subscription instead, run `unset ANTHROPIC_API_KEY` +`ANTHROPIC_AUTH_TOKEN`| Custom value for the `Authorization` header (the value you set here will be prefixed with `Bearer `) +`ANTHROPIC_BASE_URL`| Override the API endpoint to route requests through a proxy or gateway. When set to a non-first-party host, [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) is disabled by default. Set `ENABLE_TOOL_SEARCH=true` if your proxy forwards `tool_reference` blocks +`ANTHROPIC_CUSTOM_HEADERS`| Custom headers to add to requests (`Name: Value` format, newline-separated for multiple headers) +`ANTHROPIC_CUSTOM_MODEL_OPTION`| Model ID to add as a custom entry in the `/model` picker. Use this to make a non-standard or gateway-specific model selectable without replacing built-in aliases. See [Model configuration](</docs/en/model-config#add-a-custom-model-option>) +`ANTHROPIC_CUSTOM_MODEL_OPTION_DESCRIPTION`| Display description for the custom model entry in the `/model` picker. Defaults to `Custom model (<model-id>)` when not set +`ANTHROPIC_CUSTOM_MODEL_OPTION_NAME`| Display name for the custom model entry in the `/model` picker. Defaults to the model ID when not set +`ANTHROPIC_DEFAULT_HAIKU_MODEL`| See [Model configuration](</docs/en/model-config#environment-variables>) +`ANTHROPIC_DEFAULT_OPUS_MODEL`| See [Model configuration](</docs/en/model-config#environment-variables>) +`ANTHROPIC_DEFAULT_SONNET_MODEL`| See [Model configuration](</docs/en/model-config#environment-variables>) +`ANTHROPIC_FOUNDRY_API_KEY`| API key for Microsoft Foundry authentication (see [Microsoft Foundry](</docs/en/microsoft-foundry>)) +`ANTHROPIC_FOUNDRY_BASE_URL`| Full base URL for the Foundry resource (for example, `https://my-resource.services.ai.azure.com/anthropic`). Alternative to `ANTHROPIC_FOUNDRY_RESOURCE` (see [Microsoft Foundry](</docs/en/microsoft-foundry>)) +`ANTHROPIC_FOUNDRY_RESOURCE`| Foundry resource name (for example, `my-resource`). Required if `ANTHROPIC_FOUNDRY_BASE_URL` is not set (see [Microsoft Foundry](</docs/en/microsoft-foundry>)) +`ANTHROPIC_MODEL`| Name of the model setting to use (see [Model Configuration](</docs/en/model-config#environment-variables>)) +`ANTHROPIC_SMALL_FAST_MODEL`| [DEPRECATED] Name of [Haiku-class model for background tasks](</docs/en/costs>) +`ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION`| Override AWS region for the Haiku-class model when using Bedrock +`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/>)) +`BASH_DEFAULT_TIMEOUT_MS`| Default timeout for long-running bash commands +`BASH_MAX_OUTPUT_LENGTH`| Maximum number of characters in bash outputs before they are middle-truncated +`BASH_MAX_TIMEOUT_MS`| Maximum timeout the model can set for long-running bash commands +`CLAUDECODE`| Set to `1` in shell environments Claude Code spawns (Bash tool, tmux sessions). Not set in [hooks](</docs/en/hooks>) or [status line](</docs/en/statusline>) commands. Use to detect when a script is running inside a shell spawned by Claude Code +`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](</docs/en/statusline>) +`CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR`| Return to the original working directory after each Bash command +`CLAUDE_CODE_ACCOUNT_UUID`| Account UUID for the authenticated user. Used by SDK callers to provide account information synchronously, avoiding a race condition where early telemetry events lack account metadata. Requires `CLAUDE_CODE_USER_EMAIL` and `CLAUDE_CODE_ORGANIZATION_UUID` to also be set +`CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD`| Set to `1` to load CLAUDE.md files from directories specified with `--add-dir`. By default, additional directories do not load memory files +`CLAUDE_CODE_AUTO_COMPACT_WINDOW`| Set the context capacity in tokens used for auto-compaction calculations. Defaults to the model’s context window: 200K for standard models or 1M for [extended context](</docs/en/model-config#extended-context>) models. Use a lower value like `500000` on a 1M model to treat the window as 500K for compaction purposes. The value is capped at the model’s actual context window. `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` is applied as a percentage of this value. Setting this variable decouples the compaction threshold from the status line’s `used_percentage`, which always uses the model’s full context window +`CLAUDE_CODE_API_KEY_HELPER_TTL_MS`| Interval in milliseconds at which credentials should be refreshed (when using [`apiKeyHelper`](</docs/en/settings#available-settings>)) +`CLAUDE_CODE_CLIENT_CERT`| Path to client certificate file for mTLS authentication +`CLAUDE_CODE_CLIENT_KEY`| Path to client private key file for mTLS authentication +`CLAUDE_CODE_CLIENT_KEY_PASSPHRASE`| Passphrase for encrypted CLAUDE_CODE_CLIENT_KEY (optional) +`CLAUDE_CODE_DISABLE_1M_CONTEXT`| Set to `1` to disable [1M context window](</docs/en/model-config#extended-context>) support. When set, 1M model variants are unavailable in the model picker. Useful for enterprise environments with compliance requirements +`CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING`| Set to `1` to disable [adaptive reasoning](</docs/en/model-config#adjust-effort-level>) for Opus 4.6 and Sonnet 4.6. When disabled, these models fall back to the fixed thinking budget controlled by `MAX_THINKING_TOKENS` +`CLAUDE_CODE_DISABLE_AUTO_MEMORY`| Set to `1` to disable [auto memory](</docs/en/memory#auto-memory>). Set to `0` to force auto memory on during the gradual rollout. When disabled, Claude does not create or load auto memory files +`CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS`| Set to `1` to remove built-in commit and PR workflow instructions and the git status snapshot from Claude’s system prompt. Useful when using your own git workflow skills. Takes precedence over the [`includeGitInstructions`](</docs/en/settings#available-settings>) setting when set +`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 +`CLAUDE_CODE_DISABLE_CRON`| Set to `1` to disable [scheduled tasks](</docs/en/scheduled-tasks>). The `/loop` skill and cron tools become unavailable and any already-scheduled tasks stop firing, including tasks that are already running mid-session +`CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS`| Set to `1` to strip Anthropic-specific `anthropic-beta` request headers and beta tool-schema fields (such as `defer_loading` and `eager_input_streaming`) from API requests. Use this when a proxy gateway rejects requests with errors like “Unexpected value(s) for the `anthropic-beta` header” or “Extra inputs are not permitted”. Standard fields (`name`, `description`, `input_schema`, `cache_control`) are preserved. +`CLAUDE_CODE_DISABLE_FAST_MODE`| Set to `1` to disable [fast mode](</docs/en/fast-mode>) +`CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY`| Set to `1` to disable the “How is Claude doing?” session quality surveys. Surveys are also disabled when `DISABLE_TELEMETRY` or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` is set. See [Session quality surveys](</docs/en/data-usage#session-quality-surveys>) +`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC`| Equivalent of setting `DISABLE_AUTOUPDATER`, `DISABLE_FEEDBACK_COMMAND`, `DISABLE_ERROR_REPORTING`, and `DISABLE_TELEMETRY` +`CLAUDE_CODE_DISABLE_TERMINAL_TITLE`| Set to `1` to disable automatic terminal title updates based on conversation context +`CLAUDE_CODE_EFFORT_LEVEL`| Set the effort level for supported models. Values: `low`, `medium`, `high`, `max` (Opus 4.6 only), or `auto` to use the model default. Takes precedence over `/effort` and the `effortLevel` setting. See [Adjust effort level](</docs/en/model-config#adjust-effort-level>) +`CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION`| Set to `false` to disable prompt suggestions (the “Prompt suggestions” toggle in `/config`). These are the grayed-out predictions that appear in your prompt input after Claude responds. See [Prompt suggestions](</docs/en/interactive-mode#prompt-suggestions>) +`CLAUDE_CODE_ENABLE_TASKS`| Set to `true` to enable the task tracking system in non-interactive mode (the `-p` flag). Tasks are on by default in interactive mode. See [Task list](</docs/en/interactive-mode#task-list>) +`CLAUDE_CODE_ENABLE_TELEMETRY`| Set to `1` to enable OpenTelemetry data collection for metrics and logging. Required before configuring OTel exporters. See [Monitoring](</docs/en/monitoring-usage>) +`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 +`CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS`| Set to `1` to enable [agent teams](</docs/en/agent-teams>). Agent teams are experimental and disabled by default +`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 +`CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL`| Skip auto-installation of IDE extensions. Equivalent to setting [`autoInstallIdeExtension`](</docs/en/settings#global-config-settings>) to `false` +`CLAUDE_CODE_MAX_OUTPUT_TOKENS`| Set the maximum number of output tokens for most requests. Defaults and caps vary by model; see [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>). Increasing this value reduces the effective context window available before [auto-compaction](</docs/en/costs#reduce-token-usage>) triggers. +`CLAUDE_CODE_NEW_INIT`| Set to `true` to make `/init` run an interactive setup flow. The flow asks which files to generate, including CLAUDE.md, skills, and hooks, before exploring the codebase and writing them. Without this variable, `/init` generates a CLAUDE.md automatically without prompting. +`CLAUDE_CODE_ORGANIZATION_UUID`| Organization UUID for the authenticated user. Used by SDK callers to provide account information synchronously. Requires `CLAUDE_CODE_ACCOUNT_UUID` and `CLAUDE_CODE_USER_EMAIL` to also be set +`CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS`| Interval for refreshing dynamic OpenTelemetry headers in milliseconds (default: 1740000 / 29 minutes). See [Dynamic headers](</docs/en/monitoring-usage#dynamic-headers>) +`CLAUDE_CODE_PLAN_MODE_REQUIRED`| Auto-set to `true` on [agent team](</docs/en/agent-teams>) teammates that require plan approval. Read-only: set by Claude Code when spawning teammates. See [require plan approval](</docs/en/agent-teams#require-plan-approval-for-teammates>) +`CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS`| Timeout in milliseconds for git operations when installing or updating plugins (default: 120000). Increase this value for large repositories or slow network connections. See [Git operations time out](</docs/en/plugin-marketplaces#git-operations-time-out>) +`CLAUDE_CODE_PLUGIN_SEED_DIR`| Path to one or more read-only plugin seed directories, separated by `:` on Unix or `;` on Windows. Use this to bundle a pre-populated plugins directory into a container image. Claude Code registers marketplaces from these directories at startup and uses pre-cached plugins without re-cloning. See [Pre-populate plugins for containers](</docs/en/plugin-marketplaces#pre-populate-plugins-for-containers>) +`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 +`CLAUDE_CODE_SESSIONEND_HOOKS_TIMEOUT_MS`| Maximum time in milliseconds for [SessionEnd](</docs/en/hooks#sessionend>) hooks to complete (default: `1500`). Applies to session exit, `/clear`, and switching sessions via interactive `/resume`. Per-hook `timeout` values are also capped by this budget +`CLAUDE_CODE_SHELL`| Override automatic shell detection. Useful when your login shell differs from your preferred working shell (for example, `bash` vs `zsh`) +`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>` +`CLAUDE_CODE_SIMPLE`| Set to `1` to run with a minimal system prompt and only the Bash, file read, and file edit tools. Disables auto-discovery of hooks, skills, plugins, MCP servers, auto memory, and CLAUDE.md. The [`--bare`](</docs/en/headless#start-faster-with-bare-mode>) CLI flag sets this +`CLAUDE_CODE_SKIP_BEDROCK_AUTH`| Skip AWS authentication for Bedrock (for example, when using an LLM gateway) +`CLAUDE_CODE_SKIP_FAST_MODE_NETWORK_ERRORS`| Set to `1` to allow [fast mode](</docs/en/fast-mode>) when the organization status check fails due to a network error. Useful when a corporate proxy blocks the status endpoint. The API still enforces organization-level disable separately +`CLAUDE_CODE_SKIP_FOUNDRY_AUTH`| Skip Azure authentication for Microsoft Foundry (for example, when using an LLM gateway) +`CLAUDE_CODE_SKIP_VERTEX_AUTH`| Skip Google authentication for Vertex (for example, when using an LLM gateway) +`CLAUDE_CODE_SUBAGENT_MODEL`| See [Model configuration](</docs/en/model-config>) +`CLAUDE_CODE_TASK_LIST_ID`| Share a task list across sessions. Set the same ID in multiple Claude Code instances to coordinate on a shared task list. See [Task list](</docs/en/interactive-mode#task-list>) +`CLAUDE_CODE_TEAM_NAME`| Name of the agent team this teammate belongs to. Set automatically on [agent team](</docs/en/agent-teams>) members +`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 +`CLAUDE_CODE_USER_EMAIL`| Email address for the authenticated user. Used by SDK callers to provide account information synchronously. Requires `CLAUDE_CODE_ACCOUNT_UUID` and `CLAUDE_CODE_ORGANIZATION_UUID` to also be set +`CLAUDE_CODE_USE_BEDROCK`| Use [Bedrock](</docs/en/amazon-bedrock>) +`CLAUDE_CODE_USE_FOUNDRY`| Use [Microsoft Foundry](</docs/en/microsoft-foundry>) +`CLAUDE_CODE_USE_VERTEX`| Use [Vertex](</docs/en/google-vertex-ai>) +`CLAUDE_CONFIG_DIR`| Customize where Claude Code stores its configuration and data files +`CLAUDE_ENV_FILE`| Path to a shell script that Claude Code sources before each Bash command. Use to persist virtualenv or conda activation across commands. Also populated dynamically by [SessionStart hooks](</docs/en/hooks#persist-environment-variables>) +`DISABLE_AUTOUPDATER`| Set to `1` to disable automatic updates. +`DISABLE_COST_WARNINGS`| Set to `1` to disable cost warning messages +`DISABLE_ERROR_REPORTING`| Set to `1` to opt out of Sentry error reporting +`DISABLE_FEEDBACK_COMMAND`| Set to `1` to disable the `/feedback` command. The older name `DISABLE_BUG_COMMAND` is also accepted +`DISABLE_INSTALLATION_CHECKS`| Set to `1` to disable installation warnings. Use only when manually managing the installation location, as this can mask issues with standard installations +`DISABLE_PROMPT_CACHING`| Set to `1` to disable prompt caching for all models (takes precedence over per-model settings) +`DISABLE_PROMPT_CACHING_HAIKU`| Set to `1` to disable prompt caching for Haiku models +`DISABLE_PROMPT_CACHING_OPUS`| Set to `1` to disable prompt caching for Opus models +`DISABLE_PROMPT_CACHING_SONNET`| Set to `1` to disable prompt caching for Sonnet models +`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) +`ENABLE_CLAUDEAI_MCP_SERVERS`| Set to `false` to disable [claude.ai MCP servers](</docs/en/mcp#use-mcp-servers-from-claudeai>) in Claude Code. Enabled by default for logged-in users +`ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset: enabled by default, but disabled when `ANTHROPIC_BASE_URL` points to a non-first-party host. Values: `true` (always on including proxies), `auto` (enables at 10% context), `auto:N` (custom threshold, e.g., `auto:5` for 5%), `false` (disabled) +`FORCE_AUTOUPDATE_PLUGINS`| Set to `true` to force plugin auto-updates even when the main auto-updater is disabled via `DISABLE_AUTOUPDATER` +`HTTP_PROXY`| Specify HTTP proxy server for network connections +`HTTPS_PROXY`| Specify HTTPS proxy server for network connections +`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 +`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) +`MAX_THINKING_TOKENS`| Override the [extended thinking](<https://platform.claude.com/docs/en/build-with-claude/extended-thinking>) token budget. The ceiling is the model’s [max output tokens](<https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison>) minus one. Set to `0` to disable thinking entirely. On models with adaptive reasoning (Opus 4.6, Sonnet 4.6), the budget is ignored unless adaptive reasoning is disabled via `CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING` +`MCP_CLIENT_SECRET`| OAuth client secret for MCP servers that require [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>). Avoids the interactive prompt when adding a server with `--client-secret` +`MCP_OAUTH_CALLBACK_PORT`| Fixed port for the OAuth redirect callback, as an alternative to `--callback-port` when adding an MCP server with [pre-configured credentials](</docs/en/mcp#use-pre-configured-oauth-credentials>) +`MCP_TIMEOUT`| Timeout in milliseconds for MCP server startup +`MCP_TOOL_TIMEOUT`| Timeout in milliseconds for MCP tool execution +`NO_PROXY`| List of domains and IPs to which requests will be directly issued, bypassing proxy +`SLASH_COMMAND_TOOL_CHAR_BUDGET`| Override the character budget for skill metadata shown to the [Skill tool](</docs/en/skills#control-who-invokes-a-skill>). The budget scales dynamically at 2% of the context window, with a fallback of 16,000 characters. Legacy name kept for backwards compatibility +`USE_BUILTIN_RIPGREP`| Set to `0` to use system-installed `rg` instead of `rg` included with Claude Code +`VERTEX_REGION_CLAUDE_3_5_HAIKU`| Override region for Claude 3.5 Haiku when using Vertex AI +`VERTEX_REGION_CLAUDE_3_7_SONNET`| Override region for Claude 3.7 Sonnet when using Vertex AI +`VERTEX_REGION_CLAUDE_4_0_OPUS`| Override region for Claude 4.0 Opus when using Vertex AI +`VERTEX_REGION_CLAUDE_4_0_SONNET`| Override region for Claude 4.0 Sonnet when using Vertex AI +`VERTEX_REGION_CLAUDE_4_1_OPUS`| Override region for Claude 4.1 Opus when using Vertex AI + +## + +​ + +See also + + * [Settings](</docs/en/settings>): configure environment variables in `settings.json` so they apply to every session + * [CLI reference](</docs/en/cli-reference>): launch-time flags + * [Network configuration](</docs/en/network-config>): proxy and TLS setup