Support project-scoped worktrees in monorepos
Problem
In a monorepo, EnterWorktree always creates a worktree at the git repo root level. This means the entire monorepo gets a worktree, even when working on a single project subdirectory.
Additionally, WorktreeCreate / WorktreeRemove hooks are only invoked outside of git repositories. When inside a git repo, the built-in behavior takes over and the hooks are ignored. This means there's no way to customize worktree creation for monorepo use cases.
Expected Behavior
One or both of:
WorktreeCreate/WorktreeRemovehooks should be invoked even inside git repos, allowing users to override the default worktree location. This would let monorepo users create worktrees scoped to their project subdirectory.
EnterWorktreeshould support a project-scoped mode, where the worktree is created relative to the current working directory (the project) rather than the repo root.
Use Case
Working in a monorepo structured like:
repo-root/
serverless/
project-a/ ← working here
project-b/
project-c/
When running EnterWorktree from project-a, the worktree is created at repo-root/.claude/worktrees/<name> containing the full monorepo. Ideally it would be scoped to project-a/.claude/worktrees/<name> or at least allow hooks to control this.
Workaround Attempted
Configured WorktreeCreate hook in .claude/settings.local.json to create the worktree under the project directory — but the hook is never called because the tool detects a git repo and uses its built-in behavior.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗