[FEATURE] claude --worktree should preserve subdirectory context in monorepos

Resolved 💬 3 comments Opened Feb 23, 2026 by krystian-elisity Closed Feb 27, 2026

Problem

When launching claude --worktree <name> from a subdirectory within a monorepo, the worktree session drops you at the repository root instead of the equivalent subdirectory within the worktree.

Example

# Launch from a subdirectory
cd ~/work/repo/my-monorepo/services/backend/user-service
claude --worktree TICKET-12345

# Expected pwd:
~/work/repo/my-monorepo/.claude/worktrees/TICKET-12345/services/backend/user-service

# Actual pwd:
~/work/repo/my-monorepo/.claude/worktrees/TICKET-12345/

Why this matters

1. Lost directory context: The user launched from a specific service directory for a reason — they want Claude scoped to that area. Landing at the repo root defeats the purpose.

2. Wrong CLAUDE.md loaded: In monorepos, teams often have different CLAUDE.md files at different levels (root vs service subdirectory). When the worktree drops you at the root, you pick up the root-level CLAUDE.md which may contain instructions irrelevant to the service you're working on.

Expected behavior

If claude --worktree is launched from <repo>/path/to/service/, the session should cd into <worktree>/path/to/service/ after creating the worktree.

Workaround

Manually cd into the subdirectory after worktree creation, but this is easy to forget and breaks the flow.

View original on GitHub ↗

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