[FEATURE] Desktop: setting to always create a fresh worktree per session (opt out of the worktree pool)

Status Open
Maintainer reply None cached
Activity 1 comment · opened Oct 10, 2026

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's Code tab, a new worktree session can lease an idle worktree from a pool instead of getting a new one. Archiving a session detaches its worktree and keeps it (#91246), and a later session checks out a fresh branch from the default branch inside that same directory (#85282).

On my machine, one directory under <repo>/.claude/worktrees/ has hosted the branches of five sessions since 2026-09-16, according to its reflog. The latest one was started from another device through Remote Control. What carries over from one session to the next:

  • The directory name still comes from the first session, so it never matches the branch checked out there.
  • Gitignored and untracked files survive. When the latest session started, 85 ignored paths (bin/, obj/ and similar) from earlier sessions' builds were already there.
  • The worktree's reflog mixes the history of unrelated sessions.

I found no way to turn this off. Settings → Claude Code has no such option, and the docs describe archiving as removing the worktree.

Proposed Solution

Add an option in Settings → Claude Code, for example "Reuse idle worktrees for new sessions" (on/off). When it is off:

  • every new worktree session gets a new directory from git worktree add, named for that session;
  • archiving a session whose worktree has no uncommitted changes removes the worktree, as the docs already describe, instead of releasing it to the pool.

Keeping pooling as the default is fine, since it saves build time on heavy projects. I'd just like to be able to opt out.

Alternative Solutions

  • Removing detached worktrees by hand with git worktree remove after archiving. It works, but my repository has submodules, so it needs --force, and I have to check for uncommitted changes every time.
  • A WorktreeCreate hook. The desktop app doesn't call it (#29716).

Priority

Medium - Would be very helpful

Feature Category

Configuration and settings

Use Case Example

  1. I start a session from another device through Remote Control to work on an issue.
  2. The app hands it a worktree that a finished session used weeks earlier, still carrying that session's directory name and build outputs.
  3. With the option off, the session would get a clean worktree named for its own branch, and archiving it would leave nothing behind.

Additional Context

Related: #85282 (new sessions reuse an existing session worktree), #91246 (pooled worktrees are never reclaimed), #29716 (WorktreeCreate hooks not called in Desktop).

Claude Desktop on Linux.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗