claude-code - 💡(How to fix) Fix Memory system cannot delete files — only create/overwrite [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#46871Fetched 2026-04-12 13:30:52
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Author
Timeline (top)
labeled ×3commented ×1

The auto-memory system can create and update memory files via the Write tool, but cannot delete them. The Bash tool's sandbox does not include ~/.claude/projects/ in its write-allowed paths, so rm is blocked. The Write tool has no delete capability.

Root Cause

The auto-memory system can create and update memory files via the Write tool, but cannot delete them. The Bash tool's sandbox does not include ~/.claude/projects/ in its write-allowed paths, so rm is blocked. The Write tool has no delete capability.

Fix Action

Fix / Workaround

  1. Save a memory (e.g., "remember that X") — works fine
  2. Ask to forget/delete the memory — rm fails with Read-only file system
  3. Only workaround is overwriting the file with empty content, leaving orphan files on disk
RAW_BUFFERClick to expand / collapse

Summary

The auto-memory system can create and update memory files via the Write tool, but cannot delete them. The Bash tool's sandbox does not include ~/.claude/projects/ in its write-allowed paths, so rm is blocked. The Write tool has no delete capability.

Steps to reproduce

  1. Save a memory (e.g., "remember that X") — works fine
  2. Ask to forget/delete the memory — rm fails with Read-only file system
  3. Only workaround is overwriting the file with empty content, leaving orphan files on disk

Expected behavior

When the user asks to forget a memory, the agent should be able to delete the corresponding file and remove it from MEMORY.md.

Possible fixes

  • Add ~/.claude/projects/*/memory/ to the Bash sandbox write-allow list
  • Or provide a dedicated Delete tool for file removal
  • Or add a delete parameter to the Write tool

🤖 Generated with Claude Code

extent analysis

TL;DR

The most likely fix is to add the memory file directory to the Bash sandbox's write-allowed paths to enable deletion.

Guidance

  • Identify the specific directory path that needs to be added to the Bash sandbox's write-allowed list, which is ~/.claude/projects/*/memory/.
  • Verify that adding this path does not introduce security risks by reviewing the sandbox's configuration and access controls.
  • Consider implementing one of the proposed fixes: adding the path, creating a Delete tool, or modifying the Write tool to include a delete parameter.
  • Test the chosen solution to ensure that memory files can be deleted successfully and that the MEMORY.md file is updated accordingly.

Example

No code snippet is provided as the issue does not imply a specific code change.

Notes

The chosen solution should balance the need for file deletion with security considerations to prevent unauthorized access or modifications.

Recommendation

Apply a workaround by adding ~/.claude/projects/*/memory/ to the Bash sandbox's write-allowed paths, as this is the most straightforward solution that directly addresses the issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

When the user asks to forget a memory, the agent should be able to delete the corresponding file and remove it from MEMORY.md.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING