{
  "markdown": "# Session Sweep — Claude Code Plugin\n\nAutomatically scan your system, find all session artifacts left behind by Claude Code (stale git worktrees, dangling refs, orphaned directories), safely remove them, and report how much disk space you reclaimed.\n\n## Why You Need This\n\nEvery Claude Code task creates a **git worktree** — a full working copy of your repository under `~/.claude/worktrees/`. These do not get cleaned up automatically. After a few days of heavy use:\n\n- 80 tasks × 500 MB repo = **40 GB wasted**\n- Disk fills up silently\n- System slows down\n\nThis plugin gives you a single command to find and purge all stale session artifacts.\n\n## Installation\n\n```bash\nclaude plugin add github:WenyuChiou/session-sweep\n```\n\n## Prerequisites\n\n- **git** must be installed and available in your PATH. Verify with `git --version`.\n- Claude Code CLI installed (see [claude.ai/code](https://claude.ai/code))\n- macOS, Linux, or Windows (PowerShell required on Windows)\n\n## Usage\n\nInvoke directly:\n\n```\n/session-sweep\n```\n\nOr just describe what you want — Claude handles the rest:\n\n```\nMy computer has been sluggish since I started using Claude Code heavily. Can you clean up?\nClean up worktrees in my data-pipeline repo\nSet up a daily cleanup at 3 AM so I never have to think about this again\n```\n\n## Examples\n\n### Basic: system is slow, clean everything up\n\nYou notice your MacBook fan is running constantly and Finder shows 12 GB less free space than last week.\n\n> **You:** My computer is slow and I'm running out of disk space. Can you clean up after Claude Code?\n\nSession Sweep scans `~/.claude/worktrees/`, finds 83 stale directories from the past week of coding sessions, checks that none are currently locked by an active session, then bulk-removes them and prunes the dangling git refs.\n\n```\n=== Session Sweep Report ===\n\nScanned: 4 repositories\nRemoved: 83 stale worktrees\nPruned:   6 dangling git refs\n\n  data-pipeline/    41 removed   (1.3 GB freed)\n  my-app/           28 removed   (870 MB freed)\n  scripts/           9 removed   (95 MB freed)\n  dotfiles/          5 removed   (18 MB freed)\n\nTotal space freed: 2.3 GB\nActive worktrees kept: 1 (your current session)\n```\n\n---\n\n### Targeted: clean a specific repo\n\nYou're about to push a large branch and want to free space in one specific project without touching anything else.\n\n> **You:** Clean up stale worktrees in my data-pipeline repo only.\n\nSession Sweep scopes the sweep to that repo's worktree container, leaving other repos untouched.\n\n```\n=== Session Sweep Report (targeted) ===\n\nRepository: ~/projects/data-pipeline\nRemoved: 41 stale worktrees\nPruned:   2 dangling git refs\n\nTotal space freed: 1.3 GB\nActive worktrees kept: 0 (no active sessions in this repo)\n```\n\n---\n\n### Scheduled: set it and forget it\n\nAfter your first cleanup you realize this is going to keep accumulating.\n\n> **You:** Set up a daily cleanup at 3 AM so I never have to think about this again.\n\nSession Sweep creates a scheduled task that runs nightly, keeping your disk clean automatically. You get a summary the next morning if anything was removed.\n\n```\nScheduled task created: session-sweep\n  Runs daily at 03:00 local time\n  Next run: tomorrow at 3:00 AM\n\nTo cancel: \"remove the daily session sweep\"\n```\n\n## What Gets Cleaned\n\n**Before** — after a week of heavy Claude Code use across 5 repos:\n\n```\n~/.claude/worktrees/\n├── aged-maxwell/          ← stale (session ended 6 days ago)\n├── bold-turing/           ← stale\n├── calm-hopper/           ← stale\n├── deft-lovelace/         ← ACTIVE (current session — kept)\n├── eager-dijkstra/        ← stale\n│   ... 79 more stale dirs\n```\n\nOn Windows, this is `C:\\Users\\<you>\\.claude\\worktrees\\`.\n\n- **83 stale worktrees** across 4 repos\n- **~1.3 GB** wasted in data-pipeline alone; **~2.3 GB** total\n- Git still tracking 6 refs to directories that no longer exist\n\n**After** — session sweep completes (typically under a minute):\n\n```\n~/.claude/worktrees/\n└── deft-lovelace/         ← your active session, untouched\n```\n\n- Only the live session remains\n- All dangling git refs pruned\n- 2.3 GB reclaimed\n\n## What It Does\n\n1. **Discovers** all `~/.claude/worktrees/` directories on your system\n2. **Measures** disk usage before cleanup\n3. **Checks safety** — skips active sessions (locked worktrees), never touches the main working tree, validates paths before deleting\n4. **Removes** stale worktrees (bulk delete + `git worktree prune`)\n5. **Prunes** dangling git refs left behind by orphaned sessions\n6. **Reports** total space freed, per-repo breakdown\n\n## Platform Support\n\n| Platform | Status |\n|----------|--------|\n| macOS    | ✅ Full support |\n| Linux    | ✅ Full support |\n| Windows  | ✅ Full support (PowerShell + cmd fallback) |\n\n## License\n\nMIT — see [LICENSE](./LICENSE)\n",
  "bytes": 4767,
  "sha": "ad6d27ba6d5b88f3637d8a54d03e854208bf62ec46fceaa37a5668ae59de149f",
  "repo_slug": "wenyuchiou/session-sweep",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/plg_wenyuchiou_session_sweep_session_sweep_c2484bca/readme"
}