[FEATURE] Desktop sidebar: option to group sessions by git worktree (or show branch) instead of collapsing worktrees into the main repo
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
In the desktop app sidebar, "Group by project" resolves git worktrees back to their main repository and groups all sessions under the main worktree's folder name. For worktree-heavy workflows, this collapses distinct workstreams into a single indistinguishable group.
My setup:
~/Bolster-Rx/bolsterrx-app ← main worktree (develop)
~/Bolster-Rx/admin-invoice ← worktree (feature/admin-invoice)
~/Bolster-Rx/drug-catalog ← worktree (drug-catalog)
~/Bolster-Rx/ananya-learn ← worktree (ananya-learn)
A session started from ~/Bolster-Rx/admin-invoice (session transcript confirms "cwd": ".../admin-invoice", "gitBranch": "feature/admin-invoice") appears in the sidebar under the "bolsterrx-app" group, not under "admin-invoice". With 70+ sessions across 4 worktrees, one flat "bolsterrx-app" group makes it hard to find the session for a given feature branch.
The transcript JSONL already stores both cwd and gitBranch per session, and sessions are already keyed by cwd on disk (~/.claude/projects/-Users-...-Bolster-Rx-admin-invoice/), so the data needed for finer grouping exists — the sidebar just normalizes it away.
Proposed Solution
Any of these would solve it (in order of preference):
A "Group by folder/worktree" option that uses the session's actual cwd folder as the group, treating each worktree as its own group.
A "Group by branch" option using the recorded gitBranch.
At minimum: sub-group or badge worktree/branch within the repo group, e.g. bolsterrx-app ▸ admin-invoice.
Alternatives Considered
Separate full clones per branch — works (each clone is its own repo root) but forfeits the benefits of worktrees (shared object store, single fetch).
Ctrl+B branch filter in the session picker — helps in the picker, but doesn't organize the persistent desktop sidebar.
Naming sessions with branch prefixes — manual and easy to forget.
Alternative Solutions
Related but distinct: #61134 (grouping by working directory vs. inner solution file, closed not-planned), #66980 (cross-repo filtering, closed as duplicate). Neither addresses worktree collapsing.
Priority
High - Significant impact on productivity
Feature Category
Configuration and settings
Use Case Example
_No response_
Additional Context
_No response_