[BUG] Agent Team Isolation per Git Worktree
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 running multiple Claude Code terminals from different git worktrees, agent teams are stored globally at ~/.claude/teams/ and ~ ~/.claude/tasks/. This causes race conditions where one instance's team cleanup/delete operations affect teams created by another instance working in a different worktree.
What Should Happen?
Claude code should support creating the agent team files in the worktree to prevent race conditions
Error Messages/Logs
Steps to Reproduce
launch claude code in a worktree
launch agent teams in the worktree with active work
launch another claude code session in another worktree
start using agent teams and then stop and clean up the agent teams
This will wipe all files in ~/.claude/teams including the agents, tasks and inbox etc of all agents irrespective of the worktree they are working in. all agent teams are deleted breaking all worktree sessions
Claude Model
None
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.1.34
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Xterm
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗