Five agents competing for a single working directory? Worktrunk transforms `git worktree` into a simple `wt switch`.

Five agents competing for a single working directory? Worktrunk transforms `git worktree` into a simple `wt switch`.

1 week ago
duguying
6 views
Source: GitHub

Worktrunk, written in Rust, uses branch names to access the worktree. Its three core commands cover switching, creating, merging, and cleaning, and it also provides hooks, LLM commit information, and a copy-on-write build cache that spans multiple worktrees – essential Git tools for the era of parallel AI agents.

Related tags

#GitHub#Trending#git#AI Agent#CLI

Running five Claude Code sessions concurrently presents a challenge, as the most common issue isn't models overwriting code, but rather them all competing for space within the same repository directory. Git's worktree functionality was originally designed to address this: providing each branch with its own independent working directory, isolating changes. However, the implementation is clunky – even simply creating a new worktree requires specifying the branch name three times:

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

Rust-based Worktrunk (command `wt`) aims to simplify this process, making worktrees as usable as branches. It uses branch names to access worktrees, and paths are determined by configurable templates. The command accepts both branch names and the path to the worktree's checked-out code.

The core commands cover common actions: `wt switch feat` switches to a branch; `wt switch -c -x claude feat` creates a branch, a worktree, and clones Claude into it; and `wt remove` removes both the directory and the branch. The `wt list` command provides an overview, showing the current worktree (@), changes staged (+), number of commits ahead of main (↑1), and unpushed commits (⇡).

What truly sets Worktrunk apart from a simple "wrapper" is the attention to detail surrounding multiple concurrent changes:

  • **Hooks:** Runs commands on events like create, pre-merge, and post-merge for dependency management and setting up development servers.
  • **LLM Commit Messages:** Generates commit messages directly from diffs.
  • **One Command for Cleanup:** `wt merge main` performs a squash, rebase, or fast-forward merge in the background, removing the worktree and branch.
  • **Shared Build Cache:** Ten worktrees can share a single target/node_modules directory, eliminating redundant builds and copies – leveraging file system copy-on-write, currently supporting APFS, btrfs, and XFS.
  • **Interactive Picker:** Provides CI status, diffs, logs, PR previews, and comments directly when browsing worktrees.
  • **PR Direct Access:** `wt switch pr:123` switches to the branch of a specific PR.
  • **Dedicated Dev Server per Worktree:** The `hash_port` template assigns a unique port to each worktree, preventing conflicts with other services using port 3000.

As author max-sixty states in the README: This project, released in early 2026, is now one of the most popular Git worktree managers, and he considers any friction in its usage as a priority. Even PRs don't require code; they just need a clear explanation of "how to get around this now, and what the ideal state should be."

Looking at the current rankings, Worktrunk and other projects like JetBrains' Thinkrail (which integrates parallel agent sessions into an IDE) and Cindy (which offers multi-harness reuse on the client side) represent different layers of the same concept: Worktrunk focuses on the lowest level – interacting directly with the file system and Git. It doesn't tie you to any specific agent, allowing you to use Claude Code, Codex, or your own scripts through the `-x` parameter. This non-affiliation approach likely contributes to its wide adoption across various workflows.

Installation is available via Homebrew ( `brew install worktrunk && wt config shell install`), Cargo, Arch, conda/pixi, and for Windows users: be aware of potential conflicts between `wt` and Windows Terminal's command aliases; Winget will install a separate `git-wt` entry.

Repository address: https://github.com/max-sixty/worktrunk

More News

Want to see more quality content?

Browse all news