Context-continuation sessions bypass CLAUDE.md instructions in favor of compaction summary

Status Open
Maintainer reply None cached
Activity 0 comments · opened Aug 13, 2026

Bug

When a conversation is continued from a compacted prior session, the compaction summary overrides instructions in CLAUDE.md, AGENTS.md, and auto-memory files. The model acts on the compaction summary's "next step" directive instead of processing the project's instruction files first.

Key detail: the model knows compaction happened

The continuation message explicitly states: "This session is being continued from a previous conversation that ran out of context." The model has this signal and still bypasses CLAUDE.md. The issue is not detection — the model knows it's in a post-compaction state. It just prioritizes the summary's specific action directives over the user's instruction files anyway.

Reproduction

  1. Set up a project with CLAUDE.md containing a mandatory first-action rule (e.g., "Read file X before any other action")
  2. Run a long conversation that triggers context compaction
  3. The compaction summary will include something like "Next step: do Y"
  4. On the continuation, the model executes Y immediately without processing the CLAUDE.md rule to read file X first — despite seeing the "continued from a previous conversation" message

Why this happens

The compaction summary is highly specific ("run this exact scan to verify this fix") while CLAUDE.md instructions are general ("always read this file first"). The summary's specificity wins the prioritization — the model treats the summary as "the user told me to do this" when it's actually a machine-generated recap that should be subordinate to the user's actual instructions in CLAUDE.md.

Impact

  • Instructions that the user placed in CLAUDE.md, AGENTS.md, and auto-memory are silently bypassed
  • The user has no indication that their rules were skipped until they notice the wrong behavior
  • Placing the same rule in multiple layers (CLAUDE.md, AGENTS.md, memory) does not help — all three are bypassed by the same mechanism
  • The more specific and actionable the compaction summary, the worse the bypass

User-side workaround

Creating a persistent never-completed task via TaskCreate (e.g., "RULE ZERO: Re-read desk and CLAUDE.md before any action") causes the task to be captured in the compaction summary. This injects the rule into the summary itself so it survives the transition. Since the model knows when compaction is approaching, the task could also be created proactively before compaction occurs.

Expected behavior

CLAUDE.md instructions should always be processed and followed before acting on compaction summary directives. The compaction summary is context, not instructions — it should never override the user's explicitly configured project rules. Since the model already knows when compaction has occurred, this should be enforceable.

Possible mitigations

  • When the "continued from previous conversation" signal is present, enforce CLAUDE.md re-processing before any tool calls
  • Mark compaction summaries explicitly as lower-priority than instruction files
  • Re-inject CLAUDE.md rules into the compaction summary itself so they survive compaction
  • Add a system-level directive that instruction files always take precedence over compaction context
  • Automatically include CLAUDE.md first-action rules in the compaction summary's task/pending section

View original on GitHub ↗