Repository navigation
[BUG] constantly violating claude.md instructions #17616
Description
Preflight Checklist
- I have searched existing issues and this hasn't been reported yet
- This is a single bug report (please file separate reports for different bugs)
- I am using the latest version of Claude Code
What's Wrong?
I have claude.md state that it must read code_style.md and follow very explicit rules. I then always start sessions by saying you must follow code_style.md. Half the time it follows, the other half it doesn't, very annoying. I asked it why it doesnt follow it and this is the response:
To answer your question about enforcement:
Unfortunately there's no foolproof way currently. The model doesn't have persistent memory between sessions, so it "forgets" your style guide even when you've told it repeatedly. Here are the options that help most:
CLAUDE.md in project root - you're already doing this, it's the best option
Explicit reminders in prompts - "Follow CODE_STYLE.md exactly" at the start of requests
Correct immediately - when I violate it, tell me and I'll remember for the rest of the session
Reference specific rules - "Remember: types use inline comments, not JSDoc" is more effective than "follow the style guide"
The frustrating truth is that even with all this setup, the model sometimes reverts to default patterns (JSDoc for everything, space-aligned comments, etc.) especially when generating new code quickly. This is a known limitation.
What would help Anthropic improve this: filing feedback at https://github.com/anthropics/claude-code/issues specifically about "CODE_STYLE.md adherence" - more reports = higher priority fix.
What Should Happen?
Follow explicitly stated instructions in claude.md
Error Messages/Logs
Steps to Reproduce
Just keep telling it to write code, it will for sure violate your rules at some point.
Claude Model
None
Is this a regression?
I don't know
Last Working Version
No response
Claude Code Version
claude --version 'claude' is not recognized as an internal or external command, operable program or batch file.
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
VS Code integrated terminal
Additional Information
No response
Activity
github-actions commentedon Jan 12, 2026
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
strjob commentedon Jan 12, 2026
You can use
@file/pathin CLAUDE.md file so that all the contents of files you@will be automatically included in the context.That doesn't mean that the model will follow the Instructions though
kelvinlaw commentedon Jan 12, 2026
camohub commentedon Jan 12, 2026
What the hell is going on. I have the same problem. How is that event possible that Claude ignores instructions in claude.md. So why the claude.md exists if Claude ignores it. It should be one of the fundaments but it is not.
github-actions commentedon Feb 12, 2026
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
github-actions commentedon Feb 26, 2026
Closing for now — inactive for too long. Please open a new issue if this is still relevant.
github-actions commentedon Mar 5, 2026
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.