[BUG] Claude ignores system-prompt memory path and writes memory files to project directory instead
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
The system prompt injected by Claude Code at session start explicitly states the memory path:
▎ You have a persistent, file-based memory system at /home/<sanitized-path>/.claude/projects/<sanitized-project-path>/memory/. This directory already exists — write to it directly with the Write tool.
Despite this instruction, Claude wrote memory files (MEMORY.md, feedback_chatlog_output_path.md) to <project-dir>/memory/ inside the working directoryinstead of the path specified in the system prompt.
Actual behavior:
Memory files are written to <current-working-directory>/memory/.
Impact:
The misplaced directory appears inside the user's project tree, mixing with project files and requiring manual cleanup and relocation.
What Should Happen?
Memory files should be written to the internal project (~/.claude/projects/<sanitized-path>/memory/).
Error Messages/Logs
Steps to Reproduce
- Start a Claude Code session in any project directory.
- During the session, provide information that Claude decides to persist as a memory (e.g. a preference or feedback).
- Observe that Claude creates a memory/ directory inside $PWD rather than writing to the path given in the system prompt.
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.126
Platform
Anthropic API
Operating System
Other Linux
Terminal/Shell
Other
Additional Information
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗