bridge-spawn root ignores CLAUDE_CONFIG_DIR and always creates ~/.claude
What's wrong
Setting CLAUDE_CONFIG_DIR moves almost all state, but ~/.claude/bridge-spawn is still created in the home directory on every launch of the desktop app, so ~/.claude keeps reappearing.
Cause
In the bundled binary (2.1.284), the bridge-spawn root is a module-level constant built from the home directory:
var y6n = "bridge-spawn", t5 = join(homedir(), ".claude", y6n);
ensureBridgeSpawnRootDir then runs mkdir -p on it at startup. There is no check for CLAUDE_CONFIG_DIR, unlike the other config paths.
Steps to reproduce
- Set
CLAUDE_CONFIG_DIRto a custom path, such as~/Library/Application Support/Claude Code. Set it for both the CLI and the desktop app. - Delete
~/.claude. - Launch the Claude desktop app and start a Code session.
~/.claude/bridge-spawnexists again (empty directory, mode 0700).
Expected
The bridge-spawn root lives under CLAUDE_CONFIG_DIR (or XDG_STATE_HOME/XDG_RUNTIME_DIR) when set, so no home-directory folder is created.
Environment
- macOS (Darwin), Claude desktop app with Claude Code 2.1.284
- XDG variables and
CLAUDE_CONFIG_DIRset in~/.zshenv
Related
The sandbox allowlist also hardcodes ~/.claude/debug and ~/.npm/_logs, so those can also create ~/.claude and ~/.npm. They are worth moving under the config dir too.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗