# AI use cases for Worktrunk (max-sixty/worktrunk)

Repo: [max-sixty/worktrunk](https://github.com/max-sixty/worktrunk) | Use cases: 3 | Page: https://dedupedai.com/use-cases/max-sixty-worktrunk/

Worktrunk is a CLI for git worktree management, designed for running AI agents in parallel. Its three core commands make worktrees as easy as branches, and it adds hooks to automate local workflows, LLM commit messages, a merge workflow and copy-on-write build caches.

This file holds every use case of this repo. Each one starts with a "## " heading and ends with its URL.

- Run several coding agents in parallel worktrees: https://dedupedai.com/use-cases/max-sixty-worktrunk/run-parallel-agents-in-separate-worktrees/
- Merge a finished worktree back to main in one command: https://dedupedai.com/use-cases/max-sixty-worktrunk/merge-a-worktree-and-clean-up/
- Automate setup in every new worktree with hooks: https://dedupedai.com/use-cases/max-sixty-worktrunk/automate-worktree-setup-with-hooks/

## How to run several coding agents in parallel worktrees with Worktrunk

Repo: [max-sixty/worktrunk](https://github.com/max-sixty/worktrunk) | Difficulty: Beginner | Time: 15 minutes | Basis: From the README

Create a worktree per task and launch an agent in each with one command.

**Who it is for:** A developer managing 5 to 10 agents who is tired of typing branch names three times.

**The problem:** Agents in one directory step on each other's changes, and plain git worktree commands are clunky.

**The outcome:** One worktree per agent, each started with a task, addressed by branch name.

### Steps

1. Run `brew install worktrunk && wt config shell install` (or `cargo install worktrunk && wt config shell install`)
2. Run `wt switch -x claude -c feature-a -- 'Add user authentication'`
3. Run `wt switch -x claude -c feature-b -- 'Fix the pagination bug'`
4. Run `wt list` to see the status of each worktree

### Prompt to paste into your agent

```text
Install worktrunk, then for each of <tasks> run `wt switch -x claude -c <branch> -- '<task>'` so every agent gets its own worktree. Use `wt list` to report status.
```

### Caveat

On Windows, winget installs it as git-wt to avoid a clash with Windows Terminal's wt command.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/max-sixty-worktrunk/run-parallel-agents-in-separate-worktrees/

## How to merge a finished worktree back to main in one command with Worktrunk

Repo: [max-sixty/worktrunk](https://github.com/max-sixty/worktrunk) | Difficulty: Beginner | Time: 10 minutes | Basis: From the README

Squash, rebase, fast-forward merge and remove the worktree with wt merge.

**Who it is for:** A developer finishing an agent's branch who wants it merged and cleaned up without several git commands.

**The problem:** Finishing a worktree by hand means commit, rebase, merge, then remove the worktree and branch.

**The outcome:** The change merged to main with a generated commit message and the worktree removed.

### Steps

1. Run `wt merge main` from the worktree
2. It generates a commit message, merges the commit to main and removes the worktree and branch in the background
3. For a PR workflow instead run `wt step commit`, then `gh pr create`
4. After the PR is merged run `wt remove`

### Prompt to paste into your agent

```text
In the worktree for <branch>, run `wt merge main` and show me the output. If I prefer a PR, use `wt step commit`, `gh pr create` and later `wt remove`.
```

### Caveat

Commit message generation relies on a configured LLM; see the LLM commit messages docs.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/max-sixty-worktrunk/merge-a-worktree-and-clean-up/

## How to automate setup in every new worktree with hooks with Worktrunk

Repo: [max-sixty/worktrunk](https://github.com/max-sixty/worktrunk) | Difficulty: Intermediate | Time: 30 minutes | Basis: From the README

Run commands on create and merge so each worktree installs dependencies and gets its own dev server port.

**Who it is for:** A developer who needs each parallel worktree ready to run without manual setup.

**The problem:** Every new worktree needs dependencies and a dev server, and ten of them collide on ports and rebuilds.

**The outcome:** New worktrees that set themselves up, share build caches and use a unique port each.

### Steps

1. Read the Hooks docs at Worktrunk.dev/hook for the hook types such as post-start
2. Add a post-start hook that installs dependencies and starts your dev server
3. Use the `hash_port` template filter to give each worktree a unique port
4. Use Share build caches so ten worktrees get `target/`, `node_modules/`, etc without building or copying them

### Prompt to paste into your agent

```text
Using worktrunk, set up a post-start hook for this repo that installs dependencies and starts the dev server on a `hash_port` port, and share build caches between worktrees. Show me the config before saving.
```

### Caveat

Shared build caches need APFS, btrfs or XFS, and the README points to the docs for hook syntax.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/max-sixty-worktrunk/automate-worktree-setup-with-hooks/
