Auto-memory system-prompt block names wrong project directory (uses $HOME encoding, not actual $PWD)

Status Open
Maintainer reply None cached
Activity 0 comments · opened Aug 2, 2026

Summary
The "auto memory" feature injects a system-prompt block telling Claude where its persistent memory directory is (~/.claude/projects/<encoded-cwd>/memory/). In sessions run from a subdirectory of $HOME (not $HOME itself), this block sometimes names the encoded path of bare $HOME instead of the actual working directory — pointing Claude at the wrong project's memory store (or a stale legacy one).

Evidence
Session run in ~/vibe-coding/name-1-work (confirmed via pwd/env):

  • The auto-memory system-prompt block stated the memory directory as /home/<user>/.claude/projects/-home-<user>/memory/ — the encoding of bare $HOME.
  • The actual correct store, /home/<user>/.claude/projects/-home-<user>-vibe-coding-name-1-work/memory/, exists, is populated, and is the one actually being read/written by other harness mechanisms.
  • The session's own transcript file (*.jsonl in the correct project dir) has the correct "cwd" field throughout — so the harness's own logging/routing is correctly scoped to the real cwd. Only the auto-memory system-prompt text is wrong.
  • Checked all 8 configured project directories on this machine (each with its own bridge-pointer.json carrying a correct, unique sessionId/environmentId) — transcript/session scoping is cwd-based and correct everywhere; this bug is isolated to the auto-memory path text specifically.

Impact
Claude reads/writes memory from the wrong directory, silently landing in a stale/legacy store instead of the project's real one — memories go missing or get orphaned, and the model doesn't know because the stated path in its context looks legitimate.

Workaround
Adding an explicit note to each project's CLAUDE.md telling Claude to ignore the auto-injected path and independently resolve ~/.claude/projects/<encode(pwd)>/memory/ at session start.

Environment
Ubuntu 24.04, Claude Code (non-interactive/headless session via tmux), multi-project setup with several long-lived project directories under $HOME.

View original on GitHub ↗