Worktree isolation creates worktrees in .git/modules/ for submodule repos, breaking agent permissions
Problem
When using isolation: "worktree" on the Agent tool in a git submodule repo, the created worktree lands inside .git/modules/<path>/.claude/worktrees/ instead of inside the project's own .claude/worktrees/ directory.
This puts the worktree outside the project's permission scope, causing agents spawned with mode: "bypassPermissions" to still be prompted for file write permissions.
Reproduction
- Have a repo that is a git submodule (e.g.,
world/tools/arpiis a submodule ofworld) - Spawn an agent with
isolation: "worktree"andmode: "bypassPermissions" - The agent's worktree is created at a path like:
```
/path/to/world/.git/modules/tools/arpi/.claude/worktrees/agent-abc123
`
instead of:
``
/path/to/world/tools/arpi/.claude/worktrees/agent-abc123
- The agent is prompted for every file write despite
bypassPermissions
Expected behavior
Worktrees should be created relative to the working tree of the submodule (the project root), not relative to the git dir (.git/modules/). This would keep them within the project's permission scope.
Workaround
Don't use isolation: "worktree" for submodule repos. Agents can work directly on the main branch with --no-verify for parallel execution.
Environment
- Claude Code version: 2.1.90
- OS: macOS (Darwin 25.3.0)
- Git: submodule repo
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗