CLAUDE_BG_SOCKET_TOKENS_PATH
Updated by Alex Sorokoletov
CLAUDE_BG_SOCKET_TOKENS_PATH is a Claude Code environment variable. Added between v2.1.143 and v2.1.212 and still present in v2.1.295. It is not in the official reference.
| Status | Present in v2.1.295 |
|---|---|
| Added | Added between v2.1.143 and v2.1.212 |
| Category | Authentication |
| Official docs | Not listed |
How to set it
For one session, export it in the shell that starts Claude Code:
export CLAUDE_BG_SOCKET_TOKENS_PATH=<value>
claudeTo apply it to every session, add it to the env object of a settings file:
// ~/.claude/settings.json
{
"env": {
"CLAUDE_BG_SOCKET_TOKENS_PATH": "<value>"
}
}Related variables
CLAUDE_BG_AUTH_SNAPSHOT_PATH: Path for snapshotting background session auth credentials to disk.CLAUDE_CODE_FILE_READ_MAX_OUTPUT_TOKENS: Max tokens for file read output.CLAUDE_CODE_IDLE_COMPACT_MIN_TOKENS: Sets the minimum conversation size, in tokens, before idle compaction runs.CLAUDE_CODE_MAX_CONTEXT_TOKENS: Sets an explicit ceiling on the context window size used during a session.CLAUDE_CODE_MAX_OUTPUT_TOKENS: Maximum output tokens; validated per-model.MAX_MCP_OUTPUT_TOKENS: Max tokens for MCP tool output.MAX_THINKING_TOKENS: Likely controlled via API settings now.CLAUDE_CODE_TOTAL_TOKENS_REMINDER
Frequently asked questions
Which Claude Code version has CLAUDE_BG_SOCKET_TOKENS_PATH?
Added between v2.1.143 and v2.1.212 and still present in v2.1.295.
How do I set CLAUDE_BG_SOCKET_TOKENS_PATH?
Export it before starting Claude Code (export CLAUDE_BG_SOCKET_TOKENS_PATH=value), or add it to the "env" object in ~/.claude/settings.json to apply it to every session.
All variables, searchable: Claude Code environment variables.