Expand description
A git worktree per supervisor task (#570).
A task with a git_ref runs in its own worktree on its own branch, so
parallel tasks over one repo never edit the same checkout. The worktree
lives under ~/.claudectl/worktrees/<task-id>, outside the repo, so it
never shows up in that repo’s git status.
- Reused, not recreated. A retry or a resume of the same task finds its worktree and keeps working in it.
- Removed after DONE only if clean. An agent that left uncommitted changes left its work there, and removing the worktree would destroy it. The branch is always kept.
- No git means no worktree: a
git_refon a non-repo is an error, not a silent fallback to the plain cwd.
Structs§
- Worktree
- A worktree a task runs in.
Enums§
- Cleanup
- What
cleanupdid.
Functions§
- cleanup
- Remove a finished task’s worktree if nothing would be lost; keep the branch either way.
- default_
branch - The branch a task gets when it doesn’t name one:
claudectl/<name>-<id>, with the name reduced to lowercase letters, digits and-. - ensure
- Make sure the task’s worktree exists at
pathonbranch, starting fromgit_ref, in the repo containingcwd. Reuses one already there. - path_
for - Where task
task_id’s worktree goes. - repo_
root - The repo
cwdis in. - validate_
ref - Check a ref or branch name before it goes on a git command line. It comes
from a tasks file; a leading
-would read as an option.