Store project memory in $PWD/.claude/ to make workspaces relocatable

Resolved 💬 2 comments Opened Jun 17, 2026 by ascheman Closed Jun 17, 2026

Problem

Per-project memory currently lives at:

~/.claude/projects/<workspace-path-with-slashes-replaced-by-dashes>/memory/

For my workspace /Users/me/wrk/maven/maven-bugfixing/ that becomes:

~/.claude/projects/-Users-me-wrk-maven-maven-bugfixing/memory/

Three practical pains:

  1. Not relocatable. If I mv the workspace to a different path, all the per-project memory becomes orphaned — the encoded directory name no longer matches the new workspace location.
  2. Not visible in the IDE. With the workspace open in IntelliJ IDEA (or any IDE that shows the project tree), the memory files are out of sight. Reviewing what Claude Code has captured about the project requires leaving the IDE and navigating ~/.claude/projects/ by hand.
  3. Not shareable. Useful per-project context (workspace conventions, fork org targets, known footguns, ...) sits in a private home dir; if I share the workspace, the captured project context isn't part of it.

Proposed solution

Add a $PWD/.claude/ location for per-project memory, opt-in (or default):

  • If the workspace contains a .claude/memory/ directory (or .claude/MEMORY.md), Claude Code reads/writes there.
  • Otherwise, fall back to today's ~/.claude/projects/<encoded>/memory/ behavior.

Benefits:

  • Moving the workspace automatically carries its memory.
  • Memory files appear in the IDE filetree right next to source code and CLAUDE.md.
  • .gitignore-able or commit-able per the user's choice (share workspace conventions with the team, keep personal preferences out).

Alternatives considered

  • Manually copy ~/.claude/projects/<encoded>/memory/ to the new location on every workspace move — error-prone, easy to forget.
  • Stuff everything into a single CLAUDE.md in the workspace — works for static convention docs but not for the dynamic, file-per-fact auto-memory features Claude Code is designed around (one name/description/type per file makes future-Claude's selective recall efficient).

Edge case

When both $PWD/.claude/memory/ and ~/.claude/projects/<encoded>/memory/ exist for the same workspace, Claude Code could log a one-line notice and prefer the workspace one (documented precedence). Avoids silent drift after a partial migration.

Related

The current encoded path also creates a subtle pitfall: a session started from /Users/me/ matches project -Users-me/, which becomes a catch-all for everything under home. Per-project memory written during a sub-directory session can leak across sibling projects until the user notices and migrates by hand. Workspace-local .claude/ avoids this entirely.

View original on GitHub ↗

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