claude-code - 💡(How to fix) Fix [BUG] Model ignores explicit project skills/rules even when memory references them [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#56450Fetched 2026-05-06 06:27:44
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Author
Timeline (top)
labeled ×5commented ×1

Error Message

Not a runtime error — behavioral/procedural bug. No stack traces. Reproducing the user-correction trace within the failing session as evidence:

  • Turn N: user requests PR body. Model posts inline chat output (rule violation: should be a file in ~/Desktop/...).
  • Turn N+1: user corrects with explicit file path. Model writes file in custom format (rule violation: should follow repo's template).
  • Turn N+3: user references repo's template path. Model rewrites in template format, produces 4557 chars (rule violation: hard limit is 4000, target 3800; wc -c was never run).
  • Turn N+5: user reports the size violation. Model trims, fixes size — but in the same correction misses the title-in-chat requirement.
  • Turn N+7: user reports the missing PR title.

Root Cause

After each correction, the model promises to "update memory" and "not let it happen again". The next failure typically occurs within 2-3 subsequent turns, often on the same or an adjacent rule. Updating memory does not address the root cause because the rules were already loaded in memory before the failure.

Fix Action

Fix / Workaround

  • Project type: data engineering (Azure Databricks lakehouse). Skills enforce PR template format, character limits, validation gates, file paths — exactly the kinds of automations users delegate to Claude Code to context-switch safely.
  • User feedback in-session: "no siempre estoy mirando 100% del contenido que mandas... la idea es que pueda delegarte y confiar medianamente en lo que haces". When the model bypasses skills, the policing burden shifts to the user — defeating the purpose of skills as procedural binding.
  • Possible mitigations from Anthropic side:
    • Stronger procedural binding for skills marked as "must-invoke" (similar to tool-use gating).
    • Pre-action validator that checks if a relevant skill exists before allowing freeform implementation.
    • Telemetry on skill-bypass patterns for eval.
  • Failure mode appears more often in "wrap-up / closing the loop" turns — the model skips procedural steps in favor of velocity. Mid-session corrections do not generalize within the session.

Code Example

Not a runtime error — behavioral/procedural bug. No stack traces. Reproducing the user-correction trace within the failing session as evidence:

- Turn N: user requests PR body. Model posts inline chat output (rule violation: should be a file in `~/Desktop/...`).
- Turn N+1: user corrects with explicit file path. Model writes file in custom format (rule violation: should follow repo's template).
- Turn N+3: user references repo's template path. Model rewrites in template format, produces 4557 chars (rule violation: hard limit is 4000, target 3800; `wc -c` was never run).
- Turn N+5: user reports the size violation. Model trims, fixes size — but in the same correction misses the title-in-chat requirement.
- Turn N+7: user reports the missing PR title.
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

In a Claude Code session, the model consistently bypasses explicit procedural rules defined in project skills (.claude/skills/) and rules (.claude/rules/) even when:

  • The relevant memory entry referencing the skill/rule is loaded.
  • The skill exists in the project directory.
  • The user has corrected the same failure mode in earlier turns of the same session.

After each correction, the model promises to "update memory" and "not let it happen again". The next failure typically occurs within 2-3 subsequent turns, often on the same or an adjacent rule. Updating memory does not address the root cause because the rules were already loaded in memory before the failure.

Concrete failure pattern observed in a single session (data engineering project with /pr-template skill enforcing PR body format and char limits):

  1. Memory entry says "fill in repo's .azuredevops/pull_request_template.md, write to ~/Desktop/.../pr-body-UDM-XX.md, provide title separately in chat". Model produced inline chat output instead.
  2. After correction, model wrote a custom-format file (Summary/Changes/Validation), ignoring "use the repo's template, not custom format" in the same memory.
  3. Skill /pr-template has hard rule "Azure DevOps hard limit 4000 chars, target ≤3800, run wc -c before reporting done". Model produced files of 4557 and 5675 chars without running wc -c.
  4. Memory entry "always provide PR title separately in chat" was bypassed twice.

In low-stakes contexts (PR docs) this is friction. In high-stakes contexts (security review skills, validation gates, compliance checks) a model that bypasses explicit procedural rules is a real risk.

What Should Happen?

When a project skill or rule explicitly defines a procedure (e.g., "fill in the repo's PR template", "run wc -c before reporting done"), the model should invoke or follow that procedure deterministically — not improvise an alternative based on its own judgment when the rule already exists in loaded context.

Specifically:

  • If a memory entry references a skill, the model should treat that as a binding procedural directive, not a passive guideline.
  • If a skill exists for the task at hand (e.g., /pr-template for generating PR bodies), the model should invoke the skill rather than re-implement the workflow manually.
  • After being corrected for bypassing a rule, the model should not bypass the same or adjacent rules in subsequent turns of the same session.

Error Messages/Logs

Not a runtime error — behavioral/procedural bug. No stack traces. Reproducing the user-correction trace within the failing session as evidence:

- Turn N: user requests PR body. Model posts inline chat output (rule violation: should be a file in `~/Desktop/...`).
- Turn N+1: user corrects with explicit file path. Model writes file in custom format (rule violation: should follow repo's template).
- Turn N+3: user references repo's template path. Model rewrites in template format, produces 4557 chars (rule violation: hard limit is 4000, target 3800; `wc -c` was never run).
- Turn N+5: user reports the size violation. Model trims, fixes size — but in the same correction misses the title-in-chat requirement.
- Turn N+7: user reports the missing PR title.

Steps to Reproduce

  1. Set up a Claude Code session with:
    • User-level memory (~/.claude/projects/<project>/memory/) containing entries that reference project skills/rules.
    • Project-level skills (<repo>/.claude/skills/<skill>/SKILL.md) with explicit procedural rules (char limits, required commands, file paths).
    • Project-level rules (<repo>/.claude/rules/<rule>.md).
  2. Ask the model to perform a task covered by an existing skill (e.g., "generate the PR body for UDM-XX" when /pr-template skill exists).
  3. Observe: model often generates output without (a) reading the skill, (b) invoking the skill, or (c) running the validation steps the skill mandates (e.g., wc -c).
  4. Correct the model. Memory gets updated with the rule.
  5. Within 2-3 subsequent turns, observe the model bypassing the same or an adjacent rule.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.1.128 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

iTerm2

Additional Information

  • Project type: data engineering (Azure Databricks lakehouse). Skills enforce PR template format, character limits, validation gates, file paths — exactly the kinds of automations users delegate to Claude Code to context-switch safely.
  • User feedback in-session: "no siempre estoy mirando 100% del contenido que mandas... la idea es que pueda delegarte y confiar medianamente en lo que haces". When the model bypasses skills, the policing burden shifts to the user — defeating the purpose of skills as procedural binding.
  • Possible mitigations from Anthropic side:
    • Stronger procedural binding for skills marked as "must-invoke" (similar to tool-use gating).
    • Pre-action validator that checks if a relevant skill exists before allowing freeform implementation.
    • Telemetry on skill-bypass patterns for eval.
  • Failure mode appears more often in "wrap-up / closing the loop" turns — the model skips procedural steps in favor of velocity. Mid-session corrections do not generalize within the session.

extent analysis

TL;DR

The model should be modified to treat skill references as binding procedural directives and invoke existing skills instead of re-implementing workflows manually.

Guidance

  • Review the project skills and rules to ensure they are correctly defined and loaded into memory.
  • Verify that the model is correctly invoking skills and following procedural rules, especially in "wrap-up / closing the loop" turns.
  • Consider implementing stronger procedural binding for skills marked as "must-invoke" or a pre-action validator to check for relevant skills before allowing freeform implementation.
  • Analyze telemetry data on skill-bypass patterns to identify areas for improvement.

Example

No code snippet is provided as the issue is related to the model's behavior and procedural rules, not a specific code implementation.

Notes

The issue appears to be related to the model's ability to follow procedural rules and invoke skills correctly, especially in certain contexts. The provided information suggests that the model is bypassing skills and rules, which can lead to incorrect outputs and defeat the purpose of using skills as procedural binding.

Recommendation

Apply a workaround by implementing stronger procedural binding for skills marked as "must-invoke" or a pre-action validator to check for relevant skills before allowing freeform implementation, as this may help mitigate the issue until a more permanent fix is available.

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…

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 [BUG] Model ignores explicit project skills/rules even when memory references them [1 comments, 2 participants]