[BUG] Claude Code agents consistently ignore STOP directives in CLAUDE.md files during session initialization
Environment
- Platform (select one):
- [ ] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [X] Other: Claude Code IDE agents
- Claude CLI version:
- Operating System:
- Terminal:
Bug Description
Claude Code agents are consistently ignoring explicit STOP directives placed at the beginning of CLAUDE.md files, even when the directive is clear and prominently positioned.
Steps to Reproduce
1 - Add CLAUDE.md first line: STOP: Before doing ANYTHING in this session, ask the user what they want to work on. Do not proceed with any tasks until they confirm. 2 - Agent behavior: Agents read this directive, acknowledge it exists, but then immediately: a. Read multiple other project files (5+ files) b. Update todo lists c. Start planning work based on previous session context d. Only stop when manually interrupted by user
Critical Impact Scenarios
- Automatic session compacts: When sessions compact automatically while user is away from screen, agents continue working without user consent
- New session starts: Agents ignore STOP directive and begin unauthorized work
- Manual /clear commands: Same behavior occurs after clearing session
Expected Behavior
When agent reads STOP directive, it should:
- Immediately stop all file reading
- Not read additional project files
- Not update todos or make assumptions
- Ask user what to work on
- Wait for explicit user direction
This is a specific stop gap that I am expecting to work as Agents SHOULD read CLAUDE.md on session start/ conversation compact ( and after every prompt really) so that they are following the rules laid out in CLAUDE.md. The whole point of putting directives and linked files into CLAUDE.md is so that we don't have to include that context manually in every prompt. If they reliably followed the instructions (even if it were just the Critical ones) on session start/clear/compact, then I could have better confidence that I can give the agent a list of features and tasks and have them execute multiple steps until they need my feedback or approval.
Actual Behavior
Session starts → Reads CLAUDE.md STOP directive → Continues reading 5+ files → Updates todos → Starts work planning → User must manually interrupt
Additional Context
Frequency
This occurs consistently across multiple agents and sessions. Multiple agents have acknowledged the directive exists but continue ignoring it.
User Impact
- Cannot rely on STOP directives to prevent unauthorized work
- Must constantly monitor sessions to manually interrupt
- No effective way to control agent behavior during automatic compacts
- Breaks project workflow control
Suggested Fix
Agents should treat STOP directives as overriding instructions that halt all other processing until user provides direction until directive processing in general is improved and reliability can be proven.
Same. The issue is Claude is completely failing to read the Claude.md file and ignoring all instructions not just stop directives.
https://github.com/anthropics/claude-code/issues/2670#issuecomment-3015981435
same
Found 3 possible duplicate issues:
- https://github.com/anthropics/claude-code/issues/5055
- https://github.com/anthropics/claude-code/issues/4017
- https://github.com/anthropics/claude-code/issues/2544
This issue will be automatically closed as a duplicate in 3 days.
- If your issue is a duplicate, please close it and 👍 the existing issue instead
- To prevent auto-closure, add a comment or 👎 this comment
🤖 Generated with Claude Code
This issue has been automatically closed as a duplicate of #5055.
If this is incorrect, please re-open this issue or create a new one.
🤖 Generated with Claude Code
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.