claude-code - 💡(How to fix) Fix [FEATURE] Desktop: expose worktree name/base input in UI + pass branch-prefix & base branch into the WorktreeCreate hook payload

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

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.

Root Cause

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.

Fix Action

Fix / Workaround

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.

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.

  • #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)

Code Example

// 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": "..." }

---

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
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing requests and this feature hasn't been requested yet
  • 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.

  2. 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

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING