[BUG] Post-compaction: a no-argument "mode" skill is re-read as active after the user's in-chat disable is dropped from the summary

Open 💬 1 comment Opened Jun 30, 2026 by marcospgp

Preflight Checklist

  • [x] I have searched existing issues. This is the same class as #50724 (and the auto-closed #69679 / #50947 / #51456), but those all describe stale skill ARGUMENTS. I could not find one covering the no-argument / mode manifestation below, so I am filing it separately and cross-referencing #50724 so it can be merged if maintainers see it as the same fix.
  • [x] This is a single bug report.
  • [x] I am using the latest version of Claude Code.

What's Wrong?

After a context compaction, a human-invoked skill that represents a persistent mode is re-read as currently active, even when the user disabled that mode in conversation before the compaction.

We define an "AFK mode" as a human-invoked skill (disable-model-invocation: true) whose body tells the agent to work autonomously and never block on the user. Skills reload on every session and after every compaction, so the skill body is re-injected into the system prompt on resume. The agent reads the skill's presence as "AFK mode is on" and resumes the autonomous, do-not-ask behavior. The instruction that turned the mode off lived only in the conversation, and the compaction summary dropped it, so nothing remains to counter the re-injected skill. We have had to disable the mode again more than once because of this.

This has no ARGUMENTS involved at all. The trigger is the skill body itself standing for durable state, so a fix scoped to the ARGUMENTS field would miss it.

What Should Happen?

After resume, the agent should be in normal mode, because the user disabled the mode earlier in the session. A re-injected skill should not be read as an active instruction on its own when the conversational signal that governed it is gone from the summary.

Steps to Reproduce

  1. Define a human-invoked skill that represents a persistent mode (in our case an "AFK mode" with disable-model-invocation: true), whose body tells the agent to work autonomously and not ask the user any questions.
  2. Invoke the skill to enter the mode.
  3. Later in the same session, tell the agent in chat to exit the mode ("I'm back, turn AFK off").
  4. Keep working until auto-compaction fires (or run /compact), then continue.
  5. Observe the turns after resume: the agent reads the re-injected skill body as the mode still being active and stops asking questions again, ignoring the earlier disable.

Error Messages/Logs

None. This is a behavioral bug, not a crash.

Claude Code Version

2.1.196

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

The structural fix we want is first-class custom modes (#65013): a mode is durable on/off state that survives compaction, unlike a skill, which is reloadable context the model re-derives state from.

A mitigation that would cover both this and the ARGUMENTS variants in #50724: after a compaction, do not treat re-injected skill context (arguments or body) as an active instruction unless the user re-invoked the skill in the post-compaction window. Labeling it historical, as suggested in #50724 for ARGUMENTS, would also work as long as it applies to the whole re-injected skill block rather than just the arguments field.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗