[BUG] macOS auto-memory scoped to home-dir hash, ignoring cwd-hash dirs
Environment
- Claude Code version: 2.1.118 (brew cask) AND 2.1.126 (native installer at ~/.local/bin/claude). Reproduced on both.
- macOS: Sequoia (Darwin 24.3.0 arm64), Apple Silicon Mac mini
- Cross-reference Linux: Same architecture works correctly on Linux (Ubuntu 24.04 / Claude Code 2.1.122 native installer)
Expected behavior (per docs)
Auto-memory is cwd-keyed: when CC runs at <cwd>, it reads/writes ~/.claude/projects/<cwd-with-/-replaced-by-->/memory/. Different cwds get different memory dirs. Documented as platform-agnostic.
Actual behavior on macOS
Auto-memory is keyed only to the user's HOME-dir hash, regardless of cwd. CC at /Users/leofloa/utopia, /Users/leofloa/medumio, or ~ all read/write the SAME dir: ~/.claude/projects/-Users-leofloa/memory/. The cwd-specific hash dirs are never used for memory (only for session JSONLs).
Reproduction
- Pre-create a memory file outside CC at the cwd-specific path:
```bash
mkdir -p ~/.claude/projects/-Users-leofloa-utopia/memory
cat > ~/.claude/projects/-Users-leofloa-utopia/memory/MEMORY.md <<'EOM'
- Test sentinel: the festival mascot is a gardener gnome named Gertrude
EOM
```
- Start CC at the matching cwd:
``bash``
cd ~/utopia && claude
- Without invoking /recall, ask Claude: "What's the festival mascot for the sync test?"
- Expected: "Gertrude" (loaded from MEMORY.md at the cwd-hash path)
- Actual: "I don't have any record of a Utopia festival mascot — nothing in MEMORY.md, the Utopia CLAUDE.md, or the agent vault references one."
Confirming via CC's own write path
Step 1: at /Users/leofloa/utopia, prompt Claude remember this: utopia mascot is Gertrude. save to memory.
Step 2: Claude responds "Saved to utopia_sync_test_mascot.md and indexed under Project in MEMORY.md."
Step 3: Check filesystem:
- File DOES NOT appear at
~/.claude/projects/-Users-leofloa-utopia/memory/(the cwd-hash dir, where it should land) - File DOES appear at
~/.claude/projects/-Users-leofloa/memory/utopia_sync_test_mascot.md(the home-dir, where it should NOT land for a~/utopiacwd)
So even when CC itself writes (the canonical write path), it goes to home-dir hash on macOS.
Cross-platform comparison
On Linux at /home/vbox/medumio, CC correctly uses /home/vbox/.claude/projects/-home-vbox-medumio/memory/. Past session JSONLs at ~/.claude/projects/-home-vbox-medumio/*.jsonl reference loading the cwd-hash path's feedback_*.md files dozens of times. Linux behavior matches the docs.
Things ruled out
- Project registration: Adding
/Users/leofloa/utopia(and all life-domain cwds) as entries under theprojectskey in~/.claude.json, mirroring the Linux machine's structure. No effect. - CC version: Tested on 2.1.118 (brew) and upgraded to 2.1.126 (native). Same behavior on both.
- Permissions: Both the cwd-hash dir and the home-hash dir have identical 755/644 permissions on macOS.
- File format: MEMORY.md content is valid markdown matching the format that loads correctly on Linux.
Impact
This breaks per-project memory scoping on macOS — all projects share one memory blob, mixing unrelated domain context. For users with multiple distinct project areas under one HOME (typical), it makes auto-memory effectively unusable as a per-context tool.
Hypothesis
Likely a path-normalization or HOME-stripping bug in macOS-specific slug generation. The slug encoding (replace / with -) appears to collapse the cwd to the home-dir prefix on macOS only.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗