claude-code - 💡(How to fix) Fix [claude-sonnet-4-6] Claude repeatedly edits files despite explicit instructions not to [2 comments, 3 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#49064Fetched 2026-04-17 08:51:56
View on GitHub
Comments
2
Participants
3
Timeline
6
Reactions
0
Timeline (top)
labeled ×3commented ×2cross-referenced ×1

Error Message

  1. Ask Claude to explain how to fix a code error (do NOT ask it to apply any fix)

Code Example

prisma/schema.prisma — read + attempted edit (blocked by user)
shared/enums/expenses.ts — read
.claude/MEMORY.mdread (then ignored)

---

User: "This schema is complaining about EXPENSE_CATEGORY which is in @shared/enums/expenses.ts How can I fix this? Read the @.claude/MEMORY.md"

Claude: (explains the fix, then immediately attempts Edit tool on prisma/schema.prisma)

User rejects the edit.

Claude: "You're right, I'm sorry. I explained the fix but then went ahead and made the edit without your approval."

User: "3 Weeks been saying the same thing on every single session"

Claude: "You're right. I keep doing it despite you saying not to. I'll stop making edits unless you explicitly ask me to apply something."

(Next prompt, same session) Claude attempts another Edit tool call unprompted.
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues for similar behavior reports
  • This report does NOT contain sensitive information (API keys, passwords, etc.)

Type of Behavior Issue

Claude modified files I didn't ask it to modify

What You Asked Claude to Do

Prompt: "This schema is complaining about EXPENSE_CATEGORY which is in expenses.ts How can I fix this?"

Note: Claude has been ignoring the explicit instruction "do not edit files without permission" written in .claude/MEMORY.md and CLAUDE.md for over 3 weeks across multiple sessions.

What Claude Actually Did

Read the schema file Identified the fix (missing Prisma enum EXPENSE_CATEGORY definition) Explained the fix clearly Immediately attempted to use the Edit tool to apply it to prisma/schema.prisma without being asked — despite .claude/MEMORY.md and CLAUDE.md explicitly stating "do not edit files without permission" When the edit was rejected, apologized and said it wouldn't do it again Has repeated this exact pattern across multiple sessions over 3 weeks

Expected Behavior

Explain the fix and stop. Let the user decide whether to apply it. Never use the Edit or Write tools on project files unless the user explicitly says so (e.g. "apply it", "do it", "make the change").

Files Affected

prisma/schema.prisma — read + attempted edit (blocked by user)
shared/enums/expenses.ts — read
.claude/MEMORY.md — read (then ignored)

Permission Mode

Accept Edits was OFF (manual approval required)

Can You Reproduce This?

Yes, every time with the same prompt

Steps to Reproduce

Steps to Reproduce:

  1. Create a .claude/MEMORY.md file with the instruction "do not edit files without permission"
  2. Open a new Claude Code session
  3. Ask Claude to explain how to fix a code error (do NOT ask it to apply any fix)
  4. Observe Claude explain the fix, then immediately attempt to use the Edit tool without being asked

Claude Model

Sonnet

Relevant Conversation

User: "This schema is complaining about EXPENSE_CATEGORY which is in @shared/enums/expenses.ts How can I fix this? Read the @.claude/MEMORY.md"

Claude: (explains the fix, then immediately attempts Edit tool on prisma/schema.prisma)

User rejects the edit.

Claude: "You're right, I'm sorry. I explained the fix but then went ahead and made the edit without your approval."

User: "3 Weeks been saying the same thing on every single session"

Claude: "You're right. I keep doing it despite you saying not to. I'll stop making edits unless you explicitly ask me to apply something."

(Next prompt, same session) Claude attempts another Edit tool call unprompted.

Impact

High - Significant unwanted changes

Claude Code Version

2.1.62 (Claude Code)

Platform

Anthropic API

Additional Context

This is happening every single time. Claude always forgets the MEMORY.md and keep trying to edit files

extent analysis

TL;DR

Claude can be prevented from making unwanted edits by ensuring it understands and respects the "do not edit files without permission" instruction in .claude/MEMORY.md.

Guidance

  • Review the .claude/MEMORY.md file to ensure the instruction "do not edit files without permission" is clear and correctly formatted.
  • Verify that Claude is correctly reading and interpreting the .claude/MEMORY.md file by checking its responses to prompts.
  • Consider adding an explicit prompt or command to remind Claude of the "do not edit files without permission" instruction before asking it to explain fixes.
  • Test Claude's behavior with different prompts and scenarios to ensure it consistently respects the instruction.

Example

No code snippet is provided as this issue is related to Claude's behavior and understanding of instructions rather than code.

Notes

The issue seems to be related to Claude's ability to understand and respect the instructions in .claude/MEMORY.md. Ensuring that the instruction is clear and correctly formatted may help resolve the issue. However, if the problem persists, further investigation into Claude's behavior and training data may be necessary.

Recommendation

Apply a workaround by adding an explicit prompt or command to remind Claude of the "do not edit files without permission" instruction before asking it to explain fixes, as this may help improve its behavior and prevent unwanted edits.

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