[FEATURE] Desktop: show the session's current branch and worktree, and surface a visible event when either changes mid-session

Status Open
Reported on v2.1.222
Maintainer reply None cached
Activity 0 comments · opened Aug 12, 2026

Environment

  • Claude Code 2.1.222, desktop app, macOS
  • Workflow: several concurrent sessions against a single repository, most in isolated worktrees under .claude/worktrees/

The gap

There is no persistent indication in the desktop session UI of which branch and which worktree the session is operating on. To answer "where am I?" the user has to ask the assistant to run git rev-parse --abbrev-ref HEAD and pwd.

Worse: both values can change mid-session with no visible signal. The session continues in the same conversation thread, the transcript shows nothing, and the UI looks identical before and after.

Observed

In a single continuous conversation:

  • The session began in worktree A on an auto-generated branch.
  • Mid-conversation, worktree A was removed by the periodic cleanup sweep (its branch had been merged and had no unpushed work) — while the conversation was still live. A shell command failed with Working directory ... was deleted.
  • The session was then moved to a newly created worktree B, with the same branch re-created in it.

The assistant received notice of the move via injected context. The user saw nothing. From the UI, it was the same session in the same place the whole time.

Compounding this, worktree directories keep the name of the first branch they ever held, so the folder name is not a reliable indicator either — a directory named for one branch routinely hosts a different one (see #79366, which reports the reuse behavior itself as undesirable).

Impact

With multiple sessions against one repo, the user cannot tell which session is working where. In this instance that uncertainty escalated: a commit appeared on a branch, and because neither the user nor the assistant could establish where each session was operating, it took an extended investigation across peer-session transcripts, settings.json hooks, git hooks, and process working directories to establish that nothing was actually wrong.

Any of this would have been a glance at a status indicator.

Request

  1. A persistent indicator in the desktop session UI showing the session's current branch and worktree path (or at least the worktree directory name), visible without asking the assistant.
  2. A visible event in the transcript when either changes mid-session — worktree recycled, worktree reassigned, branch switched — stating the old and new values. Silent relocation is the core problem; even a one-line system notice would resolve most of it.

Open question

Are there other triggers for a mid-session worktree or branch change besides the cleanup sweep? Specifically: does clearing conversation context cause a session to be reassigned to a different worktree or branch? This is a user-reported suspicion I was not able to confirm or rule out — in the case documented above the trigger was the cleanup sweep during a live conversation with no context clear, so the trigger set is at least broader than that. Documenting the full set of triggers would help even before any UI work.

Related

  • #58183 — "Show git branch + dirty state in claude.ai/code session bar" (closed/stale; same request for the web client — this one is for the desktop app)
  • #79366 — worktree sessions reusing an existing worktree directory instead of creating a fresh one
  • #81628 — desktop session project tag is ambiguous across multiple clones of one repo

View original on GitHub ↗