[BUG] Agent tool schema exposes isolation as required field with only "worktree" accepted, breaking subagents in non-git directories
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?
The Agent tool's runtime schema exposes isolation as a required field with "worktree" as the only accepted value. This contradicts the documentation, which states isolation is optional and only activates worktree behavior when explicitly set.
As a result, any subagent invocation from a non-git directory fails unconditionally — even for agents that have no need for git worktree isolation (e.g. browser automation via Playwright MCP). More importantly, this breaks all multi-repo workflows, where I want to spawn subagent at a directory dir with multiple repos in dir/repo1, dir/repo2, dir/repo3.
What Should Happen?
Per the docs and common-workflows, isolation is optional. Omitting it (or setting it to a non-worktree value) should allow the subagent to run in the current working directory without attempting to create a git worktree.
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
- Create or navigate to a directory that is not a git repository:
````
mkdir ~/test-workspace && cd ~/test-workspace
- Launch Claude Code from that directory:
````
claude
- Ask Claude to spawn any subagent — e.g.:
````
Use the general-purpose agent to say hello.
- Observe the error:
````
Error: Cannot create agent worktree: not in a git repository and no
WorktreeCreate hooks are configured.
- To confirm the schema constraint, ask Claude directly in the session:
```
Can you show me the isolation field options available to you in the Agent tool schema?
isolation
Claude will report that is required and "worktree"` is the only accepted value.
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.87
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Other
Additional Information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗