# Technical Documentation: max-sixty/worktrunk

> ℹ️ **Provenance:** Multi-Tier Ingestion · [CodeWiki Reference](https://codewiki.google/github.com/max-sixty/worktrunk)

### Overview (`README.md`)

<h1><img src="docs/public/logo.png" alt="Worktrunk logo" width="50" align="absmiddle">&nbsp;&nbsp;Worktrunk</h1>


[](https://worktrunk.dev)
[](https://opensource.org/licenses/MIT)
[](https://github.com/max-sixty/worktrunk/actions?query=branch%3Amain+workflow%3Aci)
[](https://codecov.io/gh/max-sixty/worktrunk)
[](https://github.com/max-sixty/worktrunk/stargazers)
[](https://github.com/max-sixty/tend)

> **November 2026**: Worktrunk was [released](https://x.com/max_sixty/status/2006077845391724739?s=20) at the start of the year, and has quickly become the most popular git worktree manager. It's built with love (there's no slop!). Please let me know any frictions at all; I'm intensely focused on continuing to make Worktrunk excellent, and the biggest help is folks posting problems they perceive.

Worktrunk is a CLI for git worktree management, designed for running AI agents in parallel.

Worktrunk's three core commands make worktrees as easy as branches. Plus, Worktrunk has a bunch of quality-of-life features to simplify working with many parallel changes, including hooks to automate local workflows & copy-on-write build caches.

A quick demo:



> ### 📚 Full documentation at [worktrunk.dev](https://worktrunk.dev) 📚



## Context: git worktrees

AI agents like Claude Code and Codex can handle longer tasks without
supervision, such that it's possible to manage 5-10+ in parallel. Git's native
worktree feature gives each agent its own working directory, so they don't step
on each other's changes.

But the git worktree UX is clunky. Even a task as small as starting a new
worktree requires typing the branch name three times: `git worktree add -b feat
../repo.feat`, then `cd ../repo.feat`.

## Worktrunk makes git worktrees as easy as branches

Worktrees are addressed by branch name; paths are computed from a configurable template. Commands that take a branch also accept the path of the worktree it is checked out in.

<p class="workflow-stage">Start with the core commands</p>

**Core commands:**

<table class="cmd-compare">
  <thead>
    <tr>
      <th>Task</th>
      <th>Worktrunk</th>
      <th>Plain git</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Switch worktrees</td>
      <td data-label="Worktrunk"><code>wt switch feat</code></td>
      <td data-label="Plain git"><code>cd ../repo.feat</code></td>
    </tr>
    <tr>
      <td>Create + start Claude</td>
      <td data-label="Worktrunk"><code>wt switch -c -x claude feat</code></td>
      <td data-label="Plain git"><pre><code>git worktree add -b feat ../repo.feat && \
cd ../repo.feat && \
claude</code></pre></td>
    </tr>
    <tr>
      <td>Clean up</td>
      <td data-label="Worktrunk"><code>wt remove</code></td>
      <td data-label="Plain git"><pre><code>cd ../repo && \
git worktree remove ../repo.feat && \
git branch -d feat</code></pre></td>
    </tr>
    <tr>
      <td>List with status</td>
      <td data-label="Worktrunk"><code>wt list</code></td>
      <td data-label="Plain git"><span class="cmd-compare-value"><code>git worktree list</code> (paths only)</span></td>
    </tr>
  </tbody>
</table>

<p class="workflow-stage">Expand into the more advanced commands as needed</p>

<p class="workflow-heading"><strong>Workflow automation:</strong></p>

- **[Hooks](https://worktrunk.dev/hook/)** — run commands on create, pre-merge, post-merge, etc
- **[LLM commit messages](https://worktrunk.dev/llm-commits/)** — generate commit messages from diffs
- **[Merge workflow](https://worktrunk.dev/merge/)** — squash, rebase, merge, clean up in one command
- **[Interactive picker](https://worktrunk.dev/switch/#interactive-picker)** — browse worktrees with streaming CI status and diff, log, PR and comment previews
- **[Share build caches](https://worktrunk.dev/step/#wt-step-copy-ignored)** — ten worktrees get `target/`, `node_modules/`, etc without building or copying them (on APFS, btrfs, and XFS)
- **[`wt list --full`](https://worktrunk.dev/list/#full-mode)** — [CI status](https://worktrunk.dev/list/#ci-status) and [AI-generated summaries](https://worktrunk.dev/list/#llm-summaries) per branch
- **[PR checkout](https://worktrunk.dev/switch/#pull-requests-and-merge-requests)** — `wt switch pr:123` to jump straight to a PR's branch
- **[Dev server per worktree](https://worktrunk.dev/tips-patterns/#dev-server-per-worktree)** — `hash_port` template filter gives each worktree a unique port
- **[Aliases](https://worktrunk.dev/extending/#aliases) & [per-branch variables](https://worktrunk.dev/config/#wt-config-state-vars)** — custom `wt <name>` commands and branch-scoped state for hook templates
- ...and **[lots more](#next-steps)**

Multiple parallel agents, same simple commands:







## Install

**Homebrew (macOS & Linux):**

```bash
brew install worktrunk && wt config shell install
```

Shell integration allows commands to change directories.

**Cargo:**

```bash
cargo install worktrunk && wt config shell install
```

<details>
<summary><strong>Windows & other</strong></summary>

**Windows.** `wt` defaults to Windows Terminal's command, so Winget additionally installs Worktrunk as `git-wt` to avoid the conflict:

```bash
winget install max-sixty.worktrunk
git-wt config shell install
```

Alternatively, disable Windows Terminal's alias (Settings → Apps → Advanced app settings → App execution aliases → "Terminal"/"Terminal Preview") to use `wt` directly.

> Free code signing provided by [SignPath.io](https://signpath.io/), certificate by [SignPath Foundation](https://signpath.org/) — [policy](https://worktrunk.dev/code-signing/).

**Arch Linux:**

```bash
sudo pacman -S worktrunk && wt config shell install
```

**Conda / Pixi** (community-maintained [feedstock](https://github.com/conda-forge/worktrunk-feedstock)):

```bash
conda install -c conda-forge worktrunk && wt config shell install
```

Or with [Pixi](https://pixi.sh): `pixi global install worktrunk && wt config shell install`.

**PyPI** (experimental):

```bash
uv tool install worktrunk@latest && wt config shell install
```

Python tools can also list `worktrunk` as a dependency, or run it without installing: `uvx --from worktrunk wt list`.

</details>

## Quick start

Create a worktree for a new feature:

```console
$ wt switch --create feature-auth
✓ Created branch feature-auth from main and worktree @ ~/repo.feature-auth
```

This creates a new branch and worktree, then switches to it. Do your work, then check all worktrees with [`wt list`](https://worktrunk.dev/list/):

```console
$ wt list
  Branch        Status       @±        ^↕        ^…±     Remote⇅  Commit    Age  Message
@ feature-auth  +   ↑      +27   -8   ↑1       +31                4bc72dc    2h  Add authenticatio…
^ main              ^⇡                                    ⇡1      0e631ad    1d  Initial commit

○ Showing 2 worktrees, 1 with changes, 1 ahead, hidden: Path  (+ staged files  ↑ ahead of default)
```

The `@` marks the current worktree. `+` means staged changes, `↑1` means 1 commit ahead of main, `⇡` means unpushed commits.

When done, either:

**PR workflow** — commit, push, open a PR, merge via GitHub/GitLab, then clean up:

```bash
wt step commit                    # commit staged changes
gh pr create                      # or glab mr create
wt remove                         # after PR is merged
```

**Local merge** — squash, rebase onto main, fast-forward merge, clean up:

```console
$ wt merge main
◎ Generating commit message and committing changes... (2 files, +53, no squashing needed)
  Add authentication module
✓ Committed changes @ a1b2c3d
◎ Merging 1 commit to main @ a1b2c3d (no rebase needed)
  * a1b2c3d Add authentication module
   auth.rs | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
   lib.rs  |  2 ++
   2 files changed, 53 insertions(+)
✓ Merged to main (1 commit, 2 files, +53)
◎ Removing feature-auth worktree & branch in background (same commit as main, _)
○ Switched to worktree for main @ ~/repo
```

For parallel agents, create multiple worktrees and launch an agent in each:

```bash
wt switch -x claude -c feature-a -- 'Add user authentication'
wt switch -x claude -c feature-b -- 'Fix the pagination bug'
wt switch -x claude -c feature-c -- 'Write tests for the API'
```

The `-x` flag runs a command after switching; arguments after `--` are passed to it. Configure [post-start hooks](https://worktrunk.dev/hook/#hook-types) to automate setup (install deps, start dev servers).

## Next steps

- Learn the core commands: [`wt switch`](https://worktrunk.dev/switch/), [`wt list`](https://worktrunk.dev/list/), [`wt merge`](https://worktrunk.dev/merge/), [`wt remove`](https://worktrunk.dev/remove/)
- Set up [hooks](https://worktrunk.dev/hook/) for automated setup
- Explore [LLM commit messages](https://worktrunk.dev/llm-commits/), [interactive
  picker](https://worktrunk.dev/switch/#interactive-picker), [Claude Code integration](https://worktrunk.dev/claude-code/), [CI
  status & PR links](https://worktrunk.dev/list/#ci-status)
- Browse [tips & patterns](https://worktrunk.dev/tips-patterns/) for recipes: aliases, dev servers, databases, agent handoffs, and more
- [Extending Worktrunk](https://worktrunk.dev/extending/) — customize workflows with hooks & aliases
- Watch [@DevOpsToolbox's video on Worktrunk](https://youtu.be/WBQiqr6LevQ?t=345)
- Run `wt --help` or `wt <command> --help` for quick CLI reference



## Contributing

- ⭐ Star the repo
- Tell a friend about Worktrunk
- [Open an issue](https://github.com/max-sixty/worktrunk/issues/new?title=&body=%23%23%20Description%0A%0A%3C!--%20Describe%20the%20bug%20or%20feature%20request%20--%3E%0A%0A%23%23%20Context%0A%0A%3C!--%20Any%20relevant%20context%3A%20your%20workflow%2C%20what%20you%20were%20trying%20to%20do%2C%20etc.%20--%3E) — feedback, feature requests, even a small friction or imperfect user message, or [a worktree pain not yet solved](https://github.com/max-sixty/worktrunk/issues/new?title=Worktree%20friction%3A%20&body=%23%23%20The%20friction%0A%0A%3C!--%20What%20worktree-related%20task%20is%20still%20painful%3F%20--%3E%0A%0A%23%23%20Current%20workaround%0A%0A%3C!--%20How%20do%20you%20handle%20this%20today%3F%20--%3E%0A%0A%23%23%20Ideal%20solution%0A%0A%3C!--%20What%20would%20make%20this%20easier%3F%20--%3E)
- Share: [X](https://twitter.com/intent/tweet?text=Worktrunk%20%E2%80%94%20CLI%20for%20git%20worktree%20management&url=https%3A%2F%2Fworktrunk.dev) · [Reddit](https://www.reddit.com/submit?url=https%3A%2F%2Fworktrunk.dev&title=Worktrunk%20%E2%80%94%20CLI%20for%20git%20worktree%20management) · [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fworktrunk.dev)

> ### 📚 Full documentation at [worktrunk.dev](https://worktrunk.dev) 📚

### Star history


<a href="https://star-history.com/#max-sixty/worktrunk&Date">
  <img src="https://api.star-history.com/svg?repos=max-sixty/worktrunk&type=Date&sealed_token=2ySbQiVbkVrGmwgDsJya-xr4ApbVVvR0siYI46d22Xj_1kPCcgA9X0YpUGc3__aMuZ0ZAWzG4NBhJtqepYjlkoYrVwmKbgaPmGpNZTCfSyVp8EDA_IXaOOYW2whsOXDAi6g7HD9ezsnqSl58n7AqW2_4IQ4hY2p3h7tNv_3k4am5ASq1NdpbfrOUazCl" width="500" alt="Star History Chart">
</a>

---

### Overview (`plugins/worktrunk/README.md`)

# Worktrunk Plugin for Claude Code

Git worktree management CLI integration with activity tracking.

Requires `wt` v0.81.0 or later ([worktrunk.dev](https://worktrunk.dev)).

## Features

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

## What the hooks run

Every hook runs `wt config plugins claude hook` through `hooks/wt.sh`; that subcommand reads Claude Code's hook payload and acts on its event:

- **Activity markers**: `UserPromptSubmit`, `Notification`, `Stop`, and `PreToolUse` on `AskUserQuestion` set the branch's marker; `SessionEnd` clears it.
- **Worktree creation and removal**: when Claude Code creates or removes a worktree, the `WorktreeCreate` and `WorktreeRemove` hooks run `wt switch --create` (plain `wt switch` when the branch already exists, which returns its worktree) and `wt remove` in place of Claude Code's own `git worktree` commands, so the worktree follows worktrunk's path layout and runs the project's approved worktrunk hooks.
- **`EnterWorktree` approval**: the `PermissionRequest` hook allows an `EnterWorktree` call without a dialog when its path is a worktree of the current repository at the location worktrunk's `worktree-path` template gives its branch. Every other request shows Claude Code's usual dialog and sets the branch's marker to 💬 while it waits.

## Examples

**Activity tracking across worktrees**

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

**Set up LLM commit message generation**

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

**Add pre-start hooks to run npm install automatically**

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

**Start work in a fresh worktree**

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

---

### Overview (`docs/demos/demoshell/README.md`)

# Try it demo

The [Try it](https://worktrunk.dev/try-it/) page embeds a [Demoshell](https://demoshell.com) VM: Alpine Linux on an emulated arm64 CPU, running in the visitor's browser with `wt` installed. `docs/src/pages/try-it.astro` mounts it by its Demoshell reference.

The VM's definition is kept here and entered into the Demoshell studio, where the VM is built and saved:

| File | Studio field |
|------|--------------|
| `recipe.sh` | Base image script |
| `after-load.sh` | Files → `/root/after-load.sh` |
| `guide.json` | Guide: title, order, finish card, and steps |

`guide.json` uses the field names Demoshell's embed API serves for a guide. Command steps tick when the visitor runs `pattern`, and `output_contains` must appear in its output, so check those strings against real output when changing the recipe or `wt`'s messages. The optional interactive picker uses a manual step: Demoshell does not detect completion when it leaves the terminal's alternate screen.

Set **When a visitor opens the VM → Start an app** to `bash --rcfile /root/after-load.sh`. Demoshell's shell-prompt mode runs ash even if the recipe changes root's login shell. Starting bash explicitly loads Worktrunk's shell integration so switching and merging move the visitor's shell.

`after-load.sh` supplies the prompt prefix Demoshell uses to identify commands and an OSC 133 exit-status marker so the guide can verify whether they succeeded.

To check the full recipe before a Studio build, run this from the repository root with Docker:

```bash
docker run --rm -it --platform linux/arm64 \
  -v "$PWD/docs/demos/demoshell:/demo:ro" \
  alpine:latest sh -ec 'sh -e /demo/recipe.sh; exec bash --rcfile /demo/after-load.sh'
```

In the container, run each command step's `pattern` from `guide.json`, then try the optional picker as described. Check that each command step's `output_contains` appears and that merging returns the shell to `/root/acme` with the updated price. This exercises the release download and Alpine shell setup as well as the guide commands; the Studio build and automatic guide completion still need checking in Demoshell.

Demoshell rebuilds the VM when a Worktrunk release is published, so the recipe installs the latest release rather than a pinned version.

---

### Overview (`.claude/skills/release/evals/README.md`)

# Changelog cases

## Verification template

Four entries from a shipped release, three of which reached users wrong. They
score the "MANDATORY: Verify Each Changelog Entry" prompt template: run it as a
subagent prompt and check which of the three it reports.

The template reads the top section of `CHANGELOG.md` on disk, so run the arm in a
checkout at `v0.77.0`, where that section is the 29 entries these cases come
from. Run the template unedited: pointing it at the section some other way scores
a prompt nobody ships, and the section it would otherwise read is whatever
release is in progress.

```bash
git worktree add /tmp/wt-eval-0.77.0 v0.77.0   # remove it afterwards
```

That checkout carries this skill at `v0.77.0` too, whose template is the one
being replaced. Pass the arm's template as the prompt and withhold the `Skill`
tool, so the run cannot load the old one off disk instead.

Offer the run the notes from the per-group agents as a map, the way a release
does. Handed only these four entries every wording found all three, so what the
cases measure is attention spread across 29 entries, a missing-entries sweep,
and the attribution checks.

None of them has its truthmaker wholly outside the commit, and that is hard to
fix here: this repo's commits routinely restate the surrounding facts in added
comments and doc lines, so the falsifying text usually arrives in the diff. Read
the rows as scoring how much of the diff the verifier reads, not whether it goes
looking beyond one.

| Case | Entry | The claim | What the source says |
|------|-------|-----------|----------------------|
| Before-state, with a confirming-looking diff | `wt list --format=json` gains a `marker` field | "`state` no longer carries `detached`" | `git show 981a207e2^:src/commands/list/model/state.rs` has no `Detached` variant — the PR adds it. The diff's no-op arm for `Detached` reads like the removal of a case that used to emit something. |
| Fact in the diff, in an added comment rather than the code | `wt config state marker` set and clear no-op | "an agent plugin's hooks failed on every event" | Every shipped marker hook ends `\|\| true` (`git grep 'state marker' v0.76.0 -- plugins hooks`), so the hook exited 0. `29a611b7c` says so in a comment it adds beside the fix, so a verifier that reads the whole diff has the contradiction without leaving it. |
| Non-headline clause, settled in the diff | The FAQ lists the files Worktrunk writes | "for Claude Code, Codex, OpenCode, Pi, and Gemini" | The FAQ's new table has three rows. Gemini appears nowhere; Codex appears only in the line saying its install writes nothing. |
| Guardrail | LLM commit messages keep diffs for quoted paths | all of it | Accurate. A run that calls this entry wrong has gone too far. |

## Fix prominence

`research-0.80.0.md` holds the per-group research notes 0.80.0's Fixed section
was drafted from, then that first draft. The draft named every condition, joined
with "and", yet gave each of fourteen fixes its own bullet under a headline
stating the consequence, so corner cases such as a pre-remove hook corrupting
the user config read as general breakage. The case scores "Match a fix's prominence to
its reach".

Paste the arm's `## CHANGELOG Review` section (up to `### Credit External
Contributors`), the 0.79.0 Fixed section from `CHANGELOG.md` as the neighbouring
exemplar, and the notes without the draft into one prompt, and ask for the
Fixed section alone:

- The submodule-ignore fix (#4252) is headlined by its setup, not by what `wt remove` deleted.
- The near-zero-reach fixes (leading `-` names, non-UTF-8 paths, `CLAUDE_CONFIG_DIR`, #4276) sit in a roll-up bullet rather than their own.
- Guardrail: the failed-squash fix (#4206), which anyone with a failing commit hook hits, keeps its own bullet near the top.

Against the wording before it, the rule's first version took setup-first
submodule headlines from 1/3 to 3/3 and roll-up bullets from 0/3 to 3/3 (one run
still gave #4276 its own bullet), and every run held the guardrail.

The verifier's headline check scores on the same notes and the draft as first
written, the fixture's last section: handed the template's "Also check" list,
three runs with the headline line proposed the roll-up and three without it did
not.

---

### AGENTS (`docs/AGENTS.md`)

# Documentation site

The site uses Astro and Starlight. The project hook installs dependencies, fetches assets, and starts the dev server; wt list shows this worktree's URL. Site checks are npm --prefix docs run check, test, build, and test:site. Before the first test:site run, install its browser with npm --prefix docs exec playwright install webkit. A config change under a running Astro server may require wt hook post-start docs to clear its content cache.

For text changes, run the docs sync test and build. For visual changes, inspect the rendered page at desktop and mobile widths, including affected navigation, code blocks, and theme states. Hand over the running preview.

## Site architecture

Canonical Markdown is in docs/src/content/docs/. The homepage renders worktrunk.md. Keep existing public routes and anchors stable; src/plugins/stable-heading-ids.mjs owns heading IDs, and test:site checks built links. Use root-relative links and asset paths. Starlight owns navigation, search, code frames, copy controls, and theme selection; keep overrides narrow. The design uses warm paper, dark ink, orange accents, and terminal output as the main visual material.

## Documentation sync taxonomy

Run cargo test --test integration test_docs_are_in_sync. It regenerates mirrors and fails if they changed; review the diff and run it again.

- Command pages: src/cli/mod.rs is primary for config, hook, list, merge, remove, step, and switch. The test updates their generated regions in the site and skills/worktrunk/reference/.
- Other site pages: docs/src/content/docs/ is primary and generates the skill copy.
- Skill-only pages: skills/worktrunk/reference/ is primary. Mark new authored pages linguist-generated=false in .gitattributes.
- plugins/worktrunk/skills/ is a generated mirror of repo-root skills/.

Never edit generated regions or mirrors directly. Command-page frontmatter stays outside the generated markers, and generated regions must not nest.

## Command-page generation

The first Clap doc line is the short description; a second line can supply terminal context. after_long_help contains the guide, examples, and links. Terminal help shows it after options, while the site leads with the short description, so do not repeat that lead. Link text must make sense when terminal help removes the URL.

USER_CONFIG_START and PROJECT_CONFIG_START blocks also generate commented TOML. Put explanatory prose before a TOML fence, not as standalone TOML comments that would be commented twice. After help changes, run test_docs_are_in_sync and cargo insta test --accept --test integration -- test_help.

## Snapshot examples

Command placeholders in src/cli/mod.rs expand from snapshots owned by tests/integration_tests/readme_sync.rs. Update the owning test and snapshot, then run the sync test twice. The sync also writes terminal-styles.json from ANSI spans. Keep portable Markdown plain text; src/plugins/worktrunk-terminal.mjs supplies site-only styling and command-copy behavior.

## Code-block convention

Use bash for copyable commands, console for command plus output with a $ prompt, and the actual language for files. Put a file-path comment first when valid, or a title attribute on the fence. Committed Markdown must remain understandable without the site renderer.

## Template examples

Every documented Worktrunk template expression needs a matching test in tests/integration_tests/doc_templates.rs.

## Demo assets

Large GIFs live in max-sixty/worktrunk-assets and are fetched into gitignored docs/public/assets/. docs/demos/AGENTS.md covers recording and validation. SVG social-card sources remain in docs/public/.

---

### Package.Json (`docs/package.json`)

{
  "name": "worktrunk-docs",
  "private": true,
  "type": "module",
  "scripts": {
    "build": "astro build --force",
    "check": "astro check",
    "dev": "astro dev --force",
    "parity": "node scripts/parity.mjs",
    "preview": "astro preview",
    "test": "node --test tests/plugins.test.mjs",
    "test:site": "node --test tests/built-site.test.mjs tests/browser-site.test.mjs"
  },
  "dependencies": {
    "@astrojs/markdown-remark": "^7.3.10",
    "@astrojs/sitemap": "^3.7.6",
    "@astrojs/starlight": "^0.43.1",
    "@expressive-code/core": "^0.44.4",
    "astro": "^7.4.13",
    "hast-util-from-html": "^2.1.0"
  },
  "devDependencies": {
    "@astrojs/check": "^0.9.12",
    "playwright": "^1.65.1",
    "typescript": "^6.0.3"
  }
}

---

### Demos AGENTS (`docs/demos/AGENTS.md`)

# Demo development

Tapes live in docs/demos/tapes/; shared setup, themes, fixtures, and OCR checkpoints live in shared/. The build script produces gitignored docs/public/assets/ output. The separate assets repository holds published GIFs.

## Recording and validation

- Build a recording with `./docs/demos/build docs --only <name>` or `./docs/demos/build social --only <name>`. Docs produces light and dark variants; social produces light only. Each theme needs a fresh demo environment because tapes mutate it.
- Use --snapshot for command-output regression snapshots. TUI recordings need GIF inspection and OCR checkpoints in shared/validation.py because text snapshots cannot see nested terminal content. Measure checkpoint windows in the actual GIF; frame counts drift with execution time and terminal size.
- Use --shell to inspect a prepared demo environment interactively. The build fetches its VHS fork and other dependencies; Claude demos use the authenticated account.
- Inspect sampled frames across the finished GIF for split commands, warnings, wrong panes, and layout glitches. Confirm visible controls and text at representative states before publishing.
- Publish with task publish-assets only when authorized; task fetch-assets retrieves published files. Local builds and fetched assets share docs/public/assets/.

The VHS fork checkout under docs/demos/.deps/vhs/ is gitignored. Changes to the fork do not ship with this repository; publish them in that fork explicitly when authorized.

## Tape behavior

Keep displayed commands natural; put recording-only flags in setup. Pause long enough to read results, with short gaps between related keystrokes. The tape's opening command is typed before Show so the first frame contains it complete. Hidden keystrokes land together on the first visible frame.

For Alt keybindings, the VHS fork passes macOptionIsMeta to ttyd; quote digit keys as Alt+"8". If a key seems wrong, verify its bytes in a recording before changing the tape.

The mock forge data is written by write_gh_mock_data in shared/lib.py and served by fixtures/gh-mock.sh. A parseable origin, a successful gh --version, and matching DEMO_PROJECT_ID are required before CI cells appear. Staggered response delays demonstrate progressive rows; keep the longest within the tape's wait.

The picker recording uses prepare_picker and its own smaller text size to fit the CI, summary, and preview columns. Its filter searches PR metadata as well as branch names, and narrowing preserves cursor row index; use an unambiguous query before cursor movement.

The site palette in docs/src/styles/custom.css feeds shared/themes.py, so re-record demos after palette changes. Do not kill generic Zellij processes while cleaning up a demo run; identify the demo process specifically.

---

### Public Llms (`docs/public/llms.txt`)

# Worktrunk

> CLI for Git worktree management, designed for parallel AI agent workflows.

Worktrunk is a CLI for Git worktree management, designed for **parallel AI agent
workflows**.

Worktrunk's three core commands make worktrees as easy as branches.
Plus, Worktrunk has a bunch of quality-of-life features to simplify working
with many parallel changes, including hooks to automate local workflows &
copy-on-write build caches.

## Commands

- [wt switch](https://worktrunk.dev/switch.md): Switch to a worktree; create if needed.
- [wt list](https://worktrunk.dev/list.md): List worktrees and their status.
- [wt merge](https://worktrunk.dev/merge.md): Merge a branch into the target branch. Squash & rebase, fast-forward the target branch, remove the worktree.
- [wt remove](https://worktrunk.dev/remove.md): Remove worktree; delete branch if merged. Defaults to the current worktree.
- [wt config](https://worktrunk.dev/config.md): Manage user & project configs. Includes shell integration, hooks, and saved state.
- [wt step](https://worktrunk.dev/step.md): Run individual operations. The building blocks of wt merge — commit, squash, rebase, push — plus standalone utilities.
- [wt hook](https://worktrunk.dev/hook.md): Run configured hooks.

## Reference

- [Agent Integration](https://worktrunk.dev/claude-code.md): Worktrunk plugins for Claude Code, Codex, OpenCode, Pi, oh-my-pi, and Gemini CLI: a configuration skill, wt list activity tracking, and worktree isolation for Claude Code and OpenCode.
- [Extending Worktrunk](https://worktrunk.dev/extending.md): Three ways to add custom behavior: hooks for lifecycle automation, aliases for reusable commands, and custom subcommands for standalone tools.
- [LLM Commit Messages](https://worktrunk.dev/llm-commits.md): Generate commit messages from diffs using any LLM. Integrates with wt merge, wt step commit, and wt step squash.
- [Tips & Patterns](https://worktrunk.dev/tips-patterns.md): Practical recipes for Worktrunk workflows: repo layout, aliases and hooks, per-worktree dev servers and databases, agent handoffs, and branch status.
- [Shell integration](https://worktrunk.dev/shell-integration.md): How Worktrunk's shell wrapper changes the parent shell's directory, which files each shell gets, and how to debug integration that isn't working.
- [FAQ](https://worktrunk.dev/faq.md): Common questions about Worktrunk: comparison to git worktree and branch switching, bare repos, TUI support, and more.
- [Code Signing Policy](https://worktrunk.dev/code-signing.md): Windows code signing, release approval, and privacy.

---

### Public Robots (`docs/public/robots.txt`)

User-agent: *
Allow: /

Sitemap: https://worktrunk.dev/sitemap.xml

---

### Public Shell Integration (`docs/public/shell-integration.md`)

../../skills/worktrunk/reference/shell-integration.md

---

### Demos Demoshell Guide.Json (`docs/demos/demoshell/guide.json`)

{
  "title": "Take a change from a new worktree to main",
  "order_mode": "fixed",
  "cta_label": "Install Worktrunk",
  "cta_url": "https://worktrunk.dev/#install",
  "steps": [
    {
      "title": "See every worktree at once",
      "body": "One row per worktree: docs is a commit ahead of main, and experiment has uncommitted changes (!). @ marks where you are.",
      "kind": "command",
      "match_mode": "exact",
      "pattern": "wt list",
      "output_contains": "Showing 3 worktrees",
      "require_success": true,
      "optional": false
    },
    {
      "title": "Start a worktree for a new change",
      "body": "--create makes the branch and its worktree together and moves your shell into it: one command in place of git worktree add plus a cd.",
      "kind": "command",
      "match_mode": "exact",
      "pattern": "wt switch --create raise-price",
      "output_contains": "Created branch",
      "require_success": true,
      "optional": false
    },
    {
      "title": "Make the change",
      "body": "Edit a file as you or an agent would. The other worktrees don't see it.",
      "kind": "command",
      "match_mode": "exact",
      "pattern": "sed -i 's/19\\/month/24\\/month/' pricing.txt",
      "output_contains": null,
      "require_success": true,
      "optional": false
    },
    {
      "title": "See the change in the list",
      "body": "raise-price now shows ! for uncommitted changes and +1 -1 for the lines changed.",
      "kind": "command",
      "match_mode": "exact",
      "pattern": "wt list",
      "output_contains": "Showing 4 worktrees",
      "require_success": true,
      "optional": false
    },
    {
      "title": "Merge it into main",
      "body": "No git commit needed: wt merge commits the change, rebases onto main if needed, fast-forwards main, removes the worktree and branch, and brings your shell back to main.",
      "kind": "command",
      "match_mode": "exact",
      "pattern": "wt merge",
      "output_contains": "Merged to",
      "require_success": true,
      "optional": false
    },
    {
      "title": "Jump to another worktree",
      "body": "Run wt switch to open a picker: type to filter, move with the arrow keys, Enter to switch, Esc to leave. Mark this step done when you've tried it.",
      "kind": "manual",
      "match_mode": "exact",
      "pattern": "",
      "output_contains": null,
      "require_success": false,
      "optional": true
    }
  ]
}

---

### Public Schema List V2.Json (`docs/public/schema/list-v2.json`)

{
  "$defs": {
    "CiSource": {
      "description": "Source of CI status (PR/MR vs branch workflow)\n\nSerialized to JSON as \"pr\" or \"branch\" for programmatic consumers.",
      "oneOf": [
        {
          "const": "pr",
          "description": "Pull request or merge request",
          "type": "string"
        },
        {
          "const": "branch",
          "description": "Branch workflow/pipeline (no PR/MR)",
          "type": "string"
        }
      ]
    },
    "Collected": {
      "description": "Fact families whose collection is gated (`--full`, `[list] summary`).\nUngated families (working tree, counts, diffs) are always requested.\nSerialized as-is into the schema-2 JSON envelope's `collected` field,\ndisambiguating \"absent because not requested\".",
      "properties": {
        "ci": {
          "description": "Forge CI/PR data was fetched.",
          "type": "boolean"
        },
        "summary": {
          "description": "LLM branch summaries were generated.",
          "type": "boolean"
        }
      },
      "required": [
        "ci",
        "summary"
      ],
      "type": "object"
    },
    "GitRepoInfo": {
      "description": "Parsed, provider-neutral repository metadata.\n\nThis is the single shape behind the `repo` / `ci.repo` JSON objects of\n`wt list`; serde controls the field rename/skip rules so there is no\nparallel output-only struct.",
      "properties": {
        "api_host": {
          "description": "Configured API hostname for the local repository.",
          "type": [
            "string",
            "null"
          ]
        },
        "host": {
          "description": "Web host for the repository URL.",
          "type": "string"
        },
        "name": {
          "description": "Repository name.",
          "type": "string"
        },
        "owner": {
          "description": "Repository owner, organization, or namespace path.",
          "type": "string"
        },
        "project": {
          "description": "Azure DevOps project name.",
          "type": [
            "string",
            "null"
          ]
        },
        "provider": {
          "$ref": "#/$defs/GitRepoProvider",
          "description": "Forge provider, or [`GitRepoProvider::Unknown`] for parseable URLs whose\nhost and config do not identify a supported provider."
        },
        "remote": {
          "description": "Local git remote this metadata was derived from. Set only for the\ntop-level `repo` of `wt list`; absent for PR/MR-URL-derived metadata\nsuch as `ci.repo`.",
          "type": [
            "string",
            "null"
          ]
        },
        "url": {
          "description": "Repository web URL.",
          "type": "string"
        }
      },
      "required": [
        "url",
        "provider",
        "host",
        "owner",
        "name"
      ],
      "type": "object"
    },
    "GitRepoProvider": {
      "description": "Supported forge providers for repository metadata.",
      "enum": [
        "github",
        "gitlab",
        "gitea",
        "azure-devops",
        "unknown"
      ],
      "type": "string"
    },
    "JsonChanges": {
      "description": "Working-tree change facts.",
      "properties": {
        "conflicted": {
          "description": "Tracked files carry merge conflicts; null while unresolved.",
          "type": [
            "boolean",
            "null"
          ]
        },
        "deleted": {
          "description": "Has deleted files.",
          "type": "boolean"
        },
        "diff": {
          "anyOf": [
            {
              "$ref": "#/$defs/JsonDiff"
            },
            {
              "type": "null"
            }
          ],
          "description": "Lines added/deleted vs HEAD; null while unresolved."
        },
        "modified": {
          "description": "Has modified (unstaged) files.",
          "type": "boolean"
        },
        "renamed": {
          "description": "Has renamed files.",
          "type": "boolean"
        },
        "staged": {
          "description": "Has staged files.",
          "type": "boolean"
        },
        "untracked": {
          "description": "Has untracked files.",
          "type": "boolean"
        }
      },
      "required": [
        "staged",
        "modified",
        "untracked",
        "renamed",
        "deleted",
        "conflicted",
        "diff"
      ],
      "type": "object"
    },
    "JsonCheckStatus": {
      "description": "The pipeline outcomes that reach JSON. [`CiStatus`] carries three more\nthat never appear here, because each is reported by the shape of `checks`\nrather than by a value inside it: `Error` makes both `pr` and `checks`\nunknown, `NoCI` makes `checks` absent, and `Conflicts` leaves `status`\nnull (the conflict itself surfaces as `pr.mergeable`). See\n[`pr_and_checks`].",
      "enum": [
        "passed",
        "running",
        "failed"
      ],
      "type": "string"
    },
    "JsonChecks": {
      "description": "CI pipeline facts.",
      "properties": {
        "source": {
          "$ref": "#/$defs/CiSource",
          "description": "`\"pr\"` or `\"branch\"` (branch workflow)."
        },
        "stale": {
          "description": "Local HEAD is not what CI ran against.",
          "type": "boolean"
        },
        "status": {
          "anyOf": [
            {
              "$ref": "#/$defs/JsonCheckStatus"
            },
            {
              "type": "null"
            }
          ],
          "description": "Pipeline outcome; null when a conflicts report masked it."
        }
      },
      "required": [
        "status",
        "source",
        "stale"
      ],
      "type": "object"
    },
    "JsonDefaultBranch": {
      "description": "Relation to the default branch — independent facts, not the table's\npriority-collapsed symbol (that lives in `display.state`).",
      "properties": {
        "ahead": {
          "description": "Commits ahead; null while unresolved (and for orphans).",
          "format": "uint",
          "minimum": 0,
          "type": [
            "integer",
            "null"
          ]
        },
        "behind": {
          "description": "Commits behind; null while unresolved (and for orphans).",
          "format": "uint",
          "minimum": 0,
          "type": [
            "integer",
            "null"
          ]
        },
        "diff": {
          "anyOf": [
            {
              "$ref": "#/$defs/JsonDiff"
            },
            {
              "type": "null"
            }
          ],
          "description": "Lines added/deleted vs the default branch; null while unresolved."
        },
        "integration": {
          "$ref": "#/$defs/Nullable_JsonIntegration",
          "description": "How committed content is integrated; absent when determined\nnot-integrated, null when undetermined (a check timed out or was\nskipped)."
        },
        "merge_conflicts": {
          "description": "A merge into the default branch would conflict based on committed\ncontent and tracked worktree changes (local `merge-tree` simulation);\nnull while unresolved.",
          "type": [
            "boolean",
            "null"
          ]
        },
        "orphan": {
          "description": "No merge-base with the default branch; null while unresolved.",
          "type": [
            "boolean",
            "null"
          ]
        }
      },
      "required": [
        "ahead",
        "behind",
        "diff",
        "orphan",
        "merge_conflicts"
      ],
      "type": "object"
    },
    "JsonDevServer": {
      "description": "Dev server facts.",
      "properties": {
        "listening": {
          "description": "The URL's port is listening; null while unresolved.",
          "type": [
            "boolean",
            "null"
          ]
        },
        "url": {
          "description": "URL from the project's `list.url` template.",
          "type": "string"
        }
      },
      "required": [
        "url",
        "listening"
      ],
      "type": "object"
    },
    "JsonDiff": {
      "description": "Line diff statistics",
      "properties": {
        "added": {
          "format": "uint",
          "minimum": 0,
          "type": "integer"
        },
        "deleted": {
          "format": "uint",
          "minimum": 0,
          "type": "integer"
        }
      },
      "required": [
        "added",
        "deleted"
      ],
      "type": "object"
    },
    "JsonDisplay": {
      "description": "Presentation strings. Everything here is a rendering of facts that\nappear elsewhere in the item.",
      "properties": {
        "columns": {
          "additionalProperties": {
            "type": "string"
          },
          "description": "Rendered `[list.custom-columns]` cells keyed by header; empty cells\nomitted.",
          "type": "object"
        },
        "state": {
          "anyOf": [
            {
              "$ref": "#/$defs/JsonMainState"
            },
            {
              "type": "null"
            }
          ],
          "description": "The table's collapsed default-branch state (one value per row,\nhighest priority wins); absent when none applies or unresolved."
        },
        "statusline": {
          "description": "Pre-formatted one-line status with ANSI colors, for prompt tools.",
          "type": [
            "string",
            "null"
          ]
        },
        "symbols": {
          "description": "Raw status glyphs without ANSI (e.g. `\"+!⊂\"`).",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "type": "object"
    },
    "JsonHead": {
      "description": "HEAD commit facts.",
      "properties": {
        "committed_at": {
          "description": "Committer time, RFC 3339 UTC; null when not loaded.",
          "type": [
            "string",
            "null"
          ]
        },
        "sha": {
          "description": "Full commit SHA.",
          "type": "string"
        },
        "short_sha": {
          "description": "Abbreviated per `core.abbrev`, auto-extended for ambiguous prefixes;\nnull when not determined (the commit object can't be read).",
          "type": [
            "string",
            "null"
          ]
        },
        "subject": {
          "description": "Commit subject (first line); null when not loaded (e.g. prunable\nworktrees).",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "sha",
        "short_sha",
        "subject",
        "committed_at"
      ],
      "type": "object"
    },
    "JsonIntegration": {
      "description": "Why committed content counts as integrated.",
      "properties": {
        "reason": {
          "$ref": "#/$defs/JsonIntegrationReason",
          "description": "Which check matched."
        }
      },
      "required": [
        "reason"
      ],
      "type": "object"
    },
    "JsonIntegrationReason": {
      "description": "`IntegrationReason` wire values. Schema 2 uses snake_case throughout; the\nenum's own serde rename (kebab-case) is shared with other surfaces, so the\nmapping lives here instead of on the enum.",
      "enum": [
        "same_commit",
        "ancestor",
        "no_added_changes",
        "trees_match",
        "merge_adds_nothing",
        "patch_id_match"
      ],
      "type": "string"
    },
    "JsonItemV2": {
      "description": "One list row: a worktree, a local branch, or a remote-only branch.",
      "properties": {
        "branch": {
          "description": "Branch name; null for a detached-HEAD worktree. Remote rows carry\nthe bare branch name, with the remote in `remote`.",
          "type": [
            "string",
            "null"
          ]
        },
        "checks": {
          "$ref": "#/$defs/Nullable_JsonChecks",
          "description": "CI pipeline state; absent when no CI exists (or CI wasn't\ncollected), null when the forge fetch failed."
        },
        "default_branch": {
          "$ref": "#/$defs/Nullable_JsonDefaultBranch",
          "description": "Relation to the default branch; absent on the default branch itself."
        },
        "dev_server": {
          "anyOf": [
            {
              "$ref": "#/$defs/JsonDevServer"
            },
            {
              "type": "null"
            }
          ],
          "description": "Dev server from the project's `list.url` template; absent when not\nconfigured."
        },
        "display": {
          "$ref": "#/$defs/JsonDisplay",
          "description": "Presentation: rendered strings for humans and prompt tools."
        },
        "head": {
          "anyOf": [
            {
              "$ref": "#/$defs/JsonHead"
            },
            {
              "type": "null"
            }
          ],
          "description": "HEAD commit; null for unborn branches."
        },
        "marker": {
          "$ref": "#/$defs/Nullable_string",
          "description": "Branch marker stored via `wt config state marker`; absent when none\nis set, null while the lookup is unresolved. The same string is the\nlast glyph in `display.symbols`."
        },
        "pr": {
          "$ref": "#/$defs/Nullable_JsonPr",
          "description": "Open PR/MR; absent when none exists (or CI wasn't collected), null\nwhen the forge fetch failed."
        },
        "remote": {
          "description": "Remote name for remote-only branch rows; absent on local rows.",
          "type": [
            "string",
            "null"
          ]
        },
        "summary": {
          "$ref": "#/$defs/Nullable_string",
          "description": "LLM-generated branch summary; absent when summaries are off or none\nwas produced, null while pending."
        },
        "upstream": {
          "$ref": "#/$defs/Nullable_JsonUpstream",
          "description": "Tracking-branch relation; absent when no upstream is configured,\nnull while unresolved."
        },
        "vars": {
          "additionalProperties": {
            "type": "string"
          },
          "description": "Custom variables stored via `wt config state vars`.",
          "type": "object"
        },
        "worktree": {
          "anyOf": [
            {
              "$ref": "#/$defs/JsonWorktreeV2"
            },
            {
              "type": "null"
            }
          ],
          "description": "Worktree facts; absent on branch-only rows."
        }
      },
      "required": [
        "branch",
        "head",
        "display"
      ],
      "type": "object"
    },
    "JsonMainState": {
      "description": "[`MainState`] wire values. `MainState::None` renders as no value at all,\nso it has no variant here — `display.state` is absent instead. The\n`Integrated` payload is dropped: the reason it carries is already reported\nas `default_branch.integration.reason`.",
      "enum": [
        "is_main",
        "would_conflict",
        "empty",
        "same_commit",
        "integrated",
        "orphan",
        "diverged",
        "ahead",
        "behind"
      ],
      "type": "string"
    },
    "JsonOperation": {
      "description": "[`InProgressOperation`] wire values. The domain enum's `strum` names are\nthe same strings, but going through an exhaustive match is what makes a\nsixth variant a compile error here instead of a value that appears in\npublished output with nothing to catch it.",
      "enum": [
        "merge",
        "rebase",
        "cherry_pick",
        "revert",
        "bisect"
      ],
      "type": "string"
    },
    "JsonPr": {
      "description": "Open PR/MR facts.",
      "properties": {
        "mergeable": {
          "description": "Whether the PR merges cleanly into its target: false when the forge\nreports conflicts, null otherwise (the fetch records only the\nconflicted case).",
          "type": [
            "boolean",
            "null"
          ]
        },
        "number": {
          "description": "Forge number; null when the forge reported none.",
          "format": "uint64",
          "minimum": 0,
          "type": [
            "integer",
            "null"
          ]
        },
        "repo": {
          "anyOf": [
            {
              "$ref": "#/$defs/GitRepoInfo"
            },
            {
              "type": "null"
            }
          ],
          "description": "The repository the PR/MR targets (the upstream for fork PRs);\nabsent when the URL doesn't parse."
        },
        "review": {
          "anyOf": [
            {
              "$ref": "#/$defs/ReviewState"
            },
            {
              "type": "null"
            }
          ],
          "description": "Review state; absent when the forge reports no review signal."
        },
        "url": {
          "description": "URL to the PR/MR page; null when the forge reported none.",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "number",
        "url",
        "mergeable"
      ],
      "type": "object"
    },
    "JsonReason": {
      "description": "Reason payload for `locked` / `prunable`.",
      "properties": {
        "reason": {
          "description": "Reason git records; null when none was given.",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "reason"
      ],
      "type": "object"
    },
    "JsonRepo": {
      "description": "Repo-wide facts.",
      "properties": {
        "default_branch": {
          "description": "The branch every `default_branch` object measures against; absent\nwhen detection failed.",
          "type": [
            "string",
            "null"
          ]
        },
        "forge": {
          "anyOf": [
            {
              "$ref": "#/$defs/GitRepoInfo"
            },
            {
              "type": "null"
            }
          ],
          "description": "Forge metadata derived from the primary remote; absent when no\nremote URL parses."
        }
      },
      "type": "object"
    },
    "JsonUpstream": {
      "description": "Tracking-branch relation.",
      "properties": {
        "ahead": {
          "description": "Commits ahead of the upstream.",
          "format": "uint",
          "minimum": 0,
          "type": "integer"
        },
        "behind": {
          "description": "Commits behind the upstream.",
          "format": "uint",
          "minimum": 0,
          "type": "integer"
        },
        "branch": {
          "description": "Branch name on the remote; null when only the remote is known.",
          "type": [
            "string",
            "null"
          ]
        },
        "remote": {
          "description": "Remote name.",
          "type": "string"
        }
      },
      "required": [
        "remote",
        "branch",
        "ahead",
        "behind"
      ],
      "type": "object"
    },
    "JsonWorktreeV2": {
      "description": "Worktree facts. Location attributes (`locked`, `prunable`,\n`branch_mismatch`, `duplicate_branch`) are independent fields — unlike\nschema 1's single `state`, they can co-occur.",
      "properties": {
        "branch_mismatch": {
          "description": "The checked-out branch doesn't match the branch this worktree was\ncreated for.",
          "type": "boolean"
        },
        "changes": {
          "anyOf": [
            {
              "$ref": "#/$defs/JsonChanges"
            },
            {
              "type": "null"
            }
          ],
          "description": "Working-tree state; null while unresolved."
        },
        "current": {
          "description": "This is the worktree the command ran from.",
          "type": "boolean"
        },
        "detached": {
          "description": "HEAD is detached.",
          "type": "boolean"
        },
        "duplicate_branch": {
          "description": "Another worktree has the same branch checked out.",
          "type": "boolean"
        },
        "locked": {
          "anyOf": [
            {
              "$ref": "#/$defs/JsonReason"
            },
            {
              "type": "null"
            }
          ],
          "description": "Present when the worktree is locked."
        },
        "main": {
          "description": "This is the primary worktree.",
          "type": "boolean"
        },
        "modified_at": {
          "$ref": "#/$defs/Nullable_string",
          "description": "Later of HEAD committer time and changed-file mtimes, RFC 3339 UTC; null when unresolved."
        },
        "operation": {
          "$ref": "#/$defs/Nullable_JsonOperation",
          "description": "In-progress operation; absent when none, null while unresolved."
        },
        "path": {
          "description": "Filesystem path.",
          "type": "string"
        },
        "previous": {
          "description": "This was the previous worktree (`wt switch -`).",
          "type": "boolean"
        },
        "prunable": {
          "anyOf": [
            {
              "$ref": "#/$defs/JsonReason"
            },
            {
              "type": "null"
            }
          ],
          "description": "Present when git considers the worktree prunable."
        }
      },
      "required": [
        "path",
        "main",
        "current",
        "previous",
        "detached",
        "branch_mismatch",
        "duplicate_branch",
        "changes"
      ],
      "type": "object"
    },
    "Nullable_JsonChecks": {
      "anyOf": [
        {
          "$ref": "#/$defs/JsonChecks"
        },
        {
          "type": "null"
        }
      ]
    },
    "Nullable_JsonDefaultBranch": {
      "anyOf": [
        {
          "$ref": "#/$defs/JsonDefaultBranch"
        },
        {
          "type": "null"
        }
      ]
    },
    "Nullable_JsonIntegration": {
      "anyOf": [
        {
          "$ref": "#/$defs/JsonIntegration"
        },
        {
          "type": "null"
        }
      ]
    },
    "Nullable_JsonOperation": {
      "anyOf": [
        {
          "$ref": "#/$defs/JsonOperation"
        },
        {
          "type": "null"
        }
      ]
    },
    "Nullable_JsonPr": {
      "anyOf": [
        {
          "$ref": "#/$defs/JsonPr"
        },
        {
          "type": "null"
        }
      ]
    },
    "Nullable_JsonUpstream": {
      "anyOf": [
        {
          "$ref": "#/$defs/JsonUpstream"
        },
        {
          "type": "null"
        }
      ]
    },
    "Nullable_string": {
      "type": [
        "string",
        "null"
      ]
    },
    "ReviewState": {
      "description": "Review state of a PR/MR.\n\nThe vocabulary matches Claude Code's statusline `pr.review_state` field so\nthe two surfaces never disagree on names. A PR with no review signal at all\n(e.g. GitHub's `reviewDecision` is empty on repos without required\nreviewers and no reviews) carries `None` on [`PrStatus`], not `Pending`,\nso unreviewed branches keep their plain CI colors.",
      "oneOf": [
        {
          "enum": [
            "approved",
            "changes_requested",
            "draft"
          ],
          "type": "string"
        },
        {
          "const": "pending",
          "description": "Review is required before merge (e.g. branch protection) but not given yet",
          "type": "string"
        }
      ]
    }
  },
  "$id": "https://worktrunk.dev/schema/list-v2.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "description": "Root envelope.",
  "properties": {
    "collected": {
      "$ref": "#/$defs/Collected",
      "description": "Which gated fact families this run requested."
    },
    "items": {
      "description": "One entry per row, in table order.",
      "items": {
        "$ref": "#/$defs/JsonItemV2"
      },
      "type": "array"
    },
    "repo": {
      "$ref": "#/$defs/JsonRepo",
      "description": "Repo-wide facts, hoisted out of the items."
    },
    "schema": {
      "description": "Output schema version. The unversioned bare-array format is 1.",
      "format": "uint32",
      "minimum": 0,
      "type": "integer"
    }
  },
  "required": [
    "schema",
    "repo",
    "collected",
    "items"
  ],
  "title": "wt list --format=json (schema 2)",
  "type": "object"
}

---

### Public Schema Project Config.Json (`docs/public/schema/project-config.json`)

{
  "$defs": {
    "CommandConfig": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "additionalProperties": {
            "type": "string"
          },
          "type": "object"
        },
        {
          "items": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "additionalProperties": {
                  "type": "string"
                },
                "type": "object"
              }
            ]
          },
          "type": "array"
        }
      ]
    },
    "CopyIgnoredConfig": {
      "additionalProperties": false,
      "description": "Configuration for `wt step copy-ignored`",
      "properties": {
        "exclude": {
          "description": "Gitignore-style patterns to exclude from `wt step copy-ignored`.",
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "type": "object"
    },
    "ProjectCiConfig": {
      "additionalProperties": false,
      "description": "Project-level CI configuration.\n\nNames the CI platform explicitly, for repos where URL-based detection can't\ndetermine it (e.g., GitHub Enterprise or self-hosted GitLab with custom\ndomains).\n\n# Example\n\n```toml\n[ci]\nplatform = \"github\"  # or \"gitlab\"\n```",
      "properties": {
        "platform": {
          "default": null,
          "description": "CI platform. When unset, the platform is detected from the remote URL.\n\nDeprecated alias for `[forge].platform`; same accepted values\n(\"github\", \"gitlab\", \"gitea\", \"azure-devops\").",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "type": "object"
    },
    "ProjectCommitConfig": {
      "additionalProperties": false,
      "description": "Project-level commit message configuration.\n\nOnly fields appropriate as shared, checked-in settings live here. The LLM\ncommand and full prompt template stay in user/system config — they\ndescribe per-developer environment (which CLI is installed, which agent\nthey prefer).",
      "properties": {
        "generation": {
          "anyOf": [
            {
              "$ref": "#/$defs/ProjectCommitGenerationConfig"
            },
            {
              "type": "null"
            }
          ],
          "description": "Commit message generation settings shared across the team."
        }
      },
      "type": "object"
    },
    "ProjectCommitGenerationConfig": {
      "additionalProperties": false,
      "description": "Project-level commit message generation settings.",
      "properties": {
        "template-append": {
          "default": null,
          "description": "Text appended to the commit and squash prompts inside a\n`<project-guidance>` block.\n\nRendered with the same minijinja context as the main commit/squash\ntemplate (`{{ branch }}`, `{{ git_diff }}`, etc.), so it can\nreference template variables directly. Use this for project-wide\ncommit conventions (e.g. \"use conventional commits\", \"reference\nissue numbers\"). The user config has a `[commit.generation]\ntemplate-append` of its own; it renders into a separate\n`<user-guidance>` block immediately before this one. The first time\nthe rendered text would reach the LLM, worktrunk prompts the user to\napprove the raw fragment — the same gate as project-defined commands.",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "type": "object"
    },
    "ProjectForgeConfig": {
      "additionalProperties": false,
      "description": "Project-level forge configuration.\n\nNames the forge explicitly, for a remote whose hostname doesn't name its\nforge (a Forgejo instance at `forge.example.com`, a company git server).\n\n# Example\n\n```toml\n[forge]\nplatform = \"github\"              # or \"gitlab\", \"gitea\" (experimental), \"azure-devops\" (experimental)\nhostname = \"github.example.com\"  # API hostname for GHE / self-hosted GitLab\n```",
      "properties": {
        "hostname": {
          "default": null,
          "description": "API hostname for GitHub Enterprise or self-hosted GitLab.\n\nOnly needed when the remote URL uses an SSH host alias that doesn't\nresolve to the real API hostname. For standard github.com/gitlab.com\nsetups, this is not needed.",
          "type": [
            "string",
            "null"
          ]
        },
        "platform": {
          "default": null,
          "description": "Forge platform. When unset, the platform is detected from the remote URL.\n\nValues: \"github\", \"gitlab\", \"gitea\" (experimental), or \"azure-devops\"\n(experimental). Both the `wt switch pr:` shortcut and `wt list --full`\nCI status detection use `forge.platform` to pick the forge CLI (`gh`,\n`glab`, `tea`, or `az`).",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "type": "object"
    },
    "ProjectListConfig": {
      "additionalProperties": false,
      "description": "Project-level configuration for `wt list` output.\n\nThis is distinct from user-level `ListConfig` which controls CLI defaults.\nProject-level config is for project-specific features like dev server URLs.\n\n# Example\n\n```toml\n[list]\nurl = \"http://localhost:{{ branch | hash_port }}\"\n```",
      "properties": {
        "url": {
          "default": null,
          "description": "URL template for dev server links shown in `wt list`.\n\nAvailable variable: `{{ branch }}` (the branch name).\nAvailable filters: `{{ branch | hash_port }}` (deterministic port 10000-19999),\n`{{ branch | sanitize }}` (filesystem-safe name).\n\nThe URL is displayed with health-check styling: dim if the port is not\nlistening, normal if it is.",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "type": "object"
    },
    "StepConfig": {
      "additionalProperties": false,
      "description": "Configuration for `wt step` subcommands.",
      "properties": {
        "copy-ignored": {
          "anyOf": [
            {
              "$ref": "#/$defs/CopyIgnoredConfig"
            },
            {
              "type": "null"
            }
          ],
          "description": "Configuration for `wt step copy-ignored`."
        }
      },
      "type": "object"
    }
  },
  "$id": "https://worktrunk.dev/schema/project-config.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "description": "Schema for .config/wt.toml.",
  "properties": {
    "aliases": {
      "additionalProperties": {
        "$ref": "#/$defs/CommandConfig"
      },
      "description": "Command aliases for `wt <name>`.\n\nEach alias is a string for a single command, a named table\n(`[aliases.NAME]`) for concurrent commands, or `[[aliases.NAME]]`\nblocks for sequential pipeline steps. All hook\ntemplate variables are available (e.g., `{{ branch }}`,\n`{{ worktree_path }}`).\n\n```toml\n[aliases]\ndeploy = \"cd {{ worktree_path }} && make deploy\"\nlint = \"npm run lint\"\n```",
      "type": "object"
    },
    "ci": {
      "$ref": "#/$defs/ProjectCiConfig",
      "description": "CI configuration (platform). Deprecated: use `[forge]` instead."
    },
    "commit": {
      "$ref": "#/$defs/ProjectCommitConfig",
      "description": "Project-wide commit message settings (shared across teammates)"
    },
    "forge": {
      "$ref": "#/$defs/ProjectForgeConfig",
      "description": "Forge configuration (platform, API hostname)"
    },
    "list": {
      "$ref": "#/$defs/ProjectListConfig",
      "description": "Configuration for `wt list` output"
    },
    "post-commit": {
      "anyOf": [
        {
          "$ref": "#/$defs/CommandConfig"
        },
        {
          "type": "null"
        }
      ],
      "description": "Commands to execute after committing (background)"
    },
    "post-merge": {
      "anyOf": [
        {
          "$ref": "#/$defs/CommandConfig"
        },
        {
          "type": "null"
        }
      ],
      "description": "Commands to execute after successful merge (background)"
    },
    "post-remove": {
      "anyOf": [
        {
          "$ref": "#/$defs/CommandConfig"
        },
        {
          "type": "null"
        }
      ],
      "description": "Commands to execute after worktree removal (background)"
    },
    "post-start": {
      "anyOf": [
        {
          "$ref": "#/$defs/CommandConfig"
        },
        {
          "type": "null"
        }
      ],
      "description": "Commands to execute after worktree creation (background)"
    },
    "post-switch": {
      "anyOf": [
        {
          "$ref": "#/$defs/CommandConfig"
        },
        {
          "type": "null"
        }
      ],
      "description": "Commands to execute after switching to a worktree (background)"
    },
    "pre-commit": {
      "anyOf": [
        {
          "$ref": "#/$defs/CommandConfig"
        },
        {
          "type": "null"
        }
      ],
      "description": "Commands to execute before any Worktrunk commit (blocking, fail-fast)"
    },
    "pre-merge": {
      "anyOf": [
        {
          "$ref": "#/$defs/CommandConfig"
        },
        {
          "type": "null"
        }
      ],
      "description": "Commands to execute before merging (blocking, fail-fast)"
    },
    "pre-remove": {
      "anyOf": [
        {
          "$ref": "#/$defs/CommandConfig"
        },
        {
          "type": "null"
        }
      ],
      "description": "Commands to execute before worktree removal (blocking, fail-fast)"
    },
    "pre-start": {
      "anyOf": [
        {
          "$ref": "#/$defs/CommandConfig"
        },
        {
          "type": "null"
        }
      ],
      "description": "Commands to execute after worktree creation (blocking, fail-fast)"
    },
    "pre-switch": {
      "anyOf": [
        {
          "$ref": "#/$defs/CommandConfig"
        },
        {
          "type": "null"
        }
      ],
      "description": "Commands to execute before switch begins (blocking, fail-fast)"
    },
    "step": {
      "$ref": "#/$defs/StepConfig",
      "description": "Configuration for `wt step` subcommands."
    }
  },
  "title": "Worktrunk project config",
  "type": "object"
}

---

### Public Schema User Config.Json (`docs/public/schema/user-config.json`)

{
  "$defs": {
    "CommandConfig": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "additionalProperties": {
            "type": "string"
          },
          "type": "object"
        },
        {
          "items": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "additionalProperties": {
                  "type": "string"
                },
                "type": "object"
              }
            ]
          },
          "type": "array"
        }
      ]
    },
    "CommitConfig": {
      "additionalProperties": false,
      "description": "Configuration for the `wt step commit` command\n\nAlso used by `wt merge` for shared settings like `stage`.",
      "properties": {
        "generation": {
          "anyOf": [
            {
              "$ref": "#/$defs/CommitGenerationConfig"
            },
            {
              "type": "null"
            }
          ],
          "description": "LLM commit message generation settings\n\nNested under `[commit.generation]` in TOML."
        },
        "stage": {
          "anyOf": [
            {
              "$ref": "#/$defs/StageMode"
            },
            {
              "type": "null"
            }
          ],
          "description": "What to stage before committing (default: all)\nValues: \"all\", \"tracked\", \"none\""
        }
      },
      "type": "object"
    },
    "CommitGenerationConfig": {
      "additionalProperties": false,
      "description": "Configuration for commit message generation\n\nThe command is a shell string executed via `sh -c`. Environment variables\ncan be set inline (e.g., `MAX_THINKING_TOKENS=0 claude -p ...`).",
      "properties": {
        "command": {
          "default": null,
          "description": "Shell command to invoke for generating commit messages\n\nExample: `\"MAX_THINKING_TOKENS=0 claude -p --no-session-persistence --model=haiku\"`\n\nThe command receives the prompt via stdin and should output the commit message.",
          "type": [
            "string",
            "null"
          ]
        },
        "squash-template": {
          "default": null,
          "description": "Inline template for squash commit message prompt\nAvailable variables: {{ commit_details }}, {{ target_branch }}, {{ branch }}, {{ repo }}",
          "type": [
            "string",
            "null"
          ]
        },
        "template": {
          "default": null,
          "description": "Inline template for commit message prompt\nAvailable variables: {{ git_diff }}, {{ branch }}, {{ recent_commits }}, {{ repo }}",
          "type": [
            "string",
            "null"
          ]
        },
        "template-append": {
          "default": null,
          "description": "Inline text appended to the commit and squash prompts inside a\n`<user-guidance>` block, after the main template's `<style>`\nsection. Rendered as a minijinja template with the same variables\n(`{{ branch }}`, `{{ git_diff }}`, etc.). Unlike `template`, this\n*adds to* the default prompt instead of replacing it — use it for\npersonal commit-message preferences without restating the whole\ntemplate. The project config has a `[commit.generation]\ntemplate-append` of its own; it renders into a separate\n`<project-guidance>` block right after this one.",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "type": "object"
    },
    "CopyIgnoredConfig": {
      "additionalProperties": false,
      "description": "Configuration for `wt step copy-ignored`",
      "properties": {
        "exclude": {
          "description": "Gitignore-style patterns to exclude from `wt step copy-ignored`.",
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "type": "object"
    },
    "ListColumnConfig": {
      "additionalProperties": false,
      "description": "A custom column in the `wt list` table, keyed by its header text.\n\nThe value is a minijinja template rendered per row with `{{ branch }}`,\n`{{ worktree_path }}`, `{{ worktree_name }}` (empty for branch-only rows),\nand `{{ vars.* }}` (per-branch state from `wt config state vars set`).\nRows where the template renders empty show an empty cell; a column that is\nempty for every row is dropped from the table.\n\n*(Experimental — fields may change in future releases.)*\n\n```toml\n[list.custom-columns.Ticket]\ntemplate = \"{{ vars.ticket }}\"\n```",
      "properties": {
        "priority": {
          "description": "Drop order when the terminal narrows; lower = kept longer (default: 9,\nalongside the URL column; built-in columns range 0-13)",
          "format": "uint8",
          "maximum": 255,
          "minimum": 0,
          "type": [
            "integer",
            "null"
          ]
        },
        "template": {
          "description": "Template rendered per row; the result is the cell text",
          "type": "string"
        },
        "width": {
          "description": "Maximum display width; longer values truncate (default: 40).\nValues below the header's width are raised to it — a column is never\nnarrower than its header.",
          "format": "uint",
          "minimum": 0,
          "type": [
            "integer",
            "null"
          ]
        }
      },
      "required": [
        "template"
      ],
      "type": "object"
    },
    "ListConfig": {
      "additionalProperties": false,
      "description": "Configuration for the `wt list` command",
      "properties": {
        "branches": {
          "description": "Include branches without worktrees by default",
          "type": [
            "boolean",
            "null"
          ]
        },
        "columns": {
          "description": "Columns to render, in order. When non-empty this is exhaustive — only\nthese columns appear (a subset and/or reorder); empty means the default\nset. Built-ins are kebab identifiers (`branch`, `status`, `working-diff`,\n`ahead-behind`, `branch-diff`, `summary`, `upstream`, `ci`, `path`,\n`url`, `commit`, `age`, `message`); custom columns are named by their\n`[list.custom-columns]` header, so a selection mixes both in one list. A\nbuilt-in wins over a custom header that collides with its name. The\ngutter type indicator always shows. A custom column omitted from a\nnon-empty selection is hidden; with no selection, custom columns append\nto the default set. Set as a TOML array in config files.",
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "custom-columns": {
          "additionalProperties": {
            "$ref": "#/$defs/ListColumnConfig"
          },
          "description": "Custom columns, keyed by header text.\n\n*(Experimental — fields may change in future releases.)*",
          "type": "object"
        },
        "full": {
          "description": "Show CI status and LLM summaries by default (`--full`)",
          "type": [
            "boolean",
            "null"
          ]
        },
        "json-schema": {
          "description": "JSON output schema for `wt list --format=json` (1 or 2).\nSchema 2 wraps items in an envelope of per-item facts (see the\n`wt list` JSON docs) and is the default.",
          "format": "uint8",
          "maximum": 255,
          "minimum": 0,
          "type": [
            "integer",
            "null"
          ]
        },
        "remotes": {
          "description": "Include remote branches by default",
          "type": [
            "boolean",
            "null"
          ]
        },
        "summary": {
          "description": "Enable LLM-generated branch summaries (picker tab 6 + list Summary column).\nRequires `[commit.generation] command` to be configured.",
          "type": [
            "boolean",
            "null"
          ]
        },
        "timeout-ms": {
          "description": "Wall-clock budget for the entire collect phase in milliseconds.\nTasks that complete within the budget contribute data; tasks still\nrunning when it expires are abandoned silently. Set to 0 to disable.\nDisabled when --full is used. Default: no budget (wait for all results).",
          "format": "uint64",
          "minimum": 0,
          "type": [
            "integer",
            "null"
          ]
        }
      },
      "type": "object"
    },
    "MergeConfig": {
      "additionalProperties": false,
      "description": "Configuration for the `wt merge` command\n\nNote: `stage` defaults from `[commit]` section, not here.",
      "properties": {
        "commit": {
          "description": "Commit, squash, and rebase during merge (default: true)",
          "type": [
            "boolean",
            "null"
          ]
        },
        "ff": {
          "description": "Fast-forward merge instead of creating a merge commit (default: true)",
          "type": [
            "boolean",
            "null"
          ]
        },
        "rebase": {
          "description": "Rebase onto target branch before merging (default: true)\n\nWhen false, merge fails if branch is not already rebased.",
          "type": [
            "boolean",
            "null"
          ]
        },
        "remove": {
          "description": "Remove worktree after merge (default: true)",
          "type": [
            "boolean",
            "null"
          ]
        },
        "squash": {
          "description": "Squash commits when merging (default: true)",
          "type": [
            "boolean",
            "null"
          ]
        },
        "verify": {
          "description": "Run user and project hooks (default: true)",
          "type": [
            "boolean",
            "null"
          ]
        }
      },
      "type": "object"
    },
    "ProjectForgeConfig": {
      "additionalProperties": false,
      "description": "Project-level forge configuration.\n\nNames the forge explicitly, for a remote whose hostname doesn't name its\nforge (a Forgejo instance at `forge.example.com`, a company git server).\n\n# Example\n\n```toml\n[forge]\nplatform = \"github\"              # or \"gitlab\", \"gitea\" (experimental), \"azure-devops\" (experimental)\nhostname = \"github.example.com\"  # API hostname for GHE / self-hosted GitLab\n```",
      "properties": {
        "hostname": {
          "default": null,
          "description": "API hostname for GitHub Enterprise or self-hosted GitLab.\n\nOnly needed when the remote URL uses an SSH host alias that doesn't\nresolve to the real API hostname. For standard github.com/gitlab.com\nsetups, this is not needed.",
          "type": [
            "string",
            "null"
          ]
        },
        "platform": {
          "default": null,
          "description": "Forge platform. When unset, the platform is detected from the remote URL.\n\nValues: \"github\", \"gitlab\", \"gitea\" (experimental), or \"azure-devops\"\n(experimental). Both the `wt switch pr:` shortcut and `wt list --full`\nCI status detection use `forge.platform` to pick the forge CLI (`gh`,\n`glab`, `tea`, or `az`).",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "type": "object"
    },
    "RemoveConfig": {
      "additionalProperties": false,
      "description": "Configuration for the `wt remove` command",
      "properties": {
        "delete-branch": {
          "description": "Delete the branch after removing the worktree (default: true)",
          "type": [
            "boolean",
            "null"
          ]
        }
      },
      "type": "object"
    },
    "StageMode": {
      "description": "What to stage before committing",
      "oneOf": [
        {
          "const": "all",
          "description": "Stage everything: untracked files + unstaged tracked changes",
          "type": "string"
        },
        {
          "const": "tracked",
          "description": "Stage tracked changes only (like `git add -u`)",
          "type": "string"
        },
        {
          "const": "none",
          "description": "Stage nothing, commit only what's already in the index",
          "type": "string"
        }
      ]
    },
    "StepConfig": {
      "additionalProperties": false,
      "description": "Configuration for `wt step` subcommands.",
      "properties": {
        "copy-ignored": {
          "anyOf": [
            {
              "$ref": "#/$defs/CopyIgnoredConfig"
            },
            {
              "type": "null"
            }
          ],
          "description": "Configuration for `wt step copy-ignored`."
        }
      },
      "type": "object"
    },
    "SwitchConfig": {
      "additionalProperties": false,
      "description": "Configuration for the `wt switch` command",
      "properties": {
        "cd": {
          "description": "Change directory after switch (default: true)",
          "type": [
            "boolean",
            "null"
          ]
        },
        "picker": {
          "anyOf": [
            {
              "$ref": "#/$defs/SwitchPickerConfig"
            },
            {
              "type": "null"
            }
          ],
          "description": "Picker settings for the interactive selector"
        }
      },
      "type": "object"
    },
    "SwitchPickerConfig": {
      "additionalProperties": false,
      "description": "Configuration for the `wt switch` interactive picker.\n\nNew format under `[switch.picker]`. Replaces the deprecated `[select]` section.",
      "properties": {
        "pager": {
          "description": "Pager command with flags for diff preview\n\nOverrides git's core.pager for the interactive picker's preview panel.\nUse this to specify pager flags needed for non-TTY contexts.\n\nExample: `pager = \"delta --paging=never\"`",
          "type": [
            "string",
            "null"
          ]
        },
        "preview": {
          "description": "Show the preview panel when the picker opens (default: true)\n\nWith `preview = false` the picker opens list-only; `Alt-p` still\ntoggles the preview.",
          "type": [
            "boolean",
            "null"
          ]
        }
      },
      "type": "object"
    },
    "UserProjectOverrides": {
      "additionalProperties": false,
      "description": "Per-project overrides in the user's config file\n\nStored under `[projects.\"project-id\"]` in the user's config.\nThese are user preferences (not checked into git) that override\nthe corresponding global settings when set.\n\nThe key is a project identifier (`host/owner/repo`) or a `*` pattern\ncovering a set of them, so one entry can carry settings for every\nrepository on a host. Every matching entry applies, least- to\nmost-specific.\n\n# TOML Format\n```toml\n[projects.\"github.com/user/repo\"]\nworktree-path = \".worktrees/{{ branch | sanitize }}\"\n\n[projects.\"github.com/user/repo\".commit.generation]\ncommand = \"opencode run -m anthropic/claude-haiku-5-5 --variant fast\"\n\n[projects.\"github.com/user/repo\".list]\nfull = true\n\n[projects.\"github.com/user/repo\".merge]\nsquash = false\n\n# Every repository on a self-hosted forge whose name carries no brand\n[projects.\"git.company.example/*\"]\nforge.platform = \"gitlab\"\n```",
      "properties": {
        "aliases": {
          "additionalProperties": {
            "$ref": "#/$defs/CommandConfig"
          },
          "type": "object"
        },
        "approved-commands": {
          "description": "Deprecated: approvals live in `approvals.toml`; `wt config update` moves them there.",
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "commit": {
          "$ref": "#/$defs/CommitConfig"
        },
        "forge": {
          "$ref": "#/$defs/ProjectForgeConfig",
          "description": "Forge platform and API hostname for the matched repositories.\n\nSame shape as the repository's own `[forge]` block, which wins field by\nfield where both are set. Both fields describe the host rather than the\nrepository, so a `*` pattern keyed to a hostname is the usual way to\nwrite them."
        },
        "list": {
          "$ref": "#/$defs/ListConfig"
        },
        "merge": {
          "$ref": "#/$defs/MergeConfig"
        },
        "post-commit": {
          "anyOf": [
            {
              "$ref": "#/$defs/CommandConfig"
            },
            {
              "type": "null"
            }
          ],
          "description": "Commands to execute after committing (background)"
        },
        "post-merge": {
          "anyOf": [
            {
              "$ref": "#/$defs/CommandConfig"
            },
            {
              "type": "null"
            }
          ],
          "description": "Commands to execute after successful merge (background)"
        },
        "post-remove": {
          "anyOf": [
            {
              "$ref": "#/$defs/CommandConfig"
            },
            {
              "type": "null"
            }
          ],
          "description": "Commands to execute after worktree removal (background)"
        },
        "post-start": {
          "anyOf": [
            {
              "$ref": "#/$defs/CommandConfig"
            },
            {
              "type": "null"
            }
          ],
          "description": "Commands to execute after worktree creation (background)"
        },
        "post-switch": {
          "anyOf": [
            {
              "$ref": "#/$defs/CommandConfig"
            },
            {
              "type": "null"
            }
          ],
          "description": "Commands to execute after switching to a worktree (background)"
        },
        "pre-commit": {
          "anyOf": [
            {
              "$ref": "#/$defs/CommandConfig"
            },
            {
              "type": "null"
            }
          ],
          "description": "Commands to execute before any Worktrunk commit (blocking, fail-fast)"
        },
        "pre-merge": {
          "anyOf": [
            {
              "$ref": "#/$defs/CommandConfig"
            },
            {
              "type": "null"
            }
          ],
          "description": "Commands to execute before merging (blocking, fail-fast)"
        },
        "pre-remove": {
          "anyOf": [
            {
              "$ref": "#/$defs/CommandConfig"
            },
            {
              "type": "null"
            }
          ],
          "description": "Commands to execute before worktree removal (blocking, fail-fast)"
        },
        "pre-start": {
          "anyOf": [
            {
              "$ref": "#/$defs/CommandConfig"
            },
            {
              "type": "null"
            }
          ],
          "description": "Commands to execute after worktree creation (blocking, fail-fast)"
        },
        "pre-switch": {
          "anyOf": [
            {
              "$ref": "#/$defs/CommandConfig"
            },
            {
              "type": "null"
            }
          ],
          "description": "Commands to execute before switch begins (blocking, fail-fast)"
        },
        "remove": {
          "$ref": "#/$defs/RemoveConfig"
        },
        "step": {
          "$ref": "#/$defs/StepConfig"
        },
        "switch": {
          "$ref": "#/$defs/SwitchConfig"
        },
        "worktree-path": {
          "description": "Per-project worktree path template override",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "type": "object"
    }
  },
  "$id": "https://worktrunk.dev/schema/user-config.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "description": "Schema for ~/.config/worktrunk/config.toml.",
  "properties": {
    "aliases": {
      "additionalProperties": {
        "$ref": "#/$defs/CommandConfig"
      },
      "description": "Command aliases for `wt <name>`",
      "type": "object"
    },
    "commit": {
      "$ref": "#/$defs/CommitConfig",
      "description": "Configuration for the `wt step commit` command (also used by merge)"
    },
    "list": {
      "$ref": "#/$defs/ListConfig",
      "description": "Configuration for the `wt list` command"
    },
    "merge": {
      "$ref": "#/$defs/MergeConfig",
      "description": "Configuration for the `wt merge` command"
    },
    "post-commit": {
      "anyOf": [
        {
          "$ref": "#/$defs/CommandConfig"
        },
        {
          "type": "null"
        }
      ],
      "description": "Commands to execute after committing (background)"
    },
    "post-merge": {
      "anyOf": [
        {
          "$ref": "#/$defs/CommandConfig"
        },
        {
          "type": "null"
        }
      ],
      "description": "Commands to execute after successful merge (background)"
    },
    "post-remove": {
      "anyOf": [
        {
          "$ref": "#/$defs/CommandConfig"
        },
        {
          "type": "null"
        }
      ],
      "description": "Commands to execute after worktree removal (background)"
    },
    "post-start": {
      "anyOf": [
        {
          "$ref": "#/$defs/CommandConfig"
        },
        {
          "type": "null"
        }
      ],
      "description": "Commands to execute after worktree creation (background)"
    },
    "post-switch": {
      "anyOf": [
        {
          "$ref": "#/$defs/CommandConfig"
        },
        {
          "type": "null"
        }
      ],
      "description": "Commands to execute after switching to a worktree (background)"
    },
    "pre-commit": {
      "anyOf": [
        {
          "$ref": "#/$defs/CommandConfig"
        },
        {
          "type": "null"
        }
      ],
      "description": "Commands to execute before any Worktrunk commit (blocking, fail-fast)"
    },
    "pre-merge": {
      "anyOf": [
        {
          "$ref": "#/$defs/CommandConfig"
        },
        {
          "type": "null"
        }
      ],
      "description": "Commands to execute before merging (blocking, fail-fast)"
    },
    "pre-remove": {
      "anyOf": [
        {
          "$ref": "#/$defs/CommandConfig"
        },
        {
          "type": "null"
        }
      ],
      "description": "Commands to execute before worktree removal (blocking, fail-fast)"
    },
    "pre-start": {
      "anyOf": [
        {
          "$ref": "#/$defs/CommandConfig"
        },
        {
          "type": "null"
        }
      ],
      "description": "Commands to execute after worktree creation (blocking, fail-fast)"
    },
    "pre-switch": {
      "anyOf": [
        {
          "$ref": "#/$defs/CommandConfig"
        },
        {
          "type": "null"
        }
      ],
      "description": "Commands to execute before switch begins (blocking, fail-fast)"
    },
    "projects": {
      "additionalProperties": {
        "$ref": "#/$defs/UserProjectOverrides"
      },
      "default": {},
      "description": "Per-project overrides, keyed by project identifier (`host/owner/repo`) or a `*` pattern.",
      "type": "object"
    },
    "remove": {
      "$ref": "#/$defs/RemoveConfig",
      "description": "Configuration for the `wt remove` command"
    },
    "skip-commit-generation-prompt": {
      "description": "Skip the first-run commit generation prompt",
      "type": "boolean"
    },
    "skip-shell-integration-prompt": {
      "description": "Skip the first-run shell integration prompt",
      "type": "boolean"
    },
    "step": {
      "$ref": "#/$defs/StepConfig",
      "description": "Configuration for `wt step` subcommands"
    },
    "switch": {
      "$ref": "#/$defs/SwitchConfig",
      "description": "Configuration for the `wt switch` command"
    },
    "worktree-path": {
      "description": "Worktree path template",
      "type": [
        "string",
        "null"
      ]
    }
  },
  "title": "Worktrunk user config",
  "type": "object"
}

---

### Src Generated Terminal Styles.Json (`docs/src/generated/terminal-styles.json`)

[
  {
    "lines": [
      [
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "Branch"
        },
        {
          "classes": [],
          "text": "        "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "Status"
        },
        {
          "classes": [],
          "text": "       "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "@±"
        },
        {
          "classes": [],
          "text": "        "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "^↕"
        },
        {
          "classes": [],
          "text": "        "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "^…±"
        },
        {
          "classes": [],
          "text": "     "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "Remote⇅"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "Commit"
        },
        {
          "classes": [],
          "text": "    "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "Age"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "Message"
        }
      ],
      [
        {
          "classes": [],
          "text": "@ feature-auth  "
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": "+"
        },
        {
          "classes": [],
          "text": "   "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "↑"
        },
        {
          "classes": [],
          "text": "      "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "+27"
        },
        {
          "classes": [],
          "text": "   "
        },
        {
          "classes": [
            "wt-terminal-red"
          ],
          "text": "-8"
        },
        {
          "classes": [],
          "text": "   "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "↑1"
        },
        {
          "classes": [],
          "text": "       "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "+31"
        },
        {
          "classes": [],
          "text": "                "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "4bc72dc"
        },
        {
          "classes": [],
          "text": "    "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "2h"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "Add authenticatio…"
        }
      ],
      [
        {
          "classes": [],
          "text": "^ main              "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "^⇡"
        },
        {
          "classes": [],
          "text": "                                    "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "⇡1"
        },
        {
          "classes": [],
          "text": "      "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "0e631ad"
        },
        {
          "classes": [],
          "text": "    "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "1d"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "Initial commit"
        }
      ],
      [],
      [
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "○"
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "Showing 2 worktrees, 1 with changes, 1 ahead, hidden: Path  (+ staged files  ↑ ahead of default)"
        }
      ]
    ],
    "plain": "  Branch        Status       @±        ^↕        ^…±     Remote⇅  Commit    Age  Message\n@ feature-auth  +   ↑      +27   -8   ↑1       +31                4bc72dc    2h  Add authenticatio…\n^ main              ^⇡                                    ⇡1      0e631ad    1d  Initial commit\n\n○ Showing 2 worktrees, 1 with changes, 1 ahead, hidden: Path  (+ staged files  ↑ ahead of default)"
  },
  {
    "lines": [
      [
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "Branch"
        },
        {
          "classes": [],
          "text": "       "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "Status"
        },
        {
          "classes": [],
          "text": "       "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "@±"
        },
        {
          "classes": [],
          "text": "        "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "^↕"
        },
        {
          "classes": [],
          "text": "        "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "^…±"
        },
        {
          "classes": [],
          "text": "     "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "Remote⇅"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "Commit"
        },
        {
          "classes": [],
          "text": "    "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "Age"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "Message"
        }
      ],
      [
        {
          "classes": [],
          "text": "@ feature-api  "
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": "+"
        },
        {
          "classes": [],
          "text": "   "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "↕⇡"
        },
        {
          "classes": [],
          "text": "     "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "+54"
        },
        {
          "classes": [],
          "text": "   "
        },
        {
          "classes": [
            "wt-terminal-red"
          ],
          "text": "-5"
        },
        {
          "classes": [],
          "text": "   "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "↑4"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-red",
            "wt-terminal-dim"
          ],
          "text": "↓1"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "+234"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-red"
          ],
          "text": "-24"
        },
        {
          "classes": [],
          "text": "   "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "⇡3"
        },
        {
          "classes": [],
          "text": "      "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "6814f02"
        },
        {
          "classes": [],
          "text": "   "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "30m"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "Add API tests"
        }
      ],
      [
        {
          "classes": [],
          "text": "^ main             "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "^⇅"
        },
        {
          "classes": [],
          "text": "                                    "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "⇡1"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-red",
            "wt-terminal-dim"
          ],
          "text": "⇣1"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "41ee083"
        },
        {
          "classes": [],
          "text": "    "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "4d"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "Merge fix-auth: ha…"
        }
      ],
      [
        {
          "classes": [],
          "text": "+ fix-auth         "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "↕|"
        },
        {
          "classes": [],
          "text": "                "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "↑2"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-red",
            "wt-terminal-dim"
          ],
          "text": "↓1"
        },
        {
          "classes": [],
          "text": "   "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "+25"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-red"
          ],
          "text": "-11"
        },
        {
          "classes": [],
          "text": "     "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "|"
        },
        {
          "classes": [],
          "text": "     "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "b772e68"
        },
        {
          "classes": [],
          "text": "    "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "5h"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "Add secure token s…"
        }
      ],
      [
        {
          "classes": [],
          "text": "+ "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "fix-typos"
        },
        {
          "classes": [],
          "text": "        "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "_|"
        },
        {
          "classes": [],
          "text": "                                      "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "|"
        },
        {
          "classes": [],
          "text": "     "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "41ee083"
        },
        {
          "classes": [],
          "text": "    "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "4d"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "Merge fix-auth: ha…"
        }
      ],
      [],
      [
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "○"
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "Showing 4 worktrees, 1 with changes, 2 ahead, hidden: Path  (↕ diverged from default)"
        }
      ]
    ],
    "plain": "  Branch       Status       @±        ^↕        ^…±     Remote⇅  Commit    Age  Message\n@ feature-api  +   ↕⇡     +54   -5   ↑4  ↓1  +234  -24   ⇡3      6814f02   30m  Add API tests\n^ main             ^⇅                                    ⇡1  ⇣1  41ee083    4d  Merge fix-auth: ha…\n+ fix-auth         ↕|                ↑2  ↓1   +25  -11     |     b772e68    5h  Add secure token s…\n+ fix-typos        _|                                      |     41ee083    4d  Merge fix-auth: ha…\n\n○ Showing 4 worktrees, 1 with changes, 2 ahead, hidden: Path  (↕ diverged from default)"
  },
  {
    "lines": [
      [
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "Branch"
        },
        {
          "classes": [],
          "text": "       "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "Status"
        },
        {
          "classes": [],
          "text": "       "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "@±"
        },
        {
          "classes": [],
          "text": "        "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "^↕"
        },
        {
          "classes": [],
          "text": "        "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "^…±"
        },
        {
          "classes": [],
          "text": "     "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "Remote⇅"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "Commit"
        },
        {
          "classes": [],
          "text": "    "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "Age"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "Message"
        }
      ],
      [
        {
          "classes": [],
          "text": "@ main             "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "^⇡"
        },
        {
          "classes": [],
          "text": "                                    "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "⇡1"
        },
        {
          "classes": [],
          "text": "      "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "33323bc"
        },
        {
          "classes": [],
          "text": "    "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "1d"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "Initial commit"
        }
      ],
      [
        {
          "classes": [],
          "text": "+ feature-api      "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "↑"
        },
        {
          "classes": [],
          "text": " 🤖              "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "↑1"
        },
        {
          "classes": [],
          "text": "        "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "+1"
        },
        {
          "classes": [],
          "text": "                "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "70343f0"
        },
        {
          "classes": [],
          "text": "    "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "1d"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "Add REST API endpo…"
        }
      ],
      [
        {
          "classes": [],
          "text": "+ review-ui      "
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": "?"
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "↑"
        },
        {
          "classes": [],
          "text": " 💬    "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "+1"
        },
        {
          "classes": [],
          "text": "        "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "↑1"
        },
        {
          "classes": [],
          "text": "        "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "+1"
        },
        {
          "classes": [],
          "text": "                "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "a585d6e"
        },
        {
          "classes": [],
          "text": "    "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "1d"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "Add dashboard comp…"
        }
      ],
      [
        {
          "classes": [],
          "text": "+ wip-docs       "
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": "?"
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "–"
        },
        {
          "classes": [],
          "text": "       "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "+1"
        },
        {
          "classes": [],
          "text": "                                    "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "33323bc"
        },
        {
          "classes": [],
          "text": "    "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "1d"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "Initial commit"
        }
      ],
      [],
      [
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "○"
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "Showing 4 worktrees, 2 with changes, 2 ahead, hidden: Path  (^ main worktree  ⇡ ahead of remote)"
        }
      ]
    ],
    "plain": "  Branch       Status       @±        ^↕        ^…±     Remote⇅  Commit    Age  Message\n@ main             ^⇡                                    ⇡1      33323bc    1d  Initial commit\n+ feature-api      ↑ 🤖              ↑1        +1                70343f0    1d  Add REST API endpo…\n+ review-ui      ? ↑ 💬    +1        ↑1        +1                a585d6e    1d  Add dashboard comp…\n+ wip-docs       ? –       +1                                    33323bc    1d  Initial commit\n\n○ Showing 4 worktrees, 2 with changes, 2 ahead, hidden: Path  (^ main worktree  ⇡ ahead of remote)"
  },
  {
    "lines": [
      [
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "Branch"
        },
        {
          "classes": [],
          "text": "       "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "Status"
        },
        {
          "classes": [],
          "text": "       "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "@±"
        },
        {
          "classes": [],
          "text": "        "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "^↕"
        },
        {
          "classes": [],
          "text": "        "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "^…±"
        },
        {
          "classes": [],
          "text": "     "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "Remote⇅"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "URL"
        },
        {
          "classes": [],
          "text": "                     "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "Commit"
        }
      ],
      [
        {
          "classes": [],
          "text": "@ main           "
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": "?"
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "^⇅"
        },
        {
          "classes": [],
          "text": "      "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "+5"
        },
        {
          "classes": [],
          "text": "                            "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "⇡1"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-red",
            "wt-terminal-dim"
          ],
          "text": "⇣1"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "http://localhost:12107"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "41ee083"
        }
      ],
      [
        {
          "classes": [],
          "text": "+ feature-api  "
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": "+"
        },
        {
          "classes": [],
          "text": "   "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "↕⇡"
        },
        {
          "classes": [],
          "text": "     "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "+54"
        },
        {
          "classes": [],
          "text": "   "
        },
        {
          "classes": [
            "wt-terminal-red"
          ],
          "text": "-5"
        },
        {
          "classes": [],
          "text": "   "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "↑4"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-red",
            "wt-terminal-dim"
          ],
          "text": "↓1"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "+234"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-red"
          ],
          "text": "-24"
        },
        {
          "classes": [],
          "text": "   "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "⇡3"
        },
        {
          "classes": [],
          "text": "      "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "http://localhost:10703"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "6814f02"
        }
      ],
      [
        {
          "classes": [],
          "text": "+ fix-auth         "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "↕|"
        },
        {
          "classes": [],
          "text": "                "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "↑2"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-red",
            "wt-terminal-dim"
          ],
          "text": "↓1"
        },
        {
          "classes": [],
          "text": "   "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "+25"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-red"
          ],
          "text": "-11"
        },
        {
          "classes": [],
          "text": "     "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "|"
        },
        {
          "classes": [],
          "text": "     "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "http://localhost:16460"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "b772e68"
        }
      ],
      [
        {
          "classes": [],
          "text": "+ "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "fix-typos"
        },
        {
          "classes": [],
          "text": "        "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "_|"
        },
        {
          "classes": [],
          "text": "                                      "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "|"
        },
        {
          "classes": [],
          "text": "     "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "http://localhost:14301"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "41ee083"
        }
      ],
      [],
      [
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "○"
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "Showing 4 worktrees, 2 with changes, 2 ahead, hidden: Path, Age, Message  (? untracked files)"
        }
      ]
    ],
    "plain": "  Branch       Status       @±        ^↕        ^…±     Remote⇅  URL                     Commit\n@ main           ? ^⇅      +5                            ⇡1  ⇣1  http://localhost:12107  41ee083\n+ feature-api  +   ↕⇡     +54   -5   ↑4  ↓1  +234  -24   ⇡3      http://localhost:10703  6814f02\n+ fix-auth         ↕|                ↑2  ↓1   +25  -11     |     http://localhost:16460  b772e68\n+ fix-typos        _|                                      |     http://localhost:14301  41ee083\n\n○ Showing 4 worktrees, 2 with changes, 2 ahead, hidden: Path, Age, Message  (? untracked files)"
  },
  {
    "lines": [
      [
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "Branch"
        },
        {
          "classes": [],
          "text": "       "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "Status"
        },
        {
          "classes": [],
          "text": "       "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "@±"
        },
        {
          "classes": [],
          "text": "        "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "^↕"
        },
        {
          "classes": [],
          "text": "        "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "^…±"
        },
        {
          "classes": [],
          "text": "     "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "Summary"
        },
        {
          "classes": [],
          "text": "                       "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "Remote⇅"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "CI"
        }
      ],
      [
        {
          "classes": [],
          "text": "@ feature-api  "
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": "+"
        },
        {
          "classes": [],
          "text": "   "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "↕⇡"
        },
        {
          "classes": [],
          "text": "     "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "+54"
        },
        {
          "classes": [],
          "text": "   "
        },
        {
          "classes": [
            "wt-terminal-red"
          ],
          "text": "-5"
        },
        {
          "classes": [],
          "text": "   "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "↑4"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-red",
            "wt-terminal-dim"
          ],
          "text": "↓1"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "+234"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-red"
          ],
          "text": "-24"
        },
        {
          "classes": [],
          "text": "  Refactor API to REST archit…   "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "⇡3"
        },
        {
          "classes": [],
          "text": "      "
        },
        {
          "classes": [
            "wt-terminal-blue",
            "wt-terminal-dim"
          ],
          "text": "#412"
        }
      ],
      [
        {
          "classes": [],
          "text": "^ main             "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "^⇅"
        },
        {
          "classes": [],
          "text": "                                                                  "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "⇡1"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-red",
            "wt-terminal-dim"
          ],
          "text": "⇣1"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "#"
        }
      ],
      [
        {
          "classes": [],
          "text": "+ fix-auth         "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "↕|"
        },
        {
          "classes": [],
          "text": "                "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "↑2"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-red",
            "wt-terminal-dim"
          ],
          "text": "↓1"
        },
        {
          "classes": [],
          "text": "   "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "+25"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-red"
          ],
          "text": "-11"
        },
        {
          "classes": [],
          "text": "  Harden auth with constant-t…     "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "|"
        },
        {
          "classes": [],
          "text": "     "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "#408"
        }
      ],
      [
        {
          "classes": [],
          "text": "+ "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "fix-typos"
        },
        {
          "classes": [],
          "text": "        "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "_|"
        },
        {
          "classes": [],
          "text": "                                                                    "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "|"
        },
        {
          "classes": [],
          "text": "     "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "#410"
        }
      ],
      [],
      [
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "○"
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "Showing 4 worktrees, 1 with changes, 2 ahead, hidden: Path, Commit, Age, Message"
        }
      ]
    ],
    "plain": "  Branch       Status       @±        ^↕        ^…±     Summary                       Remote⇅  CI\n@ feature-api  +   ↕⇡     +54   -5   ↑4  ↓1  +234  -24  Refactor API to REST archit…   ⇡3      #412\n^ main             ^⇅                                                                  ⇡1  ⇣1  #\n+ fix-auth         ↕|                ↑2  ↓1   +25  -11  Harden auth with constant-t…     |     #408\n+ fix-typos        _|                                                                    |     #410\n\n○ Showing 4 worktrees, 1 with changes, 2 ahead, hidden: Path, Commit, Age, Message"
  },
  {
    "lines": [
      [
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "Branch"
        },
        {
          "classes": [],
          "text": "       "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "Status"
        },
        {
          "classes": [],
          "text": "       "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "@±"
        },
        {
          "classes": [],
          "text": "        "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "^↕"
        },
        {
          "classes": [],
          "text": "        "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "^…±"
        },
        {
          "classes": [],
          "text": "     "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "Summary"
        },
        {
          "classes": [],
          "text": "                       "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "Remote⇅"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "CI"
        }
      ],
      [
        {
          "classes": [],
          "text": "@ feature-api  "
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": "+"
        },
        {
          "classes": [],
          "text": "   "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "↕⇡"
        },
        {
          "classes": [],
          "text": "     "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "+54"
        },
        {
          "classes": [],
          "text": "   "
        },
        {
          "classes": [
            "wt-terminal-red"
          ],
          "text": "-5"
        },
        {
          "classes": [],
          "text": "   "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "↑4"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-red",
            "wt-terminal-dim"
          ],
          "text": "↓1"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "+234"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-red"
          ],
          "text": "-24"
        },
        {
          "classes": [],
          "text": "  Refactor API to REST archit…   "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "⇡3"
        },
        {
          "classes": [],
          "text": "      "
        },
        {
          "classes": [
            "wt-terminal-blue",
            "wt-terminal-dim"
          ],
          "text": "#412"
        }
      ],
      [
        {
          "classes": [],
          "text": "^ main             "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "^⇅"
        },
        {
          "classes": [],
          "text": "                                                                  "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "⇡1"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-red",
            "wt-terminal-dim"
          ],
          "text": "⇣1"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "#"
        }
      ],
      [
        {
          "classes": [],
          "text": "+ fix-auth         "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "↕|"
        },
        {
          "classes": [],
          "text": "                "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "↑2"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-red",
            "wt-terminal-dim"
          ],
          "text": "↓1"
        },
        {
          "classes": [],
          "text": "   "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "+25"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-red"
          ],
          "text": "-11"
        },
        {
          "classes": [],
          "text": "  Harden auth with constant-t…     "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "|"
        },
        {
          "classes": [],
          "text": "     "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "#408"
        }
      ],
      [
        {
          "classes": [],
          "text": "+ "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "fix-typos"
        },
        {
          "classes": [],
          "text": "        "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "_|"
        },
        {
          "classes": [],
          "text": "                                                                    "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "|"
        },
        {
          "classes": [],
          "text": "     "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "#410"
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "/ "
        },
        {
          "classes": [],
          "text": "exp             "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "/↕"
        },
        {
          "classes": [],
          "text": "                 "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "↑2"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-red",
            "wt-terminal-dim"
          ],
          "text": "↓1"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "+137"
        },
        {
          "classes": [],
          "text": "       Explore GraphQL schema and…"
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "/ "
        },
        {
          "classes": [],
          "text": "wip             "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "/↕"
        },
        {
          "classes": [],
          "text": "                 "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "↑1"
        },
        {
          "classes": [],
          "text": "  "
        },
        {
          "classes": [
            "wt-terminal-red",
            "wt-terminal-dim"
          ],
          "text": "↓1"
        },
        {
          "classes": [],
          "text": "   "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "+33"
        },
        {
          "classes": [],
          "text": "       Start API documentation"
        }
      ],
      [],
      [
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "○"
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "Showing 4 worktrees, 2 branches, 1 with changes, 4 ahead, hidden: Path, Commit, Age, Message"
        }
      ]
    ],
    "plain": "  Branch       Status       @±        ^↕        ^…±     Summary                       Remote⇅  CI\n@ feature-api  +   ↕⇡     +54   -5   ↑4  ↓1  +234  -24  Refactor API to REST archit…   ⇡3      #412\n^ main             ^⇅                                                                  ⇡1  ⇣1  #\n+ fix-auth         ↕|                ↑2  ↓1   +25  -11  Harden auth with constant-t…     |     #408\n+ fix-typos        _|                                                                    |     #410\n/ exp             /↕                 ↑2  ↓1  +137       Explore GraphQL schema and…\n/ wip             /↕                 ↑1  ↓1   +33       Start API documentation\n\n○ Showing 4 worktrees, 2 branches, 1 with changes, 4 ahead, hidden: Path, Commit, Age, Message"
  },
  {
    "lines": [
      [
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": "◎"
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": "Generating commit message and committing changes... "
        },
        {
          "classes": [
            "wt-terminal-gray"
          ],
          "text": "(2 files, "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "+26"
        },
        {
          "classes": [
            "wt-terminal-gray"
          ],
          "text": ")"
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-gutter"
          ],
          "text": " "
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "feat(validation): add input validation utilities"
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "✓"
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "Committed changes @ "
        },
        {
          "classes": [
            "wt-terminal-green",
            "wt-terminal-dim"
          ],
          "text": "a1b2c3d"
        }
      ]
    ],
    "plain": "◎ Generating commit message and committing changes... (2 files, +26)\n  feat(validation): add input validation utilities\n✓ Committed changes @ a1b2c3d"
  },
  {
    "lines": [
      [
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": "◎"
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": "Generating commit message and committing changes... "
        },
        {
          "classes": [
            "wt-terminal-gray"
          ],
          "text": "(2 files, "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "+53"
        },
        {
          "classes": [],
          "text": ", no squashing needed"
        },
        {
          "classes": [
            "wt-terminal-gray"
          ],
          "text": ")"
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-gutter"
          ],
          "text": " "
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "Add authentication module"
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "✓"
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "Committed changes @ "
        },
        {
          "classes": [
            "wt-terminal-green",
            "wt-terminal-dim"
          ],
          "text": "a1b2c3d"
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": "◎"
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": "Merging 1 commit to "
        },
        {
          "classes": [
            "wt-terminal-cyan",
            "wt-terminal-bold"
          ],
          "text": "main"
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": " @ "
        },
        {
          "classes": [
            "wt-terminal-cyan",
            "wt-terminal-dim"
          ],
          "text": "a1b2c3d"
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": " (no rebase needed)"
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-gutter"
          ],
          "text": " "
        },
        {
          "classes": [],
          "text": " * "
        },
        {
          "classes": [
            "wt-terminal-yellow"
          ],
          "text": "a1b2c3d"
        },
        {
          "classes": [],
          "text": " Add authentication module"
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-gutter"
          ],
          "text": " "
        },
        {
          "classes": [],
          "text": "  auth.rs | 51 "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "+++++++++++++++++++++++++++++++++++++++++++++++++++"
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-gutter"
          ],
          "text": " "
        },
        {
          "classes": [],
          "text": "  lib.rs  |  2 "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "++"
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-gutter"
          ],
          "text": " "
        },
        {
          "classes": [],
          "text": "  2 files changed, 53 insertions(+)"
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "✓"
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "Merged to "
        },
        {
          "classes": [
            "wt-terminal-green",
            "wt-terminal-bold"
          ],
          "text": "main"
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-gray"
          ],
          "text": "(1 commit, 2 files, "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "+53"
        },
        {
          "classes": [
            "wt-terminal-gray"
          ],
          "text": ")"
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": "◎"
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": "Removing "
        },
        {
          "classes": [
            "wt-terminal-cyan",
            "wt-terminal-bold"
          ],
          "text": "feature-auth"
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": " worktree & branch in background (same commit as "
        },
        {
          "classes": [
            "wt-terminal-cyan",
            "wt-terminal-bold"
          ],
          "text": "main"
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": ","
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "_"
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": ")"
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "○"
        },
        {
          "classes": [],
          "text": " Switched to worktree for "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "main"
        },
        {
          "classes": [],
          "text": " @ "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "~/repo"
        }
      ]
    ],
    "plain": "◎ Generating commit message and committing changes... (2 files, +53, no squashing needed)\n  Add authentication module\n✓ Committed changes @ a1b2c3d\n◎ Merging 1 commit to main @ a1b2c3d (no rebase needed)\n  * a1b2c3d Add authentication module\n   auth.rs | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++\n   lib.rs  |  2 ++\n   2 files changed, 53 insertions(+)\n✓ Merged to main (1 commit, 2 files, +53)\n◎ Removing feature-auth worktree & branch in background (same commit as main, _)\n○ Switched to worktree for main @ ~/repo"
  },
  {
    "lines": [
      [
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": "◎"
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": "Running pre-merge "
        },
        {
          "classes": [
            "wt-terminal-cyan",
            "wt-terminal-bold"
          ],
          "text": "project:test"
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-gutter"
          ],
          "text": " "
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-blue",
            "wt-terminal-dim"
          ],
          "text": "cargo"
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": " nextest run"
        }
      ],
      [
        {
          "classes": [],
          "text": "    Finished `test` profile [unoptimized + debuginfo] target(s) in 0.02s"
        }
      ],
      [
        {
          "classes": [],
          "text": "     Summary [   0.002s] 2 tests run: 2 passed, 0 skipped"
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": "◎"
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": "Merging 1 commit to "
        },
        {
          "classes": [
            "wt-terminal-cyan",
            "wt-terminal-bold"
          ],
          "text": "main"
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": " @ "
        },
        {
          "classes": [
            "wt-terminal-cyan",
            "wt-terminal-dim"
          ],
          "text": "a1b2c3d"
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": " (no commit/squash/rebase needed)"
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-gutter"
          ],
          "text": " "
        },
        {
          "classes": [],
          "text": " * "
        },
        {
          "classes": [
            "wt-terminal-yellow"
          ],
          "text": "a1b2c3d"
        },
        {
          "classes": [],
          "text": " feat: add hook registration"
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-gutter"
          ],
          "text": " "
        },
        {
          "classes": [],
          "text": "  hook.rs | 31 "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "+++++++++++++++++++++++++++++++"
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-gutter"
          ],
          "text": " "
        },
        {
          "classes": [],
          "text": "  1 file changed, 31 insertions(+)"
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "✓"
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "Merged to "
        },
        {
          "classes": [
            "wt-terminal-green",
            "wt-terminal-bold"
          ],
          "text": "main"
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-gray"
          ],
          "text": "(1 commit, 1 file, "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "+31"
        },
        {
          "classes": [
            "wt-terminal-gray"
          ],
          "text": ")"
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": "◎"
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": "Removing "
        },
        {
          "classes": [
            "wt-terminal-cyan",
            "wt-terminal-bold"
          ],
          "text": "hooks"
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": " worktree & branch in background (same commit as "
        },
        {
          "classes": [
            "wt-terminal-cyan",
            "wt-terminal-bold"
          ],
          "text": "main"
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": ","
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "_"
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": ")"
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "○"
        },
        {
          "classes": [],
          "text": " Switched to worktree for "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "main"
        },
        {
          "classes": [],
          "text": " @ "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "~/repo"
        }
      ]
    ],
    "plain": "◎ Running pre-merge project:test\n  cargo nextest run\n    Finished `test` profile [unoptimized + debuginfo] target(s) in 0.02s\n     Summary [   0.002s] 2 tests run: 2 passed, 0 skipped\n◎ Merging 1 commit to main @ a1b2c3d (no commit/squash/rebase needed)\n  * a1b2c3d feat: add hook registration\n   hook.rs | 31 +++++++++++++++++++++++++++++++\n   1 file changed, 31 insertions(+)\n✓ Merged to main (1 commit, 1 file, +31)\n◎ Removing hooks worktree & branch in background (same commit as main, _)\n○ Switched to worktree for main @ ~/repo"
  },
  {
    "lines": [
      [
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": "◎"
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": "Running pre-merge "
        },
        {
          "classes": [
            "wt-terminal-cyan",
            "wt-terminal-bold"
          ],
          "text": "project:test"
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-gutter"
          ],
          "text": " "
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-blue",
            "wt-terminal-dim"
          ],
          "text": "cargo"
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": " test"
        }
      ],
      [
        {
          "classes": [],
          "text": "    Finished test [unoptimized + debuginfo] target(s) in 0.12s"
        }
      ],
      [
        {
          "classes": [],
          "text": "     Running unittests src/lib.rs (target/debug/deps/worktrunk-abc123)"
        }
      ],
      [],
      [
        {
          "classes": [],
          "text": "running 18 tests"
        }
      ],
      [
        {
          "classes": [],
          "text": "test auth::tests::test_jwt_decode ... ok"
        }
      ],
      [
        {
          "classes": [],
          "text": "test auth::tests::test_jwt_encode ... ok"
        }
      ],
      [
        {
          "classes": [],
          "text": "test auth::tests::test_token_refresh ... ok"
        }
      ],
      [
        {
          "classes": [],
          "text": "test auth::tests::test_token_validation ... ok"
        }
      ],
      [],
      [
        {
          "classes": [],
          "text": "test result: ok. 18 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.08s"
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": "◎"
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": "Running pre-merge "
        },
        {
          "classes": [
            "wt-terminal-cyan",
            "wt-terminal-bold"
          ],
          "text": "project:lint"
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-gutter"
          ],
          "text": " "
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-blue",
            "wt-terminal-dim"
          ],
          "text": "cargo"
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": " clippy"
        }
      ],
      [
        {
          "classes": [],
          "text": "    Checking worktrunk v0.1.0"
        }
      ],
      [
        {
          "classes": [],
          "text": "    Finished dev [unoptimized + debuginfo] target(s) in 1.23s"
        }
      ]
    ],
    "plain": "◎ Running pre-merge project:test\n  cargo test\n    Finished test [unoptimized + debuginfo] target(s) in 0.12s\n     Running unittests src/lib.rs (target/debug/deps/worktrunk-abc123)\n\nrunning 18 tests\ntest auth::tests::test_jwt_decode ... ok\ntest auth::tests::test_jwt_encode ... ok\ntest auth::tests::test_token_refresh ... ok\ntest auth::tests::test_token_validation ... ok\n\ntest result: ok. 18 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.08s\n◎ Running pre-merge project:lint\n  cargo clippy\n    Checking worktrunk v0.1.0\n    Finished dev [unoptimized + debuginfo] target(s) in 1.23s"
  },
  {
    "lines": [
      [
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": "◎"
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": "Running pre-remove "
        },
        {
          "classes": [
            "wt-terminal-cyan",
            "wt-terminal-bold"
          ],
          "text": "project:cleanup"
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-gutter"
          ],
          "text": " "
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-blue",
            "wt-terminal-dim"
          ],
          "text": "flyctl"
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": " scale count 0"
        }
      ],
      [
        {
          "classes": [],
          "text": "Scaling app to 0 machines"
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": "◎"
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": "Removing "
        },
        {
          "classes": [
            "wt-terminal-cyan",
            "wt-terminal-bold"
          ],
          "text": "api"
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": " worktree & branch in background (same commit as "
        },
        {
          "classes": [
            "wt-terminal-cyan",
            "wt-terminal-bold"
          ],
          "text": "main"
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": ","
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "_"
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": ")"
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "○"
        },
        {
          "classes": [],
          "text": " Switched to worktree for "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "main"
        },
        {
          "classes": [],
          "text": " @ "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "~/repo"
        }
      ]
    ],
    "plain": "◎ Running pre-remove project:cleanup\n  flyctl scale count 0\nScaling app to 0 machines\n◎ Removing api worktree & branch in background (same commit as main, _)\n○ Switched to worktree for main @ ~/repo"
  },
  {
    "lines": [
      [
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": "◎"
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": "Squashing 3 commits into a single commit "
        },
        {
          "classes": [
            "wt-terminal-gray"
          ],
          "text": "(5 files, "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "+16"
        },
        {
          "classes": [
            "wt-terminal-gray"
          ],
          "text": ")"
        },
        {
          "classes": [],
          "text": "..."
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": "◎"
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": "Generating squash commit message..."
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-gutter"
          ],
          "text": " "
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "feat(auth): Implement JWT authentication system"
        }
      ],
      [],
      [
        {
          "classes": [
            "wt-terminal-gutter"
          ],
          "text": " "
        },
        {
          "classes": [],
          "text": " Add comprehensive JWT token handling including validation, refresh"
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-gutter"
          ],
          "text": " "
        },
        {
          "classes": [],
          "text": " logic, and authentication tests."
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "✓"
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "Squashed @ a1b2c3d"
        }
      ]
    ],
    "plain": "◎ Squashing 3 commits into a single commit (5 files, +16)...\n◎ Generating squash commit message...\n  feat(auth): Implement JWT authentication system\n\n  Add comprehensive JWT token handling including validation, refresh\n  logic, and authentication tests.\n✓ Squashed @ a1b2c3d"
  },
  {
    "lines": [
      [
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": "◎"
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": "Squashing 3 commits into a single commit "
        },
        {
          "classes": [
            "wt-terminal-gray"
          ],
          "text": "(5 files, "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "+16"
        },
        {
          "classes": [
            "wt-terminal-gray"
          ],
          "text": ")"
        },
        {
          "classes": [],
          "text": "..."
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": "◎"
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": "Generating squash commit message..."
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-gutter"
          ],
          "text": " "
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "feat(auth): Implement JWT authentication system"
        }
      ],
      [],
      [
        {
          "classes": [
            "wt-terminal-gutter"
          ],
          "text": " "
        },
        {
          "classes": [],
          "text": " Add comprehensive JWT token handling including validation, refresh"
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-gutter"
          ],
          "text": " "
        },
        {
          "classes": [],
          "text": " logic, and authentication tests."
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "✓"
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "Squashed @ a1b2c3d"
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": "◎"
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": "Merging 1 commit to "
        },
        {
          "classes": [
            "wt-terminal-cyan",
            "wt-terminal-bold"
          ],
          "text": "main"
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": " @ "
        },
        {
          "classes": [
            "wt-terminal-cyan",
            "wt-terminal-dim"
          ],
          "text": "a1b2c3d"
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": " (no rebase needed)"
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-gutter"
          ],
          "text": " "
        },
        {
          "classes": [],
          "text": " * "
        },
        {
          "classes": [
            "wt-terminal-yellow"
          ],
          "text": "a1b2c3d"
        },
        {
          "classes": [],
          "text": " feat(auth): Implement JWT authentication system"
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-gutter"
          ],
          "text": " "
        },
        {
          "classes": [],
          "text": "  auth.rs             | 2 "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "++"
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-gutter"
          ],
          "text": " "
        },
        {
          "classes": [],
          "text": "  auth_test.rs        | 2 "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "++"
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-gutter"
          ],
          "text": " "
        },
        {
          "classes": [],
          "text": "  integration_test.rs | 6 "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "++++++"
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-gutter"
          ],
          "text": " "
        },
        {
          "classes": [],
          "text": "  jwt.rs              | 3 "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "+++"
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-gutter"
          ],
          "text": " "
        },
        {
          "classes": [],
          "text": "  jwt_test.rs         | 3 "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "+++"
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-gutter"
          ],
          "text": " "
        },
        {
          "classes": [],
          "text": "  5 files changed, 16 insertions(+)"
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "✓"
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "Merged to "
        },
        {
          "classes": [
            "wt-terminal-green",
            "wt-terminal-bold"
          ],
          "text": "main"
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-gray"
          ],
          "text": "(1 commit, 5 files, "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "+16"
        },
        {
          "classes": [
            "wt-terminal-gray"
          ],
          "text": ")"
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": "◎"
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": "Removing "
        },
        {
          "classes": [
            "wt-terminal-cyan",
            "wt-terminal-bold"
          ],
          "text": "feature"
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": " worktree & branch in background (same commit as "
        },
        {
          "classes": [
            "wt-terminal-cyan",
            "wt-terminal-bold"
          ],
          "text": "main"
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": ","
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "_"
        },
        {
          "classes": [
            "wt-terminal-cyan"
          ],
          "text": ")"
        }
      ],
      [
        {
          "classes": [
            "wt-terminal-dim"
          ],
          "text": "○"
        },
        {
          "classes": [],
          "text": " Switched to worktree for "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "main"
        },
        {
          "classes": [],
          "text": " @ "
        },
        {
          "classes": [
            "wt-terminal-bold"
          ],
          "text": "~/repo"
        }
      ]
    ],
    "plain": "◎ Squashing 3 commits into a single commit (5 files, +16)...\n◎ Generating squash commit message...\n  feat(auth): Implement JWT authentication system\n\n  Add comprehensive JWT token handling including validation, refresh\n  logic, and authentication tests.\n✓ Squashed @ a1b2c3d\n◎ Merging 1 commit to main @ a1b2c3d (no rebase needed)\n  * a1b2c3d feat(auth): Implement JWT authentication system\n   auth.rs             | 2 ++\n   auth_test.rs        | 2 ++\n   integration_test.rs | 6 ++++++\n   jwt.rs              | 3 +++\n   jwt_test.rs         | 3 +++\n   5 files changed, 16 insertions(+)\n✓ Merged to main (1 commit, 5 files, +16)\n◎ Removing feature worktree & branch in background (same commit as main, _)\n○ Switched to worktree for main @ ~/repo"
  },
  {
    "lines": [
      [
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "✓"
        },
        {
          "classes": [],
          "text": " "
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": "Created branch "
        },
        {
          "classes": [
            "wt-terminal-green",
            "wt-terminal-bold"
          ],
          "text": "feature-auth"
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": " from "
        },
        {
          "classes": [
            "wt-terminal-green",
            "wt-terminal-bold"
          ],
          "text": "main"
        },
        {
          "classes": [
            "wt-terminal-green"
          ],
          "text": " and worktree @ "
        },
        {
          "classes": [
            "wt-terminal-green",
            "wt-terminal-bold"
          ],
          "text": "~/repo.feature-auth"
        }
      ]
    ],
    "plain": "✓ Created branch feature-auth from main and worktree @ ~/repo.feature-auth"
  }
]

---

### Public .Well Known Agent Skills Index.Json (`docs/public/.well-known/agent-skills/index.json`)

{
  "$schema": "https://schemas.agentskills.io/discovery/0.2.0/schema.json",
  "skills": [
    {
      "name": "worktrunk",
      "type": "skill-md",
      "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.",
      "url": "./worktrunk/SKILL.md",
      "digest": "sha256:3c9fd14364522baef8a17bcbaad846201d6e438c7f1db86b7964e82e64a1184e"
    }
  ]
}

---

### Public Demos Twitter Thread (`docs/public/demos/twitter/thread.md`)

# Twitter Thread: Worktrunk Launch

Published: Dec 30, 2025
URL: https://x.com/max_sixty/status/2006077845391724739

---

**1/**
Announcing Worktrunk! A git worktree manager, designed for running AI agents in parallel.

A few points on why I'm so excited about the project, and why I hope it becomes broadly adopted 🧵

[wt-core.gif]

**2/**
As models have improved this year, I've been running more & more Claude Code instances in parallel, often 5-10.

Each needs its own isolated working directory, otherwise they get confused by each other's changes.

**3/**
Git worktrees solve this, but the UX is terrible!

To create & navigate to a new worktree in git:

git worktree add -b feat ../repo.feat && cd ../repo.feat

...even for a simple command, we need to type the name three times.

**4/**
Worktrunk is a CLI, written in Rust, which makes git worktrees as easy as branches.

[worktrunk.dev card]

**5/**
In contrast to the git command, the Worktrunk command to create a new worktree is short (& aliasable):

wt switch --create api

[wt-switch.gif]

**6/**
Worktrunk's other core commands:

wt list: see all worktrees with status
wt remove: delete a worktree

[wt-list-remove.gif]

**7/**
Beyond core commands, Worktrunk has quality-of-life features to simplify working with many parallel changes:

Hooks: Post-start hooks run after creating a worktree: install deps, copy caches, start dev servers, etc. And there's a hook for every stage of a worktree lifecycle.

[wt-hooks.gif]

**8/**
wt list renders in ~50ms, then fills in details (CI status, diff stats) as they become available. Can also list branches with wt list --branches.

wt list --full: CI status as clickable dots. Green/blue/red. Clicking opens the PR.

[wt-list.gif]

**9/**
wt switch picker: fuzzy picker across all branches.

[wt-select-short.gif]

**10/**
LLM Commits: When running wt step commit or wt merge, worktrunk can have an LLM write the commit message, with a customizable template.

[wt-commit.gif]

**11/**
wt merge: squash, rebase, merge, remove worktree, delete branch, in one command.

[wt-merge.gif]

**12/**
.@claudeai status line integration. See branch, diff stats, CI status at a glance.

[wt-statusline.gif]

**13/**
Putting it all together: parallel Claude Code agents in Zellij tabs, each in its own worktree. The full lifecycle: wt switch, wt list, wt select, wt merge.

[wt-zellij-omnibus.gif]

**14/**
To install:

brew install max-sixty/worktrunk/wt
wt config shell install

Feedback very welcome. Open an issue or reply here.

⭐

[GitHub card: github.com/max-sixty/worktrunk]

**15/**
Big thanks to @AnthropicAI and the @claudeai team, including @bcherny @_catwu @alexalbert__, for building Claude Code. Worktrunk wouldn't exist without it 🙏

If this was useful, staring the repo / liking / RT-ing the first tweet helps spread the word.

[Quote tweet of tweet 1]

---

### Src Content Docs Claude Code (`docs/src/content/docs/claude-code.md`)

---
title: "Agent Integration"
description: "Worktrunk plugins for Claude Code, Codex, OpenCode, Pi, oh-my-pi, and Gemini CLI: a configuration skill, wt list activity tracking, and worktree isolation for Claude Code and OpenCode."
sidebar:
  order: 21
---
Worktrunk ships a plugin for each supported agent CLI. What a plugin provides depends on the hooks that CLI exposes:

| Capability | Claude Code | Codex | OpenCode | Pi | oh-my-pi | Gemini CLI |
|---|:-:|:-:|:-:|:-:|:-:|:-:|
| Configuration skill | ✓ | ✓ |  |  |  | ✓ |
| Activity tracking (🤖/💬 in `wt list`) | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| Worktree isolation | ✓ |  | ✓ |  |  |  |
| `/wt-switch-create` skill | ✓ |  |  |  |  |  |
| `/wt-diff` pane | ✓ |  |  |  |  |  |

The configuration skill is documentation the agent reads to help set up LLM commits, hooks, and troubleshooting. Activity tracking shows which worktrees have running sessions. Worktree isolation needs worktree-lifecycle hooks, which only Claude Code and OpenCode 2 expose, so Codex, Pi, oh-my-pi, and Gemini users invoke `wt switch --create` and `wt remove` directly.

## Installation

### Claude Code

```bash
wt config plugins claude install
```

Manual equivalent (Claude Code 2.1.292 or later):

```bash
claude plugin install worktrunk --marketplace max-sixty/worktrunk
```

`wt config plugins claude uninstall` removes the plugin and its marketplace entry.

### Codex

```bash
wt config plugins codex install
```

Manual equivalent:

```bash
codex plugin marketplace add max-sixty/worktrunk
codex plugin add worktrunk@worktrunk
codex plugin add worktrunk-markers@worktrunk
```

`worktrunk` carries the skills; `worktrunk-markers` carries only the activity-marker hooks, so skill updates don't make Codex ask to approve the hooks again. An install that predates the split has only `worktrunk`, whose markers stop once it updates; add the markers with `codex plugin add worktrunk-markers@worktrunk`.

`wt config plugins codex uninstall` removes both plugins and their marketplace entry.

### OpenCode

```bash
wt config plugins opencode install
```

This writes the plugin to OpenCode's global plugins directory, `~/.config/opencode/plugins/worktrunk.ts` (honoring `$OPENCODE_CONFIG_DIR` and `$XDG_CONFIG_HOME`). `wt config plugins opencode uninstall` removes it.

### Pi

```bash
wt config plugins pi install
```

This writes the activity extension to `~/.pi/agent/extensions/worktrunk.ts`, where Pi discovers it on startup; `$PI_CODING_AGENT_DIR` replaces the agent directory. `wt config plugins pi uninstall` removes the extension.

### oh-my-pi

```bash
wt config plugins omp install
```

oh-my-pi (`omp`) is a Pi-derived agent with its own config root and hook API, so it takes a separate command. This writes the activity hook to `~/.omp/agent/hooks/pre/worktrunk.ts`. Named `$OMP_PROFILE` or `$PI_PROFILE` profiles use `~/.omp/profiles/<profile>/agent`, `$PI_CONFIG_DIR` changes the `.omp` config root, and `$PI_CODING_AGENT_DIR` overrides the agent directory for the default profile. `wt config plugins omp uninstall` removes the hook.

### Gemini CLI

```bash
gemini extensions install https://github.com/max-sixty/worktrunk
```

Gemini loads the extension natively from the repository, so there is no `wt` wrapper. `gemini extensions uninstall worktrunk` removes it.

## Configuration skill

With the `/worktrunk` skill, the agent can help with:

- Setting up LLM-generated commit messages
- Adding project hooks (pre-start, pre-merge, pre-commit)
- Configuring worktree path templates
- Fixing shell integration issues

Claude Code is designed to load the skill automatically when it detects worktrunk-related questions.

## Activity tracking

Every plugin tracks agent sessions with status markers in `wt list`:



```console
$ wt list
  Branch       Status       @±        ^↕        ^…±     Remote⇅  Commit    Age  Message
@ main             ^⇡                                    ⇡1      33323bc    1d  Initial commit
+ feature-api      ↑ 🤖              ↑1        +1                70343f0    1d  Add REST API endpo…
+ review-ui      ? ↑ 💬    +1        ↑1        +1                a585d6e    1d  Add dashboard comp…
+ wip-docs       ? –       +1                                    33323bc    1d  Initial commit

○ Showing 4 worktrees, 2 with changes, 2 ahead, hidden: Path  (^ main worktree  ⇡ ahead of remote)
```



- 🤖 — agent is working
- 💬 — agent is waiting or idle

Every plugin clears the marker when a session ends. A stale marker can remain if the agent process is killed before its session-end hook runs. In every case, `wt config state marker clear` removes a marker manually.

### Manual status markers

Set status markers manually for any workflow:

```console
$ wt config state marker set "🚧"                   # Current branch
$ wt config state marker set "✅" --branch feature  # Specific branch
$ git config worktrunk.state.feature.marker '{"marker":"💬","set_at":0}'  # Direct
```

### Agent CLIs without a plugin

For other agent CLIs, configure these commands to run on session events:

| Host event | Command |
|---|---|
| Session starts, or the agent resumes work | `wt config state marker set "🤖"` |
| Agent finishes a turn and waits for input | `wt config state marker set "💬"` |
| Session ends | `wt config state marker clear` |

## Worktree isolation (Claude Code and OpenCode)

Claude Code agents can run in isolated worktrees (`isolation: "worktree"`). By default, Claude Code creates these with `git worktree add`. The plugin's `WorktreeCreate` and `WorktreeRemove` hooks route this through `wt switch --create` and `wt remove` instead, so worktrees created by agents get worktrunk's naming conventions, hooks, and lifecycle management. If the branch already exists, the hook runs `wt switch` without `--create`, which returns the branch's worktree, creating one if it has none. New branches start from the default branch: Claude Code's hook input names the worktree but no base, so its `worktree.baseRef` setting has no effect.

The Claude desktop app creates worktree sessions itself and doesn't run plugin `WorktreeCreate` or `WorktreeRemove` hooks, so those worktrees bypass `wt` ([anthropics/claude-code#29716](https://github.com/anthropics/claude-code/issues/29716)).

Under OpenCode 2, the plugin registers a `worktrunk` worktree strategy, so worktrees OpenCode creates and removes go through the same commands. Each gets a branch named after the worktree name OpenCode chooses, at the path from `worktree-path`; OpenCode's `worktree.directory` setting is ignored. New branches start from the default branch (or the starting ref OpenCode passes), not the current checkout's HEAD. A dirty worktree fails removal with worktrunk's message rather than an offer to force.

## `/wt-switch-create` skill (Claude Code only)

`/wt-switch-create [<branch>] [<repo>] [-- <task>]` starts a task in a fresh worktree without leaving the session: it creates the worktree, switches into it, and runs the task (all arguments optional). The worktree shows up in `wt list`; merge or remove it with `wt merge` / `wt remove`.

Claude Code asks for confirmation before a session enters an existing worktree by path outside `.claude/worktrees/`, which in worktrunk's default layout is every worktree. The plugin's `PermissionRequest` hook answers yes for a worktree of the repository the session is working in that sits where `worktree-path` puts its branch, so a background session doesn't stop at that prompt. Entering any other worktree still asks.

## `/wt-diff` pane (Claude Code only)

`/wt-diff` opens a pane beside the conversation that lists the worktrees the session has worked in, with the selected one's [`wt step diff`](/step/#wt-step-diff) below: everything since the branch left the default branch, committed, uncommitted, and untracked. `/wt-diff <branch>` selects another worktree.

A worktree joins the list when the session starts or moves into it, or when the session or one of its subagents edits a file there or runs a command there that isn't read-only. Until the pane first opens, the pane only notes those directories, without running `git` or `wt`.

| Key | Action |
|---|---|
| `1`–`9` | Select a worktree |
| `j` / `k` | Next or previous file |
| `ctrl+↓` / `ctrl+↑` | Next or previous file, from the prompt |
| `r` | Refresh |
| ↑ ↓, PageUp, PageDown | Scroll |

The other keys work while the pane has the keyboard, which it takes when it opens. Running `/wt-diff` again gives it back, as does `ctrl+x tab`, which moves focus from the prompt to the line above it when another plugin draws one, then to the pane. `esc` returns to the prompt.

The pane needs a Claude Code release that loads plugin hooks modules; earlier releases load the rest of the plugin without it.

## Statusline (Claude Code only)

`wt list statusline --format=claude-code` outputs a single-line status for the Claude Code statusline. Claude Code runs it in the background, which is what makes the occasional 1–2 second CI fetch invisible.

<code>~/w/myproject.feature-auth  !🤖  @<span style='color:#0a0'>+42</span> <span style='color:#a00'>-8</span>  <span style='color:#0a0'>↑3</span>  <span style='color:#0a0'>⇡1</span>  <span style='color:#0a0'>#3035</span>  Opus  🌔 65%  <span style='color:#a70'>1.4×(10am–3pm)</span></code>

The statusline shows worktree status, model, context usage, and rate-limit pace. See [`wt list statusline`](/list/#wt-list-statusline) for details.

<figure class="demo">
<picture>
  <source srcset="/assets/docs/dark/wt-statusline.gif" media="(prefers-color-scheme: dark)">
  <img src="/assets/docs/light/wt-statusline.gif" alt="Claude Code statusline demo" width="1600" height="900">
</picture>
<figcaption>Switching to a worktree, then launching Claude Code with the statusline configured</figcaption>
</figure>

Add to `~/.claude/settings.json`:

```json title="~/.claude/settings.json"
{
  "statusLine": {
    "type": "command",
    "command": "wt list statusline --format=claude-code"
  }
}
```

---

### Src Content Docs Code Signing (`docs/src/content/docs/code-signing.md`)

---
title: "Code Signing Policy"
description: "Windows code signing, release approval, and privacy."
sidebar:
  order: 27
---
Worktrunk's SignPath Foundation application is under review. The Windows signing pipeline currently uses a self-signed test certificate and allows unsigned releases if signing fails.

## Why signing matters

[Authenticode](https://learn.microsoft.com/en-us/windows-hardware/drivers/install/authenticode) signatures identify a binary's publisher and verify that it has not changed since signing.

## Signing certificate

> Free code signing provided by [SignPath.io](https://signpath.io/), certificate by [SignPath Foundation](https://signpath.org/).

SignPath holds the private key in a hardware security module; maintainers do not have access to it.

## What is signed

The signing pipeline covers `wt.exe` and `git-wt.exe` in the `x86_64-pc-windows-msvc` archive on [GitHub Releases](https://github.com/max-sixty/worktrunk/releases), also distributed through winget.

## Build and signing pipeline

The [`release` workflow](https://github.com/max-sixty/worktrunk/blob/main/.github/workflows/release.yaml) builds tagged commits with [cargo-dist](https://axodotdev.github.io/cargo-dist/) on GitHub-hosted runners. It submits the Windows archive to SignPath and publishes the signed archive when signing succeeds.

## Project roles

[@max-sixty](https://github.com/max-sixty) holds all signing roles:

- **Author**: commits code and tags releases.
- **Reviewer**: reviews external contributions before release.
- **Approver**: authorizes signing requests.

Maintainers with signing authority use multi-factor authentication on GitHub and SignPath.

## Release approval

Under this policy, each signing request requires manual approval after confirming that the artifact was built from the repository's tagged commit.

## Privacy

Worktrunk collects no telemetry or analytics. It transfers information to other systems only for operations requested or configured by the user.

## Reporting a problem

Report suspected tampering or antivirus detections on official release artifacts by [opening an issue](https://github.com/max-sixty/worktrunk/issues). Suspected Defender false positives can also be submitted to [Microsoft for review](https://www.microsoft.com/en-us/wdsi/filesubmission).

---

### Src Content Docs Config (`docs/src/content/docs/config.md`)

---
title: "wt config"
description: "Manage user & project configs. Includes shell integration, hooks, and saved state."
sidebar:
  order: 15
---


Manage user & project configs. Includes shell integration, hooks, and saved state.

## Examples

Install shell integration (required for directory switching):

```console
$ wt config shell install
```

Create user config file with documented examples:

```console
$ wt config create
```

Create project config file (`.config/wt.toml`) for hooks:

```console
$ wt config create --project
```

Show current configuration and file locations:

```console
$ wt config show
```

## Configuration files

| File | Location | Contains | Committed & shared |
|------|----------|----------|--------------------|
| **User config** | `~/.config/worktrunk/config.toml` | Worktree path template, LLM commit configs, etc | ✗ |
| **Project config** | `.config/wt.toml` | Project hooks, dev server URL | ✓ |

Organizations can deploy a system-wide config file for shared defaults — run `wt config show` for the platform-specific location.

**User config** — personal preferences:

```toml
# ~/.config/worktrunk/config.toml
worktree-path = ".worktrees/{{ branch | sanitize }}"

[commit.generation]
command = "MAX_THINKING_TOKENS=0 claude -p --no-session-persistence --model=haiku --tools='' --safe-mode --setting-sources='user' --system-prompt=''"
```

**Project config** — shared team settings:

```toml
# .config/wt.toml
[pre-start]
deps = "npm ci"

[pre-merge]
test = "npm test"
```


# User Configuration

Create with `wt config create`. Values shown are defaults unless noted otherwise.

Location:

- macOS/Linux: `~/.config/worktrunk/config.toml` (or `$XDG_CONFIG_HOME` if set)
- Windows: `%APPDATA%\worktrunk\config.toml`

## Worktree path template

Controls where new worktrees are created.

**Available template variables:**

- `{{ repo_path }}` — absolute path to the repository root (e.g., `/Users/me/code/myproject`. Or for bare repos, the bare directory itself)
- `{{ repo }}` — repository directory name (e.g., `myproject`)
- `{{ owner }}` — primary remote owner path (may include subgroups like `group/subgroup`)
- `{{ remote_repo }}` — repository name in the primary remote URL, without `.git` (e.g., `myproject`); differs from `{{ repo }}`, the directory on disk, when a clone was renamed
- `{{ branch }}` — raw branch name (e.g., `feature/auth`)
- `{{ branch | sanitize }}` — filesystem-safe: `/` and `\` become `-` (e.g., `feature-auth`)
- `{{ branch | sanitize_db }}` — database-safe: lowercase, underscores, hash suffix (e.g., `feature_auth_x7k`)
- `{{ branch | codename(2) }}` — deterministic friendly name from a ~1.26M-combo pool (e.g., `malleable-opah`)

This is a smaller set than [the variables hooks and aliases get](/hook/#template-variables).

**Examples** for repo at `~/code/myproject`, branch `feature/auth`:

Default — sibling directory (`~/code/myproject.feature-auth`):

```toml
worktree-path = "{{ repo_path }}/../{{ repo }}.{{ branch | sanitize }}"
```

Inside the repository (`~/code/myproject/.worktrees/feature-auth`):

```toml
worktree-path = "{{ repo_path }}/.worktrees/{{ branch | sanitize }}"
```

Friendly branch-derived names (`~/code/myproject.malleable-opah`):

```toml
worktree-path = "{{ repo_path }}/../{{ repo }}.{{ branch | codename(2) }}"
```

Friendly names with branch identity in a parent directory (`~/code/worktrees/feature-auth/malleable-opah`):

```toml
worktree-path = "{{ repo_path }}/../worktrees/{{ branch | sanitize }}/{{ branch | codename(2) }}"
```

Centralized worktrees directory (`~/worktrees/myproject/feature-auth`):

```toml
worktree-path = "~/worktrees/{{ repo }}/{{ branch | sanitize }}"
```

By remote owner path (`~/development/max-sixty/myproject/feature/auth`):

```toml
worktree-path = "~/development/{{ owner }}/{{ repo }}/{{ branch }}"
```

Bare repository cloned to `~/code/myproject/.git` (`~/code/myproject/feature-auth`):

```toml
worktree-path = "{{ repo_path }}/../{{ branch | sanitize }}"
```

`~` expands to the home directory. Relative paths resolve from `repo_path`.

## LLM commit messages

Generate commit messages automatically during merge. Requires an external CLI tool.

### Claude Code

```toml
[commit.generation]
command = "MAX_THINKING_TOKENS=0 claude -p --no-session-persistence --model=haiku --tools='' --safe-mode --setting-sources='user' --system-prompt=''"
```

### Codex

Create `~/.codex/worktrunk-commit-instructions.txt` containing just `.` (no newline). Accepting Worktrunk's first-run Codex setup creates the file for you.

```toml
[commit.generation]
command = "codex exec -m gpt-6-luna -c model_reasoning_effort='none' -c project_doc_max_bytes=0 -c skills.max_context_tokens=1 -c agents.enabled=false -c features.goals=false -c web_search=disabled -c 'model_instructions_file=\"~/.codex/worktrunk-commit-instructions.txt\"' -c features.shell_tool=false -c features.unified_exec=false -c features.apps=false -c features.plugins=false --ephemeral --sandbox=read-only --json - | jq -sr '[.[] | select(.item.type? == \"agent_message\")] | last.item.text'"
```

### OpenCode

```toml
[commit.generation]
command = "opencode run -m anthropic/claude-haiku-5-5 --variant fast"
```

### Pi

```toml
[commit.generation]
command = "pi -p --no-session --no-tools --no-extensions --no-skills --no-prompt-templates --no-context-files --model anthropic/claude-haiku-5-5 --thinking off"
```

See [LLM commits docs](/llm-commits/) for setup and [Custom prompt templates](#custom-prompt-templates) for template customization.

## Command config

### List

Persistent flag values for `wt list`. Override on command line as needed.

```toml
[list]
summary = false    # Enable LLM branch summaries (requires [commit.generation])

full = false       # Show CI status and LLM summaries (--full)
branches = false   # Include branches without worktrees (--branches)
remotes = false    # Include remote-only branches (--remotes)

json-schema = 2    # JSON output schema: 2 (envelope, default) or 1 (bare array)

columns = ["branch", "status", "ci", "path"]   # Columns to show, in order — built-ins or custom headers (omit for the default set)

timeout-ms = 0     # Wall-clock budget for the entire collect phase; 0 disables
```

`columns` selects and orders the columns the `wt list` table and the `wt switch`
picker render; `--format json` ignores it and always emits every field. Omit it
for the default set. It is meant to drive a per-invocation
[alias](/extending/#aliases) (`wt --config-set 'list.columns=[…]' list`),
giving a named view without disturbing the default `wt list`. A static setting
works but pins one layout over a table that otherwise adapts to `--full` and
terminal width.

Valid built-in names:

- `branch` — The branch name
- `status` — Git status symbols, plus any user-defined status
- `working-diff` — Uncommitted line changes against `HEAD`, including untracked files (header `@±`)
- `ahead-behind` — Commits ahead of and behind the default branch (header `^↕`)
- `branch-diff` — Line changes against the default branch (header `^…±`)
- `summary` — An LLM-generated summary of the branch
- `upstream` — Commits ahead of and behind the upstream tracking branch (header `Remote⇅`)
- `ci` — CI status of the head commit
- `path` — The worktree's path
- `url` — Dev-server URL from the `[list] url` template
- `commit` — The head commit's short hash
- `age` — Time since the last commit
- `message` — The head commit's subject

A selection mixes built-ins with [custom columns](#custom-columns), each named
by its `[list.custom-columns]` header (`columns = ["branch", "Ticket", "ci"]`),
and is exhaustive: only the listed columns render. Omit `columns` to keep the
default set, where custom columns append automatically.

Listing a column forces it on, space permitting: `ci` shows without `--full`. A
column whose data source is missing still stays hidden — `summary` needs an LLM
command (`[commit.generation]`), `url` needs a `[list] url` template.

#### Custom columns

<span class="badge-experimental"></span>

Custom columns add per-branch context to the `wt list` table. Each
`[list.custom-columns]` entry is a column: the key is the header, the template
renders each row's cell.

```toml
[list.custom-columns.Ticket]
template = "{{ vars.ticket }}"   # Required; the result is the cell text
width = 20                       # Optional max display width (default: 40)
priority = 9                     # Optional drop order when the terminal narrows;
                                 # lower = kept longer (default: 9, the URL band)
```

Templates may reference `{{ branch }}`, `{{ worktree_path }}`,
`{{ worktree_name }}` (empty for branch-only rows), and two per-branch
namespaces:

- `{{ vars.* }}` — values stored with
  [`wt config state vars set`](/config/#wt-config-state-vars).
- `{{ git.branch.* }}` — the branch's own git config under `branch.<name>.*`,
  read straight from `git config` (e.g. `{{ git.branch.jira }}` for a key you
  set yourself, or the git-native `description`). Git lowercases config variable
  names, so `branch.<name>.nvciShelf` reads as `{{ git.branch.nvcishelf }}`.

All standard filters work (`sanitize`, `hash_port`, `codename`, …). A row
where the template renders empty (e.g. a branch without the key) shows an
empty cell; a column that is empty for every row is dropped from the table.
`wt list --format json` includes the rendered values under
`items[].display.columns` in schema 2, or under `columns` in schema 1.

A `Jira` column reading a key kept in git config, and a `Summary` column
showing just the first line of the git-native branch description:

```toml
[list.custom-columns.Jira]
template = "{{ git.branch.jira }}"

[list.custom-columns.Summary]
template = "{{ git.branch.description | lines | first }}"
```

### Commit

Shared by `wt step commit`, `wt step squash`, and `wt merge`.

```toml
[commit]
stage = "all"      # What to stage before commit: "all", "tracked", or "none"
```

### Merge

Most flags are on by default. Set to false to change default behavior.

```toml
[merge]
squash = true      # Squash commits into one (--no-squash to preserve history)
commit = true      # Commit uncommitted changes first (--no-commit to skip)
rebase = true      # Rebase onto target before merge (--no-rebase to skip)
remove = true      # Remove worktree after merge (--no-remove to keep)
verify = true      # Run hooks (--no-hooks to skip)
ff = true          # Fast-forward merge (--no-ff to create a merge commit instead)
```

### Remove

Persistent flag values for `wt remove`. Override on command line as needed.

```toml
[remove]
delete-branch = true   # Delete branch after removal (--no-delete-branch to keep)
```

### Switch

```toml
[switch]
cd = true          # Change directory after switching (--no-cd to skip)

[switch.picker]
pager = "delta --paging=never"   # Example: override git's core.pager for diff preview
preview = true                   # Show the preview panel on open (Alt-p toggles)
```

### Step

```toml
[step.copy-ignored]
exclude = []   # Additional excludes (e.g., [".cache/", ".turbo/"])
```

Built-in excludes (VCS metadata and tool-state directories) always apply; [the `wt step copy-ignored` docs](/step/#wt-step-copy-ignored) list them. User config and project config exclusions are combined.

### User aliases

Command templates that run as `wt <name>`. See the [Extending Worktrunk guide](/extending/#aliases) for usage and flags.

```toml
[aliases]
greet = "echo Hello from {{ branch }}"
url = "echo http://localhost:{{ branch | hash_port }}"
```

Aliases defined here apply to all projects. For project-specific aliases, use the [project config](/config/#project-aliases) `[aliases]` section instead.

### User project-specific settings

User config can include a `[projects]` table for project-specific settings — worktree layout, setting overrides, anything else — separate from the [project config](/config/#project-configuration) shared with teammates.

Entries are keyed by project identifier — `<host>/<owner>/<repo>` derived from the primary remote URL (no `.git` suffix; an explicit port other than SSH's default 22 stays with the host, as in `gitlab.example.com:2222/team/project`), or the canonical repo path when there is no remote. Run `wt config show` inside the repo to see the identifier for the current project; it appears in the `PROJECT CONFIG` section as `Identifier: …`.

Scalar values (like `worktree-path`) replace the global value; everything else (hooks, aliases, etc.) appends, global first. See [how the layers rank](/config/#precedence).

```toml
[projects."github.com/user/repo"]
worktree-path = ".worktrees/{{ branch | sanitize }}"
list.full = true
merge.squash = false
remove.delete-branch = false
pre-start.env = "cp .env.example .env"
step.copy-ignored.exclude = [".repo-local-cache/"]
aliases.deploy = "make deploy BRANCH={{ branch }}"
```

#### Matching several repositories with one entry

A key containing `*` matches any run of characters, `/` included, so one entry covers a whole host or namespace — including nested groups. `*` is the only wildcard; every other character, `.` among them, is literal.

```toml
# Every repository on a self-hosted forge whose hostname carries no brand
[projects."git.company.example/*"]
forge.platform = "gitlab"

# Everything under one namespace shares a layout
[projects."git.company.example/platform/*"]
worktree-path = ".worktrees/{{ branch | sanitize }}"
```

Every matching entry applies, least- to most-specific, following the rule above: a more specific entry — `git.company.example/platform/*` over `git.company.example/*` — wins where both set the same setting, while hooks and aliases from every matching entry all run, least-specific first. A literal key is the most specific of all; specificity is the count of non-`*` characters in the key. End a host-wide key with `/*` — a bare `git.company.example*` also covers hosts whose names merely start with that string. A remote on a non-default SSH port carries the port in its identifier, so its host-wide key is `git.company.example:2222/*`.

Entries in `approvals.toml` match the same way, so a hand-written pattern entry approves its commands for every repository it covers.

#### Forge platform and hostname

`forge` names the forge for the matched repositories — the user-level counterpart of the project config's [forge platform](/config/#forge-platform) block, for a self-hosted host whose name carries no `github`, `gitlab`, or `gitea` for detection to read.

```toml
[projects."git.company.example/*"]
forge.platform = "gitlab"                    # or "github", "gitea" (experimental), "azure-devops" (experimental)
forge.hostname = "api.git.company.example"   # API host, when the remote's own host isn't it
```

A repository's own `[forge]` block still wins over any entry here, field by field.

Hooks support all three [hook forms](/hook/#hook-forms). A table runs multiple commands concurrently; an array-of-tables pipeline runs steps in sequence:

```toml
# Single command
[projects."github.com/user/repo"]
post-start = "mise trust"

# Multiple commands, running concurrently
[projects."github.com/user/repo".post-start]
mise = "mise trust"
server = "npm run dev"

# Pipeline: steps run in sequence
[[projects."github.com/user/repo".post-start]]
install = "npm ci"

[[projects."github.com/user/repo".post-start]]
build = "npm run build"
server = "npm run dev"
```

### Custom prompt templates

Templates use [minijinja](https://docs.rs/minijinja/) syntax.

#### Commit template

Available variables:

- `{{ git_diff }}`, `{{ git_diff_stat }}` — diff content
- `{{ branch }}`, `{{ repo }}` — context
- `{{ recent_commits }}` — recent commit messages
- `{{ user_guidance }}`, `{{ project_guidance }}` — rendered append fragments (see [Appending to the prompt](/config/#appending-to-the-prompt))

Default template:


```toml
[commit.generation]
template = """
<task>Write a commit message for the staged changes below.</task>

<format>
- Subject line under 50 chars
- For material changes, add a blank line then a body paragraph explaining the change
- Output only the commit message, no quotes or code blocks
</format>

<style>
- Imperative mood: "Add feature" not "Added feature"
- Match recent commit style (conventional commits if used)
- Describe the change, not the intent or benefit
</style>
{% if user_guidance %}
<user-guidance>
{{ user_guidance }}
</user-guidance>
{% endif %}{% if project_guidance %}
<project-guidance>
{{ project_guidance }}
</project-guidance>
{% endif %}
<diffstat>
{{ git_diff_stat }}
</diffstat>

<diff>
{{ git_diff }}
</diff>

<context>
Branch: {{ branch }}
{% if recent_commits %}<recent_commits>
{% for commit in recent_commits %}- {{ commit }}
{% endfor %}</recent_commits>{% endif %}
</context>

"""
```


#### Squash template

Available variables (in addition to commit template variables):

- `{{ commit_details }}` — list of commits being squashed; each renders as its subject and exposes `.subject` / `.body`
- `{{ target_branch }}` — merge target branch

Default template:


```toml
[commit.generation]
squash-template = """
<task>Write a commit message for the change in <diff>, which is everything the squash will record. <commits> lists what it folds in.</task>

<format>
- Subject line under 50 chars
- For material changes, add a blank line then a body paragraph explaining the change
- Output only the commit message, no quotes or code blocks
</format>

<style>
- Imperative mood: "Add feature" not "Added feature"
- Match the style of commits being squashed (conventional commits if used)
- Describe the change, not the intent or benefit
</style>
{% if user_guidance %}
<user-guidance>
{{ user_guidance }}
</user-guidance>
{% endif %}{% if project_guidance %}
<project-guidance>
{{ project_guidance }}
</project-guidance>
{% endif %}
<commits branch="{{ branch }}" target="{{ target_branch }}">
{% for detail in commit_details %}- {{ detail.subject }}
{% endfor %}</commits>

<diffstat>
{{ git_diff_stat }}
</diffstat>

<diff>
{{ git_diff }}
</diff>

"""
```


#### Appending to the prompt

`template-append` adds personal conventions to the commit and squash prompts without restating the whole template:

```toml
[commit.generation]
template-append = """
- Explain the rationale in the body, not just the change
"""
```

See [the LLM commits guide](/llm-commits/#appending-to-the-prompt) for how the fragment renders and its project-config counterpart.

## User hooks

See [`wt hook`](/hook/) for hook types, execution order, template variables, and examples. User hooks apply to all projects; [project hooks](/config/#project-hooks) apply only to that repository.


# Project Configuration

Project configuration lets teams share repository-specific settings — hooks, dev server URLs, and other defaults. The file lives in `.config/wt.toml` and is typically checked into version control.

To create a starter file with commented-out examples, run `wt config create --project`.

## Project hooks

Project hooks apply to this repository only. See [`wt hook`](/hook/) for hook types, execution order, and examples.

```toml
pre-start = "npm ci"
post-start = "npm run dev"
pre-merge = "npm test"
```

## Dev server URL

URL column in `wt list` (dimmed when port not listening):

```toml
[list]
url = "http://localhost:{{ branch | hash_port }}"
```

## Forge platform

The forge is read from the remote's hostname: any host carrying `github`, `gitlab`, or `gitea` anywhere in it, plus the Azure DevOps service domains. Name the forge explicitly for a host carrying none of those, such as a Forgejo instance at `forge.example.com`:

```toml
[forge]
platform = "github"  # or "gitlab", "gitea" (experimental), "azure-devops" (experimental)
hostname = "github.example.com"  # Example: API host (GHE / self-hosted GitLab)
```

When many repositories share one self-hosted host, name it once in user config with a [pattern-keyed `[projects]` entry](/config/#user-project-specific-settings) instead of repeating this block in each repo. A repository's own `[forge]` still wins, field by field.

## Commit-message append

`template-append` adds project-wide conventions to the LLM commit and squash prompts, shared so every teammate's LLM sees the same style guide:

```toml
[commit.generation]
template-append = """
- Use conventional commits (feat:, fix:, docs:, …)
- Reference the relevant issue ID in the body
"""
```

The first time the fragment is used (and whenever it changes), `wt` prompts the user to approve it — the same one-shot gate as project-defined hooks. Only `template-append` is honored from the project file; the LLM command and the main prompt template stay in [user config](/config/). See [the LLM commits guide](/llm-commits/#appending-to-the-prompt) for how the fragment renders.

## Copy-ignored excludes

Additional excludes for `wt step copy-ignored`:

```toml
[step.copy-ignored]
exclude = [".cache/", ".turbo/"]
```

Built-in excludes (VCS metadata and tool-state directories) always apply; [the `wt step copy-ignored` docs](/step/#wt-step-copy-ignored) list them. User config and project config exclusions are combined.

## Project aliases

Command templates that run as `wt <name>`. See the [Extending Worktrunk guide](/extending/#aliases) for usage and flags.

```toml
[aliases]
deploy = "make deploy BRANCH={{ branch }}"
url = "echo http://localhost:{{ branch | hash_port }}"
```

Aliases defined here are shared with teammates. For personal aliases, use the [user config](/config/#user-aliases) `[aliases]` section instead.


# Shell Integration

See [`wt config shell`](#wt-config-shell) for setup, activation, and current-shell diagnostics.

### First-run prompts

On first run without shell integration, Worktrunk offers to install it. On first commit without LLM configuration, it offers to configure a detected tool (`claude`, `codex`, `opencode`). Declining sets `skip-shell-integration-prompt` or `skip-commit-generation-prompt` automatically.

# Other

## Environment variables

All user config options can be overridden with environment variables using the `WORKTRUNK_` prefix.

### Naming convention

Config keys use kebab-case (`worktree-path`), while env vars use SCREAMING_SNAKE_CASE (`WORKTRUNK_WORKTREE_PATH`). The conversion happens automatically.

For nested config sections, use double underscores to separate levels:

| Config | Environment Variable |
|--------|---------------------|
| `worktree-path` | `WORKTRUNK_WORKTREE_PATH` |
| `commit.generation.command` | `WORKTRUNK_COMMIT__GENERATION__COMMAND` |
| `commit.stage` | `WORKTRUNK_COMMIT__STAGE` |

### Example: CI/testing override

Override the LLM command in CI to use a mock:

```console
$ WORKTRUNK_COMMIT__GENERATION__COMMAND="echo 'test: automated commit'" wt merge
```

### Other environment variables

| Variable | Purpose |
|----------|---------|
| `WORKTRUNK_BIN` | Override binary path for shell wrappers; useful for testing dev builds |
| `WORKTRUNK_CONFIG_PATH` | Override user config file location |
| `WORKTRUNK_SYSTEM_CONFIG_PATH` | Override system config file location |
| `WORKTRUNK_PROJECT_CONFIG_PATH` | Override project config file location (defaults to `.config/wt.toml`); relative paths resolve from the worktree root |
| `WORKTRUNK_MAX_CONCURRENT_COMMANDS` | Max parallel git commands (default: 32). Lower if hitting file descriptor limits. |
| `WORKTRUNK_VERBOSE` | Verbosity level (`0`/`1`/`2`), like `-v`/`-vv` but applied everywhere — including shell completion, which no flag can reach |
| `RUST_LOG` | Logging directive (e.g. `worktrunk=debug`); overrides the verbosity baseline for what reaches stderr |
| `NO_COLOR` | Disable colored output ([standard](https://no-color.org/)) |
| `CLICOLOR_FORCE` | Force colored output even when not a TTY |

## Inline config overrides (`--config-set`)

`--config-set <toml>` overrides any user config key for a single invocation. The value is a TOML fragment, so arrays and tables work directly; the flag is global (works before or after the subcommand), repeatable, and a later `--config-set` replaces an earlier one for the same key.

```console
$ wt --config-set list.full=true list
$ wt step copy-ignored --config-set 'step.copy-ignored.exclude=["target", "dist"]'
```

This composes with aliases — an alias body can invoke `wt --config-set … <command>` to render a named view without changing the saved config.

## Precedence

Sources closer to the invocation rank higher (user config above system config), and within a config file a [project entry](/config/#user-project-specific-settings) outranks the global key of the same name. So `worktree-path` comes from the first of these that sets it:

1. `--config-set 'worktree-path = …'`
2. `WORKTRUNK_WORKTREE_PATH`
3. `[projects."github.com/owner/repo"]` in the config file
4. global `worktree-path` in the config file

A `--config-set` that names a project entry is both the highest layer and the most specific key, so it beats the same flag's global key:

```console
$ wt --config-set 'projects."github.com/owner/repo".worktree-path = "/tmp/scratch"' switch --create feature
```

Hooks, aliases and `step.copy-ignored.exclude` accumulate rather than replace, so an env-set hook and a project's hook both run.

## Editor schemas

For validation and completion in editors that support TOML schemas (such as Taplo or Tombi), start the file with `#:schema https://worktrunk.dev/schema/user-config.json` (user config) or `#:schema https://worktrunk.dev/schema/project-config.json` (project config).

## Command reference

```text wt-command-reference
wt config - Manage user & project configs

Includes shell integration, hooks, and saved state.

Usage: wt config [OPTIONS] <COMMAND>

Commands:
  shell      Shell integration setup
  create     Create configuration file
  show       Show configuration files & locations
  update     Update deprecated config settings
  approvals  Manage command approvals
  alias      Inspect and preview aliases
  plugins    Plugin management
  state      Manage internal data and cache

Options:
  -h, --help
          Print help (see a summary with '-h')

Global Options:
  -C <path>
          Working directory for this command

      --config <path>
          User config file path

      --config-set <toml>
          Override config with inline TOML, e.g. --config-set list.full=true (repeatable)

  -v, --verbose...
          Verbose output (-v: template variables; -vv: debug logs)

  -y, --yes
          Skip approval prompts
```

# Subcommands

## wt config shell

Shell integration setup.

A subprocess cannot change its parent shell's directory. Shell integration defines a function that runs the Worktrunk binary, then changes the shell's directory when the command requests it. It also enables tab completion.

### Setup

```console
$ wt config shell install
```

Start a new shell after installation to load the wrapper. Invoke `wt` by name. Running a binary path or `git wt` bypasses the wrapper, so the shell's directory stays unchanged.

- `wt config shell install --help` — installation options
- `wt config shell init --help` — manual setup
- `wt config shell uninstall` — remove the integration

### Check the current shell

```console
$ wt config show
```

The SHELL INTEGRATION section reports whether the wrapper is active in the current session. Installation and activation are separate: a configured shell can still be running without the wrapper until its config is reloaded.

In bash, zsh, or fish, `type wt` checks that `wt` resolves to a function. In PowerShell, `Get-Command wt -All` lists the Function and Application definitions.

See [worktrunk.dev/shell-integration](/shell-integration/) for warning messages, installed files, and wrapper behavior.

### Command reference

```text wt-command-reference
wt config shell - Shell integration setup

Usage: wt config shell [OPTIONS] <COMMAND>

Commands:
  init        Generate shell integration code
  install     Write shell integration to config files
  uninstall   Remove shell integration from config files
  show-theme  Show output theme samples

Options:
  -h, --help
          Print help (see a summary with '-h')
```

## wt config shell init

Generate shell integration code.

Outputs shell code for `eval` or sourcing. Most users should run `wt config shell install` instead, which adds this automatically.

### Manual setup

For bash, fish, zsh, and PowerShell, add the matching line to the shell config. For Nushell, run the command to save the wrapper in its autoload directory.

Bash (~/.bashrc):
```console
$ eval "$(wt config shell init bash)"
```

Fish (~/.config/fish/config.fish):
```fish
wt config shell init fish | source
```

Zsh (~/.zshrc):
```zsh
eval "$(wt config shell init zsh)"
```

Nushell 0.113+ <span class="badge-experimental"></span> — save to vendor autoload directory:
```console
$ wt config shell init nu | save -f ($nu.vendor-autoload-dirs | last | path join wt.nu)
```

PowerShell ($PROFILE):
```powershell
Invoke-Expression (& wt config shell init powershell | Out-String)
```

### Command reference

```text wt-command-reference
wt config shell init - Generate shell integration code

Usage: wt config shell init [OPTIONS] <bash|fish|nu|zsh|powershell>

Arguments:
  <bash|fish|nu|zsh|powershell>
          Shell to generate code for

          [possible values: bash, fish, nu, zsh, powershell]

Options:
      --cmd <CMD>
          Command name for shell integration (defaults to binary name)

          Use this to create shell integration for an alternate command name. For example,
          --cmd=git-wt creates a git-wt shell function instead of wt, useful on Windows where wt
          conflicts with Windows Terminal.

  -h, --help
          Print help (see a summary with '-h')
```

## wt config shell install

Write shell integration to config files.

Appends an initialization line to bash, zsh, and PowerShell config files. For fish and Nushell, it replaces the autoloaded wrapper file; fish also gets a separate completion file. See [worktrunk.dev/shell-integration](/shell-integration/#files-created) for their locations.

### Examples

Install for all detected shells:
```console
$ wt config shell install
```

Install for specific shell only:
```console
$ wt config shell install zsh
```

Shows proposed changes and waits for confirmation before modifying any files.
Use --yes to skip confirmation.

### Command reference

```text wt-command-reference
wt config shell install - Write shell integration to config files

Usage: wt config shell install [OPTIONS] [bash|fish|nu|zsh|powershell]

Arguments:
  [bash|fish|nu|zsh|powershell]
          Shell to install (default: all)

          [possible values: bash, fish, nu, zsh, powershell]

Options:
      --dry-run
          Show what would be changed

      --cmd <CMD>
          Command name for shell integration (defaults to binary name)

          Use this to create shell integration for an alternate command name. For example,
          --cmd=git-wt creates a git-wt shell function instead of wt, useful on Windows where wt
          conflicts with Windows Terminal.

  -h, --help
          Print help (see a summary with '-h')
```

## wt config shell uninstall

Remove shell integration from config files.

Removes Worktrunk initialization lines from bash, zsh, and PowerShell config files, and Worktrunk wrapper and completion files for fish and Nushell.

### Examples

Uninstall from all shells:
```console
$ wt config shell uninstall
```

Uninstall from specific shell only:
```console
$ wt config shell uninstall zsh
```

Skip confirmation prompt:
```console
$ wt config shell uninstall --yes
```

### Version tolerance

Uninstall recognizes the standalone setup lines written by Worktrunk or shown in `wt config shell init --help`, including older generated forms and custom binary names. Customized initialization lines must be removed manually.

### Command reference

```text wt-command-reference
wt config shell uninstall - Remove shell integration from config files

Usage: wt config shell uninstall [OPTIONS] [bash|fish|nu|zsh|powershell]

Arguments:
  [bash|fish|nu|zsh|powershell]
          Shell to uninstall (default: all)

          [possible values: bash, fish, nu, zsh, powershell]

Options:
      --dry-run
          Show what would be changed

  -h, --help
          Print help (see a summary with '-h')
```

## wt config show

Show configuration files & locations.

Shows config sources and checks for invalid TOML or list columns, misplaced or
deprecated keys, and commands awaiting approval. It renders every section
before failing; warnings exit zero.

### Full diagnostics

Use `--full` to run diagnostic checks:

```console
$ wt config show --full
```

This tests:
- **CI tool status** — Whether the CLI for the repository's forge (`gh`, `glab`, `tea`, or `az`) is installed and authenticated
- **Commit generation** — Whether the LLM command can generate commit messages
- **Version check** — Whether a newer version is available on GitHub

### Command reference

```text wt-command-reference
wt config show - Show configuration files & locations

Usage: wt config show [OPTIONS]

Options:
      --full
          Run diagnostic checks (CI tools, commit generation, version)

  -h, --help
          Print help (see a summary with '-h')

Output:
      --format <FORMAT>
          Output format

          [default: text]
          [possible values: text, json]
```

## wt config update

Update deprecated config settings.

Updates deprecated settings in user and project config files
to their current equivalents, removes deprecated keys that have no equivalent,
and reports each one. Shows a diff and asks for confirmation.

### Examples

Preview and apply updates:
```console
$ wt config update
```

Apply without confirmation:
```console
$ wt config update --yes
```

Write the migrated config to a file instead of updating in place:
```console
$ wt config update --output migrated.toml
```

Print the migrated config:
```console
$ wt config update --output=-
```

### Command reference

```text wt-command-reference
wt config update - Update deprecated config settings

Usage: wt config update [OPTIONS]

Options:
      --output <PATH>
          Output migrated config (- for stdout)

  -h, --help
          Print help (see a summary with '-h')
```

## wt config approvals

Manage command approvals.

Project hooks and project aliases prompt for approval on first run to prevent untrusted projects from running arbitrary commands. Approvals from both flows are stored together.

### Examples

List commands and their approval status for current project:
```console
$ wt config approvals list
```

Pre-approve all hook and alias commands for current project:
```console
$ wt config approvals add
```

Pre-approve without prompting, for a container or CI job:
```console
$ wt config approvals add --yes
```

Clear approvals for current project:
```console
$ wt config approvals clear
```

Clear only approvals for commands no longer in the project config:
```console
$ wt config approvals clear --stale
```

Clear global approvals:
```console
$ wt config approvals clear --global
```

Check whether an unattended run would stop for approval:
```console
$ wt config approvals list --format=json | jq -r .state
```

### How approvals work

Approved commands are saved to `~/.config/worktrunk/approvals.toml`. Re-approval is required when the command template changes or the project moves.

`--yes` approves project commands for the current run without saving approval. `wt config approvals add --yes` saves approvals for future runs.

### Reading approval state

`wt config approvals list` reads the state without prompting or writing it, so an orchestrator can find out whether a non-interactive run will stop for approval before scheduling one. `--format=json` emits:

```json
{
  "state": "approval_required",
  "commands": [
    {"phase": "post-start", "name": "dev", "template": "npm run dev", "approved": false},
    {"phase": "pre-merge", "template": "cargo test", "approved": true}
  ],
  "stale": ["some removed command"]
}
```

`state` is `no_commands` (the project declares none), `approval_required` (at least one is unapproved), or `approved`. `name` is absent for an unnamed command and for the commit-template fragment.

`stale`, which can accompany any `state`, lists approvals whose command has since been edited or removed from the project config.

### Command reference

```text wt-command-reference
wt config approvals - Manage command approvals

Usage: wt config approvals [OPTIONS] <COMMAND>

Commands:
  list   List project commands and their approval status
  add    Store approvals in approvals.toml
  clear  Clear approved commands from approvals.toml

Options:
  -h, --help
          Print help (see a summary with '-h')
```

## wt config alias

Inspect and preview aliases.

Aliases are command templates configured in user (`~/.config/worktrunk/config.toml`) or project (`.config/wt.toml`) config and run as `wt <name>`. See the [Extending Worktrunk guide](/extending/#aliases) for the configuration format.

### Examples

Show every configured alias's template:
```console
$ wt config alias show
```

Show the template for `deploy`:
```console
$ wt config alias show deploy
```

Preview an invocation without running it:
```console
$ wt config alias dry-run deploy
$ wt config alias dry-run deploy -- --env=staging
```

### Command reference

```text wt-command-reference
wt config alias - Inspect and preview aliases

Usage: wt config alias [OPTIONS] <COMMAND>

Commands:
  show     Show an alias's template, or all aliases' templates
  dry-run  Preview an alias invocation with template expansion

Options:
  -h, --help
          Print help (see a summary with '-h')
```

## wt config state

Manage internal data and cache.

State is stored in `.git/` (config entries and log files), separate from configuration files.

### Keys

- **cache**: [Regenerable caches — CI status, summaries, git commands, hints, and the `wt switch -` target](/config/#wt-config-state-cache)
- **default-branch**: [The repository's default branch (`main`, `master`, etc.)](/config/#wt-config-state-default-branch)
- **marker**: [Custom status marker for a branch (shown in `wt list`)](/config/#wt-config-state-marker)
- **vars**: [Custom variables per branch](/config/#wt-config-state-vars)
- **logs**: [Operation and debug logs](/config/#wt-config-state-logs)

### Examples

Get the default branch:
```console
$ wt config state default-branch
```

Set the default branch manually:
```console
$ wt config state default-branch set main
```

Set a marker for current branch:
```console
$ wt config state marker set 🚧
```

Store arbitrary data:
```console
$ wt config state vars set env=staging
```

Drop the regenerable caches:
```console
$ wt config state cache clear
```

Show all stored state:
```console
$ wt config state get
```

Clear all stored state:
```console
$ wt config state clear
```

### Command reference

```text wt-command-reference
wt config state - Manage internal data and cache

Usage: wt config state [OPTIONS] <COMMAND>

Commands:
  get             Get all stored state
  clear           Clear all stored state
  cache           Regenerable caches
  default-branch  Default branch detection and override
  logs            Operation and debug logs
  marker          Branch markers
  vars            Custom variables per branch

Options:
  -h, --help
          Print help (see a summary with '-h')
```

## wt config state cache

Regenerable caches.

View or drop worktrunk's regenerable caches in one place. Everything here is rebuilt on demand — clearing only forces recomputation, never data loss.

### What's cached

- **CI status** — forge CI per branch (30–60s TTL), shown in [`wt list`](/list/#ci-status)
- **Summaries** — LLM-generated branch summaries (`wt list --full`, `wt switch` preview)
- **Git commands** — cached merge-tree, ancestry, diff-stat, and `wt switch` preview results
- **Status explanations** — explanations shown in the current `wt list` footer rotation
- **Hints** — one-time hints already shown in this repo
- **Previous branch** — the `wt switch -` target, re-recorded on the next switch

`cache clear` drops all of the above with no prompt. It re-shows one-time hints and forgets the `wt switch -` target until the next switch — both repopulate on their own.

Without a subcommand, runs `get`.

### Examples

Show cache contents:
```console
$ wt config state cache
```

Drop all caches:
```console
$ wt config state cache clear
```

### Command reference

```text wt-command-reference
wt config state cache - Regenerable caches

Usage: wt config state cache [OPTIONS] [COMMAND]

Commands:
  get    Show cache contents
  clear  Drop all caches

Options:
  -h, --help
          Print help (see a summary with '-h')

Output:
      --format <FORMAT>
          Output format (text, json) [default: text]
```

## wt config state default-branch

Default branch detection and override.

Useful in scripts to avoid hardcoding `main` or `master`:

```console
$ git rebase $(wt config state default-branch)
```

In a hook or alias template, prefer the `{{ default_branch }}` [template variable](/hook/#template-variables); `$(wt config state default-branch)` is for plain shell scripts.

Without a subcommand, runs `get`. `set` stores the override in the repository's local git config. The override adds no project file and applies to every linked worktree in the clone. `clear` then `get` re-detects. The branch must exist locally for `wt list` comparisons.

### Detection

Worktrunk detects the default branch automatically:

1. **Worktrunk cache** — Checks `git config worktrunk.default-branch`
2. **Git cache** — Detects primary remote and checks its HEAD (e.g., `origin/HEAD`)
3. **Remote query** — If not cached, queries `git ls-remote`, giving up after 10s
4. **Local inference** — If no remote, or the query was abandoned, infers from local branches

Once detected, the result is cached in `worktrunk.default-branch` — except a value inferred after the remote query was abandoned, so an outage can't make a guess permanent. A later change to `origin/HEAD` isn't picked up automatically: `wt config state` flags the mismatch, `set` adopts the new branch, and `clear` re-detects.

The local inference fallback uses these heuristics in order:
- If only one local branch exists, uses it
- For bare repos or empty repos, checks `symbolic-ref HEAD`
- Checks `git config init.defaultBranch`
- Looks for common names: `main`, `master`, `develop`, `trunk`

If none of these match, detection fails; set it explicitly with `wt config state default-branch set BRANCH`.

### Command reference

```text wt-command-reference
wt config state default-branch - Default branch detection and override

Usage: wt config state default-branch [OPTIONS] [COMMAND]

Commands:
  get    Get the default branch
  set    Set the default branch
  clear  Clear the default branch cache

Options:
  -h, --help
          Print help (see a summary with '-h')
```

## wt config state logs

Operation and debug logs.

View and manage log files — hook output, command audit trail, and debug diagnostics.

### What's logged

Three kinds of logs live in `.git/wt/logs/`:

#### Command log (`commands.jsonl`)

All hook executions and LLM commands are recorded automatically — one JSON object per line. Rotates to `commands.jsonl.old` at 1MB (~2MB total). Fields:

| Field | Description |
|-------|-------------|
| `ts` | ISO 8601 timestamp |
| `wt` | The `wt` command that triggered this (e.g., `wt hook pre-merge --yes`) |
| `label` | What ran (e.g., `pre-merge user:lint`, `commit.generation`) |
| `cmd` | Shell command executed |
| `exit` | Exit code (`null` for background commands) |
| `dur_ms` | Duration in milliseconds (`null` for background commands) |

The command log appends entries and is not branch-specific — it records all activity across all worktrees.

#### Hook output logs

Hook output lives in per-branch subtrees under `.git/wt/logs/{branch}/`:

| Operation | Log path |
|-----------|----------|
| Background hooks | `{branch}/{source}/{hook-type}/{name}.log` |
| Background removal | `{branch}/internal/remove.log` |

All `post-*` hooks (post-start, post-switch, post-commit, post-merge, post-remove) run in the background and produce log files. Source is `user` or `project`. Branch and hook names are sanitized for filesystem safety. Same operation on same branch overwrites the previous log. Removing a branch clears its subtree; orphans from deleted branches can be swept with `wt config state logs clear`.

#### Diagnostic files

| File | Created when |
|------|-------------|
| `trace.log` | Running with `-vv` |
| `trace.jsonl` | Running with `-vv` |
| `subprocess.log` | Running with `-vv` |
| `diagnostic.md` | Running with `-vv` |

`trace.log` is the human-readable trace of commands and their timings. `trace.jsonl` holds the same events as JSON lines, which `wt config state logs profile` summarizes into a performance report. `subprocess.log` holds full subprocess output. `diagnostic.md` is a bug-report bundle; `wt` prints a `gh gist create` command for it. All four are overwritten on each `-vv` run.

### Location

All logs are stored in `.git/wt/logs/` (in the main worktree's git directory). All worktrees write to the same directory.

### Structured output

`wt config state logs --format=json` emits three arrays — `command_log`, `hook_output`, `diagnostic`. Each entry carries a `file` (relative), `path` (absolute), `size`, and `modified_at` (unix seconds). Hook-output entries additionally expose `branch`, `source` (`user` / `project` / `internal`), `hook_type` (the `post-*` kind, or `null` for internal ops), and `name`. `branch` is the branch name, or `null` when no local branch writes to that log directory (e.g. the branch was deleted). `name` is the hook name as it appears in the log path, which differs from the configured name only when that contains characters unsafe in a filename. Filter with `jq` to pick out a specific entry.

### Examples

List all log files:
```console
$ wt config state logs
```

Query the command log:
```console
$ tail -5 .git/wt/logs/commands.jsonl | jq .
```

Path to one hook log (e.g. the `post-start` `server` hook for the current branch):
```console
$ wt config state logs --format=json | jq -r --arg branch "$(git branch --show-current)" '.hook_output[] | select([.branch, .source, .hook_type, .name] == [$branch, "user", "post-start", "server"]) | .path'
```

Logs for a specific branch:
```console
$ wt config state logs --format=json | jq '.hook_output[] | select(.branch == "feature/auth")'
```

Clear all logs:
```console
$ wt config state logs clear
```

### Command reference

```text wt-command-reference
wt config state logs - Operation and debug logs

Usage: wt config state logs [OPTIONS] [COMMAND]

Commands:
  get      List all log file paths
  profile  Performance profile from a trace
  clear    Clear all log files

Options:
  -h, --help
          Print help (see a summary with '-h')

Output:
      --format <FORMAT>
          Output format (text, json) [default: text]
```

## wt config state marker

Branch markers.

Custom status text or emoji shown in the `wt list` Status column.

### Display

Markers appear at the end of the Status column, after git symbols:

```console
$ wt list
  Branch       Status       @±        ^↕        ^…±     Remote⇅  Commit    Age  Message
@ main             ^⇡                                    ⇡1      33323bc    1d  Initial commit
+ feature-api      ↑ 🤖              ↑1        +1                70343f0    1d  Add REST API endpo…
+ review-ui      ? ↑ 💬    +1        ↑1        +1                a585d6e    1d  Add dashboard comp…
+ wip-docs       ? –       +1                                    33323bc    1d  Initial commit

○ Showing 4 worktrees, 2 with changes, 2 ahead, hidden: Path  (^ main worktree  ⇡ ahead of remote)
```

### Use cases

- **Work status** — `🚧` WIP, `✅` ready for review, `🔥` urgent
- **Agent tracking** — [Agent plugins](/claude-code/) set markers automatically
- **Notes** — Any short text: `"blocked"`, `"needs tests"`

### Storage

Stored in git config as `worktrunk.state.<branch>.marker`. Set directly with:

```console
$ git config worktrunk.state.feature.marker '{"marker":"🚧","set_at":0}'
```

When `wt` deletes a branch or `wt switch --create` creates one, it clears that branch's marker. A branch deleted and recreated with plain `git` keeps its marker until `wt config state marker clear`.

Without a subcommand, runs `get` for the current branch. For `--branch`, use `get --branch=NAME`.

### Command reference

```text wt-command-reference
wt config state marker - Branch markers

Usage: wt config state marker [OPTIONS] [COMMAND]

Commands:
  get    Get marker for a branch
  set    Set marker for a branch
  clear  Clear marker for a branch

Options:
  -h, --help
          Print help (see a summary with '-h')

Output:
      --format <FORMAT>
          Output format (text, json) [default: text]
```

## wt config state vars

Custom variables per branch.

Store custom variables per branch. Values are stored as-is — plain strings or JSON.

### Examples

Set and get values:
```console
$ wt config state vars set env=staging
$ wt config state vars get env
```

Store JSON:
```console
$ wt config state vars set config='{"port": 3000, "debug": true}'
```

List all keys:
```console
$ wt config state vars list
```

Operate on a different branch:
```console
$ wt config state vars set env=production --branch=main
```

### Template access

Variables are available in [hook templates](/hook/#template-variables) as `{{ vars.<key> }}`. Use the `default` filter for keys that may not be set:

```toml
# .config/wt.toml
[post-start]
dev = "ENV={{ vars.env | default('development') }} npm start -- --port {{ vars.port | default('3000') }}"
```

JSON object and array values support dot access:

```console
$ wt config state vars set config='{"port": 3000, "debug": true}'
```
```toml
# .config/wt.toml
[post-start]
dev = "npm start -- --port {{ vars.config.port }}"
```

### Storage format

Stored in git config as `worktrunk.state.<branch>.vars.<key>`. Keys start with a lowercase letter and contain only lowercase letters, digits, and hyphens.

### Command reference

```text wt-command-reference
wt config state vars - Custom variables per branch

Usage: wt config state vars [OPTIONS] <COMMAND>

Commands:
  get    Get a value
  list   List all keys
  set    Set a value
  clear  Clear a key or all keys

Options:
  -h, --help
          Print help (see a summary with '-h')
```

---

### Src Content Docs Extending (`docs/src/content/docs/extending.md`)

---
title: "Extending Worktrunk"
description: "Three ways to add custom behavior: hooks for lifecycle automation, aliases for reusable commands, and custom subcommands for standalone tools."
sidebar:
  order: 22
---
| | [Hooks](#hooks) | [Aliases](#aliases) | [Custom subcommands](#custom-subcommands) |
|---|---|---|---|
| **Trigger** | Automatic (lifecycle events) | Manual (`wt <name>`) | Manual (`wt <name>`) |
| **Defined in** | TOML config | TOML config | Any executable on `PATH` |
| **Template variables** | Yes | Yes | No |
| **Shareable via repo** | `.config/wt.toml` | `.config/wt.toml` | Distribute the binary |
| **Language** | Shell commands | Shell commands | Any |

Hooks and aliases live in the same TOML config and share the [template engine](/hook/#template-variables). User config is trusted; project config requires approval on first run. When both define the same name, both run (user first).

## Hooks

Ten hooks cover five lifecycle events — switch, start, commit, merge, remove — each with a blocking `pre-` variant (failure aborts the operation) and a background `post-` variant. [`wt hook`](/hook/#hook-types) maps each hook to its timing and typical uses.

```toml
# .config/wt.toml
[pre-start]
deps = "npm ci"

[post-start]
server = "npm run dev -- --port {{ branch | hash_port }}"

[pre-merge]
test = "npm test"
```

See [`wt hook`](/hook/) for the full reference and built-in recipes (dev server per worktree, database per worktree, progressive validation). [Tips & Patterns](/tips-patterns/) has more.

## Aliases

Aliases are configured under `[aliases]`, in project or user config:

```toml
# .config/wt.toml
[aliases]
deploy = "fly deploy --config=fly.{{ env }}.toml --app=myproject-{{ branch }}"
open = "open http://localhost:{{ branch | hash_port }}"
since-main = "git log --oneline {{ default_branch }}..HEAD"
```

```bash
wt deploy --env=staging
wt open
```

`wt <name>` resolves to a built-in first, then an alias, then a [custom subcommand](#custom-subcommands).

### Templates

Aliases use the same [template engine as hooks](/hook/#template-variables): variables, [filters](/hook/#worktrunk-filters), [functions](/hook/#worktrunk-functions), and [`--KEY=VALUE` smart routing](/hook/#passing-values) (bind if the template references `KEY`, else forward to `{{ args }}`). For example, `wt deploy --env=staging` sets `{{ env }}`.

Alias templates add `{{ args }}` for positional CLI arguments. Operation-context variables (`target`, `base`, `pr_number`) aren't auto-populated, but can still be bound with `--KEY=VALUE`.

### Positional arguments

`{{ args }}` renders as a space-joined, shell-escaped string, ready to splice into a command:

```toml
# ~/.config/worktrunk/config.toml
[aliases]
s = "wt switch {{ args }}"
```

```bash
wt s some-branch
wt s feature/api
wt s 'has a space'
```

For indexing (`{{ args[0] }}`), looping, and counting, see [Passing values](/hook/#passing-values).

Tokens after `--` forward unconditionally, bypassing any binding. Writing `wt deploy -- --branch=foo` forwards the literal `--branch=foo` to `{{ args }}` even though the template references `{{ branch }}`.

An alias that forwards `{{ args }}` to a `wt` command — like `co = "wt switch {{ args }}"` or `cm = "wt step commit {{ args }}"` — inherits that command's argument and flag completion, so `wt co <Tab>` completes branches the same way `wt switch <Tab>` does.

### Inspecting and previewing

- `wt config alias show <name>` prints the template.
- `wt config alias dry-run <name> [-- args...]` prints the rendered command.

```bash
wt config alias show deploy
wt config alias dry-run deploy
wt config alias dry-run deploy -- --env=staging
```

### Multi-step pipelines

`[[aliases.NAME]]` defines a pipeline using the [same `[[block]]` semantics as hooks](/hook/#hook-forms): blocks run in order, keys within a block run concurrently, and a step failure aborts the remainder.

```toml
# .config/wt.toml
[[aliases.release]]
test = "cargo test"

[[aliases.release]]
build = "cargo build --release"
package = "cargo package --no-verify"

[[aliases.release]]
publish = "cargo publish {{ args }}"
```

Every step sees the same `{{ args }}` and bound variables. `wt release -- --dry-run` forwards `--dry-run` to `publish` without affecting earlier steps.

### Changing directory

`wt switch`, `wt merge` (when it leaves the removed source), and `wt remove` of the current worktree change the parent shell's directory even when invoked from an alias; the Worktrunk shell integration propagates the change through. Other shell state doesn't persist: the alias runs in a subshell, so `cd`, `export`, and similar commands only affect that subshell.

### Nesting templates

An alias that calls a `wt` command may want to pass it a template for that command to expand — each worktree's own branch, or the worktree `wt switch` is about to create:

```toml
# ~/.config/worktrunk/config.toml
[aliases]
show-branches = "wt step for-each -- echo '{% raw %}{{ branch }}{% endraw %}'"
echo-target = "wt switch {{ args }} --no-cd --execute echo -- '{% raw %}{{ worktree_path }}{% endraw %}'"
```

An alias body renders once, at dispatch, so a bare `{{ branch }}` would reach the nested command already resolved to the invoking worktree's branch. `{% raw %}…{% endraw %}` passes it through unrendered instead. Quote it — the deferred text contains spaces, and the alias body is a shell command line.

Repo-level variables like `{{ default_branch }}` are identical in every worktree, so they need no deferral.

### Recipe: rebase every worktree onto its upstream

```toml
# ~/.config/worktrunk/config.toml
[aliases]
up = '''
git fetch --all --prune; wt step for-each -- sh -c '
  git rev-parse --verify -q @{u} >/dev/null || exit 0
  g=$(git rev-parse --git-dir)
  rebasing() { test -d "$g/rebase-merge" || test -d "$g/rebase-apply"; }
  rebasing && exit 0
  git diff --quiet HEAD || { git merge --ff-only --no-autostash @{u}; exit 0; }
  git rebase @{u} --no-autostash || { rebasing || exit 0; git rebase --abort; }
''''
```

`wt up` fetches every remote, then brings each worktree up to date with its upstream: skip if there is no upstream or a rebase is already in progress, fast-forward if a tracked file is modified or staged, otherwise rebase, aborting on conflict. It rebases onto git-native `@{u}` rather than a `{{ … }}` template, so git resolves each worktree's own upstream and there is nothing to defer.

`--no-autostash` overrides a global `rebase.autostash` or `merge.autostash`, whose conflicting pop would leave conflict markers behind and still exit 0.

### Recipe: move or copy in-progress changes to a new worktree

`wt switch --create` lands you in a clean worktree. To carry staged, unstaged, and untracked changes along, pair it with `git stash`:

```toml
# .config/wt.toml
[aliases]
move-changes = '''
if git diff --quiet HEAD && test -z "$(git ls-files --others --exclude-standard)"; then
  wt switch --create {{ to }} --execute sh -- -c \
    'if [ "$#" -gt 0 ]; then exec "$@"; fi' worktrunk-move {{ args }}
else
  git stash push --include-untracked --quiet || exit
  wt switch --create {{ to }} --execute sh -- -c \
    'git stash pop --index || exit; if [ "$#" -gt 0 ]; then exec "$@"; fi' worktrunk-move {{ args }}
fi
'''
```

Run with `wt move-changes --to=feature-xyz`. The guard skips the stash when nothing is in flight; otherwise `git stash push` captures everything and the explicit `sh -c` step pops it in the new worktree with the staged/unstaged split intact. Anything after `--` is forwarded as argv and runs in the new worktree after pop. For example, `wt move-changes --to=feature-xyz -- claude` opens Claude there.

To copy instead of move, add `git stash apply --index --quiet` right after the push.

### Recipe: tail a specific hook log

`wt config state logs --format=json` emits structured entries (`branch`, `source`, `hook_type`, `name`, `path`). Pipe through `jq` to resolve one entry, then wrap in an alias for quick access:

```toml
# ~/.config/worktrunk/config.toml
[aliases]
hook-log = '''
tail -f "$(wt config state logs --format=json | jq -r --arg branch {{ branch }} --arg name {{ name | sanitize_hash }} --arg kind {{ kind }} '
  .hook_output[]
  | select([.branch, .hook_type, .name] == [$branch, $kind, $name])
  | .path
' | head -1)"
'''
```

Run with `wt hook-log --kind=post-start --name=server` to tail the log for the `server` hook on the current branch. `--kind` picks the hook type; the branch is pulled from the current worktree via `{{ branch }}`. `branch` in the JSON is the branch name itself, while `name` is the hook name as it appears on disk; `sanitize_hash` applies the same transformation to `{{ name }}`, so the alias resolves the right log even when the hook name contains characters like `/`.

## Custom subcommands

<span class="badge-experimental"></span>

Any executable named `wt-<name>` on `PATH` becomes available as `wt <name>`, the same pattern git uses for `git-foo`. Built-in commands and [aliases](#aliases) take precedence.

```bash
wt sync origin              # runs: wt-sync origin
wt -C /tmp/repo sync        # -C is forwarded as the child's working directory
```

Arguments pass through verbatim, stdio is inherited, and the child's exit code propagates unchanged.

### Examples

- [`worktrunk-sync`](https://github.com/pablospe/worktrunk-sync): rebases stacked worktree branches in the dependency order inferred from git history. Install with `cargo install worktrunk-sync`, then run as `wt sync`.
- [`workz`](https://github.com/rohansx/workz): provisions the current worktree with a collision-free port range plus its own database and Docker Compose project, merged into `.env.local`, so parallel worktrees don't clash. Install with `cargo install workz`, drop its [`wt-workz`](https://github.com/rohansx/workz/blob/main/examples/wt-workz) adapter on `PATH`, then run as `wt workz`.
- [`wt-tui`](https://github.com/marcusjihansson/worktrunk-tui): a terminal dashboard of every worktree with live updates, cross-worktree search, and diff and log previews; create, merge, remove, and prune run through `wt` behind confirmation dialogs. Install with `cargo install --git https://github.com/marcusjihansson/worktrunk-tui`, then run as `wt tui`.

## Reference: hooks vs. aliases

Aside from the differences below, hooks and aliases behave the same.

<details>
<summary>Interface differences</summary>

| Axis | Hooks | Aliases |
|------|-------|---------|
| Invocation | `wt hook <type> [args...]` (nested under the `hook` built-in) | `wt <name> [args...]` (top-level) |
| Bare positionals | Filter names (`wt hook pre-merge test build` runs only `test` and `build`) | Forwarded to `{{ args }}` |
| Reach `{{ args }}` from positionals | Must use `--` (`wt hook pre-merge -- extra`) | Any bare positional lands there |
| Approval skip flag | Post-subcommand `--yes` / `-y` supported (`wt hook pre-merge --yes`) | Only the global form (`wt -y <alias>`); post-alias `--yes` falls through to `{{ args }}` |
| Source discrimination | `user:` / `project:` / `user:name` / `project:name` filter syntax | Run user first, then project; no filter syntax |
| `--help` | `wt hook --help` lists hook types; `wt hook <type> --help` shows flags and arguments for that type | An alias whose template references `{{ args }}` or `{{ help }}` takes `--help` and `-h` like any other argument and runs, every pipeline step included, so `wt sw --help` with `sw = "wt switch {{ args }}"` shows `wt switch --help`. Other aliases print how to inspect them (`wt config alias show` / `dry-run`) without running. `wt --help` and `wt step --help` list configured aliases alongside built-in commands |
| Inspection | `wt hook show [type] [--expanded]` | `wt config alias show <name>` / `wt config alias dry-run <name>` |
| Stdin | A command running alone in the foreground inherits wt's stdin; concurrent and background commands get empty stdin ([Interactive hooks](/hook/#interactive-hooks)) | A command running alone inherits wt's stdin; concurrent commands get empty stdin |
| Template-context extras | `hook_type`, `hook_name`, per-type operation vars (`base`, `target`, `pr_number`, …) | `args` on top of the shared base variables |

</details>

---

### Src Content Docs Faq (`docs/src/content/docs/faq.md`)

---
title: "FAQ"
description: "Common questions about Worktrunk: comparison to git worktree and branch switching, bare repos, TUI support, and more."
sidebar:
  order: 26
---
## How does Worktrunk compare to alternatives?

### vs. branch switching

Branch switching uses one directory: uncommitted changes from one agent get mixed with the next agent's work, or block switching entirely. Worktrees give each agent its own directory with independent files and index.

### vs. Plain `git worktree`

Git's built-in worktree commands work but require manual lifecycle management:

```console
# Plain git worktree workflow
$ git worktree add -b feature-auth ../myproject.feature-auth main
$ cd ../myproject.feature-auth
# ...work, commit, push...
$ cd ../myproject
$ git merge feature-auth
$ git worktree remove ../myproject.feature-auth
$ git branch -d feature-auth
```

Worktrunk automates the full lifecycle:

```console
$ wt switch --create feature-auth  # Creates worktree, runs setup hooks
# ...work...
$ wt merge                            # Merges into default branch, cleans up
```

No cd back to main — `wt merge` runs from the feature worktree and merges into the target, like GitHub's merge button.

What `git worktree` doesn't provide:

- Consistent directory naming and cleanup validation
- Project-specific automation (install dependencies, start services)
- Unified status across all worktrees (commits, CI, conflicts, changes)

### vs. git-machete / git-town

Different scopes:

- **git-machete**: Branch stack management in a single directory
- **git-town**: Git workflow automation in a single directory
- **worktrunk**: Multi-worktree management with hooks and status aggregation

These tools can be used together—run git-machete or git-town inside individual worktrees.

### vs. Git TUIs (lazygit, gh-dash, etc.)

Git TUIs operate on a single repository. Worktrunk manages multiple worktrees, runs automation hooks, and aggregates status across branches. TUIs work inside each worktree directory.

## How much disk do worktrees use?

Worktrees share one `.git`. Each adds a checkout of the tracked files, plus whatever gitignored build output you copy in.

On APFS, btrfs, and XFS (not ext4 or NTFS), [`wt step copy-ignored`](/step/#wt-step-copy-ignored--copy-on-write) reflinks that output, so a new worktree shares the primary worktree's disk blocks. A later build rewrites only what changed, and the rest stays shared.

## Does Worktrunk support stacked branches?

Not natively — stacked-branch workflows are a large design space, so Worktrunk treats them as an extension rather than a built-in. [`worktrunk-sync`](https://github.com/pablospe/worktrunk-sync) is a community tool that auto-detects the branch dependency tree from git history and rebases each branch onto its parent in topological order. Install with `cargo install worktrunk-sync` and run as `wt sync` (via [custom subcommands](/extending/#custom-subcommands)).

## How do I move uncommitted changes to a new worktree?

Stash the changes, create the worktree, then pop:

```bash
git stash push -u           # -u also stashes untracked files
wt switch --create feature  # new branch off the default branch
git stash pop               # changes reappear in the new worktree
```

The stash lives in the shared `.git` directory, so it's reachable from the new worktree. The original branch is left clean.

`wt switch --create` bases the new branch on the default branch. To base it on the current commit instead, pass `--base=@` (needed when the current branch has commits beyond the default branch).

## There's an issue with my shell setup

If shell integration isn't working (auto-cd not happening, completions missing, `wt` not found as a function), work through the [shell integration](/shell-integration/#debugging-checklist) debugging checklist — it covers each warning `wt switch` prints and what to check for every shell.

Or hand it to an agent: install the [Worktrunk plugin](/claude-code/) in Claude Code and ask it to debug the Worktrunk shell integration. It runs `wt config show`, inspects the shell config files, and identifies the issue.

If neither settles it, please [open an issue](https://github.com/max-sixty/worktrunk/issues/new?title=Shell%20setup%20issue&body=%23%23%20Shell%20and%20OS%0A%0A-%20Shell%3A%20%0A-%20OS%3A%20%0A%0A%23%23%20Output%20of%20%60wt%20config%20show%60%0A%0A%60%60%60%0A%0A%60%60%60%0A%0A%23%23%20What%20Claude%20found%20%28if%20available%29%0A%0A) with the output of `wt config show`, the shell (bash/zsh/fish), and OS. (And even if it fixes the problem, feel free to open an issue: non-standard success cases are useful for ensuring Worktrunk is easy to set up for others.)

## What does `-v` / `-vv` do?

Three verbosity levels. Each is a superset of the previous one.

| Level | Stderr | Files (`.git/wt/logs/`) | Use case |
|-------|--------|-------------------------|----------|
| (none) | Warnings only | — | Normal use |
| `-v` | + Info: hook output, alias template variable resolution | — | Debugging hooks/aliases |
| `-vv` | Same as `-v` | + `trace.log`, `trace.jsonl`, `subprocess.log`, `diagnostic.md` | Filing a bug |

With `-vv`, stderr shows the log directory. See [`wt config state logs`](/config/#wt-config-state-logs) for the file formats.

`RUST_LOG` overrides the flag baseline when set (`RUST_LOG=debug wt -v` lifts `-v` to debug-on-stderr).

The flags only reach a command you type; shell completion runs as its own process with nowhere to pass one. Set `WORKTRUNK_VERBOSE=0|1|2` to apply the level to *every* invocation, completion included — it's the env-var equivalent of `-v`/`-vv`, so level 2 writes the same `trace.log`/`trace.jsonl`/`subprocess.log`/`diagnostic.md` files. An explicit `-v`/`-vv` on a command raises the level further but never lowers this baseline. To profile a slow tab-completion, run it the way your shell does — e.g. `WORKTRUNK_VERBOSE=2 COMPLETE=fish wt -- wt switch ''` — then render the result with `wt config state logs profile`.

## What files does Worktrunk create?

### 1. Worktree directories

Created by `wt switch <branch>` when switching to a branch that doesn't have a worktree. Use `wt switch --create <branch>` to create a new branch. Default location is `../<repo>.<branch>` (sibling to the main worktree), configurable via `worktree-path` in user config.

**To remove:** `wt remove <branch>` removes the worktree directory and deletes the branch if it's merged.

### 2. Config files

| File | Created by | Purpose |
|------|------------|---------|
| `~/.config/worktrunk/config.toml` | `wt config create` | User preferences |
| `~/.config/worktrunk/approvals.toml` | Approving project commands | Approved hook and alias commands |
| `~/.codex/worktrunk-commit-instructions.txt` | Accepting first-run Codex commit setup | Minimal Codex instructions used by the saved commit command |
| `.config/wt.toml` | `wt config create --project` | Project hooks (checked into repo) |

User config location: `$XDG_CONFIG_HOME/worktrunk/` (or `~/.config/worktrunk/`) on Linux/macOS, `%APPDATA%\worktrunk\` on Windows.

**To remove:** Delete directly. User config: `rm ~/.config/worktrunk/config.toml`. Project config: `rm .config/wt.toml` (and commit). Codex instructions: `rm ~/.codex/worktrunk-commit-instructions.txt` after changing or removing the saved Codex commit command. That command fails if the file is removed first.

### 3. Shell integration

`wt config shell install` appends a line to the bash, zsh, and PowerShell rc files, and writes worktrunk's own wrapper and completion files whole for fish and Nushell. [Shell integration](/shell-integration/#files-created) names the file each shell gets.

**To remove:** `wt config shell uninstall`.

### 4. Metadata in `.git/` (automatic)

Worktrunk stores repository state, caches, and logs under `.git/`:

| Location | Purpose | Created by |
|----------|---------|------------|
| `git config worktrunk.*` | Cached default branch, branch markers, custom variables | Various commands |
| `.git/wt/switch-history.json` | The worktree `wt switch -` returns to | `wt switch` |
| `refs/wt-backup/<branch>` | [Squash backups](/step/#wt-step-squash--recovering-staged-changes) and backups of changes discarded by `wt remove --force`; preserved by state clearing | `wt step squash`, `wt merge`, `wt remove --force` |
| `.git/wt/cache/{kind}/*.json` | Cached CI status, the largest PR/MR number seen (sizes the `wt list` CI column), and git command results (merge-tree, integration probes, diff stats, ancestry checks, ahead/behind counts, merge bases) | `wt list`, `wt merge`, `wt remove` |
| `.git/wt/cache/summary/{branch}/{hash}.json` | Cached LLM branch summaries, content-addressed by diff hash | `wt list --full`, `wt switch` (when `[list] summary = true`) |
| `.git/wt/cache/status-explanations/shown.json` | Status explanations shown in the current footer rotation | `wt list` |
| `.git/wt/cache/picker-preview/*.json` | Rendered preview panes for the interactive picker | `wt switch` |
| `.git/wt/logs/{branch}/**/*.log` | Background hook output (nested per branch) | Hooks, background `wt remove` |
| `.git/wt/logs/commands.jsonl` | Command audit log (~2MB max) | Hooks, LLM commands |
| `.git/wt/logs/trace.log` | Human debug trace for issue reporting | Running with `-vv` |
| `.git/wt/logs/trace.jsonl` | Machine trace (one JSON object per record) | Running with `-vv` |
| `.git/wt/logs/subprocess.log` | Raw uncapped subprocess stdout/stderr (may be multi-MB) | Running with `-vv` |
| `.git/wt/logs/diagnostic.md` | Diagnostic report for issue reporting (leads with the performance profile) | Running with `-vv` |
| `.git/wt/trash/<name>-<timestamp>` | Staged worktree contents pending background deletion | `wt remove` |
| `.git/wt/trash.lock` | Lock for background trash deletion | `wt remove` |

None of this is tracked by git or pushed to remotes.

**To remove:** `wt config state clear` removes repository state: config keys, caches, markers, hints, variables, logs, and stale trash. It prompts before removing anything worktrunk can't recompute, unless you pass `--yes`.

### 5. Agent integrations

Created by the `wt config plugins <agent>` install commands. Each writes outside worktrunk's own config directory, into the agent's:

| File | Created by | Purpose |
|------|------------|---------|
| `~/.config/opencode/plugins/worktrunk.ts` | `wt config plugins opencode install` | Activity markers in `wt list`; OpenCode 2 worktrees through `wt` |
| `~/.pi/agent/extensions/worktrunk.ts` | `wt config plugins pi install` | Activity markers in `wt list` |
| `~/.omp/agent/hooks/pre/worktrunk.ts` | `wt config plugins omp install` | Activity markers in `wt list` |
| `~/.claude/settings.json` | `wt config plugins claude install-statusline` | Adds a `statusLine` entry running `wt list statusline --format=claude-code` |

The OpenCode path follows `$OPENCODE_CONFIG_DIR` > `$XDG_CONFIG_HOME/opencode` > `~/.config/opencode`; the Pi path follows `$PI_CODING_AGENT_DIR`; the oh-my-pi path follows `$PI_CONFIG_DIR`, `$OMP_PROFILE`/`$PI_PROFILE`, and `$PI_CODING_AGENT_DIR`; Claude Code's follows `$CLAUDE_CONFIG_DIR`. The three plugin files are worktrunk's own, so install writes them whole (and uninstall removes them whole). `settings.json` belongs to Claude Code, so install merges the `statusLine` key into it and leaves the rest untouched.

`wt config plugins claude install` and `wt config plugins codex install` write nothing themselves — they run `claude` / `codex` to register the marketplace and install the plugin, and each CLI records that in its own config (`~/.claude/plugins/`, `~/.codex/config.toml`).

**To remove:** `wt config plugins opencode uninstall`, `wt config plugins pi uninstall`, and `wt config plugins omp uninstall` delete their plugin file. `wt config plugins claude uninstall` / `codex uninstall` remove the plugin and marketplace through that CLI. The statusline entry is removed by editing `settings.json`.

### 6. Temporary files (automatic)

Worktrunk creates temporary Git index copies inside `$TMPDIR/worktrunk-temp-index-*` directories. `wt list`, `wt list statusline`, `wt step diff`, `wt step commit --dry-run`, `wt step squash --dry-run`, and `wt switch` use them to inspect staged or working-tree state without changing the real index; `wt remove --force` uses them to back up uncommitted changes. `wt list` also creates a `$TMPDIR/worktrunk-list-objects-*` directory so its merge probes do not add unreachable objects to the repository. When the system temp directory is unavailable, both fall back to Git's metadata: `worktrunk-list-objects-*` under the Git common directory and `worktrunk-temp-index-*` under the worktree's Git directory. A normal exit removes these directories. Later commands that create a temporary index reclaim abandoned index directories older than one hour, preserving indexes still in use; object directories left by an interrupted process may still need manual cleanup.

### What Worktrunk does NOT create

- No files outside the six sections above: `.git/`, worktrunk's config directory, worktree directories, the shell startup files and wrapper paths of section 3, the agent config paths of section 5 (only when you run a `wt config plugins` install), and the system temporary directory
- No global git hooks
- No modifications to `~/.gitconfig`
- No long-running background processes or daemons

## What can Worktrunk delete?

Worktrunk can delete **worktrees** and **branches**. Both have safeguards.

### Worktree removal

`wt remove` mirrors `git worktree remove`: it refuses to remove worktrees with uncommitted changes (staged, modified, or untracked files). The `--force` flag removes the worktree anyway, after saving those changes (except ignored files and changes inside submodules) to `refs/wt-backup/<branch>` and printing a command to recover them.

Removal also refuses, `--force` included, when the directory at a registered path no longer holds the worktree registered there — a clone made there after the worktree was deleted, say, or another worktree of the same repository moved onto the path. `--force` waives uncommitted changes, not the check for what the directory holds, and `git worktree remove` refuses the same cases.

It also refuses, `--force` included, a worktree whose directory contains another registered worktree, since that checkout would go with it; remove the nested worktree first. `wt step prune` skips such a worktree.

To protect a worktree from removal entirely (say it holds a local database), lock it:

```bash
git worktree lock ../myproject.feature-auth --reason "Contains local database"
```

Locked worktrees show `⊞` in `wt list`. Neither `git worktree remove` nor any Worktrunk removal path — `wt remove` or `wt merge` — will delete them, even with `--force`. Unlock with `git worktree unlock`.

### Branch deletion

By default, `wt remove` only deletes branches whose content is already in the default branch. Branches showing `_` (same commit, clean) or `⊂` (integrated) in `wt list` are safe to delete.

For the full algorithm, see [Branch cleanup](/remove/#branch-cleanup) — it handles squash-merge and rebase workflows where commit history differs but file changes match.

Use `-D` to force-delete branches with unmerged changes. Use `--no-delete-branch` to keep the branch regardless of status.

A branch checked out in a second worktree is retained regardless, `-D` included. Deleting it would leave that worktree unable to resolve `HEAD`; only `git worktree add --force` produces that state.

Deleting a branch also clears its [marker](/config/#wt-config-state-marker), so a later branch with the same name starts without one.

### Other cleanup

- `wt merge` / `wt step push` — the target branch's checked-out worktree is updated to the merged commits, so a file those commits delete disappears from it, and an ignored file at a path they track is overwritten — the same result a `git merge` run in that worktree would produce. Uncommitted changes at paths the merge doesn't touch stay in place, staged or not; one at a path it does touch refuses the merge upfront, naming the file
- `wt remove` / `wt step prune` — unregister a stale worktree (`⊟` in `wt list`) by deleting its `.git/worktrees/<id>` entry, as `git worktree prune` does, but for that worktree only. Files still in its directory stay. An entry whose index holds staged changes, or with a rebase, merge, or other operation in progress, is kept unless `wt remove --force` names it, since `git worktree repair` can restore it only while the entry exists
- `wt remove` — also stops the removed worktree's `git fsmonitor--daemon` (under `core.fsmonitor=true`), and resumes deleting `.git/wt/trash/` entries an interrupted removal left behind, along with fsmonitor daemons whose worktree no longer exists
- `wt config state clear` — clears config keys, caches, markers, hints, variables, logs, and stale trash
- `wt config shell install` — replaces an existing fish or Nushell wrapper file whole, and removes one an older version installed at a previous location (fish `conf.d/wt.fish`, Nushell `<config-dir>/vendor/autoload/wt.nu`), printing each removal; [Files created](/shell-integration/#files-created) names the file each shell gets
- `wt config shell uninstall` — removes recognized initialization lines from bash/zsh/PowerShell rc files, and deletes wrapper and completion files carrying worktrunk's content markers (fish `functions/`, `conf.d/`, and `completions/`; nushell `vendor/autoload`). Customized initialization lines must be removed manually. Every removed line is printed
- `wt config plugins opencode uninstall` / `wt config plugins pi uninstall` / `wt config plugins omp uninstall` — deletes that agent's `worktrunk.ts` plugin file. Only worktrunk's own file is touched; the rest of the agent's plugin directory is left alone

See [What files does Worktrunk create?](#what-files-does-worktrunk-create) for details.

## What commands does Worktrunk execute?

Worktrunk runs `git` commands internally and optionally runs the forge CLI (`gh`, `glab`, `tea`, or `az`) for CI status and PR/MR lookups. Beyond that, user-defined commands execute in four contexts:

1. **User hooks** (`~/.config/worktrunk/config.toml`) — Personal automation for all repositories
2. **Project hooks** (`.config/wt.toml`) — Repository-specific automation
3. **LLM commands** (`~/.config/worktrunk/config.toml`) — Commit message generation and [branch summaries](/llm-commits/#branch-summaries)
4. **--execute flag** — Explicitly provided commands

User hooks and user aliases don't require approval (you defined them). Commands from project hooks and project aliases require approval on first run. Approved commands are saved to the approvals file (`approvals.toml`). If a command changes, Worktrunk requires new approval.

### Example approval prompt

```console
▲ repo needs approval to execute 3 commands:

○ pre-start install:
  npm ci
○ pre-start build:
  cargo build --release
○ pre-start env:
  echo 'PORT={{ branch | hash_port }}' > .env.local

❯ Allow and remember? [y/N]
```

Use `--yes` to bypass prompts (useful for CI/automation).

### Command log

All hook executions and LLM commands are recorded in `.git/wt/logs/commands.jsonl`, one JSON object per line; [`wt config state logs`](/config/#wt-config-state-logs) lists the fields.

View the log with `wt config state logs get`, or query directly:

```console
# Recent commands
$ tail -5 .git/wt/logs/commands.jsonl | jq .

# Failed commands
$ jq 'select(.exit != 0 and .exit != null)' .git/wt/logs/commands.jsonl
```

Clear with `wt config state logs clear`.

## Does Worktrunk work on Windows?

Yes. Core commands, shell integration, and tab completion work in both Git Bash and PowerShell. See [installation](/#install) for setup details, including avoiding the Windows Terminal `wt` conflict.

**Git for Windows required** — Hooks use bash syntax and execute via Git Bash, so [Git for Windows](https://gitforwindows.org/) must be installed even when PowerShell is the interactive shell.

The `wt switch` interactive picker runs on Windows too.

## How does Worktrunk determine the default branch?

Worktrunk checks the local git cache first, queries the remote if needed, and falls back to local inference when no remote exists.

If the remote's default branch has changed (e.g., renamed from master to main), clear the cache with `wt config state default-branch clear`.

For full details on the detection mechanism, see `wt config state default-branch --help`.

## My `for-each` or `--execute` alias prints the same value in every worktree

The alias body rendered once at dispatch, baking the variable to the invoking worktree's value before the nested `wt` command iterated. See [nesting templates](/extending/#nesting-templates) for how to pass the template through unrendered.

## What system dependencies are required?

Worktrunk requires Git 2.43 or newer.

Installing with Cargo and the default features also requires a C99 compiler for bash syntax highlighting. If tree-sitter or C compilation fails (C99 mode, `le16toh` undefined), install without syntax highlighting:

```bash
cargo install worktrunk --no-default-features --features cli
```

This disables bash syntax highlighting in command output but keeps all core functionality.

## How can I contribute?

See [Contributing](https://github.com/max-sixty/worktrunk#contributing) in the README — feedback, share links, and how to run the test suite.

---

### Src Content Docs Hook (`docs/src/content/docs/hook.md`)

---
title: "wt hook"
description: "Run configured hooks."
sidebar:
  order: 17
---


Run configured hooks.

Hooks are shell commands that run at key points in the worktree lifecycle — automatically during `wt switch`, `wt merge`, & `wt remove`, or on demand via `wt hook <type>`. Both user and project hooks are supported.

# Hook Types

| Event | `pre-` — blocking | `post-` — background |
|-------|-------------------|---------------------|
| **switch** | `pre-switch` | `post-switch` |
| **create** | `pre-start` | `post-start` |
| **commit** | `pre-commit` | `post-commit` |
| **merge** | `pre-merge` | `post-merge` |
| **remove** | `pre-remove` | `post-remove` |

`pre-*` hooks block — failure aborts the operation. `post-*` hooks run in the background with output logged (use [`wt config state logs`](/config/#wt-config-state-logs) to find and manage log files); `wt hook <type> --foreground` runs one inline instead, so its output arrives in the terminal. Use `-v` to see the template variables for background hooks; `wt hook <type> --dry-run` previews the commands.

The most common creation hook is `post-start` — it runs background tasks (dev servers, file copying, builds) without blocking worktree creation. Prefer `post-start` over `pre-start` unless a later step needs the work completed first.

| Hook | Purpose |
|------|---------|
| `pre-switch` | Runs in the source worktree before switching — creating, switching to existing, or staying on current |
| `post-switch` | Triggers on all switch results: creating, switching to existing, or staying on current |
| `pre-start` | Runs once when a new worktree is created, blocking `post-start`/`--execute` until complete: dependency install, env file generation |
| `post-start` | Runs once when a new worktree is created, in the background: dev servers, long builds, file watchers, copying caches |
| `pre-commit` | Formatters, linters, type checking — runs before any Worktrunk commit (`wt step commit`, `wt step squash`, and the commit `wt merge` makes) |
| `post-commit` | CI triggers, notifications, background linting |
| `pre-merge` | Tests, security scans, build verification — runs after rebase, before merge to target |
| `post-merge` | Deployment, notifications, installing updated binaries. Runs in the target branch worktree if it exists, otherwise the primary worktree |
| `pre-remove` | Cleanup before worktree deletion: saving test artifacts, backing up state. Runs in the worktree being removed |
| `post-remove` | Stopping dev servers, removing containers, notifying external systems. Template variables reference the removed worktree |

During `wt merge`, the blocking hooks run in this order: pre-commit → pre-merge → pre-remove. The `post-*` hooks start together once the merge finishes. See [`wt merge`](/merge/#pipeline) for the complete pipeline.

# Security

Project commands require approval on first run:

```
▲ repo needs approval to execute 3 commands:

○ pre-start install:
   npm ci
○ pre-start build:
   cargo build --release
○ pre-start env:
   echo 'PORT={{ branch | hash_port }}' > .env.local

❯ Allow and remember? [y/N]
```

- Approvals are saved to `~/.config/worktrunk/approvals.toml`
- If a command changes, new approval is required
- Declining skips every hook for that operation — user hooks and already-approved project commands included — and continues without them; saved approvals are unaffected
- Use `--yes` to bypass prompts — useful for CI and automation
- Use `--no-hooks` to skip hooks — accepted by the commands that run them (`wt switch`, `wt merge`, `wt remove`, `wt step commit`, `wt step squash`), not by `wt hook`

Manage approvals with `wt config approvals add` and `wt config approvals clear`.

# Configuration

Hooks can be defined in project config (`.config/wt.toml`) or user config (`~/.config/worktrunk/config.toml`). Both use the same format. The project config is read from the worktree the command ran in.

## Hook forms

Hooks take one of three forms, determined by their TOML shape.

A string is a single command:

```toml
# .config/wt.toml
pre-start = "npm install"
```

A table names commands. With multiple keys, they run concurrently:

```toml
# .config/wt.toml
[post-start]
server = "npm run dev"
watch = "npm run watch"
```

A pipeline is a sequence of `[[hook]]` blocks run in order. Each block is one step; multiple keys within a block run concurrently. A failing step aborts the rest of the pipeline:

```toml
# .config/wt.toml
[[post-start]]
install = "npm ci"

[[post-start]]
build = "npm run build"
server = "npm run dev"
```

Here `install` runs first, then `build` and `server` run together.

Templates are checked before the pipeline starts. One that can't parse, or that fails to expand from values no earlier step can change, such as an unguarded `{{ branch }}` in a detached worktree, stops the hook before any step from either source runs, and the command exits nonzero. Templates render as each step runs, so a step can store [per-branch vars](/config/#wt-config-state-vars) that later steps read via `{{ vars.<key> }}`. Previews (`wt hook <type> --dry-run`, `wt hook show --expanded`) leave `{{ vars.* }}` references unexpanded for that reason.

Most hooks don't need `[[hook]]` blocks. Reach for them when there's a dependency chain — typically setup that must complete before later steps, like installing dependencies before running a build and dev server concurrently.

## Project vs user hooks

| Aspect | Project hooks | User hooks |
|--------|--------------|------------|
| Location | `.config/wt.toml` | `~/.config/worktrunk/config.toml` |
| Scope | Single repository | All repositories (or [per-project](/config/#user-project-specific-settings)) |
| Approval | Required | Not required |
| Execution order | `pre-*`: after user hooks. `post-*`: alongside them | `pre-*`: first. `post-*`: alongside project hooks |

To run a specific hook when user and project both define the same name, use `user:name` or `project:name` syntax.

For `pre-*` hooks, a user-hook failure skips project hooks. For `post-*` hooks, a step failing in one source does not stop the other. Concurrent hooks can race when writing the same file or running Git in the same worktree. Commands that depend on each other should use ordered `[[hook]]` blocks within one source.

## Template variables

Hooks can use template variables that expand at runtime:

| Kind | Variable | Description |
|------|----------|-------------|
| active    | `{{ branch }}`                | Branch name; unset in a detached worktree |
|           | `{{ worktree_path }}`         | Worktree path |
|           | `{{ worktree_name }}`         | Worktree directory name |
|           | `{{ commit }}`                | Branch HEAD SHA |
|           | `{{ short_commit }}`          | Branch HEAD SHA, abbreviated per `core.abbrev` |
|           | `{{ upstream }}`              | Branch upstream (if tracking a remote) |
| operation | `{{ base }}`                  | Base branch name (switch/create only) |
|           | `{{ base_worktree_path }}`    | Base worktree path |
|           | `{{ target }}`                | Target branch name |
|           | `{{ target_worktree_path }}`  | Target worktree path (when target has a worktree) |
|           | `{{ pr_number }}`             | PR/MR number (switch and create hooks; when switching via `pr:N` / `mr:N`) |
|           | `{{ pr_url }}`                | PR/MR web URL (switch and create hooks; when switching via `pr:N` / `mr:N`) |
| repo      | `{{ repo }}`                  | Repository directory name |
|           | `{{ repo_path }}`             | Absolute path to repository root |
|           | `{{ owner }}`                 | Primary remote owner path (may include subgroups) |
|           | `{{ remote_repo }}`           | Repository name from the primary remote URL, without `.git` |
|           | `{{ primary_worktree_path }}` | Primary worktree path |
|           | `{{ default_branch }}`        | Default branch name |
|           | `{{ remote }}`                | Primary remote name |
|           | `{{ remote_url }}`            | Remote URL |
| exec      | `{{ cwd }}`                   | Directory where the hook command runs |
|           | `{{ hook_type }}`             | Hook type being run (e.g. `pre-start`, `pre-merge`) |
|           | `{{ hook_name }}`             | Hook command name (if named) |
|           | `{{ args }}`                  | Tokens forwarded from the CLI — see [Running Hooks Manually](#running-hooks-manually) |
| user      | `{{ vars.<key> }}`            | Per-branch variables from [`wt config state vars`](/config/#wt-config-state-vars) |

The `repo` variables (`repo`, `repo_path`, `owner`, `remote_repo`, `primary_worktree_path`, `default_branch`, `remote`, `remote_url`) are constant across the whole repository — `default_branch` is the same in every worktree. The `active` variables (`branch`, `worktree_path`, `worktree_name`, `commit`, `short_commit`, `upstream`) vary per worktree.

Bare variables (`branch`, `worktree_path`, `commit`) refer to the branch the operation acts on: the destination for switch/create, the source for merge/remove. `base` and `target` give the other side:

| Operation | Bare vars | `base` | `target` |
|-----------|-----------|--------|----------|
| switch/create | destination | where you came from | = bare vars |
| commit (during merge/squash) | worktree being squashed | unset | integration target |
| merge | feature being merged | unset | merge target |
| remove | branch being removed | unset | where you end up |

All hooks share the same perspective — `{{ branch | hash_port }}` produces the same port in `post-start` and `post-remove`.

`cwd` is the worktree root where the hook command runs. It equals `worktree_path` except in three cases:

- `pre-switch`: hook runs in the source worktree; `worktree_path` is the destination, or the source when the switch creates a new worktree (use `pre-start` to work in the new worktree)
- `post-remove`: the active worktree is gone, so the hook runs in the primary worktree
- `post-merge`: the hook runs in the target branch's worktree (the primary worktree if the target has none)

Undefined variables error — use conditionals or defaults for optional behavior:

```toml
# .config/wt.toml
[pre-start]
# Rebase onto upstream if tracking a remote branch (e.g., wt switch --create feature --base origin/feature)
sync = "{% if upstream %}git fetch && git rebase {{ upstream }}{% endif %}"
```

A detached worktree has no branch, so `branch` — and a `base` or `target` that names that worktree — is undefined there; guard with `{% if branch %}`. A command that identifies the worktree rather than its branch can use `worktree_name` or `worktree_path`, which every worktree has.

Run any hook-firing command with `-v` to see the resolved variables for the actual invocation — each hook prints a `template variables:` block showing every in-scope variable and its value (`(unset)` for conditional vars that didn't populate, like `target_worktree_path` during `wt switch -`). Aliases do the same under `-v`: `wt -v <alias>` prints the alias's in-scope variables before the pipeline runs.

Variables use dot access and the `default` filter for missing keys. JSON object/array values are parsed automatically, so `{{ vars.config.port }}` works when the value is `{"port": 3000}`:

```toml
# .config/wt.toml
[post-start]
dev = "ENV={{ vars.env | default('development') }} npm start -- --port {{ vars.config.port | default('3000') }}"
```

The `tojson` filter renders a whole object or array as JSON, for commands that take JSON input:

```toml
# .config/wt.toml
[post-start]
seed = "curl -X POST localhost:3000/seed -d {{ vars.config | tojson }}"
```

Logic that templates can't express belongs in a script, with the values it needs passed as arguments:

```toml
# .config/wt.toml
[post-start]
setup = "python3 scripts/post-start-setup.py {{ branch }} {{ repo }}"
```

```python
# scripts/post-start-setup.py
import subprocess, sys
branch, repo = sys.argv[1], sys.argv[2]
if branch.startswith('feature/') and 'backend' in repo:
    subprocess.run(['make', 'seed-db'])
```

## Worktrunk filters

Templates support Jinja2 filters for transforming values:

| Filter | Example | Description |
|--------|---------|-------------|
| `sanitize` | `{{ branch \| sanitize }}` | Replace `/` and `\` with `-` |
| `sanitize_db` | `{{ branch \| sanitize_db }}` | Database-safe identifier with hash suffix (`[a-z0-9_]`, max 48 chars) |
| `sanitize_hash` | `{{ branch \| sanitize_hash }}` | Filesystem-safe name with hash suffix for uniqueness |
| `hash` | `{{ branch \| hash }}` | 3-character base36 digest of the input |
| `hash_port` | `{{ branch \| hash_port }}` | Hash to port 10000-19999 |
| `dirname` | `{{ repo_path \| dirname }}` | Strip the last path component (`/a/b/c` → `/a/b`) |
| `basename` | `{{ repo_path \| basename }}` | Keep only the last path component (`/a/b/c` → `c`) |
| `codename(n)` | `{{ branch \| codename(2) }}` | Deterministic friendly words |

The `sanitize_db` filter produces database-safe identifiers — lowercase alphanumeric and underscores, no leading digits, with a 3-character hash suffix to avoid collisions and reserved words. The `sanitize_hash` filter produces a filesystem-safe name and appends a 3-character hash suffix when sanitization changed the input, so distinct originals never collide — already-safe names pass through unchanged. The `codename(n)` filter produces deterministic friendly names from an input string: `codename(1)` returns a noun, `codename(2)` returns `adjective-noun`, and higher counts add more adjectives. The pool is large (~1.26M combinations for `codename(2)`), so it usually stands alone as a worktree leaf — the [`worktree-path` recipes](/config/#worktree-path-template) show it both alone and under a branch-named parent directory.

The `hash` filter is the bare 3-character base36 digest, useful for composing your own truncate-with-collision-avoidance recipes when an output budget is tight (e.g., Unix socket paths capped at 107 bytes):

```toml
# ~/.config/worktrunk/config.toml
# Truncated branch slug + hash: collisions remain disambiguated even when prefixes match
worktree-path = "/tmp/{{ (branch | sanitize)[:20] }}_{{ branch | sanitize | hash }}"
```

The `dirname` and `basename` filters traverse paths. They're useful for bare repos in a hidden directory like `myproject/.git`, where `{{ repo }}` resolves to `.git`:

```toml
# ~/.config/worktrunk/config.toml
# Place worktrees as siblings of the bare repo, named `<wrapper>.<branch>`
worktree-path = "{{ repo_path }}/../{{ repo_path | dirname | basename }}.{{ branch | sanitize }}"
```

The `hash_port` filter is useful for running dev servers on unique ports per worktree:

```toml
# .config/wt.toml
[post-start]
dev = "npm run dev -- --host {{ branch }}.localhost --port {{ branch | hash_port }}"
```

Hash any string, including concatenations:

```toml
# .config/wt.toml
# Unique port per repo+branch combination
[post-start]
dev = "npm run dev --port {{ (repo ~ '-' ~ branch) | hash_port }}"
```

Variables are shell-escaped automatically — quotes around `{{ ... }}` are unnecessary and can cause issues with special characters.

## Worktrunk functions

Templates also support functions for dynamic lookups:

| Function | Example | Description |
|----------|---------|-------------|
| `worktree_path_of_branch(branch)` | `{{ worktree_path_of_branch("main") }}` | Look up the path of a branch's worktree |
| `expected_worktree_path_of_branch(branch)` | `{{ expected_worktree_path_of_branch("feature") }}` | Where `wt switch` expects the branch's worktree |

The `worktree_path_of_branch` function returns the filesystem path of a worktree given a branch name, or an empty string if no worktree exists for that branch. This is useful for referencing files in other worktrees:

```toml
# .config/wt.toml
[pre-start]
# Copy config from main worktree
setup = "cp {{ worktree_path_of_branch('main') }}/config.local {{ worktree_path }}"
```

The `expected_worktree_path_of_branch` function returns the path `wt switch --create` would use for a branch, whether or not a worktree exists there. Unlike `worktree_path_of_branch`, it still returns that path after the worktree there has moved to another branch. For example, this switches to the worktree at `feature`'s path, whichever branch it now holds:

```bash
wt switch "$(wt step eval "{{ expected_worktree_path_of_branch('feature') }}")"
```

## Interactive hooks

A hook command inherits wt's stdin, so it can prompt, when it runs in the foreground with no other command alongside it. Commands that run concurrently, such as the keys of a multi-key table, get empty stdin, as do `post-*` hooks running in the background and the hooks `wt step prune` runs for several worktrees at once. This `pre-start` hook asks before trusting the worktree:

```toml
# .config/wt.toml
[pre-start]
trust = "gum confirm 'trust this worktree?' && mise trust"
```

## Copying untracked files

Git worktrees share the repository but not untracked files. [`wt step copy-ignored`](/step/#wt-step-copy-ignored) copies gitignored files between worktrees:

```toml
# .config/wt.toml
[post-start]
copy = "wt step copy-ignored"
```

# Running Hooks Manually

`wt hook <type>` runs hooks on demand — useful for testing during development, running in CI pipelines, or re-running after a failure.

```console
$ wt hook pre-merge              # Run all pre-merge hooks
$ wt hook pre-merge test         # Run hooks named "test" from both sources
$ wt hook pre-merge test build   # Run hooks named "test" and "build"
$ wt hook pre-merge user:        # Run all user hooks
$ wt hook pre-merge project:     # Run all project hooks
$ wt hook pre-merge user:test    # Run only user's "test" hook
$ wt hook pre-merge --yes        # Skip approval prompts (for CI)
$ wt hook pre-start --branch=feature/test    # Override a template variable
$ wt hook pre-merge -- --extra args     # Forward tokens into {{ args }}
```

The `user:` and `project:` prefixes filter by source. Use `user:` or `project:` alone to run all hooks from that source, or `user:name` / `project:name` to run a specific hook.

```console
$ wt hook pre-merge
◎ Running pre-merge project:test
  cargo test
    Finished test [unoptimized + debuginfo] target(s) in 0.12s
     Running unittests src/lib.rs (target/debug/deps/worktrunk-abc123)

running 18 tests
test auth::tests::test_jwt_decode ... ok
test auth::tests::test_jwt_encode ... ok
test auth::tests::test_token_refresh ... ok
test auth::tests::test_token_validation ... ok

test result: ok. 18 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.08s
◎ Running pre-merge project:lint
  cargo clippy
    Checking worktrunk v0.1.0
    Finished dev [unoptimized + debuginfo] target(s) in 1.23s
```

```console
$ wt hook post-start
◎ Running post-start: project @ ~/acme
```

## Passing values

`--KEY=VALUE` binds `KEY` whenever `{{ KEY }}` appears in any selected hook command — the same smart-routing rule `wt <alias>` uses. Built-in variables can be overridden: `--branch=foo` sets `{{ branch }}` inside hook templates (the worktree's actual branch doesn't move). Hyphens in keys become underscores: `--my-var=x` sets `{{ my_var }}`.

Any `--KEY=VALUE` whose key isn't referenced by a selected hook template forwards into `{{ args }}` as a literal `--KEY=VALUE` token. Tokens after `--` also forward into `{{ args }}` verbatim. `{{ args }}` renders as a space-joined, shell-escaped string; index with `{{ args[0] }}`, loop with `{% for a in args %}…{% endfor %}`, count with `{{ args | length }}`.

# Recipes

- [Eliminate cold starts](/tips-patterns/#eliminate-cold-starts): `wt step copy-ignored` in `post-start` shares build caches and dependencies; use a `[[post-start]]` pipeline when a later hook depends on the copy
- [Dev server per worktree](/tips-patterns/#dev-server-per-worktree): `wt step tether` in `post-start` runs the dev server and kills its whole process group when the worktree is removed, with optional subdomain routing
- [Database per worktree](/tips-patterns/#database-per-worktree): a `post-start` pipeline stores container name, port, and connection string as [per-branch vars](/config/#wt-config-state-vars) that later hooks reference
- [Progressive validation](/tips-patterns/#progressive-validation): quick lint/typecheck in `pre-commit`, expensive tests and builds in `pre-merge`
- [Target-specific hooks](/tips-patterns/#target-specific-hooks): branch on `{{ target }}` in `post-merge` for per-environment deploys

## See also

- [`wt merge`](/merge/) — Runs hooks automatically during merge
- [`wt switch`](/switch/) — Runs pre-start/post-start hooks on `--create`
- [`wt config approvals`](/config/#wt-config-approvals) — Manage approvals
- [`wt config state logs`](/config/#wt-config-state-logs) — Access background hook logs

## Command reference

```text wt-command-reference
wt hook - Run configured hooks

Usage: wt hook [OPTIONS] <COMMAND>

Commands:
  show         Show configured hooks
  pre-switch   Run pre-switch hooks
  post-switch  Run post-switch hooks
  pre-start    Run pre-start hooks
  post-start   Run post-start hooks
  pre-commit   Run pre-commit hooks
  post-commit  Run post-commit hooks
  pre-merge    Run pre-merge hooks
  post-merge   Run post-merge hooks
  pre-remove   Run pre-remove hooks
  post-remove  Run post-remove hooks

Options:
  -h, --help
          Print help (see a summary with '-h')

Global Options:
  -C <path>
          Working directory for this command

      --config <path>
          User config file path

      --config-set <toml>
          Override config with inline TOML, e.g. --config-set list.full=true (repeatable)

  -v, --verbose...
          Verbose output (-v: template variables; -vv: debug logs)

  -y, --yes
          Skip approval prompts
```

---

### Src Content Docs List (`docs/src/content/docs/list.md`)

---
title: "wt list"
description: "List worktrees and their status."
sidebar:
  order: 11
---


List worktrees and their status.

Shows uncommitted changes, divergence from the default branch and remote, and optional CI status and LLM summaries.

<figure class="demo">
<picture>
  <source srcset="/assets/docs/dark/wt-list.gif" media="(prefers-color-scheme: dark)">
  <img src="/assets/docs/light/wt-list.gif" alt="wt list demo" width="1600" height="900">
</picture>
<figcaption>Progressive rendering, then --full and --branches</figcaption>
</figure>

The table renders progressively: branch names, paths, and commit hashes appear immediately, then status, divergence, and other columns fill in as background git operations complete.

## Full mode

`--full` adds the two columns that reach off-machine: [CI status](#ci-status) (forge pipeline pass/fail, over the network) and [LLM-generated summaries](#llm-summaries) of each branch's changes.

## Examples

List all worktrees:

```console
$ wt list
  Branch       Status       @±        ^↕        ^…±     Remote⇅  Commit    Age  Message
@ feature-api  +   ↕⇡     +54   -5   ↑4  ↓1  +234  -24   ⇡3      6814f02   30m  Add API tests
^ main             ^⇅                                    ⇡1  ⇣1  41ee083    4d  Merge fix-auth: ha…
+ fix-auth         ↕|                ↑2  ↓1   +25  -11     |     b772e68    5h  Add secure token s…
+ fix-typos        _|                                      |     41ee083    4d  Merge fix-auth: ha…

○ Showing 4 worktrees, 1 with changes, 2 ahead, hidden: Path  (↕ diverged from default)
```

Include CI status and LLM summaries:

```console
$ wt list --full
  Branch       Status       @±        ^↕        ^…±     Summary                       Remote⇅  CI
@ feature-api  +   ↕⇡     +54   -5   ↑4  ↓1  +234  -24  Refactor API to REST archit…   ⇡3      #412
^ main             ^⇅                                                                  ⇡1  ⇣1  #
+ fix-auth         ↕|                ↑2  ↓1   +25  -11  Harden auth with constant-t…     |     #408
+ fix-typos        _|                                                                    |     #410

○ Showing 4 worktrees, 1 with changes, 2 ahead, hidden: Path, Commit, Age, Message
```

Include branches that don't have worktrees:

```console
$ wt list --branches --full
  Branch       Status       @±        ^↕        ^…±     Summary                       Remote⇅  CI
@ feature-api  +   ↕⇡     +54   -5   ↑4  ↓1  +234  -24  Refactor API to REST archit…   ⇡3      #412
^ main             ^⇅                                                                  ⇡1  ⇣1  #
+ fix-auth         ↕|                ↑2  ↓1   +25  -11  Harden auth with constant-t…     |     #408
+ fix-typos        _|                                                                    |     #410
/ exp             /↕                 ↑2  ↓1  +137       Explore GraphQL schema and…
/ wip             /↕                 ↑1  ↓1   +33       Start API documentation

○ Showing 4 worktrees, 2 branches, 1 with changes, 4 ahead, hidden: Path, Commit, Age, Message
```

Output as JSON for scripting:

```console
$ wt list --format=json
```

## Columns

| Column | Shows |
|--------|-------|
| Branch | Branch name, elided with `…` past 32 characters; a detached worktree shows its short hash |
| Status | Compact symbols (see below) |
| @± | Uncommitted changes, including untracked files: +added -deleted lines |
| ^↕ | Commits ahead/behind default branch |
| ^…± | Line diffs since the merge-base (three-dot) with the default branch |
| Summary | LLM-generated branch summary; requires `--full`, `summary = true`, and [`commit.generation`](/config/#commit) |
| Remote⇅ | Commits ahead/behind tracking branch |
| CI | PR/MR number colored by pipeline status; `--full` only |
| Path | Worktree directory |
| URL | Dev server URL from project config; dimmed if port is not listening |
| *(custom)* | User-defined [custom columns](#custom-columns) from `[list.custom-columns]` user config <span class="badge-experimental"></span> |
| Commit | Short hash, abbreviated per `core.abbrev` |
| Age | Time since last commit |
| Message | Last commit message (truncated) |

In the headers, `@` stands for the worktree's own `HEAD` and `^` for the default branch, whatever it is named — the same shortcuts `wt switch` accepts.

Counts too large for their column are shortened, rounded down, and drawn brighter: `C` is hundreds and `K` thousands (`↑3C` is 300–399 commits, `+2K` is 2,000–2,999 lines), and `∞` means 10,000 or more. Line counts stay exact up to 999; commit counts up to 99. `--format=json` carries the exact counts.

The table sizes itself to the terminal. When the columns don't all fit, the least important go first — roughly right to left, since the order above runs from identity to nice-to-have — and the summary footer names them (`hidden: Commit, Age, Message`). A wider terminal brings them back. To pin a set rather than leave it to the width, name the columns in [`[list] columns`](/config/#list); `--format=json` carries every field at any width.

### Gutter

The leftmost column marks each row by physical presence, from most present to least:

| Symbol | Meaning |
|--------|---------|
| `@` | Current worktree |
| `^` | Primary worktree (the repo's home worktree) |
| `+` | Other worktree |
| `/` | Local branch without a worktree (`--branches`) |
| `\|` | Remote branch, not present locally until fetched (`--remotes`) |

### CI status

The CI column shows the branch's open PR/MR — `#3035` on GitHub, Gitea, and Azure DevOps, `!3035` on GitLab — colored by pipeline status, or a bare `#` when no number is available (e.g. branch workflows without a PR/MR). Green, blue, red, yellow, and gray show the pipeline state; magenta and cyan show the review state. [checks object](#checks-object) and [review states](#review-states) give the JSON form of each value:

| Indicator | Value | Meaning |
|-----------|-------|---------|
| <span style='color:#0a0'>#</span> green | `"passed"` | All checks passed |
| <span style='color:#00a'>#</span> blue | `"running"` | Checks in progress |
| <span style='color:#a00'>#</span> red | `"failed"` | One or more checks failed |
| <span style='color:#a60'>#</span> yellow | `"conflicts"` | Merge conflicts with the target branch |
| <span style='color:#888'>#</span> gray | `"no-ci"` | No PR/MR, or no checks configured |
| <span style='color:#a60'>⚠</span> yellow | `"error"` | CI status could not be fetched (expired login, rate limit, network, etc.) |
| <span style='color:#a0a'>#</span> magenta | `"changes_requested"` | A reviewer requested changes |
| <span style='color:#0aa'>#</span> cyan | `"pending"` | A review is required (e.g. branch protection) but not yet given |
| (blank) | `pr` and `checks` absent | Branch never pushed, forge CLI not logged in to the host, or no PR/MR and no branch workflow |

The two remaining review states have no indicator of their own: `"draft"` only dims the cell and `"approved"` leaves the color unchanged.

Changes requested (magenta) outranks running checks, while a required review (cyan) only recolors an otherwise green or gray branch. GitLab reports only the `"pending"` and `"draft"` review states.

CI cells are clickable links to the PR or pipeline page, and appear dimmed for a draft PR/MR (`"draft"`) or when unpushed local changes make the status stale (`checks.stale`). Results are cached for 30-60 seconds; use `wt config state cache` to view or clear.

### LLM summaries

Reuses the [`commit.generation`](/config/#commit) command — the same LLM that generates commit messages. Enable with `summary = true` in `[list]` config; requires `--full`. Results are cached until the branch's diff changes.

### Custom columns

<span class="badge-experimental"></span>

Each `[list.custom-columns]` entry in user config adds a column. Its key sets the header; its template renders each row's cell. Templates read `{{ vars.* }}`, set with [`wt config state vars set`](/config/#wt-config-state-vars), and `{{ git.branch.* }}`, from `branch.<name>.*` in Git config:

```toml
# ~/.config/worktrunk/config.toml
[list.custom-columns.Ticket]
template = "{{ vars.ticket }}"
```

The [custom columns config](/config/#custom-columns) covers templates, widths, and drop priority.

## Status symbols

The Status column packs several subcolumns, left to right, each mapping to a schema-2 field in `--format=json` (schema 1 spells several of them differently — see [Schema 1](#schema-1)). Working-tree flags are independent and co-occur — any combination shows at once. The other subcolumns are mutually exclusive: each shows a single symbol, the highest-priority state in top-to-bottom table order, and is blank when nothing applies.

When space permits, the footer rotates through visible status explanations.

### Working tree

Independent flags from `git status`; several can show at once (e.g. `+!?`). Each maps to a boolean in the [changes object](#changes-object):

| Symbol | worktree.changes | Meaning |
|--------|------------------|---------|
| `+` | `staged` | Staged files |
| `!` | `modified` | Modified files (unstaged) |
| `?` | `untracked` | Untracked files |

`worktree.changes` also reports `renamed` and `deleted`, which have no dedicated symbol in the column.

### Worktree

An in-progress git operation, a worktree-location attribute, or a branch with no worktree. One symbol shows, highest priority first (`✘ > ↻ > ⊟ > ⊞ > ⊘ > ⚐ > /`):

| Symbol | JSON | Meaning |
|--------|------|---------|
| `✘` | `worktree.changes.conflicted` | Merge conflicts |
| `↻` | `worktree.operation` `"rebase"`, `"merge"`, `"cherry_pick"`, `"revert"`, `"bisect"` | A git operation is in progress; `git status` names it |
| `⊟` | `worktree.prunable` | Prunable (worktree directory or its `.git` gone) |
| `⊞` | `worktree.locked` | Locked worktree |
| `⊘` | `worktree.detached` | Detached HEAD |
| `⚐` | `worktree.duplicate_branch` | Branch checked out in more than one worktree |
| `⚐` | `worktree.branch_mismatch` | Worktree isn't at the path its branch implies |
| `/` | no `worktree` object | Branch without a worktree |

### Default branch

The single highest-priority state describing the branch's relation to the default branch; blank when none applies (a normal up-to-date branch). Each symbol is one `display.state` value:

| Symbol | display.state | Meaning |
|--------|---------------|---------|
| `^` | `"is_main"` | The primary worktree (the repo's home worktree) |
| `∅` | `"orphan"` | No common ancestor with the default branch |
| `_` | `"empty"` | Same commit as the default branch, working tree clean — safe to remove; row dimmed |
| `⊂` | `"integrated"` | Content [integrated](/remove/#branch-cleanup) into the default branch or merge target via different history; the matching check is in `default_branch.integration.reason`; row dimmed |
| `✗` | `"would_conflict"` | Merging into the default branch would conflict (simulated with `git merge-tree`) and the branch isn't already integrated; with `--full`, the check includes tracked uncommitted changes |
| `–` | `"same_commit"` | Same commit as the default branch, but with uncommitted changes |
| `↕` | `"diverged"` | Both ahead of and behind the default branch |
| `↑` | `"ahead"` | Has commits the default branch doesn't |
| `↓` | `"behind"` | Missing commits the default branch has |

Rows are dimmed when [safe to delete](/remove/#branch-cleanup) — `_` (`"empty"`) or `⊂` (`"integrated"`).

### Remote

Relation to the tracking branch, derived from the `upstream.ahead` / `upstream.behind` counts; blank when there is no upstream:

| Symbol | upstream | Meaning |
|--------|----------|---------|
| `\|` | `ahead` 0, `behind` 0 | In sync with remote |
| `⇡` | `ahead` > 0 | Ahead of remote |
| `⇣` | `behind` > 0 | Behind remote |
| `⇅` | `ahead` > 0, `behind` > 0 | Diverged from remote |

### Marker

The last subcolumn shows the branch's marker, set with
[`wt config state marker set`](/config/#wt-config-state-marker) — usually an
emoji saying what the branch is for. It reads back as the item's `marker`
field.

### Placeholder symbols

These appear across all columns while the table is loading:

| Symbol | Meaning |
|--------|---------|
| `·` | Data is loading, or collection timed out |

---

## JSON output

`--format=json` emits schema 2 by default: the envelope format below. Set
`[list] json-schema = 1` to retain the original bare-array format.

### Schema 2

One envelope object. Items carry independent facts; rendered strings
(including the collapsed Status value) live under `display`:

```json
{
  "schema": 2,
  "repo": {
    "default_branch": "main",
    "forge": {"url": "https://github.com/org/repo", "provider": "github",
              "host": "github.com", "owner": "org", "name": "repo", "remote": "origin"}
  },
  "collected": {"ci": false, "summary": false},
  "items": [
    {
      "branch": "feature",
      "head": {"sha": "05a4a45d…", "short_sha": "05a4a45", "subject": "Add login page",
               "committed_at": "2025-01-01T08:00:00Z"},
      "worktree": {"path": "/home/user/repo.feature", "modified_at": "2025-01-01T09:30:00Z",
                   "main": false, "current": true, "previous": false, "detached": false,
                   "branch_mismatch": false, "duplicate_branch": false,
                   "changes": {"staged": false, "modified": true, "untracked": false,
                               "renamed": false, "deleted": false, "conflicted": false,
                               "diff": {"added": 10, "deleted": 2}}},
      "default_branch": {"ahead": 3, "behind": 1, "diff": {"added": 50, "deleted": 20},
                         "orphan": false, "integration": null, "merge_conflicts": false},
      "upstream": {"remote": "origin", "branch": "feature", "ahead": 0, "behind": 2},
      "display": {"state": "diverged", "symbols": "!↕", "statusline": "feature …"}
    }
  ]
}
```

How "no value" reads:

- **Absent** — nothing to report: not applicable (`worktree` on a branch-only
  row), not requested this run (the envelope's `collected` records what was),
  or determined-empty (no PR, no lock, not integrated).
- **`null`** — requested but not determined: a task timed out, a check was
  skipped, or a forge fetch failed. This is the JSON form of the table's `·`
  placeholder.

jq treats absent and `null` identically in path expressions, so filters need
no null checks; `has()` distinguishes the two when it matters.

Envelope fields:

| Field | Type | Description |
|-------|------|-------------|
| `schema` | number | Format version; always `2` |
| `repo` | object | `{default_branch, forge}` — the branch every `default_branch` object measures against (absent when detection failed), and forge metadata derived from the primary remote (absent when no remote URL parses; see [repo object](#repo-object)) |
| `collected` | object | `{ci, summary}` — which gated fact families this run requested, so an absent `pr`/`checks`/`summary` reads as "not requested" rather than "none" |
| `items` | array | One object per row: a worktree, a local branch, or a remote-only branch |

Item fields:

| Field | Type | Description |
|-------|------|-------------|
| `branch` | string/null | Branch name; null for a detached-HEAD worktree. Remote rows carry the bare name with the remote in `remote` |
| `remote` | string | Remote name, present only on remote-only branch rows |
| `head` | object/null | HEAD commit (see [head object](#head-object)); null for unborn branches |
| `worktree` | object | Worktree facts (see [worktree object](#worktree-object)); absent on branch-only rows |
| `default_branch` | object | Relation to the default branch (see [default_branch object](#default-branch-object)); absent on the default branch itself |
| `upstream` | object | Tracking branch (see [upstream object](#upstream-object)); absent when none is configured |
| `pr` | object | Open PR/MR (see [pr object](#pr-object)); collected with `--full` |
| `checks` | object | CI pipeline (see [checks object](#checks-object)); collected with `--full` |
| `dev_server` | object | `{url, listening}` from the project's `list.url` template; absent when not configured |
| `summary` | string | LLM branch summary; needs `--full`, `[list] summary = true`, and a `[commit.generation]` command |
| `marker` | string | Branch marker from [`wt config state marker`](/config/#wt-config-state-marker); absent when none is set |
| `vars` | object | Per-branch variables from [`wt config state vars`](/config/#wt-config-state-vars) |
| `display` | object | Rendered strings (see [display object](#display-object)) |

### head object

| Field | Type | Description |
|-------|------|-------------|
| `sha` | string | Full commit SHA (40 chars) |
| `short_sha` | string/null | Short commit SHA, abbreviated per `core.abbrev` (auto-extends for ambiguous prefixes); null when the commit can't be read |
| `subject` | string/null | Commit subject (first line); null when not loaded, as for a prunable worktree |
| `committed_at` | string/null | Committer time, RFC 3339 UTC; null when not loaded |

### worktree object

Present only on worktree rows. The location attributes are independent, so they co-occur — see [Worktree](#worktree) for the symbols, which pick one:

| Field | Type | Description |
|-------|------|-------------|
| `path` | string | Worktree path |
| `modified_at` | string/null | Later of HEAD committer time and the newest changed or untracked file mtime, RFC 3339 UTC; null when unresolved |
| `main` | boolean | Is the primary worktree: the main worktree, or in a bare repo the one on the default branch |
| `current` | boolean | Is the worktree the command ran from |
| `previous` | boolean | Is the previous worktree (`wt switch -`) |
| `detached` | boolean | HEAD is detached |
| `locked` | object | `{reason}`; absent when not locked |
| `prunable` | object | `{reason}`; absent when git doesn't report the worktree prunable |
| `branch_mismatch` | boolean | Worktree isn't at the path its branch implies |
| `duplicate_branch` | boolean | Another worktree has the same branch checked out |
| `operation` | string/null | In-progress operation: `"merge"`, `"rebase"`, `"cherry_pick"`, `"revert"`, `"bisect"`; absent when none |
| `changes` | object/null | Working-tree state (see [changes object](#changes-object)) |

### changes object

The five change flags map to the [Working tree](#working-tree) symbols (`renamed` and `deleted` have none of their own):

| Field | Type | Description |
|-------|------|-------------|
| `staged` | boolean | Has staged files |
| `modified` | boolean | Has modified files (unstaged) |
| `untracked` | boolean | Has untracked files |
| `renamed` | boolean | Has renamed files |
| `deleted` | boolean | Has deleted files |
| `conflicted` | boolean/null | Tracked files carry merge conflicts |
| `diff` | object/null | Lines changed vs HEAD: `{added, deleted}` |

### default_branch object

Independent facts; the table's priority-collapsed symbol is `display.state`.

| Field | Type | Description |
|-------|------|-------------|
| `ahead` | number/null | Commits ahead of the default branch (null for orphans) |
| `behind` | number/null | Commits behind the default branch (null for orphans) |
| `diff` | object/null | Lines changed vs the default branch: `{added, deleted}` |
| `orphan` | boolean/null | No common ancestor with the default branch |
| `integration` | object/null | `{reason}` — which check found the content [integrated](/remove/#branch-cleanup) (see [integration reasons](#integration-reasons)); absent when determined not-integrated, null when undetermined (a check timed out or was skipped) |
| `merge_conflicts` | boolean/null | Merging into the default branch would conflict, simulated locally with `git merge-tree` |

### upstream object

`ahead` / `behind` drive the [Remote](#remote) divergence symbol:

| Field | Type | Description |
|-------|------|-------------|
| `remote` | string | Remote name (e.g., `"origin"`) |
| `branch` | string/null | Branch name on the remote |
| `ahead` | number | Commits ahead of remote |
| `behind` | number | Commits behind remote |

### pr object

| Field | Type | Description |
|-------|------|-------------|
| `number` | integer/null | PR/MR number |
| `url` | string/null | URL to the PR/MR page |
| `review` | string | Review state (see [review states](#review-states)); absent when the forge reports no review signal |
| `mergeable` | boolean/null | False when the forge reports conflicts, null otherwise |
| `repo` | object | Structured metadata for the repository the PR/MR targets, the upstream for fork PRs (see [repo object](#repo-object)); absent when the URL doesn't parse |

### checks object

| Field | Type | Description |
|-------|------|-------------|
| `status` | string/null | `"passed"`, `"running"`, or `"failed"`; null when a conflicts report masks it |
| `source` | string | `"pr"` (PR/MR) or `"branch"` (branch workflow) |
| `stale` | boolean | Local HEAD differs from remote (unpushed changes) |

Three [CI status](#ci-status) values have no `checks.status` of their own, because the shape of `pr` and `checks` reports them: a fetch error (`⚠`) makes both null, no CI leaves `checks` absent, and merge conflicts leave `checks.status` null with `pr.mergeable` false.

### dev_server object

| Field | Type | Description |
|-------|------|-------------|
| `url` | string | Dev server URL from project config |
| `listening` | boolean/null | Whether the URL's port is listening |

### display object

Presentation only — every value here renders facts that appear elsewhere in the item:

| Field | Type | Description |
|-------|------|-------------|
| `state` | string | The table's collapsed default-branch state (see [state values](#state-values)); absent when none applies |
| `symbols` | string | Raw status symbols without colors (e.g., `"!?↓"`) |
| `statusline` | string | Pre-formatted status with colors and links |
| `columns` | object | Rendered [custom column](#custom-columns) values keyed by header; empty cells omitted |

### repo object

`repo.forge` describes the local checkout's repository as derived from the primary remote. `pr.repo` describes the repository targeted by the PR/MR (for fork PRs, the upstream target).

| Field | Type | Description |
|-------|------|-------------|
| `url` | string | Repository web URL |
| `provider` | string | `"github"`, `"gitlab"`, `"gitea"`, `"azure-devops"`, or `"unknown"` |
| `host` | string | Repository web host |
| `api_host` | string | API host from `forge.hostname`, only on `repo.forge` when set |
| `owner` | string | Owner, organization, or namespace path |
| `name` | string | Repository name |
| `project` | string | Azure DevOps project name; absent for other providers |
| `remote` | string | Local remote name; present on `repo.forge`, absent from `pr.repo` |

### state values

The single highest-priority state describing the branch's relation to the default branch; absent when none applies (a normal up-to-date branch). Each value is one Default-branch symbol — see [Default branch](#default-branch) for the symbol and the full meaning of each value (`"is_main"`, `"orphan"`, `"empty"`, `"integrated"`, `"would_conflict"`, `"same_commit"`, `"diverged"`, `"ahead"`, `"behind"`).

### integration reasons

`default_branch.integration.reason` records which check matched. Checks run cheapest-first and the first match wins. See [Default branch](#default-branch) for symbols.

| Value | Meaning |
|-------|---------|
| `"same_commit"` | Branch HEAD is the default branch's commit |
| `"ancestor"` | Branch HEAD is an ancestor of the default branch, which has moved past it |
| `"no_added_changes"` | The three-dot diff (`main...branch`) is empty — no file changes beyond the merge-base |
| `"trees_match"` | Different history, but the branch's tree is identical to the default branch's |
| `"merge_adds_nothing"` | The branch has changes, but merging them leaves the default branch's tree unchanged (e.g. a squash merge where the target advanced on other files) |
| `"patch_id_match"` | The branch's squashed diff matches a single commit on the default branch (e.g. a GitHub/GitLab squash merge) |

### review states

`pr.review` is one of `"changes_requested"`, `"pending"`, `"draft"`, `"approved"`, absent when the forge reports no review signal. [CI status](#ci-status) shows how each renders. The vocabulary matches Claude Code's statusline `pr.review_state` field.

```console
# Current worktree path (for scripts)
$ wt list --format=json | jq -r '.items[] | select(.worktree.current) | .worktree.path'

# Branches with uncommitted changes
$ wt list --format=json | jq '.items[] | select(.worktree.changes.modified)'

# Worktrees with merge conflicts
$ wt list --format=json | jq '.items[] | select(.worktree.changes.conflicted)'

# Branches ahead of main (needs merging)
$ wt list --format=json | jq '.items[] | select(.default_branch.ahead > 0) | .branch'

# Integrated branches (safe to remove)
$ wt list --format=json | jq '.items[] | select(.display.state == "integrated" or .display.state == "empty") | .branch'

# Branches without worktrees
$ wt list --format=json --branches | jq '.items[] | select(.worktree == null) | .branch'

# Worktrees ahead of upstream (needs pushing)
$ wt list --format=json | jq '.items[] | select(.upstream.ahead > 0) | {branch, ahead: .upstream.ahead}'

# Stale CI (local changes not reflected in CI)
$ wt list --format=json --full | jq '.items[] | select(.checks.stale) | .branch'
```

A JSON Schema for the envelope is published at
[worktrunk.dev/schema/list-v2.json](https://worktrunk.dev/schema/list-v2.json).

### Schema 1

The original bare-array format — one object per row, no envelope — selected by
`[list] json-schema = 1`. Its fields all have a schema-2 home:

| Schema 1 | Schema 2 |
|----------|----------|
| `branch` | `branch` |
| `path` | `worktree.path` |
| `kind` | the row's shape — a `worktree` object means `"worktree"`, no `worktree` object means `"branch"` |
| `commit.sha`, `.short_sha`, `.message` | `head.sha`, `.short_sha`, `.subject` |
| `commit.timestamp` (Unix) | `head.committed_at` (RFC 3339 UTC) |
| `working_tree.staged`, `.modified`, `.untracked`, `.renamed`, `.deleted`, `.diff` | `worktree.changes.*` |
| `operation_state` `"conflicts"` | `worktree.changes.conflicted` |
| `operation_state` `"rebase"`, `"merge"`, … | `worktree.operation` |
| `main_state` | `display.state` |
| `integration_reason` | `default_branch.integration.reason` (snake_case, and it reports `"same_commit"` rather than folding it into `main_state`) |
| `main.ahead`, `.behind`, `.diff` | `default_branch.ahead`, `.behind`, `.diff` |
| `remote.name`, `.branch`, `.ahead`, `.behind` | `upstream.remote`, `.branch`, `.ahead`, `.behind` |
| `worktree.state` | `worktree.locked`, `.prunable`, `.duplicate_branch`, `.branch_mismatch` — independent, so they co-occur |
| `worktree.reason` | `worktree.locked.reason`, `worktree.prunable.reason` |
| `worktree.detached` | `worktree.detached` |
| `is_main`, `is_current`, `is_previous` | `worktree.main`, `.current`, `.previous` |
| `ci.status` | `checks.status`, plus the shapes described under [checks object](#checks-object) |
| `ci.source`, `ci.stale` | `checks.source`, `checks.stale` |
| `ci.number`, `ci.url`, `ci.review_state` | `pr.number`, `pr.url`, `pr.review` |
| `ci.repo`, `ci.repo_url` | `pr.repo`, `pr.repo.url` |
| `repo`, `repo_url` | the envelope's `repo.forge`, `repo.forge.url` |
| `url`, `url_active` | `dev_server.url`, `dev_server.listening` |
| `summary`, `vars`, `marker` | `summary`, `vars`, `marker` |
| `statusline`, `symbols`, `columns` | `display.statusline`, `display.symbols`, `display.columns` |

The envelope's `repo.default_branch` and `collected` have no schema-1 equivalent, and schema 2 separates "nothing to report" from "not determined" — see [How "no value" reads](#schema-2).

Missing a field that would be generally useful? [Open an issue](https://github.com/max-sixty/worktrunk/issues).

## See also

- [`wt switch`](/switch/) — Switch worktrees or open interactive picker

## Command reference

```text wt-command-reference
wt list - List worktrees and their status

Usage: wt list [OPTIONS]
       wt list <COMMAND>

Commands:
  statusline  Single-line status for the current worktree

Options:
      --format <FORMAT>
          Output format

          [default: table]
          [possible values: table, json]

      --branches
          Include branches without worktrees

      --remotes
          Include remote branches

      --full
          Show CI status and LLM summaries

      --progressive
          Show fast info immediately, update with slow info

          Displays local data (branches, paths, status) first, then updates with remote data (CI,
          upstream) as it arrives. Use --no-progressive to force buffered rendering. Auto-enabled
          for TTY.

  -h, --help
          Print help (see a summary with '-h')

Global Options:
  -C <path>
          Working directory for this command

      --config <path>
          User config file path

      --config-set <toml>
          Override config with inline TOML, e.g. --config-set list.full=true (repeatable)

  -v, --verbose...
          Verbose output (-v: template variables; -vv: debug logs)

  -y, --yes
          Skip approval prompts
```

# Subcommands

## wt list statusline

Single-line status for the current worktree.

The line carries the same cells as the worktree's row in `wt list`. A stale CI status cache makes it reach the network for a second or two, so it fits a statusline the host renders in the background — Claude Code's, a `tmux` status bar — better than a prompt the shell blocks on. Want it fast enough for a synchronous prompt? [Open an issue](https://github.com/max-sixty/worktrunk/issues).

### Output formats

- `table` (default): `branch  status  @±  ^↕  ^…±  Remote⇅  CI  URL`
- `json`: the current [`wt list --format=json`](/list/#json-output) schema — a one-item envelope by default, or a one-item array with `[list] json-schema = 1`
- `claude-code`: the `table` cells, preceded by `dir` and followed by `model  context  pace`

A cell with nothing to show is left out, so most lines are shorter than that. A line that overruns the terminal drops whole cells, least important first.

The CI reference links to its PR/MR, and a dev server URL carrying a port shows as `:3000` linking to the URL in full, dim until something answers on that port. Both are underlined terminal links.

### Claude Code mode

`--format=claude-code` reads JSON context from stdin (`.workspace.current_dir` is required; the rest are optional):

- `.workspace.current_dir` — working directory
- `.model.display_name` — model name
- `.context_window.used_percentage` — context usage (0–100), rendered as `🌔 65%`, the moon waning 🌕→🌑 as context fills
- `.rate_limits.{five_hour,seven_day}.used_percentage` — rate-limit window usage (0–100)
- `.rate_limits.{five_hour,seven_day}.resets_at` — window reset time (Unix epoch seconds)

The pace segment appears only when usage is likely to hit a rate limit before its window resets, and shows the higher-risk window: `2.9×(Tue–Tue 5pm)` reads as 2.9× the pace that would exactly fill that window. Above 90% used it shows usage instead of pace — `93%(Tue–Tue 5pm)`. Its color deepens from dim to yellow as more of the window would be spent capped.

[Claude Code statusline setup](/claude-code/#statusline-claude-code-only) has the `~/.claude/settings.json` entry that feeds this mode.

### Command reference

```text wt-command-reference
wt list statusline - Single-line status for the current worktree

Usage: wt list statusline [OPTIONS]

Options:
      --format <FORMAT>
          Output format

          Possible values:
          - table
          - json
          - claude-code: Claude Code statusline mode (reads context from stdin)

          [default: table]

  -h, --help
          Print help (see a summary with '-h')
```

---

### Src Content Docs Llm Commits (`docs/src/content/docs/llm-commits.md`)

---
title: "LLM Commit Messages"
description: "Generate commit messages from diffs using any LLM. Integrates with wt merge, wt step commit, and wt step squash."
sidebar:
  order: 23
---
Worktrunk generates commit messages by building a templated prompt and piping it to an external command. This integrates with `wt merge`, `wt step commit`, and `wt step squash`.

<figure class="demo">
<picture>
  <source srcset="/assets/docs/dark/wt-commit.gif" media="(prefers-color-scheme: dark)">
  <img src="/assets/docs/light/wt-commit.gif" alt="LLM commit message generation demo" width="1600" height="900">
</picture>
<figcaption>Reviewing the staged diff, generating a message, and committing</figcaption>
</figure>

## Setup

Any command that reads a prompt from stdin and outputs a commit message works. Add to `~/.config/worktrunk/config.toml`:

### Claude Code

```toml
# ~/.config/worktrunk/config.toml
[commit.generation]
command = "MAX_THINKING_TOKENS=0 claude -p --no-session-persistence --model=haiku --tools='' --safe-mode --setting-sources='user' --system-prompt=''"
```

`--no-session-persistence` prevents the commit conversation from polluting `claude --continue`. `--safe-mode` keeps the run hermetic — no hooks, plugins, MCP, skills, or CLAUDE.md — while leaving authentication working normally, so setups that authenticate via `apiKeyHelper` (not just OAuth or `ANTHROPIC_API_KEY`) still get a key. `--setting-sources='user'` scopes settings to your user config so a project `.claude/settings.json` can't override auth. The remaining flags disable tools, system prompt, and thinking for fast text-only output. `--safe-mode` requires Claude Code ≥ 2.1.169. See [Claude Code docs](https://code.claude.com/docs/en/setup) for installation.

### Codex

Create `~/.codex/worktrunk-commit-instructions.txt` containing just `.` (no newline). Accepting Worktrunk's first-run Codex setup creates the file for you.

```toml
# ~/.config/worktrunk/config.toml
[commit.generation]
command = "codex exec -m gpt-6-luna -c model_reasoning_effort='none' -c project_doc_max_bytes=0 -c skills.max_context_tokens=1 -c agents.enabled=false -c features.goals=false -c web_search=disabled -c 'model_instructions_file=\"~/.codex/worktrunk-commit-instructions.txt\"' -c features.shell_tool=false -c features.unified_exec=false -c features.apps=false -c features.plugins=false --ephemeral --sandbox=read-only --json - | jq -sr '[.[] | select(.item.type? == \"agent_message\")] | last.item.text'"
```

Requires `jq` for JSON parsing. See [Codex CLI docs](https://developers.openai.com/codex/cli/).

### Other tools

Either of these replaces the `command` line above:

```toml
# OpenCode — use a fast model variant
command = "opencode run -m anthropic/claude-haiku-5-5 --variant fast"

# Pi — no session file, tools, extensions, or context files
command = "pi -p --no-session --no-tools --no-extensions --no-skills --no-prompt-templates --no-context-files --model anthropic/claude-haiku-5-5 --thinking off"
```

## Usage

These examples assume a feature worktree with changes to commit.

### wt merge

Squashes all changes (uncommitted + existing commits) into one commit with an LLM-generated message, then merges to the default branch:



```console
$ wt merge
◎ Squashing 3 commits into a single commit (5 files, +16)...
◎ Generating squash commit message...
  feat(auth): Implement JWT authentication system

  Add comprehensive JWT token handling including validation, refresh
  logic, and authentication tests.
✓ Squashed @ a1b2c3d
◎ Merging 1 commit to main @ a1b2c3d (no rebase needed)
  * a1b2c3d feat(auth): Implement JWT authentication system
   auth.rs             | 2 ++
   auth_test.rs        | 2 ++
   integration_test.rs | 6 ++++++
   jwt.rs              | 3 +++
   jwt_test.rs         | 3 +++
   5 files changed, 16 insertions(+)
✓ Merged to main (1 commit, 5 files, +16)
◎ Removing feature worktree & branch in background (same commit as main, _)
○ Switched to worktree for main @ ~/repo
```



### wt step commit

Stages and commits with LLM-generated message:



```console
$ wt step commit
◎ Generating commit message and committing changes... (2 files, +26)
  feat(validation): add input validation utilities
✓ Committed changes @ a1b2c3d
```



### wt step squash

Squashes branch commits into one with LLM-generated message:



```console
$ wt step squash
◎ Squashing 3 commits into a single commit (5 files, +16)...
◎ Generating squash commit message...
  feat(auth): Implement JWT authentication system

  Add comprehensive JWT token handling including validation, refresh
  logic, and authentication tests.
✓ Squashed @ a1b2c3d
```



See [`wt merge`](/merge/) and [`wt step`](/step/) for full documentation.

## Branch summaries

With `summary = true` and a `[commit.generation] command` configured, Worktrunk generates LLM branch summaries — one-line descriptions of each branch's changes since the default branch.

Summaries appear in:

- **`wt switch`** [interactive picker](/switch/#interactive-picker) — the `summary` preview tab
- **`wt list --full`** — the Summary column (see [`wt list`](/list/#llm-summaries))

Enable in user config:

```toml
# ~/.config/worktrunk/config.toml
[list]
summary = true
```

Summaries are cached and regenerated only when the diff changes.

## Prompt templates

Worktrunk uses [minijinja](https://docs.rs/minijinja/) templates (Jinja2-like syntax) to build prompts.

### Custom templates

Override the defaults with inline templates:

```toml
# ~/.config/worktrunk/config.toml
[commit.generation]
command = "MAX_THINKING_TOKENS=0 claude -p --no-session-persistence --model=haiku --tools='' --safe-mode --setting-sources='user' --system-prompt=''"

template = """
Write a commit message for this diff. One line, under 50 chars.

Branch: {{ branch }}
Diff:
{{ git_diff }}
"""

squash-template = """
Combine these {{ commit_details | length }} commits into one message:
{% for c in commit_details %}
- {{ c.subject }}
{% endfor %}

Diff:
{{ git_diff }}
"""
```

### Template variables

| Variable | Description |
|----------|-------------|
| `{{ git_diff }}` | The diff (staged changes or combined diff for squash) |
| `{{ git_diff_stat }}` | Diff statistics (files changed, insertions, deletions) |
| `{{ branch }}` | Current branch name |
| `{{ repo }}` | Repository name |
| `{{ recent_commits }}` | Recent commit subjects (for style reference) |
| `{{ commit_details }}` | Commits being squashed (squash template only); each renders as its subject and exposes `.subject` / `.body` |
| `{{ target_branch }}` | Merge target branch (squash template only) |
| `{{ user_guidance }}` | Rendered user `template-append` fragment (see below) |
| `{{ project_guidance }}` | Rendered project `template-append` fragment (see below) |

### Template syntax

Templates use [minijinja](https://docs.rs/minijinja/latest/minijinja/syntax/index.html), which supports:

- **Variables**: `{{ branch }}`, `{{ repo | upper }}`
- **Filters**: `{{ commit_details | length }}`, `{{ repo | upper }}`
- **Conditionals**: `{% if recent_commits %}...{% endif %}`
- **Loops**: `{% for c in commit_details %}{{ c.subject }}{% endfor %}`
- **Loop variables**: `{{ loop.index }}`, `{{ loop.length }}`
- **Whitespace control**: `{%- ... -%}` strips surrounding whitespace

See `wt config create --help` for the full default templates.

## Appending to the prompt

`template-append` adds instructions to the default commit and squash prompts. Set it in user config for personal preferences or `.config/wt.toml` for shared project conventions. Fragments support the same template variables as the main prompt.

```toml
# .config/wt.toml
[commit.generation]
template-append = """
- Use conventional commits (feat:, fix:, docs:, …)
- Reference the related issue ID in the body
"""
```

When both are configured, user instructions come before project instructions.

The user fragment needs no approval — it's the developer's own config. For the project fragment, the first time the rendered text is sent to the LLM, Worktrunk shows the raw fragment in an approval prompt — the same one-shot gate as project-defined hooks. Subsequent commits don't re-prompt unless the fragment changes. Declining is non-fatal: the LLM runs with just the user fragment (if any).

Custom user templates that don't reference `{{ user_guidance }}` / `{{ project_guidance }}` opt out of the appended blocks — the rendered values are injected only where the template places them.

## Fallback behavior

When no LLM is configured, worktrunk generates deterministic messages: commits name the changed files (e.g., "Changes to auth.rs & config.rs"), and squashes get the subject `Squash commits from <branch>` with the combined commits listed in the body.

---

### Src Content Docs Merge (`docs/src/content/docs/merge.md`)

---
title: "wt merge"
description: "Merge a branch into the target branch. Squash & rebase, fast-forward the target branch, remove the worktree."
sidebar:
  order: 12
---


Merge a branch into the target branch. Squash & rebase, fast-forward the target branch, remove the worktree.

Unlike `git merge`, this merges a source branch into the target branch, not the target into the current branch. Similar to clicking "Merge pull request" on GitHub, but locally. The source defaults to the current branch (`--branch` names another); the target defaults to the default branch.

<figure class="demo">
<picture>
  <source srcset="/assets/docs/dark/wt-merge.gif" media="(prefers-color-scheme: dark)">
  <img src="/assets/docs/light/wt-merge.gif" alt="wt merge demo" width="1600" height="900">
</picture>
<figcaption>Creating a worktree, committing in it, and merging it away</figcaption>
</figure>

## Examples

Merge to the default branch:

```console
$ wt merge
◎ Running pre-merge project:test
  cargo nextest run
    Finished `test` profile [unoptimized + debuginfo] target(s) in 0.02s
     Summary [   0.002s] 2 tests run: 2 passed, 0 skipped
◎ Merging 1 commit to main @ a1b2c3d (no commit/squash/rebase needed)
  * a1b2c3d feat: add hook registration
   hook.rs | 31 +++++++++++++++++++++++++++++++
   1 file changed, 31 insertions(+)
✓ Merged to main (1 commit, 1 file, +31)
◎ Removing hooks worktree & branch in background (same commit as main, _)
○ Switched to worktree for main @ ~/repo
```

Merge to a different branch:

```console
$ wt merge develop
```

Merge another worktree's branch without leaving the current worktree:

```console
$ wt merge --branch feature/auth
$ wt merge develop --branch feature/auth
```

The source branch must have a checked-out worktree. Commit, squash, rebase, and hooks use that worktree and its project configuration. Cleanup removes the source worktree; the invoking worktree stays in place. A rebase conflict is left in the source worktree to resolve or abort.

Keep the worktree after merging:

```console
$ wt merge --no-remove
```

Preserve commit history (no squash):

```console
$ wt merge --no-squash
```

Create a merge commit — rebased semi-linear history by default:

```console
$ wt merge --no-ff
```

Skip committing/squashing (rebase still runs unless --no-rebase):

```console
$ wt merge --no-commit
```

Preserve the exact clean commit graph and tip:

```console
$ wt merge --no-commit --no-rebase
```

## Pipeline

`wt merge` runs these steps:

1. **Commit** — Pre-commit hooks run, then uncommitted changes are committed. Post-commit hooks run in the background. This step is skipped when squashing (the default) — changes are staged during the squash step instead. With `--no-squash`, this is the only commit step.
2. **Squash** — Combines all commits since target into one (like GitHub's "Squash and merge"). Pre-commit hooks see the staged changes, and their edits are staged into the squash commit; post-commit hooks run in the background after committing. Use `--stage` to control what gets staged: `all` (default), `tracked`, or `none`. Working-tree changes swept into the squash are backed up first to `refs/wt-backup/<branch>`; see [`wt step squash`](/step/#wt-step-squash) for recovery. With `--no-squash`, individual commits are preserved.
3. **Rebase** — Rebases onto target, skipping when nothing needs replaying ([`wt step rebase`](/step/#wt-step-rebase) gives the conditions). A conflict stops the merge with the rebase left open in the worktree, to resolve or abort. With `--no-rebase`, the graph produced by earlier commit/squash steps is preserved and the target must be able to fast-forward to its tip.
4. **Pre-merge hooks** — Hooks run after rebase, before merge. Failures abort. See [`wt hook`](/hook/).
5. **Merge** — Fast-forward merge to the target branch ([`wt step push`](/step/#wt-step-push)). With `--no-ff`, a merge commit is created instead — semi-linear history after the default rebase, while explicit `--no-rebase` preserves the graph produced by earlier steps before adding the merge commit. Non-fast-forward merges are rejected.
6. **Pre-remove hooks** — Hooks run before removing worktree. Failures abort.
7. **Cleanup** — Removes the worktree and branch. Use `--no-remove` to keep the worktree. When already on the target branch, on the default branch, in the primary worktree, locked, or containing another registered worktree, the worktree is preserved.
8. **Post-remove + post-merge hooks** — Run in background after cleanup.

Use `--no-commit` to skip committing uncommitted changes and squashing; rebase still runs by default and can rewrite commits unless `--no-rebase` is passed. Combining both flags preserves the exact source graph and requires the target to be its ancestor. Useful after preparing commits manually with `wt step commit`. Requires a clean working tree.

`wt merge` merges into the *local* target branch and never fetches.

## Local CI

Pre-merge hooks run checks locally before merging. A failed check stops the merge:

```toml
# .config/wt.toml
[[pre-merge]]
test = "cargo test"
lint = "cargo clippy"
```

## See also

- [`wt step`](/step/) — Run individual operations (commit, squash, rebase, push)
- [`wt remove`](/remove/) — Remove worktrees without merging
- [`wt switch`](/switch/) — Navigate to other worktrees

## Command reference

```
/* Detailed source-code truncated for AI context efficiency. */
```

---

### Src Content Docs Remove (`docs/src/content/docs/remove.md`)

---
title: "wt remove"
description: "Remove worktree; delete branch if merged. Defaults to the current worktree."
sidebar:
  order: 13
---


Remove worktree; delete branch if merged. Defaults to the current worktree.

## Examples

Remove current worktree:

```console
$ wt remove
◎ Running pre-remove project:cleanup
  flyctl scale count 0
Scaling app to 0 machines
◎ Removing api worktree & branch in background (same commit as main, _)
○ Switched to worktree for main @ ~/repo
```

Remove specific worktrees / branches:

```console
$ wt remove feature-branch
$ wt remove old-feature another-branch
```

To choose interactively, open the [`wt switch` picker](/switch/#interactive-picker) and press `Alt-x` on a row.

Keep the branch:

```console
$ wt remove --no-delete-branch feature-branch
```

If `[remove] delete-branch = false` is configured, use `--delete-branch` to delete a branch for one removal:

```console
$ wt remove --delete-branch feature-branch
```

Force-delete an unmerged branch:

```console
$ wt remove -D experimental
```

## Branch cleanup

By default, branches are deleted when they would add no changes to the default branch if merged. This works with both unchanged git histories, and squash-merge or rebase workflows where commit history differs but file changes match.

Worktrunk checks six conditions:

1. **Same commit** — Branch HEAD equals the default branch. Shows `_` in `wt list`.
2. **Ancestor** — Branch is in target's history (fast-forward or rebase case). Shows `⊂`.
3. **No added changes** — Three-dot diff (`target...branch`) is empty. Shows `⊂`.
4. **Trees match** — Branch tree SHA equals target tree SHA. Shows `⊂`.
5. **Merge adds nothing** — Simulated merge produces the same tree as target. Handles squash-merged branches where target has advanced with changes to different files. Shows `⊂`.
6. **Patch-id match** — Branch's entire diff matches a single squash-merge commit on target. Fallback for when the simulated merge conflicts because target later modified the same files the branch touched. Shows `⊂`.

The default-branch walk is capped so a single check stays fast; a squash merge with hundreds of commits landed since the merge point falls outside the cap and needs `-D` to remove.

The 'same commit' check uses the local default branch; for other checks, 'target' means the default branch, or its upstream (e.g., `origin/main`) when strictly ahead.

Branches matching these conditions and with empty working trees are dimmed in `wt list` as safe to delete.

## Force flags

Worktrunk has two force flags for different situations:

| Flag | Scope | When to use |
|------|-------|-------------|
| `--force` (`-f`) | Worktree | Worktree has uncommitted changes |
| `--force-delete` (`-D`) | Branch | Branch has unmerged commits |

```console
$ wt remove feature --force       # Remove dirty worktree
$ wt remove feature -D            # Delete unmerged branch
$ wt remove feature --force -D    # Both
```

Before `--force` discards uncommitted changes, Worktrunk saves them (except ignored files and changes inside submodules) to `refs/wt-backup/<branch>` and prints a command to recover them in a new worktree.

Use `--no-delete-branch` to keep the branch regardless of merge status.

## Background removal

Removal runs in the background by default — the command returns immediately, and output goes to `.git/wt/logs/{branch}/internal/remove.log`. Use `--foreground` to wait for it.

## Reaping processes

<span class="badge-experimental"></span>

`--reap` terminates processes left running in the worktree before it is removed — a `post-start` dev server, a file watcher, a language server — freeing the ports and file handles they hold. Processes are discovered by working directory: any process whose current directory is at or under the worktree path (`SIGTERM`, then `SIGKILL` for survivors).

```console
$ wt remove --reap feature
◎ Reaping 2 processes under feature worktree
   ┃ 51234 node
   ┃ 51240 esbuild
✓ Reaped 2 processes
◎ Removing feature worktree & branch in background (same commit as main, _)
```

To avoid killing work the user did not mean to kill, two guards keep `--reap` conservative:

- **Interactive processes are spared.** A process holding a controlling terminal — an interactive shell, or a terminal editor such as `vim` with unsaved buffers — is never reaped. Only detached processes remain candidates.
- **Discovery is by working directory only.** A process that started in the worktree and later changed directory, or a daemon that reparented to `init`, no longer reports a directory under the worktree and is not found. To reliably reap those, launch them with [`wt step tether`](/step/#wt-step-tether), which kills the whole process group when the worktree is removed.

Unix only; on Windows `--reap` is rejected.

## JSON output

`--format=json` prints one object per removal to stdout: `{kind, branch, path, branch_outcome, branch_checked_out_at}` for a worktree, with `pruned` in place of `path` for a branch-only removal. Branch-only results also include `detached_worktree`: the path of a detached worktree at the branch's expected location, which the removal leaves in place, or `null`.

`branch_outcome` names what happened to the branch, so a caller can tell a deletion the removal declined from one it was never asked to make:

| Value | Meaning |
|-------|---------|
| `deleted` | The branch is gone |
| `deferred` | Left to the background removal, whose result this run doesn't see. `--foreground` never reports it |
| `not_attempted` | No deletion was tried: a detached worktree, a sibling checkout, or `--no-delete-branch` |
| `retained_unmerged` | Declined: the branch was not integrated into the target |
| `retained_checked_out` | Declined: another worktree has the branch checked out |
| `retained_raced` | Declined: the branch moved during the removal. Retry |
| `retained_failed` | The delete command itself failed |

## Hooks

`pre-remove` hooks run before the worktree is deleted (with access to worktree files). `post-remove` hooks run after removal. See [`wt hook`](/hook/) for configuration.

## Detached HEAD worktrees

Detached worktrees have no branch name. Pass the worktree path instead: `wt remove /path/to/worktree`.

## See also

- [`wt merge`](/merge/) — Remove worktree after merging
- [`wt list`](/list/) — View all worktrees

## Command reference

```
/* Detailed source-code truncated for AI context efficiency. */
```

---

### Src Content Docs Shell Integration (`docs/src/content/docs/shell-integration.md`)

---
title: "Shell integration"
description: "How Worktrunk's shell wrapper changes the parent shell's directory, which files each shell gets, and how to debug integration that isn't working."
sidebar:
  order: 25
---
[`wt config shell`](/config/#wt-config-shell) covers setup, activation, and current-shell diagnostics. This guide covers installed files, warning messages, and wrapper behavior.

## Why shell integration exists

A subprocess can't change its parent shell's directory, so `wt` installs a shell function that runs the binary and then changes directory when the command asks. [How the shell wrapper works](#how-the-shell-wrapper-works) has the details.

## Installation

See [`wt config shell install`](/config/#wt-config-shell-install) for automatic installation and [`wt config shell init`](/config/#wt-config-shell-init) for manual setup in each supported shell.

Keep each initialization statement on its own line for automatic detection and removal. Customized initialization lines must be managed manually.

## Files created

[`wt config shell install`](/config/#wt-config-shell-install) appends a line to the bash, zsh, and PowerShell files, and writes the fish and Nushell files whole:

- **Bash**: `~/.bashrc`
- **Zsh**: `~/.zshrc` (or `$ZDOTDIR/.zshrc`)
- **Fish**: `~/.config/fish/functions/wt.fish` and `~/.config/fish/completions/wt.fish` (under `$XDG_CONFIG_HOME/fish` when that is set)
- **Nushell 0.113+** <span class="badge-experimental"></span>: `wt.nu` in Nushell's user vendor-autoload directory — the last entry of `$nu.vendor-autoload-dirs`, under `$nu.data-dir` (typically `~/.local/share/nushell/vendor/autoload` on Linux, `~/Library/Application Support/nushell/vendor/autoload` on macOS)
- **PowerShell** (Windows): both profile files, created if they don't exist:
  - `Documents/PowerShell/Microsoft.PowerShell_profile.ps1` (PowerShell 7+)
  - `Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1` (Windows PowerShell 5.1)

**PowerShell detection on Windows:** When running from cmd.exe or PowerShell, both PowerShell profile files are created automatically. When running from Git Bash or MSYS2, PowerShell is skipped (use `wt config shell install powershell` to create the profiles explicitly).

See [`wt config shell uninstall`](/config/#wt-config-shell-uninstall) for removal.

## Checking status

Run `wt config show`. Its SHELL INTEGRATION section reports whether the wrapper is active in the current shell.

## Warning messages

When shell integration isn't working, `wt switch` shows a warning explaining why.

### "shell wrapper is out of date"

**Meaning**: The active shell has a wrapper from an older Worktrunk version loaded, which can't follow a directory change.

**Fix**: Run `wt config shell install`, then restart the shell (or reload its config) to activate the current wrapper.

### "shell integration not installed"

**Meaning**: The current shell has no installed Worktrunk initialization line or wrapper file. The current shell is detected from the process tree (falling back to `$SHELL`), so this refers to the shell `wt` was actually invoked from, not necessarily the login shell.

**Fix**: Run `wt config shell install` or follow the [manual setup](/config/#wt-config-shell-init).

### "shell integration installed but not active"

**Meaning**: Shell integration is configured for the current shell, but the shell function isn't loaded in this session — usually because the session was started before installation.

**Fix**: Start a new terminal or run `source ~/.bashrc` (or equivalent). If the message persists after a restart, `wt config show` reports the detected shell, `$SHELL`, and per-shell integration status.

### "ran ./path/to/wt; shell integration wraps wt"

**Meaning**: The binary was invoked with an explicit path (like `./target/debug/wt` or `/usr/local/bin/wt`) instead of just `wt`. The shell wrapper only intercepts the bare command `wt`.

**Fix**: Use `wt` without a path. For testing dev builds, set `WORKTRUNK_BIN`:

```bash
export WORKTRUNK_BIN=./target/debug/wt
wt switch feature  # Now uses the dev build with shell integration
```

### "ran git wt; running through git prevents cd"

**Meaning**: `git wt` (git alias) was used instead of `wt`. Git runs worktrunk as a subprocess, bypassing the shell wrapper.

**Fix**: Use `wt` directly instead of `git wt` when directory switching is needed.

### "Alias bypasses shell integration"

**Meaning**: The alias invokes the binary directly, bypassing the shell function that changes directories.

**Fix**: Change the alias to point to the function name instead of the binary:

```bash
alias gwt="wt"       # Good - uses the shell function
alias gwt="git-wt"   # Good - uses the shell function
```

`wt config show` detects these problematic aliases and shows a warning with the suggested fix.

## How the shell wrapper works

The shell wrapper (installed by `wt config shell install`) defines a shell function that:

1. Creates a temp file
2. Sets `WORKTRUNK_DIRECTIVE_CD_FILE`
3. Runs the real `wt` binary
4. Reads the CD file with `cd -- "$(< file)"` (raw path, no shell parsing)
5. Cleans up the temp file

Simplified example (the actual wrapper also handles completions and edge cases):

```bash
wt() {
    local cd_file exit_code=0
    cd_file="$(mktemp)"

    WORKTRUNK_DIRECTIVE_CD_FILE="$cd_file" \
        command wt "$@" || exit_code=$?

    if [[ -s "$cd_file" ]]; then
        cd -- "$(<"$cd_file")"
    fi
    rm -f "$cd_file"
    return "$exit_code"
}
```

## Debugging checklist

### 1. Check whether the wrapper is loaded

```bash
# Should show a shell function, not a binary path
type wt

# Expected output (bash/zsh):
# wt is a function
# wt () { ... }

# If it shows a path like /usr/local/bin/wt, the wrapper isn't loaded
```

### 2. Check whether the wrapper is loaded (PowerShell)

```powershell
# PowerShell: should show Function, not just Application
Get-Command wt -All

# Expected output when the wrapper is loaded:
# CommandType  Name  Source
# -----------  ----  ------
# Function     wt
# Application  wt    C:\Users\...\wt.exe

# If only Application appears, the wrapper isn't loaded (restart the shell)
# If Function appears but integration is still "not active", check the body:
(Get-Command wt -CommandType Function).ScriptBlock | Select-String WORKTRUNK
```

### 3. Check the shell config file

```bash
# bash
grep -n "wt config shell init" ~/.bashrc

# zsh
grep -n "wt config shell init" ~/.zshrc

# fish (manual setup)
grep -n "wt config shell init" ~/.config/fish/config.fish
```

These commands show the initialization line and its line number. `wt config shell install` writes fish and Nushell wrapper files instead; check those at the locations listed under [Files created](#files-created).

### 4. Check whether directive files are set

```bash
# After running any wt command, this should be unset (the temp file is deleted)
echo $WORKTRUNK_DIRECTIVE_CD_FILE

# During wt execution, this is set to a temp file path
```

### 5. Test directive files manually

```bash
# Create the temp file and test
export WORKTRUNK_DIRECTIVE_CD_FILE=$(mktemp)
command wt switch feature
cat $WORKTRUNK_DIRECTIVE_CD_FILE     # Should contain: /path/to/worktree (raw path)
cd -- "$(<$WORKTRUNK_DIRECTIVE_CD_FILE)"  # Should cd you there
rm -f $WORKTRUNK_DIRECTIVE_CD_FILE
```

## Common issues

### Shell integration works in the terminal but not in an IDE terminal

IDE terminals may use different shell configs. Check:

- VS Code: Settings → Terminal → Integrated → Shell Args
- The IDE terminal might source a different profile

### Completions not working

Completions are installed alongside shell integration. If they're missing:

```bash
# Reinstall (forces regeneration)
wt config shell install

# For zsh, you may need compinit before the wt line:
autoload -Uz compinit && compinit
eval "$(wt config shell init zsh)"
```

### Windows Git Bash issues

If you see path issues, make sure you're on a recent Git for Windows version.

## Environment variables

| Variable | Purpose |
|----------|---------|
| `WORKTRUNK_DIRECTIVE_CD_FILE` | Set by the shell wrapper; `wt` writes a raw path, the wrapper `cd`s to it |
| `WORKTRUNK_BIN` | Override the binary path (for testing dev builds) |
| `WORKTRUNK_COMPLETE_NAME` | Set by the bash, zsh, and PowerShell wrappers when they load completions; names the command the registration binds to, so `--cmd` integrations complete |

## See also

- [`wt config shell`](/config/#wt-config-shell) — setup and current-shell diagnostics
- [FAQ: What files does Worktrunk create?](/faq/#what-files-does-worktrunk-create)

---

### Src Content Docs Step (`docs/src/content/docs/step.md`)

---
title: "wt step"
description: "Run individual operations. The building blocks of wt merge — commit, squash, rebase, push — plus standalone utilities."
sidebar:
  order: 16
---


Run individual operations. The building blocks of wt merge — commit, squash, rebase, push — plus standalone utilities.

## Examples

Commit with LLM-generated message:

```console
$ wt step commit
◎ Generating commit message and committing changes... (2 files, +26)
  feat(validation): add input validation utilities
✓ Committed changes @ a1b2c3d
```

Manual merge workflow with review between steps:

```console
$ wt step commit
$ wt step squash
$ wt step rebase
$ wt step push
```

## Operations

- [`commit`](#wt-step-commit) — Stage and commit with [LLM-generated message](/llm-commits/)
- [`squash`](#wt-step-squash) — Squash all branch commits into one with [LLM-generated message](/llm-commits/)
- [`rebase`](#wt-step-rebase) — Rebase onto target branch
- [`push`](#wt-step-push) — Fast-forward target to current branch
- [`diff`](#wt-step-diff) — Show all changes since branching (committed, staged, unstaged, untracked)
- [`copy-ignored`](#wt-step-copy-ignored) — Copy gitignored files between worktrees
- [`eval`](#wt-step-eval) — Evaluate a template expression
- [`for-each`](#wt-step-for-each) — Run a command in every worktree
- [`promote`](#wt-step-promote) — <span class="badge-experimental"></span> Swap a branch into the main worktree
- [`prune`](#wt-step-prune) — Remove worktrees and branches merged into the default branch
- [`relocate`](#wt-step-relocate) — <span class="badge-experimental"></span> Move worktrees to expected paths
- [`tether`](#wt-step-tether) — <span class="badge-experimental"></span> Run a command; kill its whole process tree when its worktree is removed
- [`<alias>`](/extending/#aliases) — Run a configured command alias

## See also

- [`wt merge`](/merge/) — Runs commit → squash → rebase → hooks → push → cleanup automatically
- [`wt hook`](/hook/) — Run configured hooks
- [Aliases](/extending/#aliases) — Custom command templates run as `wt <name>`

## Command reference

```text wt-command-reference
wt step - Run individual operations

The building blocks of wt merge — commit, squash, rebase, push — plus standalone utilities.

Usage: wt step [OPTIONS] <COMMAND>

Commands:
  commit        Stage and commit with LLM-generated message
  squash        Squash commits since branching
  rebase        Rebase onto target
  push          Fast-forward target to current branch
  diff          Show all changes since branching
  copy-ignored  Copy gitignored files to another worktree
  eval          Evaluate a template expression
  for-each      Run command in each worktree
  promote       [experimental] Swap a branch into the main worktree
  prune         Remove worktrees and branches merged into the default branch
  relocate      [experimental] Move worktrees to expected paths
  tether        [experimental] Run a command; kill its whole process tree when its worktree is
                removed

Options:
  -h, --help
          Print help (see a summary with '-h')

Global Options:
  -C <path>
          Working directory for this command

      --config <path>
          User config file path

      --config-set <toml>
          Override config with inline TOML, e.g. --config-set list.full=true (repeatable)

  -v, --verbose...
          Verbose output (-v: template variables; -vv: debug logs)

  -y, --yes
          Skip approval prompts
```

# Subcommands

## wt step commit

Stage and commit with LLM-generated message.

See [LLM-generated commit messages](/llm-commits/) for configuration and prompt customization. Without a `[commit.generation]` command configured, the commit still happens — the message is built from the staged file names instead (`Changes to README.md`).

### Operating on another worktree

`--branch` commits in another worktree's branch without leaving the current one:

```console
$ wt step commit --branch feature
```

The branch must have a checked-out worktree; staging, hooks, and the commit all happen there.

### Hooks

`pre-commit` hooks run before the commit and abort it on failure; `post-commit` hooks run after it, in the background with their output logged. `--no-hooks` skips both. See [`wt hook`](/hook/).

### Options

#### Staging

Controls what to stage before committing:

| Value | Behavior |
|-------|----------|
| `all` | Stage all changes including untracked files (default) |
| `tracked` | Stage only modified tracked files |
| `none` | Don't stage anything, commit only what's already staged |

```console
$ wt step commit --stage=tracked
```

Configure the default in user config:

```toml
# ~/.config/worktrunk/config.toml
[commit]
stage = "tracked"
```

#### Dry run

Render the prompt, print the LLM command, generate the message, and exit without staging, running hooks, or committing:

```console
$ wt step commit --dry-run
```

Three sections are printed: the rendered prompt, the shell command that would invoke the LLM, and the message returned. The LLM call still happens — only the commit is skipped.

### Command reference

```text wt-command-reference
wt step commit - Stage and commit with LLM-generated message

Usage: wt step commit [OPTIONS]

Options:
  -b, --branch <BRANCH>
          Branch to operate on (defaults to current worktree)

      --stage <STAGE>
          What to stage before committing [default: all]

          Possible values:
          - all:     Stage everything: untracked files + unstaged tracked changes
          - tracked: Stage tracked changes only (like git add -u)
          - none:    Stage nothing, commit only what's already in the index

      --dry-run
          Preview prompt, command, and generated message without committing

  -h, --help
          Print help (see a summary with '-h')

Automation:
      --no-hooks
          Skip hooks

      --format <FORMAT>
          Output format

          JSON prints structured result to stdout after the commit completes.

          [default: text]
          [possible values: text, json]
```

## wt step squash

Squash commits since branching. Stages changes and generates message with LLM.

See [LLM-generated commit messages](/llm-commits/) for configuration and prompt customization. Without a `[commit.generation]` command configured, the squash still happens — the message lists the squashed commits' subjects under `Squash commits from <branch>` instead.

### Hooks

`pre-commit` hooks run before the squash commit and abort it on failure; `post-commit` hooks run after it, in the background with their output logged. `--no-hooks` skips both. See [`wt hook`](/hook/).

The squash commit is made on a detached HEAD, as `git rebase` does, so git's own commit hooks run and see no current branch.

### Recovering staged changes

Before squashing, Worktrunk saves the uncommitted changes the squash includes (everything staged, by hand or by `--stage`) to `refs/wt-backup/<branch>`. Changes left out of the squash stay in the working tree and aren't backed up.

The output prints a command to recover the saved changes in a new worktree, including after `wt merge` removes the original.

### Options

#### Staging

Controls what to stage before squashing:

| Value | Behavior |
|-------|----------|
| `all` | Stage all changes including untracked files (default) |
| `tracked` | Stage only modified tracked files |
| `none` | Don't stage anything; squash commits plus what's already staged |

```console
$ wt step squash --stage=none
```

Configure the default in user config:

```toml
# ~/.config/worktrunk/config.toml
[commit]
stage = "tracked"
```

#### Dry run

Render the prompt, print the LLM command, generate the squash message, and exit without staging, running hooks, or squashing:

```console
$ wt step squash --dry-run
```

Three sections are printed: the rendered prompt, the shell command that would invoke the LLM, and the message returned. The LLM call still happens — only the squash is skipped.

### Command reference

```text wt-command-reference
wt step squash - Squash commits since branching

Stages changes and generates message with LLM.

Usage: wt step squash [OPTIONS] [TARGET]

Arguments:
  [TARGET]
          Target branch

          Defaults to default branch.

Options:
      --stage <STAGE>
          What to stage before committing [default: all]

          Possible values:
          - all:     Stage everything: untracked files + unstaged tracked changes
          - tracked: Stage tracked changes only (like git add -u)
          - none:    Stage nothing, commit only what's already in the index

      --dry-run
          Preview prompt, command, and generated message without squashing

  -h, --help
          Print help (see a summary with '-h')

Automation:
      --no-hooks
          Skip hooks

      --format <FORMAT>
          Output format

          JSON prints structured result to stdout after the squash completes.

          [default: text]
          [possible values: text, json]
```

## wt step rebase

Rebase onto target.

A rebase puts the branch's commits on top of the target, which is what [`wt step push`](#wt-step-push) needs — a push fast-forwards only if the target is an ancestor of the branch. `wt merge` runs this step as part of its pipeline; on its own it brings a branch up to date with a target that has moved, without merging into it.

The target is any commit: a branch, a tag, a SHA.

### Examples

```console
$ wt step rebase            # Rebase onto default branch
$ wt step rebase develop    # Rebase onto develop
$ wt step rebase v1.2.0     # Rebase onto a tag
```

### Outcomes

The first matching row wins:

| Branch and target | Result |
|-------------------|--------|
| The target is already an ancestor of the branch, with no merge commit in between | Nothing runs — `Already up to date` |
| The branch is an ancestor of the target, so it has no commits of its own | `Fast-forwarded to <target>` |
| Otherwise | The branch's commits replay onto the target's tip — refused outright if the two share no history |

### Conflicts

A conflicting commit leaves the rebase open rather than undoing it. The worktree keeps git's conflict markers, and the ways out are `git rebase --continue` once the conflict is resolved, `git rebase --skip`, or `git rebase --abort`. Until the rebase is settled, `wt step rebase`, `wt step squash`, `wt step push`, and `wt merge` refuse to run.

### Command reference

```text wt-command-reference
wt step rebase - Rebase onto target

Usage: wt step rebase [OPTIONS] [TARGET]

Arguments:
  [TARGET]
          Target branch, tag, or commit

          Defaults to default branch.

Options:
  -h, --help
          Print help (see a summary with '-h')

Automation:
      --format <FORMAT>
          Output format

          JSON prints structured result to stdout after the rebase completes.

          [default: text]
          [possible values: text, json]
```

## wt step push

Fast-forward target to current branch.

Despite the name, no commits leave the repository. The target branch's ref moves forward locally, and a worktree holding that branch is updated along with it. Publishing is a separate `git push` to the remote afterward.

The target is a branch, and must already be an ancestor of the current branch. One that has moved ahead is refused, and there is no force variant — [`wt step rebase`](#wt-step-rebase) puts the branch back on top of it first.

### Examples

```console
$ wt step push             # Fast-forward main to current branch
$ wt step push develop     # Fast-forward develop instead
$ wt step push --no-ff     # Merge commit instead of a fast-forward
```

### Target worktree

When the target branch has a worktree of its own, that worktree's files move to the new commits too. Uncommitted changes there never move: the update carries any file the push doesn't touch — staged or not — exactly where it is, and a change touching a file the push does change is refused upfront, naming the file. If the update can't be applied, it is rolled back, leaving branch and worktree as they were.

### Command reference

```text wt-command-reference
wt step push - Fast-forward target to current branch

Usage: wt step push [OPTIONS] [TARGET]

Arguments:
  [TARGET]
          Target branch

          Defaults to default branch.

Options:
      --no-ff
          Create a merge commit (no fast-forward)

  -h, --help
          Print help (see a summary with '-h')

Automation:
      --format <FORMAT>
          Output format

          JSON prints structured result to stdout after the push completes.

          [default: text]
          [possible values: text, json]
```

## wt step diff

Show all changes since branching. Includes committed, staged, unstaged, and untracked files.

This is what `wt merge` would include — a single diff against the merge base.

### Operating on another worktree

`--branch` diffs another worktree's branch without leaving the current one:

```console
$ wt step diff --branch feature
```

The branch must have a checked-out worktree.

### Extra git diff arguments

Arguments after `--` are forwarded to `git diff`:

```console
$ wt step diff -- --stat
$ wt step diff -- --name-only
$ wt step diff -- -- '*.rs'
```

The diff is pipeable to tools like `delta`:

```console
$ wt step diff | delta
```

### Command reference

```text wt-command-reference
wt step diff - Show all changes since branching

Includes committed, staged, unstaged, and untracked files.

Usage: wt step diff [OPTIONS] [TARGET] [-- <EXTRA_ARGS>...]

Arguments:
  [TARGET]
          Target branch

          Defaults to default branch.

  [EXTRA_ARGS]...
          Extra arguments forwarded to git diff

Options:
  -b, --branch <BRANCH>
          Branch to operate on (defaults to current worktree)

  -h, --help
          Print help (see a summary with '-h')
```

## wt step copy-ignored

Copy gitignored files to another worktree. Eliminates cold starts by copying build caches and dependencies.

### Setup

Add to the project config:

```toml
# .config/wt.toml
[post-start]
copy = "wt step copy-ignored"
```

### Choosing source and destination

By default the copy runs from the primary worktree into the current one — what a `post-start` hook needs, since the new worktree is where the hook runs. `--from` and `--to` name either end by branch, so a copy can run between two worktrees from anywhere:

```console
$ wt step copy-ignored --from main --to feature   # between two named worktrees
$ wt step copy-ignored --from feature             # from feature into the current worktree
```

A branch named by `--from` or `--to` must have a worktree.

### What gets copied

All gitignored files are copied by default, except for built-in excluded directories: VCS metadata (`.bzr/`, `.hg/`, `.jj/`, `.pijul/`, `.sl/`, `.svn/`), tool-state (`.conductor/`, `.entire/`, `.worktrees/`), and nested worktrees. Tracked files are never touched. Discovery handles nested `.gitignore` files, global excludes, and `.git/info/exclude`. Existing files in the destination are skipped, so re-running is safe; `--force` overwrites them.

To limit what gets copied further, create `.worktreeinclude` with gitignore-style patterns. Files must be **both** gitignored **and** in `.worktreeinclude`:

```text
# .worktreeinclude
.env
node_modules/
target/
```

After `.worktreeinclude` selects entries, you can add more gitignore-style excludes in user config, per-project user overrides, or project config:

```toml
# ~/.config/worktrunk/config.toml
[step.copy-ignored]
exclude = [".cache/", ".turbo/"]
```

To copy nothing unless `.worktreeinclude` exists — matching Claude Code desktop, where the file is required — pass `--require-include`:

```console
$ wt step copy-ignored --require-include
```

Without `.worktreeinclude`, the command is a no-op (it reports that nothing was copied and why). With the file present, only matching files copy as above. To apply this across every repository, put the flag in a user-config hook: `post-start = "wt step copy-ignored --require-include"`.

### Common patterns

| Type | Patterns |
|------|----------|
| Dependencies | `node_modules/`, `.venv/`, `target/`, `vendor/`, `Pods/` |
| Build caches | `.cache/`, `.next/`, `.parcel-cache/`, `.turbo/` |
| Generated assets | Images, ML models, binaries too large for git |
| Environment files | `.env` (if not generated per-worktree) |

### Copy-on-write

Files are reflinked where the filesystem supports it: APFS (macOS), btrfs and XFS (Linux), ReFS (Windows). A reflinked copy shares the source's disk blocks until one side writes. For a 14GB `target/` directory:

| Command | Time | Disk |
|---------|------|------|
| `cp -R` (full copy) | 2m | 14GB |
| `cp -Rc` / `wt step copy-ignored` | 20s | ~0 |

On ext4 and NTFS, which have no reflink, every file is copied in full; the summary says `(reflinked, no extra disk)` or `(full copy)`.

Reflinks are per file (like `cp -Rc`), so copy time scales with file count.

Use the `post-start` hook so the copy runs in the background. Use `pre-start` instead if subsequent hooks or `--execute` command need the copied files immediately.

### Language-specific notes

#### Rust

The `target/` directory is huge (often 1-10GB). Copying with reflink cuts first build from ~68s to ~3s by reusing compiled dependencies.

#### Node.js

`node_modules/` is large but mostly static. If the project has no native dependencies, symlinks are even faster:

```toml
# .config/wt.toml
[pre-start]
deps = "ln -sf {{ primary_worktree_path }}/node_modules ."
```

Git sees the symlink as a file, so `.gitignore` needs `node_modules` without a trailing slash. `node_modules/` matches only directories: the link stays untracked, a commit can pick it up, and merging that commit replaces the primary worktree's `node_modules` with a link to itself.

#### Python

Virtual environments contain absolute paths and can't be copied. Use `uv sync` instead — it's fast enough that copying isn't worth it.

### Behavior vs Claude Code on desktop

The `.worktreeinclude` pattern is shared with [Claude Code on desktop](https://code.claude.com/docs/en/desktop), which copies matching files when creating worktrees. Differences:

- worktrunk copies all gitignored files by default; Claude Code requires `.worktreeinclude`. Pass `--require-include` to match Claude Code (copy nothing without `.worktreeinclude`)
- worktrunk runs as a configurable hook in the worktree lifecycle

### Command reference

```text wt-command-reference
wt step copy-ignored - Copy gitignored files to another worktree

Eliminates cold starts by copying build caches and dependencies.

Usage: wt step copy-ignored [OPTIONS]

Options:
      --from <FROM>
          Source worktree branch

          Defaults to primary worktree.

      --to <TO>
          Destination worktree branch

          Defaults to current worktree.

      --dry-run
          Show what would be copied

      --force
          Overwrite existing files in destination

      --require-include
          Require .worktreeinclude to copy anything

  -h, --help
          Print help (see a summary with '-h')

Automation:
      --format <FORMAT>
          Output format

          JSON prints structured result to stdout after the copy completes.

          [default: text]
          [possible values: text, json]
```

## wt step eval

Evaluate a template expression. Prints the result to stdout for use in scripts and shell substitutions.

All [hook template variables and filters](/hook/#template-variables) are available.

### Examples

Get the port for the current branch:

```console
$ wt step eval '{{ branch | hash_port }}'
16066
```

Use in shell substitution:

```console
$ curl http://localhost:$(wt step eval '{{ branch | hash_port }}')/health
```

Combine multiple values:

```console
$ wt step eval '{{ branch | hash_port }},{{ ("supabase-api-" ~ branch) | hash_port }}'
16066,16739
```

Use conditionals and filters:

```console
$ wt step eval '{{ branch | sanitize_db }}'
feature_auth_oauth2_a1b
```

List the available template variables with `-v` (alongside the expansion, on stderr). The real block prints every variable in scope; this one is abridged:

```console
$ wt step eval -v '{{ branch }}'
○ eval template variables:
  branch                = feature/auth
  worktree_path         = /home/user/code/myproject.feature-auth
  …
  cwd                   = /home/user/code/myproject.feature-auth
○ eval source
  {{ branch }}
○ eval result
  feature/auth

feature/auth
```

### Command reference

```text wt-command-reference
wt step eval - Evaluate a template expression

Prints the result to stdout for use in scripts and shell substitutions.

Usage: wt step eval [OPTIONS] <TEMPLATE>

Arguments:
  <TEMPLATE>
          Template expression to evaluate

Options:
  -h, --help
          Print help (see a summary with '-h')

Automation:
      --format <FORMAT>
          Output format

          JSON prints {name, template, result} to stdout instead of the bare result.

          [default: text]
          [possible values: text, json]
```

## wt step for-each

Run command in each worktree. Executes sequentially with real-time output; continues past command failures.

A summary of successes and failures is shown at the end. Context JSON — a flat object of every template variable — is provided on stdin for scripts that need structured data.

### Arguments

Arguments after `--` are the program and its arguments — run directly, no shell.

```console
$ wt step for-each -- git status --short
$ wt step for-each -- npm install
```

For pipes, redirects, variables, or globs, wrap in `sh -c`:

```console
$ wt step for-each -- sh -c 'git status | wc -l'
$ wt step for-each -- sh -c 'echo $HOME && git pull'
```

### Template variables

Variables substitute into each argv element before exec. See [`wt hook` template variables](/hook/#template-variables) for the complete list and filters.

```console
$ wt step for-each -- echo 'Branch: {{ branch }}'
```

Each element is expanded fresh in every worktree, so `{{ branch }}` is that worktree's branch. An alias wrapping for-each renders templates earlier, in the invoking worktree; [nesting templates](/extending/#nesting-templates) shows how to keep a variable per-worktree.

### Examples

Pull updates in worktrees with upstreams (skips others):

```console
$ git fetch --prune && wt step for-each -- sh -c '[ "$(git rev-parse @{u} 2>/dev/null)" ] || exit 0; git pull --autostash'
```

### Command reference

```text wt-command-reference
wt step for-each - Run command in each worktree

Executes sequentially with real-time output; continues past command failures.

Usage: wt step for-each [OPTIONS] -- <ARGS>...

Arguments:
  <ARGS>...
          Command template (see --help for all variables)

Options:
      --format <FORMAT>
          Output format

          [default: text]
          [possible values: text, json]

  -h, --help
          Print help (see a summary with '-h')
```

## wt step promote

<span class="badge-experimental"></span>

Swap a branch into the main worktree. Exchanges branches and gitignored files between two worktrees.

**Experimental.** Use promote for temporary testing when the main worktree has special significance (Docker Compose, IDE configs, heavy build artifacts anchored to project root), and hooks & tools aren't yet set up to run on arbitrary worktrees. The idiomatic Worktrunk workflow does not use `promote`; instead each worktree has a full environment. `promote` is the only Worktrunk command which changes a branch in an existing worktree.

### Example

```console
# from ~/project (main worktree)
$ wt step promote feature
```

Before:

```
  Branch   Path
@ main     ~/project
+ feature  ~/project.feature
```

After:

```
  Branch   Path
@ feature  ~/project
+ main     ~/project.feature
```

To restore: `wt step promote main` from anywhere, or just `wt step promote` from the main worktree.

Without an argument, promotes the current branch — or restores the default branch if run from the main worktree.

### Requirements

- Both worktrees must be clean
- The branch must have an existing worktree

### Gitignored files

Gitignored files (build artifacts, `node_modules/`, `.env`) are swapped along with the branches so each worktree keeps the artifacts that belong to its branch. Files are discovered using the same mechanism as [`copy-ignored`](#wt-step-copy-ignored) and can be filtered with `.worktreeinclude`.

### Command reference

```text wt-command-reference
wt step promote - [experimental] Swap a branch into the main worktree

Exchanges branches and gitignored files between two worktrees.

Usage: wt step promote [OPTIONS] [BRANCH]

Arguments:
  [BRANCH]
          Branch to promote to main worktree

          Defaults to current branch, or default branch from main worktree.

Options:
  -h, --help
          Print help (see a summary with '-h')

Automation:
      --format <FORMAT>
          Output format

          JSON prints structured result to stdout after the promote completes. The mismatch warning
          still appears on stderr in JSON mode (safety signal).

          [default: text]
          [possible values: text, json]
```

## wt step prune

Remove worktrees and branches merged into the default branch.

Bulk-removes worktrees and branches that are integrated into the default branch, using the same criteria as `wt remove`'s branch cleanup. Stale worktree entries are cleaned up too, except one whose git metadata holds staged changes or an operation in progress; `git worktree repair` can still restore those.

In `wt list`, candidates show `_` (same commit) or `⊂` (content integrated). Run `--dry-run` to preview. See `wt remove --help` for the full integration criteria.

Locked worktrees, worktrees with uncommitted changes, worktrees containing another worktree, and the main worktree are always skipped. The current worktree is removed last, triggering cd to the primary worktree. Pre-remove and post-remove hooks run for each removal; a candidate whose hooks include an unapproved project command is skipped with `(approval required)` (pre-approve with `wt config approvals add`, or pass `--yes`).

Prune removes worktrees concurrently, so hooks that write shared resources must coordinate those writes.

### Min-age guard

Candidates younger than `--min-age` (default: 1 day) are skipped, so a worktree just created from the default branch isn't removed for looking "merged" (its branch points at the same commit). A worktree's age is its creation time; a branch with no worktree takes its age from its reflog. A branch with no reflog, which is common in bare repositories, can look new again after Git maintenance or a branch deletion, and is then skipped until `--min-age` passes.

```console
$ wt step prune --min-age=0s     # no age guard
$ wt step prune --min-age=2d     # skip candidates younger than 2 days
```

### JSON output

`--format=json` prints one object per candidate to stdout. A live run reports `branch_outcome`, as [`wt remove`](/remove/#json-output) does. `--dry-run` reports `branch_deleted` (whether the removal would delete the branch), `reason` (why the candidate qualifies), and `target` (what it was measured against).

### Examples

Preview what would be removed:

```console
$ wt step prune --dry-run
```

Remove all merged worktrees:

```console
$ wt step prune
```

### Command reference

```text wt-command-reference
wt step prune - Remove worktrees and branches merged into the default branch

Usage: wt step prune [OPTIONS]

Options:
      --dry-run
          Show what would be removed

      --min-age <MIN_AGE>
          Skip worktrees and branches younger than this

          [default: 1d]

      --foreground
          Run removal in foreground (block until complete)

      --format <FORMAT>
          Output format

          [default: text]
          [possible values: text, json]

  -h, --help
          Print help (see a summary with '-h')
```

## wt step relocate

<span class="badge-experimental"></span>

Move worktrees to expected paths. Relocates worktrees whose path doesn't match the worktree-path template.

### Examples

Preview what would be moved:

```console
$ wt step relocate --dry-run
```

Move all mismatched worktrees:

```console
$ wt step relocate
```

Auto-commit dirty worktrees and clobber non-worktree blockers:

```console
$ wt step relocate --commit --clobber
```

Move specific worktrees:

```console
$ wt step relocate feature bugfix
```

### Swap handling

When worktrees are at each other's expected locations (e.g., `alpha` at
`repo.beta` and `beta` at `repo.alpha`), relocate automatically resolves
this by using a temporary location.

### Clobbering

With `--clobber`, non-worktree paths at target locations are moved to
`<path>.bak.<timestamp>` before relocating, never overwriting an existing
backup.

### Main worktree behavior

The main worktree can't be moved with `git worktree move`. Instead, relocate
switches it to the default branch and creates a new linked worktree at the
expected path. Untracked and gitignored files remain at the original location.

### Dirty worktrees

Linked worktrees relocate as-is — `git worktree move` carries uncommitted
changes along. Only the main worktree skips when dirty (its `git switch`
refuses), unless `--commit` is passed.

### Skipped worktrees

- **Dirty main worktree** (without `--commit`) — use `--commit` to auto-commit first
- **Locked** — unlock with `git worktree unlock`
- **Target blocked** (without `--clobber`) — use `--clobber` to backup blocker
- **Target is a worktree outside this relocation** — relocate or remove that worktree first
- **Unresolved conflicts** (with `--commit`) — resolve them first
- **Detached HEAD** — no branch to compute expected path

### Command reference

```text wt-command-reference
wt step relocate - [experimental] Move worktrees to expected paths

Relocates worktrees whose path doesn't match the worktree-path template.

Usage: wt step relocate [OPTIONS] [BRANCHES]...

Arguments:
  [BRANCHES]...
          Worktrees to relocate (defaults to all mismatched)

Options:
      --dry-run
          Show what would be moved

      --commit
          Commit uncommitted changes before relocating

      --clobber
          Backup non-worktree paths at target locations

          Moves blocking paths to <path>.bak.<timestamp>.

  -h, --help
          Print help (see a summary with '-h')

Automation:
      --format <FORMAT>
          Output format

          JSON prints structured result to stdout after the relocate completes.

          [default: text]
          [possible values: text, json]
```

## wt step tether

<span class="badge-experimental"></span>

Run a command; kill its whole process tree when its worktree is removed. Teardown is automatic and needs no pre-remove hook; the group gets SIGTERM then SIGKILL.

### Why

`pre-remove` hooks run only when Worktrunk removes a worktree. `tether` also stops the command when another tool removes the worktree.

### Arguments

Arguments after `--` are the program and its arguments, run directly, no shell.

```console
$ wt step tether -- npm run dev
```

For pipes, redirects, variables, or globs, wrap in `sh -c`:

```console
$ wt step tether -- sh -c 'PORT=$P npm run dev | tee dev.log'
```

To run the command from a subdirectory, pass the global `-C` flag:

```console
$ wt step tether -C frontend -- npm run dev
```

### Examples

Run a dev server, torn down automatically when the worktree goes away:

```toml
# .config/wt.toml
[post-start]
server = "wt step tether -- npm run dev -- --port {{ branch | hash_port }}"
```

### Command reference

```text wt-command-reference
wt step tether - [experimental] Run a command; kill its whole process tree when its worktree is removed

Teardown is automatic and needs no pre-remove hook; the group gets SIGTERM then SIGKILL.

Usage: wt step tether [OPTIONS] -- <COMMAND>...

Arguments:
  <COMMAND>...
          Command to run (after --, run directly, no shell)

Options:
  -h, --help
          Print help (see a summary with '-h')
```

---

### Src Content Docs Switch (`docs/src/content/docs/switch.md`)

---
title: "wt switch"
description: "Switch to a worktree; create if needed."
sidebar:
  order: 10
---


Switch to a worktree; create if needed.

Worktrees are addressed by branch name; paths are computed from a configurable template. Unlike `git switch`, this navigates between worktrees rather than changing branches in place.

<figure class="demo">
<picture>
  <source srcset="/assets/docs/dark/wt-switch.gif" media="(prefers-color-scheme: dark)">
  <img src="/assets/docs/light/wt-switch.gif" alt="wt switch demo" width="1600" height="900">
</picture>
<figcaption>Switching to a worktree, creating one, and creating one that launches an agent</figcaption>
</figure>

## Examples

```console
$ wt switch feature-auth           # Switch to worktree
$ wt switch -                      # Previous worktree (like cd -)
$ wt switch --create new-feature   # Create new branch and worktree
$ wt switch --create hotfix --base production
$ wt switch pr:123                 # Switch to PR #123's branch
$ wt switch https://github.com/owner/repo/pull/123   # ...or paste the PR's URL
```

## Creating a branch

The `--create` flag creates a new branch from `--base` — the default branch unless specified. Without `--create`, the branch must already exist. Switching to a remote branch (e.g., `wt switch feature` when only `origin/feature` exists) creates a local tracking branch.

To complete branches from a specific remote, type its prefix before pressing Tab (e.g., `wt switch origin/`).

A new branch tracks the remote branch it starts from only when the two share a name: `--create release --base origin/release` tracks `origin/release`, while `--create feature --base origin/release` gets no upstream. Publish such a branch with `git push --set-upstream origin <branch>`, or set git's `push.autoSetupRemote = true` once.

## Creating worktrees

If the branch already has a worktree, `wt switch` changes directories to it. Otherwise, it creates one:

1. Runs [pre-switch hooks](/hook/#hook-types), blocking until complete
2. Creates worktree at configured path (or at `--path`)
3. Switches to new directory
4. Runs [pre-start hooks](/hook/#hook-types), blocking until complete
5. Spawns [post-start](/hook/#hook-types) and [post-switch hooks](/hook/#hook-types) in the background

```console
$ wt switch feature                        # Existing branch → creates worktree
$ wt switch --create feature               # New branch and worktree
$ wt switch --create fix --base release    # New branch from release
$ wt switch --create temp --no-hooks       # Skip hooks
```

### Custom path

<span class="badge-experimental"></span>

`--path` places one worktree outside the `worktree-path` template, keeping the branch name intact:

```console
$ wt switch --create feature/JIRA-1234 --path ../dark-mode
$ wt switch ../dark-mode                   # Switch by path...
$ wt switch feature/JIRA-1234              # ...or by branch
```

Other commands reach it by branch or path as usual. [`wt list`](/list/#worktree) marks it `⚐`, since it isn't at the path its branch implies, and [`wt step relocate`](/step/#wt-step-relocate) offers to move it back to the template path.

## Naming a worktree

Worktrees are addressed by branch name, and every argument that takes one also accepts the path of the worktree itself — resolved after the branch, so a directory never shadows a branch sharing its name. A path names what a branch cannot: a detached worktree, or one of two checkouts of the same branch. Relative paths resolve against `-C` and a leading `~` against the home directory, so a path worktrunk printed can be pasted back.

## Shortcuts

| Shortcut | Meaning |
|----------|---------|
| `^` | Default branch (`main`/`master`) |
| `@` | Current branch/worktree |
| `-` | Previous worktree (like `cd -`) |
| `pr:{N}` | GitHub PR #N's branch |
| `mr:{N}` | GitLab MR !N's branch |

```console
$ wt switch -                           # Back to previous
$ wt switch ^                           # Default branch worktree
$ wt switch --create fix --base=@       # Branch from current HEAD
$ wt switch --create fix --base=pr:123  # Branch from PR #123's head
$ wt switch pr:123                      # PR #123's branch
$ wt switch mr:101                      # MR !101's branch
```

Shortcuts also apply to `--base`.

## Interactive picker

When called without arguments, `wt switch` opens an interactive picker to browse and select worktrees with live preview. The candidate set widens with `--branches` (local branches without worktrees), `--remotes` (remote branches), and `--prs` (open PRs/MRs — see below).

The CI column shows each row's PR/MR CI and review status, the same as [`wt list --full`](/list/).

<figure class="demo">
<picture>
  <source srcset="/assets/docs/dark/wt-switch-picker.gif" media="(prefers-color-scheme: dark)">
  <img src="/assets/docs/light/wt-switch-picker.gif" alt="wt switch picker demo" width="1600" height="900">
</picture>
<figcaption>Alt-p to reveal the CI and summary columns as they fill in, then paging a diff, a PR's comment thread, and the PR itself</figcaption>
</figure>

**Keybindings:**

| Key | Action |
|-----|--------|
| `↑`/`↓` | Navigate worktree list |
| (type) | Filter worktrees |
| `Enter` | Switch to selected worktree |
| `Alt-c` | Create new worktree named as entered text |
| `Alt-x` | Remove selected worktree/branch (never forces; not the current worktree) |
| `Alt-y` | Copy selected branch name to the clipboard |
| `Alt-o` | Open the selected row's PR/MR URL in the browser |
| `Alt-r` | Refresh the list (pick up worktrees created elsewhere) |
| `Esc` | Cancel |
| `Alt-1`–`Alt-8` | Jump to a preview tab |
| `Tab`/`Shift-Tab` | Cycle available preview tabs forward/backward |
| `Alt-p` | Toggle preview panel |
| `Ctrl-u`/`Ctrl-d` | Scroll preview up/down |

On macOS, `Alt` is the Option key; the terminal needs to send it as Meta (e.g. Terminal.app's [Use Option as Meta key](https://support.apple.com/guide/terminal/change-profiles-keyboard-settings-trmlkbrd/mac)).

The filter matches each row's branch, path, and — when it has a PR/MR — the PR/MR's number, title, and author. Typing `+` narrows to linked worktrees, and `@` to the current worktree.

**Preview tabs:**

1. **diff** — One net diff from the comparison base through the current worktree: committed, staged, unstaged, and untracked changes
2. **working** — Staged, unstaged, and untracked changes against `HEAD`
3. **committed** — Committed changes since the comparison base
4. **log** — Recent commits; commits already on the default branch have dimmed hashes
5. **remote⇅** — Ahead/behind diff vs upstream tracking branch
6. **summary** — LLM-generated branch summary; requires `[list] summary = true` and [`commit.generation`](/config/#commit)
7. **pr** — The selected row's PR/MR, for any row whose branch has one
8. **comments** — The PR/MR's comment thread, fetched from the forge for any row whose branch has one

The comparison base is the merge-base with the default branch, or with its upstream when the local default branch lags. The picker opens on **diff** for local rows and **pr** for a PR/MR listed by `--prs` but not available locally. A tab with no content for the selected row has a dimmed label, and the active tab's label is underlined. `Tab` and `Shift-Tab` skip the dimmed tabs; `Alt-1` through `Alt-8` open any tab directly. After you choose a tab, that choice stays active while you navigate.

**Pager configuration:** The preview panel pipes diff output through git's pager. Override in user config:

```toml
# ~/.config/worktrunk/config.toml
[switch.picker]
pager = "delta --paging=never --width=$COLUMNS"
```

**Hiding the preview:** Set `preview = false` under `[switch.picker]` to open the picker with the preview hidden; `Alt-p` still shows it.

## Pull requests and merge requests

The `pr:<number>` / `mr:<number>` shortcut and the PR/MR's web URL both resolve to its branch. For same-repo PRs/MRs, worktrunk switches to the branch directly. For fork PRs/MRs, it fetches the ref (`refs/pull/N/head` or `refs/merge-requests/N/head`) and configures `pushRemote` to the fork URL.

```console
$ wt switch pr:101                                  # GitHub PR #101
$ wt switch https://github.com/owner/repo/pull/101  # ...the same PR, by URL
$ wt switch mr:101                                  # GitLab MR !101
$ wt switch https://gitlab.com/owner/repo/-/merge_requests/101  # ...the same MR, by URL
$ wt switch --prs                                   # Browse open PRs/MRs in the picker
```

Both work anywhere a branch is accepted, including `--base`. The `--create` flag cannot be used with a PR/MR reference since the branch already exists.

If the PR or MR is on a fork, the local branch uses its branch name directly, so `git push` works normally. If a local branch with that name already exists for a different ref, Worktrunk uses a prefixed branch instead. The prefixed branch can fetch the PR or MR but cannot push to the fork.

The `--prs` flag adds the repository's open PRs (GitHub) or MRs (GitLab) that aren't already in the interactive picker. Selecting one switches to it as `pr:<number>` / `mr:<number>` would.

Requires `gh` (GitHub), `glab` (GitLab), or an equivalent CLI installed and authenticated; see [forge platform](/config/#forge-platform) for Gitea, Azure DevOps, and other supported platforms.

## When wt switch fails

- **Branch doesn't exist** — Use `--create`, or check `wt list --branches`
- **Path occupied** — Another worktree is at the target path; switch to it or remove it
- **Stale directory** — Use `--clobber` to remove a non-worktree directory at the target path

To change which branch a worktree is on, use `git switch` inside that worktree.

## See also

- [`wt list`](/list/) — View all worktrees
- [`wt remove`](/remove/) — Delete worktrees when done
- [`wt merge`](/merge/) — Integrate changes back to the default branch

## Command reference

```
/* Detailed source-code truncated for AI context efficiency. */
```

---

### Src Content Docs Tips Patterns (`docs/src/content/docs/tips-patterns.md`)

---
title: "Tips & Patterns"
description: "Practical recipes for Worktrunk workflows: repo layout, aliases and hooks, per-worktree dev servers and databases, agent handoffs, and branch status."
sidebar:
  order: 24
---
Practical recipes for common Worktrunk workflows.

## Setup and layout

### Shell alias for new worktree + agent

Create a worktree and launch Claude in one command:

```bash
alias wsc='wt switch --create --execute=claude'
wsc new-feature                       # Creates worktree, runs hooks, launches Claude
wsc feature -- 'Fix GH #322'          # Runs `claude 'Fix GH #322'`
```

### Shortcuts

Special arguments work across all commands—see [`wt switch`](/switch/#shortcuts) for the full list.

```bash
wt switch --create hotfix --base=@       # Branch from current HEAD
wt switch -                              # Switch to previous worktree
wt remove @                              # Remove current worktree
```

### Stacked branches

Branch from current HEAD instead of the default branch:

```bash
wt switch --create feature-part2 --base=@
```

### Reuse `default-branch`

Default branch [detection](/config/#wt-config-state-default-branch) means scripts work on any repo — no need to hardcode `main` or `master`:

```bash
git rebase $(wt config state default-branch)
```

In hooks and aliases, the same value is the `{{ default_branch }}` [template variable](/hook/#template-variables); reserve this command for plain shell scripts.

### Override `default-branch` for one clone

When the integration branch differs from the remote's `HEAD`, set a [clone-local override](/config/#wt-config-state-default-branch):

```bash
wt config state default-branch set integration
```

### Bare repository layout

A [bare repository](https://git-scm.com/docs/gitrepository-layout) has no working tree, so all branches — including the default — are [linked worktrees](https://git-scm.com/docs/git-worktree) at equal paths. No branch gets special treatment.

Cloning a bare repo into `<project>/.git` puts all worktrees under one directory:

```bash
git clone --bare <url> myproject/.git
cd myproject
git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'
git fetch origin
git remote set-head origin --auto
```

The fetch refspec creates remote-tracking branches such as `origin/main`; `git remote set-head` records the remote's default branch.

With `worktree-path = "{{ repo_path }}/../{{ branch | sanitize }}"`, worktrees become subdirectories of `myproject/`:

```
myproject/
├── .git/       # bare repository
├── main/       # default branch worktree
├── feature/    # feature branch worktree
└── bugfix/     # bugfix branch worktree
```

#### Configure the worktree path

On first `wt switch` in a bare repo at a hidden path (`.git`, `.bare`), worktrunk detects that the default template would produce broken paths like `myproject/.git.main` and offers a fix:

```
▲ Bare repo at myproject/.git — worktrees will be at myproject/.git.main
◎ Configure worktree-path to place worktrees at myproject/main? [y/N/?]
```

Accepting writes a project-scoped entry to user config:

```toml
# ~/.config/worktrunk/config.toml
[projects."github.com/myorg/myrepo"]
worktree-path = "{{ repo_path }}/../{{ branch | sanitize }}"
```

Run `wt config show` from inside any worktree to find the project identifier (`Identifier: …` in the PROJECT CONFIG section). Set it globally with `worktree-path = "..."` at the top level if this layout is preferred for all bare repos.

#### Create the first worktree

```bash
wt switch main
```

For a freshly cloned bare repo the default branch already exists, so `wt switch main` (without `--create`) is enough. Use `wt switch --create <branch>` for new branches.

Now `wt switch --create feature` creates `myproject/feature/`.

#### Set up the project config

The project config (`.config/wt.toml`) must live inside a worktree — the bare `.git` directory has no tracked files. Once the first worktree exists, create it from there:

```bash
wt switch main
wt config create --project
```

Commit the file and it will appear in every worktree automatically.

## Aliases and hooks

### `wt` aliases

Compose with template filters and [vars](/tips-patterns/#per-branch-variables):

```toml
# .config/wt.toml
[aliases]
# Open this worktree's dev server
open = "open http://localhost:{{ branch | hash_port }}"

# Test with branch-specific features from vars
test = "cargo test --features {{ vars.features | default('default') }}"

# Switch via the interactive picker, print the chosen branch
pick = "wt switch --format=json | jq -r '.branch'"
```

See [Aliases](/extending/#aliases) for scoping, approval, and reference.

### Per-branch variables

`wt config state vars` holds state per branch, accessible from templates (`{{ vars.key }}`) and the CLI. Some uses:

- **Coordinate state across pipeline steps** — see [Database per worktree](/tips-patterns/#database-per-worktree) below for a full recipe
- **Stick a branch to an environment** — `wt config state vars set env=staging`, then `{{ vars.env | default('dev') }}` in hooks
- **Parametrize aliases per branch** — see [`wt` aliases above](/tips-patterns/#wt-aliases)

See [`wt config state vars`](/config/#wt-config-state-vars) for storage format, JSON support, and reference.

### Task runners in hooks

Reference Taskfile/Justfile/Makefile in hooks:

```toml
# .config/wt.toml
[pre-start]
"setup" = "task install"

[pre-merge]
"validate" = "just test lint"
```

### Progressive validation

Split checks across hook types — quick feedback before each commit, expensive suites before merge:

```toml
# .config/wt.toml
[[pre-commit]]
lint = "npm run lint"
typecheck = "npm run typecheck"

[[pre-merge]]
test = "npm test"
build = "npm run build"
```

`pre-commit` runs during `wt merge`, before the squash commit; `pre-merge` runs once per merge after the rebase, so it's the right place for the slow tests.

### Target-specific hooks

Branch on `{{ target }}` to vary behavior per merge destination — for example, deploying to production from `main` and staging from a release branch:

```toml
# .config/wt.toml
post-merge = """
if [ {{ target }} = main ]; then
    npm run deploy:production
elif [ {{ target }} = staging ]; then
    npm run deploy:staging
fi
"""
```

`{{ target }}` is the branch being merged into. `post-merge` runs in the target's worktree (or the primary worktree if target has none), so deploy commands see the merged code.

## Per-worktree services

### Dev server per worktree

Each worktree runs its own dev server on a deterministic port. The `hash_port` filter generates a stable port (10000-19999) from the branch name:

```toml
# .config/wt.toml
[post-start]
server = "wt step tether -- npm run dev -- --port {{ branch | hash_port }}"

[list]
url = "http://localhost:{{ branch | hash_port }}"
```

[`wt step tether`](/step/#wt-step-tether) runs the server in its own process group and tears the whole group down when the worktree is removed, so no `pre-remove` hook is needed. See the [`wt step tether`](/step/#wt-step-tether) docs for the full rationale and platform behavior.

The URL column in `wt list` shows each worktree's dev server:



```console
$ wt list
  Branch       Status       @±        ^↕        ^…±     Remote⇅  URL                     Commit
@ main           ? ^⇅      +5                            ⇡1  ⇣1  http://localhost:12107  41ee083
+ feature-api  +   ↕⇡     +54   -5   ↑4  ↓1  +234  -24   ⇡3      http://localhost:10703  6814f02
+ fix-auth         ↕|                ↑2  ↓1   +25  -11     |     http://localhost:16460  b772e68
+ fix-typos        _|                                      |     http://localhost:14301  41ee083

○ Showing 4 worktrees, 2 with changes, 2 ahead, hidden: Path, Age, Message  (? untracked files)
```



`fix-auth` always gets port 16460, on any machine. The URL dims if the server isn't running.

### Database per worktree

Each worktree can have its own isolated database. A pipeline sets up names and ports as [vars](/config/#wt-config-state-vars), then later steps and hooks reference them:

```toml
# .config/wt.toml
[[post-start]]
set-vars = """
wt config state vars set container='{{ repo }}-{{ branch | sanitize }}-postgres' &&
wt config state vars set port='{{ ('db-' ~ branch) | hash_port }}' &&
wt config state vars set db-url='postgres://postgres:dev@localhost:{{ ('db-' ~ branch) | hash_port }}/{{ branch | sanitize_db }}'
"""

[[post-start]]
db = """
docker run -d --rm \
  --name {{ vars.container }} \
  -p {{ vars.port }}:5432 \
  -e POSTGRES_DB={{ branch | sanitize_db }} \
  -e POSTGRES_PASSWORD=dev \
  postgres:16
"""

[pre-remove]
db-stop = "docker stop {{ vars.container }} 2>/dev/null || true"
```

The first pipeline step derives values from the branch and stores them as vars. The second step references `{{ vars.container }}` and `{{ vars.port }}` — templates render when each step runs, so the vars are already set. `pre-remove` reads the same vars to stop the container.

The `('db-' ~ branch)` concatenation hashes differently than plain `branch`, so database and dev server ports don't collide. The `sanitize_db` filter produces database-safe identifiers (lowercase, underscores, no leading digits, with a short hash suffix).

The connection string is accessible anywhere — not just in hooks:

```bash
DATABASE_URL=$(wt config state vars get db-url) npm start
```

### Per-worktree env vars

To scope environment variables to a worktree — a tool's package path, a profile, an API endpoint — use a directory environment manager like [direnv](https://direnv.net) or [mise](https://mise.jdx.dev). Both hook the shell prompt, so they activate on the `cd` that `wt switch` already performs — no worktrunk configuration needed. Commit the config at the repo root and every worktree gets its own copy, with paths resolving relative to that worktree.

**direnv** — commit `.envrc` at the repo root:

```sh
# .envrc
export MY_PACKAGES_PATH="$(expand_path .packages)"
```

Run `direnv allow` once per worktree to trust the file ([getting started](https://direnv.net/#getting-started)). After that, switching into a worktree loads the env; switching out unloads it.

**mise** — commit `mise.toml` at the repo root:

```toml
# mise.toml
[env]
MY_PACKAGES_PATH = "{{ config_root }}/.packages"
```

`{{ config_root }}` is the project root mise resolves relative paths against ([env directives](https://mise.jdx.dev/environments/)) — the worktree root, not the primary worktree. mise also covers Windows / PowerShell, which direnv doesn't natively.

Both set real environment variables in the shell session, so every child process inherits them — hooks, build tools, subshells. Each new worktree is a new path, so it needs its own one-time trust step (`direnv allow` / `mise trust`).

### Eliminate cold starts

Use [`wt step copy-ignored`](/step/#wt-step-copy-ignored) to copy gitignored files (caches, dependencies, `.env`) between worktrees:

```toml
# .config/wt.toml
[post-start]
copy = "wt step copy-ignored"
```

When another hook depends on the copy — for example, copying `node_modules/` before `pnpm install` so the install reuses cached packages — sequence them with a `[[post-start]]` pipeline:

```toml
# .config/wt.toml
[[post-start]]
copy = "wt step copy-ignored"

[[post-start]]
install = "pnpm install"
```

Use `pre-start` instead when an `--execute` command needs the copied files immediately.

All gitignored files are copied by default. To limit what gets copied, create `.worktreeinclude` with patterns — files must be both gitignored and listed. See [`wt step copy-ignored`](/step/#wt-step-copy-ignored) for details.

### Subdomain routing with Caddy



Clean URLs like `http://feature-auth.myproject.localhost` without port numbers. Useful for cookies, CORS, and matching production URL structure.

**Prerequisites:** [Caddy](https://caddyserver.com/docs/install) (`brew install caddy`)

```toml
# .config/wt.toml
[post-start]
server = "wt step tether -- npm run dev -- --port {{ branch | hash_port }}"
proxy = """
  curl -sf --max-time 0.5 http://localhost:2019/config/ || caddy start
  curl -sf http://localhost:2019/config/apps/http/servers/wt || \
    curl -sfX PUT http://localhost:2019/config/apps/http/servers/wt -H 'Content-Type: application/json' \
      -d '{"listen":[":8080"],"automatic_https":{"disable":true},"routes":[]}'
  curl -sf -X DELETE http://localhost:2019/id/wt:{{ repo }}:{{ branch | sanitize }} || true
  curl -sfX PUT http://localhost:2019/config/apps/http/servers/wt/routes/0 -H 'Content-Type: application/json' \
    -d '{"@id":"wt:{{ repo }}:{{ branch | sanitize }}","match":[{"host":["{{ branch | sanitize }}.{{ repo }}.localhost"]}],"handle":[{"handler":"reverse_proxy","upstreams":[{"dial":"127.0.0.1:{{ branch | hash_port }}"}]}]}'
"""

[pre-remove]
proxy = "curl -sf -X DELETE http://localhost:2019/id/wt:{{ repo }}:{{ branch | sanitize }} || true"

[list]
url = "http://{{ branch | sanitize }}.{{ repo }}.localhost:8080"
```

**How it works:**

1. `wt switch --create feature-auth` runs the `post-start` hook, starting the dev server on a deterministic port (`{{ branch | hash_port }}` → 18283)
2. The hook starts Caddy if needed and registers a route using the same port: `feature-auth.myproject` → `localhost:18283`
3. `*.localhost` resolves to `127.0.0.1` via the OS
4. Visiting `http://feature-auth.myproject.localhost:8080`: Caddy matches the subdomain and proxies to the dev server

### Tmux session per worktree

Each worktree gets its own tmux session with a multi-pane layout.

```toml
# .config/wt.toml
[pre-start]
tmux = """
S={{ branch | sanitize }}
W={{ worktree_path }}
tmux new-session -d -s "$S" -c "$W" -n dev

# Create 4-pane layout: shell | backend / claude | frontend
tmux split-window -h -t "$S:dev" -c "$W"
tmux split-window -v -t "$S:dev.0" -c "$W"
tmux split-window -v -t "$S:dev.2" -c "$W"

# Start services in each pane
tmux send-keys -t "$S:dev.1" 'npm run backend' Enter
tmux send-keys -t "$S:dev.2" 'claude' Enter
tmux send-keys -t "$S:dev.3" 'npm run frontend' Enter

tmux select-pane -t "$S:dev.0"
echo "✓ Session '$S' — attach with: tmux attach -t $S"
"""

[pre-remove]
tmux = "tmux kill-session -t {{ branch | sanitize }} 2>/dev/null || true"
```

To create a worktree and immediately attach:

```console
$ wt switch --create feature -x tmux -- attach -t '{{ branch | sanitize }}'
```

### cmux workspace per worktree

Each worktree gets its own [cmux](https://cmux.com) workspace. Switching worktrees switches workspaces; removing a worktree closes its workspace. Configuration contributed by [@endigma](https://github.com/endigma) ([#2796](https://github.com/max-sixty/worktrunk/issues/2796)).

**Prerequisites:** [jq](https://jqlang.org) (`brew install jq`)

```toml
# ~/.config/worktrunk/config.toml

# cmux is the navigation primitive; don't also cd the invoking shell.
[switch]
cd = false

[pre-start]
cmux = "cmux new-workspace --name {{ repo | sanitize }}/{{ branch | sanitize }} --cwd {{ worktree_path }} --focus true"

[pre-switch]
cmux = """
WS=$(cmux --json list-workspaces 2>/dev/null \\
  | jq -r --arg t '{{ repo | sanitize }}/{{ branch | sanitize }}' \\
      '.workspaces[] | select(.title == $t) | .ref' | head -1)
[ -n "$WS" ] && cmux select-workspace --workspace "$WS" || true
"""

[pre-remove]
cmux = """
WS=$(cmux --json list-workspaces 2>/dev/null \\
  | jq -r --arg t '{{ repo | sanitize }}/{{ branch | sanitize }}' \\
      '.workspaces[] | select(.title == $t) | .ref' | head -1)
[ -n "$WS" ] && cmux close-workspace --workspace "$WS" || true
"""
```

**Why `pre-*` instead of `post-*`?** cmux restricts socket access to processes spawned inside a cmux terminal. `post-*` hooks run as detached background processes, breaking the process ancestry chain. `pre-*` hooks run in the foreground and inherit the terminal's process lineage.

### Xcode DerivedData cleanup

Clean up Xcode's DerivedData when removing a worktree. Each DerivedData directory contains an `info.plist` recording its project path — grep for the worktree path to find and remove the matching build cache:

```toml
# ~/.config/worktrunk/config.toml
[post-remove]
clean-derived = """
  grep -Fl {{ worktree_path }} \
    ~/Library/Developer/Xcode/DerivedData/*/info.plist 2>/dev/null \
  | while read plist; do
      derived_dir=$(dirname "$plist")
      rm -rf "$derived_dir"
      echo "Cleaned DerivedData: $derived_dir"
    done
"""
```

## Working with agents

### Track agent status

The agent plugins mark each worktree 🤖 (working) or 💬 (waiting) in `wt list`, and `wt config state marker set` sets a marker by hand for any other workflow. See [Activity tracking](/claude-code/#activity-tracking).

### Agent handoffs

Spawn a worktree with an agent CLI running in the background. `-x` names the program to run and everything after `--` is passed to it, so OpenCode's subcommand goes after the `--`: `-x opencode -- run '<task>'`.

**tmux** (new detached session):
```bash
tmux new-session -d -s fix-auth-bug "wt switch --create fix-auth-bug -x claude -- \
  'The login session expires after 5 minutes. Find the session timeout config and extend it to 24 hours.'"
```

**Zellij** (new pane in current session):
```bash
zellij run -- wt switch --create fix-auth-bug -x claude -- \
  'The login session expires after 5 minutes. Find the session timeout config and extend it to 24 hours.'
```

This lets one agent session hand off work to another that runs in the background. Hooks run inside the multiplexer session/pane.

The [worktrunk skill](/claude-code/) includes guidance for Claude Code (and other agent CLIs that load it) to execute this pattern. To enable it, request it explicitly ("spawn a parallel worktree for...") or add to your project instructions (`CLAUDE.md` or `AGENTS.md`):

```markdown title="AGENTS.md"
When I ask you to spawn parallel worktrees, use the agent handoff pattern
from the worktrunk skill.
```

## Status, commits, and logs

### Monitor CI across branches

```bash
wt list --full --branches
```

Shows PR/CI status for all branches, including those without worktrees. CI indicators are clickable links to the PR page.

### LLM branch summaries

With `summary = true` and [`commit.generation`](/config/#commit) configured, `wt list --full` shows an LLM-generated one-line summary for each branch. The same summaries appear in the [`wt switch` picker](/switch/#interactive-picker)'s `summary` tab.

```toml
# ~/.config/worktrunk/config.toml
[list]
summary = true
```

See [LLM Commits](/llm-commits/#branch-summaries) for details.

### JSON API

```bash
wt list --format=json
```

Structured output for dashboards, statuslines, and scripts. See [`wt list`](/list/) for query examples.

### Manual commit messages

The `commit.generation.command` receives the rendered prompt on stdin and returns the commit message on stdout. To write commit messages by hand instead of using an LLM, point it at `$EDITOR`:

```toml
# ~/.config/worktrunk/config.toml
[commit.generation]
command = '''f=$(mktemp); printf '\n\n' > "$f"; sed 's/^/# /' >> "$f"; ${EDITOR:-vi} "$f" < /dev/tty > /dev/tty; grep -v '^#' "$f"'''
```

This comments out the rendered prompt (diff, branch name, stats) with `#` prefixes, opens your editor, and strips comment lines on save. A couple of blank lines at the top give you space to type; the prompt context is visible below for reference.

To keep the LLM as default but use the editor for a specific merge, add a [worktrunk alias](/extending/#aliases):

```toml
# ~/.config/worktrunk/config.toml
[aliases]
mc = '''WORKTRUNK_COMMIT__GENERATION__COMMAND='f=$(mktemp); printf "\n\n" > "$f"; sed "s/^/# /" >> "$f"; ${EDITOR:-vi} "$f" < /dev/tty > /dev/tty; grep -v "^#" "$f"' wt merge'''
```

Then `wt mc` opens an editor for the commit message while plain `wt merge` continues to use the LLM.

### Monitor hook logs

Follow background hook output:

```bash
tail -f "$(wt config state logs --format=json | jq -r --arg branch "$(git branch --show-current)" '.hook_output[] | select([.branch, .source, .hook_type, .name] == [$branch, "user", "post-start", "server"]) | .path')"
```

Each `hook_output` entry carries `branch`, `source` (`user`, `project`, or `internal`), `hook_type`, `name`, and `path` — adjust the `select` to pick a different hook or branch. Run `wt config state logs` to list all available logs.

Create a shell function for frequent use (`wtlog server`):

```bash
wtlog() {
  tail -f "$(wt config state logs --format=json | jq -r --arg branch "$(git branch --show-current)" --arg name "$1" '.hook_output[] | select([.branch, .source, .hook_type, .name] == [$branch, "user", "post-start", $name]) | .path')"
}
```

---

### Src Content Docs Worktrunk (`docs/src/content/docs/worktrunk.md`)

---
title: "Worktrunk"
description: "CLI for Git worktree management, designed for parallel AI agent workflows."
sidebar:
  order: 1
pagefind: false
head:
  - tag: link
    attrs:
      rel: canonical
      href: "https://worktrunk.dev/"
  - tag: meta
    attrs:
      name: robots
      content: noindex
  - tag: meta
    attrs:
      property: og:url
      content: "https://worktrunk.dev/"
---
Worktrunk is a CLI for Git worktree management, designed for **parallel AI agent
workflows**.

Worktrunk's three core commands make worktrees as easy as branches.
Plus, Worktrunk has a bunch of quality-of-life features to simplify working
with many parallel changes, including hooks to automate local workflows &
copy-on-write build caches.

A quick demo:

<figure class="demo">
<picture>
  <source srcset="/assets/docs/dark/wt-core-mobile.gif" media="(prefers-color-scheme: dark) and (max-width: 42rem)" data-demo-theme="dark" data-demo-media="(max-width: 42rem)">
  <source srcset="/assets/docs/light/wt-core-mobile.gif" media="(max-width: 42rem)" data-demo-theme="light" data-demo-media="(max-width: 42rem)">
  <source srcset="/assets/docs/dark/wt-core.gif" media="(prefers-color-scheme: dark)" data-demo-theme="dark">
  <img src="/assets/docs/light/wt-core.gif" alt="Worktrunk demo showing wt list, wt switch, and hooks" width="1600" height="900">
</picture>
<figcaption>Listing worktrees, switching, cleaning up</figcaption>
</figure>

## Context: git worktrees

AI agents like Claude Code and Codex can handle longer tasks without
supervision, such that it's possible to manage 5-10+ in parallel. Git's native
worktree feature gives each agent its own working directory, so they don't step
on each other's changes.

But the git worktree UX is clunky. Even a task as small as starting a new
worktree requires typing the branch name three times: `git worktree add -b feat
../repo.feat`, then `cd ../repo.feat`.

## Worktrunk makes git worktrees as easy as branches

Worktrees are addressed by branch name; paths are computed from a configurable template. Commands that take a branch also accept the path of the worktree it is checked out in.

<p class="workflow-stage">Start with the core commands</p>

**Core commands:**

<table class="cmd-compare">
  <thead>
    <tr>
      <th>Task</th>
      <th>Worktrunk</th>
      <th>Plain git</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Switch worktrees</td>
      <td data-label="Worktrunk"><code>wt switch feat</code></td>
      <td data-label="Plain git"><code>cd ../repo.feat</code></td>
    </tr>
    <tr>
      <td>Create + start Claude</td>
      <td data-label="Worktrunk"><code>wt switch -c -x claude feat</code></td>
      <td data-label="Plain git"><pre><code>git worktree add -b feat ../repo.feat && \
cd ../repo.feat && \
claude</code></pre></td>
    </tr>
    <tr>
      <td>Clean up</td>
      <td data-label="Worktrunk"><code>wt remove</code></td>
      <td data-label="Plain git"><pre><code>cd ../repo && \
git worktree remove ../repo.feat && \
git branch -d feat</code></pre></td>
    </tr>
    <tr>
      <td>List with status</td>
      <td data-label="Worktrunk"><code>wt list</code></td>
      <td data-label="Plain git"><span class="cmd-compare-value"><code>git worktree list</code> (paths only)</span></td>
    </tr>
  </tbody>
</table>

<p class="workflow-stage">Expand into the more advanced commands as needed</p>

<p class="workflow-heading"><strong>Workflow automation:</strong></p>

- **[Hooks](/hook/)** — run commands on create, pre-merge, post-merge, etc
- **[LLM commit messages](/llm-commits/)** — generate commit messages from diffs
- **[Merge workflow](/merge/)** — squash, rebase, merge, clean up in one command
- **[Interactive picker](/switch/#interactive-picker)** — browse worktrees with streaming CI status and diff, log, PR and comment previews
- **[Share build caches](/step/#wt-step-copy-ignored)** — ten worktrees get `target/`, `node_modules/`, etc without building or copying them (on APFS, btrfs, and XFS)
- **[`wt list --full`](/list/#full-mode)** — [CI status](/list/#ci-status) and [AI-generated summaries](/list/#llm-summaries) per branch
- **[PR checkout](/switch/#pull-requests-and-merge-requests)** — `wt switch pr:123` to jump straight to a PR's branch
- **[Dev server per worktree](/tips-patterns/#dev-server-per-worktree)** — `hash_port` template filter gives each worktree a unique port
- **[Aliases](/extending/#aliases) & [per-branch variables](/config/#wt-config-state-vars)** — custom `wt <name>` commands and branch-scoped state for hook templates
- ...and **[lots more](#next-steps)**

Multiple parallel agents, same simple commands:

<figure class="demo">
<picture>
  <source srcset="/assets/docs/dark/wt-zellij-omnibus.gif" media="(prefers-color-scheme: dark)">
  <img src="/assets/docs/light/wt-zellij-omnibus.gif" alt="Worktrunk omnibus demo: multiple Claude agents in Zellij tabs with hooks, LLM commits, and merge workflow" width="1600" height="900" loading="lazy">
</picture>
<figcaption>Multiple Claude agents in parallel with interactive picker, hooks, LLM commits, and merge</figcaption>
</figure>

## Install

**Homebrew (macOS & Linux):**

```bash
brew install worktrunk && wt config shell install
```

Shell integration allows commands to change directories.

**Cargo:**

```bash
cargo install worktrunk && wt config shell install
```

<details>
<summary><strong>Windows & other</strong></summary>

**Windows.** `wt` defaults to Windows Terminal's command, so Winget additionally installs Worktrunk as `git-wt` to avoid the conflict:

```bash
winget install max-sixty.worktrunk
git-wt config shell install
```

Alternatively, disable Windows Terminal's alias (Settings → Apps → Advanced app settings → App execution aliases → "Terminal"/"Terminal Preview") to use `wt` directly.

> Free code signing provided by [SignPath.io](https://signpath.io/), certificate by [SignPath Foundation](https://signpath.org/) — [policy](/code-signing/).

**Arch Linux:**

```bash
sudo pacman -S worktrunk && wt config shell install
```

**Conda / Pixi** (community-maintained [feedstock](https://github.com/conda-forge/worktrunk-feedstock)):

```bash
conda install -c conda-forge worktrunk && wt config shell install
```

Or with [Pixi](https://pixi.sh): `pixi global install worktrunk && wt config shell install`.

**PyPI** (experimental):

```bash
uv tool install worktrunk@latest && wt config shell install
```

Python tools can also list `worktrunk` as a dependency, or run it without installing: `uvx --from worktrunk wt list`.

</details>

## Quick start

Create a worktree for a new feature:



```console
$ wt switch --create feature-auth
✓ Created branch feature-auth from main and worktree @ ~/repo.feature-auth
```



This creates a new branch and worktree, then switches to it. Do your work, then check all worktrees with [`wt list`](/list/):



```console
$ wt list
  Branch        Status       @±        ^↕        ^…±     Remote⇅  Commit    Age  Message
@ feature-auth  +   ↑      +27   -8   ↑1       +31                4bc72dc    2h  Add authenticatio…
^ main              ^⇡                                    ⇡1      0e631ad    1d  Initial commit

○ Showing 2 worktrees, 1 with changes, 1 ahead, hidden: Path  (+ staged files  ↑ ahead of default)
```



The `@` marks the current worktree. `+` means staged changes, `↑1` means 1 commit ahead of main, `⇡` means unpushed commits.

When done, either:

**PR workflow** — commit, push, open a PR, merge via GitHub/GitLab, then clean up:

```bash
wt step commit                    # commit staged changes
gh pr create                      # or glab mr create
wt remove                         # after PR is merged
```

**Local merge** — squash, rebase onto main, fast-forward merge, clean up:



```console
$ wt merge main
◎ Generating commit message and committing changes... (2 files, +53, no squashing needed)
  Add authentication module
✓ Committed changes @ a1b2c3d
◎ Merging 1 commit to main @ a1b2c3d (no rebase needed)
  * a1b2c3d Add authentication module
   auth.rs | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
   lib.rs  |  2 ++
   2 files changed, 53 insertions(+)
✓ Merged to main (1 commit, 2 files, +53)
◎ Removing feature-auth worktree & branch in background (same commit as main, _)
○ Switched to worktree for main @ ~/repo
```



For parallel agents, create multiple worktrees and launch an agent in each:

```bash
wt switch -x claude -c feature-a -- 'Add user authentication'
wt switch -x claude -c feature-b -- 'Fix the pagination bug'
wt switch -x claude -c feature-c -- 'Write tests for the API'
```

The `-x` flag runs a command after switching; arguments after `--` are passed to it. Configure [post-start hooks](/hook/#hook-types) to automate setup (install deps, start dev servers).

## Next steps

- Learn the core commands: [`wt switch`](/switch/), [`wt list`](/list/), [`wt merge`](/merge/), [`wt remove`](/remove/)
- Set up [hooks](/hook/) for automated setup
- Explore [LLM commit messages](/llm-commits/), [interactive
  picker](/switch/#interactive-picker), [Claude Code integration](/claude-code/), [CI
  status & PR links](/list/#ci-status)
- Browse [tips & patterns](/tips-patterns/) for recipes: aliases, dev servers, databases, agent handoffs, and more
- [Extending Worktrunk](/extending/) — customize workflows with hooks & aliases
- Watch [@DevOpsToolbox's video on Worktrunk](https://youtu.be/WBQiqr6LevQ?t=345)
- Run `wt --help` or `wt <command> --help` for quick CLI reference

---

--- METRICS ---
- Files Extracted: 32
- Estimated Token Budget: ~107945 tokens
- Canonical Reference: https://codewiki.google/github.com/max-sixty/worktrunk
