[BUG] Task tool missing when launching session with --agent (tools not inherited even when undefined)

Status Closed — not planned
Maintainer reply None cached
Activity 14 comments · opened Dec 10, 2025 · closed Mar 24, 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 I launch Claude Code v2.0.64 with a custom agent using the --agent flag, the main session unexpectedly loses access to the Task tool, even though the agent definition does not declare any tools: field.

According to the documentation, omitting tools: in an agent definition should make the agent inherit all default tools available to the main thread. However, when the session is started with claude --agent <agent-name>, Task-based commands like /sidequest fail with a message such as:

Task tool is not available.

In other words, simply starting a session with a custom agent via --agent causes the Task tool to be unavailable, despite not explicitly restricting tools in the agent configuration.

What Should Happen?

  • When tools: is omitted in an agent definition, the agent should inherit all main-thread tools, including the Task tool.
  • Launching a session with claude --agent <agent-name> should not implicitly disable Task or apply sub-agent-like restrictions to the main agent.
  • After starting with --agent, I should still be able to use /sidequest and other Task-based workflows normally.

Error Messages/Logs

Task tool is not available.

Steps to Reproduce

  1. Create the following agent definition file:

~/.claude/agents/test.md

with this content:
```yml
---
name: test
description: minimal test agent
# NOTE: no
tools: field — expecting full inheritance (including Task)
---
```
This is a minimal test agent used to reproduce the issue.

  1. Launch Claude Code with this agent:

claude --agent test

  1. In the new session, try to use any Task-based workflow, for example:

/sidequest

  1. Claude responds with an error that the Task tool is not available (or equivalent wording), and Task/sub-agent workflows cannot be used.

Claude Model

Sonnet (default)

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

2.0.64

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

VS Code integrated terminal

Additional Information

  • If I start Claude Code without --agent, the Task tool works as expected and /sidequest is available.
  • The issue only appears when launching the session with claude --agent <agent-name> where the agent definition does not specify tools:.
  • My understanding from the docs is that omitting tools: should not disable Task but instead inherit the default tool set from the main thread. The current behavior feels inconsistent with that expectation and makes it difficult to use custom agents as top-level orchestrators.

View original on GitHub ↗

14 Comments

github-actions[bot] · 8 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/11028
  2. https://github.com/anthropics/claude-code/issues/12994
  3. https://github.com/anthropics/claude-code/issues/11895

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

github-actions[bot] · 7 months ago

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

Butanium · 7 months ago

hey this is very annoying to me. the workaround is to make a skill instead and add -p "/myagent /agentsubskill1 /agentsubskill2" to my claude startup but this is not elegant.

context: I want a research orchestrator agent that needs some skill preloaded (that are shared with research scientist subagent), this is why a skill is not optimal

dganttii · 7 months ago

I am still having issues with this. What is going on with the Task tool and custom agents? Not sure why this has gone unresolved for so long

adamskubel · 7 months ago

+1 This is prevents having complex multi-agent workflows which are required for efficient context management. If the plan is to not fix this, then please indicate so.. but this should be a trivial change.

Reithan · 6 months ago

I also am seeing this issue, and further, even if you DO explicitly add 'Task' to the tools list, it's STILL unavailable. It doesn't seem like there's any way to make a main-context agent that can spawn subagent or teammates, even though the docs clearly say this should be possible.

Reithan · 6 months ago

Also the suggested workaround of "spawn the orchestration agent from the main context using the Task tool" is... honestly gibberish. The user can't invoke the task tool themself, and even if you prompt the main context agent to do so, the spawned subagent STILL has no access to the Task tool for team management.

shostako · 6 months ago

For anyone trying to use Agent Teams with a custom agent

Just wanted to share what worked for me, in case it helps others hitting this.

I had "agent": "my-agent" in my user-level ~/.claude/settings.json (not using the --agent CLI flag). This seems to trigger the same issue — the Task tool (the one that spawns teammates) was silently missing from every interactive session.

This also means Agent Teams do not workTeamCreate, TaskCreate, SendMessage are all there, but without the Task tool you cannot actually spawn any teammates.

What worked for me

I just renamed the key in settings.json to disable it temporarily:

// Before
"agent": "my-agent"

// After
"_agent": "my-agent"

After restarting, Agent Teams worked as expected — 3 teammates spawned in parallel (in-process mode), all completed their tasks, and shutdown/cleanup went smoothly.

Not ideal since you lose your custom agent, but at least it unblocks Agent Teams until this gets fixed.

Environment

  • Claude Code v2.1.37
  • WSL2 (Ubuntu) + WezTerm
  • teammateMode: "in-process"
  • CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS: "1" in settings.json env
Reithan · 6 months ago

@shostako Yes, using teams without a custom agent works fine. It's just the custom agent that's broken.

2 workarounds I found:

  • Turn your custom agent into a Skill, use that skill to start the team. This may be what people meant by 'just use Task to start the team'. Still you lose a lot of what would make a custom agent good here.
  • Have your main context non-agent start the team with your team lead agent + teammates, and have the team lead 'request' agents from the main context, but still 'act' as team lead - this is messier.
emmahyde · 6 months ago

Yes, confirming I'm seeing the same thing - Not trying to use a Team just using --agent.

Reithan · 6 months ago

With further testing today, I can see some prior things I reported were mistakes.

  1. If starting without --agent team leader can spawn teammates 'raw' or from agents. Team members cannot spawn subagents. Prior confirmation they could seems to have been hallucination on their part(s).
  2. If starting with --agent, neither team leader nor teammates can spawn teammates or subagents. This is basically non-functional.

Possible workaround:

  • Have team members 'request' agents from the team leader, who can spawn and task those agents for the team members
  • This is sub-optimal as cross-team messaging will explode for requesting agent spawning, tasking, shutdown, etc.

Possible workaround:

  • Include several 'helper' agents in the team of types you expect to be used, e.g. Read, Explore, Write, etc. These will need to be 'variants' of these agents that are instructed to idle and wait for tasking from the team.
  • Instruct all teammates to add tasks for the helper agents to acquire and complete.
  • Helper agents act as a common 'pool' of subagents for team's use
  • This is still sub-optimal: we save on spawn/destroy messaging, but messaging from tasks & returns throughout the team will still add plenty of 'noise'.

This is likely one of the big problems with agent teams using huge amounts of tokens, right now. Every action is/must be done by the teammates directly, rather than using subagents like Explore, etc.

Reithan · 6 months ago

Working around this by creating 'pools' of agents also fails. Individual agents claim the "cannot see any team members" of the expected agent types, and simply perform Reads/Writes themselves, rather than creating or delegating tasks to the team, even if their permission mode is set to delegate, seemingly ignoring this setting.

github-actions[bot] · 5 months ago

Closing for now — inactive for too long. Please open a new issue if this is still relevant.

github-actions[bot] · 5 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.