Skip to content

Instantly share code, notes, and snippets.

@unkn0wncode
Last active February 28, 2026 15:27
Show Gist options
  • Select an option

  • Save unkn0wncode/f87295d055dd0f0e8082358a0b5cc467 to your computer and use it in GitHub Desktop.

Select an option

Save unkn0wncode/f87295d055dd0f0e8082358a0b5cc467 to your computer and use it in GitHub Desktop.
# Claude Code CLI Environment Variables
# This file lists all environment variables used in v2.1.63 with explanations
## Anthropic API & Authentication
ANTHROPIC_API_KEY - Primary API key for Anthropic's Claude API. Used as fallback when no OAuth token is configured.
ANTHROPIC_AUTH_TOKEN - Alternative bearer token for Anthropic services. Takes priority over ANTHROPIC_API_KEY for authorization headers.
ANTHROPIC_BASE_URL - Custom base URL for Anthropic API endpoints. Overrides the default api.anthropic.com endpoint.
ANTHROPIC_CUSTOM_HEADERS - Custom HTTP headers for API requests. Newline-separated Key: Value pairs.
ANTHROPIC_BETAS - Comma-separated list of beta feature headers to include in API requests. Appended to internal beta flags.
ANTHROPIC_LOG - Anthropic SDK internal logging level (from the SDK itself, not Claude Code).
API_TIMEOUT_MS - API request timeout in milliseconds. Default: 600000 (10 minutes). Shown in timeout error messages with suggestion to increase.
## Model Configuration
ANTHROPIC_MODEL - Override the default Claude model. Can be set via CLI flag, env var, or settings file. Checked against known model IDs.
ANTHROPIC_SMALL_FAST_MODEL - Override the small/fast model used for quick operations (e.g., compaction, summarization). Defaults to Haiku.
ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION - Specific AWS region for the small fast model when using Bedrock. Falls back to the general Bedrock region.
ANTHROPIC_DEFAULT_HAIKU_MODEL - Override the default Haiku model ID. Used for non-first-party providers. Falls back to haiku-4.5.
ANTHROPIC_DEFAULT_SONNET_MODEL - Override the default Sonnet model ID. First-party defaults to sonnet-4.6, third-party to sonnet-4.5.
ANTHROPIC_DEFAULT_OPUS_MODEL - Override the default Opus model ID. First-party defaults to opus-4.6, third-party to opus-4.1.
CLAUDE_CODE_SUBAGENT_MODEL - Force a specific model for all sub-agent/teammate operations. Overrides normal model selection logic.
CLAUDE_CODE_MAX_OUTPUT_TOKENS - Maximum output tokens for responses. Validated against a per-model upper limit.
MAX_THINKING_TOKENS - Maximum tokens for extended thinking. Parsed as int; if > 0, enables thinking with a fixed budget.
CLAUDE_CODE_EFFORT_LEVEL - Set reasoning effort level. Accepted values: "low", "medium", "high" (default: "high").
## Provider: AWS Bedrock
CLAUDE_CODE_USE_BEDROCK - Boolean. Route all API calls through AWS Bedrock instead of direct Anthropic API.
CLAUDE_CODE_SKIP_BEDROCK_AUTH - Boolean. Skip AWS authentication for Bedrock (uses empty credentials).
BEDROCK_BASE_URL - Custom base URL for AWS Bedrock API endpoint.
ANTHROPIC_BEDROCK_BASE_URL - Alternative custom endpoint for Bedrock. Passed as endpoint to the Bedrock client.
AWS_ACCESS_KEY_ID - AWS access key for Bedrock authentication.
AWS_SECRET_ACCESS_KEY - AWS secret key for Bedrock authentication.
AWS_SESSION_TOKEN - AWS session token for temporary credentials.
AWS_REGION - AWS region for Bedrock service calls.
AWS_DEFAULT_REGION - Fallback AWS region.
AWS_PROFILE - AWS profile name for credential selection from ~/.aws/credentials.
AWS_BEARER_TOKEN_BEDROCK - Bearer token for Bedrock authentication.
AWS_EXECUTION_ENV - AWS execution environment identifier (e.g., Lambda).
AWS_LAMBDA_FUNCTION_NAME - Lambda function name. Used for environment detection.
AWS_LAMBDA_BENCHMARK_MODE - Enables Lambda benchmark mode for performance testing.
AWS_LOGIN_CACHE_DIRECTORY - Custom directory for caching AWS login credentials.
ENABLE_PROMPT_CACHING_1H_BEDROCK - Boolean. Enable 1-hour prompt caching on Bedrock (normally shorter).
## Provider: Google Vertex AI
CLAUDE_CODE_USE_VERTEX - Boolean. Route all API calls through Google Vertex AI.
CLAUDE_CODE_SKIP_VERTEX_AUTH - Boolean. Skip GCP authentication for Vertex AI.
VERTEX_BASE_URL - Custom base URL for Vertex AI API.
ANTHROPIC_VERTEX_PROJECT_ID - Google Cloud project ID for Vertex AI.
CLOUD_ML_REGION - Google Cloud ML region for Vertex AI. Falls back with other GCP project env vars.
GOOGLE_APPLICATION_CREDENTIALS - Path to GCP service account JSON credentials file.
GOOGLE_CLOUD_PROJECT - Google Cloud project identifier.
GOOGLE_CLOUD_QUOTA_PROJECT - Google Cloud quota/billing project.
GCLOUD_PROJECT - Alternative GCP project identifier.
## Provider: Microsoft Foundry
CLAUDE_CODE_USE_FOUNDRY - Boolean. Route all API calls through Microsoft Azure Foundry.
CLAUDE_CODE_SKIP_FOUNDRY_AUTH - Boolean. Skip Azure authentication for Foundry (provides empty token getter).
ANTHROPIC_FOUNDRY_API_KEY - API key for Foundry. If absent, falls back to Azure DefaultAzureCredential.
ANTHROPIC_FOUNDRY_BASE_URL - Custom base URL for Microsoft Foundry. Displayed as "Microsoft Foundry base URL" in auth status.
ANTHROPIC_FOUNDRY_RESOURCE - Microsoft Foundry resource name. Displayed as "Microsoft Foundry resource" in auth status.
## OAuth & Login
CLAUDE_CODE_OAUTH_TOKEN - Pre-configured OAuth access token. Checked as auth source with label "CLAUDE_CODE_OAUTH_TOKEN".
CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR - File descriptor number to read OAuth token from (for secure token passing). Must be a valid integer.
CLAUDE_CODE_OAUTH_REFRESH_TOKEN - OAuth refresh token for automatic token renewal. Requires CLAUDE_CODE_OAUTH_SCOPES to be set.
CLAUDE_CODE_OAUTH_SCOPES - Required OAuth scopes when using CLAUDE_CODE_OAUTH_REFRESH_TOKEN.
CLAUDE_CODE_OAUTH_CLIENT_ID - Custom OAuth client ID. Overrides the built-in client ID in OAuth config.
CLAUDE_CODE_CUSTOM_OAUTH_URL - Custom OAuth server URL. Must be in an approved endpoints list or it throws. Affects OAuth file suffix.
CLAUDE_CODE_API_KEY_FILE_DESCRIPTOR - File descriptor number to read API key from. Must be a valid integer.
CLAUDE_CODE_API_KEY_HELPER_TTL_MS - Cache TTL in ms for the API key helper. Parsed as int; must be >= 0.
CLAUDE_CODE_SESSION_ACCESS_TOKEN - Session-scoped access token. Set dynamically during auth flows.
CLAUDE_CODE_WEBSOCKET_AUTH_FILE_DESCRIPTOR - File descriptor for WebSocket authentication credentials.
USE_LOCAL_OAUTH - Boolean. Use local OAuth flow instead of production.
USE_STAGING_OAUTH - Boolean. Use staging OAuth server.
MCP_CLIENT_SECRET - Client secret for MCP OAuth authentication.
MCP_OAUTH_CALLBACK_PORT - Port for OAuth callback server in MCP authentication. Default: falls back to random port.
## Claude Code Core
CLAUDE_CONFIG_DIR - Custom directory for Claude Code config files. Default: ~/.claude. Affects config, debug logs, and OAuth file paths.
CLAUDE_CODE_TMPDIR - Temp directory for Claude Code operations (screenshots, sandbox, etc.). Default: /tmp on Unix, os.tmpdir() on Windows.
CLAUDE_TMPDIR - Alternative temp directory path. Fallback for CLAUDE_CODE_TMPDIR.
CLAUDE_CODE_ENTRYPOINT - Application entrypoint identifier. Set automatically based on context: "cli", "sdk-ts", "sdk-py", "sdk-cli", "mcp", "remote", "claude-code-github-action", etc. Used in user-agent and attribution headers.
CLAUDE_CODE_SHELL - Override the shell used for Bash tool execution. Must be bash or zsh and must be a valid executable. Falls back to auto-detection.
CLAUDE_CODE_SHELL_PREFIX - Prefix command for shell execution. When set, wraps all shell commands. Also used as the command for MCP stdio servers.
CLAUDE_CODE_ACTION - Boolean. Indicates running as a GitHub Action. Sets entrypoint to "claude-code-github-action".
CLAUDE_CODE_SIMPLE - Boolean. Simplified mode — disables CLAUDE.md loading, attachments, and various UI features.
CLAUDE_CODE_EXTRA_BODY - Additional JSON to merge into API request bodies. Must be a JSON object (not array).
CLAUDE_CODE_BASE_REF - Git base ref for diff operations. Falls back to auto-detected default branch.
CLAUDE_CODE_TAGS - Custom tags string attached to telemetry/analytics events.
CLAUDE_CODE_CONTAINER_ID - Container/pod identifier. Sent as x-claude-remote-container-id header.
CLAUDE_CODE_ACCOUNT_UUID - Pre-configured account UUID for auth bypass. Used with USER_EMAIL and ORGANIZATION_UUID.
CLAUDE_CODE_USER_EMAIL - Pre-configured user email for auth bypass.
CLAUDE_CODE_ORGANIZATION_UUID - Organization UUID. Sent as X-Organization-Uuid header for session key auth.
CLAUDE_CODE_ATTRIBUTION_HEADER - Boolean (set to "false" to disable). Controls whether attribution headers are sent with API requests.
CLAUDE_CODE_BLOCKING_LIMIT_OVERRIDE - Override the token limit at which Claude Code blocks (stops accepting input). Parsed as int.
CLAUDE_CODE_SLOW_OPERATION_THRESHOLD_MS - Threshold in ms for flagging slow filesystem operations. Default: Infinity (disabled).
CLAUDE_CODE_MAX_RETRIES - Maximum number of API request retries on failure.
CLAUDE_CODE_FORCE_FULL_LOGO - Boolean. Force display of the full ASCII logo on startup (normally hidden after first run).
CLAUDE_CODE_STREAMING_TEXT - Boolean. Enable streaming text display mode. Also gated behind tengu_streaming_text feature flag.
CLAUDE_CODE_SYNTAX_HIGHLIGHT - Set to "false" to disable syntax highlighting. Shown in UI as reason for disabled highlighting.
CLAUDE_CODE_ACCESSIBILITY - Boolean. Enable accessibility mode — disables cursor hiding and animated indicators.
CLAUDE_CODE_RESUME_INTERRUPTED_TURN - Boolean. Auto-resume an interrupted turn on session reconnect.
CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD - Boolean. When true, loads CLAUDE.md files from additional working directories.
CLAUDE_CODE_ADDITIONAL_PROTECTION - Boolean. Adds x-anthropic-additional-protection header to requests.
CLAUDE_CODE_SAVE_HOOK_ADDITIONAL_CONTEXT - Boolean. Persist hook additional context in session logs (normally stripped for non-Anthropic users).
CLAUDE_CODE_DIAGNOSTICS_FILE - Path to write diagnostics output file.
CLAUDE_CODE_ENVIRONMENT_KIND - Environment kind: "byoc", "anthropic_cloud", or "bridge". Affects transport and client behavior.
CLAUDE_CODE_ENVIRONMENT_RUNNER_VERSION - Environment runner version. Sent as x-environment-runner-version header.
CLAUDE_CODE_HOST_PLATFORM - Override detected platform. Accepts "win32", "darwin", "linux". Falls back to process.platform.
CLAUDE_CODE_WORKER_EPOCH - CCR worker epoch number. Required for CCR v2 client initialization (must be a valid integer).
CLAUDE_CODE_API_BASE_URL - Custom base URL for the Claude Code API (distinct from the Anthropic model API).
CLAUDE_CODE_EXIT_AFTER_FIRST_RENDER - Boolean. Exit immediately after the first UI render (for testing).
CLAUDE_CODE_EXIT_AFTER_STOP_DELAY - Delay in ms before exiting after stop signal.
CLAUDE_CODE_FORCE_GLOBAL_CACHE - Boolean. Force global cache control on system prompt. Also gated behind tengu_system_prompt_global_cache.
CLAUDE_CODE_INCLUDE_PARTIAL_MESSAGES - Boolean. Include partial/streaming messages in output (used by SDK URL mode).
CLAUDE_CODE_EAGER_FLUSH - Boolean. Eagerly flush session data after each turn (used in cowork/SDK modes).
CLAUDE_ENV_FILE - Path to an environment file to load session environment variables from.
CLAUDE_DEBUG - Boolean. Enable debug logging for internal warnings and diagnostics.
CLAUDE_REPL_MODE - Boolean. REPL mode — adjusts available tools/commands for interactive sessions.
CLAUDE_FORCE_DISPLAY_SURVEY - Boolean. Force display of the feedback survey even if not yet due.
CLAUDECODE - Set to "1" in child shell processes to indicate they were spawned by Claude Code.
CLAUDE_CODE_BUBBLEWRAP - Set to "1" to indicate running inside a bubblewrap sandbox. Bypasses root/sudo restriction for --dangerously-skip-permissions.
CLAUBBIT - Internal Anthropic development/debugging flag.
IS_DEMO - Boolean. Demo mode flag.
IS_SANDBOX - Boolean. Sandbox environment flag. Bypasses root/sudo restriction.
DEMO_VERSION - Demo version string identifier.
SLASH_COMMAND_TOOL_CHAR_BUDGET - Character budget for slash command tool output. Falls back to a computed default based on context window.
TASK_MAX_OUTPUT_LENGTH - Maximum output length for background task/shell results. Validated with default and upper limit.
CLAUDE_CODE_FILE_READ_MAX_OUTPUT_TOKENS - Maximum output tokens for the file Read tool. Parsed as int; must be > 0. Falls back to built-in default.
RIPGREP_EMBEDDED - Boolean. Indicates using the embedded ripgrep binary.
USE_BUILTIN_RIPGREP - Controls whether to use the bundled ripgrep binary vs. system-installed rg.
SAFEUSER - Safe username fallback. Used with USER and USERNAME for process identification.
## Feature Flags (Enable)
ENABLE_LSP_TOOL - Boolean. Enable the LSP (Language Server Protocol) tool for code intelligence features.
ENABLE_TOOL_SEARCH - Controls tool search/deferred tool loading. Can be "auto", "true", "false", or a percentage (0-100).
ENABLE_SESSION_BACKGROUNDING - Set to "true" to enable session backgrounding via Ctrl+B.
ENABLE_BTW - Boolean. Enable "by the way" suggestions.
ENABLE_CLAUDEAI_MCP_SERVERS - Boolean. Enable Claude.ai-hosted MCP servers.
ENABLE_MCP_LARGE_OUTPUT_FILES - Boolean. Enable large output file support for MCP tool results.
ENABLE_BETA_TRACING_DETAILED - Boolean. Enable detailed beta tracing data.
ENABLE_ENHANCED_TELEMETRY_BETA - Boolean. Enable enhanced telemetry beta features.
ENABLE_CLAUDE_CODE_SM_COMPACT - Boolean. Enable session memory compaction. Overrides feature flags.
ENABLE_PROMPT_CACHING_1H_BEDROCK - Boolean. Enable 1-hour prompt caching on Bedrock.
CLAUDE_CODE_ENABLE_CFC - Boolean. Enable Claude for Chrome (browser automation). Also checks feature flag claudeInChromeDefaultEnabled.
CLAUDE_CODE_ENABLE_TASKS - Boolean. Enable task list tools (TaskCreate, TaskUpdate, etc.). Defaults to enabled for non-SDK mode.
CLAUDE_CODE_ENABLE_FINE_GRAINED_TOOL_STREAMING - Boolean. Enable eager input streaming for fine-grained tool execution. Also gated behind tengu_fgts.
CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION - Set to "false" to disable or "1" to enable prompt suggestions.
CLAUDE_CODE_ENABLE_SDK_FILE_CHECKPOINTING - Boolean. Enable file checkpointing when running in SDK mode.
CLAUDE_CODE_ENABLE_TELEMETRY - Boolean. Enable telemetry collection.
CLAUDE_CODE_ENABLE_TOKEN_USAGE_ATTACHMENT - Boolean. Attach token usage info (used/total/remaining) to messages.
CLAUDE_CODE_ENHANCED_TELEMETRY_BETA - Boolean. Enable enhanced telemetry beta features (alternative flag).
CLAUDE_ENABLE_STREAM_WATCHDOG - Boolean. Enable a watchdog that monitors API stream health (30s/60s timeouts).
CLAUDE_CODE_EMIT_TOOL_USE_SUMMARIES - Boolean. Emit tool use summary events in output stream.
FALLBACK_FOR_ALL_PRIMARY_MODELS - Boolean. Enable fallback behavior for all primary models.
FORCE_AUTOUPDATE_PLUGINS - Boolean. Force auto-update of plugins on startup.
## Feature Flags (Disable)
CLAUDE_CODE_DISABLE_1M_CONTEXT - Boolean. Disable 1M context window models. Prevents [1m] model variants from being used.
CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING - Boolean. Disable adaptive thinking mode. Forces fixed thinking budget instead.
CLAUDE_CODE_DISABLE_ATTACHMENTS - Boolean. Disable file/image attachments in messages.
CLAUDE_CODE_DISABLE_AUTO_MEMORY - Boolean. Disable automatic memory (MEMORY.md) feature. Set "true" to disable, "false" to force enable.
CLAUDE_CODE_DISABLE_BACKGROUND_TASKS - Boolean. Disable background task functionality (Ctrl+B).
CLAUDE_CODE_DISABLE_CLAUDE_MDS - Boolean. Disable loading CLAUDE.md instruction files.
CLAUDE_CODE_DISABLE_COMMAND_INJECTION_CHECK - Boolean. Disable the command injection security check on Bash tool commands.
CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS - Boolean. Disable experimental beta API features. Only affects first-party and foundry providers.
CLAUDE_CODE_DISABLE_FAST_MODE - Boolean. Disable fast mode (streaming optimization).
CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY - Boolean. Disable the feedback survey popup.
CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING - Boolean. Disable git-based file checkpointing (undo support).
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC - Boolean. Reduce non-critical network requests (error reporting, telemetry, etc.).
CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL - Boolean. Disable automatic installation of official marketplace plugins.
CLAUDE_CODE_DISABLE_TERMINAL_TITLE - Boolean. Prevent Claude Code from updating the terminal window title.
CLAUDE_CODE_DISABLE_THINKING - Boolean. Completely disable extended thinking mode.
CLAUDE_CODE_DONT_INHERIT_ENV - Boolean. When spawning shell processes, start with empty environment instead of inheriting process.env.
CLAUDE_CODE_SKIP_PROMPT_HISTORY - Boolean. Disable saving prompt history.
DISABLE_INTERLEAVED_THINKING - Boolean. Disable interleaved thinking beta feature.
DISABLE_MICROCOMPACT - Boolean. Disable microcompact message optimization.
DISABLE_PROMPT_CACHING - Boolean. Disable prompt caching across all models.
DISABLE_PROMPT_CACHING_HAIKU - Boolean. Disable prompt caching specifically for Haiku models.
DISABLE_PROMPT_CACHING_OPUS - Boolean. Disable prompt caching specifically for Opus models.
DISABLE_PROMPT_CACHING_SONNET - Boolean. Disable prompt caching specifically for Sonnet models.
DISABLE_ERROR_REPORTING - Boolean. Disable automatic error reporting to Anthropic.
DISABLE_TELEMETRY - Boolean. Disable all telemetry collection.
## Command Disablers
DISABLE_AUTOUPDATER - Boolean. Disable the automatic update checker.
DISABLE_BUG_COMMAND - Boolean. Disable the /bug command.
DISABLE_COST_WARNINGS - Boolean. Disable API cost warning messages.
DISABLE_DOCTOR_COMMAND - Boolean. Disable the /doctor diagnostic command.
DISABLE_EXTRA_USAGE_COMMAND - Boolean. Disable the extra usage display command.
DISABLE_FEEDBACK_COMMAND - Boolean. Disable the /feedback command.
DISABLE_INSTALL_GITHUB_APP_COMMAND - Boolean. Disable the GitHub app installation command.
DISABLE_INSTALLATION_CHECKS - Boolean. Skip installation verification checks.
DISABLE_LOGIN_COMMAND - Boolean. Disable the /login command.
DISABLE_LOGOUT_COMMAND - Boolean. Disable the /logout command.
DISABLE_UPGRADE_COMMAND - Boolean. Disable the /upgrade command.
DISABLE_AUTO_MIGRATE_TO_NATIVE - Boolean. Disable automatic migration to native installer.
## Bash / Shell
BASH_MAX_OUTPUT_LENGTH - Maximum character length of bash command output. Default: 30000, upper limit: 150000.
CLAUDE_CODE_BASH_SANDBOX_SHOW_INDICATOR - Boolean. Show visual indicator when bash commands run in sandbox mode.
CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR - Boolean. Maintain consistent working directory across bash commands.
FORCE_CODE_TERMINAL - Boolean. Force terminal/CLI mode for operations.
## Tool Configuration
CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY - Maximum number of concurrent tool executions. Default: 10.
CLAUDE_CODE_GLOB_TIMEOUT_SECONDS - Timeout for glob operations in seconds. Default: 20 (wsl: 60). Overrides built-in default when > 0.
CLAUDE_CODE_GLOB_HIDDEN - Boolean. Include hidden files in glob results. Default: "true".
CLAUDE_CODE_GLOB_NO_IGNORE - Boolean. Ignore .gitignore rules in glob results. Default: "true".
## MCP (Model Context Protocol)
MCP_TIMEOUT - General timeout for MCP server connections in ms. Default: 30000 (30s).
MCP_TOOL_TIMEOUT - Timeout for individual MCP tool execution in ms. Falls back to built-in default.
MAX_MCP_OUTPUT_TOKENS - Maximum tokens for MCP tool output. Default: 25000.
MCP_SERVER_CONNECTION_BATCH_SIZE - Number of MCP servers to connect to simultaneously. Default: 3.
MCP_REMOTE_SERVER_CONNECTION_BATCH_SIZE - Batch size for remote MCP server connections. Default: 20.
MCP_CONNECTION_NONBLOCKING - Boolean. Make MCP server connections non-blocking.
## Plugin System
CLAUDE_CODE_PLUGIN_CACHE_DIR - Custom directory for caching plugins. Default: ~/.claude/plugins (or cowork_plugins in cowork mode).
CLAUDE_CODE_PLUGIN_SEED_DIR - Seed directory for pre-installed plugins. Returns undefined if not set.
CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS - Timeout for plugin git operations (clone, pull). Parsed as int; must be > 0. Falls back to built-in default.
CLAUDE_CODE_PLUGIN_USE_ZIP_CACHE - Boolean. Enable zip-based plugin caching instead of git-based.
CLAUDE_CODE_SYNC_PLUGIN_INSTALL - Boolean. Install plugins synchronously during startup.
CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS - Timeout for synchronous plugin install in ms. If > 0, races install against timeout.
CLAUDE_CODE_USE_COWORK_PLUGINS - Boolean. Use cowork_plugins directory instead of plugins.
## Context & Compaction
DISABLE_COMPACT - Boolean. Disable all context compaction (both auto and manual).
DISABLE_AUTO_COMPACT - Boolean. Disable automatic context compaction only (manual /compact still works).
DISABLE_CLAUDE_CODE_SM_COMPACT - Boolean. Disable session memory compaction.
ENABLE_CLAUDE_CODE_SM_COMPACT - Boolean. Force enable session memory compaction (overrides feature flags).
CLAUDE_AUTOCOMPACT_PCT_OVERRIDE - Override auto-compaction trigger percentage (0-100). Parsed as float. Caps at the computed maximum.
CLAUDE_CODE_SKIP_PRECOMPACT_LOAD - Boolean. Optimize large session file loading by seeking to the last compaction point for files > 100MB.
CLAUDE_AFTER_LAST_COMPACT - Boolean. When fetching session data, request only log lines after the last compaction.
USE_API_CONTEXT_MANAGEMENT - Boolean. Enable server-side API context management. Gated behind feature flags.
## Agent SDK
CLAUDE_AGENT_SDK_VERSION - Agent SDK version string. Included in User-Agent header as agent-sdk/{version}.
CLAUDE_AGENT_SDK_CLIENT_APP - Client application name when using the Agent SDK. Included in User-Agent as client-app/{name}. Sent as x-client-app header.
CLAUDE_AGENT_SDK_MCP_NO_PREFIX - Boolean. When using SDK-type MCP servers, don't prefix tool names with the server name.
CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS - Boolean. Disable built-in agent types (Explore, Plan, etc.) when running in SDK mode.
DEBUG_SDK - Boolean. Enable SDK debug logging.
## Agent Teams
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS - Boolean. Enable experimental agent teams feature. Also requires tengu_amber_flint feature flag or --agent-teams CLI flag.
CLAUDE_CODE_PLAN_MODE_REQUIRED - Set to "true" to require agents to use plan mode (must get approval before implementing).
CLAUDE_CODE_PLAN_MODE_INTERVIEW_PHASE - Boolean. Enable interview phase in plan mode.
CLAUDE_CODE_PLAN_V2_AGENT_COUNT - Number of agents for plan v2 execution. Range: 1-10. Defaults vary by subscription (max: 3, enterprise/team: 3, others: 1).
CLAUDE_CODE_PLAN_V2_EXPLORE_AGENT_COUNT - Number of explore agents for plan v2. Range: 1-10, default: 3.
CLAUDE_CODE_TASK_LIST_ID - Task list ID for team coordination.
CLAUDE_CODE_IS_COWORK - Boolean. Running in cowork/collaborative mode. Affects flush behavior and plugin directory.
CLAUDE_AUTO_BACKGROUND_TASKS - Boolean. Auto-launch background tasks after inactivity. When enabled, sets a 120s timeout. Also gated behind tengu_auto_background_agents.
## Remote / Cowork
CLAUDE_CODE_REMOTE - Boolean. Indicates running in remote/server mode. Disables auto-memory when no remote memory dir is set.
CLAUDE_CODE_REMOTE_SESSION_ID - Remote session identifier. Sent as x-claude-remote-session-id header and used for commit/PR URL generation.
CLAUDE_CODE_REMOTE_MEMORY_DIR - Directory for memory files when running remotely. Falls back to CLAUDE_CONFIG_DIR.
CLAUDE_CODE_REMOTE_SEND_KEEPALIVES - Boolean. Send periodic keepalive pings during remote sessions.
CLAUDE_CODE_REMOTE_ENVIRONMENT_TYPE - Remote environment type (e.g., type of cloud VM). Sent in telemetry as remoteEnvironmentType.
CLAUDE_CODE_USE_CCR_V2 - Boolean. Use CCR (Claude Code Remote) v2 protocol with HTTP-based transport instead of WebSocket.
CLAUDE_CODE_POST_FOR_SESSION_INGRESS_V2 - Boolean. Use POST-based transport for session ingress v2 (alternative to WebSocket).
SESSION_INGRESS_URL - URL for session ingress (remote session connectivity).
LOCAL_BRIDGE - Boolean. Local bridge mode for development.
## IDE Integration
CLAUDE_CODE_AUTO_CONNECT_IDE - Boolean. Automatically connect to IDE (VS Code, JetBrains, etc.) on startup.
CLAUDE_CODE_IDE_HOST_OVERRIDE - Custom host address for IDE communication.
CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL - Boolean. Skip automatic IDE extension installation.
CLAUDE_CODE_IDE_SKIP_VALID_CHECK - Boolean. Bypass IDE extension validation checks.
VSCODE_GIT_ASKPASS_MAIN - VS Code Git askpass process path. Used to detect VS Code environment.
CURSOR_TRACE_ID - Cursor IDE trace identifier for debugging.
CLAUDE_CHROME_PERMISSION_MODE - Permission mode for Claude-in-Chrome browser automation.
## Observability / Telemetry (OTEL)
OTEL_EXPORTER_OTLP_ENDPOINT - OpenTelemetry OTLP exporter endpoint URL.
OTEL_EXPORTER_OTLP_HEADERS - OpenTelemetry OTLP exporter headers.
OTEL_EXPORTER_OTLP_PROTOCOL - OTLP exporter protocol (e.g., grpc, http/protobuf).
OTEL_EXPORTER_OTLP_INSECURE - Boolean. Allow insecure OTLP connections.
OTEL_EXPORTER_OTLP_LOGS_PROTOCOL - Protocol specifically for OTLP logs export.
OTEL_EXPORTER_OTLP_METRICS_PROTOCOL - Protocol specifically for OTLP metrics export.
OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE - Metrics temporality preference (cumulative vs delta).
OTEL_EXPORTER_OTLP_TRACES_PROTOCOL - Protocol specifically for OTLP traces export.
OTEL_EXPORTER_PROMETHEUS_HOST - Prometheus exporter host.
OTEL_EXPORTER_PROMETHEUS_PORT - Prometheus exporter port.
OTEL_LOGS_EXPORTER - Logs exporter type (e.g., otlp, console).
OTEL_LOGS_EXPORT_INTERVAL - Logs export interval in ms.
OTEL_METRICS_EXPORTER - Metrics exporter type.
OTEL_METRIC_EXPORT_INTERVAL - Metrics export interval in ms.
OTEL_TRACES_EXPORTER - Traces exporter type.
OTEL_TRACES_EXPORT_INTERVAL - Traces export interval in ms.
OTEL_LOG_USER_PROMPTS - Boolean. Include user prompts in telemetry logs.
OTEL_LOG_TOOL_CONTENT - Boolean. Include tool input/output content in telemetry.
OTEL_LOG_TOOL_DETAILS - Boolean. Include detailed tool execution info in telemetry.
ANALYTICS_LOG_TOOL_DETAILS - Boolean. Include tool details in analytics events.
CLAUDE_CODE_OTEL_SHUTDOWN_TIMEOUT_MS - Timeout for OTEL provider shutdown. Default: 2000 ms.
CLAUDE_CODE_OTEL_FLUSH_TIMEOUT_MS - Timeout for OTEL provider flush. Default: 5000 ms.
CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS - Debounce time for OTEL headers helper.
CLAUDE_CODE_ENABLE_TELEMETRY - Boolean. Enable telemetry (alternative to DISABLE_TELEMETRY).
CLAUDE_CODE_ENHANCED_TELEMETRY_BETA - Boolean. Enable enhanced telemetry beta.
BETA_TRACING_ENDPOINT - Custom endpoint URL for beta tracing.
ENABLE_BETA_TRACING_DETAILED - Boolean. Enable detailed beta tracing.
## Datadog
CLAUDE_CODE_DATADOG_FLUSH_INTERVAL_MS - Interval for flushing logs to Datadog. Falls back to built-in default. Endpoint: https://http-intake.logs.us5.datadoghq.com/api/v2/logs.
## Profiling & Diagnostics
CLAUDE_CODE_PROFILE_STARTUP - Set to "1" to enable startup profiling. Also randomly sampled at 0.5% of sessions.
CLAUDE_CODE_PROFILE_QUERY - Set to "1" to enable per-query profiling.
CLAUDE_CODE_PERFETTO_TRACE - Enable Perfetto trace output. Value logged at initialization.
CLAUDE_CODE_DEBUG_LOGS_DIR - Custom directory for debug log files. Default: ~/.claude/debug/{sessionId}.txt.
CLAUDE_CODE_DIAGNOSTICS_FILE - Path to write diagnostics output.
## Proxy & TLS
HTTP_PROXY - HTTP proxy server URL.
HTTPS_PROXY - HTTPS proxy server URL.
NO_PROXY - Comma-separated list of domains to bypass proxy.
CLAUDE_CODE_PROXY_RESOLVES_HOSTS - Boolean. When set, proxy agent skips DNS resolution and passes hostnames directly to the proxy.
CLAUDE_CODE_CLIENT_CERT - Path to client TLS certificate file.
CLAUDE_CODE_CLIENT_KEY - Path to client TLS private key file.
CLAUDE_CODE_CLIENT_KEY_PASSPHRASE - Passphrase for encrypted client private key.
NODE_EXTRA_CA_CERTS - Path to additional CA certificates for Node.js TLS.
NODE_TLS_REJECT_UNAUTHORIZED - Set to "0" to disable TLS certificate verification (not recommended).
NODE_USE_SYSTEM_CA - Boolean. Use system CA certificate store.
## Tmux Integration
CLAUDE_CODE_TMUX_SESSION - Tmux session name. Displayed in the UI header.
CLAUDE_CODE_TMUX_PREFIX - Tmux prefix key. Displayed in detach instructions.
CLAUDE_CODE_TMUX_PREFIX_CONFLICTS - Boolean. When true, shows instructions to press prefix twice (e.g., Ctrl+B Ctrl+B d) due to key conflict with Claude Code.
TMUX - Tmux session identifier (set by tmux itself).
TMUX_PANE - Current tmux pane identifier.
## Git / CI Environment Detection
GITHUB_ACTIONS - Boolean. Indicates running in GitHub Actions.
GITHUB_ACTOR - GitHub Actions actor (user/bot) name.
GITHUB_ACTOR_ID - GitHub Actions actor unique identifier.
GITHUB_EVENT_NAME - GitHub Actions triggering event name.
GITHUB_REPOSITORY - GitHub repository (owner/name format).
GITHUB_REPOSITORY_ID - GitHub repository unique identifier.
GITHUB_REPOSITORY_OWNER - GitHub repository owner name.
GITHUB_REPOSITORY_OWNER_ID - GitHub repository owner unique identifier.
GITHUB_ACTION_PATH - GitHub Action script path. Used for file resolution.
GITHUB_ACTION_INPUTS - GitHub Action input parameters.
GITLAB_CI - Boolean. Indicates running in GitLab CI.
CIRCLECI - Boolean. Indicates running in CircleCI.
BUILDKITE - Boolean. Indicates running in Buildkite.
CODESPACES - Boolean. Indicates running in GitHub Codespaces.
GITPOD_WORKSPACE_ID - Gitpod workspace identifier.
RUNNER_ENVIRONMENT - CI/CD runner environment type.
RUNNER_OS - CI/CD runner operating system.
## SWE-Bench
SWE_BENCH_INSTANCE_ID - SWE-Bench evaluation instance identifier.
SWE_BENCH_RUN_ID - SWE-Bench evaluation run identifier.
SWE_BENCH_TASK_ID - SWE-Bench evaluation task identifier.
## Terminal Detection
Used to detect terminal emulator type for UI rendering and feature support.
TERM - Terminal type identifier (e.g., xterm-256color).
TERM_PROGRAM - Terminal program name (e.g., iTerm.app, Apple_Terminal).
TERM_PROGRAM_VERSION - Terminal program version string.
COLORTERM - Color terminal capability (e.g., truecolor).
TERMINAL_EMULATOR - Terminal emulator name.
ALACRITTY_LOG - Detects Alacritty terminal.
GNOME_TERMINAL_SERVICE - Detects GNOME Terminal.
ITERM_SESSION_ID - Detects iTerm2.
KITTY_WINDOW_ID - Detects Kitty terminal.
KONSOLE_VERSION - Detects KDE Konsole.
TERMINATOR_UUID - Detects Terminator terminal.
TILIX_ID - Detects Tilix terminal.
VTE_VERSION - VTE terminal emulator library version.
XTERM_VERSION - Detects XTerm.
WT_SESSION - Detects Windows Terminal.
ZED_TERM - Detects Zed editor terminal.
FORCE_COLOR - Force color output.
STY - Screen/tmux session identifier.
## Cloud Environment Detection
Used for detecting cloud/serverless environments (GCP metadata, Heroku, Fly.io, etc.).
GCE_METADATA_HOST - Google Compute Engine metadata server host.
GCE_METADATA_IP - Google Compute Engine metadata server IP.
METADATA_SERVER_DETECTION - Controls cloud metadata server detection behavior.
DETECT_GCP_RETRIES - Configures GCP detection retry logic.
DYNO - Heroku dyno identifier.
FLY_APP_NAME - Fly.io app name.
FLY_MACHINE_ID - Fly.io machine identifier.
FUNCTION_NAME - Cloud function name (GCP, etc.).
FUNCTION_TARGET - Cloud function target endpoint.
GAE_MODULE_NAME - Google App Engine module name.
GAE_SERVICE - Google App Engine service.
K_CONFIGURATION - Knative configuration name.
K_SERVICE - Knative service name.
CLOUD_RUN_JOB - Google Cloud Run job identifier.
RAILWAY_ENVIRONMENT_NAME - Railway deployment environment.
RAILWAY_SERVICE_NAME - Railway service name.
VERCEL - Boolean. Vercel deployment indicator.
NETLIFY - Boolean. Netlify deployment indicator.
CF_PAGES - Boolean. Cloudflare Pages indicator.
RENDER - Boolean. Render.com indicator.
DENO_DEPLOYMENT_ID - Deno Deploy deployment ID.
REPL_ID - Replit REPL identifier.
REPL_SLUG - Replit REPL slug name.
PROJECT_DOMAIN - Glitch project domain.
SPACE_CREATOR_USER_ID - Hugging Face Spaces creator ID.
WEBSITE_SITE_NAME - Azure App Service website name.
WEBSITE_SKU - Azure App Service SKU tier.
KUBERNETES_SERVICE_HOST - Kubernetes service host (detects K8s environment).
SYSTEM_OIDCREQUESTURI - Azure DevOps OIDC request URI.
AZURE_FUNCTIONS_ENVIRONMENT - Azure Functions environment.
P4PORT - Perforce server connection string.
## Azure Identity (for Foundry auth)
AZURE_ADDITIONALLY_ALLOWED_TENANTS - Additional allowed Azure AD tenants.
AZURE_AUTHORITY_HOST - Azure AD authority host URL.
AZURE_CLIENT_CERTIFICATE_PASSWORD - Azure client certificate password.
AZURE_CLIENT_CERTIFICATE_PATH - Azure client certificate file path.
AZURE_CLIENT_ID - Azure client/app ID for service principal auth.
AZURE_CLIENT_SECRET - Azure client secret for service principal auth.
AZURE_CLIENT_SEND_CERTIFICATE_CHAIN - Boolean. Send certificate chain with Azure auth.
AZURE_FEDERATED_TOKEN_FILE - Path to federated identity token file.
AZURE_IDENTITY_DISABLE_MULTITENANTAUTH - Boolean. Disable multi-tenant authentication.
AZURE_PASSWORD - Azure user password (for username/password auth).
AZURE_POD_IDENTITY_AUTHORITY_HOST - Azure Pod Identity authority host.
AZURE_REGIONAL_AUTHORITY_NAME - Azure regional authority name.
AZURE_TENANT_ID - Azure AD tenant ID.
AZURE_TOKEN_CREDENTIALS - Pre-configured Azure token credentials object.
AZURE_USERNAME - Azure username (for username/password auth).
## System / Runtime
HOME - User home directory (Unix/macOS).
USERPROFILE - User profile directory (Windows).
APPDATA - Application data directory (Windows).
LOCALAPPDATA - Local application data directory (Windows).
PATH - System executable search paths.
PATHEXT - Windows executable file extensions.
SHELL - Default shell executable path.
EDITOR - Default text editor.
VISUAL - Visual editor (fallback to EDITOR).
BROWSER - Default browser executable.
PWD - Present working directory.
TMPDIR - System temp directory.
USER - Current username (Unix).
USERNAME - Current username (Windows/fallback).
OSTYPE - OS type identifier.
MSYSTEM - MSYS2/MinGW system type (Windows).
WSL_DISTRO_NAME - WSL distribution name.
SESSIONNAME - Windows session name.
SSH_CLIENT - SSH client connection info. Used to detect SSH sessions.
SSH_CONNECTION - SSH connection details. Used to detect SSH sessions.
SSH_TTY - SSH terminal device. Used to detect SSH sessions.
XDG_CONFIG_HOME - XDG config directory.
XDG_RUNTIME_DIR - XDG runtime directory.
CLAUDE_CODE_GIT_BASH_PATH - Path to Git Bash executable on Windows.
PKG_CONFIG_PATH - pkg-config library search paths.
UV_THREADPOOL_SIZE - libuv thread pool size.
APP_URL - Application URL.
AUDIO_CAPTURE_NODE_PATH - Path to audio capture node module.
MODIFIERS_NODE_PATH - Path to modifiers node module.
VOICE_STREAM_BASE_URL - Base URL for voice streaming WebSocket. Replaces https:// with wss:// from Claude AI origin.
## Node.js / Bun Runtime
NODE_ENV - Node.js environment (e.g., production, development).
NODE_OPTIONS - Node.js runtime options.
NODE_DEBUG - Node.js debug modules to enable.
NODE_CLUSTER_SCHED_POLICY - Node.js cluster scheduling policy.
NODE_UNIQUE_ID - Node.js cluster worker unique ID.
BUN_INSTALL - Bun runtime installation directory.
BUN_ENV - Bun environment mode.
BUN_DISABLE_DYNAMIC_CHUNK_SIZE - Bun internal: disable dynamic chunk sizing.
BUN_FEEDBACK_URL - Bun crash feedback URL.
BUN_INSPECT_NOTIFY - Bun inspector notification.
BUN_JS_DEBUG - Bun JavaScript debug flag.
COREPACK_ENABLE_AUTO_PIN - Enable Corepack auto-pinning of package managers.
## gRPC
GRPC_DEFAULT_SSL_ROOTS_FILE_PATH - gRPC SSL root certificates path.
GRPC_SSL_CIPHER_SUITES - gRPC SSL cipher suites.
GRPC_TRACE - gRPC tracing configuration.
GRPC_VERBOSITY - gRPC verbosity level.
GRPC_NODE_TRACE - Node.js gRPC tracing.
GRPC_NODE_USE_ALTERNATIVE_RESOLVER - Use alternative gRPC DNS resolver.
GRPC_NODE_VERBOSITY - Node.js gRPC verbosity.
GRPC_EXPERIMENTAL_ENABLE_OUTLIER_DETECTION - Enable gRPC outlier detection.
## Libraries / Internals
CHOKIDAR_INTERVAL - Chokidar file watcher polling interval in ms.
CHOKIDAR_USEPOLLING - Boolean. Force Chokidar to use polling instead of native file events.
GRACEFUL_FS_PLATFORM - Platform override for graceful-fs library.
TEST_GRACEFUL_FS_GLOBAL_PATCH - Testing flag for graceful-fs.
SHARP_FORCE_GLOBAL_LIBVIPS - Force Sharp to use global libvips installation.
SHARP_IGNORE_GLOBAL_LIBVIPS - Ignore global libvips for Sharp.
VERBOSE_SSR - Verbose SSR (server-side rendering) logging.
SRT_DEBUG - SRT library debug flag.
DEBUG - General debug flag for verbose logging.
DEBUG_AUTH - Enable authentication debugging.
MAX_STRUCTURED_OUTPUT_RETRIES - Max retries for structured output parsing. Default: 5.
TEST_ENABLE_SESSION_PERSISTENCE - Testing flag for session persistence.
CLAUDE_CODE_TEST_FIXTURES_ROOT - Root directory for test fixtures.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment