Run a fleet of Claude agents on the same repo — each in its own worktree, zero conflicts, one command each.
Claude Code works best when it has full ownership of the working directory. Want two agents working in parallel? They'll stomp on each other — conflicting edits, dirty state, broken builds. You need separate checkouts.
Git worktrees are the perfect primitive for this. They share the same .git database but give each agent its own directory tree — no cloning, no syncing, branches stay in lockstep. mux wraps the entire worktree lifecycle into single commands so you can spin agents up, jump between them, and tear them down without thinking about it.
You wanna go fast without losing your goddamn mind. This is how.
curl -fsSL https://raw.githubusercontent.com/vxcall/cmux/main/install.sh | shThen add .worktrees/ to your .gitignore:
echo '.worktrees/' >> .gitignoremux new <your feature name> --claude # creates worktree + branch, runs setup hook, launches Claude
mux new <your feature name> --codex # same, but launches Codex
mux new <your feature name> # worktree only, no agent launchedThat's it. One command, one agent, fully isolated. See Workflow for the full loop.
| Command | What it does |
|---|---|
mux new <branch> [--claude|--codex] [-p <prompt>] |
Create new worktree + branch, run setup hook, optionally launch agent |
mux start <branch> [--claude|--codex] [-p <prompt>] |
Continue where you left off in an existing worktree, optionally launch agent |
mux cd [branch] |
cd into a worktree (no args = repo root) |
mux ls |
List active worktrees |
mux merge [branch] [--squash] |
Merge worktree branch into your primary checkout (no args = current worktree) |
mux rm [branch | --all] |
Remove a worktree and its branch (no args = current, --all = every worktree with confirmation) |
mux init [--replace] |
Generate .mux/setup hook using Claude (--replace to regenerate) |
mux update |
Update mux to the latest version |
mux version |
Show current version |
You're building a feature:
mux new feature-auth --claude # agent starts working on authBug comes in. No problem — spin up another agent without leaving the first one:
mux new fix-payments --claude # second agent, isolated worktree, independent sessionMerge the bugfix when it's done:
mux merge fix-payments --squash
mux rm fix-paymentsCome back tomorrow and pick up the feature work right where you left off:
mux start feature-auth --claude # picks up right where you left offThe key distinction: new = new worktree, new session. start = existing worktree, continuing session.
When mux new creates a worktree, it runs .mux/setup if one exists. This handles project-specific init — symlinking secrets, installing deps, running codegen. If no setup hook exists, you'll be prompted to generate one.
The easy way — let Claude write it for you:
mux initOr create one manually:
#!/bin/bash
REPO_ROOT="$(git rev-parse --git-common-dir | xargs dirname)"
ln -sf "$REPO_ROOT/.env" .env
npm ciSee examples/ for more.
- Worktrees live under
.worktrees/<branch>/in the repo root - Branch names are sanitized:
feature/foobecomesfeature-foo mux newis idempotent on the worktree — if it already exists, it skips creation and setup- Use
--claudeor--codexwithmux new/mux startto launch an agent; omitting the flag only enters the worktree mux mergeandmux rmwith no args detect the current worktree from$PWD- Pure bash — just git and the Claude CLI
You never have to remember branch names. Built-in completion for bash and zsh — automatically registered when you source mux.sh, no extra setup.
mux <TAB>— subcommandsmux start <TAB>— existing worktree branchesmux cd <TAB>— existing worktree branchesmux rm <TAB>— worktree branches +--allmux merge <TAB>— worktree branchesmux init <TAB>—--replace
MIT