[BUG] CLAUDE_CONFIG_DIR not honored - Critical data separation issue
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Critical: CLAUDE_CONFIG_DIR environment variable not honored - causes data mixing between accounts
## Summary
Claude Code and agents ignore the CLAUDE_CONFIG_DIR environment variable and default to ~/.claude/, causing configuration and
potentially sensitive data to leak between multiple user accounts on the same machine.
## Severity
Critical - Data separation/security issue affecting job security
## Environment
- Multiple user accounts on same machine with different
CLAUDE_CONFIG_DIRsettings - Claude Code version: 2.1.220
- Platform: macOS
- Affects: Work and personal account separation
## Issue Description
When CLAUDE_CONFIG_DIR environment variable is set to a custom path (e.g., $HOME/workspace/claude/rachel for personal, different path
for work account), Claude Code still:
- Reads configuration from
~/.claude/instead of the specifiedCLAUDE_CONFIG_DIR - Creates new configuration files in
~/.claude/instead of$CLAUDE_CONFIG_DIR - Agents (statusline-setup, etc.) bypass the environment variable and default to
~/.claude/
This happens repeatedly across different tasks and operations, not just isolated to one feature.
## Real-World Impact
- Work account configuration gets mixed with personal account configuration
- Potential exposure of work config/settings in personal account
- Risk to job security due to contamination between work and personal environments
- Users with multiple accounts on same machine cannot safely use both accounts
## Example
- Set
CLAUDE_CONFIG_DIR=$HOME/workspace/claude/workfor work account - Request Claude to modify settings or perform tasks
- Configuration is read/written to
~/.claude/instead - Next user (personal account) with
CLAUDE_CONFIG_DIR=$HOME/workspace/claude/personalinherits contaminated config from work account
## Expected Behavior
- Claude Code must always respect
CLAUDE_CONFIG_DIRenvironment variable when set - All configuration read/write operations must use the directory specified by
CLAUDE_CONFIG_DIR - Agents must inherit and respect this environment variable
## Actual Behavior
CLAUDE_CONFIG_DIRis consistently ignored~/.claude/is used as default regardless of environment variable- All accounts on same machine share the same
~/.claude/directory, defeating the purpose of separate config directories
## Workaround
None currently available. Users with multiple accounts must not use the same machine for both accounts simultaneously, or risk data
contamination.
## Files/Code Affected
- Core config initialization logic that defaults to
~/.claude/ - Agent initialization that doesn't inherit
CLAUDE_CONFIG_DIR - StatusLine-setup agent and other agents that bypass environment variable
This is a critical security and data separation issue that requires immediate attention.
What Should Happen?
- Claude Code must always respect
CLAUDE_CONFIG_DIRenvironment variable when set - All configuration read/write operations must use the directory specified by
CLAUDE_CONFIG_DIR - Agents must inherit and respect this environment variable
Error Messages/Logs
Steps to Reproduce
- Set
CLAUDE_CONFIG_DIR=$HOME/workspace/claude/workfor work account - Request Claude to modify settings or perform tasks
- Configuration is read/written to
~/.claude/instead - Next user (personal account) with
CLAUDE_CONFIG_DIR=$HOME/workspace/claude/personalinherits contaminated config from work account
Claude Model
Not sure / Multiple models
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.1.220
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗