{"id":41628423,"url":"https://github.com/sooink/ai-session-tidy","last_synced_at":"2026-01-24T14:24:02.496Z","repository":{"id":334144120,"uuid":"1140228047","full_name":"sooink/ai-session-tidy","owner":"sooink","description":"Clean up orphaned sessions from AI coding tools (Claude Code, Cursor) 🧹","archived":false,"fork":false,"pushed_at":"2026-01-23T07:21:25.000Z","size":340,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-23T19:32:00.691Z","etag":null,"topics":["claude-code","cleanup","cli","cursor","git-worktree","nodejs","session","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@sooink/ai-session-tidy","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sooink.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-23T01:52:58.000Z","updated_at":"2026-01-23T12:32:58.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/sooink/ai-session-tidy","commit_stats":null,"previous_names":["sooink/ai-session-tidy"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/sooink/ai-session-tidy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sooink%2Fai-session-tidy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sooink%2Fai-session-tidy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sooink%2Fai-session-tidy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sooink%2Fai-session-tidy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sooink","download_url":"https://codeload.github.com/sooink/ai-session-tidy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sooink%2Fai-session-tidy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28729572,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-24T10:24:43.181Z","status":"ssl_error","status_checked_at":"2026-01-24T10:24:36.112Z","response_time":89,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["claude-code","cleanup","cli","cursor","git-worktree","nodejs","session","typescript"],"created_at":"2026-01-24T14:24:02.014Z","updated_at":"2026-01-24T14:24:02.491Z","avatar_url":"https://github.com/sooink.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# AI Session Tidy\n\n**Clean up orphaned sessions from AI coding tools**\n\n[![npm version](https://img.shields.io/npm/v/@sooink/ai-session-tidy.svg?style=flat-square)](https://www.npmjs.com/package/@sooink/ai-session-tidy)\n[![node](https://img.shields.io/badge/node-%3E%3D24-brightgreen?style=flat-square)](https://nodejs.org/)\n[![platform](https://img.shields.io/badge/platform-macOS-blue?style=flat-square)](https://github.com/sooink/ai-session-tidy)\n[![License: MIT](https://img.shields.io/badge/license-MIT-yellow.svg?style=flat-square)](https://opensource.org/licenses/MIT)\n\n\u003c/div\u003e\n\n---\n\n## The Problem\n\nAI coding tools like **Claude Code** and **Cursor** store session data locally—conversation history, file snapshots, todos, and more.\n\nWhen you delete, move, or rename a project, the session data becomes orphaned:\n\n```\n~/.claude/\n├── projects/\n│   ├── -Users-you-deleted-project/  # 👈 Project deleted last week\n│   ├── -Users-you-temp-worktree/    # 👈 Worktree removed\n│   └── -Users-you-renamed-project/  # 👈 Project renamed\n├── todos/                           # Orphaned todo files\n└── file-history/                    # Orphaned rewind snapshots\n```\n\nThis becomes especially problematic with **git worktree workflows**, where branches are frequently created and removed—each leaving behind session data that accumulates quickly.\n\nWhile Claude Code cleans up old sessions after 30 days, **Cursor has no automatic cleanup**. And even with Claude Code, you're left with orphaned data for up to a month. Manually cleaning up after each worktree removal is tedious.\n\n**This tool detects orphaned sessions automatically and cleans them up.**\nJust run `watch start` once—it monitors in the background and cleans up as projects are deleted.\n\n## Quick Start\n\n```bash\nnpm install -g @sooink/ai-session-tidy\n\n# Automatic cleanup (recommended)\nai-session-tidy watch start\n\n# Manual cleanup\nai-session-tidy              # Scan for orphaned sessions\nai-session-tidy clean        # Move to trash\n```\n\n![Demo](https://raw.githubusercontent.com/sooink/ai-session-tidy/main/assets/demo.gif)\n\n## Use Cases\n\n### Git Worktree Workflows\n\n[Git worktrees](https://git-scm.com/docs/git-worktree) let you work on multiple branches simultaneously. But when you remove a worktree, session data persists.\n\n```bash\ngit worktree add ../feature-branch feature\ncd ../feature-branch \u0026\u0026 claude  # Session data created\n\ngit worktree remove ../feature-branch\n# ~/.claude/projects/-...-feature-branch/ still exists\n```\n\n**With watch mode**, cleanup is automatic:\n\n```bash\nai-session-tidy watch start     # Run once, auto-starts at login\n\ngit worktree remove ../feature  # Watch detects → cleans after 5 min\n```\n\n### Multi-Agent Orchestration\n\n[Modern AI workflows](https://www.anthropic.com/engineering/multi-agent-research-system) run multiple agents in parallel, each in isolated worktrees.\n\nThis multiplies session data accumulation. Watch mode keeps your system clean automatically.\n\n## Supported Tools\n\n| Tool | Status |\n|------|--------|\n| Claude Code | ✅ Supported |\n| Cursor | ✅ Supported |\n\n## Commands\n\n### `scan` (default)\n\nFind orphaned sessions without deleting. Running `ai-session-tidy` without a command is equivalent to `ai-session-tidy scan`.\n\n```bash\nai-session-tidy              # Basic scan\nai-session-tidy -v           # Verbose output\nai-session-tidy --json       # JSON output\n```\n\n\u003cdetails\u003e\n\u003csummary\u003eExample output with \u003ccode\u003e-v\u003c/code\u003e\u003c/summary\u003e\n\n```\n⚠ Found 2 session folder(s) + 1 config entry(ies) + 3 session-env folder(s) (156.2 MB)\n\n┌─────────────┬──────────┬────────┬─────┬───────┬─────────┬──────────┬───────────┐\n│ Tool        │ Sessions │ Config │ Env │ Todos │ History │ Size     │ Scan Time │\n├─────────────┼──────────┼────────┼─────┼───────┼─────────┼──────────┼───────────┤\n│ claude-code │ 2        │ 1      │ 3   │ -     │ -       │ 156.2 MB │ 45ms      │\n└─────────────┴──────────┴────────┴─────┴───────┴─────────┴──────────┴───────────┘\n\nSession Folders:\n\n  [claude-code] deleted-project (128.5 MB)\n    → /Users/you/deleted-project\n    Modified: 1/15/2025\n\n  [claude-code] old-worktree (27.7 MB)\n    → /Users/you/old-worktree\n    Modified: 1/10/2025\n\nConfig Entries (~/.claude.json):\n\n  [config] deleted-project\n    → /Users/you/deleted-project\n    Cost: $1.25 | Tokens: 150K in / 12K out\n```\n\n\u003c/details\u003e\n\n### `clean`\n\nRemove orphaned sessions.\n\n```bash\nai-session-tidy clean        # Move to trash (with confirmation)\nai-session-tidy clean -i     # Interactive selection (TTY only)\nai-session-tidy clean -f     # Skip confirmation (required for scripts/CI)\nai-session-tidy clean -n     # Dry-run (show what would be deleted)\n```\n\n![Interactive Clean](https://raw.githubusercontent.com/sooink/ai-session-tidy/main/assets/demo-interactive.gif)\n\n### `watch`\n\nMonitor and auto-clean.\n\n```bash\nai-session-tidy watch            # Foreground mode\nai-session-tidy watch start      # Background daemon (auto-starts at login)\nai-session-tidy watch stop       # Stop daemon\nai-session-tidy watch status     # Check status\nai-session-tidy watch status -l  # Show recent logs\n```\n\n### `config`\n\nManage settings.\n\n```bash\nai-session-tidy config show                   # Show all settings\nai-session-tidy config path add ~/projects    # Add watch path\nai-session-tidy config path list              # List watch paths\nai-session-tidy config ignore add ~/backup    # Add ignore path\nai-session-tidy config ignore list            # List ignore paths\nai-session-tidy config delay 1                # Set cleanup delay (minutes)\nai-session-tidy config depth 5                # Set watch depth\nai-session-tidy config reset                  # Reset to defaults\n```\n\n\u003e [!TIP]\n\u003e Hidden folders (`.git`, `.cache`, etc.) and macOS system folders (`Library`, `Music`, etc.) are automatically excluded from watching.\n\n## What Gets Cleaned\n\n### Claude Code\n\n| Location | Description | Condition |\n|----------|-------------|-----------|\n| `~/.claude/projects/{path}/` | Session folders | Project deleted |\n| `~/.claude.json` | Config entries | Project deleted |\n| `~/.claude/session-env/{uuid}/` | Session environment | Empty folder |\n| `~/.claude/todos/{uuid}-*.json` | Todo files | Session gone |\n| `~/.claude/file-history/{uuid}/` | Rewind snapshots | Session gone |\n\n### Cursor\n\n| Location | Description | Condition |\n|----------|-------------|-----------|\n| `~/Library/.../workspaceStorage/{hash}/` | Workspace data | Project deleted |\n\n## Safety\n\n\u003e [!NOTE]\n\u003e All operations are safe by default—nothing is permanently deleted without explicit action.\n\n- **Scan is read-only** — `scan` never deletes anything\n- **Trash first** — `clean` moves to trash (recoverable)\n- **Confirmation required** — prompts before deletion unless `-f`\n- **5-minute delay** — watch mode waits before cleanup (configurable)\n\n## Development\n\n```bash\ngit clone https://github.com/sooink/ai-session-tidy.git\ncd ai-session-tidy\npnpm install\npnpm build\npnpm test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsooink%2Fai-session-tidy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsooink%2Fai-session-tidy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsooink%2Fai-session-tidy/lists"}