Claude Code resolves its project root by walking up from cwd looking for .git. In worktrees, .git is a file pointing back to the main checkout, so Claude Code would resolve the main repo as its project and write files there instead of in the worktree. Adding --directory explicitly pins it to the worktree path. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>