[BUG] Agent subagents are forced to use isolation: "worktree" in non-Git directories, even with tengu_worktree_mode=false
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When using Agent subagents in Claude Code from a non-Git working directory, subagent creation repeatedly fails with:
Error: Cannot create agent worktree: not in a git repository and no
WorktreeCreate hooks are configured. Configure
WorktreeCreate/WorktreeRemove hooks in settings.json to use worktree
isolation with other VCS systems.
In non-Git directories, subagent creation fails every time.
It appears Agent calls are still being forced through isolation: "worktree", which makes subagents unusable outside Git repos.
What Should Happen?
In non-Git directories, Agent should not be forced to use worktree isolation. If worktree is unavailable and not explicitly requested, Agent should gracefully fall back to non-worktree mode.
Error Messages/Logs
Error: Cannot create agent worktree: not in a git repository and no
WorktreeCreate hooks are configured. Configure
WorktreeCreate/WorktreeRemove hooks in settings.json to use worktree
isolation with other VCS systems.
Steps to Reproduce
- Start Claude Code in a non-Git directory (example:
/Users/admin/app, not a git repo). - Trigger any request that causes an Agent subagent to be launched.
- Observe that subagent creation fails with the worktree error.
- Observe the same failure persists.
Claude Model
Other
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.71 (Claude Code)
Platform
Other
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗