← ClaudeAtlas

sessionslisted

Sweep Claude Code Desktop sessions — classify which are finished, check their worktrees are safe to discard, write resume stubs, and archive the safe ones. Use for "archive finished sessions", "session cleanup", "how many sessions do I have open".
djnsty23/claude-auto-dev · ★ 3 · AI & Automation · score 65
Install: claude install-skill djnsty23/claude-auto-dev
# Sessions Archive sessions whose work is done, without destroying work that isn't. ## Why this is not a one-liner `archive_session` stops the session process **and cleans up its git worktree**. So the risky part is never "which sessions look finished" — it is "which worktrees are actually disposable". On the first real run, two sessions that looked finished held live work: one had 2 uncommitted files, one had a branch that existed nowhere but that disk. A naive sweep deletes both. The sweep therefore fails closed. A worktree it cannot read is unsafe, not safe. ## Step 1 — classify (read-only, archives nothing) ```bash node "${CLAUDE_PLUGIN_ROOT}/scripts/session-sweep.js" ``` Verdicts: | verdict | meaning | |---|---| | `MERGED` | every PR settled (merged or closed) — finished | | `STALE` | no PR, and idle past its threshold | | `PR-OPEN` | at least one PR still open — **not** finished | | `ACTIVE` | recent activity — leave alone | Three thresholds, because "finished" and "cold" are different questions: - **`--stale-days` (default 14)** for hand-started work. - **`--ephemeral-days` (default 2)** for sessions the app launched from a schedule. These are disposable by construction — the task regenerates them tomorrow — and they dominate the population: on the machine this was built for, 261 of ~480 records carried a `scheduledTaskId`. - **`--merged-min-minutes` (default 30)** floors the MERGED verdict. A settled PR bypasses the idle clock entirely, so without t