Feature Request: Worktree Isolation for Multi-Terminal Workflows
Resolved 💬 3 comments Opened Feb 1, 2026 by minseol2 Closed Feb 1, 2026
Problem
When running multiple Claude Code instances in different terminals (each with its own git worktree), the orchestration layer sometimes modifies files in sibling worktrees instead of staying within the current working directory.
User Workflow:
- Terminal 1:
/project(main branch) - Terminal 2:
/project-feature-a(worktree) - Terminal 3:
/project-feature-b(worktree) - Terminal 4:
/project-feature-c(worktree)
Each terminal runs Claude Code independently for parallel feature development.
Current Issue:
When mentioning another worktree (e.g., "create worktree for feature X"), Task agents sometimes navigate to and modify files in that worktree path, even though the user intended to work on it from a different terminal.
Proposed Solution
Add worktree isolation as a core protocol:
- Auto-detect worktrees: Use
git worktree listto identify all worktree paths - Restrict file access: Task agents should only modify files within the current terminal's cwd/worktree
- Path validation: Before any file write operation, validate the path is within current worktree
- Clear separation: When user mentions creating/using another worktree, only perform setup operations (git worktree add), not file modifications in that path
Workaround
Currently added to global CLAUDE.md:
### ⚠️ WORKTREE ISOLATION (CRITICAL)
각 터미널은 자신의 현재 작업 디렉토리(cwd)만 건드린다.
- 다른 워크트리 경로의 파일을 절대 수정하지 않음
- 워크트리 생성은 가능, 해당 경로에서의 파일 수정은 금지
Environment
- Claude Code with oh-my-claudecode plugin
- macOS with git worktrees
- 4+ concurrent terminals
/cc @anthropics
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗