worktrunk icon indicating copy to clipboard operation
worktrunk copied to clipboard

home-manager's worktrunk module writes outdated Claude Code hooks

Open worktrunk-bot opened this issue 2 weeks ago • 2 comments

home-manager's programs.worktrunk module (modules/programs/worktrunk.nix) writes its own Claude Code hooks instead of using the plugin's. Its copy predates the single wt config plugins claude hook entry point that plugins/worktrunk/hooks/hooks.json now registers for every event, so users who set claudeCodeIntegration.enable get older behavior than plugin users:

  • WorktreeCreate always passes --create. Claude Code fires this hook again when claude --worktree <name> reopens a kept worktree; the branch then exists, wt switch --create refuses it, and the reopen fails. Worktrunk's hook switches to an existing branch without --create (#4487, released in 0.81.0).
  • WorktreeCreate prints the path unresolved. Claude Code 2.1.325 refuses a WorktreeCreate answer that goes through a symlink inside the project. Worktrunk's hook now prints the real path (#4814, on main, not yet released), so a worktree-path template under a symlinked directory in the repository fails only for module users once a release ships.
  • Activity markers follow the shell's cwd. The module runs wt config state marker set … with no directory, so a cd during a turn marks whichever repository the shell is in. Worktrunk's hook resolves markers against CLAUDE_PROJECT_DIR (#3921).
  • No EnterWorktree approval. Worktrunk's PermissionRequest hook approves an EnterWorktree into a Worktrunk-managed worktree, which /wt-switch-create relies on to enter without a confirmation dialog; the module's PermissionRequest entry only sets 💬.

The statusline and skill entries match.

Fix, in nix-community/home-manager: replace the module's per-event commands (and its jq dependency) with ${wt} config plugins claude hook for each event in hooks.json, keeping the module's split between worktreeHooks and activityTrackingHooks. The marker events keep || true, as hooks.json does. nixpkgs unstable ships 0.81.0, which has the subcommand; nixpkgs 26.05 ships 0.50.0, which does not, so the change suits home-manager's master and not its 26.05 branch. That would also stop the copy drifting again, since each later change to the hooks' behavior lands inside wt.

Opening the PR or an issue on home-manager needs a maintainer's go-ahead here first; the module's maintainers are eveeifyeve and yzx9.

worktrunk-bot avatar Nov 16 '26 02:11 worktrunk-bot

Opened nix-community/home-manager#10180, which switches every hook in the module to ${wt} config plugins claude hook, keeping its options. This issue can close when it merges.

This was written by Claude Code on behalf of max-sixty

max-sixty avatar Nov 16 '26 02:11 max-sixty

nix-community/home-manager#10180 merged on 2026-11-17 as 6e4bcf6. The module now runs ${wt} config plugins claude hook for all eight events plugins/worktrunk/hooks/hooks.json registers, with the same matchers and the same || true on the marker events. Module users therefore get the plugin's WorktreeCreate behavior from whatever wt they have installed, including the resolved-path fix from #4814 once it ships in a release. Closing.

worktrunk-bot avatar Nov 18 '26 06:11 worktrunk-bot