claude-code - 💡(How to fix) Fix CLAUDE.md rules are not applied proactively — repeatedly requires user correction [1 comments, 2 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#47840Fetched 2026-04-15 06:40:51
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Author
Timeline (top)
labeled ×2commented ×1subscribed ×1

Root Cause

CLAUDE.md contains a rule requiring the assistant to state "You asked me to" and "This action connects because" before every Edit or Write tool call. Despite this being recorded in CLAUDE.md and in memory files, the assistant consistently fails to apply this rule until explicitly corrected by the user each time.

Code Example

## Before Using Edit or Write
Before calling Edit or Write, state:
- You asked me to: [user's words]
- This action connects because: [why this action fulfills the instruction]
RAW_BUFFERClick to expand / collapse

Problem

CLAUDE.md contains a rule requiring the assistant to state "You asked me to" and "This action connects because" before every Edit or Write tool call. Despite this being recorded in CLAUDE.md and in memory files, the assistant consistently fails to apply this rule until explicitly corrected by the user each time.

Pattern observed

The same behavior repeats across sessions:

  1. Rule is violated (Edit/Write called without stating the connection)
  2. User points it out
  3. Assistant apologizes and states it will comply
  4. Rule is violated again at the next occurrence

The assistant acknowledges it cannot autonomously form the habit — the rule is known but not applied at the moment of tool invocation.

Impact

  • User must repeatedly intervene to enforce their own documented rules
  • Trust in CLAUDE.md as an effective instruction mechanism is undermined
  • Wasted tokens and context from repeated corrections

Steps to reproduce

Add the following to CLAUDE.md:

## Before Using Edit or Write
Before calling Edit or Write, state:
- You asked me to: [user's words]
- This action connects because: [why this action fulfills the instruction]

Observe whether the assistant applies this rule proactively without user prompting.

Expected behavior

Assistant states the connection before every Edit/Write call without being prompted.

Actual behavior

Assistant skips this step and only applies it after being corrected by the user.

Suggestion

This type of rule likely needs structural enforcement (e.g., a pre-tool-call hook or prompt injection at the tool invocation point), not just documentation in a file that the model may fail to consult at the right moment.

extent analysis

TL;DR

Implementing a pre-tool-call hook or prompt injection mechanism may be necessary to enforce the rule requiring the assistant to state the connection before every Edit or Write call.

Guidance

  • Review the current implementation of the Edit and Write tools to identify where the rule can be programmatically enforced, potentially through a hook or injection point.
  • Consider modifying the tool invocation process to always prompt the assistant for the required statements before proceeding with the action.
  • Investigate if there are existing mechanisms or APIs that can be leveraged to enforce this rule, such as custom prompts or preprocessing steps.
  • Evaluate the feasibility of integrating the rule enforcement into the assistant's core logic to ensure consistent application across sessions.

Example

No specific code snippet can be provided without knowing the exact implementation details of the Edit and Write tools or the assistant's architecture.

Notes

The effectiveness of this approach may depend on the flexibility and customizability of the underlying system, as well as the ability to modify or extend the assistant's behavior.

Recommendation

Apply a workaround by implementing a pre-tool-call hook or prompt injection mechanism, as this approach directly addresses the observed issue and has the potential to provide a consistent and reliable solution.

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

Assistant states the connection before every Edit/Write call without being prompted.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix CLAUDE.md rules are not applied proactively — repeatedly requires user correction [1 comments, 2 participants]