--bare mode should respect --tools flag to allow adding tools back (e.g. Agent, Skill)

Open 💬 2 comments Opened May 19, 2026 by astefanutti

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report
  • [x] I am using the latest version of Claude Code

What's Wrong?

--bare mode restricts the available tool set to [Bash, Read, Edit]. The --tools flag ("Restrict which built-in tools Claude can use") cannot add tools back — it can only filter within the bare set. Similarly, --allowed-tools has no effect on tool availability.

This means skills that use the Agent tool for parallel subagent dispatch (or Skill for sub-skill invocation) cannot run correctly in --bare mode. The model correctly reports "I don't have the Agent tool" and falls back to doing all work inline, which produces architecturally different results.

Reproduction:

# Without --bare: Agent is available (not listed in init but usable)
echo 'Use the Agent tool to spawn a subagent that returns "hello"' | \
  claude --print --output-format stream-json --verbose --max-turns 3 2>/dev/null | \
  python3 -c "
import sys, json
for line in sys.stdin:
    try:
        obj = json.loads(line.strip())
        if obj.get('type') == 'assistant':
            for block in obj.get('message',{}).get('content',[]):
                if block.get('type') == 'tool_use':
                    print(f'Tool used: {block[\"name\"]}')
    except: pass
"
# Output: Tool used: Agent

# With --bare: Agent is unavailable, even with --tools
echo 'Use the Agent tool to spawn a subagent that returns "hello"' | \
  claude --bare --print --output-format stream-json --verbose --max-turns 3 2>/dev/null | \
  python3 -c "
import sys, json
for line in sys.stdin:
    try:
        obj = json.loads(line.strip())
        if obj.get('type') == 'assistant':
            for block in obj.get('message',{}).get('content',[]):
                if block.get('type') == 'text' and block.get('text','').strip():
                    print(block['text'][:200])
    except: pass
"
# Output: I don't have an "Agent tool" available in my current toolset. The tools I have access to are:
# 1. Bash  2. Edit  3. Read

The init event confirms the tool restriction:

  • Without --bare: Tools: ['AskUserQuestion', 'Bash', ..., 'Skill', ..., 'Write'] (24 tools)
  • With --bare: Tools: ['Bash', 'Edit', 'Read'] (3 tools)
  • With --bare --tools "Bash,Edit,Read,Agent,Skill": still Tools: ['Bash', 'Edit', 'Read']--tools has no effect

What Should Happen?

--tools should be able to expand the tool set in --bare mode. If a user explicitly passes --bare --tools "Bash,Edit,Read,Agent,Skill", Agent and Skill should be available.

This is important because:

  1. --bare is documented as becoming the default for -p ("Bare mode ... will become the default for -p in a future release"), which means all headless/SDK usage will lose Agent and Skill tools unless there's a way to add them back.
  1. --bare is designed for reproducibility (skip hooks, plugins, CLAUDE.md auto-discovery), not for restricting built-in tools. Agent and Skill are built-in tools, not config-dependent — they don't need hooks or plugins to function.
  1. Multi-agent skills are common — skills that use Agent for parallel dispatch (e.g., launching N subagents for batch processing) produce architecturally different results when forced to run inline. In our case: $48/63min with agents vs $8/20min without — but with 20-0 pairwise quality wins for the agent-based run.

Related Issues

  • #40959 (closed as duplicate) — "--bare mode drops custom agents from --agents JSON for subagent_type dispatch"
  • #18895 (closed, stale) — "SDK programmatic agents ignored"
  • #33513 (closed) — "--agents flag agents invisible to Claude"

All were auto-closed without resolution.

Environment

  • Claude Code version: 2.1.121
  • Platform: macOS (Darwin 24.6.0, arm64)

View original on GitHub ↗

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