Documentation
Git worktrees in Mstro
How Mstro uses git worktrees to run many AI agents on the same repo at the same time without collisions.
Why worktrees
Running N AI agents on the same repo with one working tree is a recipe for merge hell. A git worktree is a separate working directory tied to the same repo history — same objects, different files on disk. Mstro gives every parallel agent its own worktree so edits never collide.
How Mstro uses them
- When you start a PM Board, each task gets a worktree under
.mstro/worktrees/<task-id>. - Agents run, edit files, commit, and push to their branch — all inside their worktree.
- When you accept a task, Mstro merges the task branch back to your current branch (or opens a PR).
- When you reject, the worktree is removed cleanly.
Chat tabs and worktrees
Individual chat tabs also support per-tab worktrees. Switch the tab’s worktree in the tab header; your selection is persisted across reconnects via the worktree registry.
From the CLI
Worktrees are just git, so you can inspect them with standard commands:
git worktree list
git -C .mstro/worktrees/<task-id> log
git -C .mstro/worktrees/<task-id> status