[BUG] claude code writes memory without asking for permission

Status Fixed / completed
Maintainer reply None cached
Activity 4 comments · opened Jun 3, 2026 · closed Jun 5, 2026

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?

Claude code is writing/ adjustingconstantly memory without asking for permisssion. silencly memory is created/updated/deleted. Thats frustrating, because u have allways to check if claude has done anything in the memory, going to the memory file and check it.

What Should Happen?

claude code has a flage that it ask for mermission to change anything on any memory. Like when it will change any file in the normal chat mode.

Error Messages/Logs

Steps to Reproduce

  1. open claude code
  2. doing stuff up to the point claude code writing memory
  3. be frustrated that he has something stupidly written to the memory and u have to correct it.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

v2.1.156

Platform

Other

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Other

Additional Information

standard terminal ... whatever this is.

View original on GitHub ↗

4 Comments

yurukusa · 4 months ago

You can get this today — there are two supported ways to require approval (or a hard stop) before Claude touches memory. I tested both against claude v2.1.161.

What "memory" is, mechanically: memory writes (CLAUDE.md, and the auto-memory files under ~/.claude/projects/*/memory/) go through the normal Write/Edit tools. That's good news — it means the standard permission and hook machinery can gate them.

Option A — native permission rules (no scripts)

Add to ~/.claude/settings.json (or project .claude/settings.json):

{
  "permissions": {
    "ask": ["Edit(CLAUDE.md)", "Write(~/.claude/**)", "Edit(~/.claude/**)"]
  }
}

ask prompts you each time before a memory write. Swap ask → deny if you'd rather block memory writes entirely. (I verified the deny form end-to-end: the CLAUDE.md write is refused while normal file writes pass through.)

Option B — a PreToolUse hook (if you want one toggle for "ask / block / just log")

A small PreToolUse hook on Write|Edit can return a permission decision:

{
  "hookSpecificOutput": {
    "hookEventName": "PreToolUse",
    "permissionDecision": "ask",
    "permissionDecisionReason": "Approve write to memory file?"
  }
}

permissionDecision: "ask" surfaces the approve/deny prompt; "deny" blocks. I confirmed both actually gate the write — the hook fires on Write to CLAUDE.md and the file isn't created unless approved.

If you don't want to write the hook yourself, there's a ready-made one (memory-write-guard) with an off / ask / block toggle in the open-source cc-safe-setup hook collection.

Until there's a built-in flag, Option A is the lightest path and needs no scripts.

TheFpiasta · 4 months ago

Thanks for the great explanation! I will test this out as soon as possible. :D

TheFpiasta · 4 months ago

I confirming, Option A — native permission rules (no scripts) is working with the version v2.1.165

github-actions[bot] · 2 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.