- Home
- Skills
- Workflow Automation
- session-sweep
Session Sweep
Detect a Claude Code update and safely cycle stale cmux-hosted sessions (idle now; busy via interrupt-or-wait).
$10
Works with the AI Agents you already use
session-sweep
Example session with this skill installed
A new Claude Code version is out. Sweep the open cmux sessions. Preview with a dry run first, then cycle the idle stale panes. Ask me before interrupting a busy one.
- Read your context and instructions
- Compiled the session-sweep
Protocol lines from sweep.sh (interactive). Report these counts. Do not invent a cycle that did not print.
CYCLED <surface_id>
GRACE <surface_id>
INTERACTIVE_PROMPT <surface_id>
CYCLE_FAILED <surface_id>
| Line | Agent action |
|---|---|
CYCLED <surface_id> | Done for that pane. Verified back up on the new version. |
CYCLE_FAILED <surface_id> | Pane was respawned but did not come back in the verification window. Tell the user to look manually. Do not report it as updated. |
GRACE <surface_id> | Stale and idle, still inside the idle grace window (default 15 min, SWEEP_GRACE_SECONDS). No action. |
CYCLE <surface_id> | Dry-run preview only (sweep.sh --dry-run). Nothing was cycled. |
INTERACTIVE_PROMPT <surface_id> | Busy and stale. Ask Wait vs Interrupt. On Interrupt, run sweep.sh --force-cycle=<surface_id> and check the exit status. Non-zero with FORCE_CYCLE_FAILED means no resume command was found. |
Order: handle every other surface first, report the counts to the user, then optionally self-refresh this driver last via self-cycle /self-refresh. Skip that refresh if the driver is mid-task, a /goal is in flight, or background monitors still need to report.
If stdout looks empty, read state/last-sweep.log. Output filters can hide the protocol lines; prefer rtk proxy.
Connects securely to your tools. The creator never sees your data.
About this skill
session-sweep
Check for a Claude Code update and safely cycle open cmux-hosted sessions still on an older version. Idle sessions restart in place (same pane, same conversation via cmux's tracked resume). Busy sessions get an interrupt-or-wait choice.
Canonical repo: https://github.com/chendrizzy/session-sweep
Install: npx skills add chendrizzy/session-sweep
The engine is sweep.sh in that repo (with sweep.bats). This listing is the
operating procedure. It does not inline the script.
Companion: self-cycle (https://github.com/chendrizzy/self-cycle) for
refreshing this driver session last.
When to use
- User asks to update Claude Code sessions, refresh stale sessions, or mentions a new Claude Code version.
- Fleet of cmux panes; some still running an older
claudebinary. - Preview:
sweep.sh --dry-runbefore enabling any LaunchAgent.
When not to use
- Not on cmux — same hard dependency as self-cycle; no tmux/iTerm fallback.
- Background-agent surfaces (cmux cannot respawn/restore those).
- Looping
--force-cycleacross many surfaces (each call re-runsclaude updateand serializes on the lock) — cycle one, confirm, then next. - Refreshing your own driver mid-sweep — that must be last, via self-cycle
/self-refresh, and skipped if mid-task //goal/ pending monitors. - Trusting a missing version banner alone — verify with process age (
etime).
Permissions
| Need | Why |
|---|---|
sweep.sh + bash | Engine |
rtk proxy (recommended) | Prevents output filters from hiding protocol lines |
cmux with workspace-scoped respawn | Cycle panes in other workspaces |
claude update | Version bump + lock |
| AskUserQuestion | Busy stale sessions |
| Writable state / logs | state/last-sweep.log, optional LaunchAgent log |
Expected output
Run interactive mode:
rtk proxy ~/.claude/skills/session-sweep/sweep.sh --mode=interactive
If stdout looks empty, read state/last-sweep.log (mirrored each run).
| Line | Agent action |
|---|---|
CYCLED <surface_id> | Done for that pane |
CYCLE_FAILED <surface_id> | Tell user to look manually — do not claim updated |
GRACE <surface_id> | Waiting out idle grace; no action |
CYCLE <surface_id> | Dry-run preview only |
INTERACTIVE_PROMPT <surface_id> | AskUserQuestion Wait vs Interrupt; on Interrupt run --force-cycle=<id> and check exit status |
Order: handle all other surfaces first, report to the user, then optionally self-refresh this driver via self-cycle.
Install / enable notes (honest)
Scheduled LaunchAgent must not exec through an external-volume symlink (launchd
EX_CONFIG). Prefer a plist that runs /bin/bash <script> and logs under
~/Library/Logs/. Leave enable/disable to the operator.
Requires cmux. Not compatible with tmux or iTerm. Cannot refresh background-agent surfaces. Each cycle call serializes on the claude update lock.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 1 month ago
Requires
Permissions
Runs sweep.sh, reads cmux session state, and writes state/last-sweep.log. claude update takes the single-instance lock. Busy panes need an interrupt-or-wait choice before --force-cycle.