claude-code - 💡(How to fix) Fix CLAUDE_CONFIG_DIR is ignored when loading User Memory (~/.claude/CLAUDE.md) [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#58815Fetched 2026-05-14 03:38:48
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Timeline (top)
labeled ×4commented ×1

CLAUDE_CONFIG_DIR correctly isolates settings.json, .claude.json (auth), projects/, sessions/, plugins/, and hooks — but the User Memory file is still loaded from the hardcoded path ~/.claude/CLAUDE.md instead of $CLAUDE_CONFIG_DIR/CLAUDE.md.

This breaks the use case of running two fully isolated Claude Code "profiles" on one macOS user account (e.g. personal + client work).

Root Cause

CLAUDE_CONFIG_DIR correctly isolates settings.json, .claude.json (auth), projects/, sessions/, plugins/, and hooks — but the User Memory file is still loaded from the hardcoded path ~/.claude/CLAUDE.md instead of $CLAUDE_CONFIG_DIR/CLAUDE.md.

This breaks the use case of running two fully isolated Claude Code "profiles" on one macOS user account (e.g. personal + client work).

Code Example

# 1. Set up an alternate config dir with its own CLAUDE.md
mkdir -p ~/.claude-alt
echo "# ALT global memory" > ~/.claude-alt/CLAUDE.md

# 2. Make sure ~/.claude/CLAUDE.md has different, identifiable content
echo "# MAIN global memory" > ~/.claude/CLAUDE.md   # (back up first!)

# 3. Launch Claude with the alt config dir
CLAUDE_CONFIG_DIR="$HOME/.claude-alt" claude

# 4. Inside the session:
#    !echo "CONFIG_DIR=$CLAUDE_CONFIG_DIR"      # → /Users/you/.claude-alt  ✅
#    /memory                                    # → "User memory · Saved in ~/.claude/CLAUDE.md" ❌
RAW_BUFFERClick to expand / collapse

Summary

CLAUDE_CONFIG_DIR correctly isolates settings.json, .claude.json (auth), projects/, sessions/, plugins/, and hooks — but the User Memory file is still loaded from the hardcoded path ~/.claude/CLAUDE.md instead of $CLAUDE_CONFIG_DIR/CLAUDE.md.

This breaks the use case of running two fully isolated Claude Code "profiles" on one macOS user account (e.g. personal + client work).

Environment

  • Claude Code: 2.1.140
  • macOS: Darwin 24.6.0 (arm64)
  • Shell: zsh

Repro

# 1. Set up an alternate config dir with its own CLAUDE.md
mkdir -p ~/.claude-alt
echo "# ALT global memory" > ~/.claude-alt/CLAUDE.md

# 2. Make sure ~/.claude/CLAUDE.md has different, identifiable content
echo "# MAIN global memory" > ~/.claude/CLAUDE.md   # (back up first!)

# 3. Launch Claude with the alt config dir
CLAUDE_CONFIG_DIR="$HOME/.claude-alt" claude

# 4. Inside the session:
#    !echo "CONFIG_DIR=$CLAUDE_CONFIG_DIR"      # → /Users/you/.claude-alt  ✅
#    /memory                                    # → "User memory · Saved in ~/.claude/CLAUDE.md" ❌

/memory reports the User Memory file as ~/.claude/CLAUDE.md and loads its contents into context, despite CLAUDE_CONFIG_DIR pointing elsewhere. ~/.claude-alt/CLAUDE.md is never loaded.

Expected

When CLAUDE_CONFIG_DIR is set, User Memory should be read from and saved to $CLAUDE_CONFIG_DIR/CLAUDE.md, mirroring how settings.json and other config files behave.

Actual

User Memory path is hardcoded to ~/.claude/CLAUDE.md. Result: even with a separate CLAUDE_CONFIG_DIR, the main account's global instructions, preferences, and memory bleed into the "isolated" profile.

Impact

There is currently no way to run two fully isolated Claude Code profiles on a single macOS user without a separate OS user account. Wrapper scripts and shell aliases that set CLAUDE_CONFIG_DIR give the illusion of isolation, but the global CLAUDE.md leak means hooks/skills/preferences from the main profile still influence behavior in the secondary profile.

Suggested fix

Resolve the User Memory path as ${CLAUDE_CONFIG_DIR:-$HOME/.claude}/CLAUDE.md everywhere it's read or written (loader, /memory command, auto-memory save logic).

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix CLAUDE_CONFIG_DIR is ignored when loading User Memory (~/.claude/CLAUDE.md) [1 comments, 2 participants]