[claude-sonnet-4-6] Claude repeatedly edits files despite explicit instructions not to

Resolved 💬 3 comments Opened Apr 16, 2026 by teledirigido Closed May 26, 2026

Preflight Checklist

  • [x] I have searched existing issues for similar behavior reports
  • [x] 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

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗