[FEATURE] Configurable default worktree directory

Resolved 💬 2 comments Opened Feb 24, 2026 by mg-agilion Closed Feb 24, 2026

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

Currently, Claude Code hardcodes the worktree location to .claude/worktrees/<name> with no way to override this path.

Many projects already have a convention for worktree placement (e.g., worktrees/ at the repo root, or sibling directories outside the repo). Placing worktrees inside .claude/ conflicts with these conventions and can cause issues with tooling that scans the project directory (IDEs, build tools, file watchers).

Proposed Solution

Add a worktreeDir setting to settings.json (project or user scope) that overrides the default base directory for newly created worktrees:

{
  "worktreeDir": "worktrees"
}

Supported values:

  • Relative path — resolved relative to the repository root (e.g. "worktrees" → <repo>/worktrees/<name>)
  • Absolute path — used as-is (e.g. "/tmp/worktrees")
  • Omitted / null — falls back to current default (.claude/worktrees/<name>) for full backwards compatibility

The setting would apply wherever Claude Code creates worktrees today - both via the --worktree CLI flag and via the EnterWorktree tool inside an agent session.

Alternative Solutions

Workaround today: Manually create worktrees with git worktree add and then start Claude in them — which works, but loses the convenience of Claude's built-in EnterWorktree integration

Priority

Medium - Would be very helpful

Feature Category

Configuration and settings

Use Case Example

A project uses worktrees/ at the repository root as the conventional location for git worktrees (consistent with team tooling and IDE workspace configuration). When Claude Code creates worktrees under .claude/worktrees/ instead, they need to be manually moved afterward:

# Current workaround: create manually, then start Claude
git worktree add worktrees/migrate-rules -b feature/migrate-rules
cd worktrees/migrate-rules && claude

With a configurable worktreeDir, this would just work out of the box:

{
  "worktreeDir": "worktrees"
}

Additional Context

_No response_

View original on GitHub ↗

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