[BUG] Task tool missing when launching session with --agent (tools not inherited even when undefined)
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/sidequestand other Task-based workflows normally.
Error Messages/Logs
Task tool is not available.
Steps to Reproduce
- Create the following agent definition file:
~/.claude/agents/test.md
with this content:
```ymltools:
---
name: test
description: minimal test agent
# NOTE: no field — expecting full inheritance (including Task)```
---
This is a minimal test agent used to reproduce the issue.
- Launch Claude Code with this agent:
claude --agent test
- In the new session, try to use any Task-based workflow, for example:
/sidequest
- 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/sidequestis available. - The issue only appears when launching the session with
claude --agent <agent-name>where the agent definition does not specifytools:. - 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.
14 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
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.
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
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
+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.
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.
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.
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--agentCLI flag). This seems to trigger the same issue — theTasktool (the one that spawns teammates) was silently missing from every interactive session.This also means Agent Teams do not work —
TeamCreate,TaskCreate,SendMessageare all there, but without theTasktool you cannot actually spawn any teammates.What worked for me
I just renamed the key in
settings.jsonto disable it temporarily: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
teammateMode: "in-process"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS: "1"in settings.json env@shostako Yes, using teams without a custom agent works fine. It's just the custom agent that's broken.
2 workarounds I found:
Yes, confirming I'm seeing the same thing - Not trying to use a Team just using --agent.
With further testing today, I can see some prior things I reported were mistakes.
--agentteam 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).--agent, neither team leader nor teammates can spawn teammates or subagents. This is basically non-functional.Possible workaround:
Possible workaround:
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.
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.Closing for now — inactive for too long. Please open a new issue if this is still relevant.
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.