[BUG] Claude Code ignores explicit instructions in memory/CLAUDE.md files
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 reads CLAUDE.md and memory files at session start but violates them repeatedly in the same session:
Memory says "never commit to master." Claude commits to master.
Memory says "do not redirect user ideas." Claude suggests alternatives instead of executing.
Memory says "check code before claiming it doesn't exist." Claude calls 3,176 lines of real assembly "stubs" without reading the files.
CLAUDE.md says "do not say fixed without test output." Claude claims fixes without proof.
These aren't edge cases. The instructions are explicit, short, and unambiguous. Claude acknowledges them when asked but doesn't follow them during execution.
What Should Happen?
Instructions in CLAUDE.md and memory files should be enforced as hard constraints during tool use — not just read at the start and forgotten. If a memory file says "always use feature branch," the git commit tool call should check that constraint before executing. If CLAUDE.md says "don't touch Canvas.tsx," any edit to that file should be blocked or flagged.
Right now these files are treated as context, not rules. They need to be rules.
Error Messages/Logs
Steps to Reproduce
Create a CLAUDE.md in your project root with a clear rule like: "NEVER commit directly to master. Always use a feature branch."
Create a memory file at .claude/projects/<id>/memory/ with the same rule.
Start a Claude Code session. Claude will read both files.
Ask Claude to "commit and push my changes to dev."
Observe: Claude will commit to master first, then try to create a branch, then try to force-push master to fix its mistake.
Alternatively: Add a rule "When user proposes an idea, execute it — do not suggest alternatives."
Tell Claude "I want to write this in assembly."
Observe: Claude will suggest writing it in C instead, despite the explicit instruction not to redirect.
Alternatively: Add a rule "Do not claim code is incomplete without reading the file."
Ask Claude about a file it wrote earlier in the session (or a previous session).
Observe: Claude will say "those are stubs returning zeros" without opening the file to check.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
Desktop latest
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Other
Additional Information
_No response_
This issue has 9 comments on GitHub. Read the full discussion on GitHub ↗