A branch's worktree is where git says it is, never where somebody chose to put it, and a misplaced one is a diagnostic with a remedy rather than a mystery.
- status
- stable
Given the repository and a branch name there is exactly one path, and every surface derives
it the same way: majordomus worktree create <branch> makes the branch from the trunk and
the worktree at that path, worktree path prints it for a shell to cd into, worktree
alone says where the current session is and whether that is where it belongs, and
worktree migrate brings a misplaced worktree home with its modified, staged and untracked
files intact. Nothing registers a path: git's own common directory, its worktree list and
its refs are the registry.
The pre-commit hook asks worktree guard and refuses a feature branch committed from the
primary checkout or from a worktree that is not the branch's own. The topology is one
capability module, so the same typed answer — every worktree with its standing, every
diagnostic with its code and remedy — is on the command line, over MCP and HTTP, and on the
Cockpit's worktrees page.
It never deletes a branch, never overwrites a destination that exists, and never moves a
detached worktree or a session's scratch checkout unless asked. It does not decide what a
branch is for; the issue a branch names is read from its name when it names one.
The capabilities behind it
The capability modules of the executable this feature names, each with the capabilities it composes. The command line, the HTTP route, the MCP tool and the reference beside every row are projections of one declaration, not four registrations.
Worktree topology
worktree
behaviorally verified
Where every linked git worktree of this repository belongs and where each one is. The container is the primary checkout's sibling named with `-wt`, the path under it is the branch name with its hierarchy kept, and both are derived from git's own identity — the common directory, the registered worktrees, the branches — never from a registry, a configuration or the current directory. A worktree somewhere else is a typed diagnostic with a remedy; the migration that repairs it is a command-line operation of the same service.
apps/majordomus-cli/src/capability/builtin/worktree.rs
What it answers
Operational moments from the Why catalogue that name one of this feature's mechanisms. Nothing here was assigned: a moment appears because it names a rule, a command, a capability or a claim this feature also names.
The rules that hold it
-
blockingA branch's worktree is at <repo>-wt/<branch>, derived from git, never registered
project.worktree-topology
-
blockingNothing this repository commits names a path of the machine it was written on
project.no-machine-paths
What is guaranteed
Executable use cases