Skip to content

Instantly share code, notes, and snippets.

@jedisct1
Created March 31, 2026 10:16
Show Gist options
  • Select an option

  • Save jedisct1/9627644cda1c3929affe9b1ce8eaf714 to your computer and use it in GitHub Desktop.

Select an option

Save jedisct1/9627644cda1c3929affe9b1ce8eaf714 to your computer and use it in GitHub Desktop.
Claude Code environment variables full list

Claude Code Environment Variables

Scope and methodology

This file documents environment variables visible in the checked-in source of this repository snapshot. It is not guaranteed to be exhaustive for the full product, because many imported files are not present here.

For each variable, this document gives:

  • the visible purpose in code
  • the rough subsystem it belongs to
  • whether it appears likely to be hidden from normal user documentation

Visibility legend

  • Documented/public-looking: likely intended for normal users or administrators
  • Advanced/likely underdocumented: visible and meaningful, but more operational than mainstream
  • Internal/hidden: appears intended for Anthropic-internal, testing, bridge/runtime, or diagnostic use
  • Unknown: name is visible, but this snapshot does not show enough behavior to classify confidently

High-confidence, user/admin-facing variables

Authentication and provider routing

  • ANTHROPIC_API_KEY — API key auth source; also shows up in auth-status output and managed env handling. Visibility: Documented/public-looking
  • ANTHROPIC_AUTH_TOKEN — auth token source used alongside other provider-managed auth vars. Visibility: Advanced/likely underdocumented
  • CLAUDE_CODE_OAUTH_TOKEN — OAuth token env source and GitHub Actions secret name. Visibility: Advanced/likely underdocumented
  • CLAUDE_CODE_OAUTH_REFRESH_TOKEN — lets auth login skip browser flow and exchange a refresh token directly in cli/handlers/auth.ts:138. Visibility: Advanced/likely underdocumented
  • CLAUDE_CODE_OAUTH_SCOPES — required companion to CLAUDE_CODE_OAUTH_REFRESH_TOKEN; scopes are space-separated. Visibility: Advanced/likely underdocumented
  • CLAUDE_CODE_USE_BEDROCK — switch provider routing to Bedrock. Visibility: Documented/public-looking
  • CLAUDE_CODE_USE_VERTEX — switch provider routing to Vertex. Visibility: Documented/public-looking
  • CLAUDE_CODE_USE_FOUNDRY — switch provider routing to Foundry. Visibility: Documented/public-looking
  • CLAUDE_CODE_SKIP_BEDROCK_AUTH — skip Bedrock auth helper path. Visibility: Advanced/likely underdocumented
  • CLAUDE_CODE_SKIP_VERTEX_AUTH — skip Vertex auth helper path. Visibility: Advanced/likely underdocumented
  • CLAUDE_CODE_SKIP_FOUNDRY_AUTH — skip Foundry auth helper path. Visibility: Advanced/likely underdocumented
  • ANTHROPIC_BASE_URL — override first-party API endpoint. Security-sensitive per utils/managedEnvConstants.ts:94. Visibility: Advanced/likely underdocumented
  • ANTHROPIC_BEDROCK_BASE_URL — Bedrock endpoint override. Visibility: Advanced/likely underdocumented
  • ANTHROPIC_VERTEX_BASE_URL — Vertex endpoint override. Visibility: Advanced/likely underdocumented
  • ANTHROPIC_FOUNDRY_BASE_URL — Foundry endpoint override. Visibility: Advanced/likely underdocumented
  • ANTHROPIC_FOUNDRY_RESOURCE — Foundry project/resource selector. Security-sensitive. Visibility: Advanced/likely underdocumented
  • ANTHROPIC_VERTEX_PROJECT_ID — Vertex project selection. Visibility: Advanced/likely underdocumented
  • AWS_BEARER_TOKEN_BEDROCK — Bedrock auth credential. Visibility: Advanced/likely underdocumented
  • ANTHROPIC_FOUNDRY_API_KEY — Foundry auth credential. Visibility: Advanced/likely underdocumented

Model and output configuration

  • ANTHROPIC_MODEL — default model override. Visibility: Documented/public-looking
  • CLAUDE_CODE_SUBAGENT_MODEL — override model for subagents/worker agents. Visibility: Advanced/likely underdocumented
  • CLAUDE_CODE_MAX_OUTPUT_TOKENS — maximum output tokens; validated in doctor UI and used in API code. Visibility: Advanced/likely underdocumented
  • MAX_THINKING_TOKENS — thinking budget control. Visibility: Advanced/likely underdocumented
  • CLAUDE_CODE_EFFORT_LEVEL — effort setting override used by /effort. Visibility: Advanced/likely underdocumented
  • MAX_STRUCTURED_OUTPUT_RETRIES — retry limit for structured output recovery in QueryEngine.ts:1011. Visibility: Advanced/likely underdocumented

Telemetry and traffic controls

  • CLAUDE_CODE_ENABLE_TELEMETRY — explicitly enable telemetry. Visibility: Documented/public-looking
  • DISABLE_TELEMETRY — disable telemetry. Visibility: Documented/public-looking
  • DISABLE_ERROR_REPORTING — disable error reporting. Visibility: Advanced/likely underdocumented
  • CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC — reduce nonessential traffic. Visibility: Advanced/likely underdocumented
  • OTEL_EXPORTER_OTLP_HEADERS and related OTEL_* header/protocol/export vars — OpenTelemetry transport/logging tuning; treated as safe but still advanced. Visibility: Advanced/likely underdocumented

Tooling and UX controls

  • ENABLE_TOOL_SEARCH — enables tool search support. Visibility: Advanced/likely underdocumented
  • CLAUDE_CODE_DISABLE_TERMINAL_TITLE — disable terminal title management. Visibility: Advanced/likely underdocumented
  • CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL — skip IDE auto-install flow. Visibility: Advanced/likely underdocumented
  • USE_BUILTIN_RIPGREP — prefer builtin ripgrep path. Visibility: Advanced/likely underdocumented
  • BASH_DEFAULT_TIMEOUT_MS, BASH_MAX_TIMEOUT_MS, BASH_MAX_OUTPUT_LENGTH — bash tool limits. Visibility: Advanced/likely underdocumented
  • MAX_MCP_OUTPUT_TOKENS, MCP_TIMEOUT, MCP_TOOL_TIMEOUT — MCP/tool execution limits. Visibility: Advanced/likely underdocumented

Command visibility toggles

  • DISABLE_COMPACT — disables /compact in commands/compact/index.ts:9. Visibility: Advanced/likely underdocumented
  • DISABLE_DOCTOR_COMMAND — disables /doctor in commands/doctor/index.ts:7. Visibility: Advanced/likely underdocumented
  • DISABLE_EXTRA_USAGE_COMMAND — disables extra-usage command. Visibility: Advanced/likely underdocumented
  • DISABLE_FEEDBACK_COMMAND — disables feedback UI/command. Visibility: Advanced/likely underdocumented
  • DISABLE_BUG_COMMAND — disables bug/feedback-related flows. Visibility: Advanced/likely underdocumented

Variables clearly tied to trust, setup, or session behavior

  • CLAUDE_CODE_REMOTE — marks CCR/remote runtime; used for memory sizing and transport behavior in entrypoints/cli.tsx:9, cli/print.ts:512, cli/transports/WebSocketTransport.ts:771. Visibility: Advanced/likely underdocumented
  • CLAUDE_CODE_SIMPLE — simplified tool mode; also one of the ablation-forced vars in entrypoints/cli.tsx:22. Visibility: Advanced/likely underdocumented
  • CLAUDE_CODE_DISABLE_THINKING — disables thinking behavior; referenced in ablation bootstrap. Visibility: Advanced/likely underdocumented
  • DISABLE_INTERLEAVED_THINKING — related thinking-mode toggle. Visibility: Advanced/likely underdocumented
  • DISABLE_AUTO_COMPACT — disables auto-compaction. Visibility: Advanced/likely underdocumented
  • CLAUDE_CODE_DISABLE_AUTO_MEMORY — disables automatic memory behavior. Visibility: Advanced/likely underdocumented
  • CLAUDE_CODE_DISABLE_BACKGROUND_TASKS — disables background task behavior. Visibility: Advanced/likely underdocumented
  • CLAUDE_CODE_SESSION_ID — session identifier env propagated to subprocesses in commands/clear/conversation.ts:205. Visibility: Internal/hidden
  • CLAUDE_CODE_EAGER_FLUSH — forces eager transcript/storage flushing in QueryEngine.ts:457. Visibility: Internal/hidden
  • CLAUDE_CODE_IS_COWORK — cowork-specific eager flush behavior in QueryEngine.ts:458. Visibility: Internal/hidden
  • CLAUDE_CODE_RESUME_INTERRUPTED_TURN — resume-related behavior in headless/print flow. Visibility: Advanced/likely underdocumented
  • ENABLE_SESSION_PERSISTENCE — gates session persistence handling in remote/CCR flow. Visibility: Internal/hidden

Remote/bridge/runtime variables that look internal

These mostly appear tied to specialized remote-control, bridge, or environment-runner systems.

  • CLAUDE_CODE_USE_CCR_V2 — switches to CCR v2 transport behavior in multiple transport files. Visibility: Internal/hidden
  • CLAUDE_CODE_POST_FOR_SESSION_INGRESS_V2 — changes session-ingress transport selection. Visibility: Internal/hidden
  • CLAUDE_CODE_CCR_MIRROR — enables mirror mode in bridge code. Visibility: Internal/hidden
  • CLAUDE_CODE_WORKER_EPOCH — worker epoch for CCR client state. Visibility: Internal/hidden
  • CLAUDE_CODE_ENVIRONMENT_KIND — environment runner kind, with bridge explicitly checked in cli/remoteIO.ts:96. Visibility: Internal/hidden
  • CLAUDE_CODE_ENVIRONMENT_RUNNER_VERSION — runner version reporting in cli/remoteIO.ts:66. Visibility: Internal/hidden
  • CLAUDE_CODE_SESSION_ACCESS_TOKEN — referenced in bridge comments as a sensitive worker/session token. Visibility: Internal/hidden
  • CLAUDE_BRIDGE_OAUTH_TOKEN — ant-only bridge auth token in bridge/bridgeConfig.ts:20. Visibility: Internal/hidden
  • CLAUDE_BRIDGE_BASE_URL — ant-only bridge base URL. Visibility: Internal/hidden
  • CLAUDE_BRIDGE_USE_CCR_V2 — bridge-side override for CCR v2 usage. Visibility: Internal/hidden
  • CLAUDE_BRIDGE_SESSION_INGRESS_URL — ant-only custom session ingress URL. Visibility: Internal/hidden

Plugin, background install, and prompt-suggestion variables

  • CLAUDE_CODE_SYNC_PLUGIN_INSTALL — enables sync plugin install path in cli/print.ts:1739 and affects setup prefetch behavior. Visibility: Internal/hidden
  • CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS — timeout for sync plugin install. Visibility: Internal/hidden
  • CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION — prompt suggestion toggle in headless/print flow. Visibility: Advanced/likely underdocumented
  • CLAUDE_CODE_PROACTIVE — enables proactive behavior if proactive module is present. Visibility: Internal/hidden
  • CLAUDE_CODE_STREAMLINED_OUTPUT — alternate streamlined output mode for stream-json. Visibility: Internal/hidden
  • CLAUDE_CODE_EXIT_AFTER_FIRST_RENDER — ant-only/debug render exit shortcut. Visibility: Internal/hidden

New-init, ablation, and debug/testing variables

  • CLAUDE_CODE_NEW_INIT — opt into new /init behavior in commands/init.ts:231. Visibility: Advanced/likely underdocumented
  • CLAUDE_CODE_ABLATION_BASELINE — bootstrap flag that auto-forces a package of simplification toggles in entrypoints/cli.tsx:21. Visibility: Internal/hidden
  • CLAUDE_CODE_VERIFY_PLAN — env-controlled loading of VerifyPlanExecutionTool in tools.ts:89. Visibility: Internal/hidden
  • OVERFLOW_TEST_TOOL is a feature flag, not an env var, but it behaves similarly at surface level; noted here to avoid confusion. Visibility: n/a

Swarm / teammate / agent variables

From utils/swarm/constants.ts and related code:

  • CLAUDE_CODE_TEAMMATE_COMMAND — override the executable used to spawn teammate instances. Visibility: Internal/hidden
  • CLAUDE_CODE_AGENT_COLOR — assigns a spawned teammate color. Visibility: Internal/hidden
  • CLAUDE_CODE_PLAN_MODE_REQUIRED — forces spawned teammates to require plan mode before implementation. Visibility: Internal/hidden
  • CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS — safe env var related to experimental agent-team support. Visibility: Internal/hidden

Host/provider management and admin-oriented variables

  • CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST — prevents settings-sourced routing vars from overriding a host-managed provider configuration in utils/managedEnvConstants.ts:5. Visibility: Internal/hidden
  • CLAUDE_CONFIG_DIR — visible in spawn-utils allowlists and likely controls config directory location. Visibility: Advanced/likely underdocumented
  • CLAUDE_PLUGIN_ROOT, CLAUDE_PLUGIN_DATA — plugin environment paths in plugin integration code. Visibility: Internal/hidden
  • CLAUDE_CODE_API_KEY_HELPER_TTL_MS — TTL for apiKeyHelper-derived auth. Visibility: Advanced/likely underdocumented
  • CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR — bash/project cwd behavior. Visibility: Advanced/likely underdocumented

Generic process or platform variables used by Claude Code

These are not Claude-specific, but Claude Code reads or sets them.

  • USER_TYPE — major internal/external surface gate throughout commands, tools, bridge, and debug behavior. Visibility: Internal/hidden
  • NODE_ENV — used in several code paths to change test behavior. Visibility: Documented/public-looking
  • NODE_OPTIONS — read for debugger detection and set in remote mode to raise heap size in entrypoints/cli.tsx:11. Visibility: Documented/public-looking
  • COREPACK_ENABLE_AUTO_PIN — forcibly set to 0 at startup to avoid Corepack auto-pinning in entrypoints/cli.tsx:5. Visibility: Internal/hidden
  • SAFEUSER and USER — read in commit/PR command logic. Visibility: Unknown
  • IS_DEMO — affects onboarding/setup visibility in interactiveHelpers.tsx:105 and other places. Visibility: Internal/hidden
  • IS_SANDBOX — used in security checks around bypass-permissions in setup.ts:406. Visibility: Internal/hidden
  • CLAUBBIT — bypasses trust dialog path in interactiveHelpers.tsx:131. Visibility: Internal/hidden

Variables implied by safe-env or managed-env lists

utils/managedEnvConstants.ts is especially important because it acts like a security policy file.

Variables treated as security-sensitive

The comments explicitly call out endpoint, proxy, and TLS variables as dangerous when set via remote managed settings, including:

  • ANTHROPIC_BASE_URL
  • ANTHROPIC_BEDROCK_BASE_URL
  • ANTHROPIC_FOUNDRY_BASE_URL
  • ANTHROPIC_VERTEX_BASE_URL
  • HTTP_PROXY, HTTPS_PROXY, NO_PROXY and lowercase forms
  • OTEL_EXPORTER_OTLP_ENDPOINT and related endpoint vars
  • NODE_TLS_REJECT_UNAUTHORIZED
  • NODE_EXTRA_CA_CERTS
  • auth and resource selectors like ANTHROPIC_API_KEY, ANTHROPIC_AUTH_TOKEN, AWS_BEARER_TOKEN_BEDROCK, ANTHROPIC_FOUNDRY_RESOURCE

These are not all directly consumed in the visible files, but the code explicitly treats them as sensitive to trust boundaries.

Are these hidden from documentation?

Broadly:

  • ANTHROPIC_API_KEY, provider-selection vars, and a few obvious UX toggles look public or semi-public
  • many routing, OAuth refresh, model-limit, and tool-tuning vars look real but probably underdocumented
  • bridge, CCR, teammate, ablation, verify-plan, worker, and ant-only vars are almost certainly internal/hidden
  • USER_TYPE is one of the most important hidden variables because it changes the entire product surface

Most interesting hidden variables

If you only care about the most non-obvious ones, these stand out:

  • USER_TYPE
  • CLAUDE_CODE_VERIFY_PLAN
  • CLAUDE_CODE_ABLATION_BASELINE
  • CLAUDE_CODE_USE_CCR_V2
  • CLAUDE_CODE_SESSION_ACCESS_TOKEN
  • CLAUDE_BRIDGE_*
  • CLAUDE_CODE_TEAMMATE_COMMAND
  • CLAUDE_CODE_PLAN_MODE_REQUIRED
  • CLAUDE_CODE_EAGER_FLUSH
  • CLAUDE_CODE_SYNC_PLUGIN_INSTALL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment