Uses Claude Code's native team mode for multi-agent research. Proven working Feb 27, 2026 — 3-teammate quick research produced 51KB of structured findings + synthesis from a single API connection in ~10 minutes.
Headless batch mode (native-research.sh) is proven. In-session mode (agent uses Teammate tool directly) is the eventual target but requires team tools in the session (env var must be set before session starts).
export CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1Already in ~/.bashrc. New sessions get team tools automatically.
# Quick research (3 teammates)
/life-code/native-swarm/native-research.sh quick "topic" "question 1" "question 2"
# Standard research (5 teammates)
/life-code/native-swarm/native-research.sh standard "topic" "question"
# Thorough research (8 teammates)
/life-code/native-swarm/native-research.sh thorough "topic" "question"Output goes to /life-var/exchange/{slug}-{timestamp}/.
The team mode uses a single tool called Teammate with multiple operations. Teammates are spawned via the Task tool with team_name and name parameters.
| Operation | Purpose | Who |
|---|---|---|
spawnTeam |
Create a team (name + description) | Lead |
write |
Send message to ONE teammate by name | Anyone |
broadcast |
Send message to ALL teammates (expensive — N messages) | Anyone |
requestShutdown |
Ask a teammate to stop | Lead |
approveShutdown |
Accept shutdown request and exit | Teammate |
rejectShutdown |
Decline shutdown, keep working | Teammate |
approvePlan |
Approve a teammate's plan | Lead |
rejectPlan |
Reject plan with feedback | Lead |
cleanup |
Remove team + task directories | Lead |
discoverTeams |
List available teams | Anyone |
requestJoin / approveJoin / rejectJoin |
Dynamic team membership | Anyone/Lead |
Teammates are created using the Task tool with team_name and name parameters:
{
"subagent_type": "general-purpose",
"name": "web-broad",
"team_name": "research-topic",
"prompt": "You are a research agent...",
"description": "web-broad researcher"
}- Teammates' plain text output is NOT visible to the lead or other teammates
- To communicate, teammates MUST use
Teammate(operation: "write", target_agent_id: "team-lead", value: "...") - Messages from teammates are automatically delivered to the lead (no inbox polling needed)
- The lead sees queued messages when their current turn ends
Must follow this order:
Teammate(operation: "requestShutdown", target_agent_id: "worker-name")for each teammate- Wait for each to
approveShutdown Teammate(operation: "cleanup")to remove team + task directories- Only THEN prepare final response
Teams have a 1:1 correspondence with task lists (Team = Project = TaskList):
- Team config:
~/.claude/teams/{team-name}/config.json - Task list:
~/.claude/tasks/{team-name}/ - Teammates use TaskCreate, TaskUpdate, TaskList for work coordination
- Tasks are assigned via
TaskUpdate(owner: "teammate-name")
native-research.sh
└── claude -p (coordinator process, runs from /tmp)
├── Teammate(spawnTeam, "research-{topic}")
├── Task(name: "web-broad", team_name: "...", prompt: "...")
├── Task(name: "web-deep", team_name: "...", prompt: "...")
├── Task(name: "data", team_name: "...", prompt: "...")
│ └── [teammates run in-process, do WebSearch + WebFetch]
├── Teammates write findings to files via Write tool
├── Coordinator receives completion messages (auto-delivered)
├── Coordinator reads findings, evaluates quality, synthesizes
├── Coordinator requestShutdown → approveShutdown → cleanup
└── Output: synthesis.md + findings-{name}.md
All teammates run in-process (backendType: "in-process") — they share the coordinator's API connection. No additional sessions needed.
| Depth | Teammates | Description |
|---|---|---|
| quick | web-broad, web-deep, data | General search + forums/Reddit + structured data |
| standard | + academic, contrarian | + authoritative sources + dissenting views |
| thorough | + recent, practitioners, adjacent | + last 6 months + case studies + adjacent fields |
/life-var/exchange/{slug}-{timestamp}/
├── findings-web-broad.md # 10-15KB, 10+ findings with URLs
├── findings-web-deep.md # 10-15KB, focused on forums/Reddit
├── findings-data.md # 10-15KB, .gov/.edu/official sources
├── synthesis.md # 10-15KB, comprehensive synthesis
└── coordinator.log # Full coordinator stdout (empty until process ends)
| Metric | Result |
|---|---|
| Topic | "David Spielman Quirkiatry Nashville psychiatrist ADHD autism" |
| Depth | quick (3 teammates) |
| Total output | 51,236 bytes |
| Findings | 33 structured findings across 3 teammates |
| Source URLs | 65 unique URLs |
| Synthesis | 12,308 bytes with bibliography, answers to both questions |
| Elapsed | ~10 minutes |
| API connections | 1 (coordinator, teammates in-process) |
| Aspect | Native Team Mode | Research Swarm MCP | Subprocess Swarm |
|---|---|---|---|
| Workers per research | 3-8 (in-process) | 3-8 (subprocesses) | 3-8 (subprocesses) |
| API connections | 1 | N+1 (workers + synth) | N |
| Rate limit impact | None | High | High |
| Quality scoring | Semantic (LLM evaluates) | Regex (file size, URLs, keywords) | None |
| Follow-up iteration | Coordinator can message teammates | Retry with same prompt | None |
| Output quality | Excellent (tested) | Good (tested) | Varies |
| Infrastructure | 1 bash script (~200 lines) | Python MCP server (~1400 lines) | Python library (~850 lines) |
| Cron/batch capable | Yes | Yes | Yes |
| In-session capable | Yes (with Teammate tool) | No (MCP, runs external) | No |
| Synthesis | Coordinator does it natively | Separate synthesis worker | None |
- Now: Use
native-research.shfor headless batch research - In-session: When agent has Teammate tool, use it directly (no shell script needed)
- Deprecate: research-swarm MCP (
/life-code/research-swarm/) - Keep: Subprocess swarm (
/life-code/swarm/) for non-research parallel work
When an agent has the Teammate tool, it can run research directly:
Teammate(operation: "spawnTeam", team_name: "research-{slug}")— create team- For each domain:
Task(subagent_type: "general-purpose", name: "{domain}", team_name: "research-{slug}", prompt: "...")— spawn teammate - Teammates do research and write findings to exchange directory
- Teammates send completion message via
Teammate(operation: "write", target_agent_id: "team-lead", value: "Done") - Lead receives messages automatically, reads findings files
- Lead evaluates quality and synthesizes
- For each teammate:
Teammate(operation: "requestShutdown", target_agent_id: "{name}") - Wait for
approveShutdownfrom each Teammate(operation: "cleanup")— remove team resources
- Coordinator lingers after synthesis — The shutdown protocol takes time. Monitoring loop kills after 30s grace.
- Log file stays empty until exit —
claude -pbuffers stdout. - Team cleanup sometimes incomplete —
~/.claude/teams/artifacts may remain. Safe to delete. - tmux required — Team mode creates tmux sessions internally.
Official system prompts (from Piebald-AI/claude-code-system-prompts repo):
tool-description-teammatetool.md— Full Teammate tool operationstool-description-teammatetools-operation-parameter.md— Operation enumsystem-reminder-team-coordination.md— Teammate injection promptsystem-reminder-team-shutdown.md— Shutdown protocolsystem-prompt-teammate-communication.md— Communication rulesagent-prompt-exit-plan-mode-with-swarm.md— Plan → swarm workflow
Cloned to: /life-var/tmp/claude-code-system-prompts/
| File | Purpose |
|---|---|
native-research.sh |
Headless batch research script |
README.md |
This file |