Skip to main content

Module worktree

Module worktree 

Source
Expand description

Git worktree isolation for subagents — creation, fast-resume, cleanup.

Provides safe worktree creation with slug validation, canonical git-root resolution, fast-resume, dirty-state detection, and cleanup. Designed to prevent worktree nesting and protect the main repo from accidental mutation by isolated subagent runs.

Structs§

WorktreeInfo
Info about a created or resumed worktree.

Functions§

cleanup_stale_subagent_worktrees
Clean up stale ephemeral subagent worktrees older than the cutoff.
create_subagent_worktree
Create or resume a git worktree for a subagent.
has_worktree_changes
Check if a worktree has uncommitted changes (modified or untracked files).
remove_subagent_worktree
Clean up a subagent worktree.
validate_slug
Validate a slug for use in worktree paths and branch names.