worktree
The worktree extension manages temporary detached git worktrees for
isolated execution. It is the lifecycle owner for create/remove/prune behavior.
What it does
Section titled “What it does”- creates detached worktrees with
git worktree add --detach - removes worktrees with a git-first strategy, then filesystem fallback
- prunes stale managed worktrees on startup
- emits lifecycle events for hook automation
- injects session worktree context into the system prompt when enabled
Session isolation (tallow -w / --worktree)
Section titled “Session isolation (tallow -w / --worktree)”When you start tallow with -w or --worktree, the CLI launches the
session inside a temporary detached worktree and sets:
TALLOW_WORKTREE_PATHTALLOW_WORKTREE_ORIGINAL_CWD
The extension reads those values, emits lifecycle events, and performs
best-effort cleanup on session_shutdown.
Subagent isolation (isolation: "worktree")
Section titled “Subagent isolation (isolation: "worktree")”The subagent tool can run each subagent in its own detached worktree.
Precedence is:
- per-call
isolation - agent frontmatter
isolation _defaults.mdfrontmatterisolation
Supported value:
worktree
Hook events
Section titled “Hook events”Canonical events:
worktree_createworktree_remove
Claude-compatible aliases:
WorktreeCreateWorktreeRemove
Payload shape:
{ "worktreePath": "/tmp/tallow-worktree-subagent-abc123-...", "repoRoot": "/repo", "scope": "session", "agentId": "fg_abc123", "timestamp": 1739999999999}scope is session or subagent. agentId is present for subagent-scoped events.