Claim a worktree for a session. Fails with W210 when another session holds it, unless force is set.
forceboolean
Take the claim even when another session holds it.
session_idstring*required
The claiming session.
worktree_idstring*required
The worktree to claim.
claimedboolean*required
True when the claim is now held by `session_id`.
previous_session_idstring
The session that held the claim before, when taken over with force.
session_idstring*required
The claiming session.
worktree_idstring*required
The claimed worktree.
Create an isolated, locked git worktree off a base ref and register it in the cross-agent registry. Returns the path to hand to an agent as its working directory.
base_refstring
Ref to base the worktree on. Defaults to `HEAD`.
branchstring
Branch to create. Defaults to `<branch_prefix><worktree_id>` (or a codename when `branch_naming: codename`).
printeger· uint64min 0
Create the worktree at a GitHub pull request head: fetches `refs/pull/<n>/head` from `origin` and branches `<prefix>pr-<n>` at it. Mutually exclusive with `base_ref` and `branch`.
repo_pathstring*required
Absolute path of the repository to branch from.
session_idstring
Session to auto-claim the worktree for.
base_refstring*required
The ref the worktree was based on.
base_shastring*required
The commit `base_ref` resolved to.
branchstring*required
The branch checked out in the worktree.
created_atinteger· int64*required
Creation time, ms since epoch.
dev_portinteger· uint16*requiredmin 0
Advisory dev-server port derived from the worktree id.
pathstring*required
Absolute path of the new worktree; hand this to an agent as its working directory.
repo_keystring*required
Canonical per-repo key (FIFO group for lands).
worktree_idstring*required
Stable id, `wt_<12hex>`.
Fetch one managed worktree with its current git status.
worktree_idstring*required
The worktree to fetch.
base_refstring*required
The ref the worktree was created from.
base_shastring*required
The commit `base_ref` resolved to at creation time.
branchstring*required
The branch checked out in the worktree.
created_atinteger· int64*required
Creation time, ms since epoch.
dev_portinteger· uint16*requiredmin 0
Advisory dev-server port derived from the worktree id: deterministic, collision-improbable, never reserved anywhere.
lifecycleall of*required
Current lifecycle (reported `orphaned` when the directory is gone).
all of (1)
variant 1
one of (5)
variant 1
valuestringenum: active
variant 2
valuestringenum: claimed
variant 3
valuestringenum: landing
variant 4
valuestringenum: land-blocked
variant 5
valuestringenum: orphaned
pathstring*required
Absolute path of the worktree directory.
repo_keystring*required
Canonicalized per-repo key.
repo_pathstring*required
The repository path the worktree was created from.
session_idstring
Owning session, when claimed.
statusany of
Git status, when requested and computable.
any of (2)
variant 1
aheadinteger· uint64*requiredmin 0
Commits ahead of the comparison base (upstream when set, else `base_sha`).
behindinteger· uint64*requiredmin 0
Commits behind the comparison base.
cleanboolean*required
True when there are no staged, unstaged, untracked, or conflicted entries.
conflictedinteger· uint64*requiredmin 0
Unmerged (conflicted) entry count.
diffstatstring*required
`git diff --shortstat` of committed work since `base_sha`.
head_shastring*required
Current HEAD commit.
in_rebaseboolean*required
True while a rebase is in progress in this worktree.
integratedboolean
True when the branch's work is already contained in its integration target (fast-forward, merge, rebase, or squash merge). Integrated worktrees are prunable even when ahead of their base.
integration_reasonstring
Which check detected the integration: `same_commit`, `ancestor`, `no_added_changes`, `trees_match`, `merge_adds_nothing`, or `patch_id_match`.
stagedinteger· uint64*requiredmin 0
Staged entry count.
unpushedinteger· uint64*requiredmin 0
Commits not merged upstream (upstream ahead count, else commits past `base_sha`).
unstagedinteger· uint64*requiredmin 0
Unstaged entry count.
untrackedinteger· uint64*requiredmin 0
Untracked entry count.
updated_atinteger· int64*required
Last mutation time, ms since epoch.
worktree_idstring*required
Stable id, `wt_<12hex>`.
Queue a land: rebase onto the target, run the optional test gate via shell::exec, fast-forward the target with an atomic CAS, then clean up. Serialized per repo via the land queue.
force_restartboolean
Abort a conflicted rebase left by a previous land and start over.
keepboolean
Keep the worktree and branch after a successful land.
target_branchstring*required
The branch to fast-forward with the worktree's commits.
test_cmdstring
Optional test command run in the worktree via `shell::exec` before merging (the test gate).
worktree_idstring*required
The worktree to land.
job_idstring*required
The queued land job.
queuedboolean*required
True when the job was enqueued.
worktree::land-step
functionInternal: execute one queued land job. Bound to the land queue; not agent-callable.
job_idstring*required
The job to advance.
repo_keystring
FIFO group key; consumed by the engine's queue config, echoed here.
doneboolean*required
True when the job reached a terminal state (landed or blocked).
job_idstring*required
The advanced job.
phase_completedstring*required
The last phase this invocation completed.
List managed worktrees, optionally filtered by repo or session and enriched with git status. Also reports unmanaged worktrees of the repo when repo_path is given.
include_statusboolean
Compute git status for each worktree (slower).
repo_pathstring
Only worktrees of this repository.
session_idstring
Only worktrees claimed by this session.
unmanagedobject[]*required
Non-primary worktrees of the repo without a record (only populated when repo_path is given). Never auto-adopted.
branchstring
Checked-out branch ref, when not detached.
pathstring*required
Absolute path of the worktree.
worktreesobject[]*required
Managed worktrees, oldest first.
base_refstring*required
The ref the worktree was created from.
base_shastring*required
The commit `base_ref` resolved to at creation time.
branchstring*required
The branch checked out in the worktree.
created_atinteger· int64*required
Creation time, ms since epoch.
dev_portinteger· uint16*requiredmin 0
Advisory dev-server port derived from the worktree id: deterministic, collision-improbable, never reserved anywhere.
lifecycleall of*required
Current lifecycle (reported `orphaned` when the directory is gone).
all of (1)
variant 1
one of (5)
variant 1
valuestringenum: active
variant 2
valuestringenum: claimed
variant 3
valuestringenum: landing
variant 4
valuestringenum: land-blocked
variant 5
valuestringenum: orphaned
pathstring*required
Absolute path of the worktree directory.
repo_keystring*required
Canonicalized per-repo key.
repo_pathstring*required
The repository path the worktree was created from.
session_idstring
Owning session, when claimed.
statusany of
Git status, when requested and computable.
any of (2)
variant 1
aheadinteger· uint64*requiredmin 0
Commits ahead of the comparison base (upstream when set, else `base_sha`).
behindinteger· uint64*requiredmin 0
Commits behind the comparison base.
cleanboolean*required
True when there are no staged, unstaged, untracked, or conflicted entries.
conflictedinteger· uint64*requiredmin 0
Unmerged (conflicted) entry count.
diffstatstring*required
`git diff --shortstat` of committed work since `base_sha`.
head_shastring*required
Current HEAD commit.
in_rebaseboolean*required
True while a rebase is in progress in this worktree.
integratedboolean
True when the branch's work is already contained in its integration target (fast-forward, merge, rebase, or squash merge). Integrated worktrees are prunable even when ahead of their base.
integration_reasonstring
Which check detected the integration: `same_commit`, `ancestor`, `no_added_changes`, `trees_match`, `merge_adds_nothing`, or `patch_id_match`.
stagedinteger· uint64*requiredmin 0
Staged entry count.
unpushedinteger· uint64*requiredmin 0
Commits not merged upstream (upstream ahead count, else commits past `base_sha`).
unstagedinteger· uint64*requiredmin 0
Unstaged entry count.
untrackedinteger· uint64*requiredmin 0
Untracked entry count.
updated_atinteger· int64*required
Last mutation time, ms since epoch.
worktree_idstring*required
Stable id, `wt_<12hex>`.
Internal: hot-reload the worktree worker from the authoritative configuration when it changes — swaps the per-call snapshot and re-binds the prune cron on a schedule change.
idstring
Configuration id that changed (advisory; the handler re-fetches).
Sweep managed worktrees: reconcile records whose directories are gone and remove clean, unclaimed, expired worktrees. Cron-safe: an empty payload uses defaults; dry_run reports without acting.
dry_runboolean
Report what would be pruned without acting.
repo_pathstring
Only sweep worktrees of this repository.
prunedstring[]*required
Worktree ids pruned (or prunable, with dry_run).
skippedobject[]*required
Records left alone, with reasons.
idstring*required
The skipped worktree.
reasonstring*required
Why it was skipped.
worktree::release
functionRelease a session's claim. Fails with W211 when the caller does not hold the claim, unless force is set.
forceboolean
Release even when another session holds the claim.
session_idstring*required
The releasing session (must hold the claim unless force is set).
worktree_idstring*required
The worktree to release.
releasedboolean*required
True when the worktree is now unclaimed.
worktree_idstring*required
The released worktree.
Remove a managed worktree. Refuses dirty (W220) or unmerged (W221) work unless force is set; optionally deletes the branch.
delete_branchboolean
Also delete the worktree's branch.
forceboolean
Remove even when dirty or carrying unmerged commits.
worktree_idstring*required
The worktree to remove.
branch_deletedboolean*required
True when the branch was deleted too.
removedboolean*required
True when the worktree (and its record) are gone.
Git status for one worktree: cleanliness, ahead/behind, diffstat, rebase-in-progress, lifecycle.
worktree_idstring*required
The worktree to inspect.
aheadinteger· uint64*requiredmin 0
Commits ahead of the comparison base (upstream when set, else `base_sha`).
behindinteger· uint64*requiredmin 0
Commits behind the comparison base.
branchstring*required
The branch checked out in the worktree.
cleanboolean*required
True when there are no staged, unstaged, untracked, or conflicted entries.
conflictedinteger· uint64*requiredmin 0
Unmerged (conflicted) entry count.
dev_portinteger· uint16*requiredmin 0
Advisory dev-server port derived from the worktree id.
diffstatstring*required
`git diff --shortstat` of committed work since `base_sha`.
head_shastring*required
Current HEAD commit.
in_rebaseboolean*required
True while a rebase is in progress in this worktree.
integratedboolean
True when the branch's work is already contained in its integration target (fast-forward, merge, rebase, or squash merge). Integrated worktrees are prunable even when ahead of their base.
integration_reasonstring
Which check detected the integration: `same_commit`, `ancestor`, `no_added_changes`, `trees_match`, `merge_adds_nothing`, or `patch_id_match`.
lifecycleall of*required
Current lifecycle.
all of (1)
variant 1
one of (5)
variant 1
valuestringenum: active
variant 2
valuestringenum: claimed
variant 3
valuestringenum: landing
variant 4
valuestringenum: land-blocked
variant 5
valuestringenum: orphaned
stagedinteger· uint64*requiredmin 0
Staged entry count.
unpushedinteger· uint64*requiredmin 0
Commits not merged upstream (upstream ahead count, else commits past `base_sha`).
unstagedinteger· uint64*requiredmin 0
Unstaged entry count.
untrackedinteger· uint64*requiredmin 0
Untracked entry count.
worktree_idstring*required
The inspected worktree.
worktree::validate
functionValidate a path as a managed worktree (console picker surface). Unmanaged worktrees are reported but never adopted.
pathstring*required
Absolute path to validate.
managedboolean*required
True when a record manages this path.
reasonstring
Why the path is not valid.
validboolean*required
True when the path is a live, managed worktree.
worktree_idstring
The managing record's id, when one exists.