#environment variables
5 articles
-
/autocompact 500k and CLAUDE_CODE_AUTOCOMPACT_PCT_OVERRIDE=50: make Claude Code compact earlier, or never
/autocompact 500k sets autoCompactWindow, CLAUDE_CODE_AUTOCOMPACT_PCT_OVERRIDE=50 compacts at half the window, autoCompactEnabled: false turns it off. Defaults and precedence.
-
Adding MCP servers to Claude Code, claude mcp add, .mcp.json, scopes and passing tokens from the environment
claude mcp add for stdio and HTTP servers, the local / project / user scopes and which wins a name clash, .mcp.json with ${VAR} tokens, the approval prompt, checks and permissions.
-
Claude Code kills Bash commands at 2 minutes: raise it with BASH_DEFAULT_TIMEOUT_MS
The default timeout is 120000 ms (2 minutes), the ceiling the model can set is 600000 (10 minutes), and output cuts at 30,000 characters. How to raise each, and where to set them.
-
Codex passes your API keys to commands by default: fix it with shell_environment_policy
ignore_default_excludes defaults to true, so variables containing KEY, SECRET or TOKEN are passed straight through. How to set it to false, plus inherit, filters and set.
-
Pin environment variables in Claude Code's settings.json with the env key: precedence and pitfalls
How the env key in Claude Code's settings.json works: it overrides shell variables, applies to every session and subprocess, and when a saved change reaches a running session.