Skip to main content

Tools and Bash

These variables change how tools run. They set Bash time limits and output size, shell choice, search behavior, permission helpers, and the sandbox. Use them when long commands time out or when you need to limit what a tool can see.

This page lists 102 variables. BASH_DEFAULT_TIMEOUT_MS and BASH_MAX_OUTPUT_LENGTH are common. Switch rows take 1 or 0.

Example​

~/.claude/settings.json
{
"env": {
"BASH_DEFAULT_TIMEOUT_MS": "300000",
"BASH_MAX_OUTPUT_LENGTH": "60000"
}
}

A Bash call now waits up to five minutes before it times out.

Variables​

The table is sorted by name. See Environment Variables for what each column and badge means.

VariableStatusWhat it doesValues and defaultNotes
AUTOMODE_DECISION_LOGUndocumentedWhen the value is 1, Claude Code appends each auto mode decision to .automode_decisions.jsonl.Only the exact value 1 works. The log is skipped in one runtime modeAuto mode, all. Not set from project env before trust
BASH_DEFAULT_TIMEOUT_MSDocumentedSets the default timeout of a foreground Bash or PowerShell command.A number of milliseconds, 120000 by default. Positive number, default 120000. Invalid values fall back to the defaultAll sessions. Project env can set it before trust
BASH_MAX_OUTPUT_LENGTHDocumentedCaps the characters of Bash output that Claude reads back into the result.A number, 30000 by default. Integer, default 30000, max 150000. The bashOutputMaxChars setting wins when setAll sessions. Project env can set it before trust
BASH_MAX_TIMEOUT_MSDocumentedSets the highest timeout the model may ask for on a foreground Bash or PowerShell command.A number of milliseconds, 600000 by default. Positive number, default 600000. The ceiling is the larger of this and BASH_DEFAULT_TIMEOUT_MSAll sessions. Project env can set it before trust
CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIRDocumentedReturns to the project working directory after each Bash or PowerShell command in the main session.On or offMain session. Project env can set it before trust
CLAUDE_BG_SESSION_PERMISSION_RULESUndocumentedGives allow and deny permission rules and extra dirs to a background session as JSON.JSON text. Used only when CLAUDE_CODE_SESSION_KIND is bg. Scrubbed from child envBackground sessions. Not set from project env before trust
CLAUDE_CHROME_CLASSIFIER_FLOORUndocumentedForces the Chrome auto mode classifier floor on or off. It overrides a feature flag. No visible effect in a print-mode probe (Probes).On, off, or unset, false by default. Without it the flag decides, default false. Remote sessions read the flag in safe modeClaude in Chrome with auto mode. Not set from project env before trust
CLAUDE_CHROME_PERMISSION_MODEUndocumentedSets the permission mode of Claude in Chrome. No visible effect in a print-mode probe (Probes).Text. An unknown value logs a warning. Claude Code sets skip_all_permission_checks for the native host when permission checks are skippedClaude in Chrome. Not set from project env before trust
CLAUDE_CODE_ADOPT_UNDERIVABLE_PARKED_PERMISSIONUndocumentedLets a resumed session adopt a parked sidechain permission that it cannot re-derive. It then does not re-run the permission.On or off. Part of the parked permission settings. A log line names this var when it adopts onePrint and SDK mode with parked permissions. Not set from project env before trust
CLAUDE_CODE_AUTO_BACKGROUND_TIMEOUT_MSUndocumentedCaps the timeout of a Bash call that can auto-background in the main agent.A number of milliseconds. The cap is at least 2000. A missing or non-positive value is ignoredMain agent, Bash
CLAUDE_CODE_AUTO_MODE_ARTIFACT_CONSENT_RULEUndocumented GatedTurns the artifact consent rule of the auto mode classifier on or off.On by default. Env value wins. Else a feature flag set to true turns it offAuto mode, gated by a feature flag
CLAUDE_CODE_AUTO_MODE_CLASSIFY_ASK_USER_QUESTIONUndocumentedOverrides whether the auto mode classifier looks at AskUserQuestion calls.On by default. Env value, else the classifyAskUserQuestion server settingAuto mode
CLAUDE_CODE_AUTO_MODE_CLASSIFY_EDITSUndocumentedOverrides whether the auto mode classifier checks file edits.Env value, else a per-model server setting classifyEditsModelsAuto mode
CLAUDE_CODE_AUTO_MODE_COMPACT_THREAD_RULEUndocumented GatedPicks the compact or the original thread rule for the auto mode classifier in a bound Slack thread.Off by default. Env value, else a feature flag, default offAuto mode, gated by a feature flag
CLAUDE_CODE_AUTO_MODE_EDIT_REMOVALUndocumentedTurns on edit removal visibility in the auto mode classifier input.Off by default. Env value, else the server setting editRemovalVisibility, default offAuto mode
CLAUDE_CODE_AUTO_MODE_EDIT_REMOVAL_CAPUndocumentedSets the size cap for removed edit text in the auto mode classifier input.A number. Env value, else the server setting editRemovalCap, else 3000Auto mode
CLAUDE_CODE_AUTO_MODE_GIT_STATUS_LIMITUndocumentedSets a truncation limit for git status data in the auto mode classifier.A number. Env value, else the server setting gitStatusTruncationLimit, else 2000Auto mode
CLAUDE_CODE_AUTO_MODE_HEARTH_MEMBER_RELAY_ROWSUndocumented GatedTurns on rows for posts that a project member relayed in a bound thread, in the auto mode classifier input.Off by default. Env value, else a feature flag, default offAuto mode, gated by a feature flag
CLAUDE_CODE_AUTO_MODE_OUTCOME_CODESUndocumentedTurns on outcome code visibility in the auto mode classifier.Off by default. Env value, else the server setting outcomeVisibility, default offAuto mode
CLAUDE_CODE_AUTO_MODE_PRIOR_ASSISTANT_CONTEXTUndocumentedTurns on prior assistant context in the auto mode classifier input.Off by default. Env value, else the server setting priorAssistantContext, default offAuto mode
CLAUDE_CODE_AUTO_MODE_REPO_VISIBILITYUndocumentedTurns on a repository visibility lookup for the auto mode classifier.Off by default. Env value, else the server setting repoVisibility, default offAuto mode
CLAUDE_CODE_AUTO_MODE_SEGMENTED_TRANSCRIPTUndocumentedTurns on a segmented transcript for the auto mode classifier.Off by default. Env value, else the server setting segmentedTranscript, default off. Cached per sessionAuto mode
CLAUDE_CODE_AUTO_MODE_SERVERDocumentedControls whether the server reviews auto mode actions. Set to 0 to use the local classifier.On or off. Unset gives no user choice. Claude Code forwards it to child processesAuto mode
CLAUDE_CODE_AUTO_MODE_TIERUndocumentedAny value, even an empty one, switches the auto mode classifier to the strict tier. Claude Code forwards it to child processes.rawStr. Only presence countsAuto mode
CLAUDE_CODE_BASH_EDIT_DIFFDocumentedTurns the diff of files changed during a Bash command on or off.On, off, or unset. Wins over bashEditDiffEnabled. Without either, it is on in auto and bypassPermissions mode only if a further check passesBash tool
CLAUDE_CODE_BASH_OUTPUT_AUDIENCE_NOTEUndocumentedForces the bash_output_audience_note feature on or off for Bash results with text stdout.On, off, or unset. Unset leaves the choice to the rollout checkBash tool
CLAUDE_CODE_BASH_SANDBOX_SHOW_INDICATORUndocumentedShows the name SandboxedBash instead of Bash for commands that run in the sandbox.On or off, off by defaultBash tool, sandbox
CLAUDE_CODE_BUBBLEWRAPUndocumentedTells Claude Code that it runs inside a Bubblewrap sandbox. It also lets --dangerously-skip-permissions run as root.On or off. Part of the sandbox environment check. IS_SANDBOX=1 has the same effect on the root checkLinux sandbox
CLAUDE_CODE_DISABLE_ADVISOR_TOOLDocumentedTurns off the advisor tool and the /advisor command.On or off. Checked first in the advisor enable checkFirst-party and AWS platform. Project env can set it before trust
CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAPDocumentedStops Claude Code from ending background shells under critical memory pressure.On or off. The prompt says it works only from the launch environmentMacOS and Linux
CLAUDE_CODE_DISABLE_DANGEROUS_RM_TIMEOUTDocumentedTurns off the time limit on critical-path removal prompts.On or off. Forces a feature flag timeout config to disabledAll sessions
CLAUDE_CODE_DISABLE_INLINE_SHELL_RM_PROMPTDocumentedStops Claude Code from reading bash -c scripts for critical-path removal prompts.On or off. The check returns null at once when setAll sessions
CLAUDE_CODE_DISABLE_MOUNTED_DRIVE_RM_PROMPTUndocumentedTurns off the prompt for rm -r on a mounted drive, the folder that holds mounted drives, or a top-level file or folder of a drive. Since 2.1.304 these paths (such as /Volumes, /media, and WSL /mnt/c) get a prompt that permission rules cannot auto-allow.On or off. The program skips the check when it is setBash tool
CLAUDE_CODE_DISABLE_POWERSHELL_CMD_RM_DENYDocumentedTurns off the PowerShell check that denies rd, rmdir, del and erase on system paths.On or off. Without it a feature flag decidesPowerShell tool
CLAUDE_CODE_DISABLE_SUBSTITUTION_RM_PROMPTDocumentedTurns off the critical-path check for a recursive rm whose target is only command substitution output.On or off. Checked together with a feature flagBash tool
CLAUDE_CODE_DISABLE_WEB_FETCHDocumentedTurns off the WebFetch tool. WebSearch stays on.On or off. Docs: needs v2.1.285 or later. Also disables the web fetch agentAll sessions
CLAUDE_CODE_DISABLE_WINDOWS_SHELL_LAUNCHERDocumentedStarts PowerShell commands on Windows directly, not through the cmd.exe launcher.On or off. The launcher also depends on a flag and logs env_opt_out when this is setWindows PowerShell tool
CLAUDE_CODE_DONT_INHERIT_ENVUndocumentedStarts the shell snapshot and the spawn-env probe with an empty environment instead of the inherited one.On or off, off by defaultBash tool shell snapshot setup
CLAUDE_CODE_EMIT_TOOL_USE_SUMMARIESUndocumentedSets the emitToolUseSummaries gate that the query loop reads.On or off, off by default. Passed in the loop gates object next to fastModeEnabledQuery loop, all modes
CLAUDE_CODE_EXECPATHUndocumentedGives the shell snapshot function for claude the path of the running binary.Falls back to the computed install pathBash tool shell snapshot
CLAUDE_CODE_FILE_READ_MAX_OUTPUT_TOKENSDocumentedSets the token limit of a file read.A number. Whole number above 0. Else a built-in defaultRead tool
CLAUDE_CODE_FILE_READ_MAX_PDF_PAGES_PER_MESSAGEUndocumented GatedCaps the PDF pages that Read tool calls may use in one message.A number. Whole number of at least 1, plain digits. Active only when a flag enforces the limitRead tool with PDF files
CLAUDE_CODE_FILE_READ_MAX_PDF_PAGES_PER_TURNUndocumented GatedCaps the PDF pages that Read tool calls may use in one turn.A number. Whole number of at least 1, plain digits. Used only with the per-message cap and an enforcing flagRead tool with PDF files
CLAUDE_CODE_GIT_BASH_PATHDocumentedSets the path of the Git Bash executable on Windows.Text. Must exist and be named bash.exe, sh.exe, bash, or sh. Else warns and auto-detectsWindows
CLAUDE_CODE_GLOB_HIDDENDocumentedIncludes dotfiles in Glob results.true by default. Set false to exclude themGlob tool
CLAUDE_CODE_GLOB_NO_IGNOREDocumentedMakes Glob ignore .gitignore rules.true by default. Set false to respect .gitignoreGlob tool
CLAUDE_CODE_GLOB_TIMEOUT_SECONDSDocumentedSets the timeout of Glob file discovery in seconds.A number of seconds, 20 by default and 60 on WSL. Whole number of at least 1Glob tool
CLAUDE_CODE_INLINE_TOOLSUndocumented GatedTurns an inline tools mode on or off. Probe: Adds the beta inline-tools-2026-09-15 to anthropic-beta. See Probes.On, off, or unset. A false value always turns it off. Off in a CCR_SESSION_PROFILE sessionAll sessions
CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCYDocumentedCaps how many read-only tools and subagents run in parallel.A number, 10 by default. Whole number min 1All sessions
CLAUDE_CODE_MAX_TURNSDocumentedCaps the agentic turns when no --max-turns value is given.A number. An explicit option winsPrint and SDK modes
CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSIONDocumentedCaps WebSearch calls per session.A number, 200 by default. Whole number min 1, digits onlyAll sessions, WebSearch
CLAUDE_CODE_NANKEEN_KESTRELUndocumented GatedTurns on a Windows-only path by env. Nearby text is about the Windows sandbox group. No visible effect in a print-mode probe (Probes).On or off. Unset follows a feature flag. Always false outside WindowsWindows
CLAUDE_CODE_PERFORCE_MODEDocumentedTurns on Perforce write protection. Edit and Write fail with a p4 edit <file> hint when the file lacks the owner-write bit.On or off. Parsed as a bool. Also adds a Perforce note to the system contextAll file tools
CLAUDE_CODE_POLICY_HELPER_PS1_PATHUndocumented GatedNames the PowerShell script that a Windows policy helper runs. The helper script reads it with $env:.Text. Env var name built into a PowerShell command string. Assumed set by Claude Code for the childWindows with PowerShell
CLAUDE_CODE_POLICY_HELPER_PSMODULEPATHUndocumented GatedCarries the PSModulePath value for the Windows policy helper. The helper script copies it into $env:PSModulePath.Text. Env var name built into a PowerShell command string. Assumed set by Claude Code for the childWindows with PowerShell
CLAUDE_CODE_POWERSHELL_RESPECT_EXECUTION_POLICYDocumentedStops Claude Code from passing -ExecutionPolicy Bypass to PowerShell.On or off. The branch code was not shownWindows with PowerShell
CLAUDE_CODE_PWSH_PARSE_TIMEOUT_MSUndocumentedSets the timeout of the PowerShell command parse step.A number of milliseconds, 5000 by default. Whole number in ms above 0. The full wait adds up to 10000 ms morePowerShell tool
CLAUDE_CODE_QUESTION_EXTENDEDUndocumentedTurns on extended questions in AskUserQuestion. A host sets it from the askUserQuestion.extendedQuestions option.On or off. Read only for some entrypoints and remote sessionsSDK, remote, and selected entrypoints
CLAUDE_CODE_QUESTION_OPTIONAL_DESCRIPTIONSUndocumentedMakes option descriptions optional in AskUserQuestion. A host sets it from the askUserQuestion.optionalDescriptions option.On or off. Read only for some entrypoints and remote sessionsSDK, remote, and selected entrypoints
CLAUDE_CODE_QUESTION_PREVIEW_FORMATUndocumentedSets the preview format of AskUserQuestion. A host sets it from the askUserQuestion.previewFormat option.Text. Without it markdown is the default for most entrypoints. Not for sdk, desktop, local-agent, or remoteAll sessions
CLAUDE_CODE_REPORT_FINDINGSUndocumentedGates a findings report mode for review runs. It needs a matching tool in the options and no text or json output. No visible effect in a print-mode probe (Probes).On or offReview runs
CLAUDE_CODE_RESTRICTEDDocumentedStarts the session in restricted mode like --restricted.On or off. Other launch paths such as --desktop refuse to run under itAll sessions
CLAUDE_CODE_SANDBOX_LEAVE_DENIES_TO_SRT_WINUndocumentedOn Windows, stops Claude Code from adding its own deny rules and leaves them to srt-win. The error text warns the sandbox may then fail on a large profile.On or off. Set it in the launch environment because a settings file cannot set itWindows sandbox
CLAUDE_CODE_SANDBOX_LEAVE_PARENT_FOLDERS_ALONEUndocumentedOn Windows, stops Claude Code from giving parent folders an entry for the sandbox group. Related log text lists the folders it then skips.On or off. Only the string use was seen. The exact branch was not readWindows sandbox
⚠️ CLAUDE_CODE_SANDBOXEDUndocumentedMarks the process as already inside a sandbox. Claude Code then counts the folder as trusted and skips the trust gates.On or off. Makes the trust check pass and the permission-gate check pass. Also picks the sandbox-time settings pathAll sessions. Set by a host or container
CLAUDE_CODE_SCRIPT_CAPSDocumentedLimits how many times named scripts may run per session. It reads a JSON object of substring keys and number limits.JSON text. JSON object. Bad JSON, an array, or no valid entries turn the caps offBash tool. Docs tie it to CLAUDE_CODE_SUBPROCESS_ENV_SCRUB
CLAUDE_CODE_SETTLE_TOUCHED_FILESUndocumented GatedTurns on the settle step for touched files after a turn. It needs a feature flag off and a remote or specific build check true.On or off. Works as an alternative to a feature flag. A second a feature flag adds a stepTurn end in file-reading sessions. gated by a feature flag
CLAUDE_CODE_SHELLDocumentedSets the shell for Bash tool commands. It accepts a path to bash or zsh. An invalid path falls back to detection.Text. The path must contain bash or zsh and run. Else Claude Code logs a message and detects a shell from SHELL and PATHBash tool
CLAUDE_CODE_SHELL_LAUNCHER_SCRIPTUndocumentedPasses a launcher script to a PowerShell shell. The wrapper reads it, clears the variable, and runs it with Invoke-Expression.Text. Set by Claude Code for the PowerShell child. The wrapper sets it to $null before runningPowerShell tool. Set by Claude Code
CLAUDE_CODE_SHELL_PREFIXDocumentedWraps shell commands that Claude Code starts with a prefix program. Hooks, Bash, status line, and stdio MCP starts use it.Text. The command is passed to the wrapper as one quoted argument. PowerShell and exec-form hooks skip itBash tool, hooks, status line, MCP stdio
CLAUDE_CODE_STRICT_INLINE_SHELL_RM_PROMPTUndocumented GatedRestores the strict rm permission prompt for inline shell -c scripts that build rm at run time.On or off, on by default. Without it a feature flag (default true) picks the relaxed rule. The changelog names this variableBash tool permissions
CLAUDE_CODE_SUBPROCESS_ENV_SCRUBDocumented DiffersStrips credentials from the env of subprocesses such as Bash, hooks, and stdio MCP servers.On, off, or unset. The default depends on the host (see Notes). 1 turns it on and 0 turns it offBash, hooks, MCP stdio. Docs omit the GitHub Actions and local-agent defaults
CLAUDE_CODE_TOOL_MEMORY_CGROUP_EXCLUDEDocumentedLists process kinds that the tool memory cap leaves out. mcp is added unless another rule applies.A comma-separated list. Without it, a feature flag or a built-in set appliesLinux and WSL
CLAUDE_CODE_TOOL_MEMORY_LIMITDocumented DiffersCaps memory for tool commands with a cgroup. Docs list 0 and off to turn it off. Code also accepts none.Text. When unset, a feature flag decides, which docs do not sayLinux and WSL
CLAUDE_CODE_USE_NATIVE_FILE_SEARCHDocumentedFinds commands, subagents, and output styles with Node file APIs and not ripgrep. Docs only. The read site was not re-checked.On or off. Set 1 to enableAll sessions
CLAUDE_CODE_USE_POWERSHELL_TOOLDocumentedTurns the PowerShell tool on or off. On Windows without Git Bash it is on. With Git Bash the feature flag decides when unset.On, off, or unset. Non-Windows needs 1. Windows takes 0 or 1Windows, Linux, macOS, WSL
CLAUDE_CODE_WEB_SEARCH_FAST_ARGUndocumented GatedTurns on a fast WebSearch mode with its own description and hint. Env wins over a feature flag.On, off, or unset. Needs an extra model check to passAll sessions
CLAUDE_CODE_WEB_SEARCH_REFILLS_PER_HOURDocumentedSets how fast the session WebSearch limit refills, in calls per hour.100 by default. Plain digits. Unset gives 0 when non-interactive, else a feature flag with default 100All sessions
CLAUDE_CODE_WEBFETCH_CACHE_TTL_MSDocumentedSets how long WebFetch keeps a fetched URL in cache.A number of milliseconds, 900000 by default. Plain digits, at least 1. Read once per launchAll sessions
CLAUDE_CODE_WEBFETCH_DEADLINE_MSDocumentedSets the upper bound on how long WebFetch waits for a download.A number of milliseconds, 300000 by default. Plain digits, 0 or more. Env value has an upper capAll sessions
CLAUDE_CODE_WEBSEARCH_CITATIONSUndocumentedChanges the WebSearch tool prompt so it does not ask for a Sources: list. It also gates a citations code path.On or off. The second path needs two more checksAll sessions
CLAUDE_ENV_FILEDocumentedNames a shell script that runs before each Bash command in the same shell.Text. Read and trimmed. Hooks for SessionStart, Setup, CwdChanged, and FileChanged get a path set by Claude CodeBash tool and hooks
CLAUDE_PIDDocumentedHolds the process ID of Claude Code. Child commands use it to find the parent process.--
CLAUDECODEDocumentedMarks a process as running inside Claude Code. Claude Code also reads it to detect a child session and to skip prompt history.On or off. Set to 1 by Claude Code for shell snapshots, hook and tool subprocesses, and stdio MCP serversAll sessions
ENABLE_TOOL_SEARCHDocumentedSets MCP tool search mode. Unset defers tools, including behind a custom ANTHROPIC_BASE_URL since 2.1.304. If the gateway answers 400 or 422, Claude Code retries without tool search.Text. true defer, false upfront, auto or auto:N use a percent threshold. 0 and 100 map to defer and upfrontAll sessions. Project env can set it before trust
GCM_INTERACTIVEDocumentedClaude Code sets a default for git child processes so Git Credential Manager does not prompt.Set by Claude Code when unset in the child env. The default value comes from a table that was not readGit child processes
GIT_ASKPASSDocumentedClaude Code passes the user value to git child processes. It falls back to a default and then to an empty string.Text. If unset, SSH_ASKPASS is handed on in its place in one path. Claude Code also sets itGit child processes. Not set from project env before trust
GIT_CONFIG_COUNTDocumentedClaude Code reads the count and appends its own GIT_CONFIG_KEY_n and GIT_CONFIG_VALUE_n pairs for git child processes.A number. Parsed as a plain integer string. Also set by Claude Code in a child envGit child processes. Not set from project env before trust
GIT_CONFIG_GLOBALUndocumentedPath of the global git config. Claude Code reads it to find governed git config and sets it in scrubbed child envs.Set by Claude Code to /dev/null or a sandbox path in some child envsGit child processes. Not set from project env before trust
GIT_CONFIG_NOSYSTEMUndocumentedClaude Code sets it to 1 in scrubbed and sandbox child envs so git skips the system config.Set by Claude Code. No direct read of the user value was seenGit child processes. Not set from project env before trust
GIT_SSH_COMMANDDocumentedClaude Code uses it, or ssh, as the base of the SSH command for its git calls, and adds -o BatchMode=yes and a connect timeout.Text. Output is set by Claude Code in the child env. Timeout is 30 in one path and shorter in anotherGit clone and fetch. Not set from project env before trust
GIT_TERMINAL_PROMPTDocumentedClaude Code sets it to 0 for git child processes so git never prompts on the terminal.Set by Claude Code when unset in the child env. In one path the user value is keptGit child processes. Not set from project env before trust
IS_SANDBOXUndocumentedTells Claude Code that it runs in a deliberate sandbox, so root is allowed with --dangerously-skip-permissions.--
JAVA_TOOL_OPTIONSUndocumentedIn the sandbox, Claude Code appends -Dhttps.proxyHost settings to it so Java tools use the sandbox proxy.--
LINESDocumentedSet by Claude Code for hook commands to the terminal row count.--
LOCALAPPDATADocumented GatedUsed on Windows to find the WindowsApps alias folder and for path checks.--
NoDefaultCurrentDirectoryInExePathUndocumentedSet by Claude Code to 1 at startup so executable search skips the current directory.--
SHELLDocumentedNames the user shell. Claude Code uses it to find tools, to describe the shell in the prompt, and to run login-shell probes.Text. Non-empty string. Falls back to /bin/zsh for one probe and to unknown in the prompt textAll sessions, Windows sets it itself
SUDO_GIDUndocumented GatedGroup id of the user who ran sudo. Claude Code uses it with SUDO_UID and SUDO_USER to find the real user when it runs as root.A number. Integer, digits only, min 0. Used only when the process uid is 0Linux and macOS as root
SUDO_UIDUndocumented GatedUser id of the user who ran sudo. Claude Code uses it to decide who owns files and git repos when it runs as root.A number. Integer, digits only, min 0. Used only when the process runs as rootLinux and macOS as root
SUDO_USERUndocumented GatedName of the user who ran sudo. Claude Code checks it against the system and uses it as the real owner when it runs as root.Text. Non-empty string that must match a safe name pattern. Used only as rootLinux and macOS as root
USE_BUILTIN_RIPGREPDocumentedSet to 0 to use the system rg instead of the bundled one.On or off. Project settings may set it before trust (allowlist true)All sessions. Project env can set it before trust

How It Works​

The Bash tool starts a shell for each command. Many variables here are read when the command starts. Some variables also pass into the child shell, so a tool you run sees them too. CLAUDE_CODE_SUBPROCESS_ENV_SCRUB strips credentials from the environment of subprocesses such as Bash, hooks, and stdio MCP servers.

Source: the program (variable names found in the 2.1.304 binary) and the Environment Variables page of the official docs.