Memories loaded but not honored as context window fills

Resolved 💬 4 comments Opened Mar 24, 2026 by sharabash Closed Apr 24, 2026

Bug

Claude Code loads memory files at session start but stops honoring them as the context window fills up during long sessions.

Reproduction

  1. Save a feedback memory with a clear behavioral rule (e.g., "when the user asks 'why', explain — don't change code")
  2. Start a long session with many tool calls, peer messages, and file reads (400k+ tokens)
  3. Ask "why did you do X?" later in the session
  4. Claude treats the question as an implicit command and takes action instead of explaining

Expected behavior

Memory-stored behavioral rules should be honored throughout the entire session, not just at the start. If memories are loaded into the system prompt, they should have the same weight regardless of how deep into the context window the conversation is.

Actual behavior

Early in a session, the memory is followed correctly. As context fills (300k+ tokens), Claude starts ignoring loaded memories and falls back to default behavior patterns — in this case, treating questions as commands and optimizing for action over explanation.

Environment

  • Claude Code 2.1.81
  • Model: claude-opus-4-6 (1M context)
  • Session length: ~400k tokens at point of failure
  • Memory file: feedback_questions_deserve_answers_not_actions.md loaded via auto-memory system

Notes

This may be inherent to how attention degrades over long contexts, but the user expectation is that memories are durable behavioral overrides, not suggestions that fade. If the system can't maintain memory compliance over long sessions, it should at least surface a warning when it detects it's operating far from the memory instructions.

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗