deny permissions in settings.json are not enforced – CLAUDE.md gets overwritten
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?
Description
Claude Code ignores deny rules in ~/.claude/settings.json. Despite explicitly denying write/edit access to CLAUDE.md files, Claude Code still modifies them, especially during commits.
Steps to Reproduce
Create ~/.claude/settings.json with deny rules for CLAUDE.md (Edit and Write for both local and all subdirectories)
Create a CLAUDE.md with project rules
Ask Claude Code to make changes and commit
CLAUDE.md gets overwritten
Expected Behavior
deny rules should be absolute. Claude Code should never touch files matching deny patterns.
Actual Behavior
Claude Code ignores deny rules and modifies CLAUDE.md anyway.
Workaround
Forced to use OS-level protection with chown root:root and chmod 644. This is not acceptable. Users should not need root permissions to protect config files from their own AI tool.
Environment
Claude Code latest, Debian Linux, Bash
Impact
CLAUDE.md contains critical project rules. When overwritten, Claude Code loses context and repeats the same mistakes – the exact problem CLAUDE.md is supposed to prevent.
Suggestion
What Should Happen?
Make deny rules enforced, not advisory
Add a protected_files config option
Never auto-modify CLAUDE.md without explicit user request
Error Messages/Logs
Steps to Reproduce
Create ~/.claude/settings.json with deny rules for CLAUDE.md (Edit and Write for both local and all subdirectories)
Create a CLAUDE.md with project rules
Ask Claude Code to make changes and commit
CLAUDE.md gets overwritten
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
Opus 4.5
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
VS Code integrated terminal
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗