CLAUDE_CONFIG_DIR is ignored when loading User Memory (~/.claude/CLAUDE.md)

Resolved 💬 3 comments Opened May 13, 2026 by MarcinDudekDev Closed May 17, 2026

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).

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗