Agent Teams (tmux mode): named teammates start in $HOME instead of inheriting the lead's working directory
Environment
- Claude Code: 2.1.199
- OS: macOS (Darwin 25.5.0)
- Settings:
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1,"teammateMode": "tmux"
Bug
When the lead session spawns named teammates via the Agent tool (e.g. subagent_type: "general-purpose", name: "smaug-clip-research"), the teammate's session starts with cwd=$HOME instead of the lead's working directory.
The lead was running in a project repo (~/Documents/<org>/<repo>). Eleven teammates spawned from that session in one evening (one research agent plus a verify-0–verify-9 fan-out) all recorded "cwd": "/Users/<user>" in their session transcripts, which landed under ~/.claude/projects/-Users-<user>/ rather than the lead's project directory.
Expected
Teammates inherit the lead session's working directory, matching how in-process subagents behave.
Impact
- Repo-relative paths in spawn prompts silently resolve against
$HOME. The work only succeeded because the spawn prompts happened to contain the absolute repo path. - Teammates read/write in
$HOME— a directory the user never opened a session in or trusted. - A project entry for
/Users/<user>is auto-created in~/.claude.json(withhasTrustDialogAccepted: false), and teammate transcripts accumulate under~/.claude/projects/-Users-<user>/, detached from the real project. - Teammates load the wrong project context (
$HOMEhas no project CLAUDE.md, MCP config, or skills).
Likely mechanism
tmux-spawned panes appear to get the tmux server/session default directory rather than being launched with -c <lead cwd> (or equivalent). The docs at https://code.claude.com/docs/en/agent-teams don't specify teammate cwd behavior, and there's no setting or hook to pin it.
Related
#23669 and #59838 ask for per-teammate cwd control; this issue is about the default being wrong in tmux mode — the default should be the lead's cwd.