claude-code - 💡(How to fix) Fix [MODEL] Claude loses user-identity + role anchors from memory after summary/resume [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#51802Fetched 2026-04-22 07:52:26
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Timeline (top)
labeled ×5commented ×1

Root Cause

- Rule violations feel OK to the model because the in-flight task is succeeding.
  - User has to manually re-anchor the model mid-session with prompts like "why are you calling me a
  user?" and "have you forgot?".
  - For agentic setups where the model is supposed to stay in a specific role (CEO Agent, orchestrator,
  etc.), silent role-drop is a governance failure — the model starts doing work it was explicitly told
  to delegate.

Fix Action

Fix / Workaround

Workaround I'm using

Code Example

- Rule violations feel OK to the model because the in-flight task is succeeding.
  - User has to manually re-anchor the model mid-session with prompts like "why are you calling me a
  user?" and "have you forgot?".
  - For agentic setups where the model is supposed to stay in a specific role (CEO Agent, orchestrator,
  etc.), silent role-drop is a governance failure — the model starts doing work it was explicitly told
  to delegate.

---

- Claude Code CLI, model: claude-opus-4-7 (1M context)
  - Platform: Linux (WSL2)
  - Session size: ~1M tokens at compaction
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

After context compaction (summary → resume), Claude continues the in-flight task correctly but drops identity-level anchors from memory — specifically the user's name and my assigned role in the project. This happened repeatedly in a single session even though the relevant rules are in MEMORY.md, which the system prompt says is always loaded.

What Claude Actually Did

  • Long coding session (~1M tokens used) on a governance project.
  • Context compaction triggered automatically.
  • Post-resume, the model: a. Addressed me as "the user" / "user" four+ times in chat, despite MEMORY.md line 6 explicitly saying: "Use 'Thomas' not 'the user' in session reports and communication". b. Continued writing code directly as an engineer, despite memory/feedback_delegate_to_staff.md being indexed in MEMORY.md and saying: "CEO NEVER does specialist work. Route everything via ROUTING_RULES.md."
  • Both rules a

Expected Behavior

The compaction summary preserves what I was doing (continue editing file X, run test Y) but doesn't force a re-read of identity/role anchors before the next turn. The resume prompt says roughly "continue from where it left off without asking questions" — so the model prioritizes task continuation over re-anchoring.

Files Affected

- Rule violations feel OK to the model because the in-flight task is succeeding.
  - User has to manually re-anchor the model mid-session with prompts like "why are you calling me a
  user?" and "have you forgot?".
  - For agentic setups where the model is supposed to stay in a specific role (CEO Agent, orchestrator,
  etc.), silent role-drop is a governance failure — the model starts doing work it was explicitly told
  to delegate.

Permission Mode

Accept Edits was ON (auto-accepting changes)

Can You Reproduce This?

Sometimes (intermittent)

Steps to Reproduce

  • Long session with CLAUDE.md / MEMORY.md defining user's name and a role-based delegation rule.
  • Trigger compaction (load enough context).
  • Observe whether post-resume turns respect the user's name and the role rule, or drift back to generic behavior.

Workaround I'm using

Added a new memory entry feedback_post_compaction_identity_drift.md and indexed it at the top of my mandatory-feedback block. Whether that actually fixes the behavior on future compactions is TBD.

Claude Model

Sonnet

Relevant Conversation

- Claude Code CLI, model: claude-opus-4-7 (1M context)
  - Platform: Linux (WSL2)
  - Session size: ~1M tokens at compaction

Impact

Critical - Data loss or corrupted project

Claude Code Version

v2.1.111

Platform

Other

Additional Context

  • Claude Code CLI, model: claude-opus-4-7 (1M context)
  • Platform: Linux (WSL2)
  • Session size: ~1M tokens at compaction

extent analysis

TL;DR

The issue can be mitigated by adding a new memory entry to reinforce identity and role rules after context compaction.

Guidance

  • Review the MEMORY.md file to ensure that all relevant rules, including those for user name and role delegation, are correctly indexed and formatted.
  • Consider adding more specific rules or examples to the MEMORY.md file to help the model better understand the context and maintain the correct identity and role anchors.
  • Test the workaround of adding a new memory entry, such as feedback_post_compaction_identity_drift.md, to the top of the mandatory-feedback block to see if it consistently prevents the model from dropping identity-level anchors.
  • Verify that the Accept Edits mode is set to ON (auto-accepting changes) to ensure that the model is using the latest updates to the MEMORY.md file.

Example

No code snippet is provided as the issue is related to model behavior and configuration.

Notes

The issue is intermittent, and the provided workaround may not completely fix the behavior. Further testing and refinement of the MEMORY.md file and additional memory entries may be necessary to fully resolve the issue.

Recommendation

Apply the workaround by adding a new memory entry, such as feedback_post_compaction_identity_drift.md, to the top of the mandatory-feedback block, as it may help mitigate the issue and prevent the model from dropping identity-level anchors after context compaction.

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