{"owner":"max-sixty","repo":"worktrunk","hasSkills":true,"totalSkillsCount":54,"totalTokensCount":48994,"categories":["anthropic-skill","marketplace","claude-rule","plugin-manifest","command-prompt"],"hasMcp":false,"mcpConfig":null,"found":["skills/worktrunk/SKILL.md",".claude-plugin/marketplace.json","skills/wt-switch-create/SKILL.md","plugins/worktrunk/skills/worktrunk/SKILL.md",".claude/skills/running-tend/SKILL.md",".claude/skills/writing-user-outputs/SKILL.md","plugins/worktrunk/skills/wt-switch-create/SKILL.md",".claude/skills/release/SKILL.md","tests/CLAUDE.md",".agents/plugins/marketplace.json","plugins/worktrunk/CLAUDE.md","plugins/worktrunk/README.md","skills/wt-switch-create/rationale.md","src/commands/CLAUDE.md","plugins/worktrunk/.codex-plugin/plugin.json","plugins/worktrunk/.claude-plugin/plugin.json","plugins/worktrunk/hooks/hooks.json","skills/worktrunk/reference/claude-code.md","skills/worktrunk/reference/code-signing.md","skills/worktrunk/reference/config.md","skills/worktrunk/reference/extending.md","skills/worktrunk/reference/faq.md","skills/worktrunk/reference/hook.md","skills/worktrunk/reference/list.md","skills/worktrunk/reference/llm-commits.md","skills/worktrunk/reference/merge.md","skills/worktrunk/reference/remove.md","skills/worktrunk/reference/shell-integration.md","skills/worktrunk/reference/step.md","skills/worktrunk/reference/switch.md","skills/worktrunk/reference/tips-patterns.md","skills/worktrunk/reference/troubleshooting.md","skills/worktrunk/reference/worktrunk.md","src/commands/list/CLAUDE.md",".claude/skills/running-tend/references/nightly-cleaner.md",".claude/skills/running-tend/references/review-pr.md","plugins/worktrunk/skills/wt-switch-create/rationale.md","plugins/worktrunk/skills/worktrunk/reference/claude-code.md","plugins/worktrunk/skills/worktrunk/reference/code-signing.md","plugins/worktrunk/skills/worktrunk/reference/config.md","plugins/worktrunk/skills/worktrunk/reference/extending.md","plugins/worktrunk/skills/worktrunk/reference/faq.md","plugins/worktrunk/skills/worktrunk/reference/hook.md","plugins/worktrunk/skills/worktrunk/reference/list.md","plugins/worktrunk/skills/worktrunk/reference/llm-commits.md","plugins/worktrunk/skills/worktrunk/reference/merge.md","plugins/worktrunk/skills/worktrunk/reference/README.md","plugins/worktrunk/skills/worktrunk/reference/remove.md","plugins/worktrunk/skills/worktrunk/reference/shell-integration.md","plugins/worktrunk/skills/worktrunk/reference/step.md","plugins/worktrunk/skills/worktrunk/reference/switch.md","plugins/worktrunk/skills/worktrunk/reference/tips-patterns.md","plugins/worktrunk/skills/worktrunk/reference/troubleshooting.md","plugins/worktrunk/skills/worktrunk/reference/worktrunk.md"],"skills":{"skills/worktrunk/SKILL.md":"---\nname: worktrunk\ndescription: Guidance for Worktrunk (the `wt` CLI) — git worktree management, hooks, and config. Load when working out which worktree a `wt` command will act on, or reaching for the global `-C <path>` to target one; editing .config/wt.toml or ~/.config/worktrunk/config.toml; adding, modifying, or debugging hooks (post-merge, post-start, pre-commit, pre-merge, post-switch, etc.); configuring commit message generation or command aliases; or troubleshooting wt behavior. Also answers general worktrunk/wt questions.\nlicense: MIT OR Apache-2.0\ncompatibility: Requires the `wt` CLI (https://worktrunk.dev)\n---\n\n# Worktrunk\n\nHelp users work with Worktrunk, a CLI tool for managing git worktrees.\n\n## Available documentation\n\nReference files are synced from [worktrunk.dev](https://worktrunk.dev) documentation:\n\n- **reference/config.md**: User and project configuration (LLM, hooks, command defaults)\n- **reference/hook.md**: Hook types, timing, and execution order\n- **reference/switch.md**, **merge.md**, **list.md**, etc.: Command documentation\n- **reference/extending.md**: Aliases, multi-step pipelines, custom subcommands, and template-expansion gotchas (two-pass `{% raw %}` deferral, for-each recipes)\n- **reference/llm-commits.md**: LLM commit message generation\n- **reference/tips-patterns.md**: Practical recipes — aliases, per-branch variables, dev server per worktree, parallel agent patterns\n- **reference/shell-integration.md**: Shell integration debugging\n- **reference/troubleshooting.md**: Troubleshooting for LLM and hooks (Claude-specific)\n\nFor command-specific options, run `wt <command> --help`. For configuration, follow the workflows below.\n\n## Which worktree a command acts on\n\n`wt` finds the *repository* from the working directory, and the *worktree* from the command's own arguments. Two rules cover every case:\n\n1. **A command that names a branch already names its worktree.** Worktrees are addressed by branch name, so `wt switch <branch>`, `wt remove <branch>`, `wt step diff --branch <branch>`, and `wt config state marker set --branch <branch>` act on that branch's worktree no matter which worktree you run them from. Every such argument also accepts the worktree's own path, for the cases a branch cannot name — a second checkout of the same branch, or a detached worktree (which `marker` still rejects, since it keys state by branch name).\n2. **`-C <path>` moves the working directory, not the worktree selection.** Reach for it when the repository lookup is what's wrong: a *different* repository; a command that acts on the current worktree and takes no branch argument (`wt merge`, `wt step rebase|squash|push` — their `[TARGET]` is the merge target, not a worktree); or a caller whose working directory isn't inside a repository at all, such as an agent hook the host pins elsewhere.\n\nLayering `-C` on top of a branch argument names the same worktree twice. From inside the `alpha` worktree of a repo that also has `beta`:\n\n```bash\nwt step diff --branch beta                    # ✓ the branch argument selects the worktree\nwt -C ../repo.beta step diff --branch beta    # ✗ says beta twice\n\nwt switch --create beta                       # ✓ --base already defaults to the default branch\nwt -C ../repo switch --create beta            # ✗ -C adds nothing; you are already in that repo\n```\n\n## Two types of configuration\n\nWorktrunk uses two config files with different scopes and permission models:\n\n**User config** (`~/.config/worktrunk/config.toml`, never checked into git) holds personal preferences: LLM integration, worktree path templates, command settings, user hooks. Treat it conservatively — propose changes and get consent before editing, never install tools on the user's behalf, and preserve the file's existing structure and comments. See `reference/config.md`.\n\n**Project config** (`<repo>/.config/wt.toml`, checked into git) holds team-wide automation: hooks for the worktree lifecycle (pre-start, pre-merge, etc.). Edit proactively — changes are versioned and reversible via git. Comment why each hook exists, and warn the user before adding destructive commands (`rm -rf`, `DROP TABLE`), network fetches piped to shells, or `sudo`. See `reference/hook.md`.\n\nSome requests span both: commit-message generation is user config, while the team's quality checks are project config.\n\n## Core workflows\n\n### Setting up commit message generation (user config)\n\nDetect which tools are installed (`which claude codex opencode pi`); if none, recommend Claude Code. Take the exact command for the chosen tool from `reference/llm-commits.md`, propose the `[commit.generation]` change, and apply it after approval (`wt config create` first if no config exists). To verify, `wt step commit --dry-run` renders the prompt, runs the LLM, and prints the message without committing.\n\n### Configuring project hooks\n\nPick the hook type by when the command should run and whether it may block — `reference/hook.md` maps all ten (5 events × pre/post) to their timing and typical uses.\n\nDerive the commands from the project itself (`package.json` scripts, `Cargo.toml`, `pyproject.toml`) and verify they run before adding them.\n\nWhen a new hook must wait for an existing one, convert the entry to a pipeline; independent commands in a named table run concurrently:\n\n```toml\n# Pipeline: install completes before migrate starts\n[[pre-start]]\ninstall = \"npm install\"\n\n[[pre-start]]\nmigrate = \"npm run db:migrate\"\n\n# Concurrent: independent commands in one table\n[pre-start]\ninstall = \"npm install\"\nenv = \"cp .env.example .env\"\n```\n\nTest with `wt switch --create test-hooks`.\n\n## Common tasks reference\n\n### User config tasks\n- Set up commit message generation → `reference/llm-commits.md`\n- Customize worktree paths → `reference/config.md#worktree-path-template`\n- Custom commit templates → `reference/llm-commits.md#prompt-templates`\n- Configure command defaults → `reference/config.md#command-config`\n- Set up personal hooks → `reference/config.md#user-hooks`\n\n### Project config tasks\n- Set up hooks for new project → `reference/hook.md`\n- Add hook to existing config → `reference/hook.md#hook-forms`\n- Use template variables → `reference/hook.md#template-variables`\n- Add dev server URL to list → `reference/config.md#dev-server-url`\n\n### Aliases & multi-worktree tasks\n- Create a `wt` alias → `reference/extending.md#aliases`\n- Run a command in every worktree → `reference/step.md#wt-step-for-each`\n- Rebase every worktree (up-style) → `reference/extending.md#recipe-rebase-every-worktree-onto-its-upstream`\n- Pass a template to a nested `wt` command → `reference/extending.md#nesting-templates`\n\n## Key commands\n\n```bash\n# View all configuration\nwt config show\n\n# Create initial user config (LLM/commit setup: see reference/llm-commits.md)\nwt config create\n\n# Full config reference (subcommands, templates, env vars)\nwt config --help\n```\n\n## Hook approvals in non-interactive sessions\n\nWorktrunk never runs a project's hooks or aliases until the user has explicitly approved them. The commands in `.config/wt.toml` are arbitrary shell code shipped in a repository the user may have just cloned, so on first run Worktrunk shows each command and waits for the user to approve it — an untrusted `.config/wt.toml` cannot silently execute anything. Approvals are stored per-project in `~/.config/worktrunk/approvals.toml` and re-prompted whenever a command template changes, so a hook can't be swapped for a different command after it was approved.\n\nAgents running `wt merge`, `wt switch`, or other commands that trigger hooks will hit an error like:\n\n```\n▲ cargo-difftest needs approval to execute 1 command:\n○ post-merge install:\n  cargo install --path .\n✗ Cannot prompt for approval in non-interactive environment\n↳ To skip prompts in CI/CD, add --yes; to pre-approve commands, run wt config approvals add --yes\n```\n\nThe resolution is for the user to make the trust decision themselves:\n\n- **`wt config approvals add`** — interactive prompt where the user reviews each command before it is stored to `~/.config/worktrunk/approvals.toml`. Run once per project; the approval persists across invocations until the command template changes or the project moves. This is the path to recommend — the user reviews and consents to exactly the commands that will run.\n\n**When invoked as an agent, stop and escalate to the user.** Approving a project's hooks is a security decision about whether this repository should be trusted to run arbitrary commands on the user's machine — that decision belongs to the user, not the agent. Tell the user to run `wt config approvals add` and let them review the commands. Do not reach for either `--yes` on the user's behalf: on the blocked command it skips the gate for that invocation, and `wt config approvals add --yes` records every command the project declares with nobody reading them. Both exist for CI/CD pipelines and containers that already control their own hook contents; neither is a shortcut for an interactive agent to silence an approval prompt.\n\n## Advanced: agent handoffs\n\nWhen the user requests spawning a worktree with an agent in a background session (\"spawn a worktree for...\", \"hand off to another agent\"), use the tmux or Zellij command from `reference/tips-patterns.md#agent-handoffs` with the CLI you are running as in place of `claude`, following that section's note on where a subcommand such as OpenCode's `run` goes.\n\n**Requirements** (all must be true):\n- User explicitly requests spawning/handoff\n- User is in a supported multiplexer (check `$TMUX` / `$ZELLIJ`)\n- The user's project instructions (`CLAUDE.md` or `AGENTS.md`) or an explicit prompt authorize this pattern\n\n**Do not use this pattern** for normal worktree operations.\n\n### Parallel sub-Agents (single Claude Code session)\n\nTo spawn multiple sub-Agents that each work in their own worktree from one Claude Code session — no terminal multiplexer, no human in the other pane — pre-start each worktree from the parent and pass the path into the sub-Agent prompt:\n\n```bash\nwt switch --create <branch> --no-cd\n```\n\nThen call the `Agent` tool **without** `isolation: \"worktree\"`, naming the path in the prompt:\n\n```\nYou are working in `/abs/path/to/myproject.<branch>` on branch `<branch>`.\nAll edits must stay in that worktree.\n```\n\n`--no-cd` skips the shell-integration cd script the parent can't consume. Add `--no-hooks` only when no user or project hooks provision the worktree and each sub-Agent does its own build/test step (e.g. `cargo run -- hook pre-merge --yes`) — a `pre-start` hook that installs dependencies or links a gitignored build environment hands the sub-Agent a worktree it can't build in when it's skipped. Leaving hooks on needs the project's hook commands already approved: the parent session can't prompt, so an unapproved command in `.config/wt.toml` aborts the create — see **Hook approvals in non-interactive sessions** above.\n\n**Do not** use `Agent { isolation: \"worktree\" }` for this. Claude Code passes its internal agent ID as `name` to the `WorktreeCreate` hook, so `wt` creates the worktree as `myproject.agent-<id>` on a throwaway branch. If the sub-Agent then creates a feature branch on top, you end up with non-canonical paths, orphan branches, and post-start hooks fired against the wrong branch. Pre-creating with `wt switch --create` keeps path, branch, and hook target aligned.\n",".claude-plugin/marketplace.json":"{\n  \"name\": \"worktrunk\",\n  \"owner\": {\n    \"name\": \"Worktrunk\",\n    \"email\": \"m@maxroos.com\"\n  },\n  \"metadata\": {\n    \"description\": \"Claude Code plugin for Worktrunk, a CLI for Git worktree management\"\n  },\n  \"plugins\": [\n    {\n      \"name\": \"worktrunk\",\n      \"description\": \"Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows. This plugin provides configuration guidance (LLM commit messages, project hooks, worktree paths), automatic activity tracking (🤖/💬 indicators in `wt list` showing active Claude sessions), and a `/wt-diff` pane showing each worktree's changes.\",\n      \"source\": \"./plugins/worktrunk\"\n    }\n  ]\n}\n","skills/wt-switch-create/SKILL.md":"---\nname: wt-switch-create\ndescription: Create a new worktrunk worktree (optionally in another repo) and switch this session's working directory into it. Use when launching a session that should work in its own worktree.\nargument-hint: \"[<branch>] [<repo>] [-- <task>]\"\nlicense: MIT OR Apache-2.0\ncompatibility: Requires the `wt` CLI (https://worktrunk.dev)\n---\n\nArguments: `$ARGUMENTS`. Grammar: `[<branch>] [<repo>] [-- <task>]`.\n\n- **branch** — optional; the branch name for the new worktree. When omitted,\n  pick one (step 1 below).\n- **repo** — optional path or name; create the worktree in this repo instead\n  of the session's current one.\n- **task** — optional; what to do inside the new worktree. No task means enter\n  the worktree and wait.\n\nTokens before the `--` are the branch and/or repo. A path-shaped token\n(starting with `/`, `~`, `./`, or `../`) is the repo. A bare name can be\neither, so make an informed guess. It is the branch when the current repo\nalready has a branch by that name, as it is for `wt switch` itself. Otherwise\nit is the repo when a git repository by that name exists where the user keeps\nrepos (beside the current repo, or in a workspace directory like\n`~/workspace`), and the branch when none does (`docs` is a branch, not the\ncurrent repo's `docs/` directory). A name read as the repo carries its absolute\npath forward: that path, not the bare token, is the `<repo>` in step 3. Two\ntokens that both read as branches don't fit the grammar — ask. Without a `--`,\njudge where the task starts: leading tokens that read as a branch name\n(`fix-auth`) or a repo are consumed as such, and the rest is the task;\notherwise the whole input is the task (`fix the parser bug` has no\nbranch-shaped lead — all task).\n\n```\n/wt-switch-create my-feature -- fix the parser bug\n/wt-switch-create -- fix the parser bug\n/wt-switch-create my-feature ~/workspace/other-repo -- fix the parser bug\n/wt-switch-create my-feature\n```\n\n## What to do\n\nCreating the worktree comes first on every invocation, before any other work.\nThe invocation is itself the explicit request to create it; a research or\nread-only task gets one all the same.\n\n<!-- Maintainers: rationale.md (same directory) covers the harness rules and\ndesign choices behind this — read it before re-adding guards or routes. -->\n\n1. **Pick a new branch name** if none was given: short, from the task and\n   consistent with existing worktree names, or, mid-session, from the work\n   being moved; with nothing to derive from, ask.\n\n2. **With no repo argument, create and enter in one call:**\n   `EnterWorktree({name: \"<branch>\"})`. Worktrunk's `WorktreeCreate` hook runs\n   `wt switch --create` for a new branch or `wt switch` for an existing one,\n   creating its checkout if needed. The result is an ordinary `wt` worktree,\n   and the user sees no confirmation prompt. On success, do the task (or,\n   with no task text, confirm it's ready and wait).\n\n   Mid-session, carry uncommitted work across: `git stash push -u` before the\n   `EnterWorktree` call, then `git stash pop` once the session is in the new\n   worktree, which is after step 3 if this call fails. Entering re-roots the\n   session into the new worktree, and the stash is shared across worktrees. If\n   step 3 hands back without the session in the new worktree, restore the work\n   where it came from first (`git -C <that worktree> stash pop`).\n\n3. **Otherwise create it with `wt` and enter by path.** Two cases reach here: a\n   repo argument, which step 2 can't target, and a failed step 2, whose error\n   says `Already in a worktree session`. Create with a `Bash` call (omit\n   `-C <repo>` for this repo):\n\n   ```\n   wt -C <repo> switch --create <branch> --no-cd --format=json\n   ```\n\n   Stdout is JSON whose `path` field is the worktree's absolute path (status\n   lines go to stderr). On `Branch <branch> already exists`: if the user named\n   the branch, rerun without `--create` (it enters the branch, creating its\n   worktree if missing); if step 1 picked the name, pick another and rerun. Any\n   other failure (not a git repo, invalid name): report it and stop.\n\n   Next, call `ExitWorktree({action: \"keep\"})`. This invocation is the user\n   asking to move the session, which includes leaving the worktree it is in,\n   so make the call even when you're unsure the session is in one. A session\n   in a worktree can enter only one under its repository's\n   `.claude/worktrees/`; leaving lifts that limit, keeps the old worktree and\n   its branch on disk, and returns the session to the directory it was in\n   before it entered. Where there is nothing to leave (no worktree session, or\n   an agent pinned to its own worktree), the call returns an error and changes\n   nothing; carry on. If the session did leave a worktree\n   and the entry below doesn't happen, say so when you hand back: name the\n   worktree it left, still on disk, and where the session is now.\n\n   With a repo argument, `cd <repo>` next, in its own `Bash` call:\n   `EnterWorktree` re-roots only within the repository the cwd is in, and\n   worktrunk's `PermissionRequest` hook answers the confirmation that call\n   asks for only for a `wt` worktree of that same repository. If that `cd`\n   reports `Shell cwd was reset`, the repo is unreachable: skip the entry and\n   hand back as in **Unreachable** below. With no repo argument, don't `cd`:\n   leaving put the session back in this repository, and a `cd` into the\n   worktree it left can reset.\n\n   Then call `EnterWorktree({path: \"<path from the JSON>\"})`.\n\n   With a repo argument, once the session works in the new worktree (entered,\n   or reached by `cd` in the recovery below), read whichever of its root\n   `CLAUDE.md` and `AGENTS.md` exist before the task. Claude Code keeps the\n   launch repo's root instructions in context and loads only the new repo's\n   nested ones, so the new repo's root files supersede the launch repo's for\n   the rest of the session.\n\n   - **Accepted** → the session is re-rooted in the worktree. Do the task (or,\n     with no task text, confirm it's ready and wait).\n   - **Tool error** — the tool ran and returned an error (`Cannot enter\n     worktree: …`) → graceful; nothing moved, and one recovery covers them\n     all. One cause is an agent pinned to its own worktree, which can\n     enter only under its repo's `.claude/worktrees/`, excluding even a\n     same-repo `wt` sibling. The recovery test is whether you can `cd` into\n     the worktree, which works when it's inside an allowed directory. So\n     `cd <path>` and read the result:\n     - no `Shell cwd was reset` notice → it stuck; the worktree is reachable.\n       Work there, but a bare `cd` is not a tracked re-root, so the cwd can\n       revert to the session's launch worktree across turns (and in spawned\n       subagents); pin commands with `git -C <path>` / `wt -C <path>` rather\n       than trusting the `cd` to persist.\n     - `Shell cwd was reset` → **Unreachable.** Stop and ask the user to make\n       the directory whose `cd` reset reachable: add a parent that holds both\n       the repo and its worktrees, like `~/workspace`, to\n       `permissions.additionalDirectories` (durable, every session), or run\n       `/add-dir` on it (this session). Then continue from that `cd`. Don't\n       grind through absolute paths with `cd` resetting on every command.\n   - **Denied** — the call itself was refused, with no tool error → however\n     the denial is worded, it is the user's answer to the confirmation Claude\n     Code shows for entering a worktree outside `.claude/worktrees/`, unless\n     there was no user to ask (the denial says the session couldn't prompt),\n     which decides nothing — take the recovery above. On the user's answer:\n     the worktree `wt` just created still exists; only the entry didn't\n     happen. `cd` back out of the repo you moved into, if any, then report\n     the worktree's path and ask how to proceed, since reaching it through\n     `cd` would override that answer.\n\n## Cleanup\n\nThe worktree is a normal worktrunk worktree: it shows up in `wt list` and is\nmerged or removed with `wt merge` / `wt remove <branch>` like any other. Don't\nremove it unprompted.\n\nA worktree entered by name in step 2 gets Claude Code's Keep / Remove prompt\nwhen the session ends, with Keep selected by default. Remove runs `wt remove`\nwith its normal safeguards. A worktree entered by path in step 3 stays, as\ndoes a worktree the session left with `action: \"keep\"`. If the user asks to\nleave mid-session, `ExitWorktree({action: \"keep\"})` returns the session to its\noriginal directory;\n`ExitWorktree` cannot remove a worktree entered by `path`, so removing one of\nthose is always `wt remove <branch>`.\n\n## Scope\n\nThe command's mandate is ONE worktree (in the named repo, if one was given)\nand the requested task inside it.\n","plugins/worktrunk/skills/worktrunk/SKILL.md":"---\nname: worktrunk\ndescription: Guidance for Worktrunk (the `wt` CLI) — git worktree management, hooks, and config. Load when working out which worktree a `wt` command will act on, or reaching for the global `-C <path>` to target one; editing .config/wt.toml or ~/.config/worktrunk/config.toml; adding, modifying, or debugging hooks (post-merge, post-start, pre-commit, pre-merge, post-switch, etc.); configuring commit message generation or command aliases; or troubleshooting wt behavior. Also answers general worktrunk/wt questions.\nlicense: MIT OR Apache-2.0\ncompatibility: Requires the `wt` CLI (https://worktrunk.dev)\n---\n\n# Worktrunk\n\nHelp users work with Worktrunk, a CLI tool for managing git worktrees.\n\n## Available documentation\n\nReference files are synced from [worktrunk.dev](https://worktrunk.dev) documentation:\n\n- **reference/config.md**: User and project configuration (LLM, hooks, command defaults)\n- **reference/hook.md**: Hook types, timing, and execution order\n- **reference/switch.md**, **merge.md**, **list.md**, etc.: Command documentation\n- **reference/extending.md**: Aliases, multi-step pipelines, custom subcommands, and template-expansion gotchas (two-pass `{% raw %}` deferral, for-each recipes)\n- **reference/llm-commits.md**: LLM commit message generation\n- **reference/tips-patterns.md**: Practical recipes — aliases, per-branch variables, dev server per worktree, parallel agent patterns\n- **reference/shell-integration.md**: Shell integration debugging\n- **reference/troubleshooting.md**: Troubleshooting for LLM and hooks (Claude-specific)\n\nFor command-specific options, run `wt <command> --help`. For configuration, follow the workflows below.\n\n## Which worktree a command acts on\n\n`wt` finds the *repository* from the working directory, and the *worktree* from the command's own arguments. Two rules cover every case:\n\n1. **A command that names a branch already names its worktree.** Worktrees are addressed by branch name, so `wt switch <branch>`, `wt remove <branch>`, `wt step diff --branch <branch>`, and `wt config state marker set --branch <branch>` act on that branch's worktree no matter which worktree you run them from. Every such argument also accepts the worktree's own path, for the cases a branch cannot name — a second checkout of the same branch, or a detached worktree (which `marker` still rejects, since it keys state by branch name).\n2. **`-C <path>` moves the working directory, not the worktree selection.** Reach for it when the repository lookup is what's wrong: a *different* repository; a command that acts on the current worktree and takes no branch argument (`wt merge`, `wt step rebase|squash|push` — their `[TARGET]` is the merge target, not a worktree); or a caller whose working directory isn't inside a repository at all, such as an agent hook the host pins elsewhere.\n\nLayering `-C` on top of a branch argument names the same worktree twice. From inside the `alpha` worktree of a repo that also has `beta`:\n\n```bash\nwt step diff --branch beta                    # ✓ the branch argument selects the worktree\nwt -C ../repo.beta step diff --branch beta    # ✗ says beta twice\n\nwt switch --create beta                       # ✓ --base already defaults to the default branch\nwt -C ../repo switch --create beta            # ✗ -C adds nothing; you are already in that repo\n```\n\n## Two types of configuration\n\nWorktrunk uses two config files with different scopes and permission models:\n\n**User config** (`~/.config/worktrunk/config.toml`, never checked into git) holds personal preferences: LLM integration, worktree path templates, command settings, user hooks. Treat it conservatively — propose changes and get consent before editing, never install tools on the user's behalf, and preserve the file's existing structure and comments. See `reference/config.md`.\n\n**Project config** (`<repo>/.config/wt.toml`, checked into git) holds team-wide automation: hooks for the worktree lifecycle (pre-start, pre-merge, etc.). Edit proactively — changes are versioned and reversible via git. Comment why each hook exists, and warn the user before adding destructive commands (`rm -rf`, `DROP TABLE`), network fetches piped to shells, or `sudo`. See `reference/hook.md`.\n\nSome requests span both: commit-message generation is user config, while the team's quality checks are project config.\n\n## Core workflows\n\n### Setting up commit message generation (user config)\n\nDetect which tools are installed (`which claude codex opencode pi`); if none, recommend Claude Code. Take the exact command for the chosen tool from `reference/llm-commits.md`, propose the `[commit.generation]` change, and apply it after approval (`wt config create` first if no config exists). To verify, `wt step commit --dry-run` renders the prompt, runs the LLM, and prints the message without committing.\n\n### Configuring project hooks\n\nPick the hook type by when the command should run and whether it may block — `reference/hook.md` maps all ten (5 events × pre/post) to their timing and typical uses.\n\nDerive the commands from the project itself (`package.json` scripts, `Cargo.toml`, `pyproject.toml`) and verify they run before adding them.\n\nWhen a new hook must wait for an existing one, convert the entry to a pipeline; independent commands in a named table run concurrently:\n\n```toml\n# Pipeline: install completes before migrate starts\n[[pre-start]]\ninstall = \"npm install\"\n\n[[pre-start]]\nmigrate = \"npm run db:migrate\"\n\n# Concurrent: independent commands in one table\n[pre-start]\ninstall = \"npm install\"\nenv = \"cp .env.example .env\"\n```\n\nTest with `wt switch --create test-hooks`.\n\n## Common tasks reference\n\n### User config tasks\n- Set up commit message generation → `reference/llm-commits.md`\n- Customize worktree paths → `reference/config.md#worktree-path-template`\n- Custom commit templates → `reference/llm-commits.md#prompt-templates`\n- Configure command defaults → `reference/config.md#command-config`\n- Set up personal hooks → `reference/config.md#user-hooks`\n\n### Project config tasks\n- Set up hooks for new project → `reference/hook.md`\n- Add hook to existing config → `reference/hook.md#hook-forms`\n- Use template variables → `reference/hook.md#template-variables`\n- Add dev server URL to list → `reference/config.md#dev-server-url`\n\n### Aliases & multi-worktree tasks\n- Create a `wt` alias → `reference/extending.md#aliases`\n- Run a command in every worktree → `reference/step.md#wt-step-for-each`\n- Rebase every worktree (up-style) → `reference/extending.md#recipe-rebase-every-worktree-onto-its-upstream`\n- Pass a template to a nested `wt` command → `reference/extending.md#nesting-templates`\n\n## Key commands\n\n```bash\n# View all configuration\nwt config show\n\n# Create initial user config (LLM/commit setup: see reference/llm-commits.md)\nwt config create\n\n# Full config reference (subcommands, templates, env vars)\nwt config --help\n```\n\n## Hook approvals in non-interactive sessions\n\nWorktrunk never runs a project's hooks or aliases until the user has explicitly approved them. The commands in `.config/wt.toml` are arbitrary shell code shipped in a repository the user may have just cloned, so on first run Worktrunk shows each command and waits for the user to approve it — an untrusted `.config/wt.toml` cannot silently execute anything. Approvals are stored per-project in `~/.config/worktrunk/approvals.toml` and re-prompted whenever a command template changes, so a hook can't be swapped for a different command after it was approved.\n\nAgents running `wt merge`, `wt switch`, or other commands that trigger hooks will hit an error like:\n\n```\n▲ cargo-difftest needs approval to execute 1 command:\n○ post-merge install:\n  cargo install --path .\n✗ Cannot prompt for approval in non-interactive environment\n↳ To skip prompts in CI/CD, add --yes; to pre-approve commands, run wt config approvals add --yes\n```\n\nThe resolution is for the user to make the trust decision themselves:\n\n- **`wt config approvals add`** — interactive prompt where the user reviews each command before it is stored to `~/.config/worktrunk/approvals.toml`. Run once per project; the approval persists across invocations until the command template changes or the project moves. This is the path to recommend — the user reviews and consents to exactly the commands that will run.\n\n**When invoked as an agent, stop and escalate to the user.** Approving a project's hooks is a security decision about whether this repository should be trusted to run arbitrary commands on the user's machine — that decision belongs to the user, not the agent. Tell the user to run `wt config approvals add` and let them review the commands. Do not reach for either `--yes` on the user's behalf: on the blocked command it skips the gate for that invocation, and `wt config approvals add --yes` records every command the project declares with nobody reading them. Both exist for CI/CD pipelines and containers that already control their own hook contents; neither is a shortcut for an interactive agent to silence an approval prompt.\n\n## Advanced: agent handoffs\n\nWhen the user requests spawning a worktree with an agent in a background session (\"spawn a worktree for...\", \"hand off to another agent\"), use the tmux or Zellij command from `reference/tips-patterns.md#agent-handoffs` with the CLI you are running as in place of `claude`, following that section's note on where a subcommand such as OpenCode's `run` goes.\n\n**Requirements** (all must be true):\n- User explicitly requests spawning/handoff\n- User is in a supported multiplexer (check `$TMUX` / `$ZELLIJ`)\n- The user's project instructions (`CLAUDE.md` or `AGENTS.md`) or an explicit prompt authorize this pattern\n\n**Do not use this pattern** for normal worktree operations.\n\n### Parallel sub-Agents (single Claude Code session)\n\nTo spawn multiple sub-Agents that each work in their own worktree from one Claude Code session — no terminal multiplexer, no human in the other pane — pre-start each worktree from the parent and pass the path into the sub-Agent prompt:\n\n```bash\nwt switch --create <branch> --no-cd\n```\n\nThen call the `Agent` tool **without** `isolation: \"worktree\"`, naming the path in the prompt:\n\n```\nYou are working in `/abs/path/to/myproject.<branch>` on branch `<branch>`.\nAll edits must stay in that worktree.\n```\n\n`--no-cd` skips the shell-integration cd script the parent can't consume. Add `--no-hooks` only when no user or project hooks provision the worktree and each sub-Agent does its own build/test step (e.g. `cargo run -- hook pre-merge --yes`) — a `pre-start` hook that installs dependencies or links a gitignored build environment hands the sub-Agent a worktree it can't build in when it's skipped. Leaving hooks on needs the project's hook commands already approved: the parent session can't prompt, so an unapproved command in `.config/wt.toml` aborts the create — see **Hook approvals in non-interactive sessions** above.\n\n**Do not** use `Agent { isolation: \"worktree\" }` for this. Claude Code passes its internal agent ID as `name` to the `WorktreeCreate` hook, so `wt` creates the worktree as `myproject.agent-<id>` on a throwaway branch. If the sub-Agent then creates a feature branch on top, you end up with non-canonical paths, orphan branches, and post-start hooks fired against the wrong branch. Pre-creating with `wt switch --create` keeps path, branch, and hook target aligned.\n",".claude/skills/running-tend/SKILL.md":"---\nname: running-tend\ndescription: Worktrunk-specific guidance for tend CI workflows. Adds codecov polling, Rust test commands, labels, and review criteria on top of the bundled tend-ci-runner skills. Use when operating in CI.\nmetadata:\n  internal: true\n---\n\n# Worktrunk Tend CI\n\nProject-specific guidance for tend workflows running on worktrunk (a Rust\nCLI for managing git worktrees). The bundled `run-tend`, `review`, and `triage`\nskills provide the workflow framework; this skill adds worktrunk conventions.\n\n## Filing issues in other repos\n\nStanding exceptions granted, each filing directly without asking permission\nhere first:\n\n- agent-equipped targets (per **Filing issues** in the bundled\n  `act-in-other-repos` skill)\n- any project the weekly digest finds copying Worktrunk's code without its\n  license notice (`references/feedback-digest.md`, \"Projects that copy\n  Worktrunk's code\")\n\nThe default rule (open an issue here asking permission first) applies to every\nother target.\n\n## Codecov Monitoring\n\nAfter required CI checks pass, poll `codecov/patch` — it is mandatory despite\nbeing marked non-required:\n\n```bash\nfor i in $(seq 1 5); do\n  CODECOV=$(gh pr checks <number> 2>&1 | grep 'codecov/patch' || true)\n  if echo \"$CODECOV\" | grep -q 'pass'; then\n    echo \"codecov/patch passed\"; exit 0\n  elif echo \"$CODECOV\" | grep -q 'fail'; then\n    echo \"codecov/patch FAILED\"; exit 1\n  fi\n  sleep 60\ndone\n```\n\nIf codecov fails **locally**, investigate with `task coverage` and\n`cargo llvm-cov report --show-missing-lines | grep <file>`.\n\n### Investigating codecov failures in CI\n\n`task` and `cargo-llvm-cov` are not installed in the `tend-setup` action.\nDon't try to `cargo install` them in the sandbox — past attempts at\nsource-compiling installs cascaded into bash-tool interrupts that blocked\neven `pwd` and `echo`. Instead, query Codecov directly, following\n`tests/AGENTS.md` → **Coverage Investigation** for the endpoints and their\ntraps. The scratch paths there and below go to `${TMPDIR:-/tmp}` — write new\nones the same way.\n\nIf the Codecov API markers aren't enough, download the `code-coverage-report`\nartifact from the PR head's `coverage` workflow run — it contains a\n`cobertura.xml` with per-line hit counts:\n\n```bash\nREPO=$(gh repo view --json nameWithOwner --jq '.nameWithOwner')\n# Find the coverage run on the PR head SHA:\nCI_RUN=$(gh api \"repos/$REPO/commits/<sha>/check-runs\" --jq '.check_runs[] | select(.name == \"code-coverage\") | .details_url | capture(\"runs/(?<id>[0-9]+)\") | .id')\n# List artifacts, then download the coverage one:\ngh api \"repos/$REPO/actions/runs/$CI_RUN/artifacts\" --jq '.artifacts[] | {name, id}'\ngh api \"repos/$REPO/actions/artifacts/<id>/zip\" > \"${TMPDIR:-/tmp}/coverage.zip\"\nunzip -q \"${TMPDIR:-/tmp}/coverage.zip\" -d \"${TMPDIR:-/tmp}/coverage\"\n```\n\n## Test Commands\n\n```bash\ncargo run -- hook pre-merge --yes   # full suite + lints\ncargo test --lib --bins             # unit tests only\ncargo test --test integration       # integration tests only\n```\n\nCI runs on Linux, Windows, and macOS.\n\n## Rework a test that reaches for its environment\n\nA test that leans on inherited state — the process CWD, an ambient env var —\nsets up its own instead, via `TestRepo::with_initial_commit()` plus a tempdir,\nthe way most worktrunk tests already do. Guarding it with an early return\n(**Don't \"fix\" tests by adding skip guards** in the bundled `fix-a-bug` skill)\ndrops the coverage rather than restoring it. This governs every workflow that\nfixes a test here, not just issue triage.\n\n## Session Log Paths\n\nThe artifact directory is named after the agent's working directory, which\nmoves between tend releases — 0.2.5–0.2.13 used a per-run\n`tend-agent-workspace-*/checkout`, and from 0.2.14 the agent works in the\nrunner's own checkout, so `-home-runner-work-worktrunk-worktrunk/` is the\nprefix again. Match on neither literal: use the bundled\n`find \"$DEST\" -name '*.jsonl'` recipe, which holds across all of them — every\nshape is one `<session-id>.jsonl` under a single slugified directory.\n\n## Labels\n\n- `automated-fix` — fix PRs from triage\n- `nightly-cleanup` — nightly sweep issues and PRs\n\n## CI Failure Triage: Prefer Rerun for Transient Infrastructure Failures\n\nBefore opening a PR for a CI failure, classify it:\n\n- **Transient infrastructure** (link-check timeouts, apt-get flakes, GitHub\n  outages, runner disk issues, codecov upload blips) — do **not** create a\n  PR. Rerun the failed jobs yourself (**Rerunning failed jobs** in the bundled\n  `monitor-ci` skill) rather than leaving the rerun to the maintainer, and\n  report its result where you post the diagnosis. A permanent config change\n  for a one-off timeout is churn the maintainer will close.\n- **Flaky test** (known-flaky or first-seen PTY/shell test) — try to fix it.\n- **Real regression** — proceed with a fix PR.\n\n**Non-required ≠ transient.** A non-required job (e.g. `collect affected coverage`, `affected tests (linux, advisory)`) can fail from a real regression. The required/non-required distinction is about merge-blocking, not about how the failure is classified. If a deterministic build error (`error[E...]`, \"binary not found\", \"ambiguous candidates\", missing target) repeats across consecutive runs of the same shape, it's a real regression even when the job is advisory. Reserve \"transient\" for non-deterministic causes: `BrokenPipe`, `connection reset`, runner disk full, GitHub API timeouts, host-availability blips.\n\n**Lychee link-check timeouts are always transient** unless the same URL has\nfailed on at least two separate runs within the last few days. The check runs\nas the `link-check` job in the `nightly` workflow. `.config/lychee.toml`\nalready sets `max_retries = 6` and lists known-unreliable hosts; one timeout\nis not enough evidence to extend that list. Signals you have a transient\nfailure, not a broken link:\n\n- The previous run on the same or a nearby commit passed.\n- Only `[TIMEOUT]` is reported (not `404`/`403`/`410`).\n- The URL is reachable from a local `curl`.\n\nWhen in doubt, post the diagnosis on the failure cause issue and wait — don't open a PR.\n\n## Applying GitHub Suggestions\n\nApply the literal suggestion only — change the lines it covers, nothing more.\nIf surrounding lines also need updating, note that in your reply.\n\n## PR Review: Don't Self-Dismiss Over Unrelated Test Flakes\n\nIf a clearly-unrelated test or infrastructure failure turns a check red after\nyou've already approved a PR, leave the approval in place. Do **not** dismiss\nyour own approval to \"gate\" on a rerun — but do start the rerun yourself and\nreport its result; a diagnosis that says a rerun should clear the failure is\nthe cue to run it, not to hand it to the maintainer.\n\nGitHub blocks both `gh run rerun --failed` and per-job rerun\n(`POST /repos/{owner}/{repo}/actions/jobs/{id}/rerun`) with HTTP 403 while\n*any* job in the same workflow run is still `in_progress`, and\n`tend runtime rerun-failed-jobs` doesn't wait for that. Rerun failed jobs in\nworkflow runs that have finished now, and those in a run still going once it\ncompletes.\n\nRerun only runs on the PR's current head. The CI workflows' concurrency groups\nare keyed by PR number with `cancel-in-progress`, so rerunning an older head's\nrun cancels the current head's run in that workflow.\n\nThe codecov-failure dismissal pattern is different and remains correct:\n`AGENTS.md` requires explicit user approval before merging with failing\n`codecov/patch`, so dismissing the approval until the coverage gap is\naddressed is intentional.\n\n## Weigh the root-cause fix before shipping a workaround\n\nWhen a mismatch, a false positive, or a stale value has an obvious non-code\nworkaround (a template change, a config value, an alias, a comment recording\nthe drift), don't stop there. First check whether the workaround is **lossy or\nfoot-gunny**, and weigh a proportionate **root-cause code fix** before opening\na PR that only records it. A \"docs-only, no risk\" framing is not the same as\ngood guidance — a zero-code-risk change can still steer users toward a\ncollision-prone or lossy config, and annotating a stale value leaves the\nduplication that made it stale. If you do recommend a workaround, surface its\ndownsides in the PR body up front, not only when challenged.\n\nThis governs every workflow that opens a PR here, not just issue triage.\n\n## Issue Triage\n\nWhen you need more information to diagnose a reported bug, the **primary\nask is `wt -vv <command>`**. Re-running the failing command with `-vv`\nwrites a diagnostic bundle — a single report containing wt/git/OS versions,\nshell integration, `wt config show`, `git worktree list --porcelain`, and a\n`trace.log` of every git invocation with its output. The `-vv` output prints\nthe bundle's exact absolute path (`Diagnostics and performance profile\nsaved @ …`) followed by a ready-to-run `gh gist create --web\n<path>` line — **point the user at those printed lines; don't hand them a\nhardcoded path**. In particular, never tell them to `cat\n.git/wt/logs/diagnostic.md`: inside a linked worktree `.git` is a gitdir\n*file*, not a directory, so that path fails with `Not a directory (os error\n20)` (`ENOTDIR`). The bundle actually lives under the git *common* dir —\n`\"$(git rev-parse --git-common-dir)/wt/logs/diagnostic.md\"` resolves from any\nworktree, and the printed absolute path already points there. One gist URL\npasted into the issue gives us most of what we'd otherwise ask for piecemeal,\nso lead with this for unexplained failures rather than chaining\nversion/config/repro questions across multiple round-trips.\n\nWhen the report is about a slow `wt` command, read its **Performance profile**\nsection first. It renders the same breakdown as `wt config state logs profile`\n(subprocess time by command type, slowest calls, repeated `(command, context)`\npairs) directly from the bundled `trace.log`, so you can spot redundant git\ncalls and slow commands without parsing the raw trace by hand. The same\nreport run against a statusline capture is the weekly per-render cache\ncheck — see **Weekly Maintenance: Statusline Cache-Check**.\n\nReach for narrower asks only when the diagnostic is overkill:\n\n- `wt --version` — when the only question is whether a fix has landed.\n- `wt config show` — when the suspicion is purely config/shell-integration\n  and you already have the command + repro.\n\n### Don't ship fixes you can't verify\n\nWhen the bug or proposed fix turns on runtime state the bot can't observe from CI — plugin hooks firing inside an agent CLI (Claude Code, Codex, Antigravity), shell-integration side effects, interactive prompt rendering, signal forwarding into a TTY — do **not** open a PR premised on the hypothesis. Signals to stop:\n\n- The proposed transition fires inside a running agent session the bot can't drive from a test (`PostToolUse`, `Stop`, `Notification`, statusline redraws).\n- The \"analysis\" in the issue is an LLM-written trace pasted by the reporter, not a verified observation. Treat that as a starting hypothesis, not ground truth — a Claude-written explanation of why X is broken is no more trustworthy than the bot's own first guess.\n- The repro requires an interactive shell or `claude` running in a tmux that the bot can't spin up.\n\nComment on the issue with what's known, ask the reporter for the concrete symptom they observe (\"which marker shows where, when\") rather than for a fix to validate, and exit without a PR. The bar for opening a fix PR is *the failure mode is reproducible and the fix is testable*, not *the hypothesis seems plausible*. If you post a fix despite limited testability (rare — usually only when the reporter has confirmed the exact symptom and the code change is obviously correct from inspection), explicitly flag what wasn't verified in the PR body.\n\n### Feedback digest issues\n\nAn issue labeled `feedback-digest` is the weekly report, not a bug report. The\nweekly run files each confirmed bug in it as its own issue, so triage posts\nnothing on it.\n\n### Closing Duplicates\n\nWhen an issue is clearly a duplicate, close it after commenting. Use\n`gh issue close <number>` and tell the reporter: if they believe this was\nclosed in error, they can let us know and we'll reopen it.\n\n### Check `--config-set` before calling a setting unpinnable\n\n`wt --config-set '<toml>'` overrides any user config key for one invocation,\nabove both config files and `WORKTRUNK_SECTION__KEY` env vars ([inline config\noverrides](https://worktrunk.dev/config/#inline-config-overrides-config-set)).\nThe resolver just reads `repo.config().<key>` and shows no sign of that layer,\nso before writing \"there's no way to do X per invocation\", ask whether X is a\nconfig key: the ask is usually already met, and the reply is a `--config-set`\nrecipe plus a docs fix where the docs don't connect the flag to the setting.\nPinning is all that covers — weigh the request's residual asks on their own\nmerits.\n\n### Suggesting Aliases for Niche Feature Requests\n\nworktrunk deliberately limits flag and config growth, so a `wt` alias is the\nstanding answer to a narrow feature request rather than a new native flag.\nSuggest one when the request serves a single reporter's workflow or a small\nsubset of users (idempotent create-or-switch, auto-push after merge) and\ncomposes from existing `wt` commands.\n\nAnswer with a `wt` `[aliases]` entry. Defined in user config, it resolves\n`wt <name>` to the alias whenever no built-in matches, so the same alias works\nacross every repo. It's the project's preferred extension point.\n\n**How to respond:**\n1. Search open and closed issues for the same request and link the prior\n   thread; these asks recur, and the link lets the deflection read as a\n   considered position rather than a brush-off.\n2. Draft the alias.\n3. Test it in a scratch worktree against the happy path and edge cases (branch\n   already exists, dirty worktree). When a surprising behavior turns up, note\n   it in the reply instead of building the alias around it. For example, a\n   create-or-switch wrapper inherits `wt switch <name>`'s habit of\n   materializing a *remote* branch of the same name.\n4. Post the tested alias with usage examples.\n5. Link to the [aliases docs](https://worktrunk.dev/extending/#aliases) and\n   [tips & patterns](https://worktrunk.dev/tips-patterns/).\n\n## Weekly Maintenance: MSRV & Toolchain\n\nBump both MSRV and the development toolchain to **latest stable − 1**. When\nRust 1.N is the current stable release, set both to 1.(N−1).\n\nFiles to update:\n\n| File | Field | Example (if stable is 1.94) |\n|------|-------|----|\n| `Cargo.toml` | `rust-version` | `\"1.93\"` |\n| `tests/helpers/wt-perf/Cargo.toml` | `rust-version` | `\"1.93\"` |\n| `rust-toolchain.toml` | `channel` | `\"1.93.0\"` |\n| `.github/workflows/nightly.yaml` | `rustup override set nightly-<date>`, twice (`minimal-versions`, `check-unused-dependencies`) | a nightly from the last few weeks |\n\nBump the nightly pins only when the pinned date is more than three months old.\nCargo refuses a workspace whose `rust-version` exceeds the toolchain, so an\nMSRV bump past a stale pin fails both jobs before they check anything.\n\n`flake.nix` reads the channel from `rust-toolchain.toml`, so the Nix build\nfollows this bump. Dependabot keeps `flake.lock` current, including the\n`rust-overlay` revision that has to know the new channel; a lock too old for\nit fails the `nix-flake` job this PR triggers.\n\nAfter bumping, run the full test suite (`cargo run -- hook pre-merge --yes`)\nand verify `cargo msrv verify` passes.\n\n## Weekly Maintenance: CI Pin Bumps\n\nPinned third-party versions in CI are invisible to Dependabot — it follows `Cargo.toml` deps and `uses: foo@vN` action refs, not inline `version:` strings. They drift unless this step bumps them.\n\nEach weekly run checks every pin below against upstream and bumps whatever has drifted. A bump that can turn a whole CI leg red — an OS image, a major version, a tool whose version moves snapshots — goes on its own branch and PR, so a red matrix decides only that bump instead of holding back the week's safe ones. The weekly runner is Linux, so that PR's own checks are the only place a macOS or Windows change gets tested; open it and report what they said.\n\n- **`baptiste0928/cargo-install@v3` blocks** in `.github/workflows/{affected,ci,coverage,nightly}.yaml` and `.github/actions/{test,tend}-setup/action.yaml` — every `version: \"=X.Y.Z\"` against `cargo info <crate>`. Today: `cargo-affected`, `cargo-insta`, `cargo-nextest`, `cargo-llvm-cov`, `cargo-msrv`, `cargo-udeps`, `lychee`, `worktrunk`. `cargo-affected` is pinned twice in `affected.yaml`; move both together. Verify each crate's `rust-version` against the pinned toolchain and note compatibility in the PR body (see PR #1657 for the format).\n- **`hustcer/setup-nu@v3`** `version:` input — latest from `gh api repos/nushell/nushell/releases/latest --jq '.tag_name'`. Five call sites: `coverage.yaml` (`code-coverage`), `nightly.yaml` (`feature-powerset`), `benchmarks.yaml` (`benchmarks`), and `.github/actions/{test,tend}-setup/action.yaml` — `tend-setup`'s copy is what puts `nu` in the agent's sandbox, so it moves with the others.\n- **Codex Cloud tools** — `.codex/cloud.sh` pins pre-commit, cargo-insta, cargo-nextest, Nushell, and PowerShell; `setup-web` pins Nushell and PowerShell. Keep cargo-insta, cargo-nextest, and Nushell level with `.github/actions/test-setup/action.yaml`, which pins the same three — the gate runs `--all-features`, so Nushell's version moves PTY snapshots. Nothing under `.github/` pins PowerShell (CI runs whatever the runner image ships), so bump that one on its own.\n- **Docs site packages** in `docs/package.json` are covered by Dependabot's `/docs` npm entry. Do not duplicate those bumps in this manual pin pass. The one thing that pass does own is the `ignore` entry for `typescript` majors in `.github/dependabot.yaml`: it suppresses the proposal Dependabot would otherwise make, so nothing else can surface it. Check `npm view @astrojs/check peerDependencies.typescript` against the current `typescript` major and delete the entry once the range covers it — the rule is version-agnostic, so left in place it blocks a major `@astrojs/check` fully supports just as silently as the TypeScript 7 it was added for (#3877).\n- **Runner images** — every `runs-on:` label and matrix `os:`/`runner:` value in the workflows. A pin equals what its `-latest` label currently resolves to, per the availability table in `actions/runner-images`:\n\n  ```bash\n  gh api repos/actions/runner-images/contents/README.md \\\n    -H 'Accept: application/vnd.github.raw' | sed -n '/^| Image/,/^$/p'\n  ```\n\n  Bump any pin the table no longer lists against `-latest`, and update `ci.yaml`'s header comment, which records the reason for each image it names. GitHub keeps two GA images per OS and begins deprecating the older one as soon as a newer goes GA, so a pin that has fallen off `-latest` is already the next one due; the table's `deprecated` badge marks that deadline, not the moment to move, and a row badged `preview` is not a bump target.\n\n  A variant label — `-arm`, `-intel`, `-large` — has no `-latest` of its own; it follows its base image's row.\n\n  Where a pin is deliberately held back, that comment says what the repo needs from the older image. Re-check that need against the newer image each week — upstream announces image changes as issues, so `gh search issues --repo actions/runner-images \"<the need> <newer image>\"` surfaces a reversal. Reading the cited issue's state is not the test — an announcement closes when its change ships, in either direction.\n\n  The `tend-*.yaml` workflows also pin a runner, but tend's generator writes them and `uvx tend@latest init` overwrites a hand edit; file a tend issue for those.\n\nDiscovery shortcut: a recent green CI run on `main` flags cargo-install drift directly via workflow annotations. `gh run view <run-id> --json jobs --jq '.jobs[].databaseId' | xargs -I{} gh api repos/<owner>/<repo>/check-runs/{}/annotations` returns one warning per outdated pin.\n\n## Weekly Maintenance: Statusline Cache-Check\n\nDetect new in-process cache-miss duplicates introduced by recent changes by\nprofiling a real `wt list statusline --format=claude-code` trace. Asynchronous\nstatuslines such as Claude Code and tmux run the render repeatedly through a\nsession, so duplicate git subprocesses there compound into measurable\nfseventsd / IPC load.\n\n```bash\n# Run from any worktree of this repo. `jq -n` builds the stdin JSON so the\n# recipe is portable (the weekly job runs on ubuntu-24.04, whose GNU sed\n# rejects BSD's `sed -i ''`) and so a path with a quote can't corrupt it.\njq -n --arg cwd \"$PWD\" '{\n  hook_event_name: \"Status\",\n  workspace: {current_dir: $cwd},\n  model: {display_name: \"Opus\"},\n  context_window: {used_percentage: 42.0}\n}' > \"${TMPDIR:-/tmp}/statusline-input.json\"\n\n# Debug build on purpose. `tend-weekly` installs no `wt` and restores no Rust\n# cache, so `--release` means a cold optimized build of the whole dependency\n# graph before the first render. The duplicate `(command, context)` pairs this\n# check reads are profile-independent; only the timing columns, which this\n# section doesn't triage, would be worth a release build.\ncargo run -- -vv list statusline --format=claude-code \\\n  < \"${TMPDIR:-/tmp}/statusline-input.json\" > /dev/null\ncargo run -- config state logs profile --format=json | jq .cache\n```\n\nThe `.cache` report flags commands invoked more than once with the same context.\nTriage each duplicate:\n\n- **Legitimate** (different cwd, different ref form that can't be normalized,\n  intentional double-call across phases) — note in the response and move on.\n- **Cache miss** (same logical operation should hit cache but doesn't) —\n  open an issue or fix it. Common shapes: `merge_base(\"main\", \"<sha>\")` vs\n  `merge_base(\"main\", \"branch\")` keying separately;\n  `worktree_at(cwd)` vs `worktree_at(porcelain_path)` not canonicalizing.\n\n## Weekly Maintenance: LLM Model Names in Docs\n\nGrep for current Claude and Codex pins across every tracked file:\n\n```bash\ngit grep -niE \"claude|codex\"\n```\n\nCheck the latest IDs at <https://docs.anthropic.com/en/docs/about-claude/models> and <https://developers.openai.com/codex/models>. The recommended commit-message commands should use the most recent fastest model from each vendor (Haiku for Anthropic, the smallest current Codex variant for OpenAI).\n\n**On drift, open a PR — don't file an issue.** The source of truth is `after_long_help` in `src/cli/mod.rs`; edit it and let `cargo test --test integration test_docs_are_in_sync` regenerate the mirrors under `docs/src/content/docs/` and `skills/worktrunk/reference/`. The \"smallest current variant\" call is a judgment — pick the one the vendor's models page currently positions as fastest/smallest, and explain the choice in the PR body. Verifying the new model name with an installed CLI (`codex -m <name>`, etc.) isn't possible in this CI sandbox; the PR is the right output anyway, and the maintainer tests on merge.\n\n## Weekly Maintenance: Projects Worktrunk Integrates With\n\nOther projects change on their own schedules. Agent CLIs change the surfaces\nWorktrunk's plugins hook into, and packagers and module authors carry copies of\nWorktrunk that fall behind it. Each week, check both tables below.\n\nFor each change that needs action, search this repo's open issues for it, then\nfile one issue or add to the one already open. Link the upstream entry or the\ndownstream file, and say what should change and in which repository. A fix in\nanother repository needs the maintainer's go-ahead under **Filing issues in\nother repos**, and the issue here asks for it. Don't open a PR speculatively.\nIf nothing changed, say so and move on. A source that errors or returns\nnothing leaves its row unchecked, so name it rather than report no change.\n\n### Agent CLIs\n\nKeep Worktrunk making full use of each agent CLI. A release that adds something\nWorktrunk could use, to do more or to do what it already does more simply,\nneeds action as much as one that breaks something Worktrunk relies on.\n\nRead what each source published in the last week. For a GitHub repository,\nlist its releases with `gh release list -R <repo> -L 50` and read each new\none's notes with `gh release view`.\n\n| App | Source to check | Integration surface |\n|-----|-----------------|---------------------|\n| Claude Code | `gh api repos/anthropics/claude-code/contents/CHANGELOG.md -H 'Accept: application/vnd.github.raw'`, plus `curl -sL https://code.claude.com/docs/en/statusline.md` for the statusline JSON schema | statusline stdin JSON, `WorktreeCreate`/`WorktreeRemove` hooks, plugin marketplace, `/wt-switch-create` |\n| Codex | `openai/codex` | plugin marketplace |\n| Antigravity | `curl -sL https://antigravity.google/docs/changelog.md` and `curl -sL https://antigravity.google/docs/hooks.md` | plugin layout (`plugins/worktrunk/.antigravity-plugin/plugin.json`, `hooks.json`), lifecycle hooks (`SessionEnd`, worktree hooks), `agy plugin install` |\n| OpenCode | `anomalyco/opencode` | plugins API in `~/.config/opencode/plugins/` |\n| Pi | `earendil-works/pi` | the extension events `dev/pi-extension.ts` uses, loaded from `~/.pi/agent/extensions/` |\n| oh-my-pi | `can1357/oh-my-pi` | the hook events `dev/omp-hook.ts` uses, loaded from `~/.omp/agent/hooks/pre/` by its extension runner |\n\nWhat to flag:\n\n- **New statusline JSON fields** — `src/commands/statusline.rs` parses `workspace.current_dir`, `model.display_name`, `context_window.used_percentage`, and `rate_limits.{five_hour,seven_day}.{used_percentage,resets_at}`. A newly added field (session cost, PR review state) may be worth surfacing in `wt list statusline`.\n- **Renamed or removed hook events** — `WorktreeCreate`/`WorktreeRemove` route agent worktree creation through `wt`; a renamed event silently disables isolation rather than erroring.\n- **Changed plugin install mechanisms** — `wt config plugins <app> install` breaks if the marketplace, plugins directory, or hook API changes.\n\n### Projects that carry Worktrunk\n\n| Project | Source to check | What it carries |\n|---------|-----------------|-----------------|\n| Distribution packages | Repology, below | a release |\n| conda-forge | `curl -sSf https://api.anaconda.org/package/conda-forge/worktrunk` (`latest_version`); Repology doesn't list it | a release |\n| home-manager | `modules/programs/worktrunk.nix` in `nix-community/home-manager` | the shell init lines, its own Claude Code hook for each event in `plugins/worktrunk/hooks/hooks.json`, the skills path inside the package |\n| nixpkgs | `pkgs/by-name/wo/worktrunk/package.nix` in `NixOS/nixpkgs` | the `skills/` directories it installs by name, the shell completions command |\n| aqua registry | `pkgs/max-sixty/worktrunk/registry.yaml` in `aquaproj/aqua-registry`, which `mise`'s `aqua:` backend also reads | the release asset names, and the cosign certificate identity each release's `packslip.sigstore.json` is verified against |\n\nRepology reports each distribution's version and whether it is outdated:\n\n```bash\ncurl -sSf -A 'worktrunk-weekly (https://github.com/max-sixty/worktrunk)' \\\n  https://repology.org/api/v1/project/worktrunk |\n  jq -er '.[] | \"\\(.repo) \\(.version) \\(.status)\"'\n```\n\nWhat to flag:\n\n- **A package behind Worktrunk's releases for longer than its usual lag.** Find\n  its pending update, usually a bot's version-bump PR in the package's\n  repository, and say why it stalled. Stable channels that freeze versions,\n  such as NixOS stable and Manjaro stable, lag by design.\n- **A copy that no longer matches Worktrunk.** Compare the downstream file with\n  `main`: each hook event and the command it runs, each skill directory, each\n  init line. Either side's commits can open a difference. Flag one that gives\n  the copy's users different behavior from Worktrunk's own integration.\n- **A downstream change that breaks this repo's packaging**, such as\n  home-manager declaring an option that `homeModules.default` in `flake.nix`\n  also declares.\n\nWhen a project that carries Worktrunk is missing from the table, such as a new\nmodule the feedback digest turns up, add it in a PR.\n\n## Weekly Maintenance: Feedback Digest\n\nOpen an issue with a digest of public feedback on Worktrunk since the previous\none, following `references/feedback-digest.md`.\n\n## README Date Check\n\nThe README blockquote opens with a month+year (e.g., \"**April 2026**\"). During daily\nmaintenance, verify the month matches the current month and update it if stale.\n\n## Per-Workflow References\n\n- **PR review**: `@references/review-pr.md` — Rust idioms, documentation accuracy, duplication search\n- **Nightly sweep**: `@references/nightly-cleaner.md` — survey checklist, branch naming, CI-breakage ownership\n",".claude/skills/writing-user-outputs/SKILL.md":"---\nname: writing-user-outputs\ndescription: CLI output formatting standards for worktrunk. Load before editing any code that calls warning_message, hint_message, error_message, info_message, eprintln, or println, or that produces strings the user will see (CLI help, progress UI, snapshot text). Documents ANSI color nesting rules, message patterns, and output system architecture.\nmetadata:\n  internal: true\n---\n\n# Output System Architecture\n\n## Shell Integration\n\nWorktrunk uses one file-based directive for shell integration:\n\n1. Shell wrapper creates a temp file via `mktemp`\n2. Shell wrapper sets `WORKTRUNK_DIRECTIVE_CD_FILE`\n3. wt writes a raw path to the file\n4. Shell wrapper changes directory to that path after wt exits\n\n`--execute` always launches its external program directly from wt, with the\nselected worktree as its working directory. It does not use a directive.\n\n## Output Functions\n\nThe output system handles shell integration automatically. Just call output\nfunctions — they do the right thing regardless of whether shell integration is\nactive.\n\n```rust\n// NEVER DO THIS - don't check mode in command code\nif is_shell_integration_active() {\n    // different behavior\n}\n\n// ALWAYS DO THIS - just call output functions\neprintln!(\"{}\", success_message(\"Created worktree\"));\noutput::change_directory(&path)?;  // Writes to directive file if set, else no-op\n```\n\n**Printing output:**\n\nUse `eprintln!` and `println!` from `worktrunk::styling` (re-exported from\n`anstream` for automatic color support and TTY detection):\n\n```rust\nuse worktrunk::styling::{eprintln, println, stderr};\n\n// Status messages to stderr\neprintln!(\"{}\", success_message(\"Created worktree\"));\n\n// Primary output to stdout (tables, shell code, pipeable)\nprintln!(\"{}\", table_output);\n\n// Flush before interactive prompts\nstderr().flush()?;\n```\n\n`src/` holds two crates, and the path differs between them: `worktrunk::styling`\nfrom the binary's modules — the ones `src/main.rs` declares (`commands`, `cli`,\n`display`, …), which the examples throughout this skill are written for — and\n`crate::styling` from the library's, the ones `src/lib.rs` declares (`git`,\n`config`, `shell_exec`, …), where `worktrunk::` does not resolve at all. The\nguard tests accept either, so the compiler is the only thing that tells you the\npath is wrong for the file.\n\nWhich `println!` is in scope decides whether a closed pipe panics: std's\npanics on the `BrokenPipe` write error, anstream's drops it. `wt … | head`\ncloses the pipe, so command code imports the `worktrunk::styling` one and no\n`std::println!` is left in `src/`.\n\nThe stderr macros carry the same rule for a different consequence: anstream's\n`eprint!` / `eprintln!` strip ANSI when stderr isn't a terminal, std's keep it,\nso a file importing one but not the other writes escapes on one line of a\nmessage block and not the next under `wt … 2>log`. `eprint!` is the half that\nslips — it has no newline, so it gets reached for mid-block in a file that\nimported only `eprintln`. Every bare `eprint!` / `eprintln!` under `src/` must\nresolve to anstream's: import it, or qualify the call as\n`styling::eprintln!(…)`. `check_stderr_macros_come_from_styling` in\n`tests/integration_tests/output_system_guard.rs` holds that statically, since\nno snapshot can — the suite forces `CLICOLOR_FORCE=1`, so both printers emit\ncolor and a snapshot agrees whichever macro is in scope. Its\n`STD_STDERR_ALLOWED_PATHS` exempts whole files, not calls, so an entry is only\nright where std's macro is right throughout.\n\nA write that names no macro misses that scan entirely, since the scan looks for\nthe name: `writeln!(std::io::stderr(), …)`, `std::io::stderr().write_all(…)`, a\nlocked handle, a bound one. `check_raw_stderr_writes_go_through_anstream`\nrefuses those shapes too, with its own `RAW_STDERR_ALLOWED_PATHS` — currently\njust `progress.rs`, whose spinner holds one lock across a frame (anstream's\n`stderr()` has none) and is tty-gated, so nothing of its output ever reaches a\nredirected stderr. The shape to watch for is a message rendered in one place\nand printed several layers below, where the printer has no idea it is handling\nnarration: `Cmd::delayed_stream`'s progress line is the example, and a raw\nhandle there made it the only colored line in a redirected `wt switch` log.\n\n**Output whose ANSI is already decided** declares that once at the top of the\ncommand with `worktrunk::styling::ColorChoice::Always.write_global()` and then\nprints through the same anstream macros — the statusline a shell prompt or\nClaude Code renders, and the `--help-page` document whose escapes the docs\npipeline turns into HTML (`--plain` and `--help-md` declare `Never` the same\nway). Neither consumer is ever a tty, so without the declaration anstream\nwould strip their color every time — and the test suite would not catch it,\nbecause it forces color with `CLICOLOR_FORCE=1`;\n`test_color_follows_the_consumer` pins the unforced behavior. Declare `Always`\nonly when the pipe is a courier rather than the destination; anything a person\nreads directly stays on plain anstream, which is what strips color on a pipe\nand honors `NO_COLOR`.\n\n**`--format=json` answers** use `crate::output::print_json` at the command\nhandler. Inner operations return typed facts; when work can complete before a\nlater failure, retain those facts in `CommandFailure<T>`. The outer handler can\nuse `finish_output` to emit the available result once and return the original\nerror for main's readable stderr diagnostics and native exit handling. A path\nwith no result emits nothing; a legitimate JSON null remains a result.\n\n**Shell integration functions** (`src/output/global.rs`):\n\n| Function | Purpose |\n|----------|---------|\n| `change_directory(path)` | Shell cd after wt exits (writes to directive file if set) |\n| `execute(argv)` | Run an external program in the selected worktree |\n| `terminate_output()` | Reset ANSI state on stderr |\n| `is_shell_integration_active()` | Check if directive file set (rarely needed) |\n| `pre_hook_display_path(path)` | Compute display path for pre-hooks |\n| `post_hook_display_path(path)` | Compute display path for post-hooks |\n\n**Message formatting functions** (`worktrunk::styling`):\n\n| Function | Symbol | Color |\n|----------|--------|-------|\n| `success_message()` | ✓ | green |\n| `progress_message()` | ◎ | cyan |\n| `info_message()` | ○ | symbol dim, text plain |\n| `warning_message()` | ▲ | yellow |\n| `hint_message()` | ↳ | dim |\n| `error_message()` | ✗ | red |\n| `prompt_message()` | ❯ | cyan |\n\n**Section headings** (`worktrunk::styling`):\n\n```rust\nuse worktrunk::styling::format_heading;\n\n// Plain heading\nformat_heading(\"BINARIES\", None)  // => \"BINARIES\" (cyan)\n\n// Heading with suffix\nformat_heading(\"USER CONFIG\", Some(\"@ ~/.config/wt.toml\"))\n// => \"USER CONFIG @ ~/.config/wt.toml\" (title cyan, suffix plain)\n```\n\n## stdout vs stderr\n\n**Decision principle:** stdout carries the command's *answer*; stderr carries *narration* about producing it. The discriminating question is answer-vs-narration, not audience — `wt list` is \"for the user\" yet belongs on stdout because it *is* the answer. \"Is this a message to the user?\" doesn't discriminate, because nearly all output is.\n\n- **stdout** → the answer, in whatever format the user selected. Data (tables, JSON, shell code, an expanded template) and `--dry-run` previews both qualify: a preview is the whole answer when nothing mutates. Human-formatted output belongs here too. Color strips automatically on a pipe (anstream), so `wt list | grep` stays safe.\n- **stderr** → narration about doing it: progress, success/warning/error messages, hints, interactive prompts, and `-v`/`-vv` diagnostics.\n- **directive file** → the raw cd path consumed after wt exits.\n\nThe same line can flip streams between modes. `wt config shell uninstall` deletes the file, so `✓ Removed … @ ~/.zshrc` only narrates a side effect that already happened → stderr (the edited file is the answer; stdout is empty). `wt config shell uninstall --dry-run` mutates nothing, so `○ Will remove … @ ~/.zshrc` is the only answer there is → stdout. What flips isn't the wording, it's whether a side effect exists to be the answer.\n\nFor a split preview, the `--format=json` payload is the arbiter: a line json would carry goes to stdout, narration json omits stays on stderr. `wt step prune --dry-run` puts the removal plan on stdout (the same plan json emits) but keeps \"Skipped young-branch (younger than 1d)\" and \"nothing to remove\" on stderr. One case ignores all this: a preview shown *inside* an interactive prompt, such as the `?` re-preview during `wt config shell install`, is mid-prompt narration → stderr.\n\nExamples:\n- `wt list`, `wt config show` → human table/dump or `--format=json`, both to stdout\n- `wt step prune --dry-run` → the removal plan to stdout (human or json); \"nothing to remove\" and skipped-young caveats to stderr\n- `wt config shell init` → shell code to stdout (for `eval`)\n- `wt switch` → status messages only (nothing to pipe)\n\n## When to page output\n\nRoute long, human-oriented stdout through `crate::help_pager::show_help_in_pager`. The helper TTY-detects internally, so piping (`wt … | grep`) keeps working.\n\nPage when output is human-oriented (headings, gutters, structure) and plausibly exceeds one screen. Don't page pipe-first data (tables, JSON, shell code), short output, or output already paged by a delegated tool (`git diff`).\n\nExamples that page: `--help`, `wt config show`, `wt hook show`, `wt step {commit,squash} --dry-run`. Examples that don't: `wt list`, `wt step diff`, `wt step eval`, `--show-prompt` (pipe-first by design).\n\nBuild the whole output into a `String` first (don't stream), then:\n\n```rust\ncrate::help_pager::show_help_in_pager(&out, true)?;\n```\n\nThe helper falls back to plain stdout when paging is disabled or unavailable,\nstdout is not a TTY, or the pager cannot start. Propagate its result so native\nsignal failures and cancellation reach command cleanup.\n\n## Security\n\n- `WORKTRUNK_DIRECTIVE_CD_FILE` holds a raw path (no shell parsing), so it's\n  safe to pass through to alias/hook child processes — a body that writes to it\n  can at worst redirect `cd`.\n\nAll directive env vars are removed from spawned subprocesses by default via\n`shell_exec::scrub_directive_env_vars()`. `DirectivePassthrough::inherit_from_env()`\nre-adds the CD file where a nested command may redirect the parent shell.\n\n## Windows Compatibility (Git Bash / MSYS2)\n\nOn Windows with Git Bash, `mktemp` returns POSIX-style paths like `/tmp/tmp.xxx`.\nThe native Windows binary (`wt.exe`) needs a Windows path to write to the\ndirective file.\n\n**No explicit path conversion is needed.** MSYS2 automatically converts POSIX\npaths in environment variables when spawning native Windows binaries — shell\nwrappers can use `$directive_file` directly. See:\nhttps://www.msys2.org/docs/filesystem-paths/\n\n---\n\n# CLI Output Formatting Standards\n\n## User Message Principles\n\nOutput messages should acknowledge user-supplied arguments (flags, options,\nvalues) by reflecting those choices in the message text.\n\n```rust\n// User runs: wt switch --create feature --base=main\n// GOOD - acknowledges the base branch\n\"Created new worktree for feature from main @ /path/to/worktree\"\n// BAD - ignores the base argument\n\"Created new worktree for feature @ /path/to/worktree\"\n```\n\n**Avoid \"you/your\" pronouns:** Messages should refer to things directly, not\naddress the user. Imperatives like \"Run\", \"Use\", \"Add\" are fine — they're\nconcise CLI idiom.\n\n```rust\n// BAD - \"To rebase your changes onto main, run wt merge\"\n// GOOD - \"To rebase onto main, run wt merge\"\n```\n\n**Avoid redundant parenthesized content:** Parenthesized text should add new\ninformation, not restate what's already said.\n\n```rust\n// BAD - parentheses restate \"no changes\"\n\"No changes after squashing 3 commits (commits resulted in no net changes)\"\n// GOOD - clear and concise\n\"No changes after squashing 3 commits\"\n// GOOD - parentheses add supplementary info\n\"Committing with default message... (3 files, +45, -12)\"\n```\n\n**Two types of parenthesized content with different styling:**\n\n1. **Stats parentheses → Gray** (`[90m` bright-black): Supplementary numerical\n   info that could be omitted without losing meaning.\n   ```\n   ✓ Merged to main (1 commit, 1 file, +1)\n   ◎ Squashing 2 commits into a single commit (2 files, +2)...\n   ```\n\n2. **Reason parentheses → Message color**: Explains WHY an action is happening;\n   integral to understanding.\n   ```\n   ◎ Removing feature worktree & branch in background (same commit as main, _)\n   ```\n\nStats are truly optional context. Reasons answer \"why is this safe/happening?\"\nand belong with the main message. Symbols within reason parentheses still render\nin their native styling (see \"Symbol styling\" below).\n\n**Show path when hooks run in a different directory:** When hooks run in a\nworktree other than the user's current (or eventual) location, show the path.\nUse the appropriate helper function:\n\n1. **Pre-hooks and manual `wt hook`** — User is at cwd, no cd happens.\n   Use `output::pre_hook_display_path(hooks_run_at)`.\n   Examples: pre-commit, pre-merge, pre-remove, manual `wt hook post-merge`.\n\n2. **Post-hooks** — User will cd to destination if shell integration is active.\n   Use `output::post_hook_display_path(destination)`.\n   Examples: pre-start, post-switch, post-start, post-merge (after removal).\n\n```rust\n// Pre-hooks: user is at cwd, no cd happens\nexecute_planned_hook(&plan, anchor, &ctx, HookType::PreMerge, &extra_vars,\n    FailureStrategy::FailFast, crate::output::pre_hook_display_path(ctx.worktree_path))?;\n\n// Post-hooks: user will cd to destination if shell integration active\nregister_planned(&mut announcer, &plan, anchor, &ctx, HookType::PostSwitch, &extra_vars,\n    crate::output::post_hook_display_path(&destination))?;\n```\n\n**Avoid pronouns with cross-message referents:** Hints appear as separate\nmessages from errors. Don't use pronouns like \"it\" that refer to something\nmentioned in the error message.\n\n```rust\n// BAD - \"it\" refers to branch name in error message\n// Error: \"Branch 'feature' not found\"\n// Hint:  \"To create it, use --create\"\n// GOOD - self-contained hint\n// Error: \"Branch 'feature' not found\"\n// Hint:  \"To create a new branch, use --create\"\n```\n\n## Heading Case\n\nUse **sentence case** for help text headings: \"Configuration files\", \"JSON output\", \"LLM commit messages\".\n\n## Message Consistency Patterns\n\nUse consistent punctuation and structure for related messages.\n\n**Ampersand for combined actions:** Use `&` when a single operation does\nmultiple things:\n\n```rust\n\"Removing feature worktree & branch in background\"\n\"Commands approved & saved to config\"\n```\n\n**Semicolon for joining clauses:** Use semicolons to connect related information:\n\n```rust\n\"Removing feature worktree in background; retaining branch (--no-delete-branch)\"\n\"Branch unmerged; to delete, run <underline>wt remove -D</>\"  // hint uses underline\n\"{tool} not authenticated; run <bold>{tool} auth login</>\"       // warning uses bold\n```\n\n**Explicit flag acknowledgment:** Show flags in parentheses when they change\nbehavior:\n\n```rust\n// GOOD - shows the flag explicitly\n\"Removing feature worktree in background; retaining branch (--no-delete-branch)\"\n// BAD - doesn't acknowledge user's explicit choice\n\"Removing feature worktree in background; retaining branch\"\n```\n\n**Flag locality:** Place flag indicators adjacent to the concept they modify.\nFlags should appear immediately after the noun/action they affect, not at the\nend of the message:\n\n```rust\n// GOOD - (--force) is adjacent to \"worktree\" which it modifies\n\"Removing feature worktree (--force) & branch in background (same commit as main, _)\"\n// BAD - (--force) at end, disconnected from the worktree removal it enables\n\"Removing feature worktree & branch in background (same commit as main, _) (--force)\"\n```\n\nThis principle ensures readers can immediately understand what each annotation\nmodifies.\n\n**Parallel structure:** Related messages should follow the same pattern:\n\n```rust\n// GOOD - parallel structure with integration reason explaining branch deletion\n// Target branch is bold; symbol uses its standard styling (dim for _ and ⊂)\n\"Removing feature worktree & branch in background (same commit as <bold>main</>, <dim>_</>)\"  // Integrated\n\"Removing feature worktree in background; retaining unmerged branch\"                          // Unmerged\n\"Removing feature worktree in background; retaining branch (--no-delete-branch)\"              // User flag\n```\n\n**Symbol styling:** Symbols are atomic with their color — the styling is part of\nthe symbol's identity, not a presentation choice. Each symbol has a defined\nappearance that must be preserved in all contexts:\n\n- `_` and `⊂` — dim (integration/safe-to-delete indicators)\n- `+N` and `-N` — green/red (diff indicators)\n\nWhen a symbol appears in a colored message (cyan progress, green success), close\nthe message color before the symbol so it renders in its native styling. This\nrequires breaking out of the message color and reopening it after the symbol.\nSee `FlagNote` in `src/output/handlers.rs` for an example — it handles flag\nacknowledgment notes (like integration reasons) with proper color transitions\nvia its `after(color)` method, which reopens the message color after the symbol.\n\n**Comma + \"but\" + em-dash for limitations:** When stating an outcome with a\nlimitation and its reason:\n\n```rust\n// Outcome, but limitation — reason\n\"Worktree for feature @ ~/repo.feature, but cannot change directory — shell integration not installed\"\n```\n\nThis pattern:\n- States what succeeded (worktree exists at path)\n- Uses \"but\" to introduce what didn't work (cannot cd)\n- Uses em-dash to explain why (shell integration status)\n\nSee `compute_shell_warning_reason()` in `src/output/shell_integration.rs` for the\ncomplete spec of shell integration warning messages and hints\n\n**Compute decisions once:** For background operations, check conditions upfront,\nshow the message, then pass the decision explicitly rather than re-checking in\nbackground scripts:\n\n```rust\n// GOOD - check once, pass decision\nlet should_delete = check_if_merged();\nshow_message_based_on(should_delete);\nspawn_background(build_command(should_delete));\n\n// BAD - check twice (once for message, again in background script)\nlet is_merged = check_if_merged();\nshow_message_based_on(is_merged);\nspawn_background(build_command_that_checks_merge_again());  // Duplicate check!\n```\n\n## Warning Ordering\n\n**Core principle:** Messages about state discovered during evaluation\n(warnings, info notices) appear **before** the action message that follows\nfrom that evaluation.\n\nWhen a command evaluates state, discovers something unexpected, and proceeds\nanyway, that message comes first:\n\n```\n▲ Auto-staging 1 untracked path:\n  notes.md\n◎ Generating commit message...\n```\n\nNot:\n\n```\n◎ Generating commit message...\n▲ Auto-staging 1 untracked path:\n  notes.md\n```\n\nWarnings that result from the action itself (something failed during execution)\nnaturally come after the action.\n\n## Message Types\n\n**Success vs Info:** Success (✓) means something was created or changed. Info\n(○) acknowledges state without changing anything.\n\n| Success ✓                               | Info ○                                |\n| --------------------------------------- | ------------------------------------- |\n| \"Created worktree for feature\"          | \"Switched to worktree for feature\"    |\n| \"Created new worktree for feature\"      | \"Already on worktree for feature\"     |\n| \"Commands approved & saved\"             | \"All commands already approved\"       |\n\nThe same rule governs standalone symbols used as per-row markers in listings:\n✓ marks a completed action, never a state. A listing that reports per-item\nstatus marks it with ○ (state acknowledged) or ❯ (awaiting approval/user\ninput) — the shared vocabulary of `wt hook show` and `wt config approvals\nlist`. Reserve a per-row ✓ for outcomes of work the command just performed\n(shell-install action lines, `-v` subprocess trace glyphs).\n\n**Hint vs Info:** Hints suggest user action or provide additional non-essential\ncontext (supplementary details the user doesn't need but may find useful). Info\nacknowledges state without changing anything.\n\n| Hint ↳                                          | Info ○                                |\n| ------------------------------------------------ | ------------------------------------- |\n| \"To continue, run `wt merge`\"                    | \"Already up to date with main\"        |\n| \"Commit or stash changes first\"                  | \"Skipping hooks (--no-hooks)\"         |\n| \"Branch can be deleted\"                           | \"Worktree preserved (main worktree)\"  |\n| \"Failed command, exit code 128:\"                   |                                       |\n\n**Warning placement:** When something unexpected happens, warn somewhere. Where\ndepends on the nature of the issue:\n\n```\nIs it unexpected?\n├── No → Silent (e.g., gh not installed when no GitHub remote)\n└── Yes → Warn somewhere:\n    ├── Immediate impact OR temporary → Inline (warning_message or in-band indicator)\n    ├── Persists until user action → wt config show (can be checked later)\n    └── Not user-fixable → log::warn! (developer diagnostics)\n```\n\n**Inline warnings** for issues affecting the current command:\n\n| Issue | Why inline |\n|-------|------------|\n| Rate limit during CI fetch | Temporary — won't be there next time |\n| Network timeout | Temporary — retry might work |\n| Hook failed during operation | Immediate impact on this command |\n\n**`wt config show`** for issues that persist until the user fixes them. These\ndon't need to interrupt every command — users can check diagnostics when\ninvestigating:\n\n| Issue | Why config show |\n|-------|-----------------|\n| `gh` not authenticated | User runs `gh auth login` |\n| Shell integration misconfigured | User updates shell config |\n| Config syntax errors | User fixes config file |\n\n**`log::warn!()`** for issues users cannot fix. These help developers debug but\nshouldn't clutter user output:\n\n| Issue | Why log::warn! |\n|-------|----------------|\n| JSON parse error (API changed) | Requires code fix |\n| Internal invariant violated | Developer bug |\n\n**Command suggestions in hints:** When a hint includes a runnable command, use\n\"To X, run Y\" pattern. End with the command for easy copying:\n\n```rust\n// GOOD - command at end for easy copying\n\"To delete the unmerged branch, run wt remove feature -D\"\n\"To rebase onto main, run wt step rebase or wt merge\"\n\n// GOOD - recovery command after shadowing a remote branch\n\"To switch to the remote branch, delete this branch and run without --create: wt remove --foreground feature && wt switch feature\"\n\n// BAD - command without context\n\"wt remove feature -D deletes unmerged branches\"\n\n// BAD - command not at end (hard to copy)\n\"Run wt switch feature (without --create) to switch to the remote branch\"\n```\n\nFor general action guidance without a specific command, direct imperatives are\nclearer:\n\n```rust\n// GOOD - direct imperative for general guidance\n\"Commit or stash changes first\"\n\"Run from inside a worktree, or specify a branch name\"\n\n// VERBOSE - \"To proceed\" adds nothing\n\"To proceed, commit or stash changes first\"\n```\n\n**Description + command in single message:** For warnings/errors that include a\nrecovery command, join with semicolon, and order the recovery \"To X, run Y\" as\nhints do, so the command still ends the line. Use `<bold>` for commands in\nwarnings/errors (only hints use `<underline>`):\n\n```rust\n// Warning with inline recovery command (bold for commands)\nwarning_message(\"Failed to restore stash; to restore manually, run <bold>git stash pop {ref}</>\")\nwarning_message(\"{tool} not authenticated; run <bold>{tool} auth login</>\")\n\n// For longer suggestions, use separate hint message (underline for commands)\nwarning_message(\"Failed to restore stash\")\nhint_message(\"To restore manually, run <underline>git stash pop {ref}</>\")\n```\n\n**Multiple suggestions in one hint:** When a message has a second suggestion,\nfold both into one hint with a semicolon rather than adding another\n`hint_message`, and put the more commonly needed command last for easy\nterminal copying:\n\n```rust\n// GOOD - common action (create) last, easy to select and copy\n\"To list branches, run wt list --branches; to create a new branch, run wt switch feature --create\"\n\n// BAD - common action buried, harder to copy\n\"To create a new branch, run wt switch feature --create; to list branches, run wt list --branches\"\n```\n\nUse `suggest_command()` from `worktrunk::styling` for proper shell escaping.\n\n**Every user-facing message requires either a symbol or a gutter.**\n\n**Section titles:** For sectioned output (`wt hook show`, `wt config show`), use\n`format_heading()` from `worktrunk::styling` (documented above).\n\n## Interactive Prompts vs Non-Interactive Hints\n\nPrompts and hints serve different purposes and have different `--yes` behavior.\n\n**Prompts** are expected steps in a workflow — the user ran a command knowing\nit would ask for confirmation. Hook approval during `wt merge`, config update\nconfirmation, shell install confirmation. `--yes` bypasses these because the\nuser anticipated the question and wants to pre-answer it (e.g., in CI).\n\n**Setup prompts** are unexpected — the user ran `wt merge` and got asked about\nLLM config or shell integration they didn't know about. `--yes` must NOT\nbypass these. A user passing `--yes` to skip hook approval did not consent to\nauto-configuring their shell. In non-interactive mode (no TTY), these should\ndegrade to a hint or be skipped silently — never error.\n\n| Type | Example | `--yes` | Non-TTY behavior |\n|------|---------|---------|------------------|\n| Workflow prompt | Hook approval, config update | Bypasses | Error (`NotInteractive`) |\n| Setup prompt | LLM config, shell integration | No effect | Hint or silent skip |\n\n**Non-TTY degradation patterns:**\n\n- **Hint** — when the user benefits from knowing about the option on every run.\n  Shell integration hint: `↳ To enable automatic cd, run wt config shell install`\n- **Silent skip** — when a hint would be noise. Commit generation setup prompt\n  skips silently because a separate fallback hint (`emit_hint_if_needed`)\n  already covers the unconfigured case on every commit.\n- **Error** — only for workflow prompts where proceeding without consent is\n  unsafe (hook approval). The error includes a hint for the fix:\n  `↳ To skip prompts in CI/CD, add --yes`\n\n**Key invariants:**\n\n- Hints shown in non-TTY mode must NOT set skip flags — hints are not prompts,\n  and should repeat on every non-TTY run\n- `--yes` means \"I anticipated this prompt\" — it applies to workflow prompts\n  the user chose to invoke, not to setup/config discovery prompts\n\n## Blank Line Principles\n\n**Core principle:** When presenting the user with text to read and consider, add\nspacing for readability. When piping output (stdout), keep output dense for\nparsing.\n\nSpecific rules:\n\n- **No leading/trailing blanks** — Start immediately, end cleanly\n- **Blank before prompts, not after** — Signal \"pause, something interactive is\n  happening\" before the prompt; once the user responds, output flows continuously.\n  The blank belongs to the narration it separates from, so the caller emits it\n  and `prompt_yes_no_preview` does not: a prompt that opens a command's output\n  (`wt config shell install`, `wt config plugins claude install`, the\n  commit-generation offer at the top of `wt merge`) starts flush, since a blank\n  there is a leading blank\n- **One blank between phases** — When a sub-operation completes and a different\n  operation begins, add a blank line to visually separate them\n- **Never double blanks** — One blank line maximum between elements\n- **Hints attach to their subject** — Never put a blank line between a hint and\n  the message it elaborates on. Hints (↳) are subordinate — they belong directly\n  below their parent message with no gap.\n\n  ```\n  // GOOD - hint directly follows its subject\n  ↳ fish: Not configured shell extension\n  ↳ To configure, run wt config shell install\n\n  // BAD - blank line detaches hint from subject\n  ↳ fish: Not configured shell extension\n\n  ↳ To configure, run wt config shell install\n  ```\n\n**Prompt spacing:** A blank line before a prompt that follows narration signals\n\"something different is about to happen\" and gives the user's eye a natural\nstopping point before they need to read and respond. No blank line after — the\nuser's input ends the interactive moment and subsequent output flows naturally\nfrom that decision. A prompt with nothing above it, like the setup offer below\nat the top of `wt step commit`, has nothing to separate from and starts flush.\n\n```\n❯ Configure claude for commit messages? [y/N/?] y\n✓ Added to user config:\n  [commit.generation]\n  command = \"...\"\n↳ View config: wt config show\n\n▲ Auto-staging 1 untracked path:\n  a\n◎ Generating commit message...\n```\n\n**Phase separation:** A \"phase\" is a logically distinct operation. The blank\nline between the hint and warning above signals \"config setup is done, now we're\ndoing the main command workflow.\"\n\n**Interactive prompts** must flush stderr before blocking on stdin:\n\n```rust\neprint!(\"❯ Allow and remember? [y/N] \");\nstderr().flush()?;\nio::stdin().read_line(&mut response)?;\n```\n\n## Temporal Locality: Output Should Be Close to Operations\n\nOutput should appear immediately adjacent to the operations it describes.\nProgress messages apply only to slow operations (>400ms): git operations,\nnetwork requests, builds.\n\nSequential operations should show immediate feedback:\n\n```rust\nfor item in items {\n    eprintln!(\"{}\", progress_message(format!(\"Removing {item}...\")));\n    perform_operation(item)?;\n    eprintln!(\"{}\", success_message(format!(\"Removed {item}\")));  // Immediate feedback\n}\n```\n\nBad example (output decoupled from operations):\n\n```\n◎ Removing worktree for feature...\n◎ Removing worktree for bugfix...\n                                    ← Long delay, no feedback\nRemoved worktree for feature        ← All output at the end\nRemoved worktree for bugfix\n```\n\nSigns of poor temporal locality: collecting messages in a buffer, single success\nmessage for batch operations, no progress before slow operations.\n\n## Spinners for Long Single-Operation Work\n\nWhen per-item `progress_message`s don't fit — recursive copy of thousands of\nfiles, a long subprocess with no useful streaming output — a stderr spinner\nkeeps the user oriented. See `src/progress.rs` (`Progress`) for the pattern:\nthe verb (`\"Copying\"`, `\"Removing\"`) is fixed at `Progress::start(verb)`,\nTTY-gate, skip when `verbosity() >= 1` or `--dry-run`, ≥300 ms startup delay\nso fast ops stay silent, IEC bytes (KiB/MiB), clear the line before printing\nthe summary, and have the summary repeat any counters the spinner displayed\n(use `format_stats_paren` for the gray `(N files · X MiB)` suffix).\n\n## Defer Non-Essential Work Until After Primary Output\n\nFire-and-forget cleanup and cache sweeps run after the command's final\nuser-visible message — never before. Placing them at the start delays\ntime-to-first-output with work the user didn't ask for.\n\nWorktrunk marks the boundary with `WORKTRUNK_FIRST_OUTPUT`: handlers\nearly-return where output begins, so work before that return is on the hot\npath, work after it is not. See `handle_remove_command` —\n`run_internal_sweep` runs after `handle_remove_output`.\n\n## Information Display: Show Once, Not Twice\n\nProgress messages should include all relevant details (what's being done,\ncounts, stats, context). Success messages should be minimal, confirming\ncompletion with reference info (hash, path).\n\n```rust\n// GOOD - detailed progress, minimal success\neprintln!(\"{}\", progress_message(\"Squashing 3 commits & working tree changes into a single commit (5 files, +60)...\"));\nperform_squash()?;\neprintln!(\"{}\", success_message(\"Squashed @ a1b2c3d\"));\n```\n\n## Section and Glyph Spacing\n\nWhen composing tightly-packed output where adjacent pieces carry distinct\nmeaning (the statusline segments, prefix-char indicators like `@+1`, `↓1`,\n`?^|`), pack sections flush — no separating space. The marker and its value\nread as one unit, and visual density keeps the line short.\n\nThe one exception is **emoji**: leave a trailing space after an emoji glyph.\nMost terminals render emoji as double-width and bleed the glyph into the cell\nto its right, so a flush `🌔65%` collides the moon with the digits. A space\n(`🌔 65%`) keeps them legible. ASCII and narrow Unicode markers (`@`, `↓`, `●`,\n`⊂`) don't have this problem and stay flush.\n\n```rust\n// GOOD - ASCII marker flush with its value\nformat!(\"@{added}\");          // @+1\n// GOOD - emoji gets a trailing space to clear the next cell\nformat!(\"{moon} {pct:.0}%\");  // 🌔 65%\n// BAD - emoji runs into the digits; terminals overlap the glyph\nformat!(\"{moon}{pct:.0}%\");   // 🌔65%\n```\n\n## Style Constants\n\nOnly three `anstyle` constants exist for table rendering (`src/styling/constants.rs`):\n\n- `ADDITION`: Green (diffs)\n- `DELETION`: Red (diffs)\n- `GUTTER`: BrightWhite background\n\nFor everything else, use `cformat!` tags.\n\n## Styling in Command Code\n\nUse `eprintln!` with formatting functions. Use `cformat!` for inner styling:\n\n```rust\neprintln!(\"{}\", success_message(cformat!(\"Created <bold>{branch}</> from <bold>{base}</>\")));\neprintln!(\"{}\", hint_message(cformat!(\"To continue, run <underline>wt merge</>\")));\n```\n\n**color-print tags:** `<bold>`, `<dim>`, `<underline>`, `<bright-black>`, `<red>`,\n`<green>`, `<yellow>`, `<cyan>`, `<magenta>`\n\n**Branch names and status values** should be bolded in messages.\n\n**Symbol constants in cformat!:** For messages that bypass output:: functions\n(e.g., `GitError` Display impl), use symbol constants directly:\n\n```rust\ncformat!(\"{ERROR_SYMBOL} <red>Branch <bold>{branch}</> not found</>\")\n```\n\n## Commands and Branches in Messages\n\nNever quote commands or branch names. Use styling to make them stand out:\n\n- **In normal font context**: Use `<bold>` for commands and branches\n- **In hints**: Use `<underline>` for commands and data values (paths,\n  branches). Underline is safe inside `<dim>` — closing `[24m` only resets\n  underline, preserving dim. Avoid `<bold>` inside hints — the closing `[22m`\n  resets both bold AND dim, so text after `</bold>` loses dim styling.\n\n```rust\n// GOOD - bold in normal context\neprintln!(\"{}\", info_message(cformat!(\"To continue, use <bold>wt merge</>\")));\n// GOOD - underline for commands in hints\neprintln!(\"{}\", hint_message(cformat!(\"To see worktrees, run <underline>wt list</>\")));\n// BAD - quoted commands\neprintln!(\"{}\", hint_message(\"To see worktrees, run 'wt list'\"));\n```\n\n## Hyperlinks\n\nEvery OSC 8 link is underlined. Link text is sized to fit a column (`#3604`,\n`:11486`) and reads as ordinary content, and color already carries state (the\nCI verdict, dim for a port nothing answers on), so the underline is what marks\na run of text as clickable.\n\n`worktrunk::styling::hyperlink(url, text)` emits the link and its underline\ntogether, which is what keeps the rule true at every call site. It closes with\n`[24m`, leaving a surrounding color or dim intact.\n\n```rust\n// GOOD - the helper carries the underline\nlet cell = hyperlink(url, &format!(\":{port}\"));\n// GOOD - a caller's own style wraps the link\nformat!(\"{style}{}{style:#}\", hyperlink(url, text))\n// BAD - hand-assembled sequences, unmarked link\nformat!(\"{}{text}{}\", osc8::Hyperlink::new(url), osc8::Hyperlink::END)\n```\n\nText that isn't a link stays plain, and whether a run of text is a link belongs\nto the render rather than to the cell emitting it: `LayoutConfig::link_style`\nanswers it once for a whole row, so a CI reference and a dev-server port can't\ndisagree. Two destinations carry no links, and so no underline: a terminal\nwithout OSC 8 support, where `wt list` prints the dev-server URL in full, and\nthe picker's rows, which `Destination::picker` renders as\n`LinkStyle::Unlinked` (that variant's docstring has the reason). Nothing in the\npicker is clickable, by two routes: a row's link style is decided at render\ntime, so it carries no OSC 8 to begin with, and the preview pane is parsed by\nskim through `ansi_to_tui`, which keeps none. Underline there is\nfree to mean something else, and the preview pane spends it twice: on a URL,\nmarking a reference rather than a link (`pr_pane::url_line`), and on the active\ntab in the tab bar (`items::render_preview_tabs`).\n\n## Design Principles\n\n- **`cformat!` for styling** — Never manual escape codes (`\\x1b[...`)\n- **`cformat!` variables are safe** — Tags like `<bold>` are processed at compile\n  time only. Runtime variable values are NOT interpreted as markup, so user\n  content (branch names, commit messages, paths, shell commands with `<`/`>`\n  redirects) can be interpolated directly without escaping. Do NOT escape\n  `<`/`>` in variables — it adds extra chars.\n- **YAGNI** — Most output needs no styling\n- **Graceful degradation** — Styling follows the consumer (NO_COLOR, TTY\n  detection). Plain output preserves meaning through wording, spacing and\n  existing semantic symbols. Missing decoration alone does not justify new\n  markers; add text when information would otherwise be lost.\n- **Unicode-aware** — Width calculations respect symbols and CJK (via `StyledLine`)\n\n**StyledLine** for table rendering with proper width calculations:\n\n```rust\nuse worktrunk::styling::StyledLine;\nuse anstyle::{AnsiColor, Color, Style};\n\nlet mut line = StyledLine::new();\nline.push_styled(\"Branch\", Style::new().dimmed());\nline.push_raw(\"  \");\nline.push_styled(\"main\", Style::new().fg_color(Some(Color::Ansi(AnsiColor::Cyan))));\nprintln!(\"{}\", line.render());\n```\n\nSee `src/commands/list/render.rs` for advanced usage.\n\n## Documentation Examples\n\nUse consistent examples throughout all documentation, help text, and config\ntemplates.\n\n### Canonical example setup\n\n| Element | Value | Notes |\n|---------|-------|-------|\n| Repo directory | `myproject` | Generic placeholder |\n| Repo path | `~/code/myproject` | Realistic dev path |\n| Branch | `feature/auth` | Shows sanitize filter |\n| Worktree path | `~/code/myproject.feature-auth` | Result of default template |\n\n### Template variable examples\n\nUse the canonical values from the table above in all examples:\n\n```\n{{ repo }}           — Repository directory name (e.g., `myproject`)\n{{ branch }}         — Branch name (e.g., `feature/auth`)\n{{ worktree_path }}  — Absolute path to worktree (e.g., `/path/to/myproject.feature-auth`)\n```\n\nIn TOML comments:\n```toml\n#   {{ repo }}           - Repository directory name (e.g., \"myproject\")\n#   {{ branch }}         - Raw branch name (e.g., \"feature/auth\")\n#   {{ worktree_name }}  - Worktree directory name (e.g., \"myproject.feature-auth\")\n```\n\n### Worktree path examples\n\nWhen showing worktree-path template examples:\n\n```toml\n# Default — siblings in parent directory\n# Creates: ~/code/myproject.feature-auth\nworktree-path = \"../{{ repo }}.{{ branch | sanitize }}\"\n\n# Inside the repository\n# Creates: ~/code/myproject/.worktrees/feature-auth\nworktree-path = \".worktrees/{{ branch | sanitize }}\"\n```\n\n## Gutter Formatting\n\nUse gutter for **quoted content** (git output, commit messages, config to copy,\nhook commands being displayed).\n\nThe gutter is a background-colored blank column followed by a space. Plain\noutput keeps the two-space indent. Gutter examples in this skill show that plain\nform.\n\n- `format_bash_with_gutter()` — shell commands (dimmed + syntax highlighting)\n- `format_with_gutter()` — other content\n\n**Gutter vs Table:** Tables for structured app data; gutter for quoting external\ncontent.\n\n**Gutter vs Hints:** Command suggestions in hints use inline `<underline>`,\nnot gutter. Gutter is for displaying content (what will execute, config to\ncopy); hints suggest what the user should run.\n\n## Newline Convention\n\n**Core principle:** All formatting functions return content WITHOUT trailing\nnewlines. Callers handle element separation.\n\nThis applies to:\n- Message functions: `error_message()`, `success_message()`, `hint_message()`, etc.\n- Gutter functions: `format_with_gutter()`, `format_bash_with_gutter()`\n\n**With `eprintln!`:** Adds trailing newline automatically.\n\n```rust\neprintln!(\"{}\", progress_message(\"Merging...\"));\neprintln!(\"{}\", format_with_gutter(&log, None));\n```\n\n**In Display impls:** Use explicit newlines for element separation.\n\n```rust\n// Pattern: leading \\n separates from previous element\nwrite!(f, \"{}\", error_message(...))?;           // first element, no leading \\n\nwrite!(f, \"\\n{}\", format_with_gutter(...))?;    // gutter, separated by \\n\nwrite!(f, \"\\n{}\", hint_message(...))            // hint, separated by \\n\n\n// For blank line between elements, add extra \\n\nwrite!(f, \"\\n{}\\n\", format_with_gutter(...))?;  // trailing \\n creates blank line\nwrite!(f, \"\\n{}\", hint_message(...))            // hint after blank line\n```\n\n**Don't add trailing `\\n` to content:**\n\n```rust\n// GOOD - eprintln! adds newline\neprintln!(\"{}\", progress_message(\"Merging...\"));\n\n// BAD - double newline\neprintln!(\"{}\", progress_message(\"Merging...\\n\"));\n```\n\n**Avoid bullets — use gutter instead.** Instead of `\"\\n  - {}: {}\"` bullet\nformatting, use `format_with_gutter()` to present lists.\n\n## Error Formatting\n\n### Error Message Structure\n\nError and warning messages should communicate four things:\n\n1. **What happened** — The actual state or outcome\n2. **What was expected** — The correct or desired state\n3. **The impact** — Why this matters (optional for obvious cases)\n4. **How to resolve** — What the user should do (can be a separate hint message)\n\n```rust\n// GOOD - states actual, expected, and impact in main message\n\"Shell probe: wt is binary at /path, not function — won't auto-cd\"\n//                 ^^^^^^^^^^^^^^^   ^^^^^^^^^^^^   ^^^^^^^^^^^^^^\n//                 actual            expected       impact\n// Resolution in separate hint: \"Restart shell to activate\"\n\n// GOOD - actual vs expected with resolution inline\n\"Config file has 3 errors, expected valid TOML; run wt config validate for details\"\n//              ^^^^^^^    ^^^^^^^^                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n//              actual     expected                  resolution\n\n// BAD - only states actual, no expected or impact\n\"Shell probe: wt resolves to binary at /path\"\n// Missing: what should it be instead? why does it matter?\n\n// BAD - vague, no actionable information\n\"Shell integration problem detected\"\n// Missing: what's wrong? what should it be? what to do?\n```\n\nWhen the expected state is obvious from context, it can be implied:\n\n```rust\n// OK - expected state (file should exist) is obvious\n\"Config file not found at ~/.config/wt/config.toml\"\n\n// OK - expected state (should succeed) is obvious\n\"Failed to read config: permission denied\"\n```\n\n**Diagnostic messages** (like `wt config show`) should follow this pattern\nespecially carefully — users read diagnostics to understand what's wrong.\n\n### Single vs Multi-line\n\n**Single-line errors** with variables are fine:\n\n```rust\n// GOOD - single-line with path variable\n.map_err(|e| format!(\"Failed to read {}: {}\", format_path_for_display(path), e))?\n\n// GOOD - using .context() for simple errors\nstd::fs::read_to_string(&path).context(\"Failed to read config\")?\n```\n\n**Multi-line external output** (git, hooks, LLM) needs gutter:\n\n1. Show the command that was run (with arguments)\n2. Put multi-line output in a gutter\n\n```\n✗ Commit generation command 'llm --model claude' failed\n  Error: [Errno 8] nodename nor servname provided\n\n// NOT: ✗ ... failed: LLM command failed: Error: [Errno 8]...\n```\n\nSee `src/git/error.rs` for examples of this pattern in `GitError` Display impls.\n\n## Verbose Output (`-v` and `-vv`)\n\n**`-v` (verbose):** User-facing diagnostic output. Must follow these guidelines.\nShows template expansions and other details users might need for debugging config.\n\nTemplate expansion shows the source template and the rendered result as two\nlabeled blocks. Each block is a bash gutter (dim + syntax highlighting via\n`format_bash_with_gutter`) under its own info header (`○` symbol, bold name,\nthen `source` or `result`):\n```\n○ name source\n  template\n○ name result\n  result\n```\n\nThe two headers carry the input/output distinction, so both blocks share the\nsame gutter and the content always starts at the gutter's column 2 (no marker\nglyph or extra indent inside the gutter). Multi-line templates and results\nfollow the same shape, one gutter line per source line.\n\n`expand_template` emits no trailing blank, so a standalone caller adds one to\nseparate the block from what follows (`wt step eval` does this after the view).\nIn a command pipeline the executor already separates the block from the next\noutput, so the expansion adds nothing.\n\n**`-vv` (debug):** Developer-facing logging output. MAY violate these guidelines.\nUses `log::debug!()` with structured format for deep debugging. Not intended for\nregular users.\n\n## Path Formatting\n\n**All user-facing paths must use `format_path_for_display()`** from\n`worktrunk::path`. This function replaces home directory prefixes with `~` for\nreadability (e.g., `/Users/alex/projects/repo` → `~/projects/repo`).\n\n**Use `@` (not \"at\") before paths in all user-facing output.** This is the\ncodebase convention for associating an entity with a location — in status\nmessages, section headings, hints, and everywhere else:\n\n```rust\n// GOOD - @ before path\n\"Created worktree for feature @ ~/code/repo.feature\"\n\"Squashed @ a1b2c3d\"\n\"Worktree for feature @ ~/repo.feature, but cannot change directory...\"\nformat_heading(\"USER HOOKS\", Some(&format!(\"@ {}\", format_path_for_display(p))))\n\n// BAD - \"at\" before path\n\"Created worktree for feature at ~/code/repo.feature\"\n// BAD - heading without @\nformat_heading(\"USER HOOKS\", Some(&format_path_for_display(p)))\n```\n\n**Exception:** Prose contexts (doc comments, help text) use \"at\" — `@` is for\nterse output only.\n\n```rust\nuse worktrunk::path::format_path_for_display;\n\n// GOOD - uses format_path_for_display\neprintln!(\"{}\", success_message(cformat!(\n    \"Created worktree @ {}\",\n    format_path_for_display(&worktree_path)\n)));\n\n// GOOD - error messages too\n.map_err(|e| format!(\"Failed to read {}: {}\", format_path_for_display(path), e))?\n\n// BAD - raw path.display()\neprintln!(\"{}\", success_message(format!(\n    \"Created worktree @ {}\",\n    worktree_path.display()  // Shows /Users/alex/... instead of ~/...\n)));\n```\n\n**Applies to:**\n- Success/info/warning/error messages\n- Section headings (`format_heading` with path suffix)\n- Hints suggesting paths\n- Progress messages\n- Dry-run previews\n\n**Exceptions:**\n- Debug logging (`log::debug!`) — full paths help debugging\n- Paths passed to git commands — must be real paths\n\n## Table Column Alignment\n\n- **Text columns** (Branch, Path, Message): left-aligned\n- **Single-value numeric columns** (Age): right-aligned, so `now` and `4m` line\n  up on the unit\n- **Diff columns** (@±, ^↕): two right-aligned halves either side of a\n  separator (`+999 -999`); a state for the whole field, such as a loading or\n  in-sync marker, is centered\n\nA header follows its content, except over a diff column, where it centres:\npushed to either edge it stands over one half and reads as that half's label,\nleaving a lone `+1` stranded left of `@±`.\n\nRows carry no trailing padding. Padding places a cell; past the last one it\nplaces nothing, and a reader who selects the row gets it anyway.\n\n## Snapshot Testing\n\nEvery command output must have snapshot tests (`tests/integration_tests/`).\nSee `tests/integration_tests/remove.rs` for the standard pattern using\n`setup_snapshot_settings()`, `make_snapshot_cmd()`, and `assert_cmd_snapshot!()`.\n\nCover success/error states, with/without data, and flag variations.\n","plugins/worktrunk/skills/wt-switch-create/SKILL.md":"---\nname: wt-switch-create\ndescription: Create a new worktrunk worktree (optionally in another repo) and switch this session's working directory into it. Use when launching a session that should work in its own worktree.\nargument-hint: \"[<branch>] [<repo>] [-- <task>]\"\nlicense: MIT OR Apache-2.0\ncompatibility: Requires the `wt` CLI (https://worktrunk.dev)\n---\n\nArguments: `$ARGUMENTS`. Grammar: `[<branch>] [<repo>] [-- <task>]`.\n\n- **branch** — optional; the branch name for the new worktree. When omitted,\n  pick one (step 1 below).\n- **repo** — optional path or name; create the worktree in this repo instead\n  of the session's current one.\n- **task** — optional; what to do inside the new worktree. No task means enter\n  the worktree and wait.\n\nTokens before the `--` are the branch and/or repo. A path-shaped token\n(starting with `/`, `~`, `./`, or `../`) is the repo. A bare name can be\neither, so make an informed guess. It is the branch when the current repo\nalready has a branch by that name, as it is for `wt switch` itself. Otherwise\nit is the repo when a git repository by that name exists where the user keeps\nrepos (beside the current repo, or in a workspace directory like\n`~/workspace`), and the branch when none does (`docs` is a branch, not the\ncurrent repo's `docs/` directory). A name read as the repo carries its absolute\npath forward: that path, not the bare token, is the `<repo>` in step 3. Two\ntokens that both read as branches don't fit the grammar — ask. Without a `--`,\njudge where the task starts: leading tokens that read as a branch name\n(`fix-auth`) or a repo are consumed as such, and the rest is the task;\notherwise the whole input is the task (`fix the parser bug` has no\nbranch-shaped lead — all task).\n\n```\n/wt-switch-create my-feature -- fix the parser bug\n/wt-switch-create -- fix the parser bug\n/wt-switch-create my-feature ~/workspace/other-repo -- fix the parser bug\n/wt-switch-create my-feature\n```\n\n## What to do\n\nCreating the worktree comes first on every invocation, before any other work.\nThe invocation is itself the explicit request to create it; a research or\nread-only task gets one all the same.\n\n<!-- Maintainers: rationale.md (same directory) covers the harness rules and\ndesign choices behind this — read it before re-adding guards or routes. -->\n\n1. **Pick a new branch name** if none was given: short, from the task and\n   consistent with existing worktree names, or, mid-session, from the work\n   being moved; with nothing to derive from, ask.\n\n2. **With no repo argument, create and enter in one call:**\n   `EnterWorktree({name: \"<branch>\"})`. Worktrunk's `WorktreeCreate` hook runs\n   `wt switch --create` for a new branch or `wt switch` for an existing one,\n   creating its checkout if needed. The result is an ordinary `wt` worktree,\n   and the user sees no confirmation prompt. On success, do the task (or,\n   with no task text, confirm it's ready and wait).\n\n   Mid-session, carry uncommitted work across: `git stash push -u` before the\n   `EnterWorktree` call, then `git stash pop` once the session is in the new\n   worktree, which is after step 3 if this call fails. Entering re-roots the\n   session into the new worktree, and the stash is shared across worktrees. If\n   step 3 hands back without the session in the new worktree, restore the work\n   where it came from first (`git -C <that worktree> stash pop`).\n\n3. **Otherwise create it with `wt` and enter by path.** Two cases reach here: a\n   repo argument, which step 2 can't target, and a failed step 2, whose error\n   says `Already in a worktree session`. Create with a `Bash` call (omit\n   `-C <repo>` for this repo):\n\n   ```\n   wt -C <repo> switch --create <branch> --no-cd --format=json\n   ```\n\n   Stdout is JSON whose `path` field is the worktree's absolute path (status\n   lines go to stderr). On `Branch <branch> already exists`: if the user named\n   the branch, rerun without `--create` (it enters the branch, creating its\n   worktree if missing); if step 1 picked the name, pick another and rerun. Any\n   other failure (not a git repo, invalid name): report it and stop.\n\n   Next, call `ExitWorktree({action: \"keep\"})`. This invocation is the user\n   asking to move the session, which includes leaving the worktree it is in,\n   so make the call even when you're unsure the session is in one. A session\n   in a worktree can enter only one under its repository's\n   `.claude/worktrees/`; leaving lifts that limit, keeps the old worktree and\n   its branch on disk, and returns the session to the directory it was in\n   before it entered. Where there is nothing to leave (no worktree session, or\n   an agent pinned to its own worktree), the call returns an error and changes\n   nothing; carry on. If the session did leave a worktree\n   and the entry below doesn't happen, say so when you hand back: name the\n   worktree it left, still on disk, and where the session is now.\n\n   With a repo argument, `cd <repo>` next, in its own `Bash` call:\n   `EnterWorktree` re-roots only within the repository the cwd is in, and\n   worktrunk's `PermissionRequest` hook answers the confirmation that call\n   asks for only for a `wt` worktree of that same repository. If that `cd`\n   reports `Shell cwd was reset`, the repo is unreachable: skip the entry and\n   hand back as in **Unreachable** below. With no repo argument, don't `cd`:\n   leaving put the session back in this repository, and a `cd` into the\n   worktree it left can reset.\n\n   Then call `EnterWorktree({path: \"<path from the JSON>\"})`.\n\n   With a repo argument, once the session works in the new worktree (entered,\n   or reached by `cd` in the recovery below), read whichever of its root\n   `CLAUDE.md` and `AGENTS.md` exist before the task. Claude Code keeps the\n   launch repo's root instructions in context and loads only the new repo's\n   nested ones, so the new repo's root files supersede the launch repo's for\n   the rest of the session.\n\n   - **Accepted** → the session is re-rooted in the worktree. Do the task (or,\n     with no task text, confirm it's ready and wait).\n   - **Tool error** — the tool ran and returned an error (`Cannot enter\n     worktree: …`) → graceful; nothing moved, and one recovery covers them\n     all. One cause is an agent pinned to its own worktree, which can\n     enter only under its repo's `.claude/worktrees/`, excluding even a\n     same-repo `wt` sibling. The recovery test is whether you can `cd` into\n     the worktree, which works when it's inside an allowed directory. So\n     `cd <path>` and read the result:\n     - no `Shell cwd was reset` notice → it stuck; the worktree is reachable.\n       Work there, but a bare `cd` is not a tracked re-root, so the cwd can\n       revert to the session's launch worktree across turns (and in spawned\n       subagents); pin commands with `git -C <path>` / `wt -C <path>` rather\n       than trusting the `cd` to persist.\n     - `Shell cwd was reset` → **Unreachable.** Stop and ask the user to make\n       the directory whose `cd` reset reachable: add a parent that holds both\n       the repo and its worktrees, like `~/workspace`, to\n       `permissions.additionalDirectories` (durable, every session), or run\n       `/add-dir` on it (this session). Then continue from that `cd`. Don't\n       grind through absolute paths with `cd` resetting on every command.\n   - **Denied** — the call itself was refused, with no tool error → however\n     the denial is worded, it is the user's answer to the confirmation Claude\n     Code shows for entering a worktree outside `.claude/worktrees/`, unless\n     there was no user to ask (the denial says the session couldn't prompt),\n     which decides nothing — take the recovery above. On the user's answer:\n     the worktree `wt` just created still exists; only the entry didn't\n     happen. `cd` back out of the repo you moved into, if any, then report\n     the worktree's path and ask how to proceed, since reaching it through\n     `cd` would override that answer.\n\n## Cleanup\n\nThe worktree is a normal worktrunk worktree: it shows up in `wt list` and is\nmerged or removed with `wt merge` / `wt remove <branch>` like any other. Don't\nremove it unprompted.\n\nA worktree entered by name in step 2 gets Claude Code's Keep / Remove prompt\nwhen the session ends, with Keep selected by default. Remove runs `wt remove`\nwith its normal safeguards. A worktree entered by path in step 3 stays, as\ndoes a worktree the session left with `action: \"keep\"`. If the user asks to\nleave mid-session, `ExitWorktree({action: \"keep\"})` returns the session to its\noriginal directory;\n`ExitWorktree` cannot remove a worktree entered by `path`, so removing one of\nthose is always `wt remove <branch>`.\n\n## Scope\n\nThe command's mandate is ONE worktree (in the named repo, if one was given)\nand the requested task inside it.\n",".claude/skills/release/SKILL.md":"---\nname: release\ndescription: Worktrunk release workflow. Use when user asks to \"do a release\", \"release a new version\", \"cut a release\", or wants to publish a new version to crates.io and GitHub.\nmetadata:\n  internal: true\n---\n\n# Release Workflow\n\n## Steps\n\n1. **Sync the release branch with `main`**: The release worktree's branch lags `main` between releases — it's only reset to `main` after a release lands. Cutting from a stale branch silently drops everything merged since. Fast-forward to the tip of `main` before anything else:\n   ```bash\n   git fetch origin\n   git merge --ff-only origin/main\n   ```\n   `--ff-only` advances the branch when it's a strict ancestor of `origin/main` and **fails** (rather than creating a merge commit or discarding work) if it has diverged — reconcile manually before continuing. This is the release-branch equivalent of `wt up`, spelled out because the `up` alias rebases each branch onto its own upstream (`origin/release`), not `main`. Note the resulting commit SHA: this is the tip the changelog covers, and step 12 checks the changelog against everything that reaches `main` before the tag.\n2. **Run tests**: Two gates — the local suite and the full cross-platform suite.\n   - Local: `cargo run -- hook pre-merge --yes`.\n   - Cross-platform: dispatch the `nightly` workflow on the cut-from tip and wait for it to go green. This is where a release gets its full linux/macos/windows validation: the PR path (`ci.yaml`) is moving to cargo-affected selection and will stop running the full `test` matrix, while `nightly` hosts `full-tests` (the full 3-OS suite) alongside feature-powerset, release-target, nix-flake, and minimal-versions. Benchmarks aren't part of `nightly` — they run in their own `benchmarks.yaml` and gate nothing.\n     ```bash\n     gh workflow run nightly.yaml --ref main\n     # Registration lags the dispatch, and a prior release may have left a\n     # stale completed workflow_dispatch run — filter to the in-flight one.\n     sleep 5\n     RUN=$(gh run list --workflow=nightly.yaml --event=workflow_dispatch --branch=main --limit 5 --json databaseId,status --jq 'map(select(.status != \"completed\")) | .[0].databaseId')\n     ```\n     Launch a ci-reporter to monitor `$RUN` to completion (avoid `gh run watch` — it can hang). Fix any failure before continuing.\n3. **Check current version**: Read `version` in `Cargo.toml`\n4. **Review commits**: Check commits since last release to understand scope of changes. Audit the cumulative diff for the data-loss surface (see [Data-Loss Surface Review](#data-loss-surface-review)) and documentation (see [Documentation Review](#documentation-review)).\n5. **Check library API compatibility (advisory)**: Run `cargo semver-checks check-release -p worktrunk` (install with `cargo install cargo-semver-checks --locked` if missing) as a bump-level input, not a compat gate — worktrunk ships breaking library changes freely. If it reports breaking changes, that's fine; under semver the bump must still be minor (pre-1.0) or major (post-1.0). See \"Library API Compatibility\" below.\n6. **Credit contributors**: Check for external PR authors and issue reporters (see \"Credit External Contributors\" and \"Credit Issue Reporters\" below)\n7. **Determine release type**: Pick the bump from the changes (including semver-checks result). Ask the user only if the choice is genuinely ambiguous (see below).\n8. **Bump version** (must run on a clean tree — before editing CHANGELOG):\n   ```bash\n   cargo release X.Y.Z -p worktrunk -x --no-publish --no-push --no-tag --no-verify --no-confirm && cargo check\n   ```\n   This bumps `Cargo.toml` and `Cargo.lock`, then auto-commits. We'll reset this commit in step 10 to fold in the CHANGELOG.\n9. **Update CHANGELOG**: the top section holds this release's changes (see MANDATORY verification below). If it is `## Unreleased`, rename that heading to `## X.Y.Z` and fold the remaining entries into it — inserting a new heading above it ships a stale `## Unreleased` in the release notes. Otherwise the top section is the last shipped version: add a `## X.Y.Z` section above it, never append to it.\n10. **Commit**: Reset the auto-commit from step 8, stage everything, and create the final release commit:\n    ```bash\n    git reset --soft HEAD~1 && git add -A && git commit -m \"Release vX.Y.Z\"\n    ```\n11. **Merge to main**: complete the documentation review on the final candidate, then push the release branch, open a PR, wait for CI, and merge it. Keep the worktree — the remaining steps run from it. Then move the branch onto the merged tip:\n    ```bash\n    git fetch origin && git reset --keep origin/main\n    ```\n    The PR squash-merges, so the branch is no longer an ancestor of `main` and step 1's `--ff-only` can't advance it; `--keep` moves it across and still fails if anything is uncommitted. `main` can advance during the CI wait; step 12 catches anything that lands before the tag.\n12. **Verify the changelog covers `main`, then tag and push**: the tag decides what ships — `release.yaml` builds the binaries and the GitHub release notes from the tree at the tag, so everything reachable from it is in the release. The merge squashes onto whatever `main` tip exists at merge time, so a commit that lands during the PR's CI wait is already an ancestor of the release commit and ships whether or not the changelog mentions it (the easy miss is a follow-up that reworks a feature this release already documents). List what reached `main` since the cut-from tip (step 1):\n    ```bash\n    git fetch origin\n    git log --oneline <cut-from-commit>..origin/main\n    ```\n    Clean means the changelog at `origin/main` documents every user-facing commit listed. With no drift the list is one line, the `Release vX.Y.Z (#NNNN)` squash commit. Review anything else that drifted in during the window and fold what's user-facing into the changelog with a follow-up squash PR, then re-fetch and re-run. The list only grows across passes — the drifted commits stay, joined by the follow-up's own squash commit — so each pass re-checks coverage over a longer list.\n\n    Extend the documentation review to any changes since its reviewed SHA, including corrections and commits that arrived during CI. Record the final reviewed SHA and resolve findings before tagging.\n\n    Once clean, tag `origin/main`. The check and the tag then name the same ref, and it's main's tip, so the tag is reachable from `main`:\n    ```bash\n    git tag vX.Y.Z origin/main && git push origin vX.Y.Z\n    ```\n13. **Wait for the release workflow**: The tag push triggers `release.yaml`. Launch a ci-reporter agent to monitor the run through to completion (avoid `gh run watch` — it can hang); the run ID comes from:\n    ```bash\n    gh run list --workflow=release.yaml --event=push --branch=vX.Y.Z --limit 1 --json databaseId --jq '.[0].databaseId'\n    ```\n    If the run fails, re-run its failed jobs when the cause is transient. Otherwise land the fix on `main` and release it as the next patch version, leaving the vX.Y.Z tag in place. Installers such as aqua check that the signing certificate names `release.yaml@refs/tags/<version>`, so each version's release has to come from the run its own tag push started.\n\n`release.yaml` builds binaries and publishes to crates.io, Homebrew, winget, AUR, and PyPI (experimental) automatically.\n\n## Data-Loss Surface Review\n\nWorktrunk's worst failure is silently destroying a user's work. The per-PR review (`running-tend`, \"Data-Loss Surface\") is the first gate; the release is the second, where the whole diff since the last release is visible at once.\n\nThis review optimizes for recall: find every change that could touch the deletion surface, accept false positives, then adjudicate each candidate. Missing one real loss path costs far more than reviewing a false alarm.\n\nA keyword grep alone is insufficient. It finds only what someone thought to pattern-match, and an agent handed the grep anchors on it and inherits its blind spots. So fan out independent finders, most of them without the grep, and analyze every candidate they surface.\n\n### Find: independent finders, recall over precision\n\nLaunch 3-5 finder subagents in parallel over the cumulative diff (`git log v<last-version>..HEAD -p`) and the code it touches, including anything that calls into or is called by the changed code. Each works independently: do not let them share findings during this phase, and do not collapse them onto one method. Each returns candidate locations with a one-line reason, erring toward over-reporting.\n\nGive each a distinct charter. At least two receive no grep and no keyword list, so they reason from the code instead of pattern-matching:\n\n- **Behavioral (no grep):** read each change and ask what it could destroy: files, branches, worktrees, uncommitted or untracked work, committed-but-unpushed commits. Flag any change whose worst case is lost user data.\n- **Blast-radius (no grep):** for every function and file the diff touches, trace callers and callees. Flag any path that can now reach a destructive primitive (branch deletion, worktree removal, filesystem removal, history rewrite), even when that call sits outside the diff.\n- **Automation diff (no grep):** compare shipped automation before and after: `plugins/*/hooks/hooks.json`, `plugins/*/hooks.json`, `plugins/*/hooks/wt.sh`, and skill or alias examples users copy. Flag any new or altered invocation that removes or force-overwrites anything.\n- **Keyword scan (grep):** one finder runs the pattern filter over the full diff as a cross-check, never as the primary method. It takes no pathspec; a path allowlist would recreate the blind spots the no-grep finders exist to avoid (the densest destructive code, the tree walk in `src/remove_dir.rs`, sits outside `src/git/`).\n  ```bash\n  git log v<last-version>..HEAD -p \\\n    | grep -nE -- '--force-delete|--force| -D| -f |branch -[dD]|worktree remove|reset --hard|checkout -f|clean -[fdx]|remove_dir_all|remove_file|unlinkat|rm -rf'\n  ```\n\n### Analyze: adjudicate each candidate\n\nPool the candidates, dedupe, and analyze each against the data-safety invariants in `AGENTS.md` and the FAQ \"What can Worktrunk delete?\" inventory: does it preserve data on failure, require explicit consent for destructive ops, and avoid silent side-effect deletion? Mark each real risk / acceptable / needs change, with the reasoning.\n\nSurface the full adjudicated list and get explicit sign-off before tagging. Do not tag a release with an unresolved deletion-surface candidate, even if it looks acceptable.\n\n## Documentation Review\n\nThe release reviews all documentation changes since the previous release, including changes already on `main` and edits made during release preparation. Public docs are curated product guidance: each passage should help readers understand or use Worktrunk, with detail proportional to how many readers need it.\n\nStart from the full release diff to inventory documentation wherever it lives:\n\n```bash\ngit diff --name-status v<last-version> HEAD\ngit diff v<last-version> HEAD\n```\n\nGive an independent reviewer the previous tag, candidate SHA, and complete inventory. Cover site pages, README files, CLI help, configuration and command examples, shipped skills, and release notes. Review canonical sources once and check their generated copies for agreement; `docs/AGENTS.md` defines ownership and sync.\n\nThe reviewer reads every changed passage in its surrounding section and checks:\n\n- **Purpose and proportion:** does it change what readers understand or do? Cut redundant explanations and implementation or regression details that belong in tests or PRs. A correctness fix needs prose only when usage changes or an existing claim becomes false.\n- **Clarity and concision:** use concrete, consistent terminology; introduce concepts before relying on them; rewrite definitions in place rather than layering caveats. Shortening must preserve necessary instructions and qualifications.\n- **Accuracy and usability:** verify claims against behavior and examples against their commands. Check links and read affected rendered sections as a reader encounters them.\n\nFor each finding, give the location, reader impact, and a concrete replacement or deletion. Apply corrections in the canonical source, regenerate mirrors, and run the checks in `docs/AGENTS.md`. Have the reviewer check the corrected passages before closing findings. Record the reviewed range and SHA, coverage, findings, and their disposition in the release review; unresolved findings block tagging. Changelog claims and credits also receive the verification below.\n\n## CHANGELOG Review\n\nDraft entries from the commits since the last release:\n\n```bash\ngit log v<last-version>..HEAD --oneline\n```\n\n**IMPORTANT: Don't trust commit messages.** Commit messages often undersell or misdescribe changes. For any commit that might be user-facing:\n\n1. Run `git show <commit> --stat` to see what files changed\n2. If it touches user-facing code (commands, CLI, output), read the actual diff\n3. Look for changes bundled together — a \"rename flag\" commit might also add new features\n\nCommon patterns where commit messages mislead:\n- \"Refactor X\" commits that also change behavior\n- \"Rename flag\" commits that add new functionality\n- \"Fix Y\" commits that also improve error messages or add hints\n- CI/test commits that include production code fixes\n\nNotable changes to document:\n- New features or commands\n- User-visible behavior changes\n- Bug fixes users might encounter\n\n**Section order:** Improved, Fixed, Documentation, Internal. Documentation is for help text, web docs, and terminology improvements. Internal is for selected notable internal changes (not everything).\n\n**Within each section, order by reader interest.** The section is the first ordering dimension and is fixed; reader interest is the second, and it decides rank inside a section. A change's class does not: a behavior change nobody asked for ranks below a feature people requested, and a fix every user hits ranks above a platform-specific one. Interest combines how many readers a change reaches with how much it obliges each of them to act, and never counts the effort the change took to build — effort and interest diverge most on the change just finished, which is the one being written up. So a breaking change stays near the top of its section: it reaches few readers, but every one of them has to do something about it.\n\n**Breaking changes:** Note inline with the entry, not as a separate section:\n\n```markdown\n- **Feature name**: Description. (Breaking: old behavior no longer supported)\n```\n\nSkip: internal refactors, test additions (unless user-facing like shell completion tests).\n\n### Length and tone\n\n**Combine related bullets.** Several PRs that share a theme — e.g. three perf changes that together account for one user-visible speedup — belong in one bullet, not three. The reader cares about the net change, not the PR boundaries. Cite all the PRs in the trailing `([#a](...), [#b](...), [#c](...))` list.\n\n**Be brief — the ceiling is words, not sentences.** A bullet aims at 35 words; a dense one runs to 60, and the two or three headline entries may reach 80; Internal-section bullets get one sentence. Drop the \"why we did it this way\" details unless they change how the user thinks about the change, and leave code examples and `Cmd::stream` / `OnceCell` / `DashMap`-style internals in the PR description, where the reasoning belongs.\n\nSentences stretch to fit whatever you want to say; words don't. So measure rather than judge:\n\n```bash\nawk '/^## /{if (f) exit; f=1} f' CHANGELOG.md \\\n  | awk '/^- \\*\\*/ {n=split($0,_,\" \"); t+=n; c++; if (n>60) o++; printf \"%4d  %.58s\\n\", n, $0} END {printf \"\\n%d entries, %d avg, %d over 60\\n\", c, c?t/c:0, o}'\n```\n\n**Calibrate against the ceiling, not against the last release.** Length ratchets: each release is drafted beside the previous section, and an abstract rule loses to a concrete neighbouring exemplar every time. Entries grew from 49 to 101 words on average across five releases while this skill said \"be brief\" throughout. Read the previous section for what it drifted to, then ignore it and write to the ceiling.\n\n**Entries describe.** An entry records what the old behavior was and what it is now. Give imperative guidance only for a material issue that affects a sizable share of users, which is rare; otherwise remediation belongs in the PR description.\n\n**No editorial framing.** Describe what changed, not what was wrong with the previous decision in subjective terms. Avoid words like \"sledgehammer\", \"ugly\", \"noisy\", \"wrong\" applied to past code. State the prior behavior neutrally and the new behavior plainly.\n\n**Good:** \"Removed `.pi/` from the default excludes list; users who need it can add it via `[step.copy-ignored]`.\"\n**Bad:** \"Removed `.pi/` — a sledgehammer fix from an unrelated debugging session that has no place as a project-agnostic default.\"\n\n**Match a fix's prominence to its reach.** Readers skim the bold headlines, so the headline, and whether the fix has a bullet of its own, tell them how big it was before they read any body text. A correctness or data-loss fix usually needed narrow conditions — a non-default git config, a command run from a particular place, a change of a particular shape. Put them in the headline and the consequence in the body: a headline that states the consequence tells every reader it could have been them, and conditions arriving after it don't undo that. Join the conditions with \"and\": \"X set *and* run from Y\" is a corner case, while \"X or Y\" reads as two common triggers. Establish each one by reproducing against the previous release's binary rather than reading it off the diff — a condition assumed is a condition the entry overstates, and overstating a data-loss bug is its own kind of inaccuracy.\n\n**Good:** \"**Submodules with an `ignore` setting**: when `submodule.<name>.ignore` hid uncommitted changes inside a submodule, `wt remove` read the worktree as clean and removed it with them.\"\n**Bad:** \"**`wt remove` no longer deletes submodule changes hidden by config**: with `submodule.<name>.ignore` set *and* uncommitted changes inside a submodule, …\" — every condition is there, but the headline has already announced a data-loss bug to every reader.\n\nA fix of near-zero reader interest (see the ordering rule above) — a name starting with `-`, a non-UTF-8 path, one platform with an unusual environment — gets no bullet of its own. Fold these into a closing bullet such as \"Fixes for unusual setups\" that names each case in a clause. A section of separate bold fixes reads as that many ways the tool broke, whatever their bodies say.\n\n### Credit External Contributors\n\nFor any changelog entry where an external contributor (not the repo owner) authored the commit, add credit with their GitHub username:\n\n```markdown\n- **Feature name**: Description. ([#123](https://github.com/user/repo/pull/123), thanks @contributor)\n```\n\nFind external contributors:\n```bash\ngit log v<last-version>..HEAD --format=\"%an <%ae>\" | sort -u\n```\n\nThen for each external contributor's commit, find their GitHub username from the commit (usually in the email or PR).\n\n### Credit Issue Reporters\n\nWhen a fix or feature addresses a user-reported issue *in this repo*, thank the reporter — not just the PR author. Users who take time to report bugs, request features, or provide reproduction steps deserve recognition. (Don't credit reporters from upstream/external repos — only issues filed here.)\n\n```markdown\n- **Feature name**: Description. ([#456](https://github.com/user/repo/pull/456), thanks @reporter for reporting)\n```\n\nFor fixes that reference issues:\n\n```markdown\n- **Bug fix**: Description. Fixes [#123](https://github.com/user/repo/issues/123). (thanks @reporter)\n```\n\n**Finding reporters — do ALL three steps:**\n\nIssues may have been filed months before the fix. Bug reports also appear as PR comments, not just issues. These steps are complementary; each catches things the others miss.\n\n1. **Extract every issue/PR reference from every commit** (PRIMARY):\n   ```bash\n   git log v<last-version>..HEAD --format=\"%B\" | grep -oE '#[0-9]+' | sort -t'#' -k2 -n -u\n   ```\n   For **each** referenced number: run `gh issue view N --json title,author,state`. This catches issues filed months ago — the most commonly missed credits.\n\n2. **Check PR comments for bug reports** (catches reports that never became issues):\n   For feature PRs referenced in commits, check comment threads for users reporting problems:\n   ```bash\n   gh pr view NNN --json comments --jq '.comments[] | \"\\(.author.login): \\(.body[:150])\"'\n   ```\n\n3. **Survey every issue opened or closed since last release** (catches unreferenced matches):\n   ```bash\n   git log -1 --format=%cs v<last-version>\n   gh issue list --state all --search \"created:>=<date>\" --json number,title,author --limit 100\n   gh issue list --state closed --search \"closed:>=<date>\" --json number,title,author --limit 100\n   ```\n   Cross-reference every title against changes in this release.\n\n**When to credit:**\n- Bug reports with clear reproduction steps (in issues OR PR comments)\n- Feature requests that shaped the implementation\n- Performance reports with measurements (like \"takes 15s\")\n- Users who helped diagnose issues through discussion\n\nSkip credit for: issues opened by the repo owner, trivial reports, or issues that were substantially different from what was implemented.\n\n### Link Significant Features to Docs\n\nFor major features with dedicated documentation, include a docs link. Use full URLs so links work from GitHub releases:\n\n```markdown\n- **Hook system**: Shell commands that run at key points in worktree lifecycle. [Docs](https://worktrunk.dev/hook/) ([#234](https://github.com/user/repo/pull/234), thanks @contributor for the suggestion)\n```\n\nLink when there's substantial documentation the user would benefit from reading — new commands, feature pages, or Tips & Patterns sections. Skip for minor improvements.\n\n### MANDATORY: Verify Each Changelog Entry\n\n**After drafting changelog entries, you MUST spawn a subagent to verify each bullet point is accurate.** The tag publishes this text as the GitHub release body, so a correction afterwards takes a follow-up PR to `CHANGELOG.md` and a hand-edit of the release page, and people have read the wrong line by then. This pass is worth as much time as it takes.\n\n**The gate cuts both ways.** Checking only accuracy pushes every entry longer: \"understates\" and \"not covered\" have no counterweight, so each pass adds and none subtracts. That asymmetry is what drove the ratchet above. An entry that is too long, too internal, or ranked above one more readers will notice is reported on the same footing as one that is wrong.\n\n**Subagent prompt template:**\n\n```\nVerify these changelog entries for version X.Y.Z are accurate. They publish with\nthe tag, and by the time anyone corrects a wrong line, readers have acted on it.\nSpend the time to read a source for each one: reading the entry and finding it\nplausible is not a check, because the entry was written from the same commits you\nare about to read.\n\nPrevious version: [e.g., v0.1.9]\nCommits to check: git log v<previous>..HEAD\n\nEntries to verify: the top section of CHANGELOG.md as it stands on disk. Read it\nthere rather than from a paste:\nawk '/^## /{if (f) exit; f=1} f' CHANGELOG.md\n\nVerify claim by claim, not entry by entry: an entry carries several independent\nclaims, and one verdict over the whole entry waves through every claim that is not\nits headline.\n\n1. Find the relevant commit(s) using git log and git show\n2. Read the diff, not the commit message. The diff settles what changed, and\n   nothing else: not what the behavior was before, not what the user sees, not\n   what a file it doesn't touch does. Settle a \"previously\" / \"no longer\" / \"so X\n   broke\" claim by reading the old file (`git show <sha>^:<path>`) and confirming\n   the old behavior there. The new code's handling of the old case is not that\n   confirmation: a case added together with a comment about why it produces\n   nothing reads in a diff exactly like a case that used to produce something.\n   Some claims have no source in the commit at all — a version floor, what a\n   rendered page shows, how another component behaves. Read that source: the\n   rendered output, the other component's own file, the upstream project's own\n   releases\n3. Flag any claim its source does not support, whether it overstates,\n   understates, or misdescribes\n4. Flag if the entry runs over 60 words (80 for one of the two or three headline\n   entries), restates the PR description, or explains mechanism the reader cannot\n   act on — report these as seriously as an inaccuracy, and quote a shorter\n   rewrite that keeps every user-facing claim\n\nAlso check:\n- Are there user-facing changes NOT covered by these entries?\n- Verify each \"thanks @...\" attribution (right person, right role — author vs reporter)\n- Within each section, is any entry ranked above one that more readers will notice?\n- Read each headline alone, as a skimming reader does. Flag one that states the\n  consequence (what was lost or broken) rather than the situation it needed, and a\n  fix almost no reader will notice that has its own bullet rather than a clause in\n  a closing roll-up.\n\nReport format:\n- Entry: [entry text]\n  Status: ✅ Accurate / ⚠️ Needs revision / ❌ Incorrect\n  Length: [word count] — ✅ / ⚠️ over ceiling\n  Evidence: [for each claim, the source you read and what it said]\n  Suggested fix: [if needed]\n```\n\n**The pass ends on a clean run, not on the first run's findings.** A rewrite the verifier suggests has no more evidence behind it than one you wrote yourself, and an entry you edit while the pass runs is in the same state — both leave that entry unverified. Re-run over the section as it now stands, and finalize only once a run comes back clean.\n\n`evals/README.md` beside this skill holds four entries from a shipped release, three of them wrong, for scoring a change to this template against what the last wording missed, and a drafting case for the prominence rule.\n\n**If verification finds problems:** Escalate to the user. Show them the subagent's findings and ask how to proceed. Don't attempt to resolve ambiguous changelog entries autonomously — the user knows the intent behind their changes better than you do.\n\n## Determine Release Type\n\nPick the bump from the changes. Skip the question when only one level is plausible; ask only when the choice is genuinely ambiguous.\n\n**Proceed without asking when the answer is obvious:**\n\n- `cargo semver-checks` reports breaking changes → minor (pre-1.0; patch is disallowed, major has no basis pre-1.0 in a maturing project). Inform the user and continue: \"Bumping minor — semver-checks reported N breaking changes; patch is disallowed pre-1.0.\"\n- Only bug fixes and internal commits since the last release, no new features, no semver breakage → patch. Inform the user with the same shape.\n\n**Ask only when genuinely ambiguous** — e.g., new features landed with no semver breakage (patch vs. minor is a judgment call), or a borderline case where the user's read of the changes may differ. Use `AskUserQuestion` with the actual choice (patch vs. minor); don't add novelty options like skipping a version number.\n\nWhen asking, present:\n1. Current version (e.g., `0.2.0`)\n2. Brief summary of changes (new features, bug fixes, breaking changes)\n3. Your recommendation with reasoning\n\nExample:\n\n```\nCurrent version: 0.2.0\nChanges since v0.2.0:\n- Added `state clear` command (new feature)\n- Added `previous-branch` state key (new feature)\n- No breaking changes\n\nRecommendation: Minor release (0.3.0) — new features, no breaking changes\n```\n\n## Version Guidelines\n\n- **Second digit** (0.1.0 → 0.2.0): Backward incompatible changes\n- **Third digit** (0.1.0 → 0.1.1): Everything else\n\nCurrent project status: maturing mode (see [AGENTS.md › Project Status](../../../AGENTS.md)). External interfaces — the config file format (`wt.toml`, user config) and CLI flags/arguments — carry compatibility weight, so breaks there need justification (a real improvement, not cleanup) and prefer deprecation warnings over silent breaks. Everything else, including the internal and library APIs, stays flexible: worktrunk ships breaking library changes freely and bumps the version each time, putting no weight on the existing internal APIs.\n\n## Library API Compatibility\n\nWorktrunk is a CLI tool. The `[lib]` crate in `Cargo.toml` does expose a public API, but it is **not a compatibility surface** — per [AGENTS.md › Project Status](../../../AGENTS.md) there are no Rust library compatibility concerns, and the project ships breaking library changes freely, bumping the version each time (see the \"Breaking library API\" entries in `CHANGELOG.md`). Downstream crates are expected to pin.\n\n`cargo-semver-checks` is therefore an **advisory bump-level input**, not a gate that commits us to keeping the API stable for downstream crates. It compares the current public API against the last version published to crates.io and reports semver-relevant changes — a useful signal for choosing the bump:\n\n```bash\ncargo semver-checks check-release -p worktrunk\n```\n\nInterpreting results:\n\n- **No issues reported**: no library-level signal for the bump. Choose based on CLI changes and new features.\n- **Breaking changes reported**: expected and acceptable — breaking the library API is not something to avoid here. But under semver a breaking change still warrants at minimum a minor bump while pre-1.0 (e.g., 0.37.0 → 0.38.0) rather than a patch. Bump accordingly; this is version mechanics, not a signal to preserve the old API.\n- **Tool fails to run** (e.g., missing baseline): likely the crate hasn't been published yet or the registry cache is stale. Try `cargo semver-checks check-release -p worktrunk --baseline-version <last-published>`.\n\nThis check validates the chosen bump — it doesn't distinguish patch vs. minor when no breakage exists. Continue using the commit review to decide between patch (fixes only) and minor (new features).\n","tests/CLAUDE.md":"# tests - Claude Agent Guidelines & System Prompt\n\nPath: `tests/CLAUDE.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/tests/CLAUDE.md)",".agents/plugins/marketplace.json":"# Claude Plugin Marketplace Catalog\n\nPath: `.agents/plugins/marketplace.json`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/.agents/plugins/marketplace.json)","plugins/worktrunk/CLAUDE.md":"# Worktrunk Skill\n\nPath: `plugins/worktrunk/CLAUDE.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/CLAUDE.md)","plugins/worktrunk/README.md":"# worktrunk Documentation\n\nPath: `plugins/worktrunk/README.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/README.md)","skills/wt-switch-create/rationale.md":"# Wt-switch-create Skill\n\nPath: `skills/wt-switch-create/rationale.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/wt-switch-create/rationale.md)","src/commands/CLAUDE.md":"# Command: /claude\n\nPath: `src/commands/CLAUDE.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/src/commands/CLAUDE.md)","plugins/worktrunk/.codex-plugin/plugin.json":"# codex-plugin Plugin Manifest\n\nPath: `plugins/worktrunk/.codex-plugin/plugin.json`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/.codex-plugin/plugin.json)","plugins/worktrunk/.claude-plugin/plugin.json":"# claude-plugin Plugin Manifest\n\nPath: `plugins/worktrunk/.claude-plugin/plugin.json`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/.claude-plugin/plugin.json)","plugins/worktrunk/hooks/hooks.json":"# Hooks Skill\n\nPath: `plugins/worktrunk/hooks/hooks.json`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/hooks/hooks.json)","skills/worktrunk/reference/claude-code.md":"# Reference Skill\n\nPath: `skills/worktrunk/reference/claude-code.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/claude-code.md)","skills/worktrunk/reference/code-signing.md":"# Reference Skill\n\nPath: `skills/worktrunk/reference/code-signing.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/code-signing.md)","skills/worktrunk/reference/config.md":"# Reference Skill\n\nPath: `skills/worktrunk/reference/config.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/config.md)","skills/worktrunk/reference/extending.md":"# Reference Skill\n\nPath: `skills/worktrunk/reference/extending.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/extending.md)","skills/worktrunk/reference/faq.md":"# Reference Skill\n\nPath: `skills/worktrunk/reference/faq.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/faq.md)","skills/worktrunk/reference/hook.md":"# Reference Skill\n\nPath: `skills/worktrunk/reference/hook.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/hook.md)","skills/worktrunk/reference/list.md":"# Reference Skill\n\nPath: `skills/worktrunk/reference/list.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/list.md)","skills/worktrunk/reference/llm-commits.md":"# Reference Skill\n\nPath: `skills/worktrunk/reference/llm-commits.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/llm-commits.md)","skills/worktrunk/reference/merge.md":"# Reference Skill\n\nPath: `skills/worktrunk/reference/merge.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/merge.md)","skills/worktrunk/reference/remove.md":"# Reference Skill\n\nPath: `skills/worktrunk/reference/remove.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/remove.md)","skills/worktrunk/reference/shell-integration.md":"# Reference Skill\n\nPath: `skills/worktrunk/reference/shell-integration.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/shell-integration.md)","skills/worktrunk/reference/step.md":"# Reference Skill\n\nPath: `skills/worktrunk/reference/step.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/step.md)","skills/worktrunk/reference/switch.md":"# Reference Skill\n\nPath: `skills/worktrunk/reference/switch.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/switch.md)","skills/worktrunk/reference/tips-patterns.md":"# Reference Skill\n\nPath: `skills/worktrunk/reference/tips-patterns.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/tips-patterns.md)","skills/worktrunk/reference/troubleshooting.md":"# Reference Skill\n\nPath: `skills/worktrunk/reference/troubleshooting.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/troubleshooting.md)","skills/worktrunk/reference/worktrunk.md":"# Reference Skill\n\nPath: `skills/worktrunk/reference/worktrunk.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/worktrunk.md)","src/commands/list/CLAUDE.md":"# Command: /claude\n\nPath: `src/commands/list/CLAUDE.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/src/commands/list/CLAUDE.md)",".claude/skills/running-tend/references/nightly-cleaner.md":"# References Skill\n\nPath: `.claude/skills/running-tend/references/nightly-cleaner.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/.claude/skills/running-tend/references/nightly-cleaner.md)",".claude/skills/running-tend/references/review-pr.md":"# References Skill\n\nPath: `.claude/skills/running-tend/references/review-pr.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/.claude/skills/running-tend/references/review-pr.md)","plugins/worktrunk/skills/wt-switch-create/rationale.md":"# Wt-switch-create Skill\n\nPath: `plugins/worktrunk/skills/wt-switch-create/rationale.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/wt-switch-create/rationale.md)","plugins/worktrunk/skills/worktrunk/reference/claude-code.md":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/claude-code.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/claude-code.md)","plugins/worktrunk/skills/worktrunk/reference/code-signing.md":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/code-signing.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/code-signing.md)","plugins/worktrunk/skills/worktrunk/reference/config.md":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/config.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/config.md)","plugins/worktrunk/skills/worktrunk/reference/extending.md":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/extending.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/extending.md)","plugins/worktrunk/skills/worktrunk/reference/faq.md":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/faq.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/faq.md)","plugins/worktrunk/skills/worktrunk/reference/hook.md":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/hook.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/hook.md)","plugins/worktrunk/skills/worktrunk/reference/list.md":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/list.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/list.md)","plugins/worktrunk/skills/worktrunk/reference/llm-commits.md":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/llm-commits.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/llm-commits.md)","plugins/worktrunk/skills/worktrunk/reference/merge.md":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/merge.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/merge.md)","plugins/worktrunk/skills/worktrunk/reference/README.md":"# reference Documentation\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/README.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/README.md)","plugins/worktrunk/skills/worktrunk/reference/remove.md":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/remove.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/remove.md)","plugins/worktrunk/skills/worktrunk/reference/shell-integration.md":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/shell-integration.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/shell-integration.md)","plugins/worktrunk/skills/worktrunk/reference/step.md":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/step.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/step.md)","plugins/worktrunk/skills/worktrunk/reference/switch.md":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/switch.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/switch.md)","plugins/worktrunk/skills/worktrunk/reference/tips-patterns.md":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/tips-patterns.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/tips-patterns.md)","plugins/worktrunk/skills/worktrunk/reference/troubleshooting.md":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/troubleshooting.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/troubleshooting.md)","plugins/worktrunk/skills/worktrunk/reference/worktrunk.md":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/worktrunk.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/worktrunk.md)"},"files":{"skills/worktrunk/SKILL.md":"---\nname: worktrunk\ndescription: Guidance for Worktrunk (the `wt` CLI) — git worktree management, hooks, and config. Load when working out which worktree a `wt` command will act on, or reaching for the global `-C <path>` to target one; editing .config/wt.toml or ~/.config/worktrunk/config.toml; adding, modifying, or debugging hooks (post-merge, post-start, pre-commit, pre-merge, post-switch, etc.); configuring commit message generation or command aliases; or troubleshooting wt behavior. Also answers general worktrunk/wt questions.\nlicense: MIT OR Apache-2.0\ncompatibility: Requires the `wt` CLI (https://worktrunk.dev)\n---\n\n# Worktrunk\n\nHelp users work with Worktrunk, a CLI tool for managing git worktrees.\n\n## Available documentation\n\nReference files are synced from [worktrunk.dev](https://worktrunk.dev) documentation:\n\n- **reference/config.md**: User and project configuration (LLM, hooks, command defaults)\n- **reference/hook.md**: Hook types, timing, and execution order\n- **reference/switch.md**, **merge.md**, **list.md**, etc.: Command documentation\n- **reference/extending.md**: Aliases, multi-step pipelines, custom subcommands, and template-expansion gotchas (two-pass `{% raw %}` deferral, for-each recipes)\n- **reference/llm-commits.md**: LLM commit message generation\n- **reference/tips-patterns.md**: Practical recipes — aliases, per-branch variables, dev server per worktree, parallel agent patterns\n- **reference/shell-integration.md**: Shell integration debugging\n- **reference/troubleshooting.md**: Troubleshooting for LLM and hooks (Claude-specific)\n\nFor command-specific options, run `wt <command> --help`. For configuration, follow the workflows below.\n\n## Which worktree a command acts on\n\n`wt` finds the *repository* from the working directory, and the *worktree* from the command's own arguments. Two rules cover every case:\n\n1. **A command that names a branch already names its worktree.** Worktrees are addressed by branch name, so `wt switch <branch>`, `wt remove <branch>`, `wt step diff --branch <branch>`, and `wt config state marker set --branch <branch>` act on that branch's worktree no matter which worktree you run them from. Every such argument also accepts the worktree's own path, for the cases a branch cannot name — a second checkout of the same branch, or a detached worktree (which `marker` still rejects, since it keys state by branch name).\n2. **`-C <path>` moves the working directory, not the worktree selection.** Reach for it when the repository lookup is what's wrong: a *different* repository; a command that acts on the current worktree and takes no branch argument (`wt merge`, `wt step rebase|squash|push` — their `[TARGET]` is the merge target, not a worktree); or a caller whose working directory isn't inside a repository at all, such as an agent hook the host pins elsewhere.\n\nLayering `-C` on top of a branch argument names the same worktree twice. From inside the `alpha` worktree of a repo that also has `beta`:\n\n```bash\nwt step diff --branch beta                    # ✓ the branch argument selects the worktree\nwt -C ../repo.beta step diff --branch beta    # ✗ says beta twice\n\nwt switch --create beta                       # ✓ --base already defaults to the default branch\nwt -C ../repo switch --create beta            # ✗ -C adds nothing; you are already in that repo\n```\n\n## Two types of configuration\n\nWorktrunk uses two config files with different scopes and permission models:\n\n**User config** (`~/.config/worktrunk/config.toml`, never checked into git) holds personal preferences: LLM integration, worktree path templates, command settings, user hooks. Treat it conservatively — propose changes and get consent before editing, never install tools on the user's behalf, and preserve the file's existing structure and comments. See `reference/config.md`.\n\n**Project config** (`<repo>/.config/wt.toml`, checked into git) holds team-wide automation: hooks for the worktree lifecycle (pre-start, pre-merge, etc.). Edit proactively — changes are versioned and reversible via git. Comment why each hook exists, and warn the user before adding destructive commands (`rm -rf`, `DROP TABLE`), network fetches piped to shells, or `sudo`. See `reference/hook.md`.\n\nSome requests span both: commit-message generation is user config, while the team's quality checks are project config.\n\n## Core workflows\n\n### Setting up commit message generation (user config)\n\nDetect which tools are installed (`which claude codex opencode pi`); if none, recommend Claude Code. Take the exact command for the chosen tool from `reference/llm-commits.md`, propose the `[commit.generation]` change, and apply it after approval (`wt config create` first if no config exists). To verify, `wt step commit --dry-run` renders the prompt, runs the LLM, and prints the message without committing.\n\n### Configuring project hooks\n\nPick the hook type by when the command should run and whether it may block — `reference/hook.md` maps all ten (5 events × pre/post) to their timing and typical uses.\n\nDerive the commands from the project itself (`package.json` scripts, `Cargo.toml`, `pyproject.toml`) and verify they run before adding them.\n\nWhen a new hook must wait for an existing one, convert the entry to a pipeline; independent commands in a named table run concurrently:\n\n```toml\n# Pipeline: install completes before migrate starts\n[[pre-start]]\ninstall = \"npm install\"\n\n[[pre-start]]\nmigrate = \"npm run db:migrate\"\n\n# Concurrent: independent commands in one table\n[pre-start]\ninstall = \"npm install\"\nenv = \"cp .env.example .env\"\n```\n\nTest with `wt switch --create test-hooks`.\n\n## Common tasks reference\n\n### User config tasks\n- Set up commit message generation → `reference/llm-commits.md`\n- Customize worktree paths → `reference/config.md#worktree-path-template`\n- Custom commit templates → `reference/llm-commits.md#prompt-templates`\n- Configure command defaults → `reference/config.md#command-config`\n- Set up personal hooks → `reference/config.md#user-hooks`\n\n### Project config tasks\n- Set up hooks for new project → `reference/hook.md`\n- Add hook to existing config → `reference/hook.md#hook-forms`\n- Use template variables → `reference/hook.md#template-variables`\n- Add dev server URL to list → `reference/config.md#dev-server-url`\n\n### Aliases & multi-worktree tasks\n- Create a `wt` alias → `reference/extending.md#aliases`\n- Run a command in every worktree → `reference/step.md#wt-step-for-each`\n- Rebase every worktree (up-style) → `reference/extending.md#recipe-rebase-every-worktree-onto-its-upstream`\n- Pass a template to a nested `wt` command → `reference/extending.md#nesting-templates`\n\n## Key commands\n\n```bash\n# View all configuration\nwt config show\n\n# Create initial user config (LLM/commit setup: see reference/llm-commits.md)\nwt config create\n\n# Full config reference (subcommands, templates, env vars)\nwt config --help\n```\n\n## Hook approvals in non-interactive sessions\n\nWorktrunk never runs a project's hooks or aliases until the user has explicitly approved them. The commands in `.config/wt.toml` are arbitrary shell code shipped in a repository the user may have just cloned, so on first run Worktrunk shows each command and waits for the user to approve it — an untrusted `.config/wt.toml` cannot silently execute anything. Approvals are stored per-project in `~/.config/worktrunk/approvals.toml` and re-prompted whenever a command template changes, so a hook can't be swapped for a different command after it was approved.\n\nAgents running `wt merge`, `wt switch`, or other commands that trigger hooks will hit an error like:\n\n```\n▲ cargo-difftest needs approval to execute 1 command:\n○ post-merge install:\n  cargo install --path .\n✗ Cannot prompt for approval in non-interactive environment\n↳ To skip prompts in CI/CD, add --yes; to pre-approve commands, run wt config approvals add --yes\n```\n\nThe resolution is for the user to make the trust decision themselves:\n\n- **`wt config approvals add`** — interactive prompt where the user reviews each command before it is stored to `~/.config/worktrunk/approvals.toml`. Run once per project; the approval persists across invocations until the command template changes or the project moves. This is the path to recommend — the user reviews and consents to exactly the commands that will run.\n\n**When invoked as an agent, stop and escalate to the user.** Approving a project's hooks is a security decision about whether this repository should be trusted to run arbitrary commands on the user's machine — that decision belongs to the user, not the agent. Tell the user to run `wt config approvals add` and let them review the commands. Do not reach for either `--yes` on the user's behalf: on the blocked command it skips the gate for that invocation, and `wt config approvals add --yes` records every command the project declares with nobody reading them. Both exist for CI/CD pipelines and containers that already control their own hook contents; neither is a shortcut for an interactive agent to silence an approval prompt.\n\n## Advanced: agent handoffs\n\nWhen the user requests spawning a worktree with an agent in a background session (\"spawn a worktree for...\", \"hand off to another agent\"), use the tmux or Zellij command from `reference/tips-patterns.md#agent-handoffs` with the CLI you are running as in place of `claude`, following that section's note on where a subcommand such as OpenCode's `run` goes.\n\n**Requirements** (all must be true):\n- User explicitly requests spawning/handoff\n- User is in a supported multiplexer (check `$TMUX` / `$ZELLIJ`)\n- The user's project instructions (`CLAUDE.md` or `AGENTS.md`) or an explicit prompt authorize this pattern\n\n**Do not use this pattern** for normal worktree operations.\n\n### Parallel sub-Agents (single Claude Code session)\n\nTo spawn multiple sub-Agents that each work in their own worktree from one Claude Code session — no terminal multiplexer, no human in the other pane — pre-start each worktree from the parent and pass the path into the sub-Agent prompt:\n\n```bash\nwt switch --create <branch> --no-cd\n```\n\nThen call the `Agent` tool **without** `isolation: \"worktree\"`, naming the path in the prompt:\n\n```\nYou are working in `/abs/path/to/myproject.<branch>` on branch `<branch>`.\nAll edits must stay in that worktree.\n```\n\n`--no-cd` skips the shell-integration cd script the parent can't consume. Add `--no-hooks` only when no user or project hooks provision the worktree and each sub-Agent does its own build/test step (e.g. `cargo run -- hook pre-merge --yes`) — a `pre-start` hook that installs dependencies or links a gitignored build environment hands the sub-Agent a worktree it can't build in when it's skipped. Leaving hooks on needs the project's hook commands already approved: the parent session can't prompt, so an unapproved command in `.config/wt.toml` aborts the create — see **Hook approvals in non-interactive sessions** above.\n\n**Do not** use `Agent { isolation: \"worktree\" }` for this. Claude Code passes its internal agent ID as `name` to the `WorktreeCreate` hook, so `wt` creates the worktree as `myproject.agent-<id>` on a throwaway branch. If the sub-Agent then creates a feature branch on top, you end up with non-canonical paths, orphan branches, and post-start hooks fired against the wrong branch. Pre-creating with `wt switch --create` keeps path, branch, and hook target aligned.\n",".claude-plugin/marketplace.json":"{\n  \"name\": \"worktrunk\",\n  \"owner\": {\n    \"name\": \"Worktrunk\",\n    \"email\": \"m@maxroos.com\"\n  },\n  \"metadata\": {\n    \"description\": \"Claude Code plugin for Worktrunk, a CLI for Git worktree management\"\n  },\n  \"plugins\": [\n    {\n      \"name\": \"worktrunk\",\n      \"description\": \"Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows. This plugin provides configuration guidance (LLM commit messages, project hooks, worktree paths), automatic activity tracking (🤖/💬 indicators in `wt list` showing active Claude sessions), and a `/wt-diff` pane showing each worktree's changes.\",\n      \"source\": \"./plugins/worktrunk\"\n    }\n  ]\n}\n","skills/wt-switch-create/SKILL.md":"---\nname: wt-switch-create\ndescription: Create a new worktrunk worktree (optionally in another repo) and switch this session's working directory into it. Use when launching a session that should work in its own worktree.\nargument-hint: \"[<branch>] [<repo>] [-- <task>]\"\nlicense: MIT OR Apache-2.0\ncompatibility: Requires the `wt` CLI (https://worktrunk.dev)\n---\n\nArguments: `$ARGUMENTS`. Grammar: `[<branch>] [<repo>] [-- <task>]`.\n\n- **branch** — optional; the branch name for the new worktree. When omitted,\n  pick one (step 1 below).\n- **repo** — optional path or name; create the worktree in this repo instead\n  of the session's current one.\n- **task** — optional; what to do inside the new worktree. No task means enter\n  the worktree and wait.\n\nTokens before the `--` are the branch and/or repo. A path-shaped token\n(starting with `/`, `~`, `./`, or `../`) is the repo. A bare name can be\neither, so make an informed guess. It is the branch when the current repo\nalready has a branch by that name, as it is for `wt switch` itself. Otherwise\nit is the repo when a git repository by that name exists where the user keeps\nrepos (beside the current repo, or in a workspace directory like\n`~/workspace`), and the branch when none does (`docs` is a branch, not the\ncurrent repo's `docs/` directory). A name read as the repo carries its absolute\npath forward: that path, not the bare token, is the `<repo>` in step 3. Two\ntokens that both read as branches don't fit the grammar — ask. Without a `--`,\njudge where the task starts: leading tokens that read as a branch name\n(`fix-auth`) or a repo are consumed as such, and the rest is the task;\notherwise the whole input is the task (`fix the parser bug` has no\nbranch-shaped lead — all task).\n\n```\n/wt-switch-create my-feature -- fix the parser bug\n/wt-switch-create -- fix the parser bug\n/wt-switch-create my-feature ~/workspace/other-repo -- fix the parser bug\n/wt-switch-create my-feature\n```\n\n## What to do\n\nCreating the worktree comes first on every invocation, before any other work.\nThe invocation is itself the explicit request to create it; a research or\nread-only task gets one all the same.\n\n<!-- Maintainers: rationale.md (same directory) covers the harness rules and\ndesign choices behind this — read it before re-adding guards or routes. -->\n\n1. **Pick a new branch name** if none was given: short, from the task and\n   consistent with existing worktree names, or, mid-session, from the work\n   being moved; with nothing to derive from, ask.\n\n2. **With no repo argument, create and enter in one call:**\n   `EnterWorktree({name: \"<branch>\"})`. Worktrunk's `WorktreeCreate` hook runs\n   `wt switch --create` for a new branch or `wt switch` for an existing one,\n   creating its checkout if needed. The result is an ordinary `wt` worktree,\n   and the user sees no confirmation prompt. On success, do the task (or,\n   with no task text, confirm it's ready and wait).\n\n   Mid-session, carry uncommitted work across: `git stash push -u` before the\n   `EnterWorktree` call, then `git stash pop` once the session is in the new\n   worktree, which is after step 3 if this call fails. Entering re-roots the\n   session into the new worktree, and the stash is shared across worktrees. If\n   step 3 hands back without the session in the new worktree, restore the work\n   where it came from first (`git -C <that worktree> stash pop`).\n\n3. **Otherwise create it with `wt` and enter by path.** Two cases reach here: a\n   repo argument, which step 2 can't target, and a failed step 2, whose error\n   says `Already in a worktree session`. Create with a `Bash` call (omit\n   `-C <repo>` for this repo):\n\n   ```\n   wt -C <repo> switch --create <branch> --no-cd --format=json\n   ```\n\n   Stdout is JSON whose `path` field is the worktree's absolute path (status\n   lines go to stderr). On `Branch <branch> already exists`: if the user named\n   the branch, rerun without `--create` (it enters the branch, creating its\n   worktree if missing); if step 1 picked the name, pick another and rerun. Any\n   other failure (not a git repo, invalid name): report it and stop.\n\n   Next, call `ExitWorktree({action: \"keep\"})`. This invocation is the user\n   asking to move the session, which includes leaving the worktree it is in,\n   so make the call even when you're unsure the session is in one. A session\n   in a worktree can enter only one under its repository's\n   `.claude/worktrees/`; leaving lifts that limit, keeps the old worktree and\n   its branch on disk, and returns the session to the directory it was in\n   before it entered. Where there is nothing to leave (no worktree session, or\n   an agent pinned to its own worktree), the call returns an error and changes\n   nothing; carry on. If the session did leave a worktree\n   and the entry below doesn't happen, say so when you hand back: name the\n   worktree it left, still on disk, and where the session is now.\n\n   With a repo argument, `cd <repo>` next, in its own `Bash` call:\n   `EnterWorktree` re-roots only within the repository the cwd is in, and\n   worktrunk's `PermissionRequest` hook answers the confirmation that call\n   asks for only for a `wt` worktree of that same repository. If that `cd`\n   reports `Shell cwd was reset`, the repo is unreachable: skip the entry and\n   hand back as in **Unreachable** below. With no repo argument, don't `cd`:\n   leaving put the session back in this repository, and a `cd` into the\n   worktree it left can reset.\n\n   Then call `EnterWorktree({path: \"<path from the JSON>\"})`.\n\n   With a repo argument, once the session works in the new worktree (entered,\n   or reached by `cd` in the recovery below), read whichever of its root\n   `CLAUDE.md` and `AGENTS.md` exist before the task. Claude Code keeps the\n   launch repo's root instructions in context and loads only the new repo's\n   nested ones, so the new repo's root files supersede the launch repo's for\n   the rest of the session.\n\n   - **Accepted** → the session is re-rooted in the worktree. Do the task (or,\n     with no task text, confirm it's ready and wait).\n   - **Tool error** — the tool ran and returned an error (`Cannot enter\n     worktree: …`) → graceful; nothing moved, and one recovery covers them\n     all. One cause is an agent pinned to its own worktree, which can\n     enter only under its repo's `.claude/worktrees/`, excluding even a\n     same-repo `wt` sibling. The recovery test is whether you can `cd` into\n     the worktree, which works when it's inside an allowed directory. So\n     `cd <path>` and read the result:\n     - no `Shell cwd was reset` notice → it stuck; the worktree is reachable.\n       Work there, but a bare `cd` is not a tracked re-root, so the cwd can\n       revert to the session's launch worktree across turns (and in spawned\n       subagents); pin commands with `git -C <path>` / `wt -C <path>` rather\n       than trusting the `cd` to persist.\n     - `Shell cwd was reset` → **Unreachable.** Stop and ask the user to make\n       the directory whose `cd` reset reachable: add a parent that holds both\n       the repo and its worktrees, like `~/workspace`, to\n       `permissions.additionalDirectories` (durable, every session), or run\n       `/add-dir` on it (this session). Then continue from that `cd`. Don't\n       grind through absolute paths with `cd` resetting on every command.\n   - **Denied** — the call itself was refused, with no tool error → however\n     the denial is worded, it is the user's answer to the confirmation Claude\n     Code shows for entering a worktree outside `.claude/worktrees/`, unless\n     there was no user to ask (the denial says the session couldn't prompt),\n     which decides nothing — take the recovery above. On the user's answer:\n     the worktree `wt` just created still exists; only the entry didn't\n     happen. `cd` back out of the repo you moved into, if any, then report\n     the worktree's path and ask how to proceed, since reaching it through\n     `cd` would override that answer.\n\n## Cleanup\n\nThe worktree is a normal worktrunk worktree: it shows up in `wt list` and is\nmerged or removed with `wt merge` / `wt remove <branch>` like any other. Don't\nremove it unprompted.\n\nA worktree entered by name in step 2 gets Claude Code's Keep / Remove prompt\nwhen the session ends, with Keep selected by default. Remove runs `wt remove`\nwith its normal safeguards. A worktree entered by path in step 3 stays, as\ndoes a worktree the session left with `action: \"keep\"`. If the user asks to\nleave mid-session, `ExitWorktree({action: \"keep\"})` returns the session to its\noriginal directory;\n`ExitWorktree` cannot remove a worktree entered by `path`, so removing one of\nthose is always `wt remove <branch>`.\n\n## Scope\n\nThe command's mandate is ONE worktree (in the named repo, if one was given)\nand the requested task inside it.\n","plugins/worktrunk/skills/worktrunk/SKILL.md":"---\nname: worktrunk\ndescription: Guidance for Worktrunk (the `wt` CLI) — git worktree management, hooks, and config. Load when working out which worktree a `wt` command will act on, or reaching for the global `-C <path>` to target one; editing .config/wt.toml or ~/.config/worktrunk/config.toml; adding, modifying, or debugging hooks (post-merge, post-start, pre-commit, pre-merge, post-switch, etc.); configuring commit message generation or command aliases; or troubleshooting wt behavior. Also answers general worktrunk/wt questions.\nlicense: MIT OR Apache-2.0\ncompatibility: Requires the `wt` CLI (https://worktrunk.dev)\n---\n\n# Worktrunk\n\nHelp users work with Worktrunk, a CLI tool for managing git worktrees.\n\n## Available documentation\n\nReference files are synced from [worktrunk.dev](https://worktrunk.dev) documentation:\n\n- **reference/config.md**: User and project configuration (LLM, hooks, command defaults)\n- **reference/hook.md**: Hook types, timing, and execution order\n- **reference/switch.md**, **merge.md**, **list.md**, etc.: Command documentation\n- **reference/extending.md**: Aliases, multi-step pipelines, custom subcommands, and template-expansion gotchas (two-pass `{% raw %}` deferral, for-each recipes)\n- **reference/llm-commits.md**: LLM commit message generation\n- **reference/tips-patterns.md**: Practical recipes — aliases, per-branch variables, dev server per worktree, parallel agent patterns\n- **reference/shell-integration.md**: Shell integration debugging\n- **reference/troubleshooting.md**: Troubleshooting for LLM and hooks (Claude-specific)\n\nFor command-specific options, run `wt <command> --help`. For configuration, follow the workflows below.\n\n## Which worktree a command acts on\n\n`wt` finds the *repository* from the working directory, and the *worktree* from the command's own arguments. Two rules cover every case:\n\n1. **A command that names a branch already names its worktree.** Worktrees are addressed by branch name, so `wt switch <branch>`, `wt remove <branch>`, `wt step diff --branch <branch>`, and `wt config state marker set --branch <branch>` act on that branch's worktree no matter which worktree you run them from. Every such argument also accepts the worktree's own path, for the cases a branch cannot name — a second checkout of the same branch, or a detached worktree (which `marker` still rejects, since it keys state by branch name).\n2. **`-C <path>` moves the working directory, not the worktree selection.** Reach for it when the repository lookup is what's wrong: a *different* repository; a command that acts on the current worktree and takes no branch argument (`wt merge`, `wt step rebase|squash|push` — their `[TARGET]` is the merge target, not a worktree); or a caller whose working directory isn't inside a repository at all, such as an agent hook the host pins elsewhere.\n\nLayering `-C` on top of a branch argument names the same worktree twice. From inside the `alpha` worktree of a repo that also has `beta`:\n\n```bash\nwt step diff --branch beta                    # ✓ the branch argument selects the worktree\nwt -C ../repo.beta step diff --branch beta    # ✗ says beta twice\n\nwt switch --create beta                       # ✓ --base already defaults to the default branch\nwt -C ../repo switch --create beta            # ✗ -C adds nothing; you are already in that repo\n```\n\n## Two types of configuration\n\nWorktrunk uses two config files with different scopes and permission models:\n\n**User config** (`~/.config/worktrunk/config.toml`, never checked into git) holds personal preferences: LLM integration, worktree path templates, command settings, user hooks. Treat it conservatively — propose changes and get consent before editing, never install tools on the user's behalf, and preserve the file's existing structure and comments. See `reference/config.md`.\n\n**Project config** (`<repo>/.config/wt.toml`, checked into git) holds team-wide automation: hooks for the worktree lifecycle (pre-start, pre-merge, etc.). Edit proactively — changes are versioned and reversible via git. Comment why each hook exists, and warn the user before adding destructive commands (`rm -rf`, `DROP TABLE`), network fetches piped to shells, or `sudo`. See `reference/hook.md`.\n\nSome requests span both: commit-message generation is user config, while the team's quality checks are project config.\n\n## Core workflows\n\n### Setting up commit message generation (user config)\n\nDetect which tools are installed (`which claude codex opencode pi`); if none, recommend Claude Code. Take the exact command for the chosen tool from `reference/llm-commits.md`, propose the `[commit.generation]` change, and apply it after approval (`wt config create` first if no config exists). To verify, `wt step commit --dry-run` renders the prompt, runs the LLM, and prints the message without committing.\n\n### Configuring project hooks\n\nPick the hook type by when the command should run and whether it may block — `reference/hook.md` maps all ten (5 events × pre/post) to their timing and typical uses.\n\nDerive the commands from the project itself (`package.json` scripts, `Cargo.toml`, `pyproject.toml`) and verify they run before adding them.\n\nWhen a new hook must wait for an existing one, convert the entry to a pipeline; independent commands in a named table run concurrently:\n\n```toml\n# Pipeline: install completes before migrate starts\n[[pre-start]]\ninstall = \"npm install\"\n\n[[pre-start]]\nmigrate = \"npm run db:migrate\"\n\n# Concurrent: independent commands in one table\n[pre-start]\ninstall = \"npm install\"\nenv = \"cp .env.example .env\"\n```\n\nTest with `wt switch --create test-hooks`.\n\n## Common tasks reference\n\n### User config tasks\n- Set up commit message generation → `reference/llm-commits.md`\n- Customize worktree paths → `reference/config.md#worktree-path-template`\n- Custom commit templates → `reference/llm-commits.md#prompt-templates`\n- Configure command defaults → `reference/config.md#command-config`\n- Set up personal hooks → `reference/config.md#user-hooks`\n\n### Project config tasks\n- Set up hooks for new project → `reference/hook.md`\n- Add hook to existing config → `reference/hook.md#hook-forms`\n- Use template variables → `reference/hook.md#template-variables`\n- Add dev server URL to list → `reference/config.md#dev-server-url`\n\n### Aliases & multi-worktree tasks\n- Create a `wt` alias → `reference/extending.md#aliases`\n- Run a command in every worktree → `reference/step.md#wt-step-for-each`\n- Rebase every worktree (up-style) → `reference/extending.md#recipe-rebase-every-worktree-onto-its-upstream`\n- Pass a template to a nested `wt` command → `reference/extending.md#nesting-templates`\n\n## Key commands\n\n```bash\n# View all configuration\nwt config show\n\n# Create initial user config (LLM/commit setup: see reference/llm-commits.md)\nwt config create\n\n# Full config reference (subcommands, templates, env vars)\nwt config --help\n```\n\n## Hook approvals in non-interactive sessions\n\nWorktrunk never runs a project's hooks or aliases until the user has explicitly approved them. The commands in `.config/wt.toml` are arbitrary shell code shipped in a repository the user may have just cloned, so on first run Worktrunk shows each command and waits for the user to approve it — an untrusted `.config/wt.toml` cannot silently execute anything. Approvals are stored per-project in `~/.config/worktrunk/approvals.toml` and re-prompted whenever a command template changes, so a hook can't be swapped for a different command after it was approved.\n\nAgents running `wt merge`, `wt switch`, or other commands that trigger hooks will hit an error like:\n\n```\n▲ cargo-difftest needs approval to execute 1 command:\n○ post-merge install:\n  cargo install --path .\n✗ Cannot prompt for approval in non-interactive environment\n↳ To skip prompts in CI/CD, add --yes; to pre-approve commands, run wt config approvals add --yes\n```\n\nThe resolution is for the user to make the trust decision themselves:\n\n- **`wt config approvals add`** — interactive prompt where the user reviews each command before it is stored to `~/.config/worktrunk/approvals.toml`. Run once per project; the approval persists across invocations until the command template changes or the project moves. This is the path to recommend — the user reviews and consents to exactly the commands that will run.\n\n**When invoked as an agent, stop and escalate to the user.** Approving a project's hooks is a security decision about whether this repository should be trusted to run arbitrary commands on the user's machine — that decision belongs to the user, not the agent. Tell the user to run `wt config approvals add` and let them review the commands. Do not reach for either `--yes` on the user's behalf: on the blocked command it skips the gate for that invocation, and `wt config approvals add --yes` records every command the project declares with nobody reading them. Both exist for CI/CD pipelines and containers that already control their own hook contents; neither is a shortcut for an interactive agent to silence an approval prompt.\n\n## Advanced: agent handoffs\n\nWhen the user requests spawning a worktree with an agent in a background session (\"spawn a worktree for...\", \"hand off to another agent\"), use the tmux or Zellij command from `reference/tips-patterns.md#agent-handoffs` with the CLI you are running as in place of `claude`, following that section's note on where a subcommand such as OpenCode's `run` goes.\n\n**Requirements** (all must be true):\n- User explicitly requests spawning/handoff\n- User is in a supported multiplexer (check `$TMUX` / `$ZELLIJ`)\n- The user's project instructions (`CLAUDE.md` or `AGENTS.md`) or an explicit prompt authorize this pattern\n\n**Do not use this pattern** for normal worktree operations.\n\n### Parallel sub-Agents (single Claude Code session)\n\nTo spawn multiple sub-Agents that each work in their own worktree from one Claude Code session — no terminal multiplexer, no human in the other pane — pre-start each worktree from the parent and pass the path into the sub-Agent prompt:\n\n```bash\nwt switch --create <branch> --no-cd\n```\n\nThen call the `Agent` tool **without** `isolation: \"worktree\"`, naming the path in the prompt:\n\n```\nYou are working in `/abs/path/to/myproject.<branch>` on branch `<branch>`.\nAll edits must stay in that worktree.\n```\n\n`--no-cd` skips the shell-integration cd script the parent can't consume. Add `--no-hooks` only when no user or project hooks provision the worktree and each sub-Agent does its own build/test step (e.g. `cargo run -- hook pre-merge --yes`) — a `pre-start` hook that installs dependencies or links a gitignored build environment hands the sub-Agent a worktree it can't build in when it's skipped. Leaving hooks on needs the project's hook commands already approved: the parent session can't prompt, so an unapproved command in `.config/wt.toml` aborts the create — see **Hook approvals in non-interactive sessions** above.\n\n**Do not** use `Agent { isolation: \"worktree\" }` for this. Claude Code passes its internal agent ID as `name` to the `WorktreeCreate` hook, so `wt` creates the worktree as `myproject.agent-<id>` on a throwaway branch. If the sub-Agent then creates a feature branch on top, you end up with non-canonical paths, orphan branches, and post-start hooks fired against the wrong branch. Pre-creating with `wt switch --create` keeps path, branch, and hook target aligned.\n",".claude/skills/running-tend/SKILL.md":"---\nname: running-tend\ndescription: Worktrunk-specific guidance for tend CI workflows. Adds codecov polling, Rust test commands, labels, and review criteria on top of the bundled tend-ci-runner skills. Use when operating in CI.\nmetadata:\n  internal: true\n---\n\n# Worktrunk Tend CI\n\nProject-specific guidance for tend workflows running on worktrunk (a Rust\nCLI for managing git worktrees). The bundled `run-tend`, `review`, and `triage`\nskills provide the workflow framework; this skill adds worktrunk conventions.\n\n## Filing issues in other repos\n\nStanding exceptions granted, each filing directly without asking permission\nhere first:\n\n- agent-equipped targets (per **Filing issues** in the bundled\n  `act-in-other-repos` skill)\n- any project the weekly digest finds copying Worktrunk's code without its\n  license notice (`references/feedback-digest.md`, \"Projects that copy\n  Worktrunk's code\")\n\nThe default rule (open an issue here asking permission first) applies to every\nother target.\n\n## Codecov Monitoring\n\nAfter required CI checks pass, poll `codecov/patch` — it is mandatory despite\nbeing marked non-required:\n\n```bash\nfor i in $(seq 1 5); do\n  CODECOV=$(gh pr checks <number> 2>&1 | grep 'codecov/patch' || true)\n  if echo \"$CODECOV\" | grep -q 'pass'; then\n    echo \"codecov/patch passed\"; exit 0\n  elif echo \"$CODECOV\" | grep -q 'fail'; then\n    echo \"codecov/patch FAILED\"; exit 1\n  fi\n  sleep 60\ndone\n```\n\nIf codecov fails **locally**, investigate with `task coverage` and\n`cargo llvm-cov report --show-missing-lines | grep <file>`.\n\n### Investigating codecov failures in CI\n\n`task` and `cargo-llvm-cov` are not installed in the `tend-setup` action.\nDon't try to `cargo install` them in the sandbox — past attempts at\nsource-compiling installs cascaded into bash-tool interrupts that blocked\neven `pwd` and `echo`. Instead, query Codecov directly, following\n`tests/AGENTS.md` → **Coverage Investigation** for the endpoints and their\ntraps. The scratch paths there and below go to `${TMPDIR:-/tmp}` — write new\nones the same way.\n\nIf the Codecov API markers aren't enough, download the `code-coverage-report`\nartifact from the PR head's `coverage` workflow run — it contains a\n`cobertura.xml` with per-line hit counts:\n\n```bash\nREPO=$(gh repo view --json nameWithOwner --jq '.nameWithOwner')\n# Find the coverage run on the PR head SHA:\nCI_RUN=$(gh api \"repos/$REPO/commits/<sha>/check-runs\" --jq '.check_runs[] | select(.name == \"code-coverage\") | .details_url | capture(\"runs/(?<id>[0-9]+)\") | .id')\n# List artifacts, then download the coverage one:\ngh api \"repos/$REPO/actions/runs/$CI_RUN/artifacts\" --jq '.artifacts[] | {name, id}'\ngh api \"repos/$REPO/actions/artifacts/<id>/zip\" > \"${TMPDIR:-/tmp}/coverage.zip\"\nunzip -q \"${TMPDIR:-/tmp}/coverage.zip\" -d \"${TMPDIR:-/tmp}/coverage\"\n```\n\n## Test Commands\n\n```bash\ncargo run -- hook pre-merge --yes   # full suite + lints\ncargo test --lib --bins             # unit tests only\ncargo test --test integration       # integration tests only\n```\n\nCI runs on Linux, Windows, and macOS.\n\n## Rework a test that reaches for its environment\n\nA test that leans on inherited state — the process CWD, an ambient env var —\nsets up its own instead, via `TestRepo::with_initial_commit()` plus a tempdir,\nthe way most worktrunk tests already do. Guarding it with an early return\n(**Don't \"fix\" tests by adding skip guards** in the bundled `fix-a-bug` skill)\ndrops the coverage rather than restoring it. This governs every workflow that\nfixes a test here, not just issue triage.\n\n## Session Log Paths\n\nThe artifact directory is named after the agent's working directory, which\nmoves between tend releases — 0.2.5–0.2.13 used a per-run\n`tend-agent-workspace-*/checkout`, and from 0.2.14 the agent works in the\nrunner's own checkout, so `-home-runner-work-worktrunk-worktrunk/` is the\nprefix again. Match on neither literal: use the bundled\n`find \"$DEST\" -name '*.jsonl'` recipe, which holds across all of them — every\nshape is one `<session-id>.jsonl` under a single slugified directory.\n\n## Labels\n\n- `automated-fix` — fix PRs from triage\n- `nightly-cleanup` — nightly sweep issues and PRs\n\n## CI Failure Triage: Prefer Rerun for Transient Infrastructure Failures\n\nBefore opening a PR for a CI failure, classify it:\n\n- **Transient infrastructure** (link-check timeouts, apt-get flakes, GitHub\n  outages, runner disk issues, codecov upload blips) — do **not** create a\n  PR. Rerun the failed jobs yourself (**Rerunning failed jobs** in the bundled\n  `monitor-ci` skill) rather than leaving the rerun to the maintainer, and\n  report its result where you post the diagnosis. A permanent config change\n  for a one-off timeout is churn the maintainer will close.\n- **Flaky test** (known-flaky or first-seen PTY/shell test) — try to fix it.\n- **Real regression** — proceed with a fix PR.\n\n**Non-required ≠ transient.** A non-required job (e.g. `collect affected coverage`, `affected tests (linux, advisory)`) can fail from a real regression. The required/non-required distinction is about merge-blocking, not about how the failure is classified. If a deterministic build error (`error[E...]`, \"binary not found\", \"ambiguous candidates\", missing target) repeats across consecutive runs of the same shape, it's a real regression even when the job is advisory. Reserve \"transient\" for non-deterministic causes: `BrokenPipe`, `connection reset`, runner disk full, GitHub API timeouts, host-availability blips.\n\n**Lychee link-check timeouts are always transient** unless the same URL has\nfailed on at least two separate runs within the last few days. The check runs\nas the `link-check` job in the `nightly` workflow. `.config/lychee.toml`\nalready sets `max_retries = 6` and lists known-unreliable hosts; one timeout\nis not enough evidence to extend that list. Signals you have a transient\nfailure, not a broken link:\n\n- The previous run on the same or a nearby commit passed.\n- Only `[TIMEOUT]` is reported (not `404`/`403`/`410`).\n- The URL is reachable from a local `curl`.\n\nWhen in doubt, post the diagnosis on the failure cause issue and wait — don't open a PR.\n\n## Applying GitHub Suggestions\n\nApply the literal suggestion only — change the lines it covers, nothing more.\nIf surrounding lines also need updating, note that in your reply.\n\n## PR Review: Don't Self-Dismiss Over Unrelated Test Flakes\n\nIf a clearly-unrelated test or infrastructure failure turns a check red after\nyou've already approved a PR, leave the approval in place. Do **not** dismiss\nyour own approval to \"gate\" on a rerun — but do start the rerun yourself and\nreport its result; a diagnosis that says a rerun should clear the failure is\nthe cue to run it, not to hand it to the maintainer.\n\nGitHub blocks both `gh run rerun --failed` and per-job rerun\n(`POST /repos/{owner}/{repo}/actions/jobs/{id}/rerun`) with HTTP 403 while\n*any* job in the same workflow run is still `in_progress`, and\n`tend runtime rerun-failed-jobs` doesn't wait for that. Rerun failed jobs in\nworkflow runs that have finished now, and those in a run still going once it\ncompletes.\n\nRerun only runs on the PR's current head. The CI workflows' concurrency groups\nare keyed by PR number with `cancel-in-progress`, so rerunning an older head's\nrun cancels the current head's run in that workflow.\n\nThe codecov-failure dismissal pattern is different and remains correct:\n`AGENTS.md` requires explicit user approval before merging with failing\n`codecov/patch`, so dismissing the approval until the coverage gap is\naddressed is intentional.\n\n## Weigh the root-cause fix before shipping a workaround\n\nWhen a mismatch, a false positive, or a stale value has an obvious non-code\nworkaround (a template change, a config value, an alias, a comment recording\nthe drift), don't stop there. First check whether the workaround is **lossy or\nfoot-gunny**, and weigh a proportionate **root-cause code fix** before opening\na PR that only records it. A \"docs-only, no risk\" framing is not the same as\ngood guidance — a zero-code-risk change can still steer users toward a\ncollision-prone or lossy config, and annotating a stale value leaves the\nduplication that made it stale. If you do recommend a workaround, surface its\ndownsides in the PR body up front, not only when challenged.\n\nThis governs every workflow that opens a PR here, not just issue triage.\n\n## Issue Triage\n\nWhen you need more information to diagnose a reported bug, the **primary\nask is `wt -vv <command>`**. Re-running the failing command with `-vv`\nwrites a diagnostic bundle — a single report containing wt/git/OS versions,\nshell integration, `wt config show`, `git worktree list --porcelain`, and a\n`trace.log` of every git invocation with its output. The `-vv` output prints\nthe bundle's exact absolute path (`Diagnostics and performance profile\nsaved @ …`) followed by a ready-to-run `gh gist create --web\n<path>` line — **point the user at those printed lines; don't hand them a\nhardcoded path**. In particular, never tell them to `cat\n.git/wt/logs/diagnostic.md`: inside a linked worktree `.git` is a gitdir\n*file*, not a directory, so that path fails with `Not a directory (os error\n20)` (`ENOTDIR`). The bundle actually lives under the git *common* dir —\n`\"$(git rev-parse --git-common-dir)/wt/logs/diagnostic.md\"` resolves from any\nworktree, and the printed absolute path already points there. One gist URL\npasted into the issue gives us most of what we'd otherwise ask for piecemeal,\nso lead with this for unexplained failures rather than chaining\nversion/config/repro questions across multiple round-trips.\n\nWhen the report is about a slow `wt` command, read its **Performance profile**\nsection first. It renders the same breakdown as `wt config state logs profile`\n(subprocess time by command type, slowest calls, repeated `(command, context)`\npairs) directly from the bundled `trace.log`, so you can spot redundant git\ncalls and slow commands without parsing the raw trace by hand. The same\nreport run against a statusline capture is the weekly per-render cache\ncheck — see **Weekly Maintenance: Statusline Cache-Check**.\n\nReach for narrower asks only when the diagnostic is overkill:\n\n- `wt --version` — when the only question is whether a fix has landed.\n- `wt config show` — when the suspicion is purely config/shell-integration\n  and you already have the command + repro.\n\n### Don't ship fixes you can't verify\n\nWhen the bug or proposed fix turns on runtime state the bot can't observe from CI — plugin hooks firing inside an agent CLI (Claude Code, Codex, Antigravity), shell-integration side effects, interactive prompt rendering, signal forwarding into a TTY — do **not** open a PR premised on the hypothesis. Signals to stop:\n\n- The proposed transition fires inside a running agent session the bot can't drive from a test (`PostToolUse`, `Stop`, `Notification`, statusline redraws).\n- The \"analysis\" in the issue is an LLM-written trace pasted by the reporter, not a verified observation. Treat that as a starting hypothesis, not ground truth — a Claude-written explanation of why X is broken is no more trustworthy than the bot's own first guess.\n- The repro requires an interactive shell or `claude` running in a tmux that the bot can't spin up.\n\nComment on the issue with what's known, ask the reporter for the concrete symptom they observe (\"which marker shows where, when\") rather than for a fix to validate, and exit without a PR. The bar for opening a fix PR is *the failure mode is reproducible and the fix is testable*, not *the hypothesis seems plausible*. If you post a fix despite limited testability (rare — usually only when the reporter has confirmed the exact symptom and the code change is obviously correct from inspection), explicitly flag what wasn't verified in the PR body.\n\n### Feedback digest issues\n\nAn issue labeled `feedback-digest` is the weekly report, not a bug report. The\nweekly run files each confirmed bug in it as its own issue, so triage posts\nnothing on it.\n\n### Closing Duplicates\n\nWhen an issue is clearly a duplicate, close it after commenting. Use\n`gh issue close <number>` and tell the reporter: if they believe this was\nclosed in error, they can let us know and we'll reopen it.\n\n### Check `--config-set` before calling a setting unpinnable\n\n`wt --config-set '<toml>'` overrides any user config key for one invocation,\nabove both config files and `WORKTRUNK_SECTION__KEY` env vars ([inline config\noverrides](https://worktrunk.dev/config/#inline-config-overrides-config-set)).\nThe resolver just reads `repo.config().<key>` and shows no sign of that layer,\nso before writing \"there's no way to do X per invocation\", ask whether X is a\nconfig key: the ask is usually already met, and the reply is a `--config-set`\nrecipe plus a docs fix where the docs don't connect the flag to the setting.\nPinning is all that covers — weigh the request's residual asks on their own\nmerits.\n\n### Suggesting Aliases for Niche Feature Requests\n\nworktrunk deliberately limits flag and config growth, so a `wt` alias is the\nstanding answer to a narrow feature request rather than a new native flag.\nSuggest one when the request serves a single reporter's workflow or a small\nsubset of users (idempotent create-or-switch, auto-push after merge) and\ncomposes from existing `wt` commands.\n\nAnswer with a `wt` `[aliases]` entry. Defined in user config, it resolves\n`wt <name>` to the alias whenever no built-in matches, so the same alias works\nacross every repo. It's the project's preferred extension point.\n\n**How to respond:**\n1. Search open and closed issues for the same request and link the prior\n   thread; these asks recur, and the link lets the deflection read as a\n   considered position rather than a brush-off.\n2. Draft the alias.\n3. Test it in a scratch worktree against the happy path and edge cases (branch\n   already exists, dirty worktree). When a surprising behavior turns up, note\n   it in the reply instead of building the alias around it. For example, a\n   create-or-switch wrapper inherits `wt switch <name>`'s habit of\n   materializing a *remote* branch of the same name.\n4. Post the tested alias with usage examples.\n5. Link to the [aliases docs](https://worktrunk.dev/extending/#aliases) and\n   [tips & patterns](https://worktrunk.dev/tips-patterns/).\n\n## Weekly Maintenance: MSRV & Toolchain\n\nBump both MSRV and the development toolchain to **latest stable − 1**. When\nRust 1.N is the current stable release, set both to 1.(N−1).\n\nFiles to update:\n\n| File | Field | Example (if stable is 1.94) |\n|------|-------|----|\n| `Cargo.toml` | `rust-version` | `\"1.93\"` |\n| `tests/helpers/wt-perf/Cargo.toml` | `rust-version` | `\"1.93\"` |\n| `rust-toolchain.toml` | `channel` | `\"1.93.0\"` |\n| `.github/workflows/nightly.yaml` | `rustup override set nightly-<date>`, twice (`minimal-versions`, `check-unused-dependencies`) | a nightly from the last few weeks |\n\nBump the nightly pins only when the pinned date is more than three months old.\nCargo refuses a workspace whose `rust-version` exceeds the toolchain, so an\nMSRV bump past a stale pin fails both jobs before they check anything.\n\n`flake.nix` reads the channel from `rust-toolchain.toml`, so the Nix build\nfollows this bump. Dependabot keeps `flake.lock` current, including the\n`rust-overlay` revision that has to know the new channel; a lock too old for\nit fails the `nix-flake` job this PR triggers.\n\nAfter bumping, run the full test suite (`cargo run -- hook pre-merge --yes`)\nand verify `cargo msrv verify` passes.\n\n## Weekly Maintenance: CI Pin Bumps\n\nPinned third-party versions in CI are invisible to Dependabot — it follows `Cargo.toml` deps and `uses: foo@vN` action refs, not inline `version:` strings. They drift unless this step bumps them.\n\nEach weekly run checks every pin below against upstream and bumps whatever has drifted. A bump that can turn a whole CI leg red — an OS image, a major version, a tool whose version moves snapshots — goes on its own branch and PR, so a red matrix decides only that bump instead of holding back the week's safe ones. The weekly runner is Linux, so that PR's own checks are the only place a macOS or Windows change gets tested; open it and report what they said.\n\n- **`baptiste0928/cargo-install@v3` blocks** in `.github/workflows/{affected,ci,coverage,nightly}.yaml` and `.github/actions/{test,tend}-setup/action.yaml` — every `version: \"=X.Y.Z\"` against `cargo info <crate>`. Today: `cargo-affected`, `cargo-insta`, `cargo-nextest`, `cargo-llvm-cov`, `cargo-msrv`, `cargo-udeps`, `lychee`, `worktrunk`. `cargo-affected` is pinned twice in `affected.yaml`; move both together. Verify each crate's `rust-version` against the pinned toolchain and note compatibility in the PR body (see PR #1657 for the format).\n- **`hustcer/setup-nu@v3`** `version:` input — latest from `gh api repos/nushell/nushell/releases/latest --jq '.tag_name'`. Five call sites: `coverage.yaml` (`code-coverage`), `nightly.yaml` (`feature-powerset`), `benchmarks.yaml` (`benchmarks`), and `.github/actions/{test,tend}-setup/action.yaml` — `tend-setup`'s copy is what puts `nu` in the agent's sandbox, so it moves with the others.\n- **Codex Cloud tools** — `.codex/cloud.sh` pins pre-commit, cargo-insta, cargo-nextest, Nushell, and PowerShell; `setup-web` pins Nushell and PowerShell. Keep cargo-insta, cargo-nextest, and Nushell level with `.github/actions/test-setup/action.yaml`, which pins the same three — the gate runs `--all-features`, so Nushell's version moves PTY snapshots. Nothing under `.github/` pins PowerShell (CI runs whatever the runner image ships), so bump that one on its own.\n- **Docs site packages** in `docs/package.json` are covered by Dependabot's `/docs` npm entry. Do not duplicate those bumps in this manual pin pass. The one thing that pass does own is the `ignore` entry for `typescript` majors in `.github/dependabot.yaml`: it suppresses the proposal Dependabot would otherwise make, so nothing else can surface it. Check `npm view @astrojs/check peerDependencies.typescript` against the current `typescript` major and delete the entry once the range covers it — the rule is version-agnostic, so left in place it blocks a major `@astrojs/check` fully supports just as silently as the TypeScript 7 it was added for (#3877).\n- **Runner images** — every `runs-on:` label and matrix `os:`/`runner:` value in the workflows. A pin equals what its `-latest` label currently resolves to, per the availability table in `actions/runner-images`:\n\n  ```bash\n  gh api repos/actions/runner-images/contents/README.md \\\n    -H 'Accept: application/vnd.github.raw' | sed -n '/^| Image/,/^$/p'\n  ```\n\n  Bump any pin the table no longer lists against `-latest`, and update `ci.yaml`'s header comment, which records the reason for each image it names. GitHub keeps two GA images per OS and begins deprecating the older one as soon as a newer goes GA, so a pin that has fallen off `-latest` is already the next one due; the table's `deprecated` badge marks that deadline, not the moment to move, and a row badged `preview` is not a bump target.\n\n  A variant label — `-arm`, `-intel`, `-large` — has no `-latest` of its own; it follows its base image's row.\n\n  Where a pin is deliberately held back, that comment says what the repo needs from the older image. Re-check that need against the newer image each week — upstream announces image changes as issues, so `gh search issues --repo actions/runner-images \"<the need> <newer image>\"` surfaces a reversal. Reading the cited issue's state is not the test — an announcement closes when its change ships, in either direction.\n\n  The `tend-*.yaml` workflows also pin a runner, but tend's generator writes them and `uvx tend@latest init` overwrites a hand edit; file a tend issue for those.\n\nDiscovery shortcut: a recent green CI run on `main` flags cargo-install drift directly via workflow annotations. `gh run view <run-id> --json jobs --jq '.jobs[].databaseId' | xargs -I{} gh api repos/<owner>/<repo>/check-runs/{}/annotations` returns one warning per outdated pin.\n\n## Weekly Maintenance: Statusline Cache-Check\n\nDetect new in-process cache-miss duplicates introduced by recent changes by\nprofiling a real `wt list statusline --format=claude-code` trace. Asynchronous\nstatuslines such as Claude Code and tmux run the render repeatedly through a\nsession, so duplicate git subprocesses there compound into measurable\nfseventsd / IPC load.\n\n```bash\n# Run from any worktree of this repo. `jq -n` builds the stdin JSON so the\n# recipe is portable (the weekly job runs on ubuntu-24.04, whose GNU sed\n# rejects BSD's `sed -i ''`) and so a path with a quote can't corrupt it.\njq -n --arg cwd \"$PWD\" '{\n  hook_event_name: \"Status\",\n  workspace: {current_dir: $cwd},\n  model: {display_name: \"Opus\"},\n  context_window: {used_percentage: 42.0}\n}' > \"${TMPDIR:-/tmp}/statusline-input.json\"\n\n# Debug build on purpose. `tend-weekly` installs no `wt` and restores no Rust\n# cache, so `--release` means a cold optimized build of the whole dependency\n# graph before the first render. The duplicate `(command, context)` pairs this\n# check reads are profile-independent; only the timing columns, which this\n# section doesn't triage, would be worth a release build.\ncargo run -- -vv list statusline --format=claude-code \\\n  < \"${TMPDIR:-/tmp}/statusline-input.json\" > /dev/null\ncargo run -- config state logs profile --format=json | jq .cache\n```\n\nThe `.cache` report flags commands invoked more than once with the same context.\nTriage each duplicate:\n\n- **Legitimate** (different cwd, different ref form that can't be normalized,\n  intentional double-call across phases) — note in the response and move on.\n- **Cache miss** (same logical operation should hit cache but doesn't) —\n  open an issue or fix it. Common shapes: `merge_base(\"main\", \"<sha>\")` vs\n  `merge_base(\"main\", \"branch\")` keying separately;\n  `worktree_at(cwd)` vs `worktree_at(porcelain_path)` not canonicalizing.\n\n## Weekly Maintenance: LLM Model Names in Docs\n\nGrep for current Claude and Codex pins across every tracked file:\n\n```bash\ngit grep -niE \"claude|codex\"\n```\n\nCheck the latest IDs at <https://docs.anthropic.com/en/docs/about-claude/models> and <https://developers.openai.com/codex/models>. The recommended commit-message commands should use the most recent fastest model from each vendor (Haiku for Anthropic, the smallest current Codex variant for OpenAI).\n\n**On drift, open a PR — don't file an issue.** The source of truth is `after_long_help` in `src/cli/mod.rs`; edit it and let `cargo test --test integration test_docs_are_in_sync` regenerate the mirrors under `docs/src/content/docs/` and `skills/worktrunk/reference/`. The \"smallest current variant\" call is a judgment — pick the one the vendor's models page currently positions as fastest/smallest, and explain the choice in the PR body. Verifying the new model name with an installed CLI (`codex -m <name>`, etc.) isn't possible in this CI sandbox; the PR is the right output anyway, and the maintainer tests on merge.\n\n## Weekly Maintenance: Projects Worktrunk Integrates With\n\nOther projects change on their own schedules. Agent CLIs change the surfaces\nWorktrunk's plugins hook into, and packagers and module authors carry copies of\nWorktrunk that fall behind it. Each week, check both tables below.\n\nFor each change that needs action, search this repo's open issues for it, then\nfile one issue or add to the one already open. Link the upstream entry or the\ndownstream file, and say what should change and in which repository. A fix in\nanother repository needs the maintainer's go-ahead under **Filing issues in\nother repos**, and the issue here asks for it. Don't open a PR speculatively.\nIf nothing changed, say so and move on. A source that errors or returns\nnothing leaves its row unchecked, so name it rather than report no change.\n\n### Agent CLIs\n\nKeep Worktrunk making full use of each agent CLI. A release that adds something\nWorktrunk could use, to do more or to do what it already does more simply,\nneeds action as much as one that breaks something Worktrunk relies on.\n\nRead what each source published in the last week. For a GitHub repository,\nlist its releases with `gh release list -R <repo> -L 50` and read each new\none's notes with `gh release view`.\n\n| App | Source to check | Integration surface |\n|-----|-----------------|---------------------|\n| Claude Code | `gh api repos/anthropics/claude-code/contents/CHANGELOG.md -H 'Accept: application/vnd.github.raw'`, plus `curl -sL https://code.claude.com/docs/en/statusline.md` for the statusline JSON schema | statusline stdin JSON, `WorktreeCreate`/`WorktreeRemove` hooks, plugin marketplace, `/wt-switch-create` |\n| Codex | `openai/codex` | plugin marketplace |\n| Antigravity | `curl -sL https://antigravity.google/docs/changelog.md` and `curl -sL https://antigravity.google/docs/hooks.md` | plugin layout (`plugins/worktrunk/.antigravity-plugin/plugin.json`, `hooks.json`), lifecycle hooks (`SessionEnd`, worktree hooks), `agy plugin install` |\n| OpenCode | `anomalyco/opencode` | plugins API in `~/.config/opencode/plugins/` |\n| Pi | `earendil-works/pi` | the extension events `dev/pi-extension.ts` uses, loaded from `~/.pi/agent/extensions/` |\n| oh-my-pi | `can1357/oh-my-pi` | the hook events `dev/omp-hook.ts` uses, loaded from `~/.omp/agent/hooks/pre/` by its extension runner |\n\nWhat to flag:\n\n- **New statusline JSON fields** — `src/commands/statusline.rs` parses `workspace.current_dir`, `model.display_name`, `context_window.used_percentage`, and `rate_limits.{five_hour,seven_day}.{used_percentage,resets_at}`. A newly added field (session cost, PR review state) may be worth surfacing in `wt list statusline`.\n- **Renamed or removed hook events** — `WorktreeCreate`/`WorktreeRemove` route agent worktree creation through `wt`; a renamed event silently disables isolation rather than erroring.\n- **Changed plugin install mechanisms** — `wt config plugins <app> install` breaks if the marketplace, plugins directory, or hook API changes.\n\n### Projects that carry Worktrunk\n\n| Project | Source to check | What it carries |\n|---------|-----------------|-----------------|\n| Distribution packages | Repology, below | a release |\n| conda-forge | `curl -sSf https://api.anaconda.org/package/conda-forge/worktrunk` (`latest_version`); Repology doesn't list it | a release |\n| home-manager | `modules/programs/worktrunk.nix` in `nix-community/home-manager` | the shell init lines, its own Claude Code hook for each event in `plugins/worktrunk/hooks/hooks.json`, the skills path inside the package |\n| nixpkgs | `pkgs/by-name/wo/worktrunk/package.nix` in `NixOS/nixpkgs` | the `skills/` directories it installs by name, the shell completions command |\n| aqua registry | `pkgs/max-sixty/worktrunk/registry.yaml` in `aquaproj/aqua-registry`, which `mise`'s `aqua:` backend also reads | the release asset names, and the cosign certificate identity each release's `packslip.sigstore.json` is verified against |\n\nRepology reports each distribution's version and whether it is outdated:\n\n```bash\ncurl -sSf -A 'worktrunk-weekly (https://github.com/max-sixty/worktrunk)' \\\n  https://repology.org/api/v1/project/worktrunk |\n  jq -er '.[] | \"\\(.repo) \\(.version) \\(.status)\"'\n```\n\nWhat to flag:\n\n- **A package behind Worktrunk's releases for longer than its usual lag.** Find\n  its pending update, usually a bot's version-bump PR in the package's\n  repository, and say why it stalled. Stable channels that freeze versions,\n  such as NixOS stable and Manjaro stable, lag by design.\n- **A copy that no longer matches Worktrunk.** Compare the downstream file with\n  `main`: each hook event and the command it runs, each skill directory, each\n  init line. Either side's commits can open a difference. Flag one that gives\n  the copy's users different behavior from Worktrunk's own integration.\n- **A downstream change that breaks this repo's packaging**, such as\n  home-manager declaring an option that `homeModules.default` in `flake.nix`\n  also declares.\n\nWhen a project that carries Worktrunk is missing from the table, such as a new\nmodule the feedback digest turns up, add it in a PR.\n\n## Weekly Maintenance: Feedback Digest\n\nOpen an issue with a digest of public feedback on Worktrunk since the previous\none, following `references/feedback-digest.md`.\n\n## README Date Check\n\nThe README blockquote opens with a month+year (e.g., \"**April 2026**\"). During daily\nmaintenance, verify the month matches the current month and update it if stale.\n\n## Per-Workflow References\n\n- **PR review**: `@references/review-pr.md` — Rust idioms, documentation accuracy, duplication search\n- **Nightly sweep**: `@references/nightly-cleaner.md` — survey checklist, branch naming, CI-breakage ownership\n",".claude/skills/writing-user-outputs/SKILL.md":"---\nname: writing-user-outputs\ndescription: CLI output formatting standards for worktrunk. Load before editing any code that calls warning_message, hint_message, error_message, info_message, eprintln, or println, or that produces strings the user will see (CLI help, progress UI, snapshot text). Documents ANSI color nesting rules, message patterns, and output system architecture.\nmetadata:\n  internal: true\n---\n\n# Output System Architecture\n\n## Shell Integration\n\nWorktrunk uses one file-based directive for shell integration:\n\n1. Shell wrapper creates a temp file via `mktemp`\n2. Shell wrapper sets `WORKTRUNK_DIRECTIVE_CD_FILE`\n3. wt writes a raw path to the file\n4. Shell wrapper changes directory to that path after wt exits\n\n`--execute` always launches its external program directly from wt, with the\nselected worktree as its working directory. It does not use a directive.\n\n## Output Functions\n\nThe output system handles shell integration automatically. Just call output\nfunctions — they do the right thing regardless of whether shell integration is\nactive.\n\n```rust\n// NEVER DO THIS - don't check mode in command code\nif is_shell_integration_active() {\n    // different behavior\n}\n\n// ALWAYS DO THIS - just call output functions\neprintln!(\"{}\", success_message(\"Created worktree\"));\noutput::change_directory(&path)?;  // Writes to directive file if set, else no-op\n```\n\n**Printing output:**\n\nUse `eprintln!` and `println!` from `worktrunk::styling` (re-exported from\n`anstream` for automatic color support and TTY detection):\n\n```rust\nuse worktrunk::styling::{eprintln, println, stderr};\n\n// Status messages to stderr\neprintln!(\"{}\", success_message(\"Created worktree\"));\n\n// Primary output to stdout (tables, shell code, pipeable)\nprintln!(\"{}\", table_output);\n\n// Flush before interactive prompts\nstderr().flush()?;\n```\n\n`src/` holds two crates, and the path differs between them: `worktrunk::styling`\nfrom the binary's modules — the ones `src/main.rs` declares (`commands`, `cli`,\n`display`, …), which the examples throughout this skill are written for — and\n`crate::styling` from the library's, the ones `src/lib.rs` declares (`git`,\n`config`, `shell_exec`, …), where `worktrunk::` does not resolve at all. The\nguard tests accept either, so the compiler is the only thing that tells you the\npath is wrong for the file.\n\nWhich `println!` is in scope decides whether a closed pipe panics: std's\npanics on the `BrokenPipe` write error, anstream's drops it. `wt … | head`\ncloses the pipe, so command code imports the `worktrunk::styling` one and no\n`std::println!` is left in `src/`.\n\nThe stderr macros carry the same rule for a different consequence: anstream's\n`eprint!` / `eprintln!` strip ANSI when stderr isn't a terminal, std's keep it,\nso a file importing one but not the other writes escapes on one line of a\nmessage block and not the next under `wt … 2>log`. `eprint!` is the half that\nslips — it has no newline, so it gets reached for mid-block in a file that\nimported only `eprintln`. Every bare `eprint!` / `eprintln!` under `src/` must\nresolve to anstream's: import it, or qualify the call as\n`styling::eprintln!(…)`. `check_stderr_macros_come_from_styling` in\n`tests/integration_tests/output_system_guard.rs` holds that statically, since\nno snapshot can — the suite forces `CLICOLOR_FORCE=1`, so both printers emit\ncolor and a snapshot agrees whichever macro is in scope. Its\n`STD_STDERR_ALLOWED_PATHS` exempts whole files, not calls, so an entry is only\nright where std's macro is right throughout.\n\nA write that names no macro misses that scan entirely, since the scan looks for\nthe name: `writeln!(std::io::stderr(), …)`, `std::io::stderr().write_all(…)`, a\nlocked handle, a bound one. `check_raw_stderr_writes_go_through_anstream`\nrefuses those shapes too, with its own `RAW_STDERR_ALLOWED_PATHS` — currently\njust `progress.rs`, whose spinner holds one lock across a frame (anstream's\n`stderr()` has none) and is tty-gated, so nothing of its output ever reaches a\nredirected stderr. The shape to watch for is a message rendered in one place\nand printed several layers below, where the printer has no idea it is handling\nnarration: `Cmd::delayed_stream`'s progress line is the example, and a raw\nhandle there made it the only colored line in a redirected `wt switch` log.\n\n**Output whose ANSI is already decided** declares that once at the top of the\ncommand with `worktrunk::styling::ColorChoice::Always.write_global()` and then\nprints through the same anstream macros — the statusline a shell prompt or\nClaude Code renders, and the `--help-page` document whose escapes the docs\npipeline turns into HTML (`--plain` and `--help-md` declare `Never` the same\nway). Neither consumer is ever a tty, so without the declaration anstream\nwould strip their color every time — and the test suite would not catch it,\nbecause it forces color with `CLICOLOR_FORCE=1`;\n`test_color_follows_the_consumer` pins the unforced behavior. Declare `Always`\nonly when the pipe is a courier rather than the destination; anything a person\nreads directly stays on plain anstream, which is what strips color on a pipe\nand honors `NO_COLOR`.\n\n**`--format=json` answers** use `crate::output::print_json` at the command\nhandler. Inner operations return typed facts; when work can complete before a\nlater failure, retain those facts in `CommandFailure<T>`. The outer handler can\nuse `finish_output` to emit the available result once and return the original\nerror for main's readable stderr diagnostics and native exit handling. A path\nwith no result emits nothing; a legitimate JSON null remains a result.\n\n**Shell integration functions** (`src/output/global.rs`):\n\n| Function | Purpose |\n|----------|---------|\n| `change_directory(path)` | Shell cd after wt exits (writes to directive file if set) |\n| `execute(argv)` | Run an external program in the selected worktree |\n| `terminate_output()` | Reset ANSI state on stderr |\n| `is_shell_integration_active()` | Check if directive file set (rarely needed) |\n| `pre_hook_display_path(path)` | Compute display path for pre-hooks |\n| `post_hook_display_path(path)` | Compute display path for post-hooks |\n\n**Message formatting functions** (`worktrunk::styling`):\n\n| Function | Symbol | Color |\n|----------|--------|-------|\n| `success_message()` | ✓ | green |\n| `progress_message()` | ◎ | cyan |\n| `info_message()` | ○ | symbol dim, text plain |\n| `warning_message()` | ▲ | yellow |\n| `hint_message()` | ↳ | dim |\n| `error_message()` | ✗ | red |\n| `prompt_message()` | ❯ | cyan |\n\n**Section headings** (`worktrunk::styling`):\n\n```rust\nuse worktrunk::styling::format_heading;\n\n// Plain heading\nformat_heading(\"BINARIES\", None)  // => \"BINARIES\" (cyan)\n\n// Heading with suffix\nformat_heading(\"USER CONFIG\", Some(\"@ ~/.config/wt.toml\"))\n// => \"USER CONFIG @ ~/.config/wt.toml\" (title cyan, suffix plain)\n```\n\n## stdout vs stderr\n\n**Decision principle:** stdout carries the command's *answer*; stderr carries *narration* about producing it. The discriminating question is answer-vs-narration, not audience — `wt list` is \"for the user\" yet belongs on stdout because it *is* the answer. \"Is this a message to the user?\" doesn't discriminate, because nearly all output is.\n\n- **stdout** → the answer, in whatever format the user selected. Data (tables, JSON, shell code, an expanded template) and `--dry-run` previews both qualify: a preview is the whole answer when nothing mutates. Human-formatted output belongs here too. Color strips automatically on a pipe (anstream), so `wt list | grep` stays safe.\n- **stderr** → narration about doing it: progress, success/warning/error messages, hints, interactive prompts, and `-v`/`-vv` diagnostics.\n- **directive file** → the raw cd path consumed after wt exits.\n\nThe same line can flip streams between modes. `wt config shell uninstall` deletes the file, so `✓ Removed … @ ~/.zshrc` only narrates a side effect that already happened → stderr (the edited file is the answer; stdout is empty). `wt config shell uninstall --dry-run` mutates nothing, so `○ Will remove … @ ~/.zshrc` is the only answer there is → stdout. What flips isn't the wording, it's whether a side effect exists to be the answer.\n\nFor a split preview, the `--format=json` payload is the arbiter: a line json would carry goes to stdout, narration json omits stays on stderr. `wt step prune --dry-run` puts the removal plan on stdout (the same plan json emits) but keeps \"Skipped young-branch (younger than 1d)\" and \"nothing to remove\" on stderr. One case ignores all this: a preview shown *inside* an interactive prompt, such as the `?` re-preview during `wt config shell install`, is mid-prompt narration → stderr.\n\nExamples:\n- `wt list`, `wt config show` → human table/dump or `--format=json`, both to stdout\n- `wt step prune --dry-run` → the removal plan to stdout (human or json); \"nothing to remove\" and skipped-young caveats to stderr\n- `wt config shell init` → shell code to stdout (for `eval`)\n- `wt switch` → status messages only (nothing to pipe)\n\n## When to page output\n\nRoute long, human-oriented stdout through `crate::help_pager::show_help_in_pager`. The helper TTY-detects internally, so piping (`wt … | grep`) keeps working.\n\nPage when output is human-oriented (headings, gutters, structure) and plausibly exceeds one screen. Don't page pipe-first data (tables, JSON, shell code), short output, or output already paged by a delegated tool (`git diff`).\n\nExamples that page: `--help`, `wt config show`, `wt hook show`, `wt step {commit,squash} --dry-run`. Examples that don't: `wt list`, `wt step diff`, `wt step eval`, `--show-prompt` (pipe-first by design).\n\nBuild the whole output into a `String` first (don't stream), then:\n\n```rust\ncrate::help_pager::show_help_in_pager(&out, true)?;\n```\n\nThe helper falls back to plain stdout when paging is disabled or unavailable,\nstdout is not a TTY, or the pager cannot start. Propagate its result so native\nsignal failures and cancellation reach command cleanup.\n\n## Security\n\n- `WORKTRUNK_DIRECTIVE_CD_FILE` holds a raw path (no shell parsing), so it's\n  safe to pass through to alias/hook child processes — a body that writes to it\n  can at worst redirect `cd`.\n\nAll directive env vars are removed from spawned subprocesses by default via\n`shell_exec::scrub_directive_env_vars()`. `DirectivePassthrough::inherit_from_env()`\nre-adds the CD file where a nested command may redirect the parent shell.\n\n## Windows Compatibility (Git Bash / MSYS2)\n\nOn Windows with Git Bash, `mktemp` returns POSIX-style paths like `/tmp/tmp.xxx`.\nThe native Windows binary (`wt.exe`) needs a Windows path to write to the\ndirective file.\n\n**No explicit path conversion is needed.** MSYS2 automatically converts POSIX\npaths in environment variables when spawning native Windows binaries — shell\nwrappers can use `$directive_file` directly. See:\nhttps://www.msys2.org/docs/filesystem-paths/\n\n---\n\n# CLI Output Formatting Standards\n\n## User Message Principles\n\nOutput messages should acknowledge user-supplied arguments (flags, options,\nvalues) by reflecting those choices in the message text.\n\n```rust\n// User runs: wt switch --create feature --base=main\n// GOOD - acknowledges the base branch\n\"Created new worktree for feature from main @ /path/to/worktree\"\n// BAD - ignores the base argument\n\"Created new worktree for feature @ /path/to/worktree\"\n```\n\n**Avoid \"you/your\" pronouns:** Messages should refer to things directly, not\naddress the user. Imperatives like \"Run\", \"Use\", \"Add\" are fine — they're\nconcise CLI idiom.\n\n```rust\n// BAD - \"To rebase your changes onto main, run wt merge\"\n// GOOD - \"To rebase onto main, run wt merge\"\n```\n\n**Avoid redundant parenthesized content:** Parenthesized text should add new\ninformation, not restate what's already said.\n\n```rust\n// BAD - parentheses restate \"no changes\"\n\"No changes after squashing 3 commits (commits resulted in no net changes)\"\n// GOOD - clear and concise\n\"No changes after squashing 3 commits\"\n// GOOD - parentheses add supplementary info\n\"Committing with default message... (3 files, +45, -12)\"\n```\n\n**Two types of parenthesized content with different styling:**\n\n1. **Stats parentheses → Gray** (`[90m` bright-black): Supplementary numerical\n   info that could be omitted without losing meaning.\n   ```\n   ✓ Merged to main (1 commit, 1 file, +1)\n   ◎ Squashing 2 commits into a single commit (2 files, +2)...\n   ```\n\n2. **Reason parentheses → Message color**: Explains WHY an action is happening;\n   integral to understanding.\n   ```\n   ◎ Removing feature worktree & branch in background (same commit as main, _)\n   ```\n\nStats are truly optional context. Reasons answer \"why is this safe/happening?\"\nand belong with the main message. Symbols within reason parentheses still render\nin their native styling (see \"Symbol styling\" below).\n\n**Show path when hooks run in a different directory:** When hooks run in a\nworktree other than the user's current (or eventual) location, show the path.\nUse the appropriate helper function:\n\n1. **Pre-hooks and manual `wt hook`** — User is at cwd, no cd happens.\n   Use `output::pre_hook_display_path(hooks_run_at)`.\n   Examples: pre-commit, pre-merge, pre-remove, manual `wt hook post-merge`.\n\n2. **Post-hooks** — User will cd to destination if shell integration is active.\n   Use `output::post_hook_display_path(destination)`.\n   Examples: pre-start, post-switch, post-start, post-merge (after removal).\n\n```rust\n// Pre-hooks: user is at cwd, no cd happens\nexecute_planned_hook(&plan, anchor, &ctx, HookType::PreMerge, &extra_vars,\n    FailureStrategy::FailFast, crate::output::pre_hook_display_path(ctx.worktree_path))?;\n\n// Post-hooks: user will cd to destination if shell integration active\nregister_planned(&mut announcer, &plan, anchor, &ctx, HookType::PostSwitch, &extra_vars,\n    crate::output::post_hook_display_path(&destination))?;\n```\n\n**Avoid pronouns with cross-message referents:** Hints appear as separate\nmessages from errors. Don't use pronouns like \"it\" that refer to something\nmentioned in the error message.\n\n```rust\n// BAD - \"it\" refers to branch name in error message\n// Error: \"Branch 'feature' not found\"\n// Hint:  \"To create it, use --create\"\n// GOOD - self-contained hint\n// Error: \"Branch 'feature' not found\"\n// Hint:  \"To create a new branch, use --create\"\n```\n\n## Heading Case\n\nUse **sentence case** for help text headings: \"Configuration files\", \"JSON output\", \"LLM commit messages\".\n\n## Message Consistency Patterns\n\nUse consistent punctuation and structure for related messages.\n\n**Ampersand for combined actions:** Use `&` when a single operation does\nmultiple things:\n\n```rust\n\"Removing feature worktree & branch in background\"\n\"Commands approved & saved to config\"\n```\n\n**Semicolon for joining clauses:** Use semicolons to connect related information:\n\n```rust\n\"Removing feature worktree in background; retaining branch (--no-delete-branch)\"\n\"Branch unmerged; to delete, run <underline>wt remove -D</>\"  // hint uses underline\n\"{tool} not authenticated; run <bold>{tool} auth login</>\"       // warning uses bold\n```\n\n**Explicit flag acknowledgment:** Show flags in parentheses when they change\nbehavior:\n\n```rust\n// GOOD - shows the flag explicitly\n\"Removing feature worktree in background; retaining branch (--no-delete-branch)\"\n// BAD - doesn't acknowledge user's explicit choice\n\"Removing feature worktree in background; retaining branch\"\n```\n\n**Flag locality:** Place flag indicators adjacent to the concept they modify.\nFlags should appear immediately after the noun/action they affect, not at the\nend of the message:\n\n```rust\n// GOOD - (--force) is adjacent to \"worktree\" which it modifies\n\"Removing feature worktree (--force) & branch in background (same commit as main, _)\"\n// BAD - (--force) at end, disconnected from the worktree removal it enables\n\"Removing feature worktree & branch in background (same commit as main, _) (--force)\"\n```\n\nThis principle ensures readers can immediately understand what each annotation\nmodifies.\n\n**Parallel structure:** Related messages should follow the same pattern:\n\n```rust\n// GOOD - parallel structure with integration reason explaining branch deletion\n// Target branch is bold; symbol uses its standard styling (dim for _ and ⊂)\n\"Removing feature worktree & branch in background (same commit as <bold>main</>, <dim>_</>)\"  // Integrated\n\"Removing feature worktree in background; retaining unmerged branch\"                          // Unmerged\n\"Removing feature worktree in background; retaining branch (--no-delete-branch)\"              // User flag\n```\n\n**Symbol styling:** Symbols are atomic with their color — the styling is part of\nthe symbol's identity, not a presentation choice. Each symbol has a defined\nappearance that must be preserved in all contexts:\n\n- `_` and `⊂` — dim (integration/safe-to-delete indicators)\n- `+N` and `-N` — green/red (diff indicators)\n\nWhen a symbol appears in a colored message (cyan progress, green success), close\nthe message color before the symbol so it renders in its native styling. This\nrequires breaking out of the message color and reopening it after the symbol.\nSee `FlagNote` in `src/output/handlers.rs` for an example — it handles flag\nacknowledgment notes (like integration reasons) with proper color transitions\nvia its `after(color)` method, which reopens the message color after the symbol.\n\n**Comma + \"but\" + em-dash for limitations:** When stating an outcome with a\nlimitation and its reason:\n\n```rust\n// Outcome, but limitation — reason\n\"Worktree for feature @ ~/repo.feature, but cannot change directory — shell integration not installed\"\n```\n\nThis pattern:\n- States what succeeded (worktree exists at path)\n- Uses \"but\" to introduce what didn't work (cannot cd)\n- Uses em-dash to explain why (shell integration status)\n\nSee `compute_shell_warning_reason()` in `src/output/shell_integration.rs` for the\ncomplete spec of shell integration warning messages and hints\n\n**Compute decisions once:** For background operations, check conditions upfront,\nshow the message, then pass the decision explicitly rather than re-checking in\nbackground scripts:\n\n```rust\n// GOOD - check once, pass decision\nlet should_delete = check_if_merged();\nshow_message_based_on(should_delete);\nspawn_background(build_command(should_delete));\n\n// BAD - check twice (once for message, again in background script)\nlet is_merged = check_if_merged();\nshow_message_based_on(is_merged);\nspawn_background(build_command_that_checks_merge_again());  // Duplicate check!\n```\n\n## Warning Ordering\n\n**Core principle:** Messages about state discovered during evaluation\n(warnings, info notices) appear **before** the action message that follows\nfrom that evaluation.\n\nWhen a command evaluates state, discovers something unexpected, and proceeds\nanyway, that message comes first:\n\n```\n▲ Auto-staging 1 untracked path:\n  notes.md\n◎ Generating commit message...\n```\n\nNot:\n\n```\n◎ Generating commit message...\n▲ Auto-staging 1 untracked path:\n  notes.md\n```\n\nWarnings that result from the action itself (something failed during execution)\nnaturally come after the action.\n\n## Message Types\n\n**Success vs Info:** Success (✓) means something was created or changed. Info\n(○) acknowledges state without changing anything.\n\n| Success ✓                               | Info ○                                |\n| --------------------------------------- | ------------------------------------- |\n| \"Created worktree for feature\"          | \"Switched to worktree for feature\"    |\n| \"Created new worktree for feature\"      | \"Already on worktree for feature\"     |\n| \"Commands approved & saved\"             | \"All commands already approved\"       |\n\nThe same rule governs standalone symbols used as per-row markers in listings:\n✓ marks a completed action, never a state. A listing that reports per-item\nstatus marks it with ○ (state acknowledged) or ❯ (awaiting approval/user\ninput) — the shared vocabulary of `wt hook show` and `wt config approvals\nlist`. Reserve a per-row ✓ for outcomes of work the command just performed\n(shell-install action lines, `-v` subprocess trace glyphs).\n\n**Hint vs Info:** Hints suggest user action or provide additional non-essential\ncontext (supplementary details the user doesn't need but may find useful). Info\nacknowledges state without changing anything.\n\n| Hint ↳                                          | Info ○                                |\n| ------------------------------------------------ | ------------------------------------- |\n| \"To continue, run `wt merge`\"                    | \"Already up to date with main\"        |\n| \"Commit or stash changes first\"                  | \"Skipping hooks (--no-hooks)\"         |\n| \"Branch can be deleted\"                           | \"Worktree preserved (main worktree)\"  |\n| \"Failed command, exit code 128:\"                   |                                       |\n\n**Warning placement:** When something unexpected happens, warn somewhere. Where\ndepends on the nature of the issue:\n\n```\nIs it unexpected?\n├── No → Silent (e.g., gh not installed when no GitHub remote)\n└── Yes → Warn somewhere:\n    ├── Immediate impact OR temporary → Inline (warning_message or in-band indicator)\n    ├── Persists until user action → wt config show (can be checked later)\n    └── Not user-fixable → log::warn! (developer diagnostics)\n```\n\n**Inline warnings** for issues affecting the current command:\n\n| Issue | Why inline |\n|-------|------------|\n| Rate limit during CI fetch | Temporary — won't be there next time |\n| Network timeout | Temporary — retry might work |\n| Hook failed during operation | Immediate impact on this command |\n\n**`wt config show`** for issues that persist until the user fixes them. These\ndon't need to interrupt every command — users can check diagnostics when\ninvestigating:\n\n| Issue | Why config show |\n|-------|-----------------|\n| `gh` not authenticated | User runs `gh auth login` |\n| Shell integration misconfigured | User updates shell config |\n| Config syntax errors | User fixes config file |\n\n**`log::warn!()`** for issues users cannot fix. These help developers debug but\nshouldn't clutter user output:\n\n| Issue | Why log::warn! |\n|-------|----------------|\n| JSON parse error (API changed) | Requires code fix |\n| Internal invariant violated | Developer bug |\n\n**Command suggestions in hints:** When a hint includes a runnable command, use\n\"To X, run Y\" pattern. End with the command for easy copying:\n\n```rust\n// GOOD - command at end for easy copying\n\"To delete the unmerged branch, run wt remove feature -D\"\n\"To rebase onto main, run wt step rebase or wt merge\"\n\n// GOOD - recovery command after shadowing a remote branch\n\"To switch to the remote branch, delete this branch and run without --create: wt remove --foreground feature && wt switch feature\"\n\n// BAD - command without context\n\"wt remove feature -D deletes unmerged branches\"\n\n// BAD - command not at end (hard to copy)\n\"Run wt switch feature (without --create) to switch to the remote branch\"\n```\n\nFor general action guidance without a specific command, direct imperatives are\nclearer:\n\n```rust\n// GOOD - direct imperative for general guidance\n\"Commit or stash changes first\"\n\"Run from inside a worktree, or specify a branch name\"\n\n// VERBOSE - \"To proceed\" adds nothing\n\"To proceed, commit or stash changes first\"\n```\n\n**Description + command in single message:** For warnings/errors that include a\nrecovery command, join with semicolon, and order the recovery \"To X, run Y\" as\nhints do, so the command still ends the line. Use `<bold>` for commands in\nwarnings/errors (only hints use `<underline>`):\n\n```rust\n// Warning with inline recovery command (bold for commands)\nwarning_message(\"Failed to restore stash; to restore manually, run <bold>git stash pop {ref}</>\")\nwarning_message(\"{tool} not authenticated; run <bold>{tool} auth login</>\")\n\n// For longer suggestions, use separate hint message (underline for commands)\nwarning_message(\"Failed to restore stash\")\nhint_message(\"To restore manually, run <underline>git stash pop {ref}</>\")\n```\n\n**Multiple suggestions in one hint:** When a message has a second suggestion,\nfold both into one hint with a semicolon rather than adding another\n`hint_message`, and put the more commonly needed command last for easy\nterminal copying:\n\n```rust\n// GOOD - common action (create) last, easy to select and copy\n\"To list branches, run wt list --branches; to create a new branch, run wt switch feature --create\"\n\n// BAD - common action buried, harder to copy\n\"To create a new branch, run wt switch feature --create; to list branches, run wt list --branches\"\n```\n\nUse `suggest_command()` from `worktrunk::styling` for proper shell escaping.\n\n**Every user-facing message requires either a symbol or a gutter.**\n\n**Section titles:** For sectioned output (`wt hook show`, `wt config show`), use\n`format_heading()` from `worktrunk::styling` (documented above).\n\n## Interactive Prompts vs Non-Interactive Hints\n\nPrompts and hints serve different purposes and have different `--yes` behavior.\n\n**Prompts** are expected steps in a workflow — the user ran a command knowing\nit would ask for confirmation. Hook approval during `wt merge`, config update\nconfirmation, shell install confirmation. `--yes` bypasses these because the\nuser anticipated the question and wants to pre-answer it (e.g., in CI).\n\n**Setup prompts** are unexpected — the user ran `wt merge` and got asked about\nLLM config or shell integration they didn't know about. `--yes` must NOT\nbypass these. A user passing `--yes` to skip hook approval did not consent to\nauto-configuring their shell. In non-interactive mode (no TTY), these should\ndegrade to a hint or be skipped silently — never error.\n\n| Type | Example | `--yes` | Non-TTY behavior |\n|------|---------|---------|------------------|\n| Workflow prompt | Hook approval, config update | Bypasses | Error (`NotInteractive`) |\n| Setup prompt | LLM config, shell integration | No effect | Hint or silent skip |\n\n**Non-TTY degradation patterns:**\n\n- **Hint** — when the user benefits from knowing about the option on every run.\n  Shell integration hint: `↳ To enable automatic cd, run wt config shell install`\n- **Silent skip** — when a hint would be noise. Commit generation setup prompt\n  skips silently because a separate fallback hint (`emit_hint_if_needed`)\n  already covers the unconfigured case on every commit.\n- **Error** — only for workflow prompts where proceeding without consent is\n  unsafe (hook approval). The error includes a hint for the fix:\n  `↳ To skip prompts in CI/CD, add --yes`\n\n**Key invariants:**\n\n- Hints shown in non-TTY mode must NOT set skip flags — hints are not prompts,\n  and should repeat on every non-TTY run\n- `--yes` means \"I anticipated this prompt\" — it applies to workflow prompts\n  the user chose to invoke, not to setup/config discovery prompts\n\n## Blank Line Principles\n\n**Core principle:** When presenting the user with text to read and consider, add\nspacing for readability. When piping output (stdout), keep output dense for\nparsing.\n\nSpecific rules:\n\n- **No leading/trailing blanks** — Start immediately, end cleanly\n- **Blank before prompts, not after** — Signal \"pause, something interactive is\n  happening\" before the prompt; once the user responds, output flows continuously.\n  The blank belongs to the narration it separates from, so the caller emits it\n  and `prompt_yes_no_preview` does not: a prompt that opens a command's output\n  (`wt config shell install`, `wt config plugins claude install`, the\n  commit-generation offer at the top of `wt merge`) starts flush, since a blank\n  there is a leading blank\n- **One blank between phases** — When a sub-operation completes and a different\n  operation begins, add a blank line to visually separate them\n- **Never double blanks** — One blank line maximum between elements\n- **Hints attach to their subject** — Never put a blank line between a hint and\n  the message it elaborates on. Hints (↳) are subordinate — they belong directly\n  below their parent message with no gap.\n\n  ```\n  // GOOD - hint directly follows its subject\n  ↳ fish: Not configured shell extension\n  ↳ To configure, run wt config shell install\n\n  // BAD - blank line detaches hint from subject\n  ↳ fish: Not configured shell extension\n\n  ↳ To configure, run wt config shell install\n  ```\n\n**Prompt spacing:** A blank line before a prompt that follows narration signals\n\"something different is about to happen\" and gives the user's eye a natural\nstopping point before they need to read and respond. No blank line after — the\nuser's input ends the interactive moment and subsequent output flows naturally\nfrom that decision. A prompt with nothing above it, like the setup offer below\nat the top of `wt step commit`, has nothing to separate from and starts flush.\n\n```\n❯ Configure claude for commit messages? [y/N/?] y\n✓ Added to user config:\n  [commit.generation]\n  command = \"...\"\n↳ View config: wt config show\n\n▲ Auto-staging 1 untracked path:\n  a\n◎ Generating commit message...\n```\n\n**Phase separation:** A \"phase\" is a logically distinct operation. The blank\nline between the hint and warning above signals \"config setup is done, now we're\ndoing the main command workflow.\"\n\n**Interactive prompts** must flush stderr before blocking on stdin:\n\n```rust\neprint!(\"❯ Allow and remember? [y/N] \");\nstderr().flush()?;\nio::stdin().read_line(&mut response)?;\n```\n\n## Temporal Locality: Output Should Be Close to Operations\n\nOutput should appear immediately adjacent to the operations it describes.\nProgress messages apply only to slow operations (>400ms): git operations,\nnetwork requests, builds.\n\nSequential operations should show immediate feedback:\n\n```rust\nfor item in items {\n    eprintln!(\"{}\", progress_message(format!(\"Removing {item}...\")));\n    perform_operation(item)?;\n    eprintln!(\"{}\", success_message(format!(\"Removed {item}\")));  // Immediate feedback\n}\n```\n\nBad example (output decoupled from operations):\n\n```\n◎ Removing worktree for feature...\n◎ Removing worktree for bugfix...\n                                    ← Long delay, no feedback\nRemoved worktree for feature        ← All output at the end\nRemoved worktree for bugfix\n```\n\nSigns of poor temporal locality: collecting messages in a buffer, single success\nmessage for batch operations, no progress before slow operations.\n\n## Spinners for Long Single-Operation Work\n\nWhen per-item `progress_message`s don't fit — recursive copy of thousands of\nfiles, a long subprocess with no useful streaming output — a stderr spinner\nkeeps the user oriented. See `src/progress.rs` (`Progress`) for the pattern:\nthe verb (`\"Copying\"`, `\"Removing\"`) is fixed at `Progress::start(verb)`,\nTTY-gate, skip when `verbosity() >= 1` or `--dry-run`, ≥300 ms startup delay\nso fast ops stay silent, IEC bytes (KiB/MiB), clear the line before printing\nthe summary, and have the summary repeat any counters the spinner displayed\n(use `format_stats_paren` for the gray `(N files · X MiB)` suffix).\n\n## Defer Non-Essential Work Until After Primary Output\n\nFire-and-forget cleanup and cache sweeps run after the command's final\nuser-visible message — never before. Placing them at the start delays\ntime-to-first-output with work the user didn't ask for.\n\nWorktrunk marks the boundary with `WORKTRUNK_FIRST_OUTPUT`: handlers\nearly-return where output begins, so work before that return is on the hot\npath, work after it is not. See `handle_remove_command` —\n`run_internal_sweep` runs after `handle_remove_output`.\n\n## Information Display: Show Once, Not Twice\n\nProgress messages should include all relevant details (what's being done,\ncounts, stats, context). Success messages should be minimal, confirming\ncompletion with reference info (hash, path).\n\n```rust\n// GOOD - detailed progress, minimal success\neprintln!(\"{}\", progress_message(\"Squashing 3 commits & working tree changes into a single commit (5 files, +60)...\"));\nperform_squash()?;\neprintln!(\"{}\", success_message(\"Squashed @ a1b2c3d\"));\n```\n\n## Section and Glyph Spacing\n\nWhen composing tightly-packed output where adjacent pieces carry distinct\nmeaning (the statusline segments, prefix-char indicators like `@+1`, `↓1`,\n`?^|`), pack sections flush — no separating space. The marker and its value\nread as one unit, and visual density keeps the line short.\n\nThe one exception is **emoji**: leave a trailing space after an emoji glyph.\nMost terminals render emoji as double-width and bleed the glyph into the cell\nto its right, so a flush `🌔65%` collides the moon with the digits. A space\n(`🌔 65%`) keeps them legible. ASCII and narrow Unicode markers (`@`, `↓`, `●`,\n`⊂`) don't have this problem and stay flush.\n\n```rust\n// GOOD - ASCII marker flush with its value\nformat!(\"@{added}\");          // @+1\n// GOOD - emoji gets a trailing space to clear the next cell\nformat!(\"{moon} {pct:.0}%\");  // 🌔 65%\n// BAD - emoji runs into the digits; terminals overlap the glyph\nformat!(\"{moon}{pct:.0}%\");   // 🌔65%\n```\n\n## Style Constants\n\nOnly three `anstyle` constants exist for table rendering (`src/styling/constants.rs`):\n\n- `ADDITION`: Green (diffs)\n- `DELETION`: Red (diffs)\n- `GUTTER`: BrightWhite background\n\nFor everything else, use `cformat!` tags.\n\n## Styling in Command Code\n\nUse `eprintln!` with formatting functions. Use `cformat!` for inner styling:\n\n```rust\neprintln!(\"{}\", success_message(cformat!(\"Created <bold>{branch}</> from <bold>{base}</>\")));\neprintln!(\"{}\", hint_message(cformat!(\"To continue, run <underline>wt merge</>\")));\n```\n\n**color-print tags:** `<bold>`, `<dim>`, `<underline>`, `<bright-black>`, `<red>`,\n`<green>`, `<yellow>`, `<cyan>`, `<magenta>`\n\n**Branch names and status values** should be bolded in messages.\n\n**Symbol constants in cformat!:** For messages that bypass output:: functions\n(e.g., `GitError` Display impl), use symbol constants directly:\n\n```rust\ncformat!(\"{ERROR_SYMBOL} <red>Branch <bold>{branch}</> not found</>\")\n```\n\n## Commands and Branches in Messages\n\nNever quote commands or branch names. Use styling to make them stand out:\n\n- **In normal font context**: Use `<bold>` for commands and branches\n- **In hints**: Use `<underline>` for commands and data values (paths,\n  branches). Underline is safe inside `<dim>` — closing `[24m` only resets\n  underline, preserving dim. Avoid `<bold>` inside hints — the closing `[22m`\n  resets both bold AND dim, so text after `</bold>` loses dim styling.\n\n```rust\n// GOOD - bold in normal context\neprintln!(\"{}\", info_message(cformat!(\"To continue, use <bold>wt merge</>\")));\n// GOOD - underline for commands in hints\neprintln!(\"{}\", hint_message(cformat!(\"To see worktrees, run <underline>wt list</>\")));\n// BAD - quoted commands\neprintln!(\"{}\", hint_message(\"To see worktrees, run 'wt list'\"));\n```\n\n## Hyperlinks\n\nEvery OSC 8 link is underlined. Link text is sized to fit a column (`#3604`,\n`:11486`) and reads as ordinary content, and color already carries state (the\nCI verdict, dim for a port nothing answers on), so the underline is what marks\na run of text as clickable.\n\n`worktrunk::styling::hyperlink(url, text)` emits the link and its underline\ntogether, which is what keeps the rule true at every call site. It closes with\n`[24m`, leaving a surrounding color or dim intact.\n\n```rust\n// GOOD - the helper carries the underline\nlet cell = hyperlink(url, &format!(\":{port}\"));\n// GOOD - a caller's own style wraps the link\nformat!(\"{style}{}{style:#}\", hyperlink(url, text))\n// BAD - hand-assembled sequences, unmarked link\nformat!(\"{}{text}{}\", osc8::Hyperlink::new(url), osc8::Hyperlink::END)\n```\n\nText that isn't a link stays plain, and whether a run of text is a link belongs\nto the render rather than to the cell emitting it: `LayoutConfig::link_style`\nanswers it once for a whole row, so a CI reference and a dev-server port can't\ndisagree. Two destinations carry no links, and so no underline: a terminal\nwithout OSC 8 support, where `wt list` prints the dev-server URL in full, and\nthe picker's rows, which `Destination::picker` renders as\n`LinkStyle::Unlinked` (that variant's docstring has the reason). Nothing in the\npicker is clickable, by two routes: a row's link style is decided at render\ntime, so it carries no OSC 8 to begin with, and the preview pane is parsed by\nskim through `ansi_to_tui`, which keeps none. Underline there is\nfree to mean something else, and the preview pane spends it twice: on a URL,\nmarking a reference rather than a link (`pr_pane::url_line`), and on the active\ntab in the tab bar (`items::render_preview_tabs`).\n\n## Design Principles\n\n- **`cformat!` for styling** — Never manual escape codes (`\\x1b[...`)\n- **`cformat!` variables are safe** — Tags like `<bold>` are processed at compile\n  time only. Runtime variable values are NOT interpreted as markup, so user\n  content (branch names, commit messages, paths, shell commands with `<`/`>`\n  redirects) can be interpolated directly without escaping. Do NOT escape\n  `<`/`>` in variables — it adds extra chars.\n- **YAGNI** — Most output needs no styling\n- **Graceful degradation** — Styling follows the consumer (NO_COLOR, TTY\n  detection). Plain output preserves meaning through wording, spacing and\n  existing semantic symbols. Missing decoration alone does not justify new\n  markers; add text when information would otherwise be lost.\n- **Unicode-aware** — Width calculations respect symbols and CJK (via `StyledLine`)\n\n**StyledLine** for table rendering with proper width calculations:\n\n```rust\nuse worktrunk::styling::StyledLine;\nuse anstyle::{AnsiColor, Color, Style};\n\nlet mut line = StyledLine::new();\nline.push_styled(\"Branch\", Style::new().dimmed());\nline.push_raw(\"  \");\nline.push_styled(\"main\", Style::new().fg_color(Some(Color::Ansi(AnsiColor::Cyan))));\nprintln!(\"{}\", line.render());\n```\n\nSee `src/commands/list/render.rs` for advanced usage.\n\n## Documentation Examples\n\nUse consistent examples throughout all documentation, help text, and config\ntemplates.\n\n### Canonical example setup\n\n| Element | Value | Notes |\n|---------|-------|-------|\n| Repo directory | `myproject` | Generic placeholder |\n| Repo path | `~/code/myproject` | Realistic dev path |\n| Branch | `feature/auth` | Shows sanitize filter |\n| Worktree path | `~/code/myproject.feature-auth` | Result of default template |\n\n### Template variable examples\n\nUse the canonical values from the table above in all examples:\n\n```\n{{ repo }}           — Repository directory name (e.g., `myproject`)\n{{ branch }}         — Branch name (e.g., `feature/auth`)\n{{ worktree_path }}  — Absolute path to worktree (e.g., `/path/to/myproject.feature-auth`)\n```\n\nIn TOML comments:\n```toml\n#   {{ repo }}           - Repository directory name (e.g., \"myproject\")\n#   {{ branch }}         - Raw branch name (e.g., \"feature/auth\")\n#   {{ worktree_name }}  - Worktree directory name (e.g., \"myproject.feature-auth\")\n```\n\n### Worktree path examples\n\nWhen showing worktree-path template examples:\n\n```toml\n# Default — siblings in parent directory\n# Creates: ~/code/myproject.feature-auth\nworktree-path = \"../{{ repo }}.{{ branch | sanitize }}\"\n\n# Inside the repository\n# Creates: ~/code/myproject/.worktrees/feature-auth\nworktree-path = \".worktrees/{{ branch | sanitize }}\"\n```\n\n## Gutter Formatting\n\nUse gutter for **quoted content** (git output, commit messages, config to copy,\nhook commands being displayed).\n\nThe gutter is a background-colored blank column followed by a space. Plain\noutput keeps the two-space indent. Gutter examples in this skill show that plain\nform.\n\n- `format_bash_with_gutter()` — shell commands (dimmed + syntax highlighting)\n- `format_with_gutter()` — other content\n\n**Gutter vs Table:** Tables for structured app data; gutter for quoting external\ncontent.\n\n**Gutter vs Hints:** Command suggestions in hints use inline `<underline>`,\nnot gutter. Gutter is for displaying content (what will execute, config to\ncopy); hints suggest what the user should run.\n\n## Newline Convention\n\n**Core principle:** All formatting functions return content WITHOUT trailing\nnewlines. Callers handle element separation.\n\nThis applies to:\n- Message functions: `error_message()`, `success_message()`, `hint_message()`, etc.\n- Gutter functions: `format_with_gutter()`, `format_bash_with_gutter()`\n\n**With `eprintln!`:** Adds trailing newline automatically.\n\n```rust\neprintln!(\"{}\", progress_message(\"Merging...\"));\neprintln!(\"{}\", format_with_gutter(&log, None));\n```\n\n**In Display impls:** Use explicit newlines for element separation.\n\n```rust\n// Pattern: leading \\n separates from previous element\nwrite!(f, \"{}\", error_message(...))?;           // first element, no leading \\n\nwrite!(f, \"\\n{}\", format_with_gutter(...))?;    // gutter, separated by \\n\nwrite!(f, \"\\n{}\", hint_message(...))            // hint, separated by \\n\n\n// For blank line between elements, add extra \\n\nwrite!(f, \"\\n{}\\n\", format_with_gutter(...))?;  // trailing \\n creates blank line\nwrite!(f, \"\\n{}\", hint_message(...))            // hint after blank line\n```\n\n**Don't add trailing `\\n` to content:**\n\n```rust\n// GOOD - eprintln! adds newline\neprintln!(\"{}\", progress_message(\"Merging...\"));\n\n// BAD - double newline\neprintln!(\"{}\", progress_message(\"Merging...\\n\"));\n```\n\n**Avoid bullets — use gutter instead.** Instead of `\"\\n  - {}: {}\"` bullet\nformatting, use `format_with_gutter()` to present lists.\n\n## Error Formatting\n\n### Error Message Structure\n\nError and warning messages should communicate four things:\n\n1. **What happened** — The actual state or outcome\n2. **What was expected** — The correct or desired state\n3. **The impact** — Why this matters (optional for obvious cases)\n4. **How to resolve** — What the user should do (can be a separate hint message)\n\n```rust\n// GOOD - states actual, expected, and impact in main message\n\"Shell probe: wt is binary at /path, not function — won't auto-cd\"\n//                 ^^^^^^^^^^^^^^^   ^^^^^^^^^^^^   ^^^^^^^^^^^^^^\n//                 actual            expected       impact\n// Resolution in separate hint: \"Restart shell to activate\"\n\n// GOOD - actual vs expected with resolution inline\n\"Config file has 3 errors, expected valid TOML; run wt config validate for details\"\n//              ^^^^^^^    ^^^^^^^^                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n//              actual     expected                  resolution\n\n// BAD - only states actual, no expected or impact\n\"Shell probe: wt resolves to binary at /path\"\n// Missing: what should it be instead? why does it matter?\n\n// BAD - vague, no actionable information\n\"Shell integration problem detected\"\n// Missing: what's wrong? what should it be? what to do?\n```\n\nWhen the expected state is obvious from context, it can be implied:\n\n```rust\n// OK - expected state (file should exist) is obvious\n\"Config file not found at ~/.config/wt/config.toml\"\n\n// OK - expected state (should succeed) is obvious\n\"Failed to read config: permission denied\"\n```\n\n**Diagnostic messages** (like `wt config show`) should follow this pattern\nespecially carefully — users read diagnostics to understand what's wrong.\n\n### Single vs Multi-line\n\n**Single-line errors** with variables are fine:\n\n```rust\n// GOOD - single-line with path variable\n.map_err(|e| format!(\"Failed to read {}: {}\", format_path_for_display(path), e))?\n\n// GOOD - using .context() for simple errors\nstd::fs::read_to_string(&path).context(\"Failed to read config\")?\n```\n\n**Multi-line external output** (git, hooks, LLM) needs gutter:\n\n1. Show the command that was run (with arguments)\n2. Put multi-line output in a gutter\n\n```\n✗ Commit generation command 'llm --model claude' failed\n  Error: [Errno 8] nodename nor servname provided\n\n// NOT: ✗ ... failed: LLM command failed: Error: [Errno 8]...\n```\n\nSee `src/git/error.rs` for examples of this pattern in `GitError` Display impls.\n\n## Verbose Output (`-v` and `-vv`)\n\n**`-v` (verbose):** User-facing diagnostic output. Must follow these guidelines.\nShows template expansions and other details users might need for debugging config.\n\nTemplate expansion shows the source template and the rendered result as two\nlabeled blocks. Each block is a bash gutter (dim + syntax highlighting via\n`format_bash_with_gutter`) under its own info header (`○` symbol, bold name,\nthen `source` or `result`):\n```\n○ name source\n  template\n○ name result\n  result\n```\n\nThe two headers carry the input/output distinction, so both blocks share the\nsame gutter and the content always starts at the gutter's column 2 (no marker\nglyph or extra indent inside the gutter). Multi-line templates and results\nfollow the same shape, one gutter line per source line.\n\n`expand_template` emits no trailing blank, so a standalone caller adds one to\nseparate the block from what follows (`wt step eval` does this after the view).\nIn a command pipeline the executor already separates the block from the next\noutput, so the expansion adds nothing.\n\n**`-vv` (debug):** Developer-facing logging output. MAY violate these guidelines.\nUses `log::debug!()` with structured format for deep debugging. Not intended for\nregular users.\n\n## Path Formatting\n\n**All user-facing paths must use `format_path_for_display()`** from\n`worktrunk::path`. This function replaces home directory prefixes with `~` for\nreadability (e.g., `/Users/alex/projects/repo` → `~/projects/repo`).\n\n**Use `@` (not \"at\") before paths in all user-facing output.** This is the\ncodebase convention for associating an entity with a location — in status\nmessages, section headings, hints, and everywhere else:\n\n```rust\n// GOOD - @ before path\n\"Created worktree for feature @ ~/code/repo.feature\"\n\"Squashed @ a1b2c3d\"\n\"Worktree for feature @ ~/repo.feature, but cannot change directory...\"\nformat_heading(\"USER HOOKS\", Some(&format!(\"@ {}\", format_path_for_display(p))))\n\n// BAD - \"at\" before path\n\"Created worktree for feature at ~/code/repo.feature\"\n// BAD - heading without @\nformat_heading(\"USER HOOKS\", Some(&format_path_for_display(p)))\n```\n\n**Exception:** Prose contexts (doc comments, help text) use \"at\" — `@` is for\nterse output only.\n\n```rust\nuse worktrunk::path::format_path_for_display;\n\n// GOOD - uses format_path_for_display\neprintln!(\"{}\", success_message(cformat!(\n    \"Created worktree @ {}\",\n    format_path_for_display(&worktree_path)\n)));\n\n// GOOD - error messages too\n.map_err(|e| format!(\"Failed to read {}: {}\", format_path_for_display(path), e))?\n\n// BAD - raw path.display()\neprintln!(\"{}\", success_message(format!(\n    \"Created worktree @ {}\",\n    worktree_path.display()  // Shows /Users/alex/... instead of ~/...\n)));\n```\n\n**Applies to:**\n- Success/info/warning/error messages\n- Section headings (`format_heading` with path suffix)\n- Hints suggesting paths\n- Progress messages\n- Dry-run previews\n\n**Exceptions:**\n- Debug logging (`log::debug!`) — full paths help debugging\n- Paths passed to git commands — must be real paths\n\n## Table Column Alignment\n\n- **Text columns** (Branch, Path, Message): left-aligned\n- **Single-value numeric columns** (Age): right-aligned, so `now` and `4m` line\n  up on the unit\n- **Diff columns** (@±, ^↕): two right-aligned halves either side of a\n  separator (`+999 -999`); a state for the whole field, such as a loading or\n  in-sync marker, is centered\n\nA header follows its content, except over a diff column, where it centres:\npushed to either edge it stands over one half and reads as that half's label,\nleaving a lone `+1` stranded left of `@±`.\n\nRows carry no trailing padding. Padding places a cell; past the last one it\nplaces nothing, and a reader who selects the row gets it anyway.\n\n## Snapshot Testing\n\nEvery command output must have snapshot tests (`tests/integration_tests/`).\nSee `tests/integration_tests/remove.rs` for the standard pattern using\n`setup_snapshot_settings()`, `make_snapshot_cmd()`, and `assert_cmd_snapshot!()`.\n\nCover success/error states, with/without data, and flag variations.\n","plugins/worktrunk/skills/wt-switch-create/SKILL.md":"---\nname: wt-switch-create\ndescription: Create a new worktrunk worktree (optionally in another repo) and switch this session's working directory into it. Use when launching a session that should work in its own worktree.\nargument-hint: \"[<branch>] [<repo>] [-- <task>]\"\nlicense: MIT OR Apache-2.0\ncompatibility: Requires the `wt` CLI (https://worktrunk.dev)\n---\n\nArguments: `$ARGUMENTS`. Grammar: `[<branch>] [<repo>] [-- <task>]`.\n\n- **branch** — optional; the branch name for the new worktree. When omitted,\n  pick one (step 1 below).\n- **repo** — optional path or name; create the worktree in this repo instead\n  of the session's current one.\n- **task** — optional; what to do inside the new worktree. No task means enter\n  the worktree and wait.\n\nTokens before the `--` are the branch and/or repo. A path-shaped token\n(starting with `/`, `~`, `./`, or `../`) is the repo. A bare name can be\neither, so make an informed guess. It is the branch when the current repo\nalready has a branch by that name, as it is for `wt switch` itself. Otherwise\nit is the repo when a git repository by that name exists where the user keeps\nrepos (beside the current repo, or in a workspace directory like\n`~/workspace`), and the branch when none does (`docs` is a branch, not the\ncurrent repo's `docs/` directory). A name read as the repo carries its absolute\npath forward: that path, not the bare token, is the `<repo>` in step 3. Two\ntokens that both read as branches don't fit the grammar — ask. Without a `--`,\njudge where the task starts: leading tokens that read as a branch name\n(`fix-auth`) or a repo are consumed as such, and the rest is the task;\notherwise the whole input is the task (`fix the parser bug` has no\nbranch-shaped lead — all task).\n\n```\n/wt-switch-create my-feature -- fix the parser bug\n/wt-switch-create -- fix the parser bug\n/wt-switch-create my-feature ~/workspace/other-repo -- fix the parser bug\n/wt-switch-create my-feature\n```\n\n## What to do\n\nCreating the worktree comes first on every invocation, before any other work.\nThe invocation is itself the explicit request to create it; a research or\nread-only task gets one all the same.\n\n<!-- Maintainers: rationale.md (same directory) covers the harness rules and\ndesign choices behind this — read it before re-adding guards or routes. -->\n\n1. **Pick a new branch name** if none was given: short, from the task and\n   consistent with existing worktree names, or, mid-session, from the work\n   being moved; with nothing to derive from, ask.\n\n2. **With no repo argument, create and enter in one call:**\n   `EnterWorktree({name: \"<branch>\"})`. Worktrunk's `WorktreeCreate` hook runs\n   `wt switch --create` for a new branch or `wt switch` for an existing one,\n   creating its checkout if needed. The result is an ordinary `wt` worktree,\n   and the user sees no confirmation prompt. On success, do the task (or,\n   with no task text, confirm it's ready and wait).\n\n   Mid-session, carry uncommitted work across: `git stash push -u` before the\n   `EnterWorktree` call, then `git stash pop` once the session is in the new\n   worktree, which is after step 3 if this call fails. Entering re-roots the\n   session into the new worktree, and the stash is shared across worktrees. If\n   step 3 hands back without the session in the new worktree, restore the work\n   where it came from first (`git -C <that worktree> stash pop`).\n\n3. **Otherwise create it with `wt` and enter by path.** Two cases reach here: a\n   repo argument, which step 2 can't target, and a failed step 2, whose error\n   says `Already in a worktree session`. Create with a `Bash` call (omit\n   `-C <repo>` for this repo):\n\n   ```\n   wt -C <repo> switch --create <branch> --no-cd --format=json\n   ```\n\n   Stdout is JSON whose `path` field is the worktree's absolute path (status\n   lines go to stderr). On `Branch <branch> already exists`: if the user named\n   the branch, rerun without `--create` (it enters the branch, creating its\n   worktree if missing); if step 1 picked the name, pick another and rerun. Any\n   other failure (not a git repo, invalid name): report it and stop.\n\n   Next, call `ExitWorktree({action: \"keep\"})`. This invocation is the user\n   asking to move the session, which includes leaving the worktree it is in,\n   so make the call even when you're unsure the session is in one. A session\n   in a worktree can enter only one under its repository's\n   `.claude/worktrees/`; leaving lifts that limit, keeps the old worktree and\n   its branch on disk, and returns the session to the directory it was in\n   before it entered. Where there is nothing to leave (no worktree session, or\n   an agent pinned to its own worktree), the call returns an error and changes\n   nothing; carry on. If the session did leave a worktree\n   and the entry below doesn't happen, say so when you hand back: name the\n   worktree it left, still on disk, and where the session is now.\n\n   With a repo argument, `cd <repo>` next, in its own `Bash` call:\n   `EnterWorktree` re-roots only within the repository the cwd is in, and\n   worktrunk's `PermissionRequest` hook answers the confirmation that call\n   asks for only for a `wt` worktree of that same repository. If that `cd`\n   reports `Shell cwd was reset`, the repo is unreachable: skip the entry and\n   hand back as in **Unreachable** below. With no repo argument, don't `cd`:\n   leaving put the session back in this repository, and a `cd` into the\n   worktree it left can reset.\n\n   Then call `EnterWorktree({path: \"<path from the JSON>\"})`.\n\n   With a repo argument, once the session works in the new worktree (entered,\n   or reached by `cd` in the recovery below), read whichever of its root\n   `CLAUDE.md` and `AGENTS.md` exist before the task. Claude Code keeps the\n   launch repo's root instructions in context and loads only the new repo's\n   nested ones, so the new repo's root files supersede the launch repo's for\n   the rest of the session.\n\n   - **Accepted** → the session is re-rooted in the worktree. Do the task (or,\n     with no task text, confirm it's ready and wait).\n   - **Tool error** — the tool ran and returned an error (`Cannot enter\n     worktree: …`) → graceful; nothing moved, and one recovery covers them\n     all. One cause is an agent pinned to its own worktree, which can\n     enter only under its repo's `.claude/worktrees/`, excluding even a\n     same-repo `wt` sibling. The recovery test is whether you can `cd` into\n     the worktree, which works when it's inside an allowed directory. So\n     `cd <path>` and read the result:\n     - no `Shell cwd was reset` notice → it stuck; the worktree is reachable.\n       Work there, but a bare `cd` is not a tracked re-root, so the cwd can\n       revert to the session's launch worktree across turns (and in spawned\n       subagents); pin commands with `git -C <path>` / `wt -C <path>` rather\n       than trusting the `cd` to persist.\n     - `Shell cwd was reset` → **Unreachable.** Stop and ask the user to make\n       the directory whose `cd` reset reachable: add a parent that holds both\n       the repo and its worktrees, like `~/workspace`, to\n       `permissions.additionalDirectories` (durable, every session), or run\n       `/add-dir` on it (this session). Then continue from that `cd`. Don't\n       grind through absolute paths with `cd` resetting on every command.\n   - **Denied** — the call itself was refused, with no tool error → however\n     the denial is worded, it is the user's answer to the confirmation Claude\n     Code shows for entering a worktree outside `.claude/worktrees/`, unless\n     there was no user to ask (the denial says the session couldn't prompt),\n     which decides nothing — take the recovery above. On the user's answer:\n     the worktree `wt` just created still exists; only the entry didn't\n     happen. `cd` back out of the repo you moved into, if any, then report\n     the worktree's path and ask how to proceed, since reaching it through\n     `cd` would override that answer.\n\n## Cleanup\n\nThe worktree is a normal worktrunk worktree: it shows up in `wt list` and is\nmerged or removed with `wt merge` / `wt remove <branch>` like any other. Don't\nremove it unprompted.\n\nA worktree entered by name in step 2 gets Claude Code's Keep / Remove prompt\nwhen the session ends, with Keep selected by default. Remove runs `wt remove`\nwith its normal safeguards. A worktree entered by path in step 3 stays, as\ndoes a worktree the session left with `action: \"keep\"`. If the user asks to\nleave mid-session, `ExitWorktree({action: \"keep\"})` returns the session to its\noriginal directory;\n`ExitWorktree` cannot remove a worktree entered by `path`, so removing one of\nthose is always `wt remove <branch>`.\n\n## Scope\n\nThe command's mandate is ONE worktree (in the named repo, if one was given)\nand the requested task inside it.\n",".claude/skills/release/SKILL.md":"---\nname: release\ndescription: Worktrunk release workflow. Use when user asks to \"do a release\", \"release a new version\", \"cut a release\", or wants to publish a new version to crates.io and GitHub.\nmetadata:\n  internal: true\n---\n\n# Release Workflow\n\n## Steps\n\n1. **Sync the release branch with `main`**: The release worktree's branch lags `main` between releases — it's only reset to `main` after a release lands. Cutting from a stale branch silently drops everything merged since. Fast-forward to the tip of `main` before anything else:\n   ```bash\n   git fetch origin\n   git merge --ff-only origin/main\n   ```\n   `--ff-only` advances the branch when it's a strict ancestor of `origin/main` and **fails** (rather than creating a merge commit or discarding work) if it has diverged — reconcile manually before continuing. This is the release-branch equivalent of `wt up`, spelled out because the `up` alias rebases each branch onto its own upstream (`origin/release`), not `main`. Note the resulting commit SHA: this is the tip the changelog covers, and step 12 checks the changelog against everything that reaches `main` before the tag.\n2. **Run tests**: Two gates — the local suite and the full cross-platform suite.\n   - Local: `cargo run -- hook pre-merge --yes`.\n   - Cross-platform: dispatch the `nightly` workflow on the cut-from tip and wait for it to go green. This is where a release gets its full linux/macos/windows validation: the PR path (`ci.yaml`) is moving to cargo-affected selection and will stop running the full `test` matrix, while `nightly` hosts `full-tests` (the full 3-OS suite) alongside feature-powerset, release-target, nix-flake, and minimal-versions. Benchmarks aren't part of `nightly` — they run in their own `benchmarks.yaml` and gate nothing.\n     ```bash\n     gh workflow run nightly.yaml --ref main\n     # Registration lags the dispatch, and a prior release may have left a\n     # stale completed workflow_dispatch run — filter to the in-flight one.\n     sleep 5\n     RUN=$(gh run list --workflow=nightly.yaml --event=workflow_dispatch --branch=main --limit 5 --json databaseId,status --jq 'map(select(.status != \"completed\")) | .[0].databaseId')\n     ```\n     Launch a ci-reporter to monitor `$RUN` to completion (avoid `gh run watch` — it can hang). Fix any failure before continuing.\n3. **Check current version**: Read `version` in `Cargo.toml`\n4. **Review commits**: Check commits since last release to understand scope of changes. Audit the cumulative diff for the data-loss surface (see [Data-Loss Surface Review](#data-loss-surface-review)) and documentation (see [Documentation Review](#documentation-review)).\n5. **Check library API compatibility (advisory)**: Run `cargo semver-checks check-release -p worktrunk` (install with `cargo install cargo-semver-checks --locked` if missing) as a bump-level input, not a compat gate — worktrunk ships breaking library changes freely. If it reports breaking changes, that's fine; under semver the bump must still be minor (pre-1.0) or major (post-1.0). See \"Library API Compatibility\" below.\n6. **Credit contributors**: Check for external PR authors and issue reporters (see \"Credit External Contributors\" and \"Credit Issue Reporters\" below)\n7. **Determine release type**: Pick the bump from the changes (including semver-checks result). Ask the user only if the choice is genuinely ambiguous (see below).\n8. **Bump version** (must run on a clean tree — before editing CHANGELOG):\n   ```bash\n   cargo release X.Y.Z -p worktrunk -x --no-publish --no-push --no-tag --no-verify --no-confirm && cargo check\n   ```\n   This bumps `Cargo.toml` and `Cargo.lock`, then auto-commits. We'll reset this commit in step 10 to fold in the CHANGELOG.\n9. **Update CHANGELOG**: the top section holds this release's changes (see MANDATORY verification below). If it is `## Unreleased`, rename that heading to `## X.Y.Z` and fold the remaining entries into it — inserting a new heading above it ships a stale `## Unreleased` in the release notes. Otherwise the top section is the last shipped version: add a `## X.Y.Z` section above it, never append to it.\n10. **Commit**: Reset the auto-commit from step 8, stage everything, and create the final release commit:\n    ```bash\n    git reset --soft HEAD~1 && git add -A && git commit -m \"Release vX.Y.Z\"\n    ```\n11. **Merge to main**: complete the documentation review on the final candidate, then push the release branch, open a PR, wait for CI, and merge it. Keep the worktree — the remaining steps run from it. Then move the branch onto the merged tip:\n    ```bash\n    git fetch origin && git reset --keep origin/main\n    ```\n    The PR squash-merges, so the branch is no longer an ancestor of `main` and step 1's `--ff-only` can't advance it; `--keep` moves it across and still fails if anything is uncommitted. `main` can advance during the CI wait; step 12 catches anything that lands before the tag.\n12. **Verify the changelog covers `main`, then tag and push**: the tag decides what ships — `release.yaml` builds the binaries and the GitHub release notes from the tree at the tag, so everything reachable from it is in the release. The merge squashes onto whatever `main` tip exists at merge time, so a commit that lands during the PR's CI wait is already an ancestor of the release commit and ships whether or not the changelog mentions it (the easy miss is a follow-up that reworks a feature this release already documents). List what reached `main` since the cut-from tip (step 1):\n    ```bash\n    git fetch origin\n    git log --oneline <cut-from-commit>..origin/main\n    ```\n    Clean means the changelog at `origin/main` documents every user-facing commit listed. With no drift the list is one line, the `Release vX.Y.Z (#NNNN)` squash commit. Review anything else that drifted in during the window and fold what's user-facing into the changelog with a follow-up squash PR, then re-fetch and re-run. The list only grows across passes — the drifted commits stay, joined by the follow-up's own squash commit — so each pass re-checks coverage over a longer list.\n\n    Extend the documentation review to any changes since its reviewed SHA, including corrections and commits that arrived during CI. Record the final reviewed SHA and resolve findings before tagging.\n\n    Once clean, tag `origin/main`. The check and the tag then name the same ref, and it's main's tip, so the tag is reachable from `main`:\n    ```bash\n    git tag vX.Y.Z origin/main && git push origin vX.Y.Z\n    ```\n13. **Wait for the release workflow**: The tag push triggers `release.yaml`. Launch a ci-reporter agent to monitor the run through to completion (avoid `gh run watch` — it can hang); the run ID comes from:\n    ```bash\n    gh run list --workflow=release.yaml --event=push --branch=vX.Y.Z --limit 1 --json databaseId --jq '.[0].databaseId'\n    ```\n    If the run fails, re-run its failed jobs when the cause is transient. Otherwise land the fix on `main` and release it as the next patch version, leaving the vX.Y.Z tag in place. Installers such as aqua check that the signing certificate names `release.yaml@refs/tags/<version>`, so each version's release has to come from the run its own tag push started.\n\n`release.yaml` builds binaries and publishes to crates.io, Homebrew, winget, AUR, and PyPI (experimental) automatically.\n\n## Data-Loss Surface Review\n\nWorktrunk's worst failure is silently destroying a user's work. The per-PR review (`running-tend`, \"Data-Loss Surface\") is the first gate; the release is the second, where the whole diff since the last release is visible at once.\n\nThis review optimizes for recall: find every change that could touch the deletion surface, accept false positives, then adjudicate each candidate. Missing one real loss path costs far more than reviewing a false alarm.\n\nA keyword grep alone is insufficient. It finds only what someone thought to pattern-match, and an agent handed the grep anchors on it and inherits its blind spots. So fan out independent finders, most of them without the grep, and analyze every candidate they surface.\n\n### Find: independent finders, recall over precision\n\nLaunch 3-5 finder subagents in parallel over the cumulative diff (`git log v<last-version>..HEAD -p`) and the code it touches, including anything that calls into or is called by the changed code. Each works independently: do not let them share findings during this phase, and do not collapse them onto one method. Each returns candidate locations with a one-line reason, erring toward over-reporting.\n\nGive each a distinct charter. At least two receive no grep and no keyword list, so they reason from the code instead of pattern-matching:\n\n- **Behavioral (no grep):** read each change and ask what it could destroy: files, branches, worktrees, uncommitted or untracked work, committed-but-unpushed commits. Flag any change whose worst case is lost user data.\n- **Blast-radius (no grep):** for every function and file the diff touches, trace callers and callees. Flag any path that can now reach a destructive primitive (branch deletion, worktree removal, filesystem removal, history rewrite), even when that call sits outside the diff.\n- **Automation diff (no grep):** compare shipped automation before and after: `plugins/*/hooks/hooks.json`, `plugins/*/hooks.json`, `plugins/*/hooks/wt.sh`, and skill or alias examples users copy. Flag any new or altered invocation that removes or force-overwrites anything.\n- **Keyword scan (grep):** one finder runs the pattern filter over the full diff as a cross-check, never as the primary method. It takes no pathspec; a path allowlist would recreate the blind spots the no-grep finders exist to avoid (the densest destructive code, the tree walk in `src/remove_dir.rs`, sits outside `src/git/`).\n  ```bash\n  git log v<last-version>..HEAD -p \\\n    | grep -nE -- '--force-delete|--force| -D| -f |branch -[dD]|worktree remove|reset --hard|checkout -f|clean -[fdx]|remove_dir_all|remove_file|unlinkat|rm -rf'\n  ```\n\n### Analyze: adjudicate each candidate\n\nPool the candidates, dedupe, and analyze each against the data-safety invariants in `AGENTS.md` and the FAQ \"What can Worktrunk delete?\" inventory: does it preserve data on failure, require explicit consent for destructive ops, and avoid silent side-effect deletion? Mark each real risk / acceptable / needs change, with the reasoning.\n\nSurface the full adjudicated list and get explicit sign-off before tagging. Do not tag a release with an unresolved deletion-surface candidate, even if it looks acceptable.\n\n## Documentation Review\n\nThe release reviews all documentation changes since the previous release, including changes already on `main` and edits made during release preparation. Public docs are curated product guidance: each passage should help readers understand or use Worktrunk, with detail proportional to how many readers need it.\n\nStart from the full release diff to inventory documentation wherever it lives:\n\n```bash\ngit diff --name-status v<last-version> HEAD\ngit diff v<last-version> HEAD\n```\n\nGive an independent reviewer the previous tag, candidate SHA, and complete inventory. Cover site pages, README files, CLI help, configuration and command examples, shipped skills, and release notes. Review canonical sources once and check their generated copies for agreement; `docs/AGENTS.md` defines ownership and sync.\n\nThe reviewer reads every changed passage in its surrounding section and checks:\n\n- **Purpose and proportion:** does it change what readers understand or do? Cut redundant explanations and implementation or regression details that belong in tests or PRs. A correctness fix needs prose only when usage changes or an existing claim becomes false.\n- **Clarity and concision:** use concrete, consistent terminology; introduce concepts before relying on them; rewrite definitions in place rather than layering caveats. Shortening must preserve necessary instructions and qualifications.\n- **Accuracy and usability:** verify claims against behavior and examples against their commands. Check links and read affected rendered sections as a reader encounters them.\n\nFor each finding, give the location, reader impact, and a concrete replacement or deletion. Apply corrections in the canonical source, regenerate mirrors, and run the checks in `docs/AGENTS.md`. Have the reviewer check the corrected passages before closing findings. Record the reviewed range and SHA, coverage, findings, and their disposition in the release review; unresolved findings block tagging. Changelog claims and credits also receive the verification below.\n\n## CHANGELOG Review\n\nDraft entries from the commits since the last release:\n\n```bash\ngit log v<last-version>..HEAD --oneline\n```\n\n**IMPORTANT: Don't trust commit messages.** Commit messages often undersell or misdescribe changes. For any commit that might be user-facing:\n\n1. Run `git show <commit> --stat` to see what files changed\n2. If it touches user-facing code (commands, CLI, output), read the actual diff\n3. Look for changes bundled together — a \"rename flag\" commit might also add new features\n\nCommon patterns where commit messages mislead:\n- \"Refactor X\" commits that also change behavior\n- \"Rename flag\" commits that add new functionality\n- \"Fix Y\" commits that also improve error messages or add hints\n- CI/test commits that include production code fixes\n\nNotable changes to document:\n- New features or commands\n- User-visible behavior changes\n- Bug fixes users might encounter\n\n**Section order:** Improved, Fixed, Documentation, Internal. Documentation is for help text, web docs, and terminology improvements. Internal is for selected notable internal changes (not everything).\n\n**Within each section, order by reader interest.** The section is the first ordering dimension and is fixed; reader interest is the second, and it decides rank inside a section. A change's class does not: a behavior change nobody asked for ranks below a feature people requested, and a fix every user hits ranks above a platform-specific one. Interest combines how many readers a change reaches with how much it obliges each of them to act, and never counts the effort the change took to build — effort and interest diverge most on the change just finished, which is the one being written up. So a breaking change stays near the top of its section: it reaches few readers, but every one of them has to do something about it.\n\n**Breaking changes:** Note inline with the entry, not as a separate section:\n\n```markdown\n- **Feature name**: Description. (Breaking: old behavior no longer supported)\n```\n\nSkip: internal refactors, test additions (unless user-facing like shell completion tests).\n\n### Length and tone\n\n**Combine related bullets.** Several PRs that share a theme — e.g. three perf changes that together account for one user-visible speedup — belong in one bullet, not three. The reader cares about the net change, not the PR boundaries. Cite all the PRs in the trailing `([#a](...), [#b](...), [#c](...))` list.\n\n**Be brief — the ceiling is words, not sentences.** A bullet aims at 35 words; a dense one runs to 60, and the two or three headline entries may reach 80; Internal-section bullets get one sentence. Drop the \"why we did it this way\" details unless they change how the user thinks about the change, and leave code examples and `Cmd::stream` / `OnceCell` / `DashMap`-style internals in the PR description, where the reasoning belongs.\n\nSentences stretch to fit whatever you want to say; words don't. So measure rather than judge:\n\n```bash\nawk '/^## /{if (f) exit; f=1} f' CHANGELOG.md \\\n  | awk '/^- \\*\\*/ {n=split($0,_,\" \"); t+=n; c++; if (n>60) o++; printf \"%4d  %.58s\\n\", n, $0} END {printf \"\\n%d entries, %d avg, %d over 60\\n\", c, c?t/c:0, o}'\n```\n\n**Calibrate against the ceiling, not against the last release.** Length ratchets: each release is drafted beside the previous section, and an abstract rule loses to a concrete neighbouring exemplar every time. Entries grew from 49 to 101 words on average across five releases while this skill said \"be brief\" throughout. Read the previous section for what it drifted to, then ignore it and write to the ceiling.\n\n**Entries describe.** An entry records what the old behavior was and what it is now. Give imperative guidance only for a material issue that affects a sizable share of users, which is rare; otherwise remediation belongs in the PR description.\n\n**No editorial framing.** Describe what changed, not what was wrong with the previous decision in subjective terms. Avoid words like \"sledgehammer\", \"ugly\", \"noisy\", \"wrong\" applied to past code. State the prior behavior neutrally and the new behavior plainly.\n\n**Good:** \"Removed `.pi/` from the default excludes list; users who need it can add it via `[step.copy-ignored]`.\"\n**Bad:** \"Removed `.pi/` — a sledgehammer fix from an unrelated debugging session that has no place as a project-agnostic default.\"\n\n**Match a fix's prominence to its reach.** Readers skim the bold headlines, so the headline, and whether the fix has a bullet of its own, tell them how big it was before they read any body text. A correctness or data-loss fix usually needed narrow conditions — a non-default git config, a command run from a particular place, a change of a particular shape. Put them in the headline and the consequence in the body: a headline that states the consequence tells every reader it could have been them, and conditions arriving after it don't undo that. Join the conditions with \"and\": \"X set *and* run from Y\" is a corner case, while \"X or Y\" reads as two common triggers. Establish each one by reproducing against the previous release's binary rather than reading it off the diff — a condition assumed is a condition the entry overstates, and overstating a data-loss bug is its own kind of inaccuracy.\n\n**Good:** \"**Submodules with an `ignore` setting**: when `submodule.<name>.ignore` hid uncommitted changes inside a submodule, `wt remove` read the worktree as clean and removed it with them.\"\n**Bad:** \"**`wt remove` no longer deletes submodule changes hidden by config**: with `submodule.<name>.ignore` set *and* uncommitted changes inside a submodule, …\" — every condition is there, but the headline has already announced a data-loss bug to every reader.\n\nA fix of near-zero reader interest (see the ordering rule above) — a name starting with `-`, a non-UTF-8 path, one platform with an unusual environment — gets no bullet of its own. Fold these into a closing bullet such as \"Fixes for unusual setups\" that names each case in a clause. A section of separate bold fixes reads as that many ways the tool broke, whatever their bodies say.\n\n### Credit External Contributors\n\nFor any changelog entry where an external contributor (not the repo owner) authored the commit, add credit with their GitHub username:\n\n```markdown\n- **Feature name**: Description. ([#123](https://github.com/user/repo/pull/123), thanks @contributor)\n```\n\nFind external contributors:\n```bash\ngit log v<last-version>..HEAD --format=\"%an <%ae>\" | sort -u\n```\n\nThen for each external contributor's commit, find their GitHub username from the commit (usually in the email or PR).\n\n### Credit Issue Reporters\n\nWhen a fix or feature addresses a user-reported issue *in this repo*, thank the reporter — not just the PR author. Users who take time to report bugs, request features, or provide reproduction steps deserve recognition. (Don't credit reporters from upstream/external repos — only issues filed here.)\n\n```markdown\n- **Feature name**: Description. ([#456](https://github.com/user/repo/pull/456), thanks @reporter for reporting)\n```\n\nFor fixes that reference issues:\n\n```markdown\n- **Bug fix**: Description. Fixes [#123](https://github.com/user/repo/issues/123). (thanks @reporter)\n```\n\n**Finding reporters — do ALL three steps:**\n\nIssues may have been filed months before the fix. Bug reports also appear as PR comments, not just issues. These steps are complementary; each catches things the others miss.\n\n1. **Extract every issue/PR reference from every commit** (PRIMARY):\n   ```bash\n   git log v<last-version>..HEAD --format=\"%B\" | grep -oE '#[0-9]+' | sort -t'#' -k2 -n -u\n   ```\n   For **each** referenced number: run `gh issue view N --json title,author,state`. This catches issues filed months ago — the most commonly missed credits.\n\n2. **Check PR comments for bug reports** (catches reports that never became issues):\n   For feature PRs referenced in commits, check comment threads for users reporting problems:\n   ```bash\n   gh pr view NNN --json comments --jq '.comments[] | \"\\(.author.login): \\(.body[:150])\"'\n   ```\n\n3. **Survey every issue opened or closed since last release** (catches unreferenced matches):\n   ```bash\n   git log -1 --format=%cs v<last-version>\n   gh issue list --state all --search \"created:>=<date>\" --json number,title,author --limit 100\n   gh issue list --state closed --search \"closed:>=<date>\" --json number,title,author --limit 100\n   ```\n   Cross-reference every title against changes in this release.\n\n**When to credit:**\n- Bug reports with clear reproduction steps (in issues OR PR comments)\n- Feature requests that shaped the implementation\n- Performance reports with measurements (like \"takes 15s\")\n- Users who helped diagnose issues through discussion\n\nSkip credit for: issues opened by the repo owner, trivial reports, or issues that were substantially different from what was implemented.\n\n### Link Significant Features to Docs\n\nFor major features with dedicated documentation, include a docs link. Use full URLs so links work from GitHub releases:\n\n```markdown\n- **Hook system**: Shell commands that run at key points in worktree lifecycle. [Docs](https://worktrunk.dev/hook/) ([#234](https://github.com/user/repo/pull/234), thanks @contributor for the suggestion)\n```\n\nLink when there's substantial documentation the user would benefit from reading — new commands, feature pages, or Tips & Patterns sections. Skip for minor improvements.\n\n### MANDATORY: Verify Each Changelog Entry\n\n**After drafting changelog entries, you MUST spawn a subagent to verify each bullet point is accurate.** The tag publishes this text as the GitHub release body, so a correction afterwards takes a follow-up PR to `CHANGELOG.md` and a hand-edit of the release page, and people have read the wrong line by then. This pass is worth as much time as it takes.\n\n**The gate cuts both ways.** Checking only accuracy pushes every entry longer: \"understates\" and \"not covered\" have no counterweight, so each pass adds and none subtracts. That asymmetry is what drove the ratchet above. An entry that is too long, too internal, or ranked above one more readers will notice is reported on the same footing as one that is wrong.\n\n**Subagent prompt template:**\n\n```\nVerify these changelog entries for version X.Y.Z are accurate. They publish with\nthe tag, and by the time anyone corrects a wrong line, readers have acted on it.\nSpend the time to read a source for each one: reading the entry and finding it\nplausible is not a check, because the entry was written from the same commits you\nare about to read.\n\nPrevious version: [e.g., v0.1.9]\nCommits to check: git log v<previous>..HEAD\n\nEntries to verify: the top section of CHANGELOG.md as it stands on disk. Read it\nthere rather than from a paste:\nawk '/^## /{if (f) exit; f=1} f' CHANGELOG.md\n\nVerify claim by claim, not entry by entry: an entry carries several independent\nclaims, and one verdict over the whole entry waves through every claim that is not\nits headline.\n\n1. Find the relevant commit(s) using git log and git show\n2. Read the diff, not the commit message. The diff settles what changed, and\n   nothing else: not what the behavior was before, not what the user sees, not\n   what a file it doesn't touch does. Settle a \"previously\" / \"no longer\" / \"so X\n   broke\" claim by reading the old file (`git show <sha>^:<path>`) and confirming\n   the old behavior there. The new code's handling of the old case is not that\n   confirmation: a case added together with a comment about why it produces\n   nothing reads in a diff exactly like a case that used to produce something.\n   Some claims have no source in the commit at all — a version floor, what a\n   rendered page shows, how another component behaves. Read that source: the\n   rendered output, the other component's own file, the upstream project's own\n   releases\n3. Flag any claim its source does not support, whether it overstates,\n   understates, or misdescribes\n4. Flag if the entry runs over 60 words (80 for one of the two or three headline\n   entries), restates the PR description, or explains mechanism the reader cannot\n   act on — report these as seriously as an inaccuracy, and quote a shorter\n   rewrite that keeps every user-facing claim\n\nAlso check:\n- Are there user-facing changes NOT covered by these entries?\n- Verify each \"thanks @...\" attribution (right person, right role — author vs reporter)\n- Within each section, is any entry ranked above one that more readers will notice?\n- Read each headline alone, as a skimming reader does. Flag one that states the\n  consequence (what was lost or broken) rather than the situation it needed, and a\n  fix almost no reader will notice that has its own bullet rather than a clause in\n  a closing roll-up.\n\nReport format:\n- Entry: [entry text]\n  Status: ✅ Accurate / ⚠️ Needs revision / ❌ Incorrect\n  Length: [word count] — ✅ / ⚠️ over ceiling\n  Evidence: [for each claim, the source you read and what it said]\n  Suggested fix: [if needed]\n```\n\n**The pass ends on a clean run, not on the first run's findings.** A rewrite the verifier suggests has no more evidence behind it than one you wrote yourself, and an entry you edit while the pass runs is in the same state — both leave that entry unverified. Re-run over the section as it now stands, and finalize only once a run comes back clean.\n\n`evals/README.md` beside this skill holds four entries from a shipped release, three of them wrong, for scoring a change to this template against what the last wording missed, and a drafting case for the prominence rule.\n\n**If verification finds problems:** Escalate to the user. Show them the subagent's findings and ask how to proceed. Don't attempt to resolve ambiguous changelog entries autonomously — the user knows the intent behind their changes better than you do.\n\n## Determine Release Type\n\nPick the bump from the changes. Skip the question when only one level is plausible; ask only when the choice is genuinely ambiguous.\n\n**Proceed without asking when the answer is obvious:**\n\n- `cargo semver-checks` reports breaking changes → minor (pre-1.0; patch is disallowed, major has no basis pre-1.0 in a maturing project). Inform the user and continue: \"Bumping minor — semver-checks reported N breaking changes; patch is disallowed pre-1.0.\"\n- Only bug fixes and internal commits since the last release, no new features, no semver breakage → patch. Inform the user with the same shape.\n\n**Ask only when genuinely ambiguous** — e.g., new features landed with no semver breakage (patch vs. minor is a judgment call), or a borderline case where the user's read of the changes may differ. Use `AskUserQuestion` with the actual choice (patch vs. minor); don't add novelty options like skipping a version number.\n\nWhen asking, present:\n1. Current version (e.g., `0.2.0`)\n2. Brief summary of changes (new features, bug fixes, breaking changes)\n3. Your recommendation with reasoning\n\nExample:\n\n```\nCurrent version: 0.2.0\nChanges since v0.2.0:\n- Added `state clear` command (new feature)\n- Added `previous-branch` state key (new feature)\n- No breaking changes\n\nRecommendation: Minor release (0.3.0) — new features, no breaking changes\n```\n\n## Version Guidelines\n\n- **Second digit** (0.1.0 → 0.2.0): Backward incompatible changes\n- **Third digit** (0.1.0 → 0.1.1): Everything else\n\nCurrent project status: maturing mode (see [AGENTS.md › Project Status](../../../AGENTS.md)). External interfaces — the config file format (`wt.toml`, user config) and CLI flags/arguments — carry compatibility weight, so breaks there need justification (a real improvement, not cleanup) and prefer deprecation warnings over silent breaks. Everything else, including the internal and library APIs, stays flexible: worktrunk ships breaking library changes freely and bumps the version each time, putting no weight on the existing internal APIs.\n\n## Library API Compatibility\n\nWorktrunk is a CLI tool. The `[lib]` crate in `Cargo.toml` does expose a public API, but it is **not a compatibility surface** — per [AGENTS.md › Project Status](../../../AGENTS.md) there are no Rust library compatibility concerns, and the project ships breaking library changes freely, bumping the version each time (see the \"Breaking library API\" entries in `CHANGELOG.md`). Downstream crates are expected to pin.\n\n`cargo-semver-checks` is therefore an **advisory bump-level input**, not a gate that commits us to keeping the API stable for downstream crates. It compares the current public API against the last version published to crates.io and reports semver-relevant changes — a useful signal for choosing the bump:\n\n```bash\ncargo semver-checks check-release -p worktrunk\n```\n\nInterpreting results:\n\n- **No issues reported**: no library-level signal for the bump. Choose based on CLI changes and new features.\n- **Breaking changes reported**: expected and acceptable — breaking the library API is not something to avoid here. But under semver a breaking change still warrants at minimum a minor bump while pre-1.0 (e.g., 0.37.0 → 0.38.0) rather than a patch. Bump accordingly; this is version mechanics, not a signal to preserve the old API.\n- **Tool fails to run** (e.g., missing baseline): likely the crate hasn't been published yet or the registry cache is stale. Try `cargo semver-checks check-release -p worktrunk --baseline-version <last-published>`.\n\nThis check validates the chosen bump — it doesn't distinguish patch vs. minor when no breakage exists. Continue using the commit review to decide between patch (fixes only) and minor (new features).\n","tests/CLAUDE.md":"# tests - Claude Agent Guidelines & System Prompt\n\nPath: `tests/CLAUDE.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/tests/CLAUDE.md)",".agents/plugins/marketplace.json":"# Claude Plugin Marketplace Catalog\n\nPath: `.agents/plugins/marketplace.json`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/.agents/plugins/marketplace.json)","plugins/worktrunk/CLAUDE.md":"# Worktrunk Skill\n\nPath: `plugins/worktrunk/CLAUDE.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/CLAUDE.md)","plugins/worktrunk/README.md":"# worktrunk Documentation\n\nPath: `plugins/worktrunk/README.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/README.md)","skills/wt-switch-create/rationale.md":"# Wt-switch-create Skill\n\nPath: `skills/wt-switch-create/rationale.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/wt-switch-create/rationale.md)","src/commands/CLAUDE.md":"# Command: /claude\n\nPath: `src/commands/CLAUDE.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/src/commands/CLAUDE.md)","plugins/worktrunk/.codex-plugin/plugin.json":"# codex-plugin Plugin Manifest\n\nPath: `plugins/worktrunk/.codex-plugin/plugin.json`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/.codex-plugin/plugin.json)","plugins/worktrunk/.claude-plugin/plugin.json":"# claude-plugin Plugin Manifest\n\nPath: `plugins/worktrunk/.claude-plugin/plugin.json`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/.claude-plugin/plugin.json)","plugins/worktrunk/hooks/hooks.json":"# Hooks Skill\n\nPath: `plugins/worktrunk/hooks/hooks.json`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/hooks/hooks.json)","skills/worktrunk/reference/claude-code.md":"# Reference Skill\n\nPath: `skills/worktrunk/reference/claude-code.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/claude-code.md)","skills/worktrunk/reference/code-signing.md":"# Reference Skill\n\nPath: `skills/worktrunk/reference/code-signing.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/code-signing.md)","skills/worktrunk/reference/config.md":"# Reference Skill\n\nPath: `skills/worktrunk/reference/config.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/config.md)","skills/worktrunk/reference/extending.md":"# Reference Skill\n\nPath: `skills/worktrunk/reference/extending.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/extending.md)","skills/worktrunk/reference/faq.md":"# Reference Skill\n\nPath: `skills/worktrunk/reference/faq.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/faq.md)","skills/worktrunk/reference/hook.md":"# Reference Skill\n\nPath: `skills/worktrunk/reference/hook.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/hook.md)","skills/worktrunk/reference/list.md":"# Reference Skill\n\nPath: `skills/worktrunk/reference/list.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/list.md)","skills/worktrunk/reference/llm-commits.md":"# Reference Skill\n\nPath: `skills/worktrunk/reference/llm-commits.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/llm-commits.md)","skills/worktrunk/reference/merge.md":"# Reference Skill\n\nPath: `skills/worktrunk/reference/merge.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/merge.md)","skills/worktrunk/reference/remove.md":"# Reference Skill\n\nPath: `skills/worktrunk/reference/remove.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/remove.md)","skills/worktrunk/reference/shell-integration.md":"# Reference Skill\n\nPath: `skills/worktrunk/reference/shell-integration.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/shell-integration.md)","skills/worktrunk/reference/step.md":"# Reference Skill\n\nPath: `skills/worktrunk/reference/step.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/step.md)","skills/worktrunk/reference/switch.md":"# Reference Skill\n\nPath: `skills/worktrunk/reference/switch.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/switch.md)","skills/worktrunk/reference/tips-patterns.md":"# Reference Skill\n\nPath: `skills/worktrunk/reference/tips-patterns.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/tips-patterns.md)","skills/worktrunk/reference/troubleshooting.md":"# Reference Skill\n\nPath: `skills/worktrunk/reference/troubleshooting.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/troubleshooting.md)","skills/worktrunk/reference/worktrunk.md":"# Reference Skill\n\nPath: `skills/worktrunk/reference/worktrunk.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/worktrunk.md)","src/commands/list/CLAUDE.md":"# Command: /claude\n\nPath: `src/commands/list/CLAUDE.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/src/commands/list/CLAUDE.md)",".claude/skills/running-tend/references/nightly-cleaner.md":"# References Skill\n\nPath: `.claude/skills/running-tend/references/nightly-cleaner.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/.claude/skills/running-tend/references/nightly-cleaner.md)",".claude/skills/running-tend/references/review-pr.md":"# References Skill\n\nPath: `.claude/skills/running-tend/references/review-pr.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/.claude/skills/running-tend/references/review-pr.md)","plugins/worktrunk/skills/wt-switch-create/rationale.md":"# Wt-switch-create Skill\n\nPath: `plugins/worktrunk/skills/wt-switch-create/rationale.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/wt-switch-create/rationale.md)","plugins/worktrunk/skills/worktrunk/reference/claude-code.md":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/claude-code.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/claude-code.md)","plugins/worktrunk/skills/worktrunk/reference/code-signing.md":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/code-signing.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/code-signing.md)","plugins/worktrunk/skills/worktrunk/reference/config.md":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/config.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/config.md)","plugins/worktrunk/skills/worktrunk/reference/extending.md":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/extending.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/extending.md)","plugins/worktrunk/skills/worktrunk/reference/faq.md":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/faq.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/faq.md)","plugins/worktrunk/skills/worktrunk/reference/hook.md":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/hook.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/hook.md)","plugins/worktrunk/skills/worktrunk/reference/list.md":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/list.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/list.md)","plugins/worktrunk/skills/worktrunk/reference/llm-commits.md":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/llm-commits.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/llm-commits.md)","plugins/worktrunk/skills/worktrunk/reference/merge.md":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/merge.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/merge.md)","plugins/worktrunk/skills/worktrunk/reference/README.md":"# reference Documentation\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/README.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/README.md)","plugins/worktrunk/skills/worktrunk/reference/remove.md":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/remove.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/remove.md)","plugins/worktrunk/skills/worktrunk/reference/shell-integration.md":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/shell-integration.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/shell-integration.md)","plugins/worktrunk/skills/worktrunk/reference/step.md":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/step.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/step.md)","plugins/worktrunk/skills/worktrunk/reference/switch.md":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/switch.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/switch.md)","plugins/worktrunk/skills/worktrunk/reference/tips-patterns.md":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/tips-patterns.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/tips-patterns.md)","plugins/worktrunk/skills/worktrunk/reference/troubleshooting.md":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/troubleshooting.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/troubleshooting.md)","plugins/worktrunk/skills/worktrunk/reference/worktrunk.md":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/worktrunk.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/worktrunk.md)"},"items":[{"name":"SKILL.md","path":".claude/skills/release/SKILL.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/.claude/skills/release/SKILL.md","title":"release","category":"anthropic-skill","format":"markdown","content":"---\nname: release\ndescription: Worktrunk release workflow. Use when user asks to \"do a release\", \"release a new version\", \"cut a release\", or wants to publish a new version to crates.io and GitHub.\nmetadata:\n  internal: true\n---\n\n# Release Workflow\n\n## Steps\n\n1. **Sync the release branch with `main`**: The release worktree's branch lags `main` between releases — it's only reset to `main` after a release lands. Cutting from a stale branch silently drops everything merged since. Fast-forward to the tip of `main` before anything else:\n   ```bash\n   git fetch origin\n   git merge --ff-only origin/main\n   ```\n   `--ff-only` advances the branch when it's a strict ancestor of `origin/main` and **fails** (rather than creating a merge commit or discarding work) if it has diverged — reconcile manually before continuing. This is the release-branch equivalent of `wt up`, spelled out because the `up` alias rebases each branch onto its own upstream (`origin/release`), not `main`. Note the resulting commit SHA: this is the tip the changelog covers, and step 12 checks the changelog against everything that reaches `main` before the tag.\n2. **Run tests**: Two gates — the local suite and the full cross-platform suite.\n   - Local: `cargo run -- hook pre-merge --yes`.\n   - Cross-platform: dispatch the `nightly` workflow on the cut-from tip and wait for it to go green. This is where a release gets its full linux/macos/windows validation: the PR path (`ci.yaml`) is moving to cargo-affected selection and will stop running the full `test` matrix, while `nightly` hosts `full-tests` (the full 3-OS suite) alongside feature-powerset, release-target, nix-flake, and minimal-versions. Benchmarks aren't part of `nightly` — they run in their own `benchmarks.yaml` and gate nothing.\n     ```bash\n     gh workflow run nightly.yaml --ref main\n     # Registration lags the dispatch, and a prior release may have left a\n     # stale completed workflow_dispatch run — filter to the in-flight one.\n     sleep 5\n     RUN=$(gh run list --workflow=nightly.yaml --event=workflow_dispatch --branch=main --limit 5 --json databaseId,status --jq 'map(select(.status != \"completed\")) | .[0].databaseId')\n     ```\n     Launch a ci-reporter to monitor `$RUN` to completion (avoid `gh run watch` — it can hang). Fix any failure before continuing.\n3. **Check current version**: Read `version` in `Cargo.toml`\n4. **Review commits**: Check commits since last release to understand scope of changes. Audit the cumulative diff for the data-loss surface (see [Data-Loss Surface Review](#data-loss-surface-review)) and documentation (see [Documentation Review](#documentation-review)).\n5. **Check library API compatibility (advisory)**: Run `cargo semver-checks check-release -p worktrunk` (install with `cargo install cargo-semver-checks --locked` if missing) as a bump-level input, not a compat gate — worktrunk ships breaking library changes freely. If it reports breaking changes, that's fine; under semver the bump must still be minor (pre-1.0) or major (post-1.0). See \"Library API Compatibility\" below.\n6. **Credit contributors**: Check for external PR authors and issue reporters (see \"Credit External Contributors\" and \"Credit Issue Reporters\" below)\n7. **Determine release type**: Pick the bump from the changes (including semver-checks result). Ask the user only if the choice is genuinely ambiguous (see below).\n8. **Bump version** (must run on a clean tree — before editing CHANGELOG):\n   ```bash\n   cargo release X.Y.Z -p worktrunk -x --no-publish --no-push --no-tag --no-verify --no-confirm && cargo check\n   ```\n   This bumps `Cargo.toml` and `Cargo.lock`, then auto-commits. We'll reset this commit in step 10 to fold in the CHANGELOG.\n9. **Update CHANGELOG**: the top section holds this release's changes (see MANDATORY verification below). If it is `## Unreleased`, rename that heading to `## X.Y.Z` and fold the remaining entries into it — inserting a new heading above it ships a stale `## Unreleased` in the release notes. Otherwise the top section is the last shipped version: add a `## X.Y.Z` section above it, never append to it.\n10. **Commit**: Reset the auto-commit from step 8, stage everything, and create the final release commit:\n    ```bash\n    git reset --soft HEAD~1 && git add -A && git commit -m \"Release vX.Y.Z\"\n    ```\n11. **Merge to main**: complete the documentation review on the final candidate, then push the release branch, open a PR, wait for CI, and merge it. Keep the worktree — the remaining steps run from it. Then move the branch onto the merged tip:\n    ```bash\n    git fetch origin && git reset --keep origin/main\n    ```\n    The PR squash-merges, so the branch is no longer an ancestor of `main` and step 1's `--ff-only` can't advance it; `--keep` moves it across and still fails if anything is uncommitted. `main` can advance during the CI wait; step 12 catches anything that lands before the tag.\n12. **Verify the changelog covers `main`, then tag and push**: the tag decides what ships — `release.yaml` builds the binaries and the GitHub release notes from the tree at the tag, so everything reachable from it is in the release. The merge squashes onto whatever `main` tip exists at merge time, so a commit that lands during the PR's CI wait is already an ancestor of the release commit and ships whether or not the changelog mentions it (the easy miss is a follow-up that reworks a feature this release already documents). List what reached `main` since the cut-from tip (step 1):\n    ```bash\n    git fetch origin\n    git log --oneline <cut-from-commit>..origin/main\n    ```\n    Clean means the changelog at `origin/main` documents every user-facing commit listed. With no drift the list is one line, the `Release vX.Y.Z (#NNNN)` squash commit. Review anything else that drifted in during the window and fold what's user-facing into the changelog with a follow-up squash PR, then re-fetch and re-run. The list only grows across passes — the drifted commits stay, joined by the follow-up's own squash commit — so each pass re-checks coverage over a longer list.\n\n    Extend the documentation review to any changes since its reviewed SHA, including corrections and commits that arrived during CI. Record the final reviewed SHA and resolve findings before tagging.\n\n    Once clean, tag `origin/main`. The check and the tag then name the same ref, and it's main's tip, so the tag is reachable from `main`:\n    ```bash\n    git tag vX.Y.Z origin/main && git push origin vX.Y.Z\n    ```\n13. **Wait for the release workflow**: The tag push triggers `release.yaml`. Launch a ci-reporter agent to monitor the run through to completion (avoid `gh run watch` — it can hang); the run ID comes from:\n    ```bash\n    gh run list --workflow=release.yaml --event=push --branch=vX.Y.Z --limit 1 --json databaseId --jq '.[0].databaseId'\n    ```\n    If the run fails, re-run its failed jobs when the cause is transient. Otherwise land the fix on `main` and release it as the next patch version, leaving the vX.Y.Z tag in place. Installers such as aqua check that the signing certificate names `release.yaml@refs/tags/<version>`, so each version's release has to come from the run its own tag push started.\n\n`release.yaml` builds binaries and publishes to crates.io, Homebrew, winget, AUR, and PyPI (experimental) automatically.\n\n## Data-Loss Surface Review\n\nWorktrunk's worst failure is silently destroying a user's work. The per-PR review (`running-tend`, \"Data-Loss Surface\") is the first gate; the release is the second, where the whole diff since the last release is visible at once.\n\nThis review optimizes for recall: find every change that could touch the deletion surface, accept false positives, then adjudicate each candidate. Missing one real loss path costs far more than reviewing a false alarm.\n\nA keyword grep alone is insufficient. It finds only what someone thought to pattern-match, and an agent handed the grep anchors on it and inherits its blind spots. So fan out independent finders, most of them without the grep, and analyze every candidate they surface.\n\n### Find: independent finders, recall over precision\n\nLaunch 3-5 finder subagents in parallel over the cumulative diff (`git log v<last-version>..HEAD -p`) and the code it touches, including anything that calls into or is called by the changed code. Each works independently: do not let them share findings during this phase, and do not collapse them onto one method. Each returns candidate locations with a one-line reason, erring toward over-reporting.\n\nGive each a distinct charter. At least two receive no grep and no keyword list, so they reason from the code instead of pattern-matching:\n\n- **Behavioral (no grep):** read each change and ask what it could destroy: files, branches, worktrees, uncommitted or untracked work, committed-but-unpushed commits. Flag any change whose worst case is lost user data.\n- **Blast-radius (no grep):** for every function and file the diff touches, trace callers and callees. Flag any path that can now reach a destructive primitive (branch deletion, worktree removal, filesystem removal, history rewrite), even when that call sits outside the diff.\n- **Automation diff (no grep):** compare shipped automation before and after: `plugins/*/hooks/hooks.json`, `plugins/*/hooks.json`, `plugins/*/hooks/wt.sh`, and skill or alias examples users copy. Flag any new or altered invocation that removes or force-overwrites anything.\n- **Keyword scan (grep):** one finder runs the pattern filter over the full diff as a cross-check, never as the primary method. It takes no pathspec; a path allowlist would recreate the blind spots the no-grep finders exist to avoid (the densest destructive code, the tree walk in `src/remove_dir.rs`, sits outside `src/git/`).\n  ```bash\n  git log v<last-version>..HEAD -p \\\n    | grep -nE -- '--force-delete|--force| -D| -f |branch -[dD]|worktree remove|reset --hard|checkout -f|clean -[fdx]|remove_dir_all|remove_file|unlinkat|rm -rf'\n  ```\n\n### Analyze: adjudicate each candidate\n\nPool the candidates, dedupe, and analyze each against the data-safety invariants in `AGENTS.md` and the FAQ \"What can Worktrunk delete?\" inventory: does it preserve data on failure, require explicit consent for destructive ops, and avoid silent side-effect deletion? Mark each real risk / acceptable / needs change, with the reasoning.\n\nSurface the full adjudicated list and get explicit sign-off before tagging. Do not tag a release with an unresolved deletion-surface candidate, even if it looks acceptable.\n\n## Documentation Review\n\nThe release reviews all documentation changes since the previous release, including changes already on `main` and edits made during release preparation. Public docs are curated product guidance: each passage should help readers understand or use Worktrunk, with detail proportional to how many readers need it.\n\nStart from the full release diff to inventory documentation wherever it lives:\n\n```bash\ngit diff --name-status v<last-version> HEAD\ngit diff v<last-version> HEAD\n```\n\nGive an independent reviewer the previous tag, candidate SHA, and complete inventory. Cover site pages, README files, CLI help, configuration and command examples, shipped skills, and release notes. Review canonical sources once and check their generated copies for agreement; `docs/AGENTS.md` defines ownership and sync.\n\nThe reviewer reads every changed passage in its surrounding section and checks:\n\n- **Purpose and proportion:** does it change what readers understand or do? Cut redundant explanations and implementation or regression details that belong in tests or PRs. A correctness fix needs prose only when usage changes or an existing claim becomes false.\n- **Clarity and concision:** use concrete, consistent terminology; introduce concepts before relying on them; rewrite definitions in place rather than layering caveats. Shortening must preserve necessary instructions and qualifications.\n- **Accuracy and usability:** verify claims against behavior and examples against their commands. Check links and read affected rendered sections as a reader encounters them.\n\nFor each finding, give the location, reader impact, and a concrete replacement or deletion. Apply corrections in the canonical source, regenerate mirrors, and run the checks in `docs/AGENTS.md`. Have the reviewer check the corrected passages before closing findings. Record the reviewed range and SHA, coverage, findings, and their disposition in the release review; unresolved findings block tagging. Changelog claims and credits also receive the verification below.\n\n## CHANGELOG Review\n\nDraft entries from the commits since the last release:\n\n```bash\ngit log v<last-version>..HEAD --oneline\n```\n\n**IMPORTANT: Don't trust commit messages.** Commit messages often undersell or misdescribe changes. For any commit that might be user-facing:\n\n1. Run `git show <commit> --stat` to see what files changed\n2. If it touches user-facing code (commands, CLI, output), read the actual diff\n3. Look for changes bundled together — a \"rename flag\" commit might also add new features\n\nCommon patterns where commit messages mislead:\n- \"Refactor X\" commits that also change behavior\n- \"Rename flag\" commits that add new functionality\n- \"Fix Y\" commits that also improve error messages or add hints\n- CI/test commits that include production code fixes\n\nNotable changes to document:\n- New features or commands\n- User-visible behavior changes\n- Bug fixes users might encounter\n\n**Section order:** Improved, Fixed, Documentation, Internal. Documentation is for help text, web docs, and terminology improvements. Internal is for selected notable internal changes (not everything).\n\n**Within each section, order by reader interest.** The section is the first ordering dimension and is fixed; reader interest is the second, and it decides rank inside a section. A change's class does not: a behavior change nobody asked for ranks below a feature people requested, and a fix every user hits ranks above a platform-specific one. Interest combines how many readers a change reaches with how much it obliges each of them to act, and never counts the effort the change took to build — effort and interest diverge most on the change just finished, which is the one being written up. So a breaking change stays near the top of its section: it reaches few readers, but every one of them has to do something about it.\n\n**Breaking changes:** Note inline with the entry, not as a separate section:\n\n```markdown\n- **Feature name**: Description. (Breaking: old behavior no longer supported)\n```\n\nSkip: internal refactors, test additions (unless user-facing like shell completion tests).\n\n### Length and tone\n\n**Combine related bullets.** Several PRs that share a theme — e.g. three perf changes that together account for one user-visible speedup — belong in one bullet, not three. The reader cares about the net change, not the PR boundaries. Cite all the PRs in the trailing `([#a](...), [#b](...), [#c](...))` list.\n\n**Be brief — the ceiling is words, not sentences.** A bullet aims at 35 words; a dense one runs to 60, and the two or three headline entries may reach 80; Internal-section bullets get one sentence. Drop the \"why we did it this way\" details unless they change how the user thinks about the change, and leave code examples and `Cmd::stream` / `OnceCell` / `DashMap`-style internals in the PR description, where the reasoning belongs.\n\nSentences stretch to fit whatever you want to say; words don't. So measure rather than judge:\n\n```bash\nawk '/^## /{if (f) exit; f=1} f' CHANGELOG.md \\\n  | awk '/^- \\*\\*/ {n=split($0,_,\" \"); t+=n; c++; if (n>60) o++; printf \"%4d  %.58s\\n\", n, $0} END {printf \"\\n%d entries, %d avg, %d over 60\\n\", c, c?t/c:0, o}'\n```\n\n**Calibrate against the ceiling, not against the last release.** Length ratchets: each release is drafted beside the previous section, and an abstract rule loses to a concrete neighbouring exemplar every time. Entries grew from 49 to 101 words on average across five releases while this skill said \"be brief\" throughout. Read the previous section for what it drifted to, then ignore it and write to the ceiling.\n\n**Entries describe.** An entry records what the old behavior was and what it is now. Give imperative guidance only for a material issue that affects a sizable share of users, which is rare; otherwise remediation belongs in the PR description.\n\n**No editorial framing.** Describe what changed, not what was wrong with the previous decision in subjective terms. Avoid words like \"sledgehammer\", \"ugly\", \"noisy\", \"wrong\" applied to past code. State the prior behavior neutrally and the new behavior plainly.\n\n**Good:** \"Removed `.pi/` from the default excludes list; users who need it can add it via `[step.copy-ignored]`.\"\n**Bad:** \"Removed `.pi/` — a sledgehammer fix from an unrelated debugging session that has no place as a project-agnostic default.\"\n\n**Match a fix's prominence to its reach.** Readers skim the bold headlines, so the headline, and whether the fix has a bullet of its own, tell them how big it was before they read any body text. A correctness or data-loss fix usually needed narrow conditions — a non-default git config, a command run from a particular place, a change of a particular shape. Put them in the headline and the consequence in the body: a headline that states the consequence tells every reader it could have been them, and conditions arriving after it don't undo that. Join the conditions with \"and\": \"X set *and* run from Y\" is a corner case, while \"X or Y\" reads as two common triggers. Establish each one by reproducing against the previous release's binary rather than reading it off the diff — a condition assumed is a condition the entry overstates, and overstating a data-loss bug is its own kind of inaccuracy.\n\n**Good:** \"**Submodules with an `ignore` setting**: when `submodule.<name>.ignore` hid uncommitted changes inside a submodule, `wt remove` read the worktree as clean and removed it with them.\"\n**Bad:** \"**`wt remove` no longer deletes submodule changes hidden by config**: with `submodule.<name>.ignore` set *and* uncommitted changes inside a submodule, …\" — every condition is there, but the headline has already announced a data-loss bug to every reader.\n\nA fix of near-zero reader interest (see the ordering rule above) — a name starting with `-`, a non-UTF-8 path, one platform with an unusual environment — gets no bullet of its own. Fold these into a closing bullet such as \"Fixes for unusual setups\" that names each case in a clause. A section of separate bold fixes reads as that many ways the tool broke, whatever their bodies say.\n\n### Credit External Contributors\n\nFor any changelog entry where an external contributor (not the repo owner) authored the commit, add credit with their GitHub username:\n\n```markdown\n- **Feature name**: Description. ([#123](https://github.com/user/repo/pull/123), thanks @contributor)\n```\n\nFind external contributors:\n```bash\ngit log v<last-version>..HEAD --format=\"%an <%ae>\" | sort -u\n```\n\nThen for each external contributor's commit, find their GitHub username from the commit (usually in the email or PR).\n\n### Credit Issue Reporters\n\nWhen a fix or feature addresses a user-reported issue *in this repo*, thank the reporter — not just the PR author. Users who take time to report bugs, request features, or provide reproduction steps deserve recognition. (Don't credit reporters from upstream/external repos — only issues filed here.)\n\n```markdown\n- **Feature name**: Description. ([#456](https://github.com/user/repo/pull/456), thanks @reporter for reporting)\n```\n\nFor fixes that reference issues:\n\n```markdown\n- **Bug fix**: Description. Fixes [#123](https://github.com/user/repo/issues/123). (thanks @reporter)\n```\n\n**Finding reporters — do ALL three steps:**\n\nIssues may have been filed months before the fix. Bug reports also appear as PR comments, not just issues. These steps are complementary; each catches things the others miss.\n\n1. **Extract every issue/PR reference from every commit** (PRIMARY):\n   ```bash\n   git log v<last-version>..HEAD --format=\"%B\" | grep -oE '#[0-9]+' | sort -t'#' -k2 -n -u\n   ```\n   For **each** referenced number: run `gh issue view N --json title,author,state`. This catches issues filed months ago — the most commonly missed credits.\n\n2. **Check PR comments for bug reports** (catches reports that never became issues):\n   For feature PRs referenced in commits, check comment threads for users reporting problems:\n   ```bash\n   gh pr view NNN --json comments --jq '.comments[] | \"\\(.author.login): \\(.body[:150])\"'\n   ```\n\n3. **Survey every issue opened or closed since last release** (catches unreferenced matches):\n   ```bash\n   git log -1 --format=%cs v<last-version>\n   gh issue list --state all --search \"created:>=<date>\" --json number,title,author --limit 100\n   gh issue list --state closed --search \"closed:>=<date>\" --json number,title,author --limit 100\n   ```\n   Cross-reference every title against changes in this release.\n\n**When to credit:**\n- Bug reports with clear reproduction steps (in issues OR PR comments)\n- Feature requests that shaped the implementation\n- Performance reports with measurements (like \"takes 15s\")\n- Users who helped diagnose issues through discussion\n\nSkip credit for: issues opened by the repo owner, trivial reports, or issues that were substantially different from what was implemented.\n\n### Link Significant Features to Docs\n\nFor major features with dedicated documentation, include a docs link. Use full URLs so links work from GitHub releases:\n\n```markdown\n- **Hook system**: Shell commands that run at key points in worktree lifecycle. [Docs](https://worktrunk.dev/hook/) ([#234](https://github.com/user/repo/pull/234), thanks @contributor for the suggestion)\n```\n\nLink when there's substantial documentation the user would benefit from reading — new commands, feature pages, or Tips & Patterns sections. Skip for minor improvements.\n\n### MANDATORY: Verify Each Changelog Entry\n\n**After drafting changelog entries, you MUST spawn a subagent to verify each bullet point is accurate.** The tag publishes this text as the GitHub release body, so a correction afterwards takes a follow-up PR to `CHANGELOG.md` and a hand-edit of the release page, and people have read the wrong line by then. This pass is worth as much time as it takes.\n\n**The gate cuts both ways.** Checking only accuracy pushes every entry longer: \"understates\" and \"not covered\" have no counterweight, so each pass adds and none subtracts. That asymmetry is what drove the ratchet above. An entry that is too long, too internal, or ranked above one more readers will notice is reported on the same footing as one that is wrong.\n\n**Subagent prompt template:**\n\n```\nVerify these changelog entries for version X.Y.Z are accurate. They publish with\nthe tag, and by the time anyone corrects a wrong line, readers have acted on it.\nSpend the time to read a source for each one: reading the entry and finding it\nplausible is not a check, because the entry was written from the same commits you\nare about to read.\n\nPrevious version: [e.g., v0.1.9]\nCommits to check: git log v<previous>..HEAD\n\nEntries to verify: the top section of CHANGELOG.md as it stands on disk. Read it\nthere rather than from a paste:\nawk '/^## /{if (f) exit; f=1} f' CHANGELOG.md\n\nVerify claim by claim, not entry by entry: an entry carries several independent\nclaims, and one verdict over the whole entry waves through every claim that is not\nits headline.\n\n1. Find the relevant commit(s) using git log and git show\n2. Read the diff, not the commit message. The diff settles what changed, and\n   nothing else: not what the behavior was before, not what the user sees, not\n   what a file it doesn't touch does. Settle a \"previously\" / \"no longer\" / \"so X\n   broke\" claim by reading the old file (`git show <sha>^:<path>`) and confirming\n   the old behavior there. The new code's handling of the old case is not that\n   confirmation: a case added together with a comment about why it produces\n   nothing reads in a diff exactly like a case that used to produce something.\n   Some claims have no source in the commit at all — a version floor, what a\n   rendered page shows, how another component behaves. Read that source: the\n   rendered output, the other component's own file, the upstream project's own\n   releases\n3. Flag any claim its source does not support, whether it overstates,\n   understates, or misdescribes\n4. Flag if the entry runs over 60 words (80 for one of the two or three headline\n   entries), restates the PR description, or explains mechanism the reader cannot\n   act on — report these as seriously as an inaccuracy, and quote a shorter\n   rewrite that keeps every user-facing claim\n\nAlso check:\n- Are there user-facing changes NOT covered by these entries?\n- Verify each \"thanks @...\" attribution (right person, right role — author vs reporter)\n- Within each section, is any entry ranked above one that more readers will notice?\n- Read each headline alone, as a skimming reader does. Flag one that states the\n  consequence (what was lost or broken) rather than the situation it needed, and a\n  fix almost no reader will notice that has its own bullet rather than a clause in\n  a closing roll-up.\n\nReport format:\n- Entry: [entry text]\n  Status: ✅ Accurate / ⚠️ Needs revision / ❌ Incorrect\n  Length: [word count] — ✅ / ⚠️ over ceiling\n  Evidence: [for each claim, the source you read and what it said]\n  Suggested fix: [if needed]\n```\n\n**The pass ends on a clean run, not on the first run's findings.** A rewrite the verifier suggests has no more evidence behind it than one you wrote yourself, and an entry you edit while the pass runs is in the same state — both leave that entry unverified. Re-run over the section as it now stands, and finalize only once a run comes back clean.\n\n`evals/README.md` beside this skill holds four entries from a shipped release, three of them wrong, for scoring a change to this template against what the last wording missed, and a drafting case for the prominence rule.\n\n**If verification finds problems:** Escalate to the user. Show them the subagent's findings and ask how to proceed. Don't attempt to resolve ambiguous changelog entries autonomously — the user knows the intent behind their changes better than you do.\n\n## Determine Release Type\n\nPick the bump from the changes. Skip the question when only one level is plausible; ask only when the choice is genuinely ambiguous.\n\n**Proceed without asking when the answer is obvious:**\n\n- `cargo semver-checks` reports breaking changes → minor (pre-1.0; patch is disallowed, major has no basis pre-1.0 in a maturing project). Inform the user and continue: \"Bumping minor — semver-checks reported N breaking changes; patch is disallowed pre-1.0.\"\n- Only bug fixes and internal commits since the last release, no new features, no semver breakage → patch. Inform the user with the same shape.\n\n**Ask only when genuinely ambiguous** — e.g., new features landed with no semver breakage (patch vs. minor is a judgment call), or a borderline case where the user's read of the changes may differ. Use `AskUserQuestion` with the actual choice (patch vs. minor); don't add novelty options like skipping a version number.\n\nWhen asking, present:\n1. Current version (e.g., `0.2.0`)\n2. Brief summary of changes (new features, bug fixes, breaking changes)\n3. Your recommendation with reasoning\n\nExample:\n\n```\nCurrent version: 0.2.0\nChanges since v0.2.0:\n- Added `state clear` command (new feature)\n- Added `previous-branch` state key (new feature)\n- No breaking changes\n\nRecommendation: Minor release (0.3.0) — new features, no breaking changes\n```\n\n## Version Guidelines\n\n- **Second digit** (0.1.0 → 0.2.0): Backward incompatible changes\n- **Third digit** (0.1.0 → 0.1.1): Everything else\n\nCurrent project status: maturing mode (see [AGENTS.md › Project Status](../../../AGENTS.md)). External interfaces — the config file format (`wt.toml`, user config) and CLI flags/arguments — carry compatibility weight, so breaks there need justification (a real improvement, not cleanup) and prefer deprecation warnings over silent breaks. Everything else, including the internal and library APIs, stays flexible: worktrunk ships breaking library changes freely and bumps the version each time, putting no weight on the existing internal APIs.\n\n## Library API Compatibility\n\nWorktrunk is a CLI tool. The `[lib]` crate in `Cargo.toml` does expose a public API, but it is **not a compatibility surface** — per [AGENTS.md › Project Status](../../../AGENTS.md) there are no Rust library compatibility concerns, and the project ships breaking library changes freely, bumping the version each time (see the \"Breaking library API\" entries in `CHANGELOG.md`). Downstream crates are expected to pin.\n\n`cargo-semver-checks` is therefore an **advisory bump-level input**, not a gate that commits us to keeping the API stable for downstream crates. It compares the current public API against the last version published to crates.io and reports semver-relevant changes — a useful signal for choosing the bump:\n\n```bash\ncargo semver-checks check-release -p worktrunk\n```\n\nInterpreting results:\n\n- **No issues reported**: no library-level signal for the bump. Choose based on CLI changes and new features.\n- **Breaking changes reported**: expected and acceptable — breaking the library API is not something to avoid here. But under semver a breaking change still warrants at minimum a minor bump while pre-1.0 (e.g., 0.37.0 → 0.38.0) rather than a patch. Bump accordingly; this is version mechanics, not a signal to preserve the old API.\n- **Tool fails to run** (e.g., missing baseline): likely the crate hasn't been published yet or the registry cache is stale. Try `cargo semver-checks check-release -p worktrunk --baseline-version <last-published>`.\n\nThis check validates the chosen bump — it doesn't distinguish patch vs. minor when no breakage exists. Continue using the commit review to decide between patch (fixes only) and minor (new features).\n","frontmatter":{"name":"release","description":"Worktrunk release workflow. Use when user asks to \"do a release\", \"release a new version\", \"cut a release\", or wants to publish a new version to crates.io and GitHub.","metadata":{"internal":true}},"isInternal":true,"tokens":6892,"sizeBytes":30235},{"name":"nightly-cleaner.md","path":".claude/skills/running-tend/references/nightly-cleaner.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/.claude/skills/running-tend/references/nightly-cleaner.md","title":"References Skill","category":"anthropic-skill","format":"markdown","content":"# References Skill\n\nPath: `.claude/skills/running-tend/references/nightly-cleaner.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/.claude/skills/running-tend/references/nightly-cleaner.md)","tokens":300,"sizeBytes":233},{"name":"review-pr.md","path":".claude/skills/running-tend/references/review-pr.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/.claude/skills/running-tend/references/review-pr.md","title":"References Skill","category":"anthropic-skill","format":"markdown","content":"# References Skill\n\nPath: `.claude/skills/running-tend/references/review-pr.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/.claude/skills/running-tend/references/review-pr.md)","tokens":300,"sizeBytes":221},{"name":"SKILL.md","path":".claude/skills/running-tend/SKILL.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/.claude/skills/running-tend/SKILL.md","title":"running-tend","category":"anthropic-skill","format":"markdown","content":"---\nname: running-tend\ndescription: Worktrunk-specific guidance for tend CI workflows. Adds codecov polling, Rust test commands, labels, and review criteria on top of the bundled tend-ci-runner skills. Use when operating in CI.\nmetadata:\n  internal: true\n---\n\n# Worktrunk Tend CI\n\nProject-specific guidance for tend workflows running on worktrunk (a Rust\nCLI for managing git worktrees). The bundled `run-tend`, `review`, and `triage`\nskills provide the workflow framework; this skill adds worktrunk conventions.\n\n## Filing issues in other repos\n\nStanding exceptions granted, each filing directly without asking permission\nhere first:\n\n- agent-equipped targets (per **Filing issues** in the bundled\n  `act-in-other-repos` skill)\n- any project the weekly digest finds copying Worktrunk's code without its\n  license notice (`references/feedback-digest.md`, \"Projects that copy\n  Worktrunk's code\")\n\nThe default rule (open an issue here asking permission first) applies to every\nother target.\n\n## Codecov Monitoring\n\nAfter required CI checks pass, poll `codecov/patch` — it is mandatory despite\nbeing marked non-required:\n\n```bash\nfor i in $(seq 1 5); do\n  CODECOV=$(gh pr checks <number> 2>&1 | grep 'codecov/patch' || true)\n  if echo \"$CODECOV\" | grep -q 'pass'; then\n    echo \"codecov/patch passed\"; exit 0\n  elif echo \"$CODECOV\" | grep -q 'fail'; then\n    echo \"codecov/patch FAILED\"; exit 1\n  fi\n  sleep 60\ndone\n```\n\nIf codecov fails **locally**, investigate with `task coverage` and\n`cargo llvm-cov report --show-missing-lines | grep <file>`.\n\n### Investigating codecov failures in CI\n\n`task` and `cargo-llvm-cov` are not installed in the `tend-setup` action.\nDon't try to `cargo install` them in the sandbox — past attempts at\nsource-compiling installs cascaded into bash-tool interrupts that blocked\neven `pwd` and `echo`. Instead, query Codecov directly, following\n`tests/AGENTS.md` → **Coverage Investigation** for the endpoints and their\ntraps. The scratch paths there and below go to `${TMPDIR:-/tmp}` — write new\nones the same way.\n\nIf the Codecov API markers aren't enough, download the `code-coverage-report`\nartifact from the PR head's `coverage` workflow run — it contains a\n`cobertura.xml` with per-line hit counts:\n\n```bash\nREPO=$(gh repo view --json nameWithOwner --jq '.nameWithOwner')\n# Find the coverage run on the PR head SHA:\nCI_RUN=$(gh api \"repos/$REPO/commits/<sha>/check-runs\" --jq '.check_runs[] | select(.name == \"code-coverage\") | .details_url | capture(\"runs/(?<id>[0-9]+)\") | .id')\n# List artifacts, then download the coverage one:\ngh api \"repos/$REPO/actions/runs/$CI_RUN/artifacts\" --jq '.artifacts[] | {name, id}'\ngh api \"repos/$REPO/actions/artifacts/<id>/zip\" > \"${TMPDIR:-/tmp}/coverage.zip\"\nunzip -q \"${TMPDIR:-/tmp}/coverage.zip\" -d \"${TMPDIR:-/tmp}/coverage\"\n```\n\n## Test Commands\n\n```bash\ncargo run -- hook pre-merge --yes   # full suite + lints\ncargo test --lib --bins             # unit tests only\ncargo test --test integration       # integration tests only\n```\n\nCI runs on Linux, Windows, and macOS.\n\n## Rework a test that reaches for its environment\n\nA test that leans on inherited state — the process CWD, an ambient env var —\nsets up its own instead, via `TestRepo::with_initial_commit()` plus a tempdir,\nthe way most worktrunk tests already do. Guarding it with an early return\n(**Don't \"fix\" tests by adding skip guards** in the bundled `fix-a-bug` skill)\ndrops the coverage rather than restoring it. This governs every workflow that\nfixes a test here, not just issue triage.\n\n## Session Log Paths\n\nThe artifact directory is named after the agent's working directory, which\nmoves between tend releases — 0.2.5–0.2.13 used a per-run\n`tend-agent-workspace-*/checkout`, and from 0.2.14 the agent works in the\nrunner's own checkout, so `-home-runner-work-worktrunk-worktrunk/` is the\nprefix again. Match on neither literal: use the bundled\n`find \"$DEST\" -name '*.jsonl'` recipe, which holds across all of them — every\nshape is one `<session-id>.jsonl` under a single slugified directory.\n\n## Labels\n\n- `automated-fix` — fix PRs from triage\n- `nightly-cleanup` — nightly sweep issues and PRs\n\n## CI Failure Triage: Prefer Rerun for Transient Infrastructure Failures\n\nBefore opening a PR for a CI failure, classify it:\n\n- **Transient infrastructure** (link-check timeouts, apt-get flakes, GitHub\n  outages, runner disk issues, codecov upload blips) — do **not** create a\n  PR. Rerun the failed jobs yourself (**Rerunning failed jobs** in the bundled\n  `monitor-ci` skill) rather than leaving the rerun to the maintainer, and\n  report its result where you post the diagnosis. A permanent config change\n  for a one-off timeout is churn the maintainer will close.\n- **Flaky test** (known-flaky or first-seen PTY/shell test) — try to fix it.\n- **Real regression** — proceed with a fix PR.\n\n**Non-required ≠ transient.** A non-required job (e.g. `collect affected coverage`, `affected tests (linux, advisory)`) can fail from a real regression. The required/non-required distinction is about merge-blocking, not about how the failure is classified. If a deterministic build error (`error[E...]`, \"binary not found\", \"ambiguous candidates\", missing target) repeats across consecutive runs of the same shape, it's a real regression even when the job is advisory. Reserve \"transient\" for non-deterministic causes: `BrokenPipe`, `connection reset`, runner disk full, GitHub API timeouts, host-availability blips.\n\n**Lychee link-check timeouts are always transient** unless the same URL has\nfailed on at least two separate runs within the last few days. The check runs\nas the `link-check` job in the `nightly` workflow. `.config/lychee.toml`\nalready sets `max_retries = 6` and lists known-unreliable hosts; one timeout\nis not enough evidence to extend that list. Signals you have a transient\nfailure, not a broken link:\n\n- The previous run on the same or a nearby commit passed.\n- Only `[TIMEOUT]` is reported (not `404`/`403`/`410`).\n- The URL is reachable from a local `curl`.\n\nWhen in doubt, post the diagnosis on the failure cause issue and wait — don't open a PR.\n\n## Applying GitHub Suggestions\n\nApply the literal suggestion only — change the lines it covers, nothing more.\nIf surrounding lines also need updating, note that in your reply.\n\n## PR Review: Don't Self-Dismiss Over Unrelated Test Flakes\n\nIf a clearly-unrelated test or infrastructure failure turns a check red after\nyou've already approved a PR, leave the approval in place. Do **not** dismiss\nyour own approval to \"gate\" on a rerun — but do start the rerun yourself and\nreport its result; a diagnosis that says a rerun should clear the failure is\nthe cue to run it, not to hand it to the maintainer.\n\nGitHub blocks both `gh run rerun --failed` and per-job rerun\n(`POST /repos/{owner}/{repo}/actions/jobs/{id}/rerun`) with HTTP 403 while\n*any* job in the same workflow run is still `in_progress`, and\n`tend runtime rerun-failed-jobs` doesn't wait for that. Rerun failed jobs in\nworkflow runs that have finished now, and those in a run still going once it\ncompletes.\n\nRerun only runs on the PR's current head. The CI workflows' concurrency groups\nare keyed by PR number with `cancel-in-progress`, so rerunning an older head's\nrun cancels the current head's run in that workflow.\n\nThe codecov-failure dismissal pattern is different and remains correct:\n`AGENTS.md` requires explicit user approval before merging with failing\n`codecov/patch`, so dismissing the approval until the coverage gap is\naddressed is intentional.\n\n## Weigh the root-cause fix before shipping a workaround\n\nWhen a mismatch, a false positive, or a stale value has an obvious non-code\nworkaround (a template change, a config value, an alias, a comment recording\nthe drift), don't stop there. First check whether the workaround is **lossy or\nfoot-gunny**, and weigh a proportionate **root-cause code fix** before opening\na PR that only records it. A \"docs-only, no risk\" framing is not the same as\ngood guidance — a zero-code-risk change can still steer users toward a\ncollision-prone or lossy config, and annotating a stale value leaves the\nduplication that made it stale. If you do recommend a workaround, surface its\ndownsides in the PR body up front, not only when challenged.\n\nThis governs every workflow that opens a PR here, not just issue triage.\n\n## Issue Triage\n\nWhen you need more information to diagnose a reported bug, the **primary\nask is `wt -vv <command>`**. Re-running the failing command with `-vv`\nwrites a diagnostic bundle — a single report containing wt/git/OS versions,\nshell integration, `wt config show`, `git worktree list --porcelain`, and a\n`trace.log` of every git invocation with its output. The `-vv` output prints\nthe bundle's exact absolute path (`Diagnostics and performance profile\nsaved @ …`) followed by a ready-to-run `gh gist create --web\n<path>` line — **point the user at those printed lines; don't hand them a\nhardcoded path**. In particular, never tell them to `cat\n.git/wt/logs/diagnostic.md`: inside a linked worktree `.git` is a gitdir\n*file*, not a directory, so that path fails with `Not a directory (os error\n20)` (`ENOTDIR`). The bundle actually lives under the git *common* dir —\n`\"$(git rev-parse --git-common-dir)/wt/logs/diagnostic.md\"` resolves from any\nworktree, and the printed absolute path already points there. One gist URL\npasted into the issue gives us most of what we'd otherwise ask for piecemeal,\nso lead with this for unexplained failures rather than chaining\nversion/config/repro questions across multiple round-trips.\n\nWhen the report is about a slow `wt` command, read its **Performance profile**\nsection first. It renders the same breakdown as `wt config state logs profile`\n(subprocess time by command type, slowest calls, repeated `(command, context)`\npairs) directly from the bundled `trace.log`, so you can spot redundant git\ncalls and slow commands without parsing the raw trace by hand. The same\nreport run against a statusline capture is the weekly per-render cache\ncheck — see **Weekly Maintenance: Statusline Cache-Check**.\n\nReach for narrower asks only when the diagnostic is overkill:\n\n- `wt --version` — when the only question is whether a fix has landed.\n- `wt config show` — when the suspicion is purely config/shell-integration\n  and you already have the command + repro.\n\n### Don't ship fixes you can't verify\n\nWhen the bug or proposed fix turns on runtime state the bot can't observe from CI — plugin hooks firing inside an agent CLI (Claude Code, Codex, Antigravity), shell-integration side effects, interactive prompt rendering, signal forwarding into a TTY — do **not** open a PR premised on the hypothesis. Signals to stop:\n\n- The proposed transition fires inside a running agent session the bot can't drive from a test (`PostToolUse`, `Stop`, `Notification`, statusline redraws).\n- The \"analysis\" in the issue is an LLM-written trace pasted by the reporter, not a verified observation. Treat that as a starting hypothesis, not ground truth — a Claude-written explanation of why X is broken is no more trustworthy than the bot's own first guess.\n- The repro requires an interactive shell or `claude` running in a tmux that the bot can't spin up.\n\nComment on the issue with what's known, ask the reporter for the concrete symptom they observe (\"which marker shows where, when\") rather than for a fix to validate, and exit without a PR. The bar for opening a fix PR is *the failure mode is reproducible and the fix is testable*, not *the hypothesis seems plausible*. If you post a fix despite limited testability (rare — usually only when the reporter has confirmed the exact symptom and the code change is obviously correct from inspection), explicitly flag what wasn't verified in the PR body.\n\n### Feedback digest issues\n\nAn issue labeled `feedback-digest` is the weekly report, not a bug report. The\nweekly run files each confirmed bug in it as its own issue, so triage posts\nnothing on it.\n\n### Closing Duplicates\n\nWhen an issue is clearly a duplicate, close it after commenting. Use\n`gh issue close <number>` and tell the reporter: if they believe this was\nclosed in error, they can let us know and we'll reopen it.\n\n### Check `--config-set` before calling a setting unpinnable\n\n`wt --config-set '<toml>'` overrides any user config key for one invocation,\nabove both config files and `WORKTRUNK_SECTION__KEY` env vars ([inline config\noverrides](https://worktrunk.dev/config/#inline-config-overrides-config-set)).\nThe resolver just reads `repo.config().<key>` and shows no sign of that layer,\nso before writing \"there's no way to do X per invocation\", ask whether X is a\nconfig key: the ask is usually already met, and the reply is a `--config-set`\nrecipe plus a docs fix where the docs don't connect the flag to the setting.\nPinning is all that covers — weigh the request's residual asks on their own\nmerits.\n\n### Suggesting Aliases for Niche Feature Requests\n\nworktrunk deliberately limits flag and config growth, so a `wt` alias is the\nstanding answer to a narrow feature request rather than a new native flag.\nSuggest one when the request serves a single reporter's workflow or a small\nsubset of users (idempotent create-or-switch, auto-push after merge) and\ncomposes from existing `wt` commands.\n\nAnswer with a `wt` `[aliases]` entry. Defined in user config, it resolves\n`wt <name>` to the alias whenever no built-in matches, so the same alias works\nacross every repo. It's the project's preferred extension point.\n\n**How to respond:**\n1. Search open and closed issues for the same request and link the prior\n   thread; these asks recur, and the link lets the deflection read as a\n   considered position rather than a brush-off.\n2. Draft the alias.\n3. Test it in a scratch worktree against the happy path and edge cases (branch\n   already exists, dirty worktree). When a surprising behavior turns up, note\n   it in the reply instead of building the alias around it. For example, a\n   create-or-switch wrapper inherits `wt switch <name>`'s habit of\n   materializing a *remote* branch of the same name.\n4. Post the tested alias with usage examples.\n5. Link to the [aliases docs](https://worktrunk.dev/extending/#aliases) and\n   [tips & patterns](https://worktrunk.dev/tips-patterns/).\n\n## Weekly Maintenance: MSRV & Toolchain\n\nBump both MSRV and the development toolchain to **latest stable − 1**. When\nRust 1.N is the current stable release, set both to 1.(N−1).\n\nFiles to update:\n\n| File | Field | Example (if stable is 1.94) |\n|------|-------|----|\n| `Cargo.toml` | `rust-version` | `\"1.93\"` |\n| `tests/helpers/wt-perf/Cargo.toml` | `rust-version` | `\"1.93\"` |\n| `rust-toolchain.toml` | `channel` | `\"1.93.0\"` |\n| `.github/workflows/nightly.yaml` | `rustup override set nightly-<date>`, twice (`minimal-versions`, `check-unused-dependencies`) | a nightly from the last few weeks |\n\nBump the nightly pins only when the pinned date is more than three months old.\nCargo refuses a workspace whose `rust-version` exceeds the toolchain, so an\nMSRV bump past a stale pin fails both jobs before they check anything.\n\n`flake.nix` reads the channel from `rust-toolchain.toml`, so the Nix build\nfollows this bump. Dependabot keeps `flake.lock` current, including the\n`rust-overlay` revision that has to know the new channel; a lock too old for\nit fails the `nix-flake` job this PR triggers.\n\nAfter bumping, run the full test suite (`cargo run -- hook pre-merge --yes`)\nand verify `cargo msrv verify` passes.\n\n## Weekly Maintenance: CI Pin Bumps\n\nPinned third-party versions in CI are invisible to Dependabot — it follows `Cargo.toml` deps and `uses: foo@vN` action refs, not inline `version:` strings. They drift unless this step bumps them.\n\nEach weekly run checks every pin below against upstream and bumps whatever has drifted. A bump that can turn a whole CI leg red — an OS image, a major version, a tool whose version moves snapshots — goes on its own branch and PR, so a red matrix decides only that bump instead of holding back the week's safe ones. The weekly runner is Linux, so that PR's own checks are the only place a macOS or Windows change gets tested; open it and report what they said.\n\n- **`baptiste0928/cargo-install@v3` blocks** in `.github/workflows/{affected,ci,coverage,nightly}.yaml` and `.github/actions/{test,tend}-setup/action.yaml` — every `version: \"=X.Y.Z\"` against `cargo info <crate>`. Today: `cargo-affected`, `cargo-insta`, `cargo-nextest`, `cargo-llvm-cov`, `cargo-msrv`, `cargo-udeps`, `lychee`, `worktrunk`. `cargo-affected` is pinned twice in `affected.yaml`; move both together. Verify each crate's `rust-version` against the pinned toolchain and note compatibility in the PR body (see PR #1657 for the format).\n- **`hustcer/setup-nu@v3`** `version:` input — latest from `gh api repos/nushell/nushell/releases/latest --jq '.tag_name'`. Five call sites: `coverage.yaml` (`code-coverage`), `nightly.yaml` (`feature-powerset`), `benchmarks.yaml` (`benchmarks`), and `.github/actions/{test,tend}-setup/action.yaml` — `tend-setup`'s copy is what puts `nu` in the agent's sandbox, so it moves with the others.\n- **Codex Cloud tools** — `.codex/cloud.sh` pins pre-commit, cargo-insta, cargo-nextest, Nushell, and PowerShell; `setup-web` pins Nushell and PowerShell. Keep cargo-insta, cargo-nextest, and Nushell level with `.github/actions/test-setup/action.yaml`, which pins the same three — the gate runs `--all-features`, so Nushell's version moves PTY snapshots. Nothing under `.github/` pins PowerShell (CI runs whatever the runner image ships), so bump that one on its own.\n- **Docs site packages** in `docs/package.json` are covered by Dependabot's `/docs` npm entry. Do not duplicate those bumps in this manual pin pass. The one thing that pass does own is the `ignore` entry for `typescript` majors in `.github/dependabot.yaml`: it suppresses the proposal Dependabot would otherwise make, so nothing else can surface it. Check `npm view @astrojs/check peerDependencies.typescript` against the current `typescript` major and delete the entry once the range covers it — the rule is version-agnostic, so left in place it blocks a major `@astrojs/check` fully supports just as silently as the TypeScript 7 it was added for (#3877).\n- **Runner images** — every `runs-on:` label and matrix `os:`/`runner:` value in the workflows. A pin equals what its `-latest` label currently resolves to, per the availability table in `actions/runner-images`:\n\n  ```bash\n  gh api repos/actions/runner-images/contents/README.md \\\n    -H 'Accept: application/vnd.github.raw' | sed -n '/^| Image/,/^$/p'\n  ```\n\n  Bump any pin the table no longer lists against `-latest`, and update `ci.yaml`'s header comment, which records the reason for each image it names. GitHub keeps two GA images per OS and begins deprecating the older one as soon as a newer goes GA, so a pin that has fallen off `-latest` is already the next one due; the table's `deprecated` badge marks that deadline, not the moment to move, and a row badged `preview` is not a bump target.\n\n  A variant label — `-arm`, `-intel`, `-large` — has no `-latest` of its own; it follows its base image's row.\n\n  Where a pin is deliberately held back, that comment says what the repo needs from the older image. Re-check that need against the newer image each week — upstream announces image changes as issues, so `gh search issues --repo actions/runner-images \"<the need> <newer image>\"` surfaces a reversal. Reading the cited issue's state is not the test — an announcement closes when its change ships, in either direction.\n\n  The `tend-*.yaml` workflows also pin a runner, but tend's generator writes them and `uvx tend@latest init` overwrites a hand edit; file a tend issue for those.\n\nDiscovery shortcut: a recent green CI run on `main` flags cargo-install drift directly via workflow annotations. `gh run view <run-id> --json jobs --jq '.jobs[].databaseId' | xargs -I{} gh api repos/<owner>/<repo>/check-runs/{}/annotations` returns one warning per outdated pin.\n\n## Weekly Maintenance: Statusline Cache-Check\n\nDetect new in-process cache-miss duplicates introduced by recent changes by\nprofiling a real `wt list statusline --format=claude-code` trace. Asynchronous\nstatuslines such as Claude Code and tmux run the render repeatedly through a\nsession, so duplicate git subprocesses there compound into measurable\nfseventsd / IPC load.\n\n```bash\n# Run from any worktree of this repo. `jq -n` builds the stdin JSON so the\n# recipe is portable (the weekly job runs on ubuntu-24.04, whose GNU sed\n# rejects BSD's `sed -i ''`) and so a path with a quote can't corrupt it.\njq -n --arg cwd \"$PWD\" '{\n  hook_event_name: \"Status\",\n  workspace: {current_dir: $cwd},\n  model: {display_name: \"Opus\"},\n  context_window: {used_percentage: 42.0}\n}' > \"${TMPDIR:-/tmp}/statusline-input.json\"\n\n# Debug build on purpose. `tend-weekly` installs no `wt` and restores no Rust\n# cache, so `--release` means a cold optimized build of the whole dependency\n# graph before the first render. The duplicate `(command, context)` pairs this\n# check reads are profile-independent; only the timing columns, which this\n# section doesn't triage, would be worth a release build.\ncargo run -- -vv list statusline --format=claude-code \\\n  < \"${TMPDIR:-/tmp}/statusline-input.json\" > /dev/null\ncargo run -- config state logs profile --format=json | jq .cache\n```\n\nThe `.cache` report flags commands invoked more than once with the same context.\nTriage each duplicate:\n\n- **Legitimate** (different cwd, different ref form that can't be normalized,\n  intentional double-call across phases) — note in the response and move on.\n- **Cache miss** (same logical operation should hit cache but doesn't) —\n  open an issue or fix it. Common shapes: `merge_base(\"main\", \"<sha>\")` vs\n  `merge_base(\"main\", \"branch\")` keying separately;\n  `worktree_at(cwd)` vs `worktree_at(porcelain_path)` not canonicalizing.\n\n## Weekly Maintenance: LLM Model Names in Docs\n\nGrep for current Claude and Codex pins across every tracked file:\n\n```bash\ngit grep -niE \"claude|codex\"\n```\n\nCheck the latest IDs at <https://docs.anthropic.com/en/docs/about-claude/models> and <https://developers.openai.com/codex/models>. The recommended commit-message commands should use the most recent fastest model from each vendor (Haiku for Anthropic, the smallest current Codex variant for OpenAI).\n\n**On drift, open a PR — don't file an issue.** The source of truth is `after_long_help` in `src/cli/mod.rs`; edit it and let `cargo test --test integration test_docs_are_in_sync` regenerate the mirrors under `docs/src/content/docs/` and `skills/worktrunk/reference/`. The \"smallest current variant\" call is a judgment — pick the one the vendor's models page currently positions as fastest/smallest, and explain the choice in the PR body. Verifying the new model name with an installed CLI (`codex -m <name>`, etc.) isn't possible in this CI sandbox; the PR is the right output anyway, and the maintainer tests on merge.\n\n## Weekly Maintenance: Projects Worktrunk Integrates With\n\nOther projects change on their own schedules. Agent CLIs change the surfaces\nWorktrunk's plugins hook into, and packagers and module authors carry copies of\nWorktrunk that fall behind it. Each week, check both tables below.\n\nFor each change that needs action, search this repo's open issues for it, then\nfile one issue or add to the one already open. Link the upstream entry or the\ndownstream file, and say what should change and in which repository. A fix in\nanother repository needs the maintainer's go-ahead under **Filing issues in\nother repos**, and the issue here asks for it. Don't open a PR speculatively.\nIf nothing changed, say so and move on. A source that errors or returns\nnothing leaves its row unchecked, so name it rather than report no change.\n\n### Agent CLIs\n\nKeep Worktrunk making full use of each agent CLI. A release that adds something\nWorktrunk could use, to do more or to do what it already does more simply,\nneeds action as much as one that breaks something Worktrunk relies on.\n\nRead what each source published in the last week. For a GitHub repository,\nlist its releases with `gh release list -R <repo> -L 50` and read each new\none's notes with `gh release view`.\n\n| App | Source to check | Integration surface |\n|-----|-----------------|---------------------|\n| Claude Code | `gh api repos/anthropics/claude-code/contents/CHANGELOG.md -H 'Accept: application/vnd.github.raw'`, plus `curl -sL https://code.claude.com/docs/en/statusline.md` for the statusline JSON schema | statusline stdin JSON, `WorktreeCreate`/`WorktreeRemove` hooks, plugin marketplace, `/wt-switch-create` |\n| Codex | `openai/codex` | plugin marketplace |\n| Antigravity | `curl -sL https://antigravity.google/docs/changelog.md` and `curl -sL https://antigravity.google/docs/hooks.md` | plugin layout (`plugins/worktrunk/.antigravity-plugin/plugin.json`, `hooks.json`), lifecycle hooks (`SessionEnd`, worktree hooks), `agy plugin install` |\n| OpenCode | `anomalyco/opencode` | plugins API in `~/.config/opencode/plugins/` |\n| Pi | `earendil-works/pi` | the extension events `dev/pi-extension.ts` uses, loaded from `~/.pi/agent/extensions/` |\n| oh-my-pi | `can1357/oh-my-pi` | the hook events `dev/omp-hook.ts` uses, loaded from `~/.omp/agent/hooks/pre/` by its extension runner |\n\nWhat to flag:\n\n- **New statusline JSON fields** — `src/commands/statusline.rs` parses `workspace.current_dir`, `model.display_name`, `context_window.used_percentage`, and `rate_limits.{five_hour,seven_day}.{used_percentage,resets_at}`. A newly added field (session cost, PR review state) may be worth surfacing in `wt list statusline`.\n- **Renamed or removed hook events** — `WorktreeCreate`/`WorktreeRemove` route agent worktree creation through `wt`; a renamed event silently disables isolation rather than erroring.\n- **Changed plugin install mechanisms** — `wt config plugins <app> install` breaks if the marketplace, plugins directory, or hook API changes.\n\n### Projects that carry Worktrunk\n\n| Project | Source to check | What it carries |\n|---------|-----------------|-----------------|\n| Distribution packages | Repology, below | a release |\n| conda-forge | `curl -sSf https://api.anaconda.org/package/conda-forge/worktrunk` (`latest_version`); Repology doesn't list it | a release |\n| home-manager | `modules/programs/worktrunk.nix` in `nix-community/home-manager` | the shell init lines, its own Claude Code hook for each event in `plugins/worktrunk/hooks/hooks.json`, the skills path inside the package |\n| nixpkgs | `pkgs/by-name/wo/worktrunk/package.nix` in `NixOS/nixpkgs` | the `skills/` directories it installs by name, the shell completions command |\n| aqua registry | `pkgs/max-sixty/worktrunk/registry.yaml` in `aquaproj/aqua-registry`, which `mise`'s `aqua:` backend also reads | the release asset names, and the cosign certificate identity each release's `packslip.sigstore.json` is verified against |\n\nRepology reports each distribution's version and whether it is outdated:\n\n```bash\ncurl -sSf -A 'worktrunk-weekly (https://github.com/max-sixty/worktrunk)' \\\n  https://repology.org/api/v1/project/worktrunk |\n  jq -er '.[] | \"\\(.repo) \\(.version) \\(.status)\"'\n```\n\nWhat to flag:\n\n- **A package behind Worktrunk's releases for longer than its usual lag.** Find\n  its pending update, usually a bot's version-bump PR in the package's\n  repository, and say why it stalled. Stable channels that freeze versions,\n  such as NixOS stable and Manjaro stable, lag by design.\n- **A copy that no longer matches Worktrunk.** Compare the downstream file with\n  `main`: each hook event and the command it runs, each skill directory, each\n  init line. Either side's commits can open a difference. Flag one that gives\n  the copy's users different behavior from Worktrunk's own integration.\n- **A downstream change that breaks this repo's packaging**, such as\n  home-manager declaring an option that `homeModules.default` in `flake.nix`\n  also declares.\n\nWhen a project that carries Worktrunk is missing from the table, such as a new\nmodule the feedback digest turns up, add it in a PR.\n\n## Weekly Maintenance: Feedback Digest\n\nOpen an issue with a digest of public feedback on Worktrunk since the previous\none, following `references/feedback-digest.md`.\n\n## README Date Check\n\nThe README blockquote opens with a month+year (e.g., \"**April 2026**\"). During daily\nmaintenance, verify the month matches the current month and update it if stale.\n\n## Per-Workflow References\n\n- **PR review**: `@references/review-pr.md` — Rust idioms, documentation accuracy, duplication search\n- **Nightly sweep**: `@references/nightly-cleaner.md` — survey checklist, branch naming, CI-breakage ownership\n","frontmatter":{"name":"running-tend","description":"Worktrunk-specific guidance for tend CI workflows. Adds codecov polling, Rust test commands, labels, and review criteria on top of the bundled tend-ci-runner skills. Use when operating in CI.","metadata":{"internal":true}},"isInternal":true,"tokens":7099,"sizeBytes":28816},{"name":"SKILL.md","path":".claude/skills/writing-user-outputs/SKILL.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/.claude/skills/writing-user-outputs/SKILL.md","title":"writing-user-outputs","category":"anthropic-skill","format":"markdown","content":"---\nname: writing-user-outputs\ndescription: CLI output formatting standards for worktrunk. Load before editing any code that calls warning_message, hint_message, error_message, info_message, eprintln, or println, or that produces strings the user will see (CLI help, progress UI, snapshot text). Documents ANSI color nesting rules, message patterns, and output system architecture.\nmetadata:\n  internal: true\n---\n\n# Output System Architecture\n\n## Shell Integration\n\nWorktrunk uses one file-based directive for shell integration:\n\n1. Shell wrapper creates a temp file via `mktemp`\n2. Shell wrapper sets `WORKTRUNK_DIRECTIVE_CD_FILE`\n3. wt writes a raw path to the file\n4. Shell wrapper changes directory to that path after wt exits\n\n`--execute` always launches its external program directly from wt, with the\nselected worktree as its working directory. It does not use a directive.\n\n## Output Functions\n\nThe output system handles shell integration automatically. Just call output\nfunctions — they do the right thing regardless of whether shell integration is\nactive.\n\n```rust\n// NEVER DO THIS - don't check mode in command code\nif is_shell_integration_active() {\n    // different behavior\n}\n\n// ALWAYS DO THIS - just call output functions\neprintln!(\"{}\", success_message(\"Created worktree\"));\noutput::change_directory(&path)?;  // Writes to directive file if set, else no-op\n```\n\n**Printing output:**\n\nUse `eprintln!` and `println!` from `worktrunk::styling` (re-exported from\n`anstream` for automatic color support and TTY detection):\n\n```rust\nuse worktrunk::styling::{eprintln, println, stderr};\n\n// Status messages to stderr\neprintln!(\"{}\", success_message(\"Created worktree\"));\n\n// Primary output to stdout (tables, shell code, pipeable)\nprintln!(\"{}\", table_output);\n\n// Flush before interactive prompts\nstderr().flush()?;\n```\n\n`src/` holds two crates, and the path differs between them: `worktrunk::styling`\nfrom the binary's modules — the ones `src/main.rs` declares (`commands`, `cli`,\n`display`, …), which the examples throughout this skill are written for — and\n`crate::styling` from the library's, the ones `src/lib.rs` declares (`git`,\n`config`, `shell_exec`, …), where `worktrunk::` does not resolve at all. The\nguard tests accept either, so the compiler is the only thing that tells you the\npath is wrong for the file.\n\nWhich `println!` is in scope decides whether a closed pipe panics: std's\npanics on the `BrokenPipe` write error, anstream's drops it. `wt … | head`\ncloses the pipe, so command code imports the `worktrunk::styling` one and no\n`std::println!` is left in `src/`.\n\nThe stderr macros carry the same rule for a different consequence: anstream's\n`eprint!` / `eprintln!` strip ANSI when stderr isn't a terminal, std's keep it,\nso a file importing one but not the other writes escapes on one line of a\nmessage block and not the next under `wt … 2>log`. `eprint!` is the half that\nslips — it has no newline, so it gets reached for mid-block in a file that\nimported only `eprintln`. Every bare `eprint!` / `eprintln!` under `src/` must\nresolve to anstream's: import it, or qualify the call as\n`styling::eprintln!(…)`. `check_stderr_macros_come_from_styling` in\n`tests/integration_tests/output_system_guard.rs` holds that statically, since\nno snapshot can — the suite forces `CLICOLOR_FORCE=1`, so both printers emit\ncolor and a snapshot agrees whichever macro is in scope. Its\n`STD_STDERR_ALLOWED_PATHS` exempts whole files, not calls, so an entry is only\nright where std's macro is right throughout.\n\nA write that names no macro misses that scan entirely, since the scan looks for\nthe name: `writeln!(std::io::stderr(), …)`, `std::io::stderr().write_all(…)`, a\nlocked handle, a bound one. `check_raw_stderr_writes_go_through_anstream`\nrefuses those shapes too, with its own `RAW_STDERR_ALLOWED_PATHS` — currently\njust `progress.rs`, whose spinner holds one lock across a frame (anstream's\n`stderr()` has none) and is tty-gated, so nothing of its output ever reaches a\nredirected stderr. The shape to watch for is a message rendered in one place\nand printed several layers below, where the printer has no idea it is handling\nnarration: `Cmd::delayed_stream`'s progress line is the example, and a raw\nhandle there made it the only colored line in a redirected `wt switch` log.\n\n**Output whose ANSI is already decided** declares that once at the top of the\ncommand with `worktrunk::styling::ColorChoice::Always.write_global()` and then\nprints through the same anstream macros — the statusline a shell prompt or\nClaude Code renders, and the `--help-page` document whose escapes the docs\npipeline turns into HTML (`--plain` and `--help-md` declare `Never` the same\nway). Neither consumer is ever a tty, so without the declaration anstream\nwould strip their color every time — and the test suite would not catch it,\nbecause it forces color with `CLICOLOR_FORCE=1`;\n`test_color_follows_the_consumer` pins the unforced behavior. Declare `Always`\nonly when the pipe is a courier rather than the destination; anything a person\nreads directly stays on plain anstream, which is what strips color on a pipe\nand honors `NO_COLOR`.\n\n**`--format=json` answers** use `crate::output::print_json` at the command\nhandler. Inner operations return typed facts; when work can complete before a\nlater failure, retain those facts in `CommandFailure<T>`. The outer handler can\nuse `finish_output` to emit the available result once and return the original\nerror for main's readable stderr diagnostics and native exit handling. A path\nwith no result emits nothing; a legitimate JSON null remains a result.\n\n**Shell integration functions** (`src/output/global.rs`):\n\n| Function | Purpose |\n|----------|---------|\n| `change_directory(path)` | Shell cd after wt exits (writes to directive file if set) |\n| `execute(argv)` | Run an external program in the selected worktree |\n| `terminate_output()` | Reset ANSI state on stderr |\n| `is_shell_integration_active()` | Check if directive file set (rarely needed) |\n| `pre_hook_display_path(path)` | Compute display path for pre-hooks |\n| `post_hook_display_path(path)` | Compute display path for post-hooks |\n\n**Message formatting functions** (`worktrunk::styling`):\n\n| Function | Symbol | Color |\n|----------|--------|-------|\n| `success_message()` | ✓ | green |\n| `progress_message()` | ◎ | cyan |\n| `info_message()` | ○ | symbol dim, text plain |\n| `warning_message()` | ▲ | yellow |\n| `hint_message()` | ↳ | dim |\n| `error_message()` | ✗ | red |\n| `prompt_message()` | ❯ | cyan |\n\n**Section headings** (`worktrunk::styling`):\n\n```rust\nuse worktrunk::styling::format_heading;\n\n// Plain heading\nformat_heading(\"BINARIES\", None)  // => \"BINARIES\" (cyan)\n\n// Heading with suffix\nformat_heading(\"USER CONFIG\", Some(\"@ ~/.config/wt.toml\"))\n// => \"USER CONFIG @ ~/.config/wt.toml\" (title cyan, suffix plain)\n```\n\n## stdout vs stderr\n\n**Decision principle:** stdout carries the command's *answer*; stderr carries *narration* about producing it. The discriminating question is answer-vs-narration, not audience — `wt list` is \"for the user\" yet belongs on stdout because it *is* the answer. \"Is this a message to the user?\" doesn't discriminate, because nearly all output is.\n\n- **stdout** → the answer, in whatever format the user selected. Data (tables, JSON, shell code, an expanded template) and `--dry-run` previews both qualify: a preview is the whole answer when nothing mutates. Human-formatted output belongs here too. Color strips automatically on a pipe (anstream), so `wt list | grep` stays safe.\n- **stderr** → narration about doing it: progress, success/warning/error messages, hints, interactive prompts, and `-v`/`-vv` diagnostics.\n- **directive file** → the raw cd path consumed after wt exits.\n\nThe same line can flip streams between modes. `wt config shell uninstall` deletes the file, so `✓ Removed … @ ~/.zshrc` only narrates a side effect that already happened → stderr (the edited file is the answer; stdout is empty). `wt config shell uninstall --dry-run` mutates nothing, so `○ Will remove … @ ~/.zshrc` is the only answer there is → stdout. What flips isn't the wording, it's whether a side effect exists to be the answer.\n\nFor a split preview, the `--format=json` payload is the arbiter: a line json would carry goes to stdout, narration json omits stays on stderr. `wt step prune --dry-run` puts the removal plan on stdout (the same plan json emits) but keeps \"Skipped young-branch (younger than 1d)\" and \"nothing to remove\" on stderr. One case ignores all this: a preview shown *inside* an interactive prompt, such as the `?` re-preview during `wt config shell install`, is mid-prompt narration → stderr.\n\nExamples:\n- `wt list`, `wt config show` → human table/dump or `--format=json`, both to stdout\n- `wt step prune --dry-run` → the removal plan to stdout (human or json); \"nothing to remove\" and skipped-young caveats to stderr\n- `wt config shell init` → shell code to stdout (for `eval`)\n- `wt switch` → status messages only (nothing to pipe)\n\n## When to page output\n\nRoute long, human-oriented stdout through `crate::help_pager::show_help_in_pager`. The helper TTY-detects internally, so piping (`wt … | grep`) keeps working.\n\nPage when output is human-oriented (headings, gutters, structure) and plausibly exceeds one screen. Don't page pipe-first data (tables, JSON, shell code), short output, or output already paged by a delegated tool (`git diff`).\n\nExamples that page: `--help`, `wt config show`, `wt hook show`, `wt step {commit,squash} --dry-run`. Examples that don't: `wt list`, `wt step diff`, `wt step eval`, `--show-prompt` (pipe-first by design).\n\nBuild the whole output into a `String` first (don't stream), then:\n\n```rust\ncrate::help_pager::show_help_in_pager(&out, true)?;\n```\n\nThe helper falls back to plain stdout when paging is disabled or unavailable,\nstdout is not a TTY, or the pager cannot start. Propagate its result so native\nsignal failures and cancellation reach command cleanup.\n\n## Security\n\n- `WORKTRUNK_DIRECTIVE_CD_FILE` holds a raw path (no shell parsing), so it's\n  safe to pass through to alias/hook child processes — a body that writes to it\n  can at worst redirect `cd`.\n\nAll directive env vars are removed from spawned subprocesses by default via\n`shell_exec::scrub_directive_env_vars()`. `DirectivePassthrough::inherit_from_env()`\nre-adds the CD file where a nested command may redirect the parent shell.\n\n## Windows Compatibility (Git Bash / MSYS2)\n\nOn Windows with Git Bash, `mktemp` returns POSIX-style paths like `/tmp/tmp.xxx`.\nThe native Windows binary (`wt.exe`) needs a Windows path to write to the\ndirective file.\n\n**No explicit path conversion is needed.** MSYS2 automatically converts POSIX\npaths in environment variables when spawning native Windows binaries — shell\nwrappers can use `$directive_file` directly. See:\nhttps://www.msys2.org/docs/filesystem-paths/\n\n---\n\n# CLI Output Formatting Standards\n\n## User Message Principles\n\nOutput messages should acknowledge user-supplied arguments (flags, options,\nvalues) by reflecting those choices in the message text.\n\n```rust\n// User runs: wt switch --create feature --base=main\n// GOOD - acknowledges the base branch\n\"Created new worktree for feature from main @ /path/to/worktree\"\n// BAD - ignores the base argument\n\"Created new worktree for feature @ /path/to/worktree\"\n```\n\n**Avoid \"you/your\" pronouns:** Messages should refer to things directly, not\naddress the user. Imperatives like \"Run\", \"Use\", \"Add\" are fine — they're\nconcise CLI idiom.\n\n```rust\n// BAD - \"To rebase your changes onto main, run wt merge\"\n// GOOD - \"To rebase onto main, run wt merge\"\n```\n\n**Avoid redundant parenthesized content:** Parenthesized text should add new\ninformation, not restate what's already said.\n\n```rust\n// BAD - parentheses restate \"no changes\"\n\"No changes after squashing 3 commits (commits resulted in no net changes)\"\n// GOOD - clear and concise\n\"No changes after squashing 3 commits\"\n// GOOD - parentheses add supplementary info\n\"Committing with default message... (3 files, +45, -12)\"\n```\n\n**Two types of parenthesized content with different styling:**\n\n1. **Stats parentheses → Gray** (`[90m` bright-black): Supplementary numerical\n   info that could be omitted without losing meaning.\n   ```\n   ✓ Merged to main (1 commit, 1 file, +1)\n   ◎ Squashing 2 commits into a single commit (2 files, +2)...\n   ```\n\n2. **Reason parentheses → Message color**: Explains WHY an action is happening;\n   integral to understanding.\n   ```\n   ◎ Removing feature worktree & branch in background (same commit as main, _)\n   ```\n\nStats are truly optional context. Reasons answer \"why is this safe/happening?\"\nand belong with the main message. Symbols within reason parentheses still render\nin their native styling (see \"Symbol styling\" below).\n\n**Show path when hooks run in a different directory:** When hooks run in a\nworktree other than the user's current (or eventual) location, show the path.\nUse the appropriate helper function:\n\n1. **Pre-hooks and manual `wt hook`** — User is at cwd, no cd happens.\n   Use `output::pre_hook_display_path(hooks_run_at)`.\n   Examples: pre-commit, pre-merge, pre-remove, manual `wt hook post-merge`.\n\n2. **Post-hooks** — User will cd to destination if shell integration is active.\n   Use `output::post_hook_display_path(destination)`.\n   Examples: pre-start, post-switch, post-start, post-merge (after removal).\n\n```rust\n// Pre-hooks: user is at cwd, no cd happens\nexecute_planned_hook(&plan, anchor, &ctx, HookType::PreMerge, &extra_vars,\n    FailureStrategy::FailFast, crate::output::pre_hook_display_path(ctx.worktree_path))?;\n\n// Post-hooks: user will cd to destination if shell integration active\nregister_planned(&mut announcer, &plan, anchor, &ctx, HookType::PostSwitch, &extra_vars,\n    crate::output::post_hook_display_path(&destination))?;\n```\n\n**Avoid pronouns with cross-message referents:** Hints appear as separate\nmessages from errors. Don't use pronouns like \"it\" that refer to something\nmentioned in the error message.\n\n```rust\n// BAD - \"it\" refers to branch name in error message\n// Error: \"Branch 'feature' not found\"\n// Hint:  \"To create it, use --create\"\n// GOOD - self-contained hint\n// Error: \"Branch 'feature' not found\"\n// Hint:  \"To create a new branch, use --create\"\n```\n\n## Heading Case\n\nUse **sentence case** for help text headings: \"Configuration files\", \"JSON output\", \"LLM commit messages\".\n\n## Message Consistency Patterns\n\nUse consistent punctuation and structure for related messages.\n\n**Ampersand for combined actions:** Use `&` when a single operation does\nmultiple things:\n\n```rust\n\"Removing feature worktree & branch in background\"\n\"Commands approved & saved to config\"\n```\n\n**Semicolon for joining clauses:** Use semicolons to connect related information:\n\n```rust\n\"Removing feature worktree in background; retaining branch (--no-delete-branch)\"\n\"Branch unmerged; to delete, run <underline>wt remove -D</>\"  // hint uses underline\n\"{tool} not authenticated; run <bold>{tool} auth login</>\"       // warning uses bold\n```\n\n**Explicit flag acknowledgment:** Show flags in parentheses when they change\nbehavior:\n\n```rust\n// GOOD - shows the flag explicitly\n\"Removing feature worktree in background; retaining branch (--no-delete-branch)\"\n// BAD - doesn't acknowledge user's explicit choice\n\"Removing feature worktree in background; retaining branch\"\n```\n\n**Flag locality:** Place flag indicators adjacent to the concept they modify.\nFlags should appear immediately after the noun/action they affect, not at the\nend of the message:\n\n```rust\n// GOOD - (--force) is adjacent to \"worktree\" which it modifies\n\"Removing feature worktree (--force) & branch in background (same commit as main, _)\"\n// BAD - (--force) at end, disconnected from the worktree removal it enables\n\"Removing feature worktree & branch in background (same commit as main, _) (--force)\"\n```\n\nThis principle ensures readers can immediately understand what each annotation\nmodifies.\n\n**Parallel structure:** Related messages should follow the same pattern:\n\n```rust\n// GOOD - parallel structure with integration reason explaining branch deletion\n// Target branch is bold; symbol uses its standard styling (dim for _ and ⊂)\n\"Removing feature worktree & branch in background (same commit as <bold>main</>, <dim>_</>)\"  // Integrated\n\"Removing feature worktree in background; retaining unmerged branch\"                          // Unmerged\n\"Removing feature worktree in background; retaining branch (--no-delete-branch)\"              // User flag\n```\n\n**Symbol styling:** Symbols are atomic with their color — the styling is part of\nthe symbol's identity, not a presentation choice. Each symbol has a defined\nappearance that must be preserved in all contexts:\n\n- `_` and `⊂` — dim (integration/safe-to-delete indicators)\n- `+N` and `-N` — green/red (diff indicators)\n\nWhen a symbol appears in a colored message (cyan progress, green success), close\nthe message color before the symbol so it renders in its native styling. This\nrequires breaking out of the message color and reopening it after the symbol.\nSee `FlagNote` in `src/output/handlers.rs` for an example — it handles flag\nacknowledgment notes (like integration reasons) with proper color transitions\nvia its `after(color)` method, which reopens the message color after the symbol.\n\n**Comma + \"but\" + em-dash for limitations:** When stating an outcome with a\nlimitation and its reason:\n\n```rust\n// Outcome, but limitation — reason\n\"Worktree for feature @ ~/repo.feature, but cannot change directory — shell integration not installed\"\n```\n\nThis pattern:\n- States what succeeded (worktree exists at path)\n- Uses \"but\" to introduce what didn't work (cannot cd)\n- Uses em-dash to explain why (shell integration status)\n\nSee `compute_shell_warning_reason()` in `src/output/shell_integration.rs` for the\ncomplete spec of shell integration warning messages and hints\n\n**Compute decisions once:** For background operations, check conditions upfront,\nshow the message, then pass the decision explicitly rather than re-checking in\nbackground scripts:\n\n```rust\n// GOOD - check once, pass decision\nlet should_delete = check_if_merged();\nshow_message_based_on(should_delete);\nspawn_background(build_command(should_delete));\n\n// BAD - check twice (once for message, again in background script)\nlet is_merged = check_if_merged();\nshow_message_based_on(is_merged);\nspawn_background(build_command_that_checks_merge_again());  // Duplicate check!\n```\n\n## Warning Ordering\n\n**Core principle:** Messages about state discovered during evaluation\n(warnings, info notices) appear **before** the action message that follows\nfrom that evaluation.\n\nWhen a command evaluates state, discovers something unexpected, and proceeds\nanyway, that message comes first:\n\n```\n▲ Auto-staging 1 untracked path:\n  notes.md\n◎ Generating commit message...\n```\n\nNot:\n\n```\n◎ Generating commit message...\n▲ Auto-staging 1 untracked path:\n  notes.md\n```\n\nWarnings that result from the action itself (something failed during execution)\nnaturally come after the action.\n\n## Message Types\n\n**Success vs Info:** Success (✓) means something was created or changed. Info\n(○) acknowledges state without changing anything.\n\n| Success ✓                               | Info ○                                |\n| --------------------------------------- | ------------------------------------- |\n| \"Created worktree for feature\"          | \"Switched to worktree for feature\"    |\n| \"Created new worktree for feature\"      | \"Already on worktree for feature\"     |\n| \"Commands approved & saved\"             | \"All commands already approved\"       |\n\nThe same rule governs standalone symbols used as per-row markers in listings:\n✓ marks a completed action, never a state. A listing that reports per-item\nstatus marks it with ○ (state acknowledged) or ❯ (awaiting approval/user\ninput) — the shared vocabulary of `wt hook show` and `wt config approvals\nlist`. Reserve a per-row ✓ for outcomes of work the command just performed\n(shell-install action lines, `-v` subprocess trace glyphs).\n\n**Hint vs Info:** Hints suggest user action or provide additional non-essential\ncontext (supplementary details the user doesn't need but may find useful). Info\nacknowledges state without changing anything.\n\n| Hint ↳                                          | Info ○                                |\n| ------------------------------------------------ | ------------------------------------- |\n| \"To continue, run `wt merge`\"                    | \"Already up to date with main\"        |\n| \"Commit or stash changes first\"                  | \"Skipping hooks (--no-hooks)\"         |\n| \"Branch can be deleted\"                           | \"Worktree preserved (main worktree)\"  |\n| \"Failed command, exit code 128:\"                   |                                       |\n\n**Warning placement:** When something unexpected happens, warn somewhere. Where\ndepends on the nature of the issue:\n\n```\nIs it unexpected?\n├── No → Silent (e.g., gh not installed when no GitHub remote)\n└── Yes → Warn somewhere:\n    ├── Immediate impact OR temporary → Inline (warning_message or in-band indicator)\n    ├── Persists until user action → wt config show (can be checked later)\n    └── Not user-fixable → log::warn! (developer diagnostics)\n```\n\n**Inline warnings** for issues affecting the current command:\n\n| Issue | Why inline |\n|-------|------------|\n| Rate limit during CI fetch | Temporary — won't be there next time |\n| Network timeout | Temporary — retry might work |\n| Hook failed during operation | Immediate impact on this command |\n\n**`wt config show`** for issues that persist until the user fixes them. These\ndon't need to interrupt every command — users can check diagnostics when\ninvestigating:\n\n| Issue | Why config show |\n|-------|-----------------|\n| `gh` not authenticated | User runs `gh auth login` |\n| Shell integration misconfigured | User updates shell config |\n| Config syntax errors | User fixes config file |\n\n**`log::warn!()`** for issues users cannot fix. These help developers debug but\nshouldn't clutter user output:\n\n| Issue | Why log::warn! |\n|-------|----------------|\n| JSON parse error (API changed) | Requires code fix |\n| Internal invariant violated | Developer bug |\n\n**Command suggestions in hints:** When a hint includes a runnable command, use\n\"To X, run Y\" pattern. End with the command for easy copying:\n\n```rust\n// GOOD - command at end for easy copying\n\"To delete the unmerged branch, run wt remove feature -D\"\n\"To rebase onto main, run wt step rebase or wt merge\"\n\n// GOOD - recovery command after shadowing a remote branch\n\"To switch to the remote branch, delete this branch and run without --create: wt remove --foreground feature && wt switch feature\"\n\n// BAD - command without context\n\"wt remove feature -D deletes unmerged branches\"\n\n// BAD - command not at end (hard to copy)\n\"Run wt switch feature (without --create) to switch to the remote branch\"\n```\n\nFor general action guidance without a specific command, direct imperatives are\nclearer:\n\n```rust\n// GOOD - direct imperative for general guidance\n\"Commit or stash changes first\"\n\"Run from inside a worktree, or specify a branch name\"\n\n// VERBOSE - \"To proceed\" adds nothing\n\"To proceed, commit or stash changes first\"\n```\n\n**Description + command in single message:** For warnings/errors that include a\nrecovery command, join with semicolon, and order the recovery \"To X, run Y\" as\nhints do, so the command still ends the line. Use `<bold>` for commands in\nwarnings/errors (only hints use `<underline>`):\n\n```rust\n// Warning with inline recovery command (bold for commands)\nwarning_message(\"Failed to restore stash; to restore manually, run <bold>git stash pop {ref}</>\")\nwarning_message(\"{tool} not authenticated; run <bold>{tool} auth login</>\")\n\n// For longer suggestions, use separate hint message (underline for commands)\nwarning_message(\"Failed to restore stash\")\nhint_message(\"To restore manually, run <underline>git stash pop {ref}</>\")\n```\n\n**Multiple suggestions in one hint:** When a message has a second suggestion,\nfold both into one hint with a semicolon rather than adding another\n`hint_message`, and put the more commonly needed command last for easy\nterminal copying:\n\n```rust\n// GOOD - common action (create) last, easy to select and copy\n\"To list branches, run wt list --branches; to create a new branch, run wt switch feature --create\"\n\n// BAD - common action buried, harder to copy\n\"To create a new branch, run wt switch feature --create; to list branches, run wt list --branches\"\n```\n\nUse `suggest_command()` from `worktrunk::styling` for proper shell escaping.\n\n**Every user-facing message requires either a symbol or a gutter.**\n\n**Section titles:** For sectioned output (`wt hook show`, `wt config show`), use\n`format_heading()` from `worktrunk::styling` (documented above).\n\n## Interactive Prompts vs Non-Interactive Hints\n\nPrompts and hints serve different purposes and have different `--yes` behavior.\n\n**Prompts** are expected steps in a workflow — the user ran a command knowing\nit would ask for confirmation. Hook approval during `wt merge`, config update\nconfirmation, shell install confirmation. `--yes` bypasses these because the\nuser anticipated the question and wants to pre-answer it (e.g., in CI).\n\n**Setup prompts** are unexpected — the user ran `wt merge` and got asked about\nLLM config or shell integration they didn't know about. `--yes` must NOT\nbypass these. A user passing `--yes` to skip hook approval did not consent to\nauto-configuring their shell. In non-interactive mode (no TTY), these should\ndegrade to a hint or be skipped silently — never error.\n\n| Type | Example | `--yes` | Non-TTY behavior |\n|------|---------|---------|------------------|\n| Workflow prompt | Hook approval, config update | Bypasses | Error (`NotInteractive`) |\n| Setup prompt | LLM config, shell integration | No effect | Hint or silent skip |\n\n**Non-TTY degradation patterns:**\n\n- **Hint** — when the user benefits from knowing about the option on every run.\n  Shell integration hint: `↳ To enable automatic cd, run wt config shell install`\n- **Silent skip** — when a hint would be noise. Commit generation setup prompt\n  skips silently because a separate fallback hint (`emit_hint_if_needed`)\n  already covers the unconfigured case on every commit.\n- **Error** — only for workflow prompts where proceeding without consent is\n  unsafe (hook approval). The error includes a hint for the fix:\n  `↳ To skip prompts in CI/CD, add --yes`\n\n**Key invariants:**\n\n- Hints shown in non-TTY mode must NOT set skip flags — hints are not prompts,\n  and should repeat on every non-TTY run\n- `--yes` means \"I anticipated this prompt\" — it applies to workflow prompts\n  the user chose to invoke, not to setup/config discovery prompts\n\n## Blank Line Principles\n\n**Core principle:** When presenting the user with text to read and consider, add\nspacing for readability. When piping output (stdout), keep output dense for\nparsing.\n\nSpecific rules:\n\n- **No leading/trailing blanks** — Start immediately, end cleanly\n- **Blank before prompts, not after** — Signal \"pause, something interactive is\n  happening\" before the prompt; once the user responds, output flows continuously.\n  The blank belongs to the narration it separates from, so the caller emits it\n  and `prompt_yes_no_preview` does not: a prompt that opens a command's output\n  (`wt config shell install`, `wt config plugins claude install`, the\n  commit-generation offer at the top of `wt merge`) starts flush, since a blank\n  there is a leading blank\n- **One blank between phases** — When a sub-operation completes and a different\n  operation begins, add a blank line to visually separate them\n- **Never double blanks** — One blank line maximum between elements\n- **Hints attach to their subject** — Never put a blank line between a hint and\n  the message it elaborates on. Hints (↳) are subordinate — they belong directly\n  below their parent message with no gap.\n\n  ```\n  // GOOD - hint directly follows its subject\n  ↳ fish: Not configured shell extension\n  ↳ To configure, run wt config shell install\n\n  // BAD - blank line detaches hint from subject\n  ↳ fish: Not configured shell extension\n\n  ↳ To configure, run wt config shell install\n  ```\n\n**Prompt spacing:** A blank line before a prompt that follows narration signals\n\"something different is about to happen\" and gives the user's eye a natural\nstopping point before they need to read and respond. No blank line after — the\nuser's input ends the interactive moment and subsequent output flows naturally\nfrom that decision. A prompt with nothing above it, like the setup offer below\nat the top of `wt step commit`, has nothing to separate from and starts flush.\n\n```\n❯ Configure claude for commit messages? [y/N/?] y\n✓ Added to user config:\n  [commit.generation]\n  command = \"...\"\n↳ View config: wt config show\n\n▲ Auto-staging 1 untracked path:\n  a\n◎ Generating commit message...\n```\n\n**Phase separation:** A \"phase\" is a logically distinct operation. The blank\nline between the hint and warning above signals \"config setup is done, now we're\ndoing the main command workflow.\"\n\n**Interactive prompts** must flush stderr before blocking on stdin:\n\n```rust\neprint!(\"❯ Allow and remember? [y/N] \");\nstderr().flush()?;\nio::stdin().read_line(&mut response)?;\n```\n\n## Temporal Locality: Output Should Be Close to Operations\n\nOutput should appear immediately adjacent to the operations it describes.\nProgress messages apply only to slow operations (>400ms): git operations,\nnetwork requests, builds.\n\nSequential operations should show immediate feedback:\n\n```rust\nfor item in items {\n    eprintln!(\"{}\", progress_message(format!(\"Removing {item}...\")));\n    perform_operation(item)?;\n    eprintln!(\"{}\", success_message(format!(\"Removed {item}\")));  // Immediate feedback\n}\n```\n\nBad example (output decoupled from operations):\n\n```\n◎ Removing worktree for feature...\n◎ Removing worktree for bugfix...\n                                    ← Long delay, no feedback\nRemoved worktree for feature        ← All output at the end\nRemoved worktree for bugfix\n```\n\nSigns of poor temporal locality: collecting messages in a buffer, single success\nmessage for batch operations, no progress before slow operations.\n\n## Spinners for Long Single-Operation Work\n\nWhen per-item `progress_message`s don't fit — recursive copy of thousands of\nfiles, a long subprocess with no useful streaming output — a stderr spinner\nkeeps the user oriented. See `src/progress.rs` (`Progress`) for the pattern:\nthe verb (`\"Copying\"`, `\"Removing\"`) is fixed at `Progress::start(verb)`,\nTTY-gate, skip when `verbosity() >= 1` or `--dry-run`, ≥300 ms startup delay\nso fast ops stay silent, IEC bytes (KiB/MiB), clear the line before printing\nthe summary, and have the summary repeat any counters the spinner displayed\n(use `format_stats_paren` for the gray `(N files · X MiB)` suffix).\n\n## Defer Non-Essential Work Until After Primary Output\n\nFire-and-forget cleanup and cache sweeps run after the command's final\nuser-visible message — never before. Placing them at the start delays\ntime-to-first-output with work the user didn't ask for.\n\nWorktrunk marks the boundary with `WORKTRUNK_FIRST_OUTPUT`: handlers\nearly-return where output begins, so work before that return is on the hot\npath, work after it is not. See `handle_remove_command` —\n`run_internal_sweep` runs after `handle_remove_output`.\n\n## Information Display: Show Once, Not Twice\n\nProgress messages should include all relevant details (what's being done,\ncounts, stats, context). Success messages should be minimal, confirming\ncompletion with reference info (hash, path).\n\n```rust\n// GOOD - detailed progress, minimal success\neprintln!(\"{}\", progress_message(\"Squashing 3 commits & working tree changes into a single commit (5 files, +60)...\"));\nperform_squash()?;\neprintln!(\"{}\", success_message(\"Squashed @ a1b2c3d\"));\n```\n\n## Section and Glyph Spacing\n\nWhen composing tightly-packed output where adjacent pieces carry distinct\nmeaning (the statusline segments, prefix-char indicators like `@+1`, `↓1`,\n`?^|`), pack sections flush — no separating space. The marker and its value\nread as one unit, and visual density keeps the line short.\n\nThe one exception is **emoji**: leave a trailing space after an emoji glyph.\nMost terminals render emoji as double-width and bleed the glyph into the cell\nto its right, so a flush `🌔65%` collides the moon with the digits. A space\n(`🌔 65%`) keeps them legible. ASCII and narrow Unicode markers (`@`, `↓`, `●`,\n`⊂`) don't have this problem and stay flush.\n\n```rust\n// GOOD - ASCII marker flush with its value\nformat!(\"@{added}\");          // @+1\n// GOOD - emoji gets a trailing space to clear the next cell\nformat!(\"{moon} {pct:.0}%\");  // 🌔 65%\n// BAD - emoji runs into the digits; terminals overlap the glyph\nformat!(\"{moon}{pct:.0}%\");   // 🌔65%\n```\n\n## Style Constants\n\nOnly three `anstyle` constants exist for table rendering (`src/styling/constants.rs`):\n\n- `ADDITION`: Green (diffs)\n- `DELETION`: Red (diffs)\n- `GUTTER`: BrightWhite background\n\nFor everything else, use `cformat!` tags.\n\n## Styling in Command Code\n\nUse `eprintln!` with formatting functions. Use `cformat!` for inner styling:\n\n```rust\neprintln!(\"{}\", success_message(cformat!(\"Created <bold>{branch}</> from <bold>{base}</>\")));\neprintln!(\"{}\", hint_message(cformat!(\"To continue, run <underline>wt merge</>\")));\n```\n\n**color-print tags:** `<bold>`, `<dim>`, `<underline>`, `<bright-black>`, `<red>`,\n`<green>`, `<yellow>`, `<cyan>`, `<magenta>`\n\n**Branch names and status values** should be bolded in messages.\n\n**Symbol constants in cformat!:** For messages that bypass output:: functions\n(e.g., `GitError` Display impl), use symbol constants directly:\n\n```rust\ncformat!(\"{ERROR_SYMBOL} <red>Branch <bold>{branch}</> not found</>\")\n```\n\n## Commands and Branches in Messages\n\nNever quote commands or branch names. Use styling to make them stand out:\n\n- **In normal font context**: Use `<bold>` for commands and branches\n- **In hints**: Use `<underline>` for commands and data values (paths,\n  branches). Underline is safe inside `<dim>` — closing `[24m` only resets\n  underline, preserving dim. Avoid `<bold>` inside hints — the closing `[22m`\n  resets both bold AND dim, so text after `</bold>` loses dim styling.\n\n```rust\n// GOOD - bold in normal context\neprintln!(\"{}\", info_message(cformat!(\"To continue, use <bold>wt merge</>\")));\n// GOOD - underline for commands in hints\neprintln!(\"{}\", hint_message(cformat!(\"To see worktrees, run <underline>wt list</>\")));\n// BAD - quoted commands\neprintln!(\"{}\", hint_message(\"To see worktrees, run 'wt list'\"));\n```\n\n## Hyperlinks\n\nEvery OSC 8 link is underlined. Link text is sized to fit a column (`#3604`,\n`:11486`) and reads as ordinary content, and color already carries state (the\nCI verdict, dim for a port nothing answers on), so the underline is what marks\na run of text as clickable.\n\n`worktrunk::styling::hyperlink(url, text)` emits the link and its underline\ntogether, which is what keeps the rule true at every call site. It closes with\n`[24m`, leaving a surrounding color or dim intact.\n\n```rust\n// GOOD - the helper carries the underline\nlet cell = hyperlink(url, &format!(\":{port}\"));\n// GOOD - a caller's own style wraps the link\nformat!(\"{style}{}{style:#}\", hyperlink(url, text))\n// BAD - hand-assembled sequences, unmarked link\nformat!(\"{}{text}{}\", osc8::Hyperlink::new(url), osc8::Hyperlink::END)\n```\n\nText that isn't a link stays plain, and whether a run of text is a link belongs\nto the render rather than to the cell emitting it: `LayoutConfig::link_style`\nanswers it once for a whole row, so a CI reference and a dev-server port can't\ndisagree. Two destinations carry no links, and so no underline: a terminal\nwithout OSC 8 support, where `wt list` prints the dev-server URL in full, and\nthe picker's rows, which `Destination::picker` renders as\n`LinkStyle::Unlinked` (that variant's docstring has the reason). Nothing in the\npicker is clickable, by two routes: a row's link style is decided at render\ntime, so it carries no OSC 8 to begin with, and the preview pane is parsed by\nskim through `ansi_to_tui`, which keeps none. Underline there is\nfree to mean something else, and the preview pane spends it twice: on a URL,\nmarking a reference rather than a link (`pr_pane::url_line`), and on the active\ntab in the tab bar (`items::render_preview_tabs`).\n\n## Design Principles\n\n- **`cformat!` for styling** — Never manual escape codes (`\\x1b[...`)\n- **`cformat!` variables are safe** — Tags like `<bold>` are processed at compile\n  time only. Runtime variable values are NOT interpreted as markup, so user\n  content (branch names, commit messages, paths, shell commands with `<`/`>`\n  redirects) can be interpolated directly without escaping. Do NOT escape\n  `<`/`>` in variables — it adds extra chars.\n- **YAGNI** — Most output needs no styling\n- **Graceful degradation** — Styling follows the consumer (NO_COLOR, TTY\n  detection). Plain output preserves meaning through wording, spacing and\n  existing semantic symbols. Missing decoration alone does not justify new\n  markers; add text when information would otherwise be lost.\n- **Unicode-aware** — Width calculations respect symbols and CJK (via `StyledLine`)\n\n**StyledLine** for table rendering with proper width calculations:\n\n```rust\nuse worktrunk::styling::StyledLine;\nuse anstyle::{AnsiColor, Color, Style};\n\nlet mut line = StyledLine::new();\nline.push_styled(\"Branch\", Style::new().dimmed());\nline.push_raw(\"  \");\nline.push_styled(\"main\", Style::new().fg_color(Some(Color::Ansi(AnsiColor::Cyan))));\nprintln!(\"{}\", line.render());\n```\n\nSee `src/commands/list/render.rs` for advanced usage.\n\n## Documentation Examples\n\nUse consistent examples throughout all documentation, help text, and config\ntemplates.\n\n### Canonical example setup\n\n| Element | Value | Notes |\n|---------|-------|-------|\n| Repo directory | `myproject` | Generic placeholder |\n| Repo path | `~/code/myproject` | Realistic dev path |\n| Branch | `feature/auth` | Shows sanitize filter |\n| Worktree path | `~/code/myproject.feature-auth` | Result of default template |\n\n### Template variable examples\n\nUse the canonical values from the table above in all examples:\n\n```\n{{ repo }}           — Repository directory name (e.g., `myproject`)\n{{ branch }}         — Branch name (e.g., `feature/auth`)\n{{ worktree_path }}  — Absolute path to worktree (e.g., `/path/to/myproject.feature-auth`)\n```\n\nIn TOML comments:\n```toml\n#   {{ repo }}           - Repository directory name (e.g., \"myproject\")\n#   {{ branch }}         - Raw branch name (e.g., \"feature/auth\")\n#   {{ worktree_name }}  - Worktree directory name (e.g., \"myproject.feature-auth\")\n```\n\n### Worktree path examples\n\nWhen showing worktree-path template examples:\n\n```toml\n# Default — siblings in parent directory\n# Creates: ~/code/myproject.feature-auth\nworktree-path = \"../{{ repo }}.{{ branch | sanitize }}\"\n\n# Inside the repository\n# Creates: ~/code/myproject/.worktrees/feature-auth\nworktree-path = \".worktrees/{{ branch | sanitize }}\"\n```\n\n## Gutter Formatting\n\nUse gutter for **quoted content** (git output, commit messages, config to copy,\nhook commands being displayed).\n\nThe gutter is a background-colored blank column followed by a space. Plain\noutput keeps the two-space indent. Gutter examples in this skill show that plain\nform.\n\n- `format_bash_with_gutter()` — shell commands (dimmed + syntax highlighting)\n- `format_with_gutter()` — other content\n\n**Gutter vs Table:** Tables for structured app data; gutter for quoting external\ncontent.\n\n**Gutter vs Hints:** Command suggestions in hints use inline `<underline>`,\nnot gutter. Gutter is for displaying content (what will execute, config to\ncopy); hints suggest what the user should run.\n\n## Newline Convention\n\n**Core principle:** All formatting functions return content WITHOUT trailing\nnewlines. Callers handle element separation.\n\nThis applies to:\n- Message functions: `error_message()`, `success_message()`, `hint_message()`, etc.\n- Gutter functions: `format_with_gutter()`, `format_bash_with_gutter()`\n\n**With `eprintln!`:** Adds trailing newline automatically.\n\n```rust\neprintln!(\"{}\", progress_message(\"Merging...\"));\neprintln!(\"{}\", format_with_gutter(&log, None));\n```\n\n**In Display impls:** Use explicit newlines for element separation.\n\n```rust\n// Pattern: leading \\n separates from previous element\nwrite!(f, \"{}\", error_message(...))?;           // first element, no leading \\n\nwrite!(f, \"\\n{}\", format_with_gutter(...))?;    // gutter, separated by \\n\nwrite!(f, \"\\n{}\", hint_message(...))            // hint, separated by \\n\n\n// For blank line between elements, add extra \\n\nwrite!(f, \"\\n{}\\n\", format_with_gutter(...))?;  // trailing \\n creates blank line\nwrite!(f, \"\\n{}\", hint_message(...))            // hint after blank line\n```\n\n**Don't add trailing `\\n` to content:**\n\n```rust\n// GOOD - eprintln! adds newline\neprintln!(\"{}\", progress_message(\"Merging...\"));\n\n// BAD - double newline\neprintln!(\"{}\", progress_message(\"Merging...\\n\"));\n```\n\n**Avoid bullets — use gutter instead.** Instead of `\"\\n  - {}: {}\"` bullet\nformatting, use `format_with_gutter()` to present lists.\n\n## Error Formatting\n\n### Error Message Structure\n\nError and warning messages should communicate four things:\n\n1. **What happened** — The actual state or outcome\n2. **What was expected** — The correct or desired state\n3. **The impact** — Why this matters (optional for obvious cases)\n4. **How to resolve** — What the user should do (can be a separate hint message)\n\n```rust\n// GOOD - states actual, expected, and impact in main message\n\"Shell probe: wt is binary at /path, not function — won't auto-cd\"\n//                 ^^^^^^^^^^^^^^^   ^^^^^^^^^^^^   ^^^^^^^^^^^^^^\n//                 actual            expected       impact\n// Resolution in separate hint: \"Restart shell to activate\"\n\n// GOOD - actual vs expected with resolution inline\n\"Config file has 3 errors, expected valid TOML; run wt config validate for details\"\n//              ^^^^^^^    ^^^^^^^^                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n//              actual     expected                  resolution\n\n// BAD - only states actual, no expected or impact\n\"Shell probe: wt resolves to binary at /path\"\n// Missing: what should it be instead? why does it matter?\n\n// BAD - vague, no actionable information\n\"Shell integration problem detected\"\n// Missing: what's wrong? what should it be? what to do?\n```\n\nWhen the expected state is obvious from context, it can be implied:\n\n```rust\n// OK - expected state (file should exist) is obvious\n\"Config file not found at ~/.config/wt/config.toml\"\n\n// OK - expected state (should succeed) is obvious\n\"Failed to read config: permission denied\"\n```\n\n**Diagnostic messages** (like `wt config show`) should follow this pattern\nespecially carefully — users read diagnostics to understand what's wrong.\n\n### Single vs Multi-line\n\n**Single-line errors** with variables are fine:\n\n```rust\n// GOOD - single-line with path variable\n.map_err(|e| format!(\"Failed to read {}: {}\", format_path_for_display(path), e))?\n\n// GOOD - using .context() for simple errors\nstd::fs::read_to_string(&path).context(\"Failed to read config\")?\n```\n\n**Multi-line external output** (git, hooks, LLM) needs gutter:\n\n1. Show the command that was run (with arguments)\n2. Put multi-line output in a gutter\n\n```\n✗ Commit generation command 'llm --model claude' failed\n  Error: [Errno 8] nodename nor servname provided\n\n// NOT: ✗ ... failed: LLM command failed: Error: [Errno 8]...\n```\n\nSee `src/git/error.rs` for examples of this pattern in `GitError` Display impls.\n\n## Verbose Output (`-v` and `-vv`)\n\n**`-v` (verbose):** User-facing diagnostic output. Must follow these guidelines.\nShows template expansions and other details users might need for debugging config.\n\nTemplate expansion shows the source template and the rendered result as two\nlabeled blocks. Each block is a bash gutter (dim + syntax highlighting via\n`format_bash_with_gutter`) under its own info header (`○` symbol, bold name,\nthen `source` or `result`):\n```\n○ name source\n  template\n○ name result\n  result\n```\n\nThe two headers carry the input/output distinction, so both blocks share the\nsame gutter and the content always starts at the gutter's column 2 (no marker\nglyph or extra indent inside the gutter). Multi-line templates and results\nfollow the same shape, one gutter line per source line.\n\n`expand_template` emits no trailing blank, so a standalone caller adds one to\nseparate the block from what follows (`wt step eval` does this after the view).\nIn a command pipeline the executor already separates the block from the next\noutput, so the expansion adds nothing.\n\n**`-vv` (debug):** Developer-facing logging output. MAY violate these guidelines.\nUses `log::debug!()` with structured format for deep debugging. Not intended for\nregular users.\n\n## Path Formatting\n\n**All user-facing paths must use `format_path_for_display()`** from\n`worktrunk::path`. This function replaces home directory prefixes with `~` for\nreadability (e.g., `/Users/alex/projects/repo` → `~/projects/repo`).\n\n**Use `@` (not \"at\") before paths in all user-facing output.** This is the\ncodebase convention for associating an entity with a location — in status\nmessages, section headings, hints, and everywhere else:\n\n```rust\n// GOOD - @ before path\n\"Created worktree for feature @ ~/code/repo.feature\"\n\"Squashed @ a1b2c3d\"\n\"Worktree for feature @ ~/repo.feature, but cannot change directory...\"\nformat_heading(\"USER HOOKS\", Some(&format!(\"@ {}\", format_path_for_display(p))))\n\n// BAD - \"at\" before path\n\"Created worktree for feature at ~/code/repo.feature\"\n// BAD - heading without @\nformat_heading(\"USER HOOKS\", Some(&format_path_for_display(p)))\n```\n\n**Exception:** Prose contexts (doc comments, help text) use \"at\" — `@` is for\nterse output only.\n\n```rust\nuse worktrunk::path::format_path_for_display;\n\n// GOOD - uses format_path_for_display\neprintln!(\"{}\", success_message(cformat!(\n    \"Created worktree @ {}\",\n    format_path_for_display(&worktree_path)\n)));\n\n// GOOD - error messages too\n.map_err(|e| format!(\"Failed to read {}: {}\", format_path_for_display(path), e))?\n\n// BAD - raw path.display()\neprintln!(\"{}\", success_message(format!(\n    \"Created worktree @ {}\",\n    worktree_path.display()  // Shows /Users/alex/... instead of ~/...\n)));\n```\n\n**Applies to:**\n- Success/info/warning/error messages\n- Section headings (`format_heading` with path suffix)\n- Hints suggesting paths\n- Progress messages\n- Dry-run previews\n\n**Exceptions:**\n- Debug logging (`log::debug!`) — full paths help debugging\n- Paths passed to git commands — must be real paths\n\n## Table Column Alignment\n\n- **Text columns** (Branch, Path, Message): left-aligned\n- **Single-value numeric columns** (Age): right-aligned, so `now` and `4m` line\n  up on the unit\n- **Diff columns** (@±, ^↕): two right-aligned halves either side of a\n  separator (`+999 -999`); a state for the whole field, such as a loading or\n  in-sync marker, is centered\n\nA header follows its content, except over a diff column, where it centres:\npushed to either edge it stands over one half and reads as that half's label,\nleaving a lone `+1` stranded left of `@±`.\n\nRows carry no trailing padding. Padding places a cell; past the last one it\nplaces nothing, and a reader who selects the row gets it anyway.\n\n## Snapshot Testing\n\nEvery command output must have snapshot tests (`tests/integration_tests/`).\nSee `tests/integration_tests/remove.rs` for the standard pattern using\n`setup_snapshot_settings()`, `make_snapshot_cmd()`, and `assert_cmd_snapshot!()`.\n\nCover success/error states, with/without data, and flag variations.\n","frontmatter":{"name":"writing-user-outputs","description":"CLI output formatting standards for worktrunk. Load before editing any code that calls warning_message, hint_message, error_message, info_message, eprintln, or println, or that produces strings the user will see (CLI help, progress UI, snapshot text). Documents ANSI color nesting rules, message patterns, and output system architecture.","metadata":{"internal":true}},"isInternal":true,"tokens":11249,"sizeBytes":48077},{"name":"CLAUDE.md","path":"plugins/worktrunk/CLAUDE.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/CLAUDE.md","title":"Worktrunk Skill","category":"anthropic-skill","format":"markdown","content":"# Worktrunk Skill\n\nPath: `plugins/worktrunk/CLAUDE.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/CLAUDE.md)","tokens":300,"sizeBytes":172},{"name":"hooks.json","path":"plugins/worktrunk/hooks/hooks.json","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/hooks/hooks.json","title":"Hooks Skill","category":"anthropic-skill","format":"json","content":"# Hooks Skill\n\nPath: `plugins/worktrunk/hooks/hooks.json`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/hooks/hooks.json)","tokens":300,"sizeBytes":182},{"name":"claude-code.md","path":"plugins/worktrunk/skills/worktrunk/reference/claude-code.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/claude-code.md","title":"Reference Skill","category":"anthropic-skill","format":"markdown","content":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/claude-code.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/claude-code.md)","tokens":300,"sizeBytes":236},{"name":"code-signing.md","path":"plugins/worktrunk/skills/worktrunk/reference/code-signing.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/code-signing.md","title":"Reference Skill","category":"anthropic-skill","format":"markdown","content":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/code-signing.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/code-signing.md)","tokens":300,"sizeBytes":238},{"name":"config.md","path":"plugins/worktrunk/skills/worktrunk/reference/config.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/config.md","title":"Reference Skill","category":"anthropic-skill","format":"markdown","content":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/config.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/config.md)","tokens":300,"sizeBytes":226},{"name":"extending.md","path":"plugins/worktrunk/skills/worktrunk/reference/extending.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/extending.md","title":"Reference Skill","category":"anthropic-skill","format":"markdown","content":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/extending.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/extending.md)","tokens":300,"sizeBytes":232},{"name":"faq.md","path":"plugins/worktrunk/skills/worktrunk/reference/faq.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/faq.md","title":"Reference Skill","category":"anthropic-skill","format":"markdown","content":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/faq.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/faq.md)","tokens":300,"sizeBytes":220},{"name":"hook.md","path":"plugins/worktrunk/skills/worktrunk/reference/hook.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/hook.md","title":"Reference Skill","category":"anthropic-skill","format":"markdown","content":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/hook.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/hook.md)","tokens":300,"sizeBytes":222},{"name":"list.md","path":"plugins/worktrunk/skills/worktrunk/reference/list.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/list.md","title":"Reference Skill","category":"anthropic-skill","format":"markdown","content":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/list.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/list.md)","tokens":300,"sizeBytes":222},{"name":"llm-commits.md","path":"plugins/worktrunk/skills/worktrunk/reference/llm-commits.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/llm-commits.md","title":"Reference Skill","category":"anthropic-skill","format":"markdown","content":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/llm-commits.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/llm-commits.md)","tokens":300,"sizeBytes":236},{"name":"merge.md","path":"plugins/worktrunk/skills/worktrunk/reference/merge.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/merge.md","title":"Reference Skill","category":"anthropic-skill","format":"markdown","content":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/merge.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/merge.md)","tokens":300,"sizeBytes":224},{"name":"remove.md","path":"plugins/worktrunk/skills/worktrunk/reference/remove.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/remove.md","title":"Reference Skill","category":"anthropic-skill","format":"markdown","content":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/remove.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/remove.md)","tokens":300,"sizeBytes":226},{"name":"shell-integration.md","path":"plugins/worktrunk/skills/worktrunk/reference/shell-integration.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/shell-integration.md","title":"Reference Skill","category":"anthropic-skill","format":"markdown","content":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/shell-integration.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/shell-integration.md)","tokens":300,"sizeBytes":248},{"name":"step.md","path":"plugins/worktrunk/skills/worktrunk/reference/step.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/step.md","title":"Reference Skill","category":"anthropic-skill","format":"markdown","content":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/step.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/step.md)","tokens":300,"sizeBytes":222},{"name":"switch.md","path":"plugins/worktrunk/skills/worktrunk/reference/switch.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/switch.md","title":"Reference Skill","category":"anthropic-skill","format":"markdown","content":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/switch.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/switch.md)","tokens":300,"sizeBytes":226},{"name":"tips-patterns.md","path":"plugins/worktrunk/skills/worktrunk/reference/tips-patterns.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/tips-patterns.md","title":"Reference Skill","category":"anthropic-skill","format":"markdown","content":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/tips-patterns.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/tips-patterns.md)","tokens":300,"sizeBytes":240},{"name":"troubleshooting.md","path":"plugins/worktrunk/skills/worktrunk/reference/troubleshooting.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/troubleshooting.md","title":"Reference Skill","category":"anthropic-skill","format":"markdown","content":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/troubleshooting.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/troubleshooting.md)","tokens":300,"sizeBytes":244},{"name":"worktrunk.md","path":"plugins/worktrunk/skills/worktrunk/reference/worktrunk.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/worktrunk.md","title":"Reference Skill","category":"anthropic-skill","format":"markdown","content":"# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/worktrunk.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/worktrunk.md)","tokens":300,"sizeBytes":232},{"name":"SKILL.md","path":"plugins/worktrunk/skills/worktrunk/SKILL.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/SKILL.md","title":"worktrunk","category":"anthropic-skill","format":"markdown","content":"---\nname: worktrunk\ndescription: Guidance for Worktrunk (the `wt` CLI) — git worktree management, hooks, and config. Load when working out which worktree a `wt` command will act on, or reaching for the global `-C <path>` to target one; editing .config/wt.toml or ~/.config/worktrunk/config.toml; adding, modifying, or debugging hooks (post-merge, post-start, pre-commit, pre-merge, post-switch, etc.); configuring commit message generation or command aliases; or troubleshooting wt behavior. Also answers general worktrunk/wt questions.\nlicense: MIT OR Apache-2.0\ncompatibility: Requires the `wt` CLI (https://worktrunk.dev)\n---\n\n# Worktrunk\n\nHelp users work with Worktrunk, a CLI tool for managing git worktrees.\n\n## Available documentation\n\nReference files are synced from [worktrunk.dev](https://worktrunk.dev) documentation:\n\n- **reference/config.md**: User and project configuration (LLM, hooks, command defaults)\n- **reference/hook.md**: Hook types, timing, and execution order\n- **reference/switch.md**, **merge.md**, **list.md**, etc.: Command documentation\n- **reference/extending.md**: Aliases, multi-step pipelines, custom subcommands, and template-expansion gotchas (two-pass `{% raw %}` deferral, for-each recipes)\n- **reference/llm-commits.md**: LLM commit message generation\n- **reference/tips-patterns.md**: Practical recipes — aliases, per-branch variables, dev server per worktree, parallel agent patterns\n- **reference/shell-integration.md**: Shell integration debugging\n- **reference/troubleshooting.md**: Troubleshooting for LLM and hooks (Claude-specific)\n\nFor command-specific options, run `wt <command> --help`. For configuration, follow the workflows below.\n\n## Which worktree a command acts on\n\n`wt` finds the *repository* from the working directory, and the *worktree* from the command's own arguments. Two rules cover every case:\n\n1. **A command that names a branch already names its worktree.** Worktrees are addressed by branch name, so `wt switch <branch>`, `wt remove <branch>`, `wt step diff --branch <branch>`, and `wt config state marker set --branch <branch>` act on that branch's worktree no matter which worktree you run them from. Every such argument also accepts the worktree's own path, for the cases a branch cannot name — a second checkout of the same branch, or a detached worktree (which `marker` still rejects, since it keys state by branch name).\n2. **`-C <path>` moves the working directory, not the worktree selection.** Reach for it when the repository lookup is what's wrong: a *different* repository; a command that acts on the current worktree and takes no branch argument (`wt merge`, `wt step rebase|squash|push` — their `[TARGET]` is the merge target, not a worktree); or a caller whose working directory isn't inside a repository at all, such as an agent hook the host pins elsewhere.\n\nLayering `-C` on top of a branch argument names the same worktree twice. From inside the `alpha` worktree of a repo that also has `beta`:\n\n```bash\nwt step diff --branch beta                    # ✓ the branch argument selects the worktree\nwt -C ../repo.beta step diff --branch beta    # ✗ says beta twice\n\nwt switch --create beta                       # ✓ --base already defaults to the default branch\nwt -C ../repo switch --create beta            # ✗ -C adds nothing; you are already in that repo\n```\n\n## Two types of configuration\n\nWorktrunk uses two config files with different scopes and permission models:\n\n**User config** (`~/.config/worktrunk/config.toml`, never checked into git) holds personal preferences: LLM integration, worktree path templates, command settings, user hooks. Treat it conservatively — propose changes and get consent before editing, never install tools on the user's behalf, and preserve the file's existing structure and comments. See `reference/config.md`.\n\n**Project config** (`<repo>/.config/wt.toml`, checked into git) holds team-wide automation: hooks for the worktree lifecycle (pre-start, pre-merge, etc.). Edit proactively — changes are versioned and reversible via git. Comment why each hook exists, and warn the user before adding destructive commands (`rm -rf`, `DROP TABLE`), network fetches piped to shells, or `sudo`. See `reference/hook.md`.\n\nSome requests span both: commit-message generation is user config, while the team's quality checks are project config.\n\n## Core workflows\n\n### Setting up commit message generation (user config)\n\nDetect which tools are installed (`which claude codex opencode pi`); if none, recommend Claude Code. Take the exact command for the chosen tool from `reference/llm-commits.md`, propose the `[commit.generation]` change, and apply it after approval (`wt config create` first if no config exists). To verify, `wt step commit --dry-run` renders the prompt, runs the LLM, and prints the message without committing.\n\n### Configuring project hooks\n\nPick the hook type by when the command should run and whether it may block — `reference/hook.md` maps all ten (5 events × pre/post) to their timing and typical uses.\n\nDerive the commands from the project itself (`package.json` scripts, `Cargo.toml`, `pyproject.toml`) and verify they run before adding them.\n\nWhen a new hook must wait for an existing one, convert the entry to a pipeline; independent commands in a named table run concurrently:\n\n```toml\n# Pipeline: install completes before migrate starts\n[[pre-start]]\ninstall = \"npm install\"\n\n[[pre-start]]\nmigrate = \"npm run db:migrate\"\n\n# Concurrent: independent commands in one table\n[pre-start]\ninstall = \"npm install\"\nenv = \"cp .env.example .env\"\n```\n\nTest with `wt switch --create test-hooks`.\n\n## Common tasks reference\n\n### User config tasks\n- Set up commit message generation → `reference/llm-commits.md`\n- Customize worktree paths → `reference/config.md#worktree-path-template`\n- Custom commit templates → `reference/llm-commits.md#prompt-templates`\n- Configure command defaults → `reference/config.md#command-config`\n- Set up personal hooks → `reference/config.md#user-hooks`\n\n### Project config tasks\n- Set up hooks for new project → `reference/hook.md`\n- Add hook to existing config → `reference/hook.md#hook-forms`\n- Use template variables → `reference/hook.md#template-variables`\n- Add dev server URL to list → `reference/config.md#dev-server-url`\n\n### Aliases & multi-worktree tasks\n- Create a `wt` alias → `reference/extending.md#aliases`\n- Run a command in every worktree → `reference/step.md#wt-step-for-each`\n- Rebase every worktree (up-style) → `reference/extending.md#recipe-rebase-every-worktree-onto-its-upstream`\n- Pass a template to a nested `wt` command → `reference/extending.md#nesting-templates`\n\n## Key commands\n\n```bash\n# View all configuration\nwt config show\n\n# Create initial user config (LLM/commit setup: see reference/llm-commits.md)\nwt config create\n\n# Full config reference (subcommands, templates, env vars)\nwt config --help\n```\n\n## Hook approvals in non-interactive sessions\n\nWorktrunk never runs a project's hooks or aliases until the user has explicitly approved them. The commands in `.config/wt.toml` are arbitrary shell code shipped in a repository the user may have just cloned, so on first run Worktrunk shows each command and waits for the user to approve it — an untrusted `.config/wt.toml` cannot silently execute anything. Approvals are stored per-project in `~/.config/worktrunk/approvals.toml` and re-prompted whenever a command template changes, so a hook can't be swapped for a different command after it was approved.\n\nAgents running `wt merge`, `wt switch`, or other commands that trigger hooks will hit an error like:\n\n```\n▲ cargo-difftest needs approval to execute 1 command:\n○ post-merge install:\n  cargo install --path .\n✗ Cannot prompt for approval in non-interactive environment\n↳ To skip prompts in CI/CD, add --yes; to pre-approve commands, run wt config approvals add --yes\n```\n\nThe resolution is for the user to make the trust decision themselves:\n\n- **`wt config approvals add`** — interactive prompt where the user reviews each command before it is stored to `~/.config/worktrunk/approvals.toml`. Run once per project; the approval persists across invocations until the command template changes or the project moves. This is the path to recommend — the user reviews and consents to exactly the commands that will run.\n\n**When invoked as an agent, stop and escalate to the user.** Approving a project's hooks is a security decision about whether this repository should be trusted to run arbitrary commands on the user's machine — that decision belongs to the user, not the agent. Tell the user to run `wt config approvals add` and let them review the commands. Do not reach for either `--yes` on the user's behalf: on the blocked command it skips the gate for that invocation, and `wt config approvals add --yes` records every command the project declares with nobody reading them. Both exist for CI/CD pipelines and containers that already control their own hook contents; neither is a shortcut for an interactive agent to silence an approval prompt.\n\n## Advanced: agent handoffs\n\nWhen the user requests spawning a worktree with an agent in a background session (\"spawn a worktree for...\", \"hand off to another agent\"), use the tmux or Zellij command from `reference/tips-patterns.md#agent-handoffs` with the CLI you are running as in place of `claude`, following that section's note on where a subcommand such as OpenCode's `run` goes.\n\n**Requirements** (all must be true):\n- User explicitly requests spawning/handoff\n- User is in a supported multiplexer (check `$TMUX` / `$ZELLIJ`)\n- The user's project instructions (`CLAUDE.md` or `AGENTS.md`) or an explicit prompt authorize this pattern\n\n**Do not use this pattern** for normal worktree operations.\n\n### Parallel sub-Agents (single Claude Code session)\n\nTo spawn multiple sub-Agents that each work in their own worktree from one Claude Code session — no terminal multiplexer, no human in the other pane — pre-start each worktree from the parent and pass the path into the sub-Agent prompt:\n\n```bash\nwt switch --create <branch> --no-cd\n```\n\nThen call the `Agent` tool **without** `isolation: \"worktree\"`, naming the path in the prompt:\n\n```\nYou are working in `/abs/path/to/myproject.<branch>` on branch `<branch>`.\nAll edits must stay in that worktree.\n```\n\n`--no-cd` skips the shell-integration cd script the parent can't consume. Add `--no-hooks` only when no user or project hooks provision the worktree and each sub-Agent does its own build/test step (e.g. `cargo run -- hook pre-merge --yes`) — a `pre-start` hook that installs dependencies or links a gitignored build environment hands the sub-Agent a worktree it can't build in when it's skipped. Leaving hooks on needs the project's hook commands already approved: the parent session can't prompt, so an unapproved command in `.config/wt.toml` aborts the create — see **Hook approvals in non-interactive sessions** above.\n\n**Do not** use `Agent { isolation: \"worktree\" }` for this. Claude Code passes its internal agent ID as `name` to the `WorktreeCreate` hook, so `wt` creates the worktree as `myproject.agent-<id>` on a throwaway branch. If the sub-Agent then creates a feature branch on top, you end up with non-canonical paths, orphan branches, and post-start hooks fired against the wrong branch. Pre-creating with `wt switch --create` keeps path, branch, and hook target aligned.\n","frontmatter":{"name":"worktrunk","description":"Guidance for Worktrunk (the `wt` CLI) — git worktree management, hooks, and config. Load when working out which worktree a `wt` command will act on, or reaching for the global `-C <path>` to target one; editing .config/wt.toml or ~/.config/worktrunk/config.toml; adding, modifying, or debugging hooks (post-merge, post-start, pre-commit, pre-merge, post-switch, etc.); configuring commit message generation or command aliases; or troubleshooting wt behavior. Also answers general worktrunk/wt questions.","license":"MIT OR Apache-2.0","compatibility":"Requires the `wt` CLI (https://worktrunk.dev)"},"isInternal":false,"tokens":2652,"sizeBytes":11461},{"name":"rationale.md","path":"plugins/worktrunk/skills/wt-switch-create/rationale.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/wt-switch-create/rationale.md","title":"Wt-switch-create Skill","category":"anthropic-skill","format":"markdown","content":"# Wt-switch-create Skill\n\nPath: `plugins/worktrunk/skills/wt-switch-create/rationale.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/wt-switch-create/rationale.md)","tokens":300,"sizeBytes":233},{"name":"SKILL.md","path":"plugins/worktrunk/skills/wt-switch-create/SKILL.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/wt-switch-create/SKILL.md","title":"wt-switch-create","category":"anthropic-skill","format":"markdown","content":"---\nname: wt-switch-create\ndescription: Create a new worktrunk worktree (optionally in another repo) and switch this session's working directory into it. Use when launching a session that should work in its own worktree.\nargument-hint: \"[<branch>] [<repo>] [-- <task>]\"\nlicense: MIT OR Apache-2.0\ncompatibility: Requires the `wt` CLI (https://worktrunk.dev)\n---\n\nArguments: `$ARGUMENTS`. Grammar: `[<branch>] [<repo>] [-- <task>]`.\n\n- **branch** — optional; the branch name for the new worktree. When omitted,\n  pick one (step 1 below).\n- **repo** — optional path or name; create the worktree in this repo instead\n  of the session's current one.\n- **task** — optional; what to do inside the new worktree. No task means enter\n  the worktree and wait.\n\nTokens before the `--` are the branch and/or repo. A path-shaped token\n(starting with `/`, `~`, `./`, or `../`) is the repo. A bare name can be\neither, so make an informed guess. It is the branch when the current repo\nalready has a branch by that name, as it is for `wt switch` itself. Otherwise\nit is the repo when a git repository by that name exists where the user keeps\nrepos (beside the current repo, or in a workspace directory like\n`~/workspace`), and the branch when none does (`docs` is a branch, not the\ncurrent repo's `docs/` directory). A name read as the repo carries its absolute\npath forward: that path, not the bare token, is the `<repo>` in step 3. Two\ntokens that both read as branches don't fit the grammar — ask. Without a `--`,\njudge where the task starts: leading tokens that read as a branch name\n(`fix-auth`) or a repo are consumed as such, and the rest is the task;\notherwise the whole input is the task (`fix the parser bug` has no\nbranch-shaped lead — all task).\n\n```\n/wt-switch-create my-feature -- fix the parser bug\n/wt-switch-create -- fix the parser bug\n/wt-switch-create my-feature ~/workspace/other-repo -- fix the parser bug\n/wt-switch-create my-feature\n```\n\n## What to do\n\nCreating the worktree comes first on every invocation, before any other work.\nThe invocation is itself the explicit request to create it; a research or\nread-only task gets one all the same.\n\n<!-- Maintainers: rationale.md (same directory) covers the harness rules and\ndesign choices behind this — read it before re-adding guards or routes. -->\n\n1. **Pick a new branch name** if none was given: short, from the task and\n   consistent with existing worktree names, or, mid-session, from the work\n   being moved; with nothing to derive from, ask.\n\n2. **With no repo argument, create and enter in one call:**\n   `EnterWorktree({name: \"<branch>\"})`. Worktrunk's `WorktreeCreate` hook runs\n   `wt switch --create` for a new branch or `wt switch` for an existing one,\n   creating its checkout if needed. The result is an ordinary `wt` worktree,\n   and the user sees no confirmation prompt. On success, do the task (or,\n   with no task text, confirm it's ready and wait).\n\n   Mid-session, carry uncommitted work across: `git stash push -u` before the\n   `EnterWorktree` call, then `git stash pop` once the session is in the new\n   worktree, which is after step 3 if this call fails. Entering re-roots the\n   session into the new worktree, and the stash is shared across worktrees. If\n   step 3 hands back without the session in the new worktree, restore the work\n   where it came from first (`git -C <that worktree> stash pop`).\n\n3. **Otherwise create it with `wt` and enter by path.** Two cases reach here: a\n   repo argument, which step 2 can't target, and a failed step 2, whose error\n   says `Already in a worktree session`. Create with a `Bash` call (omit\n   `-C <repo>` for this repo):\n\n   ```\n   wt -C <repo> switch --create <branch> --no-cd --format=json\n   ```\n\n   Stdout is JSON whose `path` field is the worktree's absolute path (status\n   lines go to stderr). On `Branch <branch> already exists`: if the user named\n   the branch, rerun without `--create` (it enters the branch, creating its\n   worktree if missing); if step 1 picked the name, pick another and rerun. Any\n   other failure (not a git repo, invalid name): report it and stop.\n\n   Next, call `ExitWorktree({action: \"keep\"})`. This invocation is the user\n   asking to move the session, which includes leaving the worktree it is in,\n   so make the call even when you're unsure the session is in one. A session\n   in a worktree can enter only one under its repository's\n   `.claude/worktrees/`; leaving lifts that limit, keeps the old worktree and\n   its branch on disk, and returns the session to the directory it was in\n   before it entered. Where there is nothing to leave (no worktree session, or\n   an agent pinned to its own worktree), the call returns an error and changes\n   nothing; carry on. If the session did leave a worktree\n   and the entry below doesn't happen, say so when you hand back: name the\n   worktree it left, still on disk, and where the session is now.\n\n   With a repo argument, `cd <repo>` next, in its own `Bash` call:\n   `EnterWorktree` re-roots only within the repository the cwd is in, and\n   worktrunk's `PermissionRequest` hook answers the confirmation that call\n   asks for only for a `wt` worktree of that same repository. If that `cd`\n   reports `Shell cwd was reset`, the repo is unreachable: skip the entry and\n   hand back as in **Unreachable** below. With no repo argument, don't `cd`:\n   leaving put the session back in this repository, and a `cd` into the\n   worktree it left can reset.\n\n   Then call `EnterWorktree({path: \"<path from the JSON>\"})`.\n\n   With a repo argument, once the session works in the new worktree (entered,\n   or reached by `cd` in the recovery below), read whichever of its root\n   `CLAUDE.md` and `AGENTS.md` exist before the task. Claude Code keeps the\n   launch repo's root instructions in context and loads only the new repo's\n   nested ones, so the new repo's root files supersede the launch repo's for\n   the rest of the session.\n\n   - **Accepted** → the session is re-rooted in the worktree. Do the task (or,\n     with no task text, confirm it's ready and wait).\n   - **Tool error** — the tool ran and returned an error (`Cannot enter\n     worktree: …`) → graceful; nothing moved, and one recovery covers them\n     all. One cause is an agent pinned to its own worktree, which can\n     enter only under its repo's `.claude/worktrees/`, excluding even a\n     same-repo `wt` sibling. The recovery test is whether you can `cd` into\n     the worktree, which works when it's inside an allowed directory. So\n     `cd <path>` and read the result:\n     - no `Shell cwd was reset` notice → it stuck; the worktree is reachable.\n       Work there, but a bare `cd` is not a tracked re-root, so the cwd can\n       revert to the session's launch worktree across turns (and in spawned\n       subagents); pin commands with `git -C <path>` / `wt -C <path>` rather\n       than trusting the `cd` to persist.\n     - `Shell cwd was reset` → **Unreachable.** Stop and ask the user to make\n       the directory whose `cd` reset reachable: add a parent that holds both\n       the repo and its worktrees, like `~/workspace`, to\n       `permissions.additionalDirectories` (durable, every session), or run\n       `/add-dir` on it (this session). Then continue from that `cd`. Don't\n       grind through absolute paths with `cd` resetting on every command.\n   - **Denied** — the call itself was refused, with no tool error → however\n     the denial is worded, it is the user's answer to the confirmation Claude\n     Code shows for entering a worktree outside `.claude/worktrees/`, unless\n     there was no user to ask (the denial says the session couldn't prompt),\n     which decides nothing — take the recovery above. On the user's answer:\n     the worktree `wt` just created still exists; only the entry didn't\n     happen. `cd` back out of the repo you moved into, if any, then report\n     the worktree's path and ask how to proceed, since reaching it through\n     `cd` would override that answer.\n\n## Cleanup\n\nThe worktree is a normal worktrunk worktree: it shows up in `wt list` and is\nmerged or removed with `wt merge` / `wt remove <branch>` like any other. Don't\nremove it unprompted.\n\nA worktree entered by name in step 2 gets Claude Code's Keep / Remove prompt\nwhen the session ends, with Keep selected by default. Remove runs `wt remove`\nwith its normal safeguards. A worktree entered by path in step 3 stays, as\ndoes a worktree the session left with `action: \"keep\"`. If the user asks to\nleave mid-session, `ExitWorktree({action: \"keep\"})` returns the session to its\noriginal directory;\n`ExitWorktree` cannot remove a worktree entered by `path`, so removing one of\nthose is always `wt remove <branch>`.\n\n## Scope\n\nThe command's mandate is ONE worktree (in the named repo, if one was given)\nand the requested task inside it.\n","frontmatter":{"name":"wt-switch-create","description":"Create a new worktrunk worktree (optionally in another repo) and switch this session's working directory into it. Use when launching a session that should work in its own worktree.","argument-hint":"[<branch>] [<repo>] [-- <task>]","license":"MIT OR Apache-2.0","compatibility":"Requires the `wt` CLI (https://worktrunk.dev)"},"isInternal":false,"tokens":2237,"sizeBytes":8832},{"name":"claude-code.md","path":"skills/worktrunk/reference/claude-code.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/claude-code.md","title":"Reference Skill","category":"anthropic-skill","format":"markdown","content":"# Reference Skill\n\nPath: `skills/worktrunk/reference/claude-code.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/claude-code.md)","tokens":300,"sizeBytes":200},{"name":"code-signing.md","path":"skills/worktrunk/reference/code-signing.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/code-signing.md","title":"Reference Skill","category":"anthropic-skill","format":"markdown","content":"# Reference Skill\n\nPath: `skills/worktrunk/reference/code-signing.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/code-signing.md)","tokens":300,"sizeBytes":202},{"name":"config.md","path":"skills/worktrunk/reference/config.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/config.md","title":"Reference Skill","category":"anthropic-skill","format":"markdown","content":"# Reference Skill\n\nPath: `skills/worktrunk/reference/config.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/config.md)","tokens":300,"sizeBytes":190},{"name":"extending.md","path":"skills/worktrunk/reference/extending.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/extending.md","title":"Reference Skill","category":"anthropic-skill","format":"markdown","content":"# Reference Skill\n\nPath: `skills/worktrunk/reference/extending.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/extending.md)","tokens":300,"sizeBytes":196},{"name":"faq.md","path":"skills/worktrunk/reference/faq.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/faq.md","title":"Reference Skill","category":"anthropic-skill","format":"markdown","content":"# Reference Skill\n\nPath: `skills/worktrunk/reference/faq.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/faq.md)","tokens":300,"sizeBytes":184},{"name":"hook.md","path":"skills/worktrunk/reference/hook.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/hook.md","title":"Reference Skill","category":"anthropic-skill","format":"markdown","content":"# Reference Skill\n\nPath: `skills/worktrunk/reference/hook.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/hook.md)","tokens":300,"sizeBytes":186},{"name":"list.md","path":"skills/worktrunk/reference/list.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/list.md","title":"Reference Skill","category":"anthropic-skill","format":"markdown","content":"# Reference Skill\n\nPath: `skills/worktrunk/reference/list.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/list.md)","tokens":300,"sizeBytes":186},{"name":"llm-commits.md","path":"skills/worktrunk/reference/llm-commits.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/llm-commits.md","title":"Reference Skill","category":"anthropic-skill","format":"markdown","content":"# Reference Skill\n\nPath: `skills/worktrunk/reference/llm-commits.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/llm-commits.md)","tokens":300,"sizeBytes":200},{"name":"merge.md","path":"skills/worktrunk/reference/merge.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/merge.md","title":"Reference Skill","category":"anthropic-skill","format":"markdown","content":"# Reference Skill\n\nPath: `skills/worktrunk/reference/merge.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/merge.md)","tokens":300,"sizeBytes":188},{"name":"remove.md","path":"skills/worktrunk/reference/remove.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/remove.md","title":"Reference Skill","category":"anthropic-skill","format":"markdown","content":"# Reference Skill\n\nPath: `skills/worktrunk/reference/remove.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/remove.md)","tokens":300,"sizeBytes":190},{"name":"shell-integration.md","path":"skills/worktrunk/reference/shell-integration.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/shell-integration.md","title":"Reference Skill","category":"anthropic-skill","format":"markdown","content":"# Reference Skill\n\nPath: `skills/worktrunk/reference/shell-integration.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/shell-integration.md)","tokens":300,"sizeBytes":212},{"name":"step.md","path":"skills/worktrunk/reference/step.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/step.md","title":"Reference Skill","category":"anthropic-skill","format":"markdown","content":"# Reference Skill\n\nPath: `skills/worktrunk/reference/step.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/step.md)","tokens":300,"sizeBytes":186},{"name":"switch.md","path":"skills/worktrunk/reference/switch.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/switch.md","title":"Reference Skill","category":"anthropic-skill","format":"markdown","content":"# Reference Skill\n\nPath: `skills/worktrunk/reference/switch.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/switch.md)","tokens":300,"sizeBytes":190},{"name":"tips-patterns.md","path":"skills/worktrunk/reference/tips-patterns.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/tips-patterns.md","title":"Reference Skill","category":"anthropic-skill","format":"markdown","content":"# Reference Skill\n\nPath: `skills/worktrunk/reference/tips-patterns.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/tips-patterns.md)","tokens":300,"sizeBytes":204},{"name":"troubleshooting.md","path":"skills/worktrunk/reference/troubleshooting.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/troubleshooting.md","title":"Reference Skill","category":"anthropic-skill","format":"markdown","content":"# Reference Skill\n\nPath: `skills/worktrunk/reference/troubleshooting.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/troubleshooting.md)","tokens":300,"sizeBytes":208},{"name":"worktrunk.md","path":"skills/worktrunk/reference/worktrunk.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/worktrunk.md","title":"Reference Skill","category":"anthropic-skill","format":"markdown","content":"# Reference Skill\n\nPath: `skills/worktrunk/reference/worktrunk.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/worktrunk.md)","tokens":300,"sizeBytes":196},{"name":"SKILL.md","path":"skills/worktrunk/SKILL.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/SKILL.md","title":"worktrunk","category":"anthropic-skill","format":"markdown","content":"---\nname: worktrunk\ndescription: Guidance for Worktrunk (the `wt` CLI) — git worktree management, hooks, and config. Load when working out which worktree a `wt` command will act on, or reaching for the global `-C <path>` to target one; editing .config/wt.toml or ~/.config/worktrunk/config.toml; adding, modifying, or debugging hooks (post-merge, post-start, pre-commit, pre-merge, post-switch, etc.); configuring commit message generation or command aliases; or troubleshooting wt behavior. Also answers general worktrunk/wt questions.\nlicense: MIT OR Apache-2.0\ncompatibility: Requires the `wt` CLI (https://worktrunk.dev)\n---\n\n# Worktrunk\n\nHelp users work with Worktrunk, a CLI tool for managing git worktrees.\n\n## Available documentation\n\nReference files are synced from [worktrunk.dev](https://worktrunk.dev) documentation:\n\n- **reference/config.md**: User and project configuration (LLM, hooks, command defaults)\n- **reference/hook.md**: Hook types, timing, and execution order\n- **reference/switch.md**, **merge.md**, **list.md**, etc.: Command documentation\n- **reference/extending.md**: Aliases, multi-step pipelines, custom subcommands, and template-expansion gotchas (two-pass `{% raw %}` deferral, for-each recipes)\n- **reference/llm-commits.md**: LLM commit message generation\n- **reference/tips-patterns.md**: Practical recipes — aliases, per-branch variables, dev server per worktree, parallel agent patterns\n- **reference/shell-integration.md**: Shell integration debugging\n- **reference/troubleshooting.md**: Troubleshooting for LLM and hooks (Claude-specific)\n\nFor command-specific options, run `wt <command> --help`. For configuration, follow the workflows below.\n\n## Which worktree a command acts on\n\n`wt` finds the *repository* from the working directory, and the *worktree* from the command's own arguments. Two rules cover every case:\n\n1. **A command that names a branch already names its worktree.** Worktrees are addressed by branch name, so `wt switch <branch>`, `wt remove <branch>`, `wt step diff --branch <branch>`, and `wt config state marker set --branch <branch>` act on that branch's worktree no matter which worktree you run them from. Every such argument also accepts the worktree's own path, for the cases a branch cannot name — a second checkout of the same branch, or a detached worktree (which `marker` still rejects, since it keys state by branch name).\n2. **`-C <path>` moves the working directory, not the worktree selection.** Reach for it when the repository lookup is what's wrong: a *different* repository; a command that acts on the current worktree and takes no branch argument (`wt merge`, `wt step rebase|squash|push` — their `[TARGET]` is the merge target, not a worktree); or a caller whose working directory isn't inside a repository at all, such as an agent hook the host pins elsewhere.\n\nLayering `-C` on top of a branch argument names the same worktree twice. From inside the `alpha` worktree of a repo that also has `beta`:\n\n```bash\nwt step diff --branch beta                    # ✓ the branch argument selects the worktree\nwt -C ../repo.beta step diff --branch beta    # ✗ says beta twice\n\nwt switch --create beta                       # ✓ --base already defaults to the default branch\nwt -C ../repo switch --create beta            # ✗ -C adds nothing; you are already in that repo\n```\n\n## Two types of configuration\n\nWorktrunk uses two config files with different scopes and permission models:\n\n**User config** (`~/.config/worktrunk/config.toml`, never checked into git) holds personal preferences: LLM integration, worktree path templates, command settings, user hooks. Treat it conservatively — propose changes and get consent before editing, never install tools on the user's behalf, and preserve the file's existing structure and comments. See `reference/config.md`.\n\n**Project config** (`<repo>/.config/wt.toml`, checked into git) holds team-wide automation: hooks for the worktree lifecycle (pre-start, pre-merge, etc.). Edit proactively — changes are versioned and reversible via git. Comment why each hook exists, and warn the user before adding destructive commands (`rm -rf`, `DROP TABLE`), network fetches piped to shells, or `sudo`. See `reference/hook.md`.\n\nSome requests span both: commit-message generation is user config, while the team's quality checks are project config.\n\n## Core workflows\n\n### Setting up commit message generation (user config)\n\nDetect which tools are installed (`which claude codex opencode pi`); if none, recommend Claude Code. Take the exact command for the chosen tool from `reference/llm-commits.md`, propose the `[commit.generation]` change, and apply it after approval (`wt config create` first if no config exists). To verify, `wt step commit --dry-run` renders the prompt, runs the LLM, and prints the message without committing.\n\n### Configuring project hooks\n\nPick the hook type by when the command should run and whether it may block — `reference/hook.md` maps all ten (5 events × pre/post) to their timing and typical uses.\n\nDerive the commands from the project itself (`package.json` scripts, `Cargo.toml`, `pyproject.toml`) and verify they run before adding them.\n\nWhen a new hook must wait for an existing one, convert the entry to a pipeline; independent commands in a named table run concurrently:\n\n```toml\n# Pipeline: install completes before migrate starts\n[[pre-start]]\ninstall = \"npm install\"\n\n[[pre-start]]\nmigrate = \"npm run db:migrate\"\n\n# Concurrent: independent commands in one table\n[pre-start]\ninstall = \"npm install\"\nenv = \"cp .env.example .env\"\n```\n\nTest with `wt switch --create test-hooks`.\n\n## Common tasks reference\n\n### User config tasks\n- Set up commit message generation → `reference/llm-commits.md`\n- Customize worktree paths → `reference/config.md#worktree-path-template`\n- Custom commit templates → `reference/llm-commits.md#prompt-templates`\n- Configure command defaults → `reference/config.md#command-config`\n- Set up personal hooks → `reference/config.md#user-hooks`\n\n### Project config tasks\n- Set up hooks for new project → `reference/hook.md`\n- Add hook to existing config → `reference/hook.md#hook-forms`\n- Use template variables → `reference/hook.md#template-variables`\n- Add dev server URL to list → `reference/config.md#dev-server-url`\n\n### Aliases & multi-worktree tasks\n- Create a `wt` alias → `reference/extending.md#aliases`\n- Run a command in every worktree → `reference/step.md#wt-step-for-each`\n- Rebase every worktree (up-style) → `reference/extending.md#recipe-rebase-every-worktree-onto-its-upstream`\n- Pass a template to a nested `wt` command → `reference/extending.md#nesting-templates`\n\n## Key commands\n\n```bash\n# View all configuration\nwt config show\n\n# Create initial user config (LLM/commit setup: see reference/llm-commits.md)\nwt config create\n\n# Full config reference (subcommands, templates, env vars)\nwt config --help\n```\n\n## Hook approvals in non-interactive sessions\n\nWorktrunk never runs a project's hooks or aliases until the user has explicitly approved them. The commands in `.config/wt.toml` are arbitrary shell code shipped in a repository the user may have just cloned, so on first run Worktrunk shows each command and waits for the user to approve it — an untrusted `.config/wt.toml` cannot silently execute anything. Approvals are stored per-project in `~/.config/worktrunk/approvals.toml` and re-prompted whenever a command template changes, so a hook can't be swapped for a different command after it was approved.\n\nAgents running `wt merge`, `wt switch`, or other commands that trigger hooks will hit an error like:\n\n```\n▲ cargo-difftest needs approval to execute 1 command:\n○ post-merge install:\n  cargo install --path .\n✗ Cannot prompt for approval in non-interactive environment\n↳ To skip prompts in CI/CD, add --yes; to pre-approve commands, run wt config approvals add --yes\n```\n\nThe resolution is for the user to make the trust decision themselves:\n\n- **`wt config approvals add`** — interactive prompt where the user reviews each command before it is stored to `~/.config/worktrunk/approvals.toml`. Run once per project; the approval persists across invocations until the command template changes or the project moves. This is the path to recommend — the user reviews and consents to exactly the commands that will run.\n\n**When invoked as an agent, stop and escalate to the user.** Approving a project's hooks is a security decision about whether this repository should be trusted to run arbitrary commands on the user's machine — that decision belongs to the user, not the agent. Tell the user to run `wt config approvals add` and let them review the commands. Do not reach for either `--yes` on the user's behalf: on the blocked command it skips the gate for that invocation, and `wt config approvals add --yes` records every command the project declares with nobody reading them. Both exist for CI/CD pipelines and containers that already control their own hook contents; neither is a shortcut for an interactive agent to silence an approval prompt.\n\n## Advanced: agent handoffs\n\nWhen the user requests spawning a worktree with an agent in a background session (\"spawn a worktree for...\", \"hand off to another agent\"), use the tmux or Zellij command from `reference/tips-patterns.md#agent-handoffs` with the CLI you are running as in place of `claude`, following that section's note on where a subcommand such as OpenCode's `run` goes.\n\n**Requirements** (all must be true):\n- User explicitly requests spawning/handoff\n- User is in a supported multiplexer (check `$TMUX` / `$ZELLIJ`)\n- The user's project instructions (`CLAUDE.md` or `AGENTS.md`) or an explicit prompt authorize this pattern\n\n**Do not use this pattern** for normal worktree operations.\n\n### Parallel sub-Agents (single Claude Code session)\n\nTo spawn multiple sub-Agents that each work in their own worktree from one Claude Code session — no terminal multiplexer, no human in the other pane — pre-start each worktree from the parent and pass the path into the sub-Agent prompt:\n\n```bash\nwt switch --create <branch> --no-cd\n```\n\nThen call the `Agent` tool **without** `isolation: \"worktree\"`, naming the path in the prompt:\n\n```\nYou are working in `/abs/path/to/myproject.<branch>` on branch `<branch>`.\nAll edits must stay in that worktree.\n```\n\n`--no-cd` skips the shell-integration cd script the parent can't consume. Add `--no-hooks` only when no user or project hooks provision the worktree and each sub-Agent does its own build/test step (e.g. `cargo run -- hook pre-merge --yes`) — a `pre-start` hook that installs dependencies or links a gitignored build environment hands the sub-Agent a worktree it can't build in when it's skipped. Leaving hooks on needs the project's hook commands already approved: the parent session can't prompt, so an unapproved command in `.config/wt.toml` aborts the create — see **Hook approvals in non-interactive sessions** above.\n\n**Do not** use `Agent { isolation: \"worktree\" }` for this. Claude Code passes its internal agent ID as `name` to the `WorktreeCreate` hook, so `wt` creates the worktree as `myproject.agent-<id>` on a throwaway branch. If the sub-Agent then creates a feature branch on top, you end up with non-canonical paths, orphan branches, and post-start hooks fired against the wrong branch. Pre-creating with `wt switch --create` keeps path, branch, and hook target aligned.\n","frontmatter":{"name":"worktrunk","description":"Guidance for Worktrunk (the `wt` CLI) — git worktree management, hooks, and config. Load when working out which worktree a `wt` command will act on, or reaching for the global `-C <path>` to target one; editing .config/wt.toml or ~/.config/worktrunk/config.toml; adding, modifying, or debugging hooks (post-merge, post-start, pre-commit, pre-merge, post-switch, etc.); configuring commit message generation or command aliases; or troubleshooting wt behavior. Also answers general worktrunk/wt questions.","license":"MIT OR Apache-2.0","compatibility":"Requires the `wt` CLI (https://worktrunk.dev)"},"isInternal":false,"tokens":2652,"sizeBytes":11461},{"name":"rationale.md","path":"skills/wt-switch-create/rationale.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/wt-switch-create/rationale.md","title":"Wt-switch-create Skill","category":"anthropic-skill","format":"markdown","content":"# Wt-switch-create Skill\n\nPath: `skills/wt-switch-create/rationale.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/wt-switch-create/rationale.md)","tokens":300,"sizeBytes":197},{"name":"SKILL.md","path":"skills/wt-switch-create/SKILL.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/wt-switch-create/SKILL.md","title":"wt-switch-create","category":"anthropic-skill","format":"markdown","content":"---\nname: wt-switch-create\ndescription: Create a new worktrunk worktree (optionally in another repo) and switch this session's working directory into it. Use when launching a session that should work in its own worktree.\nargument-hint: \"[<branch>] [<repo>] [-- <task>]\"\nlicense: MIT OR Apache-2.0\ncompatibility: Requires the `wt` CLI (https://worktrunk.dev)\n---\n\nArguments: `$ARGUMENTS`. Grammar: `[<branch>] [<repo>] [-- <task>]`.\n\n- **branch** — optional; the branch name for the new worktree. When omitted,\n  pick one (step 1 below).\n- **repo** — optional path or name; create the worktree in this repo instead\n  of the session's current one.\n- **task** — optional; what to do inside the new worktree. No task means enter\n  the worktree and wait.\n\nTokens before the `--` are the branch and/or repo. A path-shaped token\n(starting with `/`, `~`, `./`, or `../`) is the repo. A bare name can be\neither, so make an informed guess. It is the branch when the current repo\nalready has a branch by that name, as it is for `wt switch` itself. Otherwise\nit is the repo when a git repository by that name exists where the user keeps\nrepos (beside the current repo, or in a workspace directory like\n`~/workspace`), and the branch when none does (`docs` is a branch, not the\ncurrent repo's `docs/` directory). A name read as the repo carries its absolute\npath forward: that path, not the bare token, is the `<repo>` in step 3. Two\ntokens that both read as branches don't fit the grammar — ask. Without a `--`,\njudge where the task starts: leading tokens that read as a branch name\n(`fix-auth`) or a repo are consumed as such, and the rest is the task;\notherwise the whole input is the task (`fix the parser bug` has no\nbranch-shaped lead — all task).\n\n```\n/wt-switch-create my-feature -- fix the parser bug\n/wt-switch-create -- fix the parser bug\n/wt-switch-create my-feature ~/workspace/other-repo -- fix the parser bug\n/wt-switch-create my-feature\n```\n\n## What to do\n\nCreating the worktree comes first on every invocation, before any other work.\nThe invocation is itself the explicit request to create it; a research or\nread-only task gets one all the same.\n\n<!-- Maintainers: rationale.md (same directory) covers the harness rules and\ndesign choices behind this — read it before re-adding guards or routes. -->\n\n1. **Pick a new branch name** if none was given: short, from the task and\n   consistent with existing worktree names, or, mid-session, from the work\n   being moved; with nothing to derive from, ask.\n\n2. **With no repo argument, create and enter in one call:**\n   `EnterWorktree({name: \"<branch>\"})`. Worktrunk's `WorktreeCreate` hook runs\n   `wt switch --create` for a new branch or `wt switch` for an existing one,\n   creating its checkout if needed. The result is an ordinary `wt` worktree,\n   and the user sees no confirmation prompt. On success, do the task (or,\n   with no task text, confirm it's ready and wait).\n\n   Mid-session, carry uncommitted work across: `git stash push -u` before the\n   `EnterWorktree` call, then `git stash pop` once the session is in the new\n   worktree, which is after step 3 if this call fails. Entering re-roots the\n   session into the new worktree, and the stash is shared across worktrees. If\n   step 3 hands back without the session in the new worktree, restore the work\n   where it came from first (`git -C <that worktree> stash pop`).\n\n3. **Otherwise create it with `wt` and enter by path.** Two cases reach here: a\n   repo argument, which step 2 can't target, and a failed step 2, whose error\n   says `Already in a worktree session`. Create with a `Bash` call (omit\n   `-C <repo>` for this repo):\n\n   ```\n   wt -C <repo> switch --create <branch> --no-cd --format=json\n   ```\n\n   Stdout is JSON whose `path` field is the worktree's absolute path (status\n   lines go to stderr). On `Branch <branch> already exists`: if the user named\n   the branch, rerun without `--create` (it enters the branch, creating its\n   worktree if missing); if step 1 picked the name, pick another and rerun. Any\n   other failure (not a git repo, invalid name): report it and stop.\n\n   Next, call `ExitWorktree({action: \"keep\"})`. This invocation is the user\n   asking to move the session, which includes leaving the worktree it is in,\n   so make the call even when you're unsure the session is in one. A session\n   in a worktree can enter only one under its repository's\n   `.claude/worktrees/`; leaving lifts that limit, keeps the old worktree and\n   its branch on disk, and returns the session to the directory it was in\n   before it entered. Where there is nothing to leave (no worktree session, or\n   an agent pinned to its own worktree), the call returns an error and changes\n   nothing; carry on. If the session did leave a worktree\n   and the entry below doesn't happen, say so when you hand back: name the\n   worktree it left, still on disk, and where the session is now.\n\n   With a repo argument, `cd <repo>` next, in its own `Bash` call:\n   `EnterWorktree` re-roots only within the repository the cwd is in, and\n   worktrunk's `PermissionRequest` hook answers the confirmation that call\n   asks for only for a `wt` worktree of that same repository. If that `cd`\n   reports `Shell cwd was reset`, the repo is unreachable: skip the entry and\n   hand back as in **Unreachable** below. With no repo argument, don't `cd`:\n   leaving put the session back in this repository, and a `cd` into the\n   worktree it left can reset.\n\n   Then call `EnterWorktree({path: \"<path from the JSON>\"})`.\n\n   With a repo argument, once the session works in the new worktree (entered,\n   or reached by `cd` in the recovery below), read whichever of its root\n   `CLAUDE.md` and `AGENTS.md` exist before the task. Claude Code keeps the\n   launch repo's root instructions in context and loads only the new repo's\n   nested ones, so the new repo's root files supersede the launch repo's for\n   the rest of the session.\n\n   - **Accepted** → the session is re-rooted in the worktree. Do the task (or,\n     with no task text, confirm it's ready and wait).\n   - **Tool error** — the tool ran and returned an error (`Cannot enter\n     worktree: …`) → graceful; nothing moved, and one recovery covers them\n     all. One cause is an agent pinned to its own worktree, which can\n     enter only under its repo's `.claude/worktrees/`, excluding even a\n     same-repo `wt` sibling. The recovery test is whether you can `cd` into\n     the worktree, which works when it's inside an allowed directory. So\n     `cd <path>` and read the result:\n     - no `Shell cwd was reset` notice → it stuck; the worktree is reachable.\n       Work there, but a bare `cd` is not a tracked re-root, so the cwd can\n       revert to the session's launch worktree across turns (and in spawned\n       subagents); pin commands with `git -C <path>` / `wt -C <path>` rather\n       than trusting the `cd` to persist.\n     - `Shell cwd was reset` → **Unreachable.** Stop and ask the user to make\n       the directory whose `cd` reset reachable: add a parent that holds both\n       the repo and its worktrees, like `~/workspace`, to\n       `permissions.additionalDirectories` (durable, every session), or run\n       `/add-dir` on it (this session). Then continue from that `cd`. Don't\n       grind through absolute paths with `cd` resetting on every command.\n   - **Denied** — the call itself was refused, with no tool error → however\n     the denial is worded, it is the user's answer to the confirmation Claude\n     Code shows for entering a worktree outside `.claude/worktrees/`, unless\n     there was no user to ask (the denial says the session couldn't prompt),\n     which decides nothing — take the recovery above. On the user's answer:\n     the worktree `wt` just created still exists; only the entry didn't\n     happen. `cd` back out of the repo you moved into, if any, then report\n     the worktree's path and ask how to proceed, since reaching it through\n     `cd` would override that answer.\n\n## Cleanup\n\nThe worktree is a normal worktrunk worktree: it shows up in `wt list` and is\nmerged or removed with `wt merge` / `wt remove <branch>` like any other. Don't\nremove it unprompted.\n\nA worktree entered by name in step 2 gets Claude Code's Keep / Remove prompt\nwhen the session ends, with Keep selected by default. Remove runs `wt remove`\nwith its normal safeguards. A worktree entered by path in step 3 stays, as\ndoes a worktree the session left with `action: \"keep\"`. If the user asks to\nleave mid-session, `ExitWorktree({action: \"keep\"})` returns the session to its\noriginal directory;\n`ExitWorktree` cannot remove a worktree entered by `path`, so removing one of\nthose is always `wt remove <branch>`.\n\n## Scope\n\nThe command's mandate is ONE worktree (in the named repo, if one was given)\nand the requested task inside it.\n","frontmatter":{"name":"wt-switch-create","description":"Create a new worktrunk worktree (optionally in another repo) and switch this session's working directory into it. Use when launching a session that should work in its own worktree.","argument-hint":"[<branch>] [<repo>] [-- <task>]","license":"MIT OR Apache-2.0","compatibility":"Requires the `wt` CLI (https://worktrunk.dev)"},"isInternal":false,"tokens":2237,"sizeBytes":8832},{"name":"CLAUDE.md","path":"tests/CLAUDE.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/tests/CLAUDE.md","title":"tests - Claude Agent Guidelines & System Prompt","category":"claude-rule","format":"markdown","content":"# tests - Claude Agent Guidelines & System Prompt\n\nPath: `tests/CLAUDE.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/tests/CLAUDE.md)","tokens":300,"sizeBytes":180},{"name":"marketplace.json","path":".agents/plugins/marketplace.json","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/.agents/plugins/marketplace.json","title":"Claude Plugin Marketplace Catalog","category":"marketplace","format":"json","content":"# Claude Plugin Marketplace Catalog\n\nPath: `.agents/plugins/marketplace.json`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/.agents/plugins/marketplace.json)","tokens":300,"sizeBytes":200},{"name":"marketplace.json","path":".claude-plugin/marketplace.json","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/.claude-plugin/marketplace.json","title":"worktrunk","category":"marketplace","format":"json","content":"{\n  \"name\": \"worktrunk\",\n  \"owner\": {\n    \"name\": \"Worktrunk\",\n    \"email\": \"m@maxroos.com\"\n  },\n  \"metadata\": {\n    \"description\": \"Claude Code plugin for Worktrunk, a CLI for Git worktree management\"\n  },\n  \"plugins\": [\n    {\n      \"name\": \"worktrunk\",\n      \"description\": \"Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows. This plugin provides configuration guidance (LLM commit messages, project hooks, worktree paths), automatic activity tracking (🤖/💬 indicators in `wt list` showing active Claude sessions), and a `/wt-diff` pane showing each worktree's changes.\",\n      \"source\": \"./plugins/worktrunk\"\n    }\n  ]\n}\n","frontmatter":{"name":"worktrunk","owner":{"name":"Worktrunk","email":"m@maxroos.com"},"metadata":{"description":"Claude Code plugin for Worktrunk, a CLI for Git worktree management"},"plugins":[{"name":"worktrunk","description":"Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows. This plugin provides configuration guidance (LLM commit messages, project hooks, worktree paths), automatic activity tracking (🤖/💬 indicators in `wt list` showing active Claude sessions), and a `/wt-diff` pane showing each worktree's changes.","source":"./plugins/worktrunk"}]},"isInternal":false,"tokens":176,"sizeBytes":668},{"name":"plugin.json","path":"plugins/worktrunk/.claude-plugin/plugin.json","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/.claude-plugin/plugin.json","title":"claude-plugin Plugin Manifest","category":"plugin-manifest","format":"json","content":"# claude-plugin Plugin Manifest\n\nPath: `plugins/worktrunk/.claude-plugin/plugin.json`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/.claude-plugin/plugin.json)","tokens":300,"sizeBytes":220},{"name":"plugin.json","path":"plugins/worktrunk/.codex-plugin/plugin.json","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/.codex-plugin/plugin.json","title":"codex-plugin Plugin Manifest","category":"plugin-manifest","format":"json","content":"# codex-plugin Plugin Manifest\n\nPath: `plugins/worktrunk/.codex-plugin/plugin.json`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/.codex-plugin/plugin.json)","tokens":300,"sizeBytes":217},{"name":"README.md","path":"plugins/worktrunk/README.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/README.md","title":"worktrunk Documentation","category":"plugin-manifest","format":"markdown","content":"# worktrunk Documentation\n\nPath: `plugins/worktrunk/README.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/README.md)","tokens":300,"sizeBytes":180},{"name":"README.md","path":"plugins/worktrunk/skills/worktrunk/reference/README.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/README.md","title":"reference Documentation","category":"plugin-manifest","format":"markdown","content":"# reference Documentation\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/README.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/README.md)","tokens":300,"sizeBytes":234},{"name":"CLAUDE.md","path":"src/commands/CLAUDE.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/src/commands/CLAUDE.md","title":"Command: /claude","category":"command-prompt","format":"markdown","content":"# Command: /claude\n\nPath: `src/commands/CLAUDE.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/src/commands/CLAUDE.md)","tokens":300,"sizeBytes":163},{"name":"CLAUDE.md","path":"src/commands/list/CLAUDE.md","rawUrl":"https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/src/commands/list/CLAUDE.md","title":"Command: /claude","category":"command-prompt","format":"markdown","content":"# Command: /claude\n\nPath: `src/commands/list/CLAUDE.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/src/commands/list/CLAUDE.md)","tokens":300,"sizeBytes":173}],"systemPromptSnippet":"<yakaai_skills repo=\"max-sixty/worktrunk\">\n<!-- File: .claude/skills/release/SKILL.md (Tokens: ~6892 | Category: anthropic-skill) -->\n---\nname: release\ndescription: Worktrunk release workflow. Use when user asks to \"do a release\", \"release a new version\", \"cut a release\", or wants to publish a new version to crates.io and GitHub.\nmetadata:\n  internal: true\n---\n\n# Release Workflow\n\n## Steps\n\n1. **Sync the release branch with `main`**: The release worktree's branch lags `main` between releases — it's only reset to `main` after a release lands. Cutting from a stale branch silently drops everything merged since. Fast-forward to the tip of `main` before anything else:\n   ```bash\n   git fetch origin\n   git merge --ff-only origin/main\n   ```\n   `--ff-only` advances the branch when it's a strict ancestor of `origin/main` and **fails** (rather than creating a merge commit or discarding work) if it has diverged — reconcile manually before continuing. This is the release-branch equivalent of `wt up`, spelled out because the `up` alias rebases each branch onto its own upstream (`origin/release`), not `main`. Note the resulting commit SHA: this is the tip the changelog covers, and step 12 checks the changelog against everything that reaches `main` before the tag.\n2. **Run tests**: Two gates — the local suite and the full cross-platform suite.\n   - Local: `cargo run -- hook pre-merge --yes`.\n   - Cross-platform: dispatch the `nightly` workflow on the cut-from tip and wait for it to go green. This is where a release gets its full linux/macos/windows validation: the PR path (`ci.yaml`) is moving to cargo-affected selection and will stop running the full `test` matrix, while `nightly` hosts `full-tests` (the full 3-OS suite) alongside feature-powerset, release-target, nix-flake, and minimal-versions. Benchmarks aren't part of `nightly` — they run in their own `benchmarks.yaml` and gate nothing.\n     ```bash\n     gh workflow run nightly.yaml --ref main\n     # Registration lags the dispatch, and a prior release may have left a\n     # stale completed workflow_dispatch run — filter to the in-flight one.\n     sleep 5\n     RUN=$(gh run list --workflow=nightly.yaml --event=workflow_dispatch --branch=main --limit 5 --json databaseId,status --jq 'map(select(.status != \"completed\")) | .[0].databaseId')\n     ```\n     Launch a ci-reporter to monitor `$RUN` to completion (avoid `gh run watch` — it can hang). Fix any failure before continuing.\n3. **Check current version**: Read `version` in `Cargo.toml`\n4. **Review commits**: Check commits since last release to understand scope of changes. Audit the cumulative diff for the data-loss surface (see [Data-Loss Surface Review](#data-loss-surface-review)) and documentation (see [Documentation Review](#documentation-review)).\n5. **Check library API compatibility (advisory)**: Run `cargo semver-checks check-release -p worktrunk` (install with `cargo install cargo-semver-checks --locked` if missing) as a bump-level input, not a compat gate — worktrunk ships breaking library changes freely. If it reports breaking changes, that's fine; under semver the bump must still be minor (pre-1.0) or major (post-1.0). See \"Library API Compatibility\" below.\n6. **Credit contributors**: Check for external PR authors and issue reporters (see \"Credit External Contributors\" and \"Credit Issue Reporters\" below)\n7. **Determine release type**: Pick the bump from the changes (including semver-checks result). Ask the user only if the choice is genuinely ambiguous (see below).\n8. **Bump version** (must run on a clean tree — before editing CHANGELOG):\n   ```bash\n   cargo release X.Y.Z -p worktrunk -x --no-publish --no-push --no-tag --no-verify --no-confirm && cargo check\n   ```\n   This bumps `Cargo.toml` and `Cargo.lock`, then auto-commits. We'll reset this commit in step 10 to fold in the CHANGELOG.\n9. **Update CHANGELOG**: the top section holds this release's changes (see MANDATORY verification below). If it is `## Unreleased`, rename that heading to `## X.Y.Z` and fold the remaining entries into it — inserting a new heading above it ships a stale `## Unreleased` in the release notes. Otherwise the top section is the last shipped version: add a `## X.Y.Z` section above it, never append to it.\n10. **Commit**: Reset the auto-commit from step 8, stage everything, and create the final release commit:\n    ```bash\n    git reset --soft HEAD~1 && git add -A && git commit -m \"Release vX.Y.Z\"\n    ```\n11. **Merge to main**: complete the documentation review on the final candidate, then push the release branch, open a PR, wait for CI, and merge it. Keep the worktree — the remaining steps run from it. Then move the branch onto the merged tip:\n    ```bash\n    git fetch origin && git reset --keep origin/main\n    ```\n    The PR squash-merges, so the branch is no longer an ancestor of `main` and step 1's `--ff-only` can't advance it; `--keep` moves it across and still fails if anything is uncommitted. `main` can advance during the CI wait; step 12 catches anything that lands before the tag.\n12. **Verify the changelog covers `main`, then tag and push**: the tag decides what ships — `release.yaml` builds the binaries and the GitHub release notes from the tree at the tag, so everything reachable from it is in the release. The merge squashes onto whatever `main` tip exists at merge time, so a commit that lands during the PR's CI wait is already an ancestor of the release commit and ships whether or not the changelog mentions it (the easy miss is a follow-up that reworks a feature this release already documents). List what reached `main` since the cut-from tip (step 1):\n    ```bash\n    git fetch origin\n    git log --oneline <cut-from-commit>..origin/main\n    ```\n    Clean means the changelog at `origin/main` documents every user-facing commit listed. With no drift the list is one line, the `Release vX.Y.Z (#NNNN)` squash commit. Review anything else that drifted in during the window and fold what's user-facing into the changelog with a follow-up squash PR, then re-fetch and re-run. The list only grows across passes — the drifted commits stay, joined by the follow-up's own squash commit — so each pass re-checks coverage over a longer list.\n\n    Extend the documentation review to any changes since its reviewed SHA, including corrections and commits that arrived during CI. Record the final reviewed SHA and resolve findings before tagging.\n\n    Once clean, tag `origin/main`. The check and the tag then name the same ref, and it's main's tip, so the tag is reachable from `main`:\n    ```bash\n    git tag vX.Y.Z origin/main && git push origin vX.Y.Z\n    ```\n13. **Wait for the release workflow**: The tag push triggers `release.yaml`. Launch a ci-reporter agent to monitor the run through to completion (avoid `gh run watch` — it can hang); the run ID comes from:\n    ```bash\n    gh run list --workflow=release.yaml --event=push --branch=vX.Y.Z --limit 1 --json databaseId --jq '.[0].databaseId'\n    ```\n    If the run fails, re-run its failed jobs when the cause is transient. Otherwise land the fix on `main` and release it as the next patch version, leaving the vX.Y.Z tag in place. Installers such as aqua check that the signing certificate names `release.yaml@refs/tags/<version>`, so each version's release has to come from the run its own tag push started.\n\n`release.yaml` builds binaries and publishes to crates.io, Homebrew, winget, AUR, and PyPI (experimental) automatically.\n\n## Data-Loss Surface Review\n\nWorktrunk's worst failure is silently destroying a user's work. The per-PR review (`running-tend`, \"Data-Loss Surface\") is the first gate; the release is the second, where the whole diff since the last release is visible at once.\n\nThis review optimizes for recall: find every change that could touch the deletion surface, accept false positives, then adjudicate each candidate. Missing one real loss path costs far more than reviewing a false alarm.\n\nA keyword grep alone is insufficient. It finds only what someone thought to pattern-match, and an agent handed the grep anchors on it and inherits its blind spots. So fan out independent finders, most of them without the grep, and analyze every candidate they surface.\n\n### Find: independent finders, recall over precision\n\nLaunch 3-5 finder subagents in parallel over the cumulative diff (`git log v<last-version>..HEAD -p`) and the code it touches, including anything that calls into or is called by the changed code. Each works independently: do not let them share findings during this phase, and do not collapse them onto one method. Each returns candidate locations with a one-line reason, erring toward over-reporting.\n\nGive each a distinct charter. At least two receive no grep and no keyword list, so they reason from the code instead of pattern-matching:\n\n- **Behavioral (no grep):** read each change and ask what it could destroy: files, branches, worktrees, uncommitted or untracked work, committed-but-unpushed commits. Flag any change whose worst case is lost user data.\n- **Blast-radius (no grep):** for every function and file the diff touches, trace callers and callees. Flag any path that can now reach a destructive primitive (branch deletion, worktree removal, filesystem removal, history rewrite), even when that call sits outside the diff.\n- **Automation diff (no grep):** compare shipped automation before and after: `plugins/*/hooks/hooks.json`, `plugins/*/hooks.json`, `plugins/*/hooks/wt.sh`, and skill or alias examples users copy. Flag any new or altered invocation that removes or force-overwrites anything.\n- **Keyword scan (grep):** one finder runs the pattern filter over the full diff as a cross-check, never as the primary method. It takes no pathspec; a path allowlist would recreate the blind spots the no-grep finders exist to avoid (the densest destructive code, the tree walk in `src/remove_dir.rs`, sits outside `src/git/`).\n  ```bash\n  git log v<last-version>..HEAD -p \\\n    | grep -nE -- '--force-delete|--force| -D| -f |branch -[dD]|worktree remove|reset --hard|checkout -f|clean -[fdx]|remove_dir_all|remove_file|unlinkat|rm -rf'\n  ```\n\n### Analyze: adjudicate each candidate\n\nPool the candidates, dedupe, and analyze each against the data-safety invariants in `AGENTS.md` and the FAQ \"What can Worktrunk delete?\" inventory: does it preserve data on failure, require explicit consent for destructive ops, and avoid silent side-effect deletion? Mark each real risk / acceptable / needs change, with the reasoning.\n\nSurface the full adjudicated list and get explicit sign-off before tagging. Do not tag a release with an unresolved deletion-surface candidate, even if it looks acceptable.\n\n## Documentation Review\n\nThe release reviews all documentation changes since the previous release, including changes already on `main` and edits made during release preparation. Public docs are curated product guidance: each passage should help readers understand or use Worktrunk, with detail proportional to how many readers need it.\n\nStart from the full release diff to inventory documentation wherever it lives:\n\n```bash\ngit diff --name-status v<last-version> HEAD\ngit diff v<last-version> HEAD\n```\n\nGive an independent reviewer the previous tag, candidate SHA, and complete inventory. Cover site pages, README files, CLI help, configuration and command examples, shipped skills, and release notes. Review canonical sources once and check their generated copies for agreement; `docs/AGENTS.md` defines ownership and sync.\n\nThe reviewer reads every changed passage in its surrounding section and checks:\n\n- **Purpose and proportion:** does it change what readers understand or do? Cut redundant explanations and implementation or regression details that belong in tests or PRs. A correctness fix needs prose only when usage changes or an existing claim becomes false.\n- **Clarity and concision:** use concrete, consistent terminology; introduce concepts before relying on them; rewrite definitions in place rather than layering caveats. Shortening must preserve necessary instructions and qualifications.\n- **Accuracy and usability:** verify claims against behavior and examples against their commands. Check links and read affected rendered sections as a reader encounters them.\n\nFor each finding, give the location, reader impact, and a concrete replacement or deletion. Apply corrections in the canonical source, regenerate mirrors, and run the checks in `docs/AGENTS.md`. Have the reviewer check the corrected passages before closing findings. Record the reviewed range and SHA, coverage, findings, and their disposition in the release review; unresolved findings block tagging. Changelog claims and credits also receive the verification below.\n\n## CHANGELOG Review\n\nDraft entries from the commits since the last release:\n\n```bash\ngit log v<last-version>..HEAD --oneline\n```\n\n**IMPORTANT: Don't trust commit messages.** Commit messages often undersell or misdescribe changes. For any commit that might be user-facing:\n\n1. Run `git show <commit> --stat` to see what files changed\n2. If it touches user-facing code (commands, CLI, output), read the actual diff\n3. Look for changes bundled together — a \"rename flag\" commit might also add new features\n\nCommon patterns where commit messages mislead:\n- \"Refactor X\" commits that also change behavior\n- \"Rename flag\" commits that add new functionality\n- \"Fix Y\" commits that also improve error messages or add hints\n- CI/test commits that include production code fixes\n\nNotable changes to document:\n- New features or commands\n- User-visible behavior changes\n- Bug fixes users might encounter\n\n**Section order:** Improved, Fixed, Documentation, Internal. Documentation is for help text, web docs, and terminology improvements. Internal is for selected notable internal changes (not everything).\n\n**Within each section, order by reader interest.** The section is the first ordering dimension and is fixed; reader interest is the second, and it decides rank inside a section. A change's class does not: a behavior change nobody asked for ranks below a feature people requested, and a fix every user hits ranks above a platform-specific one. Interest combines how many readers a change reaches with how much it obliges each of them to act, and never counts the effort the change took to build — effort and interest diverge most on the change just finished, which is the one being written up. So a breaking change stays near the top of its section: it reaches few readers, but every one of them has to do something about it.\n\n**Breaking changes:** Note inline with the entry, not as a separate section:\n\n```markdown\n- **Feature name**: Description. (Breaking: old behavior no longer supported)\n```\n\nSkip: internal refactors, test additions (unless user-facing like shell completion tests).\n\n### Length and tone\n\n**Combine related bullets.** Several PRs that share a theme — e.g. three perf changes that together account for one user-visible speedup — belong in one bullet, not three. The reader cares about the net change, not the PR boundaries. Cite all the PRs in the trailing `([#a](...), [#b](...), [#c](...))` list.\n\n**Be brief — the ceiling is words, not sentences.** A bullet aims at 35 words; a dense one runs to 60, and the two or three headline entries may reach 80; Internal-section bullets get one sentence. Drop the \"why we did it this way\" details unless they change how the user thinks about the change, and leave code examples and `Cmd::stream` / `OnceCell` / `DashMap`-style internals in the PR description, where the reasoning belongs.\n\nSentences stretch to fit whatever you want to say; words don't. So measure rather than judge:\n\n```bash\nawk '/^## /{if (f) exit; f=1} f' CHANGELOG.md \\\n  | awk '/^- \\*\\*/ {n=split($0,_,\" \"); t+=n; c++; if (n>60) o++; printf \"%4d  %.58s\\n\", n, $0} END {printf \"\\n%d entries, %d avg, %d over 60\\n\", c, c?t/c:0, o}'\n```\n\n**Calibrate against the ceiling, not against the last release.** Length ratchets: each release is drafted beside the previous section, and an abstract rule loses to a concrete neighbouring exemplar every time. Entries grew from 49 to 101 words on average across five releases while this skill said \"be brief\" throughout. Read the previous section for what it drifted to, then ignore it and write to the ceiling.\n\n**Entries describe.** An entry records what the old behavior was and what it is now. Give imperative guidance only for a material issue that affects a sizable share of users, which is rare; otherwise remediation belongs in the PR description.\n\n**No editorial framing.** Describe what changed, not what was wrong with the previous decision in subjective terms. Avoid words like \"sledgehammer\", \"ugly\", \"noisy\", \"wrong\" applied to past code. State the prior behavior neutrally and the new behavior plainly.\n\n**Good:** \"Removed `.pi/` from the default excludes list; users who need it can add it via `[step.copy-ignored]`.\"\n**Bad:** \"Removed `.pi/` — a sledgehammer fix from an unrelated debugging session that has no place as a project-agnostic default.\"\n\n**Match a fix's prominence to its reach.** Readers skim the bold headlines, so the headline, and whether the fix has a bullet of its own, tell them how big it was before they read any body text. A correctness or data-loss fix usually needed narrow conditions — a non-default git config, a command run from a particular place, a change of a particular shape. Put them in the headline and the consequence in the body: a headline that states the consequence tells every reader it could have been them, and conditions arriving after it don't undo that. Join the conditions with \"and\": \"X set *and* run from Y\" is a corner case, while \"X or Y\" reads as two common triggers. Establish each one by reproducing against the previous release's binary rather than reading it off the diff — a condition assumed is a condition the entry overstates, and overstating a data-loss bug is its own kind of inaccuracy.\n\n**Good:** \"**Submodules with an `ignore` setting**: when `submodule.<name>.ignore` hid uncommitted changes inside a submodule, `wt remove` read the worktree as clean and removed it with them.\"\n**Bad:** \"**`wt remove` no longer deletes submodule changes hidden by config**: with `submodule.<name>.ignore` set *and* uncommitted changes inside a submodule, …\" — every condition is there, but the headline has already announced a data-loss bug to every reader.\n\nA fix of near-zero reader interest (see the ordering rule above) — a name starting with `-`, a non-UTF-8 path, one platform with an unusual environment — gets no bullet of its own. Fold these into a closing bullet such as \"Fixes for unusual setups\" that names each case in a clause. A section of separate bold fixes reads as that many ways the tool broke, whatever their bodies say.\n\n### Credit External Contributors\n\nFor any changelog entry where an external contributor (not the repo owner) authored the commit, add credit with their GitHub username:\n\n```markdown\n- **Feature name**: Description. ([#123](https://github.com/user/repo/pull/123), thanks @contributor)\n```\n\nFind external contributors:\n```bash\ngit log v<last-version>..HEAD --format=\"%an <%ae>\" | sort -u\n```\n\nThen for each external contributor's commit, find their GitHub username from the commit (usually in the email or PR).\n\n### Credit Issue Reporters\n\nWhen a fix or feature addresses a user-reported issue *in this repo*, thank the reporter — not just the PR author. Users who take time to report bugs, request features, or provide reproduction steps deserve recognition. (Don't credit reporters from upstream/external repos — only issues filed here.)\n\n```markdown\n- **Feature name**: Description. ([#456](https://github.com/user/repo/pull/456), thanks @reporter for reporting)\n```\n\nFor fixes that reference issues:\n\n```markdown\n- **Bug fix**: Description. Fixes [#123](https://github.com/user/repo/issues/123). (thanks @reporter)\n```\n\n**Finding reporters — do ALL three steps:**\n\nIssues may have been filed months before the fix. Bug reports also appear as PR comments, not just issues. These steps are complementary; each catches things the others miss.\n\n1. **Extract every issue/PR reference from every commit** (PRIMARY):\n   ```bash\n   git log v<last-version>..HEAD --format=\"%B\" | grep -oE '#[0-9]+' | sort -t'#' -k2 -n -u\n   ```\n   For **each** referenced number: run `gh issue view N --json title,author,state`. This catches issues filed months ago — the most commonly missed credits.\n\n2. **Check PR comments for bug reports** (catches reports that never became issues):\n   For feature PRs referenced in commits, check comment threads for users reporting problems:\n   ```bash\n   gh pr view NNN --json comments --jq '.comments[] | \"\\(.author.login): \\(.body[:150])\"'\n   ```\n\n3. **Survey every issue opened or closed since last release** (catches unreferenced matches):\n   ```bash\n   git log -1 --format=%cs v<last-version>\n   gh issue list --state all --search \"created:>=<date>\" --json number,title,author --limit 100\n   gh issue list --state closed --search \"closed:>=<date>\" --json number,title,author --limit 100\n   ```\n   Cross-reference every title against changes in this release.\n\n**When to credit:**\n- Bug reports with clear reproduction steps (in issues OR PR comments)\n- Feature requests that shaped the implementation\n- Performance reports with measurements (like \"takes 15s\")\n- Users who helped diagnose issues through discussion\n\nSkip credit for: issues opened by the repo owner, trivial reports, or issues that were substantially different from what was implemented.\n\n### Link Significant Features to Docs\n\nFor major features with dedicated documentation, include a docs link. Use full URLs so links work from GitHub releases:\n\n```markdown\n- **Hook system**: Shell commands that run at key points in worktree lifecycle. [Docs](https://worktrunk.dev/hook/) ([#234](https://github.com/user/repo/pull/234), thanks @contributor for the suggestion)\n```\n\nLink when there's substantial documentation the user would benefit from reading — new commands, feature pages, or Tips & Patterns sections. Skip for minor improvements.\n\n### MANDATORY: Verify Each Changelog Entry\n\n**After drafting changelog entries, you MUST spawn a subagent to verify each bullet point is accurate.** The tag publishes this text as the GitHub release body, so a correction afterwards takes a follow-up PR to `CHANGELOG.md` and a hand-edit of the release page, and people have read the wrong line by then. This pass is worth as much time as it takes.\n\n**The gate cuts both ways.** Checking only accuracy pushes every entry longer: \"understates\" and \"not covered\" have no counterweight, so each pass adds and none subtracts. That asymmetry is what drove the ratchet above. An entry that is too long, too internal, or ranked above one more readers will notice is reported on the same footing as one that is wrong.\n\n**Subagent prompt template:**\n\n```\nVerify these changelog entries for version X.Y.Z are accurate. They publish with\nthe tag, and by the time anyone corrects a wrong line, readers have acted on it.\nSpend the time to read a source for each one: reading the entry and finding it\nplausible is not a check, because the entry was written from the same commits you\nare about to read.\n\nPrevious version: [e.g., v0.1.9]\nCommits to check: git log v<previous>..HEAD\n\nEntries to verify: the top section of CHANGELOG.md as it stands on disk. Read it\nthere rather than from a paste:\nawk '/^## /{if (f) exit; f=1} f' CHANGELOG.md\n\nVerify claim by claim, not entry by entry: an entry carries several independent\nclaims, and one verdict over the whole entry waves through every claim that is not\nits headline.\n\n1. Find the relevant commit(s) using git log and git show\n2. Read the diff, not the commit message. The diff settles what changed, and\n   nothing else: not what the behavior was before, not what the user sees, not\n   what a file it doesn't touch does. Settle a \"previously\" / \"no longer\" / \"so X\n   broke\" claim by reading the old file (`git show <sha>^:<path>`) and confirming\n   the old behavior there. The new code's handling of the old case is not that\n   confirmation: a case added together with a comment about why it produces\n   nothing reads in a diff exactly like a case that used to produce something.\n   Some claims have no source in the commit at all — a version floor, what a\n   rendered page shows, how another component behaves. Read that source: the\n   rendered output, the other component's own file, the upstream project's own\n   releases\n3. Flag any claim its source does not support, whether it overstates,\n   understates, or misdescribes\n4. Flag if the entry runs over 60 words (80 for one of the two or three headline\n   entries), restates the PR description, or explains mechanism the reader cannot\n   act on — report these as seriously as an inaccuracy, and quote a shorter\n   rewrite that keeps every user-facing claim\n\nAlso check:\n- Are there user-facing changes NOT covered by these entries?\n- Verify each \"thanks @...\" attribution (right person, right role — author vs reporter)\n- Within each section, is any entry ranked above one that more readers will notice?\n- Read each headline alone, as a skimming reader does. Flag one that states the\n  consequence (what was lost or broken) rather than the situation it needed, and a\n  fix almost no reader will notice that has its own bullet rather than a clause in\n  a closing roll-up.\n\nReport format:\n- Entry: [entry text]\n  Status: ✅ Accurate / ⚠️ Needs revision / ❌ Incorrect\n  Length: [word count] — ✅ / ⚠️ over ceiling\n  Evidence: [for each claim, the source you read and what it said]\n  Suggested fix: [if needed]\n```\n\n**The pass ends on a clean run, not on the first run's findings.** A rewrite the verifier suggests has no more evidence behind it than one you wrote yourself, and an entry you edit while the pass runs is in the same state — both leave that entry unverified. Re-run over the section as it now stands, and finalize only once a run comes back clean.\n\n`evals/README.md` beside this skill holds four entries from a shipped release, three of them wrong, for scoring a change to this template against what the last wording missed, and a drafting case for the prominence rule.\n\n**If verification finds problems:** Escalate to the user. Show them the subagent's findings and ask how to proceed. Don't attempt to resolve ambiguous changelog entries autonomously — the user knows the intent behind their changes better than you do.\n\n## Determine Release Type\n\nPick the bump from the changes. Skip the question when only one level is plausible; ask only when the choice is genuinely ambiguous.\n\n**Proceed without asking when the answer is obvious:**\n\n- `cargo semver-checks` reports breaking changes → minor (pre-1.0; patch is disallowed, major has no basis pre-1.0 in a maturing project). Inform the user and continue: \"Bumping minor — semver-checks reported N breaking changes; patch is disallowed pre-1.0.\"\n- Only bug fixes and internal commits since the last release, no new features, no semver breakage → patch. Inform the user with the same shape.\n\n**Ask only when genuinely ambiguous** — e.g., new features landed with no semver breakage (patch vs. minor is a judgment call), or a borderline case where the user's read of the changes may differ. Use `AskUserQuestion` with the actual choice (patch vs. minor); don't add novelty options like skipping a version number.\n\nWhen asking, present:\n1. Current version (e.g., `0.2.0`)\n2. Brief summary of changes (new features, bug fixes, breaking changes)\n3. Your recommendation with reasoning\n\nExample:\n\n```\nCurrent version: 0.2.0\nChanges since v0.2.0:\n- Added `state clear` command (new feature)\n- Added `previous-branch` state key (new feature)\n- No breaking changes\n\nRecommendation: Minor release (0.3.0) — new features, no breaking changes\n```\n\n## Version Guidelines\n\n- **Second digit** (0.1.0 → 0.2.0): Backward incompatible changes\n- **Third digit** (0.1.0 → 0.1.1): Everything else\n\nCurrent project status: maturing mode (see [AGENTS.md › Project Status](../../../AGENTS.md)). External interfaces — the config file format (`wt.toml`, user config) and CLI flags/arguments — carry compatibility weight, so breaks there need justification (a real improvement, not cleanup) and prefer deprecation warnings over silent breaks. Everything else, including the internal and library APIs, stays flexible: worktrunk ships breaking library changes freely and bumps the version each time, putting no weight on the existing internal APIs.\n\n## Library API Compatibility\n\nWorktrunk is a CLI tool. The `[lib]` crate in `Cargo.toml` does expose a public API, but it is **not a compatibility surface** — per [AGENTS.md › Project Status](../../../AGENTS.md) there are no Rust library compatibility concerns, and the project ships breaking library changes freely, bumping the version each time (see the \"Breaking library API\" entries in `CHANGELOG.md`). Downstream crates are expected to pin.\n\n`cargo-semver-checks` is therefore an **advisory bump-level input**, not a gate that commits us to keeping the API stable for downstream crates. It compares the current public API against the last version published to crates.io and reports semver-relevant changes — a useful signal for choosing the bump:\n\n```bash\ncargo semver-checks check-release -p worktrunk\n```\n\nInterpreting results:\n\n- **No issues reported**: no library-level signal for the bump. Choose based on CLI changes and new features.\n- **Breaking changes reported**: expected and acceptable — breaking the library API is not something to avoid here. But under semver a breaking change still warrants at minimum a minor bump while pre-1.0 (e.g., 0.37.0 → 0.38.0) rather than a patch. Bump accordingly; this is version mechanics, not a signal to preserve the old API.\n- **Tool fails to run** (e.g., missing baseline): likely the crate hasn't been published yet or the registry cache is stale. Try `cargo semver-checks check-release -p worktrunk --baseline-version <last-published>`.\n\nThis check validates the chosen bump — it doesn't distinguish patch vs. minor when no breakage exists. Continue using the commit review to decide between patch (fixes only) and minor (new features).\n\n<!-- File: .claude/skills/running-tend/references/nightly-cleaner.md (Tokens: ~300 | Category: anthropic-skill) -->\n# References Skill\n\nPath: `.claude/skills/running-tend/references/nightly-cleaner.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/.claude/skills/running-tend/references/nightly-cleaner.md)\n\n<!-- File: .claude/skills/running-tend/references/review-pr.md (Tokens: ~300 | Category: anthropic-skill) -->\n# References Skill\n\nPath: `.claude/skills/running-tend/references/review-pr.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/.claude/skills/running-tend/references/review-pr.md)\n\n<!-- File: .claude/skills/running-tend/SKILL.md (Tokens: ~7099 | Category: anthropic-skill) -->\n---\nname: running-tend\ndescription: Worktrunk-specific guidance for tend CI workflows. Adds codecov polling, Rust test commands, labels, and review criteria on top of the bundled tend-ci-runner skills. Use when operating in CI.\nmetadata:\n  internal: true\n---\n\n# Worktrunk Tend CI\n\nProject-specific guidance for tend workflows running on worktrunk (a Rust\nCLI for managing git worktrees). The bundled `run-tend`, `review`, and `triage`\nskills provide the workflow framework; this skill adds worktrunk conventions.\n\n## Filing issues in other repos\n\nStanding exceptions granted, each filing directly without asking permission\nhere first:\n\n- agent-equipped targets (per **Filing issues** in the bundled\n  `act-in-other-repos` skill)\n- any project the weekly digest finds copying Worktrunk's code without its\n  license notice (`references/feedback-digest.md`, \"Projects that copy\n  Worktrunk's code\")\n\nThe default rule (open an issue here asking permission first) applies to every\nother target.\n\n## Codecov Monitoring\n\nAfter required CI checks pass, poll `codecov/patch` — it is mandatory despite\nbeing marked non-required:\n\n```bash\nfor i in $(seq 1 5); do\n  CODECOV=$(gh pr checks <number> 2>&1 | grep 'codecov/patch' || true)\n  if echo \"$CODECOV\" | grep -q 'pass'; then\n    echo \"codecov/patch passed\"; exit 0\n  elif echo \"$CODECOV\" | grep -q 'fail'; then\n    echo \"codecov/patch FAILED\"; exit 1\n  fi\n  sleep 60\ndone\n```\n\nIf codecov fails **locally**, investigate with `task coverage` and\n`cargo llvm-cov report --show-missing-lines | grep <file>`.\n\n### Investigating codecov failures in CI\n\n`task` and `cargo-llvm-cov` are not installed in the `tend-setup` action.\nDon't try to `cargo install` them in the sandbox — past attempts at\nsource-compiling installs cascaded into bash-tool interrupts that blocked\neven `pwd` and `echo`. Instead, query Codecov directly, following\n`tests/AGENTS.md` → **Coverage Investigation** for the endpoints and their\ntraps. The scratch paths there and below go to `${TMPDIR:-/tmp}` — write new\nones the same way.\n\nIf the Codecov API markers aren't enough, download the `code-coverage-report`\nartifact from the PR head's `coverage` workflow run — it contains a\n`cobertura.xml` with per-line hit counts:\n\n```bash\nREPO=$(gh repo view --json nameWithOwner --jq '.nameWithOwner')\n# Find the coverage run on the PR head SHA:\nCI_RUN=$(gh api \"repos/$REPO/commits/<sha>/check-runs\" --jq '.check_runs[] | select(.name == \"code-coverage\") | .details_url | capture(\"runs/(?<id>[0-9]+)\") | .id')\n# List artifacts, then download the coverage one:\ngh api \"repos/$REPO/actions/runs/$CI_RUN/artifacts\" --jq '.artifacts[] | {name, id}'\ngh api \"repos/$REPO/actions/artifacts/<id>/zip\" > \"${TMPDIR:-/tmp}/coverage.zip\"\nunzip -q \"${TMPDIR:-/tmp}/coverage.zip\" -d \"${TMPDIR:-/tmp}/coverage\"\n```\n\n## Test Commands\n\n```bash\ncargo run -- hook pre-merge --yes   # full suite + lints\ncargo test --lib --bins             # unit tests only\ncargo test --test integration       # integration tests only\n```\n\nCI runs on Linux, Windows, and macOS.\n\n## Rework a test that reaches for its environment\n\nA test that leans on inherited state — the process CWD, an ambient env var —\nsets up its own instead, via `TestRepo::with_initial_commit()` plus a tempdir,\nthe way most worktrunk tests already do. Guarding it with an early return\n(**Don't \"fix\" tests by adding skip guards** in the bundled `fix-a-bug` skill)\ndrops the coverage rather than restoring it. This governs every workflow that\nfixes a test here, not just issue triage.\n\n## Session Log Paths\n\nThe artifact directory is named after the agent's working directory, which\nmoves between tend releases — 0.2.5–0.2.13 used a per-run\n`tend-agent-workspace-*/checkout`, and from 0.2.14 the agent works in the\nrunner's own checkout, so `-home-runner-work-worktrunk-worktrunk/` is the\nprefix again. Match on neither literal: use the bundled\n`find \"$DEST\" -name '*.jsonl'` recipe, which holds across all of them — every\nshape is one `<session-id>.jsonl` under a single slugified directory.\n\n## Labels\n\n- `automated-fix` — fix PRs from triage\n- `nightly-cleanup` — nightly sweep issues and PRs\n\n## CI Failure Triage: Prefer Rerun for Transient Infrastructure Failures\n\nBefore opening a PR for a CI failure, classify it:\n\n- **Transient infrastructure** (link-check timeouts, apt-get flakes, GitHub\n  outages, runner disk issues, codecov upload blips) — do **not** create a\n  PR. Rerun the failed jobs yourself (**Rerunning failed jobs** in the bundled\n  `monitor-ci` skill) rather than leaving the rerun to the maintainer, and\n  report its result where you post the diagnosis. A permanent config change\n  for a one-off timeout is churn the maintainer will close.\n- **Flaky test** (known-flaky or first-seen PTY/shell test) — try to fix it.\n- **Real regression** — proceed with a fix PR.\n\n**Non-required ≠ transient.** A non-required job (e.g. `collect affected coverage`, `affected tests (linux, advisory)`) can fail from a real regression. The required/non-required distinction is about merge-blocking, not about how the failure is classified. If a deterministic build error (`error[E...]`, \"binary not found\", \"ambiguous candidates\", missing target) repeats across consecutive runs of the same shape, it's a real regression even when the job is advisory. Reserve \"transient\" for non-deterministic causes: `BrokenPipe`, `connection reset`, runner disk full, GitHub API timeouts, host-availability blips.\n\n**Lychee link-check timeouts are always transient** unless the same URL has\nfailed on at least two separate runs within the last few days. The check runs\nas the `link-check` job in the `nightly` workflow. `.config/lychee.toml`\nalready sets `max_retries = 6` and lists known-unreliable hosts; one timeout\nis not enough evidence to extend that list. Signals you have a transient\nfailure, not a broken link:\n\n- The previous run on the same or a nearby commit passed.\n- Only `[TIMEOUT]` is reported (not `404`/`403`/`410`).\n- The URL is reachable from a local `curl`.\n\nWhen in doubt, post the diagnosis on the failure cause issue and wait — don't open a PR.\n\n## Applying GitHub Suggestions\n\nApply the literal suggestion only — change the lines it covers, nothing more.\nIf surrounding lines also need updating, note that in your reply.\n\n## PR Review: Don't Self-Dismiss Over Unrelated Test Flakes\n\nIf a clearly-unrelated test or infrastructure failure turns a check red after\nyou've already approved a PR, leave the approval in place. Do **not** dismiss\nyour own approval to \"gate\" on a rerun — but do start the rerun yourself and\nreport its result; a diagnosis that says a rerun should clear the failure is\nthe cue to run it, not to hand it to the maintainer.\n\nGitHub blocks both `gh run rerun --failed` and per-job rerun\n(`POST /repos/{owner}/{repo}/actions/jobs/{id}/rerun`) with HTTP 403 while\n*any* job in the same workflow run is still `in_progress`, and\n`tend runtime rerun-failed-jobs` doesn't wait for that. Rerun failed jobs in\nworkflow runs that have finished now, and those in a run still going once it\ncompletes.\n\nRerun only runs on the PR's current head. The CI workflows' concurrency groups\nare keyed by PR number with `cancel-in-progress`, so rerunning an older head's\nrun cancels the current head's run in that workflow.\n\nThe codecov-failure dismissal pattern is different and remains correct:\n`AGENTS.md` requires explicit user approval before merging with failing\n`codecov/patch`, so dismissing the approval until the coverage gap is\naddressed is intentional.\n\n## Weigh the root-cause fix before shipping a workaround\n\nWhen a mismatch, a false positive, or a stale value has an obvious non-code\nworkaround (a template change, a config value, an alias, a comment recording\nthe drift), don't stop there. First check whether the workaround is **lossy or\nfoot-gunny**, and weigh a proportionate **root-cause code fix** before opening\na PR that only records it. A \"docs-only, no risk\" framing is not the same as\ngood guidance — a zero-code-risk change can still steer users toward a\ncollision-prone or lossy config, and annotating a stale value leaves the\nduplication that made it stale. If you do recommend a workaround, surface its\ndownsides in the PR body up front, not only when challenged.\n\nThis governs every workflow that opens a PR here, not just issue triage.\n\n## Issue Triage\n\nWhen you need more information to diagnose a reported bug, the **primary\nask is `wt -vv <command>`**. Re-running the failing command with `-vv`\nwrites a diagnostic bundle — a single report containing wt/git/OS versions,\nshell integration, `wt config show`, `git worktree list --porcelain`, and a\n`trace.log` of every git invocation with its output. The `-vv` output prints\nthe bundle's exact absolute path (`Diagnostics and performance profile\nsaved @ …`) followed by a ready-to-run `gh gist create --web\n<path>` line — **point the user at those printed lines; don't hand them a\nhardcoded path**. In particular, never tell them to `cat\n.git/wt/logs/diagnostic.md`: inside a linked worktree `.git` is a gitdir\n*file*, not a directory, so that path fails with `Not a directory (os error\n20)` (`ENOTDIR`). The bundle actually lives under the git *common* dir —\n`\"$(git rev-parse --git-common-dir)/wt/logs/diagnostic.md\"` resolves from any\nworktree, and the printed absolute path already points there. One gist URL\npasted into the issue gives us most of what we'd otherwise ask for piecemeal,\nso lead with this for unexplained failures rather than chaining\nversion/config/repro questions across multiple round-trips.\n\nWhen the report is about a slow `wt` command, read its **Performance profile**\nsection first. It renders the same breakdown as `wt config state logs profile`\n(subprocess time by command type, slowest calls, repeated `(command, context)`\npairs) directly from the bundled `trace.log`, so you can spot redundant git\ncalls and slow commands without parsing the raw trace by hand. The same\nreport run against a statusline capture is the weekly per-render cache\ncheck — see **Weekly Maintenance: Statusline Cache-Check**.\n\nReach for narrower asks only when the diagnostic is overkill:\n\n- `wt --version` — when the only question is whether a fix has landed.\n- `wt config show` — when the suspicion is purely config/shell-integration\n  and you already have the command + repro.\n\n### Don't ship fixes you can't verify\n\nWhen the bug or proposed fix turns on runtime state the bot can't observe from CI — plugin hooks firing inside an agent CLI (Claude Code, Codex, Antigravity), shell-integration side effects, interactive prompt rendering, signal forwarding into a TTY — do **not** open a PR premised on the hypothesis. Signals to stop:\n\n- The proposed transition fires inside a running agent session the bot can't drive from a test (`PostToolUse`, `Stop`, `Notification`, statusline redraws).\n- The \"analysis\" in the issue is an LLM-written trace pasted by the reporter, not a verified observation. Treat that as a starting hypothesis, not ground truth — a Claude-written explanation of why X is broken is no more trustworthy than the bot's own first guess.\n- The repro requires an interactive shell or `claude` running in a tmux that the bot can't spin up.\n\nComment on the issue with what's known, ask the reporter for the concrete symptom they observe (\"which marker shows where, when\") rather than for a fix to validate, and exit without a PR. The bar for opening a fix PR is *the failure mode is reproducible and the fix is testable*, not *the hypothesis seems plausible*. If you post a fix despite limited testability (rare — usually only when the reporter has confirmed the exact symptom and the code change is obviously correct from inspection), explicitly flag what wasn't verified in the PR body.\n\n### Feedback digest issues\n\nAn issue labeled `feedback-digest` is the weekly report, not a bug report. The\nweekly run files each confirmed bug in it as its own issue, so triage posts\nnothing on it.\n\n### Closing Duplicates\n\nWhen an issue is clearly a duplicate, close it after commenting. Use\n`gh issue close <number>` and tell the reporter: if they believe this was\nclosed in error, they can let us know and we'll reopen it.\n\n### Check `--config-set` before calling a setting unpinnable\n\n`wt --config-set '<toml>'` overrides any user config key for one invocation,\nabove both config files and `WORKTRUNK_SECTION__KEY` env vars ([inline config\noverrides](https://worktrunk.dev/config/#inline-config-overrides-config-set)).\nThe resolver just reads `repo.config().<key>` and shows no sign of that layer,\nso before writing \"there's no way to do X per invocation\", ask whether X is a\nconfig key: the ask is usually already met, and the reply is a `--config-set`\nrecipe plus a docs fix where the docs don't connect the flag to the setting.\nPinning is all that covers — weigh the request's residual asks on their own\nmerits.\n\n### Suggesting Aliases for Niche Feature Requests\n\nworktrunk deliberately limits flag and config growth, so a `wt` alias is the\nstanding answer to a narrow feature request rather than a new native flag.\nSuggest one when the request serves a single reporter's workflow or a small\nsubset of users (idempotent create-or-switch, auto-push after merge) and\ncomposes from existing `wt` commands.\n\nAnswer with a `wt` `[aliases]` entry. Defined in user config, it resolves\n`wt <name>` to the alias whenever no built-in matches, so the same alias works\nacross every repo. It's the project's preferred extension point.\n\n**How to respond:**\n1. Search open and closed issues for the same request and link the prior\n   thread; these asks recur, and the link lets the deflection read as a\n   considered position rather than a brush-off.\n2. Draft the alias.\n3. Test it in a scratch worktree against the happy path and edge cases (branch\n   already exists, dirty worktree). When a surprising behavior turns up, note\n   it in the reply instead of building the alias around it. For example, a\n   create-or-switch wrapper inherits `wt switch <name>`'s habit of\n   materializing a *remote* branch of the same name.\n4. Post the tested alias with usage examples.\n5. Link to the [aliases docs](https://worktrunk.dev/extending/#aliases) and\n   [tips & patterns](https://worktrunk.dev/tips-patterns/).\n\n## Weekly Maintenance: MSRV & Toolchain\n\nBump both MSRV and the development toolchain to **latest stable − 1**. When\nRust 1.N is the current stable release, set both to 1.(N−1).\n\nFiles to update:\n\n| File | Field | Example (if stable is 1.94) |\n|------|-------|----|\n| `Cargo.toml` | `rust-version` | `\"1.93\"` |\n| `tests/helpers/wt-perf/Cargo.toml` | `rust-version` | `\"1.93\"` |\n| `rust-toolchain.toml` | `channel` | `\"1.93.0\"` |\n| `.github/workflows/nightly.yaml` | `rustup override set nightly-<date>`, twice (`minimal-versions`, `check-unused-dependencies`) | a nightly from the last few weeks |\n\nBump the nightly pins only when the pinned date is more than three months old.\nCargo refuses a workspace whose `rust-version` exceeds the toolchain, so an\nMSRV bump past a stale pin fails both jobs before they check anything.\n\n`flake.nix` reads the channel from `rust-toolchain.toml`, so the Nix build\nfollows this bump. Dependabot keeps `flake.lock` current, including the\n`rust-overlay` revision that has to know the new channel; a lock too old for\nit fails the `nix-flake` job this PR triggers.\n\nAfter bumping, run the full test suite (`cargo run -- hook pre-merge --yes`)\nand verify `cargo msrv verify` passes.\n\n## Weekly Maintenance: CI Pin Bumps\n\nPinned third-party versions in CI are invisible to Dependabot — it follows `Cargo.toml` deps and `uses: foo@vN` action refs, not inline `version:` strings. They drift unless this step bumps them.\n\nEach weekly run checks every pin below against upstream and bumps whatever has drifted. A bump that can turn a whole CI leg red — an OS image, a major version, a tool whose version moves snapshots — goes on its own branch and PR, so a red matrix decides only that bump instead of holding back the week's safe ones. The weekly runner is Linux, so that PR's own checks are the only place a macOS or Windows change gets tested; open it and report what they said.\n\n- **`baptiste0928/cargo-install@v3` blocks** in `.github/workflows/{affected,ci,coverage,nightly}.yaml` and `.github/actions/{test,tend}-setup/action.yaml` — every `version: \"=X.Y.Z\"` against `cargo info <crate>`. Today: `cargo-affected`, `cargo-insta`, `cargo-nextest`, `cargo-llvm-cov`, `cargo-msrv`, `cargo-udeps`, `lychee`, `worktrunk`. `cargo-affected` is pinned twice in `affected.yaml`; move both together. Verify each crate's `rust-version` against the pinned toolchain and note compatibility in the PR body (see PR #1657 for the format).\n- **`hustcer/setup-nu@v3`** `version:` input — latest from `gh api repos/nushell/nushell/releases/latest --jq '.tag_name'`. Five call sites: `coverage.yaml` (`code-coverage`), `nightly.yaml` (`feature-powerset`), `benchmarks.yaml` (`benchmarks`), and `.github/actions/{test,tend}-setup/action.yaml` — `tend-setup`'s copy is what puts `nu` in the agent's sandbox, so it moves with the others.\n- **Codex Cloud tools** — `.codex/cloud.sh` pins pre-commit, cargo-insta, cargo-nextest, Nushell, and PowerShell; `setup-web` pins Nushell and PowerShell. Keep cargo-insta, cargo-nextest, and Nushell level with `.github/actions/test-setup/action.yaml`, which pins the same three — the gate runs `--all-features`, so Nushell's version moves PTY snapshots. Nothing under `.github/` pins PowerShell (CI runs whatever the runner image ships), so bump that one on its own.\n- **Docs site packages** in `docs/package.json` are covered by Dependabot's `/docs` npm entry. Do not duplicate those bumps in this manual pin pass. The one thing that pass does own is the `ignore` entry for `typescript` majors in `.github/dependabot.yaml`: it suppresses the proposal Dependabot would otherwise make, so nothing else can surface it. Check `npm view @astrojs/check peerDependencies.typescript` against the current `typescript` major and delete the entry once the range covers it — the rule is version-agnostic, so left in place it blocks a major `@astrojs/check` fully supports just as silently as the TypeScript 7 it was added for (#3877).\n- **Runner images** — every `runs-on:` label and matrix `os:`/`runner:` value in the workflows. A pin equals what its `-latest` label currently resolves to, per the availability table in `actions/runner-images`:\n\n  ```bash\n  gh api repos/actions/runner-images/contents/README.md \\\n    -H 'Accept: application/vnd.github.raw' | sed -n '/^| Image/,/^$/p'\n  ```\n\n  Bump any pin the table no longer lists against `-latest`, and update `ci.yaml`'s header comment, which records the reason for each image it names. GitHub keeps two GA images per OS and begins deprecating the older one as soon as a newer goes GA, so a pin that has fallen off `-latest` is already the next one due; the table's `deprecated` badge marks that deadline, not the moment to move, and a row badged `preview` is not a bump target.\n\n  A variant label — `-arm`, `-intel`, `-large` — has no `-latest` of its own; it follows its base image's row.\n\n  Where a pin is deliberately held back, that comment says what the repo needs from the older image. Re-check that need against the newer image each week — upstream announces image changes as issues, so `gh search issues --repo actions/runner-images \"<the need> <newer image>\"` surfaces a reversal. Reading the cited issue's state is not the test — an announcement closes when its change ships, in either direction.\n\n  The `tend-*.yaml` workflows also pin a runner, but tend's generator writes them and `uvx tend@latest init` overwrites a hand edit; file a tend issue for those.\n\nDiscovery shortcut: a recent green CI run on `main` flags cargo-install drift directly via workflow annotations. `gh run view <run-id> --json jobs --jq '.jobs[].databaseId' | xargs -I{} gh api repos/<owner>/<repo>/check-runs/{}/annotations` returns one warning per outdated pin.\n\n## Weekly Maintenance: Statusline Cache-Check\n\nDetect new in-process cache-miss duplicates introduced by recent changes by\nprofiling a real `wt list statusline --format=claude-code` trace. Asynchronous\nstatuslines such as Claude Code and tmux run the render repeatedly through a\nsession, so duplicate git subprocesses there compound into measurable\nfseventsd / IPC load.\n\n```bash\n# Run from any worktree of this repo. `jq -n` builds the stdin JSON so the\n# recipe is portable (the weekly job runs on ubuntu-24.04, whose GNU sed\n# rejects BSD's `sed -i ''`) and so a path with a quote can't corrupt it.\njq -n --arg cwd \"$PWD\" '{\n  hook_event_name: \"Status\",\n  workspace: {current_dir: $cwd},\n  model: {display_name: \"Opus\"},\n  context_window: {used_percentage: 42.0}\n}' > \"${TMPDIR:-/tmp}/statusline-input.json\"\n\n# Debug build on purpose. `tend-weekly` installs no `wt` and restores no Rust\n# cache, so `--release` means a cold optimized build of the whole dependency\n# graph before the first render. The duplicate `(command, context)` pairs this\n# check reads are profile-independent; only the timing columns, which this\n# section doesn't triage, would be worth a release build.\ncargo run -- -vv list statusline --format=claude-code \\\n  < \"${TMPDIR:-/tmp}/statusline-input.json\" > /dev/null\ncargo run -- config state logs profile --format=json | jq .cache\n```\n\nThe `.cache` report flags commands invoked more than once with the same context.\nTriage each duplicate:\n\n- **Legitimate** (different cwd, different ref form that can't be normalized,\n  intentional double-call across phases) — note in the response and move on.\n- **Cache miss** (same logical operation should hit cache but doesn't) —\n  open an issue or fix it. Common shapes: `merge_base(\"main\", \"<sha>\")` vs\n  `merge_base(\"main\", \"branch\")` keying separately;\n  `worktree_at(cwd)` vs `worktree_at(porcelain_path)` not canonicalizing.\n\n## Weekly Maintenance: LLM Model Names in Docs\n\nGrep for current Claude and Codex pins across every tracked file:\n\n```bash\ngit grep -niE \"claude|codex\"\n```\n\nCheck the latest IDs at <https://docs.anthropic.com/en/docs/about-claude/models> and <https://developers.openai.com/codex/models>. The recommended commit-message commands should use the most recent fastest model from each vendor (Haiku for Anthropic, the smallest current Codex variant for OpenAI).\n\n**On drift, open a PR — don't file an issue.** The source of truth is `after_long_help` in `src/cli/mod.rs`; edit it and let `cargo test --test integration test_docs_are_in_sync` regenerate the mirrors under `docs/src/content/docs/` and `skills/worktrunk/reference/`. The \"smallest current variant\" call is a judgment — pick the one the vendor's models page currently positions as fastest/smallest, and explain the choice in the PR body. Verifying the new model name with an installed CLI (`codex -m <name>`, etc.) isn't possible in this CI sandbox; the PR is the right output anyway, and the maintainer tests on merge.\n\n## Weekly Maintenance: Projects Worktrunk Integrates With\n\nOther projects change on their own schedules. Agent CLIs change the surfaces\nWorktrunk's plugins hook into, and packagers and module authors carry copies of\nWorktrunk that fall behind it. Each week, check both tables below.\n\nFor each change that needs action, search this repo's open issues for it, then\nfile one issue or add to the one already open. Link the upstream entry or the\ndownstream file, and say what should change and in which repository. A fix in\nanother repository needs the maintainer's go-ahead under **Filing issues in\nother repos**, and the issue here asks for it. Don't open a PR speculatively.\nIf nothing changed, say so and move on. A source that errors or returns\nnothing leaves its row unchecked, so name it rather than report no change.\n\n### Agent CLIs\n\nKeep Worktrunk making full use of each agent CLI. A release that adds something\nWorktrunk could use, to do more or to do what it already does more simply,\nneeds action as much as one that breaks something Worktrunk relies on.\n\nRead what each source published in the last week. For a GitHub repository,\nlist its releases with `gh release list -R <repo> -L 50` and read each new\none's notes with `gh release view`.\n\n| App | Source to check | Integration surface |\n|-----|-----------------|---------------------|\n| Claude Code | `gh api repos/anthropics/claude-code/contents/CHANGELOG.md -H 'Accept: application/vnd.github.raw'`, plus `curl -sL https://code.claude.com/docs/en/statusline.md` for the statusline JSON schema | statusline stdin JSON, `WorktreeCreate`/`WorktreeRemove` hooks, plugin marketplace, `/wt-switch-create` |\n| Codex | `openai/codex` | plugin marketplace |\n| Antigravity | `curl -sL https://antigravity.google/docs/changelog.md` and `curl -sL https://antigravity.google/docs/hooks.md` | plugin layout (`plugins/worktrunk/.antigravity-plugin/plugin.json`, `hooks.json`), lifecycle hooks (`SessionEnd`, worktree hooks), `agy plugin install` |\n| OpenCode | `anomalyco/opencode` | plugins API in `~/.config/opencode/plugins/` |\n| Pi | `earendil-works/pi` | the extension events `dev/pi-extension.ts` uses, loaded from `~/.pi/agent/extensions/` |\n| oh-my-pi | `can1357/oh-my-pi` | the hook events `dev/omp-hook.ts` uses, loaded from `~/.omp/agent/hooks/pre/` by its extension runner |\n\nWhat to flag:\n\n- **New statusline JSON fields** — `src/commands/statusline.rs` parses `workspace.current_dir`, `model.display_name`, `context_window.used_percentage`, and `rate_limits.{five_hour,seven_day}.{used_percentage,resets_at}`. A newly added field (session cost, PR review state) may be worth surfacing in `wt list statusline`.\n- **Renamed or removed hook events** — `WorktreeCreate`/`WorktreeRemove` route agent worktree creation through `wt`; a renamed event silently disables isolation rather than erroring.\n- **Changed plugin install mechanisms** — `wt config plugins <app> install` breaks if the marketplace, plugins directory, or hook API changes.\n\n### Projects that carry Worktrunk\n\n| Project | Source to check | What it carries |\n|---------|-----------------|-----------------|\n| Distribution packages | Repology, below | a release |\n| conda-forge | `curl -sSf https://api.anaconda.org/package/conda-forge/worktrunk` (`latest_version`); Repology doesn't list it | a release |\n| home-manager | `modules/programs/worktrunk.nix` in `nix-community/home-manager` | the shell init lines, its own Claude Code hook for each event in `plugins/worktrunk/hooks/hooks.json`, the skills path inside the package |\n| nixpkgs | `pkgs/by-name/wo/worktrunk/package.nix` in `NixOS/nixpkgs` | the `skills/` directories it installs by name, the shell completions command |\n| aqua registry | `pkgs/max-sixty/worktrunk/registry.yaml` in `aquaproj/aqua-registry`, which `mise`'s `aqua:` backend also reads | the release asset names, and the cosign certificate identity each release's `packslip.sigstore.json` is verified against |\n\nRepology reports each distribution's version and whether it is outdated:\n\n```bash\ncurl -sSf -A 'worktrunk-weekly (https://github.com/max-sixty/worktrunk)' \\\n  https://repology.org/api/v1/project/worktrunk |\n  jq -er '.[] | \"\\(.repo) \\(.version) \\(.status)\"'\n```\n\nWhat to flag:\n\n- **A package behind Worktrunk's releases for longer than its usual lag.** Find\n  its pending update, usually a bot's version-bump PR in the package's\n  repository, and say why it stalled. Stable channels that freeze versions,\n  such as NixOS stable and Manjaro stable, lag by design.\n- **A copy that no longer matches Worktrunk.** Compare the downstream file with\n  `main`: each hook event and the command it runs, each skill directory, each\n  init line. Either side's commits can open a difference. Flag one that gives\n  the copy's users different behavior from Worktrunk's own integration.\n- **A downstream change that breaks this repo's packaging**, such as\n  home-manager declaring an option that `homeModules.default` in `flake.nix`\n  also declares.\n\nWhen a project that carries Worktrunk is missing from the table, such as a new\nmodule the feedback digest turns up, add it in a PR.\n\n## Weekly Maintenance: Feedback Digest\n\nOpen an issue with a digest of public feedback on Worktrunk since the previous\none, following `references/feedback-digest.md`.\n\n## README Date Check\n\nThe README blockquote opens with a month+year (e.g., \"**April 2026**\"). During daily\nmaintenance, verify the month matches the current month and update it if stale.\n\n## Per-Workflow References\n\n- **PR review**: `@references/review-pr.md` — Rust idioms, documentation accuracy, duplication search\n- **Nightly sweep**: `@references/nightly-cleaner.md` — survey checklist, branch naming, CI-breakage ownership\n\n<!-- File: .claude/skills/writing-user-outputs/SKILL.md (Tokens: ~11249 | Category: anthropic-skill) -->\n---\nname: writing-user-outputs\ndescription: CLI output formatting standards for worktrunk. Load before editing any code that calls warning_message, hint_message, error_message, info_message, eprintln, or println, or that produces strings the user will see (CLI help, progress UI, snapshot text). Documents ANSI color nesting rules, message patterns, and output system architecture.\nmetadata:\n  internal: true\n---\n\n# Output System Architecture\n\n## Shell Integration\n\nWorktrunk uses one file-based directive for shell integration:\n\n1. Shell wrapper creates a temp file via `mktemp`\n2. Shell wrapper sets `WORKTRUNK_DIRECTIVE_CD_FILE`\n3. wt writes a raw path to the file\n4. Shell wrapper changes directory to that path after wt exits\n\n`--execute` always launches its external program directly from wt, with the\nselected worktree as its working directory. It does not use a directive.\n\n## Output Functions\n\nThe output system handles shell integration automatically. Just call output\nfunctions — they do the right thing regardless of whether shell integration is\nactive.\n\n```rust\n// NEVER DO THIS - don't check mode in command code\nif is_shell_integration_active() {\n    // different behavior\n}\n\n// ALWAYS DO THIS - just call output functions\neprintln!(\"{}\", success_message(\"Created worktree\"));\noutput::change_directory(&path)?;  // Writes to directive file if set, else no-op\n```\n\n**Printing output:**\n\nUse `eprintln!` and `println!` from `worktrunk::styling` (re-exported from\n`anstream` for automatic color support and TTY detection):\n\n```rust\nuse worktrunk::styling::{eprintln, println, stderr};\n\n// Status messages to stderr\neprintln!(\"{}\", success_message(\"Created worktree\"));\n\n// Primary output to stdout (tables, shell code, pipeable)\nprintln!(\"{}\", table_output);\n\n// Flush before interactive prompts\nstderr().flush()?;\n```\n\n`src/` holds two crates, and the path differs between them: `worktrunk::styling`\nfrom the binary's modules — the ones `src/main.rs` declares (`commands`, `cli`,\n`display`, …), which the examples throughout this skill are written for — and\n`crate::styling` from the library's, the ones `src/lib.rs` declares (`git`,\n`config`, `shell_exec`, …), where `worktrunk::` does not resolve at all. The\nguard tests accept either, so the compiler is the only thing that tells you the\npath is wrong for the file.\n\nWhich `println!` is in scope decides whether a closed pipe panics: std's\npanics on the `BrokenPipe` write error, anstream's drops it. `wt … | head`\ncloses the pipe, so command code imports the `worktrunk::styling` one and no\n`std::println!` is left in `src/`.\n\nThe stderr macros carry the same rule for a different consequence: anstream's\n`eprint!` / `eprintln!` strip ANSI when stderr isn't a terminal, std's keep it,\nso a file importing one but not the other writes escapes on one line of a\nmessage block and not the next under `wt … 2>log`. `eprint!` is the half that\nslips — it has no newline, so it gets reached for mid-block in a file that\nimported only `eprintln`. Every bare `eprint!` / `eprintln!` under `src/` must\nresolve to anstream's: import it, or qualify the call as\n`styling::eprintln!(…)`. `check_stderr_macros_come_from_styling` in\n`tests/integration_tests/output_system_guard.rs` holds that statically, since\nno snapshot can — the suite forces `CLICOLOR_FORCE=1`, so both printers emit\ncolor and a snapshot agrees whichever macro is in scope. Its\n`STD_STDERR_ALLOWED_PATHS` exempts whole files, not calls, so an entry is only\nright where std's macro is right throughout.\n\nA write that names no macro misses that scan entirely, since the scan looks for\nthe name: `writeln!(std::io::stderr(), …)`, `std::io::stderr().write_all(…)`, a\nlocked handle, a bound one. `check_raw_stderr_writes_go_through_anstream`\nrefuses those shapes too, with its own `RAW_STDERR_ALLOWED_PATHS` — currently\njust `progress.rs`, whose spinner holds one lock across a frame (anstream's\n`stderr()` has none) and is tty-gated, so nothing of its output ever reaches a\nredirected stderr. The shape to watch for is a message rendered in one place\nand printed several layers below, where the printer has no idea it is handling\nnarration: `Cmd::delayed_stream`'s progress line is the example, and a raw\nhandle there made it the only colored line in a redirected `wt switch` log.\n\n**Output whose ANSI is already decided** declares that once at the top of the\ncommand with `worktrunk::styling::ColorChoice::Always.write_global()` and then\nprints through the same anstream macros — the statusline a shell prompt or\nClaude Code renders, and the `--help-page` document whose escapes the docs\npipeline turns into HTML (`--plain` and `--help-md` declare `Never` the same\nway). Neither consumer is ever a tty, so without the declaration anstream\nwould strip their color every time — and the test suite would not catch it,\nbecause it forces color with `CLICOLOR_FORCE=1`;\n`test_color_follows_the_consumer` pins the unforced behavior. Declare `Always`\nonly when the pipe is a courier rather than the destination; anything a person\nreads directly stays on plain anstream, which is what strips color on a pipe\nand honors `NO_COLOR`.\n\n**`--format=json` answers** use `crate::output::print_json` at the command\nhandler. Inner operations return typed facts; when work can complete before a\nlater failure, retain those facts in `CommandFailure<T>`. The outer handler can\nuse `finish_output` to emit the available result once and return the original\nerror for main's readable stderr diagnostics and native exit handling. A path\nwith no result emits nothing; a legitimate JSON null remains a result.\n\n**Shell integration functions** (`src/output/global.rs`):\n\n| Function | Purpose |\n|----------|---------|\n| `change_directory(path)` | Shell cd after wt exits (writes to directive file if set) |\n| `execute(argv)` | Run an external program in the selected worktree |\n| `terminate_output()` | Reset ANSI state on stderr |\n| `is_shell_integration_active()` | Check if directive file set (rarely needed) |\n| `pre_hook_display_path(path)` | Compute display path for pre-hooks |\n| `post_hook_display_path(path)` | Compute display path for post-hooks |\n\n**Message formatting functions** (`worktrunk::styling`):\n\n| Function | Symbol | Color |\n|----------|--------|-------|\n| `success_message()` | ✓ | green |\n| `progress_message()` | ◎ | cyan |\n| `info_message()` | ○ | symbol dim, text plain |\n| `warning_message()` | ▲ | yellow |\n| `hint_message()` | ↳ | dim |\n| `error_message()` | ✗ | red |\n| `prompt_message()` | ❯ | cyan |\n\n**Section headings** (`worktrunk::styling`):\n\n```rust\nuse worktrunk::styling::format_heading;\n\n// Plain heading\nformat_heading(\"BINARIES\", None)  // => \"BINARIES\" (cyan)\n\n// Heading with suffix\nformat_heading(\"USER CONFIG\", Some(\"@ ~/.config/wt.toml\"))\n// => \"USER CONFIG @ ~/.config/wt.toml\" (title cyan, suffix plain)\n```\n\n## stdout vs stderr\n\n**Decision principle:** stdout carries the command's *answer*; stderr carries *narration* about producing it. The discriminating question is answer-vs-narration, not audience — `wt list` is \"for the user\" yet belongs on stdout because it *is* the answer. \"Is this a message to the user?\" doesn't discriminate, because nearly all output is.\n\n- **stdout** → the answer, in whatever format the user selected. Data (tables, JSON, shell code, an expanded template) and `--dry-run` previews both qualify: a preview is the whole answer when nothing mutates. Human-formatted output belongs here too. Color strips automatically on a pipe (anstream), so `wt list | grep` stays safe.\n- **stderr** → narration about doing it: progress, success/warning/error messages, hints, interactive prompts, and `-v`/`-vv` diagnostics.\n- **directive file** → the raw cd path consumed after wt exits.\n\nThe same line can flip streams between modes. `wt config shell uninstall` deletes the file, so `✓ Removed … @ ~/.zshrc` only narrates a side effect that already happened → stderr (the edited file is the answer; stdout is empty). `wt config shell uninstall --dry-run` mutates nothing, so `○ Will remove … @ ~/.zshrc` is the only answer there is → stdout. What flips isn't the wording, it's whether a side effect exists to be the answer.\n\nFor a split preview, the `--format=json` payload is the arbiter: a line json would carry goes to stdout, narration json omits stays on stderr. `wt step prune --dry-run` puts the removal plan on stdout (the same plan json emits) but keeps \"Skipped young-branch (younger than 1d)\" and \"nothing to remove\" on stderr. One case ignores all this: a preview shown *inside* an interactive prompt, such as the `?` re-preview during `wt config shell install`, is mid-prompt narration → stderr.\n\nExamples:\n- `wt list`, `wt config show` → human table/dump or `--format=json`, both to stdout\n- `wt step prune --dry-run` → the removal plan to stdout (human or json); \"nothing to remove\" and skipped-young caveats to stderr\n- `wt config shell init` → shell code to stdout (for `eval`)\n- `wt switch` → status messages only (nothing to pipe)\n\n## When to page output\n\nRoute long, human-oriented stdout through `crate::help_pager::show_help_in_pager`. The helper TTY-detects internally, so piping (`wt … | grep`) keeps working.\n\nPage when output is human-oriented (headings, gutters, structure) and plausibly exceeds one screen. Don't page pipe-first data (tables, JSON, shell code), short output, or output already paged by a delegated tool (`git diff`).\n\nExamples that page: `--help`, `wt config show`, `wt hook show`, `wt step {commit,squash} --dry-run`. Examples that don't: `wt list`, `wt step diff`, `wt step eval`, `--show-prompt` (pipe-first by design).\n\nBuild the whole output into a `String` first (don't stream), then:\n\n```rust\ncrate::help_pager::show_help_in_pager(&out, true)?;\n```\n\nThe helper falls back to plain stdout when paging is disabled or unavailable,\nstdout is not a TTY, or the pager cannot start. Propagate its result so native\nsignal failures and cancellation reach command cleanup.\n\n## Security\n\n- `WORKTRUNK_DIRECTIVE_CD_FILE` holds a raw path (no shell parsing), so it's\n  safe to pass through to alias/hook child processes — a body that writes to it\n  can at worst redirect `cd`.\n\nAll directive env vars are removed from spawned subprocesses by default via\n`shell_exec::scrub_directive_env_vars()`. `DirectivePassthrough::inherit_from_env()`\nre-adds the CD file where a nested command may redirect the parent shell.\n\n## Windows Compatibility (Git Bash / MSYS2)\n\nOn Windows with Git Bash, `mktemp` returns POSIX-style paths like `/tmp/tmp.xxx`.\nThe native Windows binary (`wt.exe`) needs a Windows path to write to the\ndirective file.\n\n**No explicit path conversion is needed.** MSYS2 automatically converts POSIX\npaths in environment variables when spawning native Windows binaries — shell\nwrappers can use `$directive_file` directly. See:\nhttps://www.msys2.org/docs/filesystem-paths/\n\n---\n\n# CLI Output Formatting Standards\n\n## User Message Principles\n\nOutput messages should acknowledge user-supplied arguments (flags, options,\nvalues) by reflecting those choices in the message text.\n\n```rust\n// User runs: wt switch --create feature --base=main\n// GOOD - acknowledges the base branch\n\"Created new worktree for feature from main @ /path/to/worktree\"\n// BAD - ignores the base argument\n\"Created new worktree for feature @ /path/to/worktree\"\n```\n\n**Avoid \"you/your\" pronouns:** Messages should refer to things directly, not\naddress the user. Imperatives like \"Run\", \"Use\", \"Add\" are fine — they're\nconcise CLI idiom.\n\n```rust\n// BAD - \"To rebase your changes onto main, run wt merge\"\n// GOOD - \"To rebase onto main, run wt merge\"\n```\n\n**Avoid redundant parenthesized content:** Parenthesized text should add new\ninformation, not restate what's already said.\n\n```rust\n// BAD - parentheses restate \"no changes\"\n\"No changes after squashing 3 commits (commits resulted in no net changes)\"\n// GOOD - clear and concise\n\"No changes after squashing 3 commits\"\n// GOOD - parentheses add supplementary info\n\"Committing with default message... (3 files, +45, -12)\"\n```\n\n**Two types of parenthesized content with different styling:**\n\n1. **Stats parentheses → Gray** (`[90m` bright-black): Supplementary numerical\n   info that could be omitted without losing meaning.\n   ```\n   ✓ Merged to main (1 commit, 1 file, +1)\n   ◎ Squashing 2 commits into a single commit (2 files, +2)...\n   ```\n\n2. **Reason parentheses → Message color**: Explains WHY an action is happening;\n   integral to understanding.\n   ```\n   ◎ Removing feature worktree & branch in background (same commit as main, _)\n   ```\n\nStats are truly optional context. Reasons answer \"why is this safe/happening?\"\nand belong with the main message. Symbols within reason parentheses still render\nin their native styling (see \"Symbol styling\" below).\n\n**Show path when hooks run in a different directory:** When hooks run in a\nworktree other than the user's current (or eventual) location, show the path.\nUse the appropriate helper function:\n\n1. **Pre-hooks and manual `wt hook`** — User is at cwd, no cd happens.\n   Use `output::pre_hook_display_path(hooks_run_at)`.\n   Examples: pre-commit, pre-merge, pre-remove, manual `wt hook post-merge`.\n\n2. **Post-hooks** — User will cd to destination if shell integration is active.\n   Use `output::post_hook_display_path(destination)`.\n   Examples: pre-start, post-switch, post-start, post-merge (after removal).\n\n```rust\n// Pre-hooks: user is at cwd, no cd happens\nexecute_planned_hook(&plan, anchor, &ctx, HookType::PreMerge, &extra_vars,\n    FailureStrategy::FailFast, crate::output::pre_hook_display_path(ctx.worktree_path))?;\n\n// Post-hooks: user will cd to destination if shell integration active\nregister_planned(&mut announcer, &plan, anchor, &ctx, HookType::PostSwitch, &extra_vars,\n    crate::output::post_hook_display_path(&destination))?;\n```\n\n**Avoid pronouns with cross-message referents:** Hints appear as separate\nmessages from errors. Don't use pronouns like \"it\" that refer to something\nmentioned in the error message.\n\n```rust\n// BAD - \"it\" refers to branch name in error message\n// Error: \"Branch 'feature' not found\"\n// Hint:  \"To create it, use --create\"\n// GOOD - self-contained hint\n// Error: \"Branch 'feature' not found\"\n// Hint:  \"To create a new branch, use --create\"\n```\n\n## Heading Case\n\nUse **sentence case** for help text headings: \"Configuration files\", \"JSON output\", \"LLM commit messages\".\n\n## Message Consistency Patterns\n\nUse consistent punctuation and structure for related messages.\n\n**Ampersand for combined actions:** Use `&` when a single operation does\nmultiple things:\n\n```rust\n\"Removing feature worktree & branch in background\"\n\"Commands approved & saved to config\"\n```\n\n**Semicolon for joining clauses:** Use semicolons to connect related information:\n\n```rust\n\"Removing feature worktree in background; retaining branch (--no-delete-branch)\"\n\"Branch unmerged; to delete, run <underline>wt remove -D</>\"  // hint uses underline\n\"{tool} not authenticated; run <bold>{tool} auth login</>\"       // warning uses bold\n```\n\n**Explicit flag acknowledgment:** Show flags in parentheses when they change\nbehavior:\n\n```rust\n// GOOD - shows the flag explicitly\n\"Removing feature worktree in background; retaining branch (--no-delete-branch)\"\n// BAD - doesn't acknowledge user's explicit choice\n\"Removing feature worktree in background; retaining branch\"\n```\n\n**Flag locality:** Place flag indicators adjacent to the concept they modify.\nFlags should appear immediately after the noun/action they affect, not at the\nend of the message:\n\n```rust\n// GOOD - (--force) is adjacent to \"worktree\" which it modifies\n\"Removing feature worktree (--force) & branch in background (same commit as main, _)\"\n// BAD - (--force) at end, disconnected from the worktree removal it enables\n\"Removing feature worktree & branch in background (same commit as main, _) (--force)\"\n```\n\nThis principle ensures readers can immediately understand what each annotation\nmodifies.\n\n**Parallel structure:** Related messages should follow the same pattern:\n\n```rust\n// GOOD - parallel structure with integration reason explaining branch deletion\n// Target branch is bold; symbol uses its standard styling (dim for _ and ⊂)\n\"Removing feature worktree & branch in background (same commit as <bold>main</>, <dim>_</>)\"  // Integrated\n\"Removing feature worktree in background; retaining unmerged branch\"                          // Unmerged\n\"Removing feature worktree in background; retaining branch (--no-delete-branch)\"              // User flag\n```\n\n**Symbol styling:** Symbols are atomic with their color — the styling is part of\nthe symbol's identity, not a presentation choice. Each symbol has a defined\nappearance that must be preserved in all contexts:\n\n- `_` and `⊂` — dim (integration/safe-to-delete indicators)\n- `+N` and `-N` — green/red (diff indicators)\n\nWhen a symbol appears in a colored message (cyan progress, green success), close\nthe message color before the symbol so it renders in its native styling. This\nrequires breaking out of the message color and reopening it after the symbol.\nSee `FlagNote` in `src/output/handlers.rs` for an example — it handles flag\nacknowledgment notes (like integration reasons) with proper color transitions\nvia its `after(color)` method, which reopens the message color after the symbol.\n\n**Comma + \"but\" + em-dash for limitations:** When stating an outcome with a\nlimitation and its reason:\n\n```rust\n// Outcome, but limitation — reason\n\"Worktree for feature @ ~/repo.feature, but cannot change directory — shell integration not installed\"\n```\n\nThis pattern:\n- States what succeeded (worktree exists at path)\n- Uses \"but\" to introduce what didn't work (cannot cd)\n- Uses em-dash to explain why (shell integration status)\n\nSee `compute_shell_warning_reason()` in `src/output/shell_integration.rs` for the\ncomplete spec of shell integration warning messages and hints\n\n**Compute decisions once:** For background operations, check conditions upfront,\nshow the message, then pass the decision explicitly rather than re-checking in\nbackground scripts:\n\n```rust\n// GOOD - check once, pass decision\nlet should_delete = check_if_merged();\nshow_message_based_on(should_delete);\nspawn_background(build_command(should_delete));\n\n// BAD - check twice (once for message, again in background script)\nlet is_merged = check_if_merged();\nshow_message_based_on(is_merged);\nspawn_background(build_command_that_checks_merge_again());  // Duplicate check!\n```\n\n## Warning Ordering\n\n**Core principle:** Messages about state discovered during evaluation\n(warnings, info notices) appear **before** the action message that follows\nfrom that evaluation.\n\nWhen a command evaluates state, discovers something unexpected, and proceeds\nanyway, that message comes first:\n\n```\n▲ Auto-staging 1 untracked path:\n  notes.md\n◎ Generating commit message...\n```\n\nNot:\n\n```\n◎ Generating commit message...\n▲ Auto-staging 1 untracked path:\n  notes.md\n```\n\nWarnings that result from the action itself (something failed during execution)\nnaturally come after the action.\n\n## Message Types\n\n**Success vs Info:** Success (✓) means something was created or changed. Info\n(○) acknowledges state without changing anything.\n\n| Success ✓                               | Info ○                                |\n| --------------------------------------- | ------------------------------------- |\n| \"Created worktree for feature\"          | \"Switched to worktree for feature\"    |\n| \"Created new worktree for feature\"      | \"Already on worktree for feature\"     |\n| \"Commands approved & saved\"             | \"All commands already approved\"       |\n\nThe same rule governs standalone symbols used as per-row markers in listings:\n✓ marks a completed action, never a state. A listing that reports per-item\nstatus marks it with ○ (state acknowledged) or ❯ (awaiting approval/user\ninput) — the shared vocabulary of `wt hook show` and `wt config approvals\nlist`. Reserve a per-row ✓ for outcomes of work the command just performed\n(shell-install action lines, `-v` subprocess trace glyphs).\n\n**Hint vs Info:** Hints suggest user action or provide additional non-essential\ncontext (supplementary details the user doesn't need but may find useful). Info\nacknowledges state without changing anything.\n\n| Hint ↳                                          | Info ○                                |\n| ------------------------------------------------ | ------------------------------------- |\n| \"To continue, run `wt merge`\"                    | \"Already up to date with main\"        |\n| \"Commit or stash changes first\"                  | \"Skipping hooks (--no-hooks)\"         |\n| \"Branch can be deleted\"                           | \"Worktree preserved (main worktree)\"  |\n| \"Failed command, exit code 128:\"                   |                                       |\n\n**Warning placement:** When something unexpected happens, warn somewhere. Where\ndepends on the nature of the issue:\n\n```\nIs it unexpected?\n├── No → Silent (e.g., gh not installed when no GitHub remote)\n└── Yes → Warn somewhere:\n    ├── Immediate impact OR temporary → Inline (warning_message or in-band indicator)\n    ├── Persists until user action → wt config show (can be checked later)\n    └── Not user-fixable → log::warn! (developer diagnostics)\n```\n\n**Inline warnings** for issues affecting the current command:\n\n| Issue | Why inline |\n|-------|------------|\n| Rate limit during CI fetch | Temporary — won't be there next time |\n| Network timeout | Temporary — retry might work |\n| Hook failed during operation | Immediate impact on this command |\n\n**`wt config show`** for issues that persist until the user fixes them. These\ndon't need to interrupt every command — users can check diagnostics when\ninvestigating:\n\n| Issue | Why config show |\n|-------|-----------------|\n| `gh` not authenticated | User runs `gh auth login` |\n| Shell integration misconfigured | User updates shell config |\n| Config syntax errors | User fixes config file |\n\n**`log::warn!()`** for issues users cannot fix. These help developers debug but\nshouldn't clutter user output:\n\n| Issue | Why log::warn! |\n|-------|----------------|\n| JSON parse error (API changed) | Requires code fix |\n| Internal invariant violated | Developer bug |\n\n**Command suggestions in hints:** When a hint includes a runnable command, use\n\"To X, run Y\" pattern. End with the command for easy copying:\n\n```rust\n// GOOD - command at end for easy copying\n\"To delete the unmerged branch, run wt remove feature -D\"\n\"To rebase onto main, run wt step rebase or wt merge\"\n\n// GOOD - recovery command after shadowing a remote branch\n\"To switch to the remote branch, delete this branch and run without --create: wt remove --foreground feature && wt switch feature\"\n\n// BAD - command without context\n\"wt remove feature -D deletes unmerged branches\"\n\n// BAD - command not at end (hard to copy)\n\"Run wt switch feature (without --create) to switch to the remote branch\"\n```\n\nFor general action guidance without a specific command, direct imperatives are\nclearer:\n\n```rust\n// GOOD - direct imperative for general guidance\n\"Commit or stash changes first\"\n\"Run from inside a worktree, or specify a branch name\"\n\n// VERBOSE - \"To proceed\" adds nothing\n\"To proceed, commit or stash changes first\"\n```\n\n**Description + command in single message:** For warnings/errors that include a\nrecovery command, join with semicolon, and order the recovery \"To X, run Y\" as\nhints do, so the command still ends the line. Use `<bold>` for commands in\nwarnings/errors (only hints use `<underline>`):\n\n```rust\n// Warning with inline recovery command (bold for commands)\nwarning_message(\"Failed to restore stash; to restore manually, run <bold>git stash pop {ref}</>\")\nwarning_message(\"{tool} not authenticated; run <bold>{tool} auth login</>\")\n\n// For longer suggestions, use separate hint message (underline for commands)\nwarning_message(\"Failed to restore stash\")\nhint_message(\"To restore manually, run <underline>git stash pop {ref}</>\")\n```\n\n**Multiple suggestions in one hint:** When a message has a second suggestion,\nfold both into one hint with a semicolon rather than adding another\n`hint_message`, and put the more commonly needed command last for easy\nterminal copying:\n\n```rust\n// GOOD - common action (create) last, easy to select and copy\n\"To list branches, run wt list --branches; to create a new branch, run wt switch feature --create\"\n\n// BAD - common action buried, harder to copy\n\"To create a new branch, run wt switch feature --create; to list branches, run wt list --branches\"\n```\n\nUse `suggest_command()` from `worktrunk::styling` for proper shell escaping.\n\n**Every user-facing message requires either a symbol or a gutter.**\n\n**Section titles:** For sectioned output (`wt hook show`, `wt config show`), use\n`format_heading()` from `worktrunk::styling` (documented above).\n\n## Interactive Prompts vs Non-Interactive Hints\n\nPrompts and hints serve different purposes and have different `--yes` behavior.\n\n**Prompts** are expected steps in a workflow — the user ran a command knowing\nit would ask for confirmation. Hook approval during `wt merge`, config update\nconfirmation, shell install confirmation. `--yes` bypasses these because the\nuser anticipated the question and wants to pre-answer it (e.g., in CI).\n\n**Setup prompts** are unexpected — the user ran `wt merge` and got asked about\nLLM config or shell integration they didn't know about. `--yes` must NOT\nbypass these. A user passing `--yes` to skip hook approval did not consent to\nauto-configuring their shell. In non-interactive mode (no TTY), these should\ndegrade to a hint or be skipped silently — never error.\n\n| Type | Example | `--yes` | Non-TTY behavior |\n|------|---------|---------|------------------|\n| Workflow prompt | Hook approval, config update | Bypasses | Error (`NotInteractive`) |\n| Setup prompt | LLM config, shell integration | No effect | Hint or silent skip |\n\n**Non-TTY degradation patterns:**\n\n- **Hint** — when the user benefits from knowing about the option on every run.\n  Shell integration hint: `↳ To enable automatic cd, run wt config shell install`\n- **Silent skip** — when a hint would be noise. Commit generation setup prompt\n  skips silently because a separate fallback hint (`emit_hint_if_needed`)\n  already covers the unconfigured case on every commit.\n- **Error** — only for workflow prompts where proceeding without consent is\n  unsafe (hook approval). The error includes a hint for the fix:\n  `↳ To skip prompts in CI/CD, add --yes`\n\n**Key invariants:**\n\n- Hints shown in non-TTY mode must NOT set skip flags — hints are not prompts,\n  and should repeat on every non-TTY run\n- `--yes` means \"I anticipated this prompt\" — it applies to workflow prompts\n  the user chose to invoke, not to setup/config discovery prompts\n\n## Blank Line Principles\n\n**Core principle:** When presenting the user with text to read and consider, add\nspacing for readability. When piping output (stdout), keep output dense for\nparsing.\n\nSpecific rules:\n\n- **No leading/trailing blanks** — Start immediately, end cleanly\n- **Blank before prompts, not after** — Signal \"pause, something interactive is\n  happening\" before the prompt; once the user responds, output flows continuously.\n  The blank belongs to the narration it separates from, so the caller emits it\n  and `prompt_yes_no_preview` does not: a prompt that opens a command's output\n  (`wt config shell install`, `wt config plugins claude install`, the\n  commit-generation offer at the top of `wt merge`) starts flush, since a blank\n  there is a leading blank\n- **One blank between phases** — When a sub-operation completes and a different\n  operation begins, add a blank line to visually separate them\n- **Never double blanks** — One blank line maximum between elements\n- **Hints attach to their subject** — Never put a blank line between a hint and\n  the message it elaborates on. Hints (↳) are subordinate — they belong directly\n  below their parent message with no gap.\n\n  ```\n  // GOOD - hint directly follows its subject\n  ↳ fish: Not configured shell extension\n  ↳ To configure, run wt config shell install\n\n  // BAD - blank line detaches hint from subject\n  ↳ fish: Not configured shell extension\n\n  ↳ To configure, run wt config shell install\n  ```\n\n**Prompt spacing:** A blank line before a prompt that follows narration signals\n\"something different is about to happen\" and gives the user's eye a natural\nstopping point before they need to read and respond. No blank line after — the\nuser's input ends the interactive moment and subsequent output flows naturally\nfrom that decision. A prompt with nothing above it, like the setup offer below\nat the top of `wt step commit`, has nothing to separate from and starts flush.\n\n```\n❯ Configure claude for commit messages? [y/N/?] y\n✓ Added to user config:\n  [commit.generation]\n  command = \"...\"\n↳ View config: wt config show\n\n▲ Auto-staging 1 untracked path:\n  a\n◎ Generating commit message...\n```\n\n**Phase separation:** A \"phase\" is a logically distinct operation. The blank\nline between the hint and warning above signals \"config setup is done, now we're\ndoing the main command workflow.\"\n\n**Interactive prompts** must flush stderr before blocking on stdin:\n\n```rust\neprint!(\"❯ Allow and remember? [y/N] \");\nstderr().flush()?;\nio::stdin().read_line(&mut response)?;\n```\n\n## Temporal Locality: Output Should Be Close to Operations\n\nOutput should appear immediately adjacent to the operations it describes.\nProgress messages apply only to slow operations (>400ms): git operations,\nnetwork requests, builds.\n\nSequential operations should show immediate feedback:\n\n```rust\nfor item in items {\n    eprintln!(\"{}\", progress_message(format!(\"Removing {item}...\")));\n    perform_operation(item)?;\n    eprintln!(\"{}\", success_message(format!(\"Removed {item}\")));  // Immediate feedback\n}\n```\n\nBad example (output decoupled from operations):\n\n```\n◎ Removing worktree for feature...\n◎ Removing worktree for bugfix...\n                                    ← Long delay, no feedback\nRemoved worktree for feature        ← All output at the end\nRemoved worktree for bugfix\n```\n\nSigns of poor temporal locality: collecting messages in a buffer, single success\nmessage for batch operations, no progress before slow operations.\n\n## Spinners for Long Single-Operation Work\n\nWhen per-item `progress_message`s don't fit — recursive copy of thousands of\nfiles, a long subprocess with no useful streaming output — a stderr spinner\nkeeps the user oriented. See `src/progress.rs` (`Progress`) for the pattern:\nthe verb (`\"Copying\"`, `\"Removing\"`) is fixed at `Progress::start(verb)`,\nTTY-gate, skip when `verbosity() >= 1` or `--dry-run`, ≥300 ms startup delay\nso fast ops stay silent, IEC bytes (KiB/MiB), clear the line before printing\nthe summary, and have the summary repeat any counters the spinner displayed\n(use `format_stats_paren` for the gray `(N files · X MiB)` suffix).\n\n## Defer Non-Essential Work Until After Primary Output\n\nFire-and-forget cleanup and cache sweeps run after the command's final\nuser-visible message — never before. Placing them at the start delays\ntime-to-first-output with work the user didn't ask for.\n\nWorktrunk marks the boundary with `WORKTRUNK_FIRST_OUTPUT`: handlers\nearly-return where output begins, so work before that return is on the hot\npath, work after it is not. See `handle_remove_command` —\n`run_internal_sweep` runs after `handle_remove_output`.\n\n## Information Display: Show Once, Not Twice\n\nProgress messages should include all relevant details (what's being done,\ncounts, stats, context). Success messages should be minimal, confirming\ncompletion with reference info (hash, path).\n\n```rust\n// GOOD - detailed progress, minimal success\neprintln!(\"{}\", progress_message(\"Squashing 3 commits & working tree changes into a single commit (5 files, +60)...\"));\nperform_squash()?;\neprintln!(\"{}\", success_message(\"Squashed @ a1b2c3d\"));\n```\n\n## Section and Glyph Spacing\n\nWhen composing tightly-packed output where adjacent pieces carry distinct\nmeaning (the statusline segments, prefix-char indicators like `@+1`, `↓1`,\n`?^|`), pack sections flush — no separating space. The marker and its value\nread as one unit, and visual density keeps the line short.\n\nThe one exception is **emoji**: leave a trailing space after an emoji glyph.\nMost terminals render emoji as double-width and bleed the glyph into the cell\nto its right, so a flush `🌔65%` collides the moon with the digits. A space\n(`🌔 65%`) keeps them legible. ASCII and narrow Unicode markers (`@`, `↓`, `●`,\n`⊂`) don't have this problem and stay flush.\n\n```rust\n// GOOD - ASCII marker flush with its value\nformat!(\"@{added}\");          // @+1\n// GOOD - emoji gets a trailing space to clear the next cell\nformat!(\"{moon} {pct:.0}%\");  // 🌔 65%\n// BAD - emoji runs into the digits; terminals overlap the glyph\nformat!(\"{moon}{pct:.0}%\");   // 🌔65%\n```\n\n## Style Constants\n\nOnly three `anstyle` constants exist for table rendering (`src/styling/constants.rs`):\n\n- `ADDITION`: Green (diffs)\n- `DELETION`: Red (diffs)\n- `GUTTER`: BrightWhite background\n\nFor everything else, use `cformat!` tags.\n\n## Styling in Command Code\n\nUse `eprintln!` with formatting functions. Use `cformat!` for inner styling:\n\n```rust\neprintln!(\"{}\", success_message(cformat!(\"Created <bold>{branch}</> from <bold>{base}</>\")));\neprintln!(\"{}\", hint_message(cformat!(\"To continue, run <underline>wt merge</>\")));\n```\n\n**color-print tags:** `<bold>`, `<dim>`, `<underline>`, `<bright-black>`, `<red>`,\n`<green>`, `<yellow>`, `<cyan>`, `<magenta>`\n\n**Branch names and status values** should be bolded in messages.\n\n**Symbol constants in cformat!:** For messages that bypass output:: functions\n(e.g., `GitError` Display impl), use symbol constants directly:\n\n```rust\ncformat!(\"{ERROR_SYMBOL} <red>Branch <bold>{branch}</> not found</>\")\n```\n\n## Commands and Branches in Messages\n\nNever quote commands or branch names. Use styling to make them stand out:\n\n- **In normal font context**: Use `<bold>` for commands and branches\n- **In hints**: Use `<underline>` for commands and data values (paths,\n  branches). Underline is safe inside `<dim>` — closing `[24m` only resets\n  underline, preserving dim. Avoid `<bold>` inside hints — the closing `[22m`\n  resets both bold AND dim, so text after `</bold>` loses dim styling.\n\n```rust\n// GOOD - bold in normal context\neprintln!(\"{}\", info_message(cformat!(\"To continue, use <bold>wt merge</>\")));\n// GOOD - underline for commands in hints\neprintln!(\"{}\", hint_message(cformat!(\"To see worktrees, run <underline>wt list</>\")));\n// BAD - quoted commands\neprintln!(\"{}\", hint_message(\"To see worktrees, run 'wt list'\"));\n```\n\n## Hyperlinks\n\nEvery OSC 8 link is underlined. Link text is sized to fit a column (`#3604`,\n`:11486`) and reads as ordinary content, and color already carries state (the\nCI verdict, dim for a port nothing answers on), so the underline is what marks\na run of text as clickable.\n\n`worktrunk::styling::hyperlink(url, text)` emits the link and its underline\ntogether, which is what keeps the rule true at every call site. It closes with\n`[24m`, leaving a surrounding color or dim intact.\n\n```rust\n// GOOD - the helper carries the underline\nlet cell = hyperlink(url, &format!(\":{port}\"));\n// GOOD - a caller's own style wraps the link\nformat!(\"{style}{}{style:#}\", hyperlink(url, text))\n// BAD - hand-assembled sequences, unmarked link\nformat!(\"{}{text}{}\", osc8::Hyperlink::new(url), osc8::Hyperlink::END)\n```\n\nText that isn't a link stays plain, and whether a run of text is a link belongs\nto the render rather than to the cell emitting it: `LayoutConfig::link_style`\nanswers it once for a whole row, so a CI reference and a dev-server port can't\ndisagree. Two destinations carry no links, and so no underline: a terminal\nwithout OSC 8 support, where `wt list` prints the dev-server URL in full, and\nthe picker's rows, which `Destination::picker` renders as\n`LinkStyle::Unlinked` (that variant's docstring has the reason). Nothing in the\npicker is clickable, by two routes: a row's link style is decided at render\ntime, so it carries no OSC 8 to begin with, and the preview pane is parsed by\nskim through `ansi_to_tui`, which keeps none. Underline there is\nfree to mean something else, and the preview pane spends it twice: on a URL,\nmarking a reference rather than a link (`pr_pane::url_line`), and on the active\ntab in the tab bar (`items::render_preview_tabs`).\n\n## Design Principles\n\n- **`cformat!` for styling** — Never manual escape codes (`\\x1b[...`)\n- **`cformat!` variables are safe** — Tags like `<bold>` are processed at compile\n  time only. Runtime variable values are NOT interpreted as markup, so user\n  content (branch names, commit messages, paths, shell commands with `<`/`>`\n  redirects) can be interpolated directly without escaping. Do NOT escape\n  `<`/`>` in variables — it adds extra chars.\n- **YAGNI** — Most output needs no styling\n- **Graceful degradation** — Styling follows the consumer (NO_COLOR, TTY\n  detection). Plain output preserves meaning through wording, spacing and\n  existing semantic symbols. Missing decoration alone does not justify new\n  markers; add text when information would otherwise be lost.\n- **Unicode-aware** — Width calculations respect symbols and CJK (via `StyledLine`)\n\n**StyledLine** for table rendering with proper width calculations:\n\n```rust\nuse worktrunk::styling::StyledLine;\nuse anstyle::{AnsiColor, Color, Style};\n\nlet mut line = StyledLine::new();\nline.push_styled(\"Branch\", Style::new().dimmed());\nline.push_raw(\"  \");\nline.push_styled(\"main\", Style::new().fg_color(Some(Color::Ansi(AnsiColor::Cyan))));\nprintln!(\"{}\", line.render());\n```\n\nSee `src/commands/list/render.rs` for advanced usage.\n\n## Documentation Examples\n\nUse consistent examples throughout all documentation, help text, and config\ntemplates.\n\n### Canonical example setup\n\n| Element | Value | Notes |\n|---------|-------|-------|\n| Repo directory | `myproject` | Generic placeholder |\n| Repo path | `~/code/myproject` | Realistic dev path |\n| Branch | `feature/auth` | Shows sanitize filter |\n| Worktree path | `~/code/myproject.feature-auth` | Result of default template |\n\n### Template variable examples\n\nUse the canonical values from the table above in all examples:\n\n```\n{{ repo }}           — Repository directory name (e.g., `myproject`)\n{{ branch }}         — Branch name (e.g., `feature/auth`)\n{{ worktree_path }}  — Absolute path to worktree (e.g., `/path/to/myproject.feature-auth`)\n```\n\nIn TOML comments:\n```toml\n#   {{ repo }}           - Repository directory name (e.g., \"myproject\")\n#   {{ branch }}         - Raw branch name (e.g., \"feature/auth\")\n#   {{ worktree_name }}  - Worktree directory name (e.g., \"myproject.feature-auth\")\n```\n\n### Worktree path examples\n\nWhen showing worktree-path template examples:\n\n```toml\n# Default — siblings in parent directory\n# Creates: ~/code/myproject.feature-auth\nworktree-path = \"../{{ repo }}.{{ branch | sanitize }}\"\n\n# Inside the repository\n# Creates: ~/code/myproject/.worktrees/feature-auth\nworktree-path = \".worktrees/{{ branch | sanitize }}\"\n```\n\n## Gutter Formatting\n\nUse gutter for **quoted content** (git output, commit messages, config to copy,\nhook commands being displayed).\n\nThe gutter is a background-colored blank column followed by a space. Plain\noutput keeps the two-space indent. Gutter examples in this skill show that plain\nform.\n\n- `format_bash_with_gutter()` — shell commands (dimmed + syntax highlighting)\n- `format_with_gutter()` — other content\n\n**Gutter vs Table:** Tables for structured app data; gutter for quoting external\ncontent.\n\n**Gutter vs Hints:** Command suggestions in hints use inline `<underline>`,\nnot gutter. Gutter is for displaying content (what will execute, config to\ncopy); hints suggest what the user should run.\n\n## Newline Convention\n\n**Core principle:** All formatting functions return content WITHOUT trailing\nnewlines. Callers handle element separation.\n\nThis applies to:\n- Message functions: `error_message()`, `success_message()`, `hint_message()`, etc.\n- Gutter functions: `format_with_gutter()`, `format_bash_with_gutter()`\n\n**With `eprintln!`:** Adds trailing newline automatically.\n\n```rust\neprintln!(\"{}\", progress_message(\"Merging...\"));\neprintln!(\"{}\", format_with_gutter(&log, None));\n```\n\n**In Display impls:** Use explicit newlines for element separation.\n\n```rust\n// Pattern: leading \\n separates from previous element\nwrite!(f, \"{}\", error_message(...))?;           // first element, no leading \\n\nwrite!(f, \"\\n{}\", format_with_gutter(...))?;    // gutter, separated by \\n\nwrite!(f, \"\\n{}\", hint_message(...))            // hint, separated by \\n\n\n// For blank line between elements, add extra \\n\nwrite!(f, \"\\n{}\\n\", format_with_gutter(...))?;  // trailing \\n creates blank line\nwrite!(f, \"\\n{}\", hint_message(...))            // hint after blank line\n```\n\n**Don't add trailing `\\n` to content:**\n\n```rust\n// GOOD - eprintln! adds newline\neprintln!(\"{}\", progress_message(\"Merging...\"));\n\n// BAD - double newline\neprintln!(\"{}\", progress_message(\"Merging...\\n\"));\n```\n\n**Avoid bullets — use gutter instead.** Instead of `\"\\n  - {}: {}\"` bullet\nformatting, use `format_with_gutter()` to present lists.\n\n## Error Formatting\n\n### Error Message Structure\n\nError and warning messages should communicate four things:\n\n1. **What happened** — The actual state or outcome\n2. **What was expected** — The correct or desired state\n3. **The impact** — Why this matters (optional for obvious cases)\n4. **How to resolve** — What the user should do (can be a separate hint message)\n\n```rust\n// GOOD - states actual, expected, and impact in main message\n\"Shell probe: wt is binary at /path, not function — won't auto-cd\"\n//                 ^^^^^^^^^^^^^^^   ^^^^^^^^^^^^   ^^^^^^^^^^^^^^\n//                 actual            expected       impact\n// Resolution in separate hint: \"Restart shell to activate\"\n\n// GOOD - actual vs expected with resolution inline\n\"Config file has 3 errors, expected valid TOML; run wt config validate for details\"\n//              ^^^^^^^    ^^^^^^^^                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n//              actual     expected                  resolution\n\n// BAD - only states actual, no expected or impact\n\"Shell probe: wt resolves to binary at /path\"\n// Missing: what should it be instead? why does it matter?\n\n// BAD - vague, no actionable information\n\"Shell integration problem detected\"\n// Missing: what's wrong? what should it be? what to do?\n```\n\nWhen the expected state is obvious from context, it can be implied:\n\n```rust\n// OK - expected state (file should exist) is obvious\n\"Config file not found at ~/.config/wt/config.toml\"\n\n// OK - expected state (should succeed) is obvious\n\"Failed to read config: permission denied\"\n```\n\n**Diagnostic messages** (like `wt config show`) should follow this pattern\nespecially carefully — users read diagnostics to understand what's wrong.\n\n### Single vs Multi-line\n\n**Single-line errors** with variables are fine:\n\n```rust\n// GOOD - single-line with path variable\n.map_err(|e| format!(\"Failed to read {}: {}\", format_path_for_display(path), e))?\n\n// GOOD - using .context() for simple errors\nstd::fs::read_to_string(&path).context(\"Failed to read config\")?\n```\n\n**Multi-line external output** (git, hooks, LLM) needs gutter:\n\n1. Show the command that was run (with arguments)\n2. Put multi-line output in a gutter\n\n```\n✗ Commit generation command 'llm --model claude' failed\n  Error: [Errno 8] nodename nor servname provided\n\n// NOT: ✗ ... failed: LLM command failed: Error: [Errno 8]...\n```\n\nSee `src/git/error.rs` for examples of this pattern in `GitError` Display impls.\n\n## Verbose Output (`-v` and `-vv`)\n\n**`-v` (verbose):** User-facing diagnostic output. Must follow these guidelines.\nShows template expansions and other details users might need for debugging config.\n\nTemplate expansion shows the source template and the rendered result as two\nlabeled blocks. Each block is a bash gutter (dim + syntax highlighting via\n`format_bash_with_gutter`) under its own info header (`○` symbol, bold name,\nthen `source` or `result`):\n```\n○ name source\n  template\n○ name result\n  result\n```\n\nThe two headers carry the input/output distinction, so both blocks share the\nsame gutter and the content always starts at the gutter's column 2 (no marker\nglyph or extra indent inside the gutter). Multi-line templates and results\nfollow the same shape, one gutter line per source line.\n\n`expand_template` emits no trailing blank, so a standalone caller adds one to\nseparate the block from what follows (`wt step eval` does this after the view).\nIn a command pipeline the executor already separates the block from the next\noutput, so the expansion adds nothing.\n\n**`-vv` (debug):** Developer-facing logging output. MAY violate these guidelines.\nUses `log::debug!()` with structured format for deep debugging. Not intended for\nregular users.\n\n## Path Formatting\n\n**All user-facing paths must use `format_path_for_display()`** from\n`worktrunk::path`. This function replaces home directory prefixes with `~` for\nreadability (e.g., `/Users/alex/projects/repo` → `~/projects/repo`).\n\n**Use `@` (not \"at\") before paths in all user-facing output.** This is the\ncodebase convention for associating an entity with a location — in status\nmessages, section headings, hints, and everywhere else:\n\n```rust\n// GOOD - @ before path\n\"Created worktree for feature @ ~/code/repo.feature\"\n\"Squashed @ a1b2c3d\"\n\"Worktree for feature @ ~/repo.feature, but cannot change directory...\"\nformat_heading(\"USER HOOKS\", Some(&format!(\"@ {}\", format_path_for_display(p))))\n\n// BAD - \"at\" before path\n\"Created worktree for feature at ~/code/repo.feature\"\n// BAD - heading without @\nformat_heading(\"USER HOOKS\", Some(&format_path_for_display(p)))\n```\n\n**Exception:** Prose contexts (doc comments, help text) use \"at\" — `@` is for\nterse output only.\n\n```rust\nuse worktrunk::path::format_path_for_display;\n\n// GOOD - uses format_path_for_display\neprintln!(\"{}\", success_message(cformat!(\n    \"Created worktree @ {}\",\n    format_path_for_display(&worktree_path)\n)));\n\n// GOOD - error messages too\n.map_err(|e| format!(\"Failed to read {}: {}\", format_path_for_display(path), e))?\n\n// BAD - raw path.display()\neprintln!(\"{}\", success_message(format!(\n    \"Created worktree @ {}\",\n    worktree_path.display()  // Shows /Users/alex/... instead of ~/...\n)));\n```\n\n**Applies to:**\n- Success/info/warning/error messages\n- Section headings (`format_heading` with path suffix)\n- Hints suggesting paths\n- Progress messages\n- Dry-run previews\n\n**Exceptions:**\n- Debug logging (`log::debug!`) — full paths help debugging\n- Paths passed to git commands — must be real paths\n\n## Table Column Alignment\n\n- **Text columns** (Branch, Path, Message): left-aligned\n- **Single-value numeric columns** (Age): right-aligned, so `now` and `4m` line\n  up on the unit\n- **Diff columns** (@±, ^↕): two right-aligned halves either side of a\n  separator (`+999 -999`); a state for the whole field, such as a loading or\n  in-sync marker, is centered\n\nA header follows its content, except over a diff column, where it centres:\npushed to either edge it stands over one half and reads as that half's label,\nleaving a lone `+1` stranded left of `@±`.\n\nRows carry no trailing padding. Padding places a cell; past the last one it\nplaces nothing, and a reader who selects the row gets it anyway.\n\n## Snapshot Testing\n\nEvery command output must have snapshot tests (`tests/integration_tests/`).\nSee `tests/integration_tests/remove.rs` for the standard pattern using\n`setup_snapshot_settings()`, `make_snapshot_cmd()`, and `assert_cmd_snapshot!()`.\n\nCover success/error states, with/without data, and flag variations.\n\n<!-- File: plugins/worktrunk/CLAUDE.md (Tokens: ~300 | Category: anthropic-skill) -->\n# Worktrunk Skill\n\nPath: `plugins/worktrunk/CLAUDE.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/CLAUDE.md)\n\n<!-- File: plugins/worktrunk/hooks/hooks.json (Tokens: ~300 | Category: anthropic-skill) -->\n# Hooks Skill\n\nPath: `plugins/worktrunk/hooks/hooks.json`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/hooks/hooks.json)\n\n<!-- File: plugins/worktrunk/skills/worktrunk/reference/claude-code.md (Tokens: ~300 | Category: anthropic-skill) -->\n# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/claude-code.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/claude-code.md)\n\n<!-- File: plugins/worktrunk/skills/worktrunk/reference/code-signing.md (Tokens: ~300 | Category: anthropic-skill) -->\n# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/code-signing.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/code-signing.md)\n\n<!-- File: plugins/worktrunk/skills/worktrunk/reference/config.md (Tokens: ~300 | Category: anthropic-skill) -->\n# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/config.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/config.md)\n\n<!-- File: plugins/worktrunk/skills/worktrunk/reference/extending.md (Tokens: ~300 | Category: anthropic-skill) -->\n# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/extending.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/extending.md)\n\n<!-- File: plugins/worktrunk/skills/worktrunk/reference/faq.md (Tokens: ~300 | Category: anthropic-skill) -->\n# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/faq.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/faq.md)\n\n<!-- File: plugins/worktrunk/skills/worktrunk/reference/hook.md (Tokens: ~300 | Category: anthropic-skill) -->\n# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/hook.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/hook.md)\n\n<!-- File: plugins/worktrunk/skills/worktrunk/reference/list.md (Tokens: ~300 | Category: anthropic-skill) -->\n# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/list.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/list.md)\n\n<!-- File: plugins/worktrunk/skills/worktrunk/reference/llm-commits.md (Tokens: ~300 | Category: anthropic-skill) -->\n# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/llm-commits.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/llm-commits.md)\n\n<!-- File: plugins/worktrunk/skills/worktrunk/reference/merge.md (Tokens: ~300 | Category: anthropic-skill) -->\n# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/merge.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/merge.md)\n\n<!-- File: plugins/worktrunk/skills/worktrunk/reference/remove.md (Tokens: ~300 | Category: anthropic-skill) -->\n# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/remove.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/remove.md)\n\n<!-- File: plugins/worktrunk/skills/worktrunk/reference/shell-integration.md (Tokens: ~300 | Category: anthropic-skill) -->\n# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/shell-integration.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/shell-integration.md)\n\n<!-- File: plugins/worktrunk/skills/worktrunk/reference/step.md (Tokens: ~300 | Category: anthropic-skill) -->\n# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/step.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/step.md)\n\n<!-- File: plugins/worktrunk/skills/worktrunk/reference/switch.md (Tokens: ~300 | Category: anthropic-skill) -->\n# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/switch.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/switch.md)\n\n<!-- File: plugins/worktrunk/skills/worktrunk/reference/tips-patterns.md (Tokens: ~300 | Category: anthropic-skill) -->\n# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/tips-patterns.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/tips-patterns.md)\n\n<!-- File: plugins/worktrunk/skills/worktrunk/reference/troubleshooting.md (Tokens: ~300 | Category: anthropic-skill) -->\n# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/troubleshooting.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/troubleshooting.md)\n\n<!-- File: plugins/worktrunk/skills/worktrunk/reference/worktrunk.md (Tokens: ~300 | Category: anthropic-skill) -->\n# Reference Skill\n\nPath: `plugins/worktrunk/skills/worktrunk/reference/worktrunk.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/worktrunk/reference/worktrunk.md)\n\n<!-- File: plugins/worktrunk/skills/worktrunk/SKILL.md (Tokens: ~2652 | Category: anthropic-skill) -->\n---\nname: worktrunk\ndescription: Guidance for Worktrunk (the `wt` CLI) — git worktree management, hooks, and config. Load when working out which worktree a `wt` command will act on, or reaching for the global `-C <path>` to target one; editing .config/wt.toml or ~/.config/worktrunk/config.toml; adding, modifying, or debugging hooks (post-merge, post-start, pre-commit, pre-merge, post-switch, etc.); configuring commit message generation or command aliases; or troubleshooting wt behavior. Also answers general worktrunk/wt questions.\nlicense: MIT OR Apache-2.0\ncompatibility: Requires the `wt` CLI (https://worktrunk.dev)\n---\n\n# Worktrunk\n\nHelp users work with Worktrunk, a CLI tool for managing git worktrees.\n\n## Available documentation\n\nReference files are synced from [worktrunk.dev](https://worktrunk.dev) documentation:\n\n- **reference/config.md**: User and project configuration (LLM, hooks, command defaults)\n- **reference/hook.md**: Hook types, timing, and execution order\n- **reference/switch.md**, **merge.md**, **list.md**, etc.: Command documentation\n- **reference/extending.md**: Aliases, multi-step pipelines, custom subcommands, and template-expansion gotchas (two-pass `{% raw %}` deferral, for-each recipes)\n- **reference/llm-commits.md**: LLM commit message generation\n- **reference/tips-patterns.md**: Practical recipes — aliases, per-branch variables, dev server per worktree, parallel agent patterns\n- **reference/shell-integration.md**: Shell integration debugging\n- **reference/troubleshooting.md**: Troubleshooting for LLM and hooks (Claude-specific)\n\nFor command-specific options, run `wt <command> --help`. For configuration, follow the workflows below.\n\n## Which worktree a command acts on\n\n`wt` finds the *repository* from the working directory, and the *worktree* from the command's own arguments. Two rules cover every case:\n\n1. **A command that names a branch already names its worktree.** Worktrees are addressed by branch name, so `wt switch <branch>`, `wt remove <branch>`, `wt step diff --branch <branch>`, and `wt config state marker set --branch <branch>` act on that branch's worktree no matter which worktree you run them from. Every such argument also accepts the worktree's own path, for the cases a branch cannot name — a second checkout of the same branch, or a detached worktree (which `marker` still rejects, since it keys state by branch name).\n2. **`-C <path>` moves the working directory, not the worktree selection.** Reach for it when the repository lookup is what's wrong: a *different* repository; a command that acts on the current worktree and takes no branch argument (`wt merge`, `wt step rebase|squash|push` — their `[TARGET]` is the merge target, not a worktree); or a caller whose working directory isn't inside a repository at all, such as an agent hook the host pins elsewhere.\n\nLayering `-C` on top of a branch argument names the same worktree twice. From inside the `alpha` worktree of a repo that also has `beta`:\n\n```bash\nwt step diff --branch beta                    # ✓ the branch argument selects the worktree\nwt -C ../repo.beta step diff --branch beta    # ✗ says beta twice\n\nwt switch --create beta                       # ✓ --base already defaults to the default branch\nwt -C ../repo switch --create beta            # ✗ -C adds nothing; you are already in that repo\n```\n\n## Two types of configuration\n\nWorktrunk uses two config files with different scopes and permission models:\n\n**User config** (`~/.config/worktrunk/config.toml`, never checked into git) holds personal preferences: LLM integration, worktree path templates, command settings, user hooks. Treat it conservatively — propose changes and get consent before editing, never install tools on the user's behalf, and preserve the file's existing structure and comments. See `reference/config.md`.\n\n**Project config** (`<repo>/.config/wt.toml`, checked into git) holds team-wide automation: hooks for the worktree lifecycle (pre-start, pre-merge, etc.). Edit proactively — changes are versioned and reversible via git. Comment why each hook exists, and warn the user before adding destructive commands (`rm -rf`, `DROP TABLE`), network fetches piped to shells, or `sudo`. See `reference/hook.md`.\n\nSome requests span both: commit-message generation is user config, while the team's quality checks are project config.\n\n## Core workflows\n\n### Setting up commit message generation (user config)\n\nDetect which tools are installed (`which claude codex opencode pi`); if none, recommend Claude Code. Take the exact command for the chosen tool from `reference/llm-commits.md`, propose the `[commit.generation]` change, and apply it after approval (`wt config create` first if no config exists). To verify, `wt step commit --dry-run` renders the prompt, runs the LLM, and prints the message without committing.\n\n### Configuring project hooks\n\nPick the hook type by when the command should run and whether it may block — `reference/hook.md` maps all ten (5 events × pre/post) to their timing and typical uses.\n\nDerive the commands from the project itself (`package.json` scripts, `Cargo.toml`, `pyproject.toml`) and verify they run before adding them.\n\nWhen a new hook must wait for an existing one, convert the entry to a pipeline; independent commands in a named table run concurrently:\n\n```toml\n# Pipeline: install completes before migrate starts\n[[pre-start]]\ninstall = \"npm install\"\n\n[[pre-start]]\nmigrate = \"npm run db:migrate\"\n\n# Concurrent: independent commands in one table\n[pre-start]\ninstall = \"npm install\"\nenv = \"cp .env.example .env\"\n```\n\nTest with `wt switch --create test-hooks`.\n\n## Common tasks reference\n\n### User config tasks\n- Set up commit message generation → `reference/llm-commits.md`\n- Customize worktree paths → `reference/config.md#worktree-path-template`\n- Custom commit templates → `reference/llm-commits.md#prompt-templates`\n- Configure command defaults → `reference/config.md#command-config`\n- Set up personal hooks → `reference/config.md#user-hooks`\n\n### Project config tasks\n- Set up hooks for new project → `reference/hook.md`\n- Add hook to existing config → `reference/hook.md#hook-forms`\n- Use template variables → `reference/hook.md#template-variables`\n- Add dev server URL to list → `reference/config.md#dev-server-url`\n\n### Aliases & multi-worktree tasks\n- Create a `wt` alias → `reference/extending.md#aliases`\n- Run a command in every worktree → `reference/step.md#wt-step-for-each`\n- Rebase every worktree (up-style) → `reference/extending.md#recipe-rebase-every-worktree-onto-its-upstream`\n- Pass a template to a nested `wt` command → `reference/extending.md#nesting-templates`\n\n## Key commands\n\n```bash\n# View all configuration\nwt config show\n\n# Create initial user config (LLM/commit setup: see reference/llm-commits.md)\nwt config create\n\n# Full config reference (subcommands, templates, env vars)\nwt config --help\n```\n\n## Hook approvals in non-interactive sessions\n\nWorktrunk never runs a project's hooks or aliases until the user has explicitly approved them. The commands in `.config/wt.toml` are arbitrary shell code shipped in a repository the user may have just cloned, so on first run Worktrunk shows each command and waits for the user to approve it — an untrusted `.config/wt.toml` cannot silently execute anything. Approvals are stored per-project in `~/.config/worktrunk/approvals.toml` and re-prompted whenever a command template changes, so a hook can't be swapped for a different command after it was approved.\n\nAgents running `wt merge`, `wt switch`, or other commands that trigger hooks will hit an error like:\n\n```\n▲ cargo-difftest needs approval to execute 1 command:\n○ post-merge install:\n  cargo install --path .\n✗ Cannot prompt for approval in non-interactive environment\n↳ To skip prompts in CI/CD, add --yes; to pre-approve commands, run wt config approvals add --yes\n```\n\nThe resolution is for the user to make the trust decision themselves:\n\n- **`wt config approvals add`** — interactive prompt where the user reviews each command before it is stored to `~/.config/worktrunk/approvals.toml`. Run once per project; the approval persists across invocations until the command template changes or the project moves. This is the path to recommend — the user reviews and consents to exactly the commands that will run.\n\n**When invoked as an agent, stop and escalate to the user.** Approving a project's hooks is a security decision about whether this repository should be trusted to run arbitrary commands on the user's machine — that decision belongs to the user, not the agent. Tell the user to run `wt config approvals add` and let them review the commands. Do not reach for either `--yes` on the user's behalf: on the blocked command it skips the gate for that invocation, and `wt config approvals add --yes` records every command the project declares with nobody reading them. Both exist for CI/CD pipelines and containers that already control their own hook contents; neither is a shortcut for an interactive agent to silence an approval prompt.\n\n## Advanced: agent handoffs\n\nWhen the user requests spawning a worktree with an agent in a background session (\"spawn a worktree for...\", \"hand off to another agent\"), use the tmux or Zellij command from `reference/tips-patterns.md#agent-handoffs` with the CLI you are running as in place of `claude`, following that section's note on where a subcommand such as OpenCode's `run` goes.\n\n**Requirements** (all must be true):\n- User explicitly requests spawning/handoff\n- User is in a supported multiplexer (check `$TMUX` / `$ZELLIJ`)\n- The user's project instructions (`CLAUDE.md` or `AGENTS.md`) or an explicit prompt authorize this pattern\n\n**Do not use this pattern** for normal worktree operations.\n\n### Parallel sub-Agents (single Claude Code session)\n\nTo spawn multiple sub-Agents that each work in their own worktree from one Claude Code session — no terminal multiplexer, no human in the other pane — pre-start each worktree from the parent and pass the path into the sub-Agent prompt:\n\n```bash\nwt switch --create <branch> --no-cd\n```\n\nThen call the `Agent` tool **without** `isolation: \"worktree\"`, naming the path in the prompt:\n\n```\nYou are working in `/abs/path/to/myproject.<branch>` on branch `<branch>`.\nAll edits must stay in that worktree.\n```\n\n`--no-cd` skips the shell-integration cd script the parent can't consume. Add `--no-hooks` only when no user or project hooks provision the worktree and each sub-Agent does its own build/test step (e.g. `cargo run -- hook pre-merge --yes`) — a `pre-start` hook that installs dependencies or links a gitignored build environment hands the sub-Agent a worktree it can't build in when it's skipped. Leaving hooks on needs the project's hook commands already approved: the parent session can't prompt, so an unapproved command in `.config/wt.toml` aborts the create — see **Hook approvals in non-interactive sessions** above.\n\n**Do not** use `Agent { isolation: \"worktree\" }` for this. Claude Code passes its internal agent ID as `name` to the `WorktreeCreate` hook, so `wt` creates the worktree as `myproject.agent-<id>` on a throwaway branch. If the sub-Agent then creates a feature branch on top, you end up with non-canonical paths, orphan branches, and post-start hooks fired against the wrong branch. Pre-creating with `wt switch --create` keeps path, branch, and hook target aligned.\n\n<!-- File: plugins/worktrunk/skills/wt-switch-create/rationale.md (Tokens: ~300 | Category: anthropic-skill) -->\n# Wt-switch-create Skill\n\nPath: `plugins/worktrunk/skills/wt-switch-create/rationale.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/plugins/worktrunk/skills/wt-switch-create/rationale.md)\n\n<!-- File: plugins/worktrunk/skills/wt-switch-create/SKILL.md (Tokens: ~2237 | Category: anthropic-skill) -->\n---\nname: wt-switch-create\ndescription: Create a new worktrunk worktree (optionally in another repo) and switch this session's working directory into it. Use when launching a session that should work in its own worktree.\nargument-hint: \"[<branch>] [<repo>] [-- <task>]\"\nlicense: MIT OR Apache-2.0\ncompatibility: Requires the `wt` CLI (https://worktrunk.dev)\n---\n\nArguments: `$ARGUMENTS`. Grammar: `[<branch>] [<repo>] [-- <task>]`.\n\n- **branch** — optional; the branch name for the new worktree. When omitted,\n  pick one (step 1 below).\n- **repo** — optional path or name; create the worktree in this repo instead\n  of the session's current one.\n- **task** — optional; what to do inside the new worktree. No task means enter\n  the worktree and wait.\n\nTokens before the `--` are the branch and/or repo. A path-shaped token\n(starting with `/`, `~`, `./`, or `../`) is the repo. A bare name can be\neither, so make an informed guess. It is the branch when the current repo\nalready has a branch by that name, as it is for `wt switch` itself. Otherwise\nit is the repo when a git repository by that name exists where the user keeps\nrepos (beside the current repo, or in a workspace directory like\n`~/workspace`), and the branch when none does (`docs` is a branch, not the\ncurrent repo's `docs/` directory). A name read as the repo carries its absolute\npath forward: that path, not the bare token, is the `<repo>` in step 3. Two\ntokens that both read as branches don't fit the grammar — ask. Without a `--`,\njudge where the task starts: leading tokens that read as a branch name\n(`fix-auth`) or a repo are consumed as such, and the rest is the task;\notherwise the whole input is the task (`fix the parser bug` has no\nbranch-shaped lead — all task).\n\n```\n/wt-switch-create my-feature -- fix the parser bug\n/wt-switch-create -- fix the parser bug\n/wt-switch-create my-feature ~/workspace/other-repo -- fix the parser bug\n/wt-switch-create my-feature\n```\n\n## What to do\n\nCreating the worktree comes first on every invocation, before any other work.\nThe invocation is itself the explicit request to create it; a research or\nread-only task gets one all the same.\n\n<!-- Maintainers: rationale.md (same directory) covers the harness rules and\ndesign choices behind this — read it before re-adding guards or routes. -->\n\n1. **Pick a new branch name** if none was given: short, from the task and\n   consistent with existing worktree names, or, mid-session, from the work\n   being moved; with nothing to derive from, ask.\n\n2. **With no repo argument, create and enter in one call:**\n   `EnterWorktree({name: \"<branch>\"})`. Worktrunk's `WorktreeCreate` hook runs\n   `wt switch --create` for a new branch or `wt switch` for an existing one,\n   creating its checkout if needed. The result is an ordinary `wt` worktree,\n   and the user sees no confirmation prompt. On success, do the task (or,\n   with no task text, confirm it's ready and wait).\n\n   Mid-session, carry uncommitted work across: `git stash push -u` before the\n   `EnterWorktree` call, then `git stash pop` once the session is in the new\n   worktree, which is after step 3 if this call fails. Entering re-roots the\n   session into the new worktree, and the stash is shared across worktrees. If\n   step 3 hands back without the session in the new worktree, restore the work\n   where it came from first (`git -C <that worktree> stash pop`).\n\n3. **Otherwise create it with `wt` and enter by path.** Two cases reach here: a\n   repo argument, which step 2 can't target, and a failed step 2, whose error\n   says `Already in a worktree session`. Create with a `Bash` call (omit\n   `-C <repo>` for this repo):\n\n   ```\n   wt -C <repo> switch --create <branch> --no-cd --format=json\n   ```\n\n   Stdout is JSON whose `path` field is the worktree's absolute path (status\n   lines go to stderr). On `Branch <branch> already exists`: if the user named\n   the branch, rerun without `--create` (it enters the branch, creating its\n   worktree if missing); if step 1 picked the name, pick another and rerun. Any\n   other failure (not a git repo, invalid name): report it and stop.\n\n   Next, call `ExitWorktree({action: \"keep\"})`. This invocation is the user\n   asking to move the session, which includes leaving the worktree it is in,\n   so make the call even when you're unsure the session is in one. A session\n   in a worktree can enter only one under its repository's\n   `.claude/worktrees/`; leaving lifts that limit, keeps the old worktree and\n   its branch on disk, and returns the session to the directory it was in\n   before it entered. Where there is nothing to leave (no worktree session, or\n   an agent pinned to its own worktree), the call returns an error and changes\n   nothing; carry on. If the session did leave a worktree\n   and the entry below doesn't happen, say so when you hand back: name the\n   worktree it left, still on disk, and where the session is now.\n\n   With a repo argument, `cd <repo>` next, in its own `Bash` call:\n   `EnterWorktree` re-roots only within the repository the cwd is in, and\n   worktrunk's `PermissionRequest` hook answers the confirmation that call\n   asks for only for a `wt` worktree of that same repository. If that `cd`\n   reports `Shell cwd was reset`, the repo is unreachable: skip the entry and\n   hand back as in **Unreachable** below. With no repo argument, don't `cd`:\n   leaving put the session back in this repository, and a `cd` into the\n   worktree it left can reset.\n\n   Then call `EnterWorktree({path: \"<path from the JSON>\"})`.\n\n   With a repo argument, once the session works in the new worktree (entered,\n   or reached by `cd` in the recovery below), read whichever of its root\n   `CLAUDE.md` and `AGENTS.md` exist before the task. Claude Code keeps the\n   launch repo's root instructions in context and loads only the new repo's\n   nested ones, so the new repo's root files supersede the launch repo's for\n   the rest of the session.\n\n   - **Accepted** → the session is re-rooted in the worktree. Do the task (or,\n     with no task text, confirm it's ready and wait).\n   - **Tool error** — the tool ran and returned an error (`Cannot enter\n     worktree: …`) → graceful; nothing moved, and one recovery covers them\n     all. One cause is an agent pinned to its own worktree, which can\n     enter only under its repo's `.claude/worktrees/`, excluding even a\n     same-repo `wt` sibling. The recovery test is whether you can `cd` into\n     the worktree, which works when it's inside an allowed directory. So\n     `cd <path>` and read the result:\n     - no `Shell cwd was reset` notice → it stuck; the worktree is reachable.\n       Work there, but a bare `cd` is not a tracked re-root, so the cwd can\n       revert to the session's launch worktree across turns (and in spawned\n       subagents); pin commands with `git -C <path>` / `wt -C <path>` rather\n       than trusting the `cd` to persist.\n     - `Shell cwd was reset` → **Unreachable.** Stop and ask the user to make\n       the directory whose `cd` reset reachable: add a parent that holds both\n       the repo and its worktrees, like `~/workspace`, to\n       `permissions.additionalDirectories` (durable, every session), or run\n       `/add-dir` on it (this session). Then continue from that `cd`. Don't\n       grind through absolute paths with `cd` resetting on every command.\n   - **Denied** — the call itself was refused, with no tool error → however\n     the denial is worded, it is the user's answer to the confirmation Claude\n     Code shows for entering a worktree outside `.claude/worktrees/`, unless\n     there was no user to ask (the denial says the session couldn't prompt),\n     which decides nothing — take the recovery above. On the user's answer:\n     the worktree `wt` just created still exists; only the entry didn't\n     happen. `cd` back out of the repo you moved into, if any, then report\n     the worktree's path and ask how to proceed, since reaching it through\n     `cd` would override that answer.\n\n## Cleanup\n\nThe worktree is a normal worktrunk worktree: it shows up in `wt list` and is\nmerged or removed with `wt merge` / `wt remove <branch>` like any other. Don't\nremove it unprompted.\n\nA worktree entered by name in step 2 gets Claude Code's Keep / Remove prompt\nwhen the session ends, with Keep selected by default. Remove runs `wt remove`\nwith its normal safeguards. A worktree entered by path in step 3 stays, as\ndoes a worktree the session left with `action: \"keep\"`. If the user asks to\nleave mid-session, `ExitWorktree({action: \"keep\"})` returns the session to its\noriginal directory;\n`ExitWorktree` cannot remove a worktree entered by `path`, so removing one of\nthose is always `wt remove <branch>`.\n\n## Scope\n\nThe command's mandate is ONE worktree (in the named repo, if one was given)\nand the requested task inside it.\n\n<!-- File: skills/worktrunk/reference/claude-code.md (Tokens: ~300 | Category: anthropic-skill) -->\n# Reference Skill\n\nPath: `skills/worktrunk/reference/claude-code.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/claude-code.md)\n\n<!-- File: skills/worktrunk/reference/code-signing.md (Tokens: ~300 | Category: anthropic-skill) -->\n# Reference Skill\n\nPath: `skills/worktrunk/reference/code-signing.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/code-signing.md)\n\n<!-- File: skills/worktrunk/reference/config.md (Tokens: ~300 | Category: anthropic-skill) -->\n# Reference Skill\n\nPath: `skills/worktrunk/reference/config.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/config.md)\n\n<!-- File: skills/worktrunk/reference/extending.md (Tokens: ~300 | Category: anthropic-skill) -->\n# Reference Skill\n\nPath: `skills/worktrunk/reference/extending.md`\n\n[View Raw Content on GitHub](https://raw.githubusercontent.com/max-sixty/worktrunk/HEAD/skills/worktrunk/reference/extending.md)\n\n<!-- ... +24 more modular skills available via /api/skills/max-sixty/worktrunk?path={path} -->\n</yakaai_skills>"}