[FEATURE] Desktop: expose worktree name/base input in UI + pass branch-prefix & base branch into the WorktreeCreate hook payload

Resolved 💬 2 comments Opened May 29, 2026 by ericwu917 Closed Jul 12, 2026

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request

Context

As of Desktop 1.9659.2 (macOS), the WorktreeCreate hook is now correctly dispatched from the Desktop worktree flow — #29716 is fixed. Verified locally: enabling the worktree toggle now runs my ~/.claude/settings.json WorktreeCreate hook (Desktop log: [WorktreeHooks] WorktreeCreate hook created worktree at ... / Created hook-based worktree "..."). Thanks for landing that.

With the hook now firing, two gaps remain that make the Desktop worktree flow unable to honor a team's branch-naming conventions.

Gap A — Desktop UI has no field to specify the worktree name

The Desktop worktree toggle auto-generates a random codename and gives the user no way to enter a name. So the name the hook receives is always a meaningless codename:

// Desktop UI → WorktreeCreate hook payload
{ "cwd": "/path/to/repo", "hook_event_name": "WorktreeCreate", "name": "sad-tharp-abb433" }

// CLI `claude -w feat/04-product-config` → WorktreeCreate hook payload
{ "cwd": "/path/to/repo", "hook_event_name": "WorktreeCreate", "name": "feat/04-product-config", "session_id": "...", "transcript_path": "..." }

The CLI lets the user pass a semantic name; the Desktop UI does not. A hook that derives branch names / placement from name (e.g. feat/<date>-<rest> off develop, hotfix/<date>-<rest> off master) can never be triggered from Desktop — every Desktop-initiated worktree falls into the hook's catch-all path.

Gap B — the hook payload omits Desktop's own naming context (branch prefix + base branch)

When Desktop creates worktrees itself (no hook), it consistently applies a claude/ branch prefix and records a base branch. From ~/Library/Application Support/Claude/git-worktrees.json:

branch=claude/infallible-greider-5aaa6c  sourceBranch=main
branch=claude/vigilant-wescoff-357641    sourceBranch=main
branch=claude/clever-shockley            sourceBranch=master
branch=claude/musing-ardinghelli         sourceBranch=feat/dual-strategy

So Desktop has a branch-prefix concept (at minimum a hardcoded claude/; #28945 and #42365 also describe a configurable prefix setting), and it resolves a base branch per worktree. But none of this is passed to the hook — the payload is just { cwd, hook_event_name, name }. A hook therefore cannot reproduce Desktop's own naming/branching behavior, and there's no way to keep hook-created and Desktop-created worktrees consistent.

Proposed Solution

  1. Expose worktree name (and optionally base branch) in the Desktop worktree-creation UI, and pass the user's input through as the hook's name — reaching parity with CLI claude -w <name>. When left blank, keep today's auto-generated codename as the default.
  1. Include Desktop's known worktree configuration in the WorktreeCreate hook payload, specifically:
  • the configured branch prefix (e.g. claude/), and
  • the resolved base / source branch for this worktree (the value Desktop records as sourceBranch).

This lets a hook construct branch names and worktree paths that match Desktop's conventions instead of operating blind on a bare codename.

Related

  • #29716 — Desktop now dispatches the WorktreeCreate hook (this request builds on that fix)
  • #42365, #28945 — configurable worktree branch prefix (CLI parity); both auto-closed as stale, and both reference a Desktop branch-prefix setting
  • #31969 — proposed branch parameter on EnterWorktree (complementary: exact branch override vs. consistent prefix/base context)

Environment

  • Claude Desktop: 1.9659.2 (macOS)
  • Hook configured at user scope in ~/.claude/settings.json; confirmed firing from Desktop on this version

View original on GitHub ↗

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