Skip to main content

Module worktree

Module worktree 

Source
Expand description

Git-worktree isolation for flow agent leaves (P5b).

A leaf with Isolation::Worktree runs against ITS OWN git worktree of the ctx workspace, so parallel file-mutating agents cannot trample each other. Cleanup policy (the Claude Code semantic): a worktree left CLEAN is pruned; a DIRTY one has its changes committed onto a hb/<name> branch (work is never lost), then the directory is removed.

Deviation from the parked design: this shells out to the git CLI (tokio::process) instead of linking git2 — zero new dependencies, no !Send libgit2 handles across .await, no C build. Requires git on PATH at runtime (the dev-workstation audience that wants worktrees has it).

Structs§

WorktreeGuard
One leaf’s isolated worktree. Create with WorktreeGuard::create, always finish with WorktreeGuard::cleanup (a sync best-effort Drop backstop force-removes the directory if cleanup never ran — e.g. a panicking task).

Enums§

Disposition
What cleanup did with the worktree.