Feature request: Store project memory files in project-local .claude folder
Current Behavior
Project-specific memory files are stored in a global path:
~/.claude/projects/<encoded-project-path>/memory/MEMORY.md
Desired Behavior
Store memory files inside the project's own .claude/memory/ folder, e.g.:
<project-root>/.claude/memory/MEMORY.md
This is more intuitive — when working on multiple projects with separate sessions, users naturally expect each project's memory to live within that project's directory, not in a centralized global location.
Concern: Accidental Git Commits
Memory files contain personal session history and should never be committed to version control. To address this:
- If memory files are created in a project-local
.claude/folder (whether by user request or via a future feature/option), Claude Code should automatically ensure.claude/memory/is listed in.gitignorebefore any git commit. - If
.gitignoredoesn't exist, create it with the entry. - If
.gitignoreexists but doesn't include the path, append it.
This would make the feature safe by default while keeping the project structure clean and self-contained.
Additional Context
The project-level .claude/ folder already exists for shared settings like CLAUDE.md. Adding a memory/ subfolder there (with proper .gitignore protection) would be a natural extension of the existing structure.
Showing cached comments. Read the full discussion on GitHub ↗
6 Comments
I support this. The way currently memories are stored is fragile - it would break if any of the directories along the path to the project on users' disk is renamed or the project directory is moved. And it indeed makes it difficult to share across machines and share with team. This is simply a bad design.
Temporary workaround: I did put instructions in ~/.claude/CLAUDE.md to override this (and store those memories in <project>/CLAUDE_NOTES.md.
Idea: Allow relative paths in autoMemoryDirectory from project settings
I've been running into the same fragmentation issues described here and in related issues (#25947, #24382, #25739, #24789, #30668).
While exploring workarounds, I realized that many of these issues might be addressed by a relatively small change: allowing
autoMemoryDirectoryto accept relative paths from project-level.claude/settings.json.Example: Per-project isolated memory
Example: Shared memory across worktrees
This would let users decide their own memory structure — isolated per project, shared across worktrees, or synced across machines via Git.
Current blockers (as far as I can tell)
autoMemoryDirectoryis blocked from project-level settings for security reasonsA possible compromise
To address the security concern, perhaps relative paths could be restricted to stay within the project tree (e.g., allow
./.claude/memoryor../sharedMemorybut reject paths that escape the project root).Just an idea — would love to hear if others think this approach could work or if there are concerns I'm missing.
Need this as well. Relative paths to the memory folder in a repo is broken in
settings.local.json. Always requires an absolute path.For my case, I want to set the automemory location to
<PROJECT|REPO-ROOT>/.claude/memoryand I want to be able to commit it to the repo (I'd prefer an auto-commit option too). I was really confused when my cloud container on claude.ai/code didn't have the memory context after a long session, and eventually (hours) found that autoMemoryDirectory in my settings.json was pointed at an absolute path from my local computer, which doesn't exist in the container. Tried setting it to a relative path instead, but the cloud container/session still didn't load it — relative values aren't accepted (docs say absolute or ~/ only), so there's currently no value that can express "inside this repo" across environments.Related:
This is very highly-requested and worth noting this would solve a _lot_ of bugs, including #54066, #62059, #14696, and #45700. @bcherny
Fanning your list out into bullets, which GH parses a title preview for links with a bullet, so they are easier to read for people scanning this thread: