← ClaudeAtlas

self-compactlisted

Make THIS Claude Code session compact its own context and then automatically resume its outstanding work, by arming a detached watchdog that injects /compact into the session's own cmux pane and re-prompts it once compaction finishes. Use when the user asks a session or agent to self-compact, auto-compact, compact itself, compact and keep going, or free up its own context without losing the current task.
chendrizzy/self-cycle · ★ 0 · AI & Automation · score 73
Install: claude install-skill chendrizzy/self-cycle
# self-compact Compacts **your own** session, then re-prompts you so the work continues instead of stalling. ## Do this Write a continuation prompt describing **the actual outstanding work**, then run: ```bash ENGINE="${SELFCYCLE_HOME:-$HOME/.claude/skills/self-cycle}/selfcycle.sh" [ -f "$ENGINE" ] || ENGINE="$HOME/.agents/skills/self-cycle/selfcycle.sh" bash "$ENGINE" compact "<continuation prompt>" ``` The prompt is what future-you wakes up to, so make it specific: name the current task, the next concrete step, and anything already finished that must not be redone. A vague prompt is the main reason a resumed session dithers. Example: ```bash bash "$ENGINE" compact "Continue the payments-service retry refactor. The test fixtures are already seeded and all 12 migrations are applied - do not re-run them. Next step: extract the backoff helper out of worker.ts into lib/retry.ts, then update its three call sites. Do not ask the user what to do next." ``` **Then end your turn immediately.** Say one sentence telling the user you armed it. Do not start new work: anything you do after this races the compaction. ## Reading the result - `SELFCYCLE_ARMED mode=compact ...` — armed. The watchdog fires in ~8s and runs on its own. - `SELFCYCLE_ABORT <reason>` — **nothing was armed.** Tell the user the reason plainly, then STOP. Do not re-run the command, do not try a different spelling, and do not reach for `cmux` yourself: every successful arming types another `/compact`, so a