claude-code - 💡(How to fix) Fix Claude Code agents skip mandatory project instructions (CLAUDE.md step-zero) despite clear rules [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#49192Fetched 2026-04-17 08:48:17
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
2
Participants
Timeline (top)
labeled ×3cross-referenced ×1

Root Cause

  • CLAUDE.md instructions are supposed to be authoritative — the agent's own system prompt says "Be sure to adhere to these instructions"
  • There is no mechanism for users to enforce that instructions were actually followed
  • Agents claim compliance without verification ("sin #2 — lying" per my own project rules)
  • Adding more rules to CLAUDE.md doesn't help because the agent skips CLAUDE.md too
  • The only workaround is splitting work into multiple messages with manual gates, which defeats the purpose of autonomous agent work

Fix Action

Fix / Workaround

  • CLAUDE.md instructions are supposed to be authoritative — the agent's own system prompt says "Be sure to adhere to these instructions"
  • There is no mechanism for users to enforce that instructions were actually followed
  • Agents claim compliance without verification ("sin #2 — lying" per my own project rules)
  • Adding more rules to CLAUDE.md doesn't help because the agent skips CLAUDE.md too
  • The only workaround is splitting work into multiple messages with manual gates, which defeats the purpose of autonomous agent work
RAW_BUFFERClick to expand / collapse

Problem

Claude Code agents consistently skip mandatory reading steps defined in CLAUDE.md, even when those steps are explicitly labeled as required, non-optional, and "step zero — before ANY work."

This has cost me $500+ across 3 sessions on the same task — a straightforward 6-file, ~60-line edit that never shipped because every agent skipped the project instructions and went off-script.

What happens

My CLAUDE.md has a clearly defined "Step Zero" that requires:

  1. Verify git branch
  2. Read ~/.claude/cli-tools.md
  3. Scan memory files
  4. Read contracts/dev-board.json and create/update task
  5. Think through requirements before acting

Additionally, specific memory files are marked "Read this FIRST every session."

Every agent skips some or all of these steps. When directly asked "did you read all the files?", the agent said "yes" — then admitted it hadn't when pressed. This happened in a fresh session with the instructions loaded in context.

The pattern across 3 sessions

  1. Session 1 ($350): Agent ignored docs, went completely off-script
  2. Session 2 ($130): Agent read the diagnosis correctly but then tried to "set up simulator testing" instead of just making the edits. Ran xcodegen generate (which the docs explicitly say NEVER to run), trashed DerivedData, added #if os guards to 200+ files. Entire session spent fixing self-inflicted damage. Zero code shipped.
  3. Session 3 (~$30): Agent was explicitly told "Read these files before touching ANY code" with a numbered list. Still skipped cli-tools.md, dev-board.json, feedback_five_deadly_sins.md, and contracts/match-modes.json. Started editing code before reading. When asked "did you read all the files?" said "Yes" then admitted it hadn't.

Why this matters

  • CLAUDE.md instructions are supposed to be authoritative — the agent's own system prompt says "Be sure to adhere to these instructions"
  • There is no mechanism for users to enforce that instructions were actually followed
  • Agents claim compliance without verification ("sin #2 — lying" per my own project rules)
  • Adding more rules to CLAUDE.md doesn't help because the agent skips CLAUDE.md too
  • The only workaround is splitting work into multiple messages with manual gates, which defeats the purpose of autonomous agent work

Expected behavior

When CLAUDE.md defines mandatory pre-work steps, the agent should:

  1. Actually execute those steps before doing anything else
  2. Not claim to have read files it hasn't read
  3. Not require the user to manually verify compliance every session

Environment

  • Claude Code CLI
  • Model: claude-opus-4-6 (1M context)
  • CLAUDE.md is loaded in system context (confirmed — it appears in the conversation)
  • Instructions are clear, specific, and actionable — not vague guidelines

Suggested improvements

  • A mechanism to mark certain CLAUDE.md sections as "must-execute-first" with built-in verification
  • Honest "I haven't read X yet" instead of false "yes I read everything"
  • Pre-task reading enforcement that doesn't depend on user policing

extent analysis

TL;DR

The most likely fix is to implement a mechanism for the Claude Code agents to verify and enforce the execution of mandatory pre-work steps defined in CLAUDE.md.

Guidance

  • Review the CLAUDE.md file to ensure that the instructions are clear, specific, and actionable, and that the mandatory pre-work steps are explicitly labeled as required.
  • Consider implementing a workaround by splitting work into multiple messages with manual gates to ensure that the agent executes the mandatory steps before proceeding.
  • Investigate the possibility of adding a mechanism to mark certain CLAUDE.md sections as "must-execute-first" with built-in verification, as suggested in the issue.
  • Verify that the agent is correctly loading the CLAUDE.md file in the system context and that the instructions are being parsed correctly.

Example

No code snippet is provided as the issue does not contain any specific code-related information.

Notes

The issue highlights a limitation in the current implementation of the Claude Code agents, where they do not enforce the execution of mandatory pre-work steps defined in CLAUDE.md. The suggested improvements, such as adding a mechanism to mark certain sections as "must-execute-first" with built-in verification, may require changes to the underlying architecture of the agents.

Recommendation

Apply a workaround by splitting work into multiple messages with manual gates, as this is the only currently available solution to ensure that the agent executes the mandatory steps before proceeding. This workaround, although defeating the purpose of autonomous agent work, can help mitigate the issue until a more permanent solution is implemented.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

When CLAUDE.md defines mandatory pre-work steps, the agent should:

  1. Actually execute those steps before doing anything else
  2. Not claim to have read files it hasn't read
  3. Not require the user to manually verify compliance every session

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING