[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.
This issue has 14 comments on GitHub. Read the full discussion on GitHub ↗