Make session worktrees configurable, self-cleaning, and consistently named
- Dominant language
- Shell
- Stars
- 11.2k
- Forks
- 1.9k
- Avg merge
- 14h 16m
- Merged PRs (30d)
- 6
Description
## Problem
Sessions create worktrees under a magic path (`D:\GIT\copilot-worktrees\\`) with three loosely related names:
- a session display name
- a branch name (e.g. `mhaackone10/congenial-fishstick`)
- the worktree folder slug (e.g. `mhaackone10-congenial-fishstick`)
After a branch is merged, the worktree directory and branch are left dangling. The agent tells the user "this worktree is safe to delete whenever convenient," which puts the cleanup burden on the user. Over a few weeks of normal use this produces a graveyard of orphaned worktrees and branches that the app created but won't remove.
It is also frequently confusing: the agent has to constantly explain "this is a worktree, not your main checkout" and walk the user through `git merge --ff-only` from a separate path to actually see the changes in their normal working directory. The mechanism is invisible to the user but leaks into every merge/cleanup interaction.
## Asks
1. **Make the mechanism visible and configurable.** Let the user choose between:
- worktree-per-session (current default)
- in-place editing on a branch in the main checkout
- some other strategy
And let them set the worktree root path, the branch naming scheme, and whether the session name, branch name, and folder name should be derived from one source.
2. **Manage the lifecycle.** When a session's branch is merged (fast-forward or otherwise), the app should offer or perform cleanup of the worktree directory and the local branch. "Safe to delete, do it yourself" is not adequate. Provide an explicit "archive session" / "discard worktree" action and a periodic prompt for stale ones.
3. **Use one consistent name.** The session display name, branch name, and worktree folder name should be derivable from a single user-chosen identifier (or at minimum, displayed together so it's obvious they refer to the same thing). The current `congenial-fishstick`-style autogenerated slug is noise; the fact that `rename_session` and `rename_branch` tools exist as separate operations is itself a sign that the defaults need work.
## Why it matters
The current design optimizes for isolation between sessions (good) but pushes all the housekeeping onto the user (not good). For users running many short sessions, the cumulative cost of "remember to clean up that worktree at `D:\GIT\copilot-worktrees\...`" is real, and the cognitive cost of three names for the same thing is paid on every interaction.
Contributor guide
Assessment
This issue has not been assessed yet.