[BUG] Custom agents (--agent) cannot spawn subagents into teams - Task tool unavailable

Resolved 💬 3 comments Opened Feb 5, 2026 by NavarrePratt Closed Feb 5, 2026

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 Claude Code with a custom agent (claude --agent daily), the Teammate tool is available and can create teams via spawnTeam, but the Task tool (subagent spawner) is not present in the session. This means teams can be created but never populated with members, making agent teams non-functional from custom agent sessions.

The same workflow works correctly from a plain claude session (no --agent flag).

What Should Happen?

Custom agents should have access to the Task tool when CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 is set, allowing them to spawn subagents into teams the same way a plain claude session can.

Steps to Reproduce

  1. Create a custom agent at ~/.claude/agents/daily.md:

``yaml
---
name: daily
description: Primary agent
permissionMode: bypassPermissions
---
``

  1. Set CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 in ~/.claude/settings.json
  2. Run claude --agent daily
  3. Invoke a skill that uses agent teams (e.g., one that calls Teammate then Task with team_name)
  4. Teammate(operation: "spawnTeam") succeeds - team is created
  5. Task(subagent_type: "general-purpose", team_name: "...", name: "...", model: "opus", prompt: "...") fails - tool does not exist
  6. Agent has TaskCreate, TaskList, TaskUpdate, TaskGet, Teammate, SendMessage - but NOT the Task tool (subagent spawner)
  7. Same skill works correctly from a plain claude session

Error Messages/Logs

Debug log evidence from the failing session:

[TeammateModeSnapshot] Captured from config: auto
Error: getTeammateModeFromSnapshot called before capture - this indicates an initialization bug
[Reconnection] computeInitialTeamContext: No teammate context set (not a teammate)

No explicit error is shown to the user. The Task tool simply does not appear in the agent's available tools. The agent attempted CLI workarounds (claude agent start --team ...) which failed with error: unknown option '--team'.

Is this a regression?

Unknown - agent teams are experimental. The Task tool has always been available in plain claude sessions.

Claude Model

Opus 4.6

Claude Code Version

2.1.32

Platform

Anthropic API (Max)

Operating System

macOS (Darwin 24.6.0)

Terminal/Shell

Terminal.app / zsh

Additional Information

Related issues:

  • #23420 - Agent Teams tools not injected (different: that user has no Teammate tool at all; we have Teammate but not Task)
  • #22695 - Task tool naming collision (relevant context: Task vs TaskCreate/TaskList naming confusion)

Settings:

{
  "env": {
    "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
  }
}

Workaround: Run skills that require agent teams from a plain claude session instead of claude --agent.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗