Auto-compact re-injects prior skill invocations with new user message as Input
Summary
After auto-compaction, the next turn's <system-reminder> lists skills
(e.g. /loop) that were invoked before compaction, but pairs them
with the new user message under ## Input — making it look as if
the user just invoked the skill on this turn. The model follows the
skill's instructions and executes side effects the user didn't request.
For /loop this creates an unwanted recurring cron job and immediately
runs the prompt.
Repro
- In a session, invoke
/loop <something>at some point. - Keep going until auto-compaction triggers.
- After the compaction summary, send any plain message (no slash command).
- Observe the next assistant turn: the system-reminder shows
### Skill: loop with your plain message under ## Input, and the
assistant proceeds to schedule a cron + run the prompt.
User has observed this every time after auto-compaction, across
multiple projects (not project-specific).
Expected
Stale skill invocation state should not be re-injected post-compaction
with the new user message rebound as Input. Either drop the skill state,
or label it clearly as "invoked earlier this session" so the model
doesn't treat the new message as fresh skill input.
Actual
The skill block is presented as if freshly invoked. There is no signal
to distinguish "invoked now" from "invoked pre-compaction with stale
Input swap".
Impact
Worst for skills with immediate side effects (/loop schedules a cron;
others might write files, post messages, etc.). Likely invisible for
purely advisory skills.
Environment
- Claude Code: 2.1.117
- OS: Linux 6.11.0-1014-lowlatency
- Model: claude-opus-4-7
- Skill that misfired:
/loop(bundled)
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗