claude-code - 💡(How to fix) Fix [Feature Request] Support worktree isolation for subagents from non-master branches [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#45074Fetched 2026-04-09 08:13:53
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
1
Author
Timeline (top)
labeled ×2closed ×1commented ×1
RAW_BUFFERClick to expand / collapse

Bug Description I want to have the option to start a subagent with "isolation: "worktree"" AND what it will created from my branch (and not from master)

Environment Info

  • Platform: darwin
  • Terminal: iTerm.app
  • Version: 2.1.92
  • Feedback ID: 318262f6-9812-4eab-a723-bed221e70719

My intent is creating a maker-checker-loop, which requires secrecy\isolation from the makers (subagents). After a discussion with the agent it seems this is not actually possible in Claude.

Me: Please think again what options does an agent (checker) has to spawn a subagent with a worktree with isolation in mind. Please specify my options in a concise list

Agent: Options for a checker agent spawning maker subagents with isolation:

  1. isolation: "worktree" — true isolation, but branches off master, not your current branch. Makers won't have temp-commits.

  2. isolation: "worktree" + instruct maker to pull/cherry-pick from the feature branch as its first step — true isolation, eventually correct content, but messy and the maker knows about the source branch.

  3. No isolation + pre-created worktrees + prompt-based path restriction — correct content (branched off current HEAD), but no hard isolation boundary. Agent could read root.

  4. Bash claude CLI spawned from pre-created worktree CWD — true isolation + correct base. But it's outside the Agent tool (no structured result, no SendMessage to continue).

Summary: The Agent tool gives you isolation or the right branch, not both. The CLI approach gives you both but loses the Agent tool's ergonomics.

extent analysis

TL;DR

Use the Bash claude CLI spawned from a pre-created worktree CWD to achieve both isolation and the correct branch.

Guidance

  • Consider using option 4, Bash claude CLI spawned from pre-created worktree CWD, as it provides true isolation and the correct base branch.
  • Evaluate the trade-offs between using the Agent tool with limited isolation options and using the CLI approach with better isolation but reduced ergonomics.
  • Assess the feasibility of implementing a custom solution that combines the benefits of both approaches.
  • Review the Agent tool's documentation and limitations to determine if there are any plans to address the current isolation and branching limitations.

Example

No code snippet is provided as the issue does not contain specific code examples.

Notes

The current implementation of the Agent tool has limitations that prevent achieving both isolation and the correct branch simultaneously. The CLI approach provides a workaround but may require additional effort to integrate with the existing workflow.

Recommendation

Apply workaround: Use the Bash claude CLI spawned from a pre-created worktree CWD, as it provides the required isolation and correct branch, despite the reduced ergonomics compared to the Agent tool.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING