{"version":"2.1.324","anchor":"hidden-worktree-hook-cli-subcommand-for-claude-desktop","canonical_anchor":"hidden-worktree-hook-cli-subcommand-for-claude-desktop","heading":"Hidden worktree-hook command lets Claude Desktop run worktree hooks","tier":"notice","area":"Worktrees","scope":"individual","heads_up":false,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.324\/e\/hidden-worktree-hook-cli-subcommand-for-claude-desktop","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.324","markdown":"### Hidden worktree-hook command lets Claude Desktop run worktree hooks\n\nA hidden `worktree-hook` command runs WorktreeCreate or WorktreeRemove hooks, reports JSON, and refuses to fall back to a plain git worktree\n\n**What**\n\nA worktree is a separate working copy of a project. `WorktreeCreate` and `WorktreeRemove` are hooks, commands you configure to run when a worktree is created or removed. A new hidden command drives these hooks:\n\n- `worktree-hook` runs those hooks for the current folder and reports the result as JSON on the last line of its output. Its description says it is used by Claude Desktop.\n\n- It takes `--event`, `--name`, `--path` and `--trusted-folder`, and `--json` is required.\n\n- It refuses to run in several cases: its output goes to a terminal, it was started by a session, trust is not stated, the trusted folder is not the current folder, or the path is unsafe. Reasons are reported as strings such as `stdout_is_tty` and `create_wants_a_trusted_folder`.\n\n- For a create event it runs in hook-only mode. If no `WorktreeCreate` hook made a worktree, it stops with \"No WorktreeCreate hook made a worktree: none ran, or none is enabled any more\" instead of going on to create a plain git worktree.\n\n- It can report an outcome of `not_configured`, and for hooks that come from plugins it reports `mayBeCheckouts`.\n\n**Why**\n\nClaude Desktop can use this command to run your worktree hooks through Claude Code. Because the command is hidden and refuses to write to a terminal, you cannot run it from a normal terminal session. In hook-only mode, a missing or disabled hook produces an error rather than a git worktree you did not ask for.\n\n- Area: Worktrees\n- Names: `worktree-hook`, `WorktreeCreate`, `WorktreeRemove`\n- Tier: You'll notice\n- Useful: 3\/5\n- Signal: 4\/5\n- Scope: individual\n- Heads-up: no"}