Worktree ops (the agent's git paved road)
Worktree ops is the HTTP surface an agent uses for its own session's git work — commit named files, sync, mark ready — so the safety rules are enforced rather than remembered. It deliberately has no push, no PR and no land-to-master.
What it is
Worktree ops is not a screen. It is the capability surface behind the local control server's /worktrees/:id/* routes, the paved road a coding session takes instead of running raw git. It exists so a rule like "stage only the files you named" is a 403 rather than a sentence in a prompt the model may skip.
Where to find it
A session reaches it over the control server at 127.0.0.1:19519: the read GET /worktrees/:id/status (the one route a scoped per-session token may call) plus the mutations POST /worktrees/:id/{commit,sync,ready,adopt,release,gate-hold,reclaim,remove} and POST /worktrees/block. The read-only companion — what workspaces exist, keep one, restore one — is the separate Worktree Ledger surface.
How it behaves
- Mutations are agent-scoped. A scoped per-session token is refused
401; mutations need the global full-trust token. The route finds your workspace fromX-AMC-Source-Session-Id, so you act on your own tree (not_ownerotherwise, or an unowned tree is adopted on first write). commitstages only the files you named and hard-refuses a wider staged set, a path escape,node_modules/.git, lockfiles, credential material, and a protected branch.syncrebases onto master but never resolves a conflict for you — a conflicted rebase comes back to you, it does not pick a side.readyrefuses to stamp unless a gate receipt covers the exact commit. The receipt says whether the evidence isverifiedorpre-cutover/inherited-red/human-override; ahumanOverrideneeds a stated reason and is403for a scoped token.- It deliberately excludes push, open-PR and land-to-master — those are owner-approval and auto-lander territory. A
200from/removecan still meanremoved: falsewhen a preservation floor held the tree.
For agents
- Route family:
src/main/services/cli/cli-server-worktree-ops-routes.ts. - The service behind it:
src/main/services/worktree/ops/worktree-ops-service.ts. - Ownership and slot claiming:
src/main/services/worktree/worktree-slot-claim.ts.
Related
Last verified 2026-10-06