[BUG] Claude Code agents consistently ignore STOP directives in CLAUDE.md files during session initialization

Resolved 💬 5 comments Opened Jun 28, 2025 by stevepresley Closed Aug 20, 2025

Environment

  • Platform (select one):
  • [ ] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [X] Other: Claude Code IDE agents
  • Claude CLI version: <!-- output of claude --version -->
  • Operating System: <!-- e.g. macOS 14.3, Windows 11, Ubuntu 22.04 -->
  • Terminal: <!-- e.g. iTerm2, Terminal App -->

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:

  1. Immediately stop all file reading
  2. Not read additional project files
  3. Not update todos or make assumptions
  4. Ask user what to work on
  5. 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.

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗