worktree
worktree
The worktree worker gives every agent its own isolated checkout of a shared
repository. Instead of two sessions fighting over one working tree,
worktree::create mints a locked git worktree on a fresh branch, records
who owns it, and returns a path to use as the agent's working directory.
When the work is done, worktree::land automates the merge-back: rebase
onto the target branch, run an optional test command, fast-forward the
target atomically, and clean the worktree up. Lands are serialized per
repository through an engine FIFO queue, so parallel agents never race a
merge.
The land test gate delegates to shell::exec, so the shell worker must be
installed and worktree_root must sit inside its fs.host_roots jail.
Landing never pushes to remotes; it moves local branches only.