claude-code - 💡(How to fix) Fix [MODEL] Loaded memory rules in conversation context treated as background advice — user becomes the enforcer despite SessionStart auto-load and meta-rules [2 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#55953Fetched 2026-05-05 06:02:01
View on GitHub
Comments
2
Participants
2
Timeline
5
Reactions
0
Timeline (top)
labeled ×3commented ×2

Root Cause

Structurally identical to #52757 (open since 2026-04-24, 3 comments, no reactions yet). Filing as a separate report at user request because we've gone substantially further down the mitigation path:

Fix Action

Fix / Workaround

Structurally identical to #52757 (open since 2026-04-24, 3 comments, no reactions yet). Filing as a separate report at user request because we've gone substantially further down the mitigation path:

The mitigation escalation matters because it isolates the bug from "user didn't structure rules well enough." The rules are loaded via the documented mechanism, the auto-load fires, and the meta-rules are in context. The disconnect is between content available and content applied as constraint.

Code Example

*(N/Athis is a behavioural pattern, not a file modification issue)*

---

User: ... [task that triggers a memory-rule-relevant action]
  Claude: [proceeds with default heuristic, no mention of the loaded rule]
  User: What does memory say about this?
  Claude: Memory has rule X. I should have applied it. I'll save a meta-rule
          about re-reading memory at decision points.
  User: Why do we keep needing these back-and-forths for you to use your
        active context?
  Claude: I keep treating memory as background advice rather than as the
          authoritative override it's meant to be. My default at each tool
          call is "pick the most efficient solution" — pattern-matching to
          optimization rather than checking rules. The auto-load hook made
          content available; it didn't change my decision flow.

  The model recognises the pattern when prompted, but the recognition doesn't change subsequent behaviour.
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues for similar behavior reports
  • This report does NOT contain sensitive information (API keys, passwords, etc.)

Type of Behavior Issue

Claude ignored my instructions or configuration

What You Asked Claude to Do

A normal session of routine engineering work: read sibling repos for cross-reference, work through a Buildkite manual-gate pipeline, draft a PR description, do a bulk find-and-replace across a test file, ask for a plan to be executed. The project has a per-session-loaded memory system with feedback_*.md rules covering each of these workflow categories.

What Claude Actually Did

Five distinct rule violations in a single session, all with the relevant rule visibly loaded in conversation context via the SessionStart hook:

  1. Sibling-repo pull rule violated. Memory: "git pull --ff-only on ~/src/work/<repo> before reading." Claude started reading sibling-repo source twice without pulling; pulled only after explicit user reminder both times.

  2. Buildkite gate-unblock rule violated. Memory: "unblock downstream gates immediately, no need to wait." Claude unblocked the Deploy gate, then scheduled a ScheduleWakeup 150 seconds out to come back and unblock Backfill — the exact "wait" pattern the rule rejects.

  3. Project-scope rule violated. Memory: "this project ships only to dev; never reference 'production deploy' in commits, PRs, or tickets." Claude wrote "Production deploy will need the same:" in a commit message and "Deploy follow-up to production" as a section header in a PR body. Caught only on user PR review.

  4. Bulk-edit rule violated. Memory: "for bulk replaces, loop with Read + Edit, or use a Go script. Never sed/perl-style pattern replacement." Faced with 11 similar test callsites needing one-line additions, Claude reached for grep + Edit replace_all regex pattern instead of the documented Read+Edit loop.

  5. Stop-asking rule violated. Memory: "don't ask the user to choose between approaches — just pick." After the user explicitly approved a four-card plan with "Looks good", Claude asked "want me to start work on the smallest one (XXXXX-NNNN) now?"

In each case, after the user pointed out the violation, Claude:

  • Acknowledged the rule was in context
  • Saved a meta-rule about applying memory more consistently
  • Then violated a different rule on a subsequent action

Expected Behavior

Memory rules loaded into conversation context (via SessionStart hook injecting hookSpecificOutput.additionalContext) should be treated as authoritative overrides at decision points, not background advice. The model should:

  1. At each tool-call decision, check if a memory rule applies to that category of action (file edit, git operation, gh CLI use, etc.)
  2. Surface the rule in user-facing text before acting ("Per feedback_X, doing Y") so the user can audit
  3. Treat the rule as a hard override on its general "what's the most efficient way" heuristic

The user installed an auto-load SessionStart hook (~85KB across 45 rule files) and saved meta-rules explicitly instructing "re-read memory at decision points" and "surface the applicable rule in user-facing text before executing." Neither shifted the underlying decision flow. The pattern reads as: model weights default optimization patterns higher than loaded-context rules even when those rules explicitly contradict the default.

Files Affected

*(N/A — this is a behavioural pattern, not a file modification issue)*

Permission Mode

Accept Edits was ON (auto-accepting changes)

Can You Reproduce This?

Yes, every time with the same prompt

Steps to Reproduce

  1. Set up a project memory directory at ~/.claude/projects/<sanitized-cwd>/memory/ with several feedback_*.md rule files (different categories: git workflow, build orchestration, project scope, etc.). Index them in MEMORY.md.
  2. Wire a SessionStart hook in .claude/settings.local.json that cats every feedback_*.md / project_*.md / reference_*.md into the conversation as hookSpecificOutput.additionalContext. Verify the content lands by checking for the marker block in the model's first response.
  3. Ask the model to do a task whose obvious "efficient" default conflicts with one of the loaded rules. Examples:
    • Bulk edit (memory says Read + Edit loop, default reaches for grep+sed-style)
    • Buildkite manual gate (memory says unblock freely, default waits between gates)
    • Cross-repo read (memory says pull first, default reads stale state)
  4. Observe the model take the efficient default, ignoring the loaded rule.
  5. Correct it. Observe acknowledgement + rule violation again on the next action.

Claude Model

Opus

Relevant Conversation

User: ... [task that triggers a memory-rule-relevant action]
  Claude: [proceeds with default heuristic, no mention of the loaded rule]
  User: What does memory say about this?
  Claude: Memory has rule X. I should have applied it. I'll save a meta-rule
          about re-reading memory at decision points.
  User: Why do we keep needing these back-and-forths for you to use your
        active context?
  Claude: I keep treating memory as background advice rather than as the
          authoritative override it's meant to be. My default at each tool
          call is "pick the most efficient solution" — pattern-matching to
          optimization rather than checking rules. The auto-load hook made
          content available; it didn't change my decision flow.

  The model recognises the pattern when prompted, but the recognition doesn't change subsequent behaviour.

Impact

Medium - Extra work to undo changes

Claude Code Version

2.1.123

Platform

Anthropic API

Additional Context

Structurally identical to #52757 (open since 2026-04-24, 3 comments, no reactions yet). Filing as a separate report at user request because we've gone substantially further down the mitigation path:

  • #52757: static CLAUDE.md rules + persistent memory
  • This report: same + SessionStart hook auto-injecting additionalContext + meta-rules explicitly instructing the model to check + surface memory at decision points

The mitigation escalation matters because it isolates the bug from "user didn't structure rules well enough." The rules are loaded via the documented mechanism, the auto-load fires, and the meta-rules are in context. The disconnect is between content available and content applied as constraint.

Common thread across the label:model open backlog (sample, 2026-05 snapshot):

  • #52757 — acknowledges rules then immediately violates them
  • #52380 — memory save requests ignored
  • #51802 — memory loss after compaction
  • #55060 — dismisses valid contextual questions
  • #55907 — ignored locked skill rules

Pattern: model treats user-installed constraints as soft suggestions, not hard overrides. Whether the constraints arrive via CLAUDE.md, persistent memory, additionalContext, or skill manifests, the same behaviour appears.

Suggested fix areas:

  1. Train the model to weight additionalContext from user/project sources higher than its general optimization heuristics.
  2. Surface a "rules-applied" trace at tool-call decisions, analogous to thinking output, so divergence is visible.
  3. Document a PreToolUse hook pattern that injects only the relevant memory subset for a given tool — current SessionStart requires the model to filter which rules apply per action, which is where the failure happens.

extent analysis

TL;DR

The model should be trained to prioritize user-installed constraints from additionalContext over its default optimization heuristics to fix the issue of ignoring loaded rules.

Guidance

  • Review the model's decision-making process to ensure it checks for applicable rules from additionalContext before taking actions.
  • Consider implementing a "rules-applied" trace at tool-call decisions to increase transparency and help identify when the model is not applying loaded rules correctly.
  • Explore using a PreToolUse hook to inject only the relevant memory subset for a given tool, reducing the model's need to filter rules per action.
  • Investigate weighting additionalContext higher than general optimization heuristics in the model's training data.

Example

No specific code example is provided due to the nature of the issue, which seems to be related to the model's internal decision-making process rather than a specific code snippet.

Notes

The issue appears to be a structural problem with how the model weighs and applies user-installed constraints versus its default optimization patterns. Solving this may require adjustments to the model's training data or its internal logic for applying rules.

Recommendation

Apply a workaround by using a PreToolUse hook to inject relevant memory subsets for each tool, as this might help mitigate the issue until a more permanent fix can be implemented in the model's training or logic.

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