Desktop app: auto-clean orphaned Code sessions from sidebar

Resolved 💬 3 comments Opened Apr 1, 2026 by nathanjohnpayne Closed Apr 5, 2026

Problem

The Claude desktop app's Code tab sidebar accumulates orphaned sessions over time. These are sessions whose working directory no longer exists (e.g., deleted projects, removed git worktrees). They clutter the sidebar and show "Folder no longer exists. Please start a new session." when clicked, but there's no way to dismiss or bulk-remove them from the UI.

Current workaround

Manually deleting session JSON files from:

~/Library/Application Support/Claude/claude-code-sessions/<account-id>/<user-id>/

...then restarting the app. This requires knowing the internal file structure.

Proposed solution

  1. Auto-detect orphaned sessions: On app launch (or periodically), check if each Code session's cwd still exists. If not, mark it as orphaned.
  2. Allow deletion from UI: Add a right-click "Delete session" or "Remove" option on sidebar items, and/or a "Clean up orphaned sessions" bulk action.
  3. Visual indicator: Optionally dim or badge orphaned sessions so users know they're stale before clicking into them.

Context

In my case, 21 out of 53 sessions were orphaned — mostly from deleted git worktrees (.claude/worktrees/) and removed project directories. This is a natural consequence of using worktrees and experimenting with projects.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗