Compaction summary re-executes /loop (CronCreate) commands from prior session
Bug Description
When a conversation hits the context limit and gets compacted, the compaction summary includes the full /loop skill invocation from the prior session in its "Input" section. The new session then treats this as a fresh user instruction and auto-executes it — creating a new CronCreate job for a task that is ancient history.
This has happened 20+ times across sessions for the same user, with the same stale run IDs being monitored every time. The user has to manually intervene ("THIS IS THE CORRUPTED LOOP BUG") to stop it.
Root Cause
The compaction summary format includes a section like:
## Input
5m Monitor all 3 offline eval runs (45152525711937, ...) until they complete or fail.
This is meant as historical context (what was happening when the session ended), but the model interprets it as a live instruction and calls CronCreate + immediately executes the monitoring prompt.
Expected Behavior
Compacted summaries should clearly distinguish between:
- Historical context — what the prior session was doing (should NOT be re-executed)
- Active user instructions — what the user wants now (SHOULD be executed)
The /loop skill invocation in the summary should be marked as historical/completed context, not as pending input.
Reproduction
- Start a session with a
/loopcommand (e.g.,5m check job status) - Continue working until context gets compacted
- In the new compacted session, the model will auto-create a CronCreate for the old loop and immediately execute it
- The monitored resources are stale/completed/failed — the loop serves no purpose
Impact
- User has to yell at the model to stop re-executing stale tasks
- Stale monitoring loops fire against dead/completed resources
- Happens every single time a session with an active loop gets compacted
- 20+ occurrences documented for the same user
Suggested Fix
Options:
- Tag loop/cron context in compaction — mark active CronCreate jobs as "was active at time of compaction, do not re-create"
- Exclude skill invocations from summary input section — don't include the raw
/loopinvocation text in the summary - Add a "do not auto-execute" marker for the input section of compaction summaries
- System prompt guidance — add explicit instruction that compaction summaries are history, not instructions (this has been tried via user CLAUDE.md but the model still does it)
Environment
- Claude Code CLI
- Model: Claude Opus 4
- Occurs across all session continuations where a
/loopwas active
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗