claude-code - 💡(How to fix) Fix ask permission rules with path patterns don't override auto-allow for memory directory [2 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#49235Fetched 2026-04-17 08:47:00
View on GitHub
Comments
2
Participants
2
Timeline
7
Reactions
0
Timeline (top)
labeled ×5commented ×2

When autoMemoryEnabled: false is set and memory writes go through the standard Write/Edit tools, patterned ask permission rules targeting the memory directory are silently ignored. Bare ask and patterned deny rules work correctly for the same path. This was discovered when I was trying to require user confirmation for memory writes via ask rules in settings.json.

Root Cause

Non-memory files in ~/.claude/projects/ prompt by default (outside project directory), so those results are baseline behaviour, not caused by my rules.

Fix Action

Fix / Workaround

Workarounds

Code Example

deny (patterned) > ask (bare) > [internal memory auto-allow] > ask (patterned) > default
RAW_BUFFERClick to expand / collapse

Summary

When autoMemoryEnabled: false is set and memory writes go through the standard Write/Edit tools, patterned ask permission rules targeting the memory directory are silently ignored. Bare ask and patterned deny rules work correctly for the same path. This was discovered when I was trying to require user confirmation for memory writes via ask rules in settings.json.

Environment

  • Claude Code version: latest (2026-04-16)
  • OS: Windows 11 Enterprise 10.0.26100
  • Settings location: ~/.claude/settings.json (global user settings)
  • autoMemoryEnabled: false

Investigation

I tested three permission configurations, each with four operations (Write new / Edit existing, for both memory and non-memory files in ~/.claude/projects/):

ConfigNon-memory WriteNon-memory EditMemory WriteMemory Edit
No permissionsPromptedPromptedAuto-allowedAuto-allowed
ask: ["Write", "Edit"]PromptedPromptedPromptedPrompted
ask: ["Write(~/.claude/projects/*/memory/*)", "Edit(~/.claude/projects/*/memory/*)"]PromptedPromptedAuto-allowedAuto-allowed

Non-memory files in ~/.claude/projects/ prompt by default (outside project directory), so those results are baseline behaviour, not caused by my rules.

I additionally tested deny with the same pattern:

ConfigMemory WriteMemory Edit
deny: ["Write(~/.claude/projects/*/memory/*)", ...]BlockedBlocked

Key finding: The path pattern itself matches correctly — deny with the pattern blocks memory writes. But ask with the identical pattern does not prompt. Bare ask (no pattern) does prompt.

Suspected cause

The memory directory appears to have an internal auto-allow that is evaluated after deny and bare ask, but before patterned ask. This means patterned ask rules can never override it. The evaluation order appears to be:

deny (patterned) > ask (bare) > [internal memory auto-allow] > ask (patterned) > default

This is a theory based on observed behaviour — I don't have visibility into the permission evaluation internals.

Expected behaviour

ask: ["Write(~/.claude/projects/*/memory/*)"] should prompt for confirmation on memory file writes, the same way bare ask: ["Write"] does. Patterned and bare ask rules should have equal priority relative to any internal auto-allow.

Workarounds

  • Bare ask: ["Write", "Edit"] works but prompts for all writes/edits, not just memory
  • deny works with patterns but blocks entirely rather than prompting
  • CLAUDE.md instruction as soft enforcement (relies on model compliance)

Related issues

  • #29098 — Permission patterns don't match paths resolved to relative form
  • #39340 — Absolute vs ~ path normalization mismatch (duplicate of #29098)

Note: those issues describe path matching failures. This issue is distinct — the pattern matches (proven by deny working), but ask specifically is overridden for memory paths.

extent analysis

TL;DR

The most likely fix is to modify the permission evaluation order to prioritize patterned ask rules over the internal memory auto-allow.

Guidance

  • Verify the suspected cause by testing the permission evaluation order with different rule combinations to confirm that the internal auto-allow is indeed overriding patterned ask rules.
  • Consider using the deny rule with a pattern as a temporary workaround, although this will block memory writes entirely rather than prompting for confirmation.
  • Review related issues #29098 and #39340 to ensure that path matching is working correctly, as this could be a contributing factor to the problem.
  • Experiment with modifying the ask rule pattern to see if a different pattern or syntax can bypass the internal auto-allow.

Example

No code snippet is provided as the issue is related to configuration and permission rules rather than code.

Notes

The root cause of the issue is not explicitly stated, and the suspected cause is based on observed behavior. Therefore, the guidance provided is based on the information available and may need to be adjusted if further details become available.

Recommendation

Apply the deny rule with a pattern as a temporary workaround, as it is the most straightforward solution that can be implemented with the current configuration. This will block memory writes entirely rather than prompting for confirmation, but it can help prevent unintended writes until a more permanent solution is found.

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING