[BUG] Claude Code ignores AGENTS.md rules and doesn't act as gatekeeper
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?
Problem:
Claude Code does not reliably read project rule files (AGENTS.md, CLAUDE.md)
Even when it claims to have read them, it ignores explicit rules like "Do not modify this file unless user explicitly requests"
Claude Code modifies backend files (controllers, API functions) without asking, even when rules forbid this
No gatekeeper behavior - it acts first, doesn't stop to ask
Comparison:
Codex (OpenAI) correctly:
Reads documentation files
Follows project rules
Stops and asks before making changes
Produces correct API/function code
Impact:
Broken backend code (400 errors)
User has to review every change manually
Trust is lost - user cannot rely on Claude Code for backend work
Expected behavior:
Mandatory reading of AGENTS.md at session start
Actually enforce "stop and ask" rules
Don't override user-defined restrictions
What Should Happen?
Problem:
Claude Code does not reliably read project rule files (AGENTS.md, CLAUDE.md)
Even when it claims to have read them, it ignores explicit rules like "Do not modify this file unless user explicitly requests"
Claude Code modifies backend files (controllers, API functions) without asking, even when rules forbid this
No gatekeeper behavior - it acts first, doesn't stop to ask
Comparison:
Codex (OpenAI) correctly:
Reads documentation files
Follows project rules
Stops and asks before making changes
Produces correct API/function code
Impact:
Broken backend code (400 errors)
User has to review every change manually
Trust is lost - user cannot rely on Claude Code for backend work
Expected behavior:
Mandatory reading of AGENTS.md at session start
Actually enforce "stop and ask" rules
Don't override user-defined restrictions
Error Messages/Logs
Steps to Reproduce
Problem:
Claude Code does not reliably read project rule files (AGENTS.md, CLAUDE.md)
Even when it claims to have read them, it ignores explicit rules like "Do not modify this file unless user explicitly requests"
Claude Code modifies backend files (controllers, API functions) without asking, even when rules forbid this
No gatekeeper behavior - it acts first, doesn't stop to ask
Comparison:
Codex (OpenAI) correctly:
Reads documentation files
Follows project rules
Stops and asks before making changes
Produces correct API/function code
Impact:
Broken backend code (400 errors)
User has to review every change manually
Trust is lost - user cannot rely on Claude Code for backend work
Expected behavior:
Mandatory reading of AGENTS.md at session start
Actually enforce "stop and ask" rules
Don't override user-defined restrictions
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.0.74 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗