[FEATURE] Allow custom branch name for isolation: worktree in Task tool

Resolved 💬 4 comments Opened Feb 22, 2026 by jaried Closed Mar 22, 2026

Problem Statement

When using isolation: "worktree" in the Task tool to spawn agents in isolated git worktrees, the branch name is automatically generated as worktree-agent-{hash} and cannot be configured. The worktree path is also not configurable.

This makes it difficult to:

  1. Identify which worktree belongs to which task (branch names are opaque hashes)
  2. Integrate with existing branch naming conventions (e.g., feature/issue-123)
  3. Resume work on a specific worktree after session interruption
  4. Manage worktrees manually (e.g., git worktree list shows only hash-based names)

Additionally, background team members spawned with isolation: "worktree" still have their pwd set to the main repository, meaning the isolation doesn't actually take effect for them.

Proposed Solution

Add optional parameters to the Task tool's isolation: "worktree" mode:

  • worktree_branch: Custom branch name for the worktree (e.g., "S1-13-qq-channel")
  • worktree_path: Custom path for the worktree directory

Example:

{
  "isolation": "worktree",
  "worktree_branch": "feature/my-task",
  "worktree_path": "../worktrees/my-task"
}

Also ensure that background team members correctly inherit the worktree working directory.

Priority

Medium

Feature Category

Task tool / Agent Teams / Git integration

Environment

  • Claude Code version: 2.1.50
  • OS: Windows 10 Pro (Build 19045)
  • Terminal: Windows Terminal
  • Platform: Anthropic API

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗