You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(exec): create parallel-group sub-worktrees with native isolation: "worktree"; keep merge-back in worktree-isolation.ts (#1192 follow-up, after the freeze) #1407
Follow-up from #1192: docs/investigations/native-worktree-hooks-2026-10.md, decision partial. Waits for the plugin freeze to lift, because it edits /exec SKILL steps 1b/5b.
What
On Claude Code ≥ 2.1.296, spawn /exec's isolateParallel agents with the Agent tool's isolation: "worktree" and noWorktreeCreate hook. Keep merge-back, conflict handling, orphan sweep and reporting in worktree-isolation.ts, retargeted:
discover worktrees from the returned worktreePath values and worktree-agent-* branches, instead of exec-agent-*;
add a node_modules symlink step for each returned path, because native isolation copies .worktreeinclude files but not node_modules.
Why no hook:
A WorktreeCreate hook replaces creation for every isolation: "worktree" spawn in the project, including users' own subagents.
With a hook present, native cleanup of an unchanged worktree stops working.
WorktreeRemove never fires in headless -p runs (re-probed 2026-10-10), so there's nothing to hang cleanup on.
Acceptance Criteria
AC-1: A parallel group's agents run in native isolation: "worktree" worktrees, and worktree-isolation.ts merge-all merges their changes back from the returned worktreePath values. Evidence: an integration test, or a recorded /exec run on a two-agent parallel group showing both changes merged.
AC-2: Each returned worktree has node_modules available before an agent runs tests. Evidence: a test on the symlink step.
AC-3: cleanup removes leftover worktree-agent-* worktrees and branches after merge-back, since WorktreeRemove doesn't fire headless. Evidence: a test that leaves a changed agent worktree and asserts it is removed after merge.
AC-4: On Claude Code < 2.1.296, the old exec-agent-* path still runs. Evidence: a version-gate test.
Non-Goals
Shipping a WorktreeCreate or WorktreeRemove hook.
Changing how the issue-level worktree is created (ensureWorktree).
Activity
docs(#1192): record the P5 WorktreeRemove re-probe; adoption follow-u…
docs(#1192): native WorktreeCreate/WorktreeRemove hooks vs worktree-i…