feat: Claude Code's own worktrees are workers too (decision 0015) - #18
Merged
Merged
Conversation
A second project upgraded with the parallel-agents module had four of Claude Code's own worktrees in use, as the module's origin project did: the desktop app's worktree option already gives a task its own worktree, branch, and session. Proposes treating every linked worktree as a worker, with two routes — Claude Code's worktree by default, the scripts when a worktree needs a port, start commands, or a non-default base branch — plus a .worktreeinclude for the env file. Status: proposed, for the maintainers' decision; nothing is implemented. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Accepts 0015, amending 0008. With the parallel-agents module, every linked worktree is a worker. A task starts in Claude Code's own worktree (the desktop app's worktree option, claude --worktree) by default, and goes through /dispatch and the scripts when its worktree needs a port, setup or start commands, or a base branch other than the default. - session-context.sh names the route in the main checkout and, in a worktree the scripts didn't set up, what it lacks: a generated branch to rename after triage, the env file, the scripts' setup, the base. - worktree-new.sh marks the worktrees it sets up in their own git directory; older ones are recognized by their folder name. - worktree-ls.sh lists Claude Code's worktrees as workers and flags the ones on a generated branch or a detached HEAD. - The module ships .worktreeinclude for the env file; /dispatch, PARALLEL-AGENTS.md, MODULE.md, the scenario, onboarding, and the catalogs describe both routes; protect-hub's message names them. - Hook tests cover both routes, the gaps, the marker, and a non-default base; module tests cover the marker and the flags. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mauricios
marked this pull request as ready for review
October 2, 2026 05:14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed and why
Accepts and implements 0015, which amends 0008.
Teams that work in the desktop app start tasks in a new session with its worktree option, which already gives the task its own worktree, branch, and session. Two projects running the
parallel-agentsmodule had such worktrees in use: the module's origin project, and the marketing site upgraded this week, with four each. Meanwhile the framework gave those sessions no role and sent the developers to a second tool. Claude Code now covers most of what the scripts were added for..worktreeincludecopies the env file, project-scope plugins and the local settings reach worktrees, and the app archives its worktrees.With the module, every linked worktree is a worker. A task gets its worktree one of two ways:
claude --worktree. The worker renames the generated branch to<type>/<slug>after triage./dispatch): when the worktree needs a port, setup or start commands, or a base branch other than the default branch.Changes
skeleton/.claude/hooks/session-context.sh(core):worktree.conf.worktree-new.shwrites a marker in the worktree's own git directory, whichgit statusdoesn't show. Worktrees from before the marker are recognized by their folder name._worktree-lib.sh:scripts_worktreeandgenerated_branchreplacebuiltin_worktree.worktree-ls.shlists Claude Code's worktrees as workers, marked "not from the scripts". It flags the ones on a generated branch or a detached HEAD, instead of asking to move task work out of them..worktreeinclude(new, module) lists the env file./dispatchopens with § Which route. Started from the desktop app, it opens the scripts' worktree as the session's folder rather than using the worktree option.PARALLEL-AGENTS.mdgets § Two routes, a comparison table, and § Claude Code's worktrees.MODULE.mdadds a customize step for.worktreeinclude.protect-hub.sh's message names both routes.Upgrade impact
In
CHANGELOG.md§ Unreleased:session-context.sh,protect-hub.sh, the hooks README./dispatch.docs/PARALLEL-AGENTS.md..worktreeinclude, kept in step withENV_FILE.How to verify
./evals/run-evals.sh.git status) andworktree-ls.sh's flags.Verified / not verified
claude/bold-oakworktree..worktreeincludecopying the env file. Both are Claude Code behavior, from its docs. The pilot project can confirm them once it takes this change.Merge danger
Reversible: yes. Reverting restores the "no role" message and the old flag. The marker files left in worktrees' git directories are harmless.
Blast radius: sessions in projects with the
parallel-agentsmodule, once they take this upgrade. Sessions in Claude Code's worktrees get work instructions instead of "ask for a dispatch". Nothing changes without the module.🤖 Generated with Claude Code