Compaction summary re-executes /loop (CronCreate) commands from prior session

Resolved 💬 5 comments Opened Apr 18, 2026 by batchprocess128 Closed Apr 24, 2026

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:

  1. Historical context — what the prior session was doing (should NOT be re-executed)
  2. 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

  1. Start a session with a /loop command (e.g., 5m check job status)
  2. Continue working until context gets compacted
  3. In the new compacted session, the model will auto-create a CronCreate for the old loop and immediately execute it
  4. 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:

  1. Tag loop/cron context in compaction — mark active CronCreate jobs as "was active at time of compaction, do not re-create"
  2. Exclude skill invocations from summary input section — don't include the raw /loop invocation text in the summary
  3. Add a "do not auto-execute" marker for the input section of compaction summaries
  4. 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 /loop was active

View original on GitHub ↗

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