Files
Maximilian Roos acdbbb6824 fix(remove): name the detached worktree instead of refusing the removal
The guard this branch added was solving the wrong problem. Detaching a
worktree's HEAD severs the only link git records between it and the
branch, so the branch really has no worktree and deleting the ref alone
is the correct operation — and it never lost anything: `SafeDelete`
retains an unintegrated branch, so the only refs it deleted were ones
worktrunk's own integration test calls lossless, and even a forced `-D`
leaves the commits reachable through the detached worktree's HEAD, which
is a GC root.

What #3769 actually reported was silence. `○ No worktree found for branch
<name>` is true and still reads as "nothing is there" while a directory
sits at exactly that path, so the removal now names it and the `wt remove
<path>` that clears it, on stderr and in `--format=json`'s new
`detached_worktree`. Refusing instead cost a legitimate branch cleanup
and let a branch address a detached worktree — the one thing the worktree
model says a branch cannot name.

`detached_worktree_for` survives to find the path; it no longer decides
whether the command runs, which is also why the guard-scoping it needed
(a branch-existence check, a `deletion_mode` gate) goes with it: an extra
line of output is harmless where a refusal had to be narrowed case by
case.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-11 07:47:21 -07:00
..

Worktrunk Plugin for Claude Code

Git worktree management CLI integration with activity tracking.

Requires the wt CLI (worktrunk.dev) and jq (used by the worktree-lifecycle hooks).

Features

  1. Configuration skill — Guides LLM-powered commit message setup, project hooks (pre-start, pre-merge), and worktree path customization
  2. Activity tracking — Shows which branches have active Claude sessions via indicators in wt list
  3. /wt-switch-create command — Creates a worktrunk worktree and moves the current Claude session into it

Examples

Activity tracking across worktrees

The plugin installs Claude Code hooks that track session activity per branch. When a prompt is submitted, the hook sets 🤖 on that branch. When Claude finishes and waits for input, it switches to 💬. When the session ends, the marker clears.

These markers appear in wt list output, making it easy to see which worktrees have active Claude sessions — useful when running multiple instances in parallel.

Set up LLM commit message generation

The configuration skill guides through configuring an AI tool (Claude Code, Codex, llm, or aichat) and adding [commit.generation] to the user config so wt merge can auto-generate commit messages.

Add pre-start hooks to run npm install automatically

The skill configures .config/wt.toml with project hooks. Pre-start hooks run when creating worktrees, pre-merge hooks validate before merging.

Start work in a fresh worktree

/wt-switch-create fix-auth Investigate the 5-minute session timeout creates a fix-auth worktree in worktrunk's normal sibling layout (<repo>.fix-auth/), switches the session into it, and starts the task there. The branch name is optional (/wt-switch-create -- <task>). The worktree persists after the session — merge or remove it with wt merge / wt remove like any other.