Docs menu

Ship

Git worktrees

A second agent in the same checkout competes for the same files and the same index. A git worktree gives each session its own working directory while sharing the repository. Midas creates one for you.

Start a session in a worktree

midas --worktree
midas --worktree billing-fix
midas run --worktree "split the billing module"

The optional value names the worktree. Without one, Midas picks a name. The worktree is a real checkout on disk, so you can run two sessions, review each diff independently, and merge them the way you would merge any two branches.

When to use one

  • Two agents need to edit the same repository at the same time.
  • A long refactor should not disturb the checkout you are testing in.
  • You want a clean branch for an experiment and an untouched main checkout beside it.
  • A background or headless task should not race the interactive session.

How it works

Midas runs git worktree add for the session and starts the agent in that directory. The repository history and remotes are shared. The working tree, index, and branch belong to the worktree. Midas keeps its worktrees under its own data directory, which you can print with midas debug paths.

Because it is a normal worktree, you can inspect it with git worktree list and remove it with git worktree remove when the work is merged or abandoned.

Limits

  • Worktrees require a git project.
  • The session still has the same permissions and model access as a normal session.
  • A worktree is local. For a clean remote checkout, use a cloud sandbox instead.
Cloud sandboxes are a different tool: they run on a remote machine and open a draft pull request. See Cloud sandboxes.