Claude Code subagents vs agent teams vs local messaging — 3 ways your agents communicate
When a developer says their agents talk to each other, they usually mean one of three arrangements that share almost nothing beyond the word “agent”. One is delegation inside a single session. Another is a coordinated group the model builds for itself. The third is a pipe between sessions you started by hand.
The difference matters because the arrangements fail differently. Pick the wrong one and you end up paying for a five-agent team on a task that needed one subagent, or waiting on a message that will never arrive because the receiving session has no way to be woken.
The question that separates them is simple: who is allowed to address whom?
Subagents are delegation, not conversation
A Claude Code subagent is a markdown file with YAML frontmatter: name, description, optionally tools and model, and a body that becomes the subagent’s system prompt. Project subagents live in .claude/agents/, personal ones in ~/.claude/agents/. Claude calls one through the Agent tool when the description matches the work in front of it, or you force it with an @-mention.
What defines a subagent is the shape of the conversation. It starts with a fresh context window, receives its prompt and basic environment details, does the work, and returns a result to whoever called it. It has no session identity, so nothing can address it as a durable peer. When its tools include SendMessage it can still message main or a named sibling, and Claude can resume it by name; what it lacks is a shared channel and a registered address.
That default is a feature for a lot of work. Research fan-out, “find every call site and summarize what breaks”, a review pass you don’t want filling your main window with file contents. The docs put it plainly: results return summarized to the caller, which is why subagents cost less context than the alternatives. Claude Code starts subagents spawned from the main conversation in the background by default, refuses a 21st concurrent one, and caps how deeply they can nest. Their transcripts persist with the session, so a subagent can be resumed later.
It stops fitting when the work needs a durable conversation: when two workers have to keep checking in, or when the job has to outlive the turn that started it. A subagent can’t hold a role or a channel either, so it can’t be one of the named workers in an orchestrated run. It answers a question; it does not hold a conversation.
Agent teams are a coordinated group inside one session
Agent teams are experimental. You enable them with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 in settings.json or your environment. With the flag off, no team is set up, no team directories are written, and Claude does not propose teammates.
With it on, one session becomes the lead. It spawns teammates through the Agent tool, and each teammate is a full Claude Code session with its own context window. The team has four parts: the lead, the teammates, a shared task list that members claim and complete, and a mailbox. The mailbox is a JSON file per agent under ~/.claude/teams/{team-name}/inboxes/. Teammates message each other by name with SendMessage, receive messages automatically between turns, and notify the lead when they go idle, including their final answer in the notification. You can message any teammate directly instead of going through the lead.
Two details matter if you care about who approved what. When one agent messages another, Claude Code tells the receiver the message came from another Claude session, not from you. And a teammate cannot approve a permission prompt or supply consent on your behalf. The permission boundary stays per session, and a denied action can’t be laundered through a teammate.
The costs are documented and they are not small: one team per session, no nested teams, a lead fixed for the session’s lifetime, and in-process teammates that /resume will not restore. Task status sometimes lags behind the actual work, split panes need tmux or iTerm2, and spawning requires an interactive session, so a named subagent in -p headless mode runs as an ordinary subagent. Token spend scales with every teammate, which is why the docs suggest starting with three to five and going up only when the work genuinely runs in parallel.
Teams are good at parallel work that benefits from discussion and self-coordination: competing hypotheses during a debug, separate modules, a review from several angles. They are bad at sequential work, at anything where workers must outlive the lead, and at reaching sessions you started yourself in other terminals.
Local messaging connects sessions you started
The third arrangement is the least fashionable one: you start several sessions, and a small local process moves text between them.
Anthropic now ships a version of this as cross-session messaging. Claude discovers your other sessions with ListAgents and sends with SendMessage. It is on by default once your Claude Code is new enough: 2.1.224 or later on macOS, Linux and WSL 2, 2.1.234 on native Windows, and 2.1.248 on Bedrock and the other cloud providers when feature-flag fetching is off. Each session binds a Unix domain socket on macOS and Linux, or a named pipe on native Windows, restricted to your operating system user. A peer message is read between tool calls during an active turn, and starts a new turn when the session is idle. The receiving session’s permissions still apply, and its inbound setting can accept, hold or refuse peer messages.
asenq is the same idea built outside Claude Code. A per-user daemon listens on ~/.asenq/asenq.sock with mode 0600 and stores sessions and messages in SQLite. It delivers through whatever path each harness exposes: a labelled user turn through Claude Code’s messaging socket, a prompt through OpenCode’s plugin API, a user message through omp’s extension API. The difference from the native feature is scope. asenq puts Claude Code, OpenCode and omp in one namespace, gives every session a durable name, keeps history, and treats you as an address called human with an inbox and a TUI.
What neither tool does is start sessions or merge work. You start everything. asenq’s role system lets one session lead workers over a channel, but the orchestration is a skill and a workflow, not an engine inside the messenger, and the native feature leaves task state to you.
Side by side
| Subagents | Agent teams | Local messaging | |
|---|---|---|---|
| Who addresses whom | Parent to child by default; with SendMessage, also main and named siblings |
Teammates to each other, within one team | Any named session to any other, plus the human |
| Who starts the sessions | Claude, through the Agent tool | Claude, as team lead | You |
| Cross-harness | No | No | asenq: yes; native: Claude Code only |
| Shared task list | No | Yes | No |
| Human in the loop | You read the result in the main thread | You can message any teammate directly | You are an address (asenq) or the prompt author |
| Survives a restart | Transcript persists, resumable | Not for in-process teammates | asenq: names, queues and history persist |
| Cost | Lower, results summarized back | Higher, one instance per teammate | One extra turn per message that wakes an idle session |
Picking one
When the work fits inside one task and you only care about the answer, a subagent is enough. That covers most of what people mean by “parallelize this”: isolation, a clean main context, no coordination overhead.
Agent teams are the intended tool for the other case. Claude decomposes the work itself, the workers coordinate, and everything runs in Claude Code. Accept the experimental label, the fixed lead and the token bill. Start with three teammates and keep them out of each other’s files.
Local messaging is for the sessions you start by hand. Begin with native cross-session messaging if Claude Code is all you run. Reach for asenq when OpenCode or omp is in the mix, when you want one inbox for yourself, or when names need to survive restarts.
They also combine downward. A session that receives a message can spawn a subagent to handle part of it, and the reply still goes back to the session that owns the conversation. What you can’t do is give a subagent a durable address: it has no session identity, it never joins a channel, and its sibling messages only exist while it is running.
Related
- Agent-to-agent communication in Claude Code: every option, honestly compared: /blog/claude-code-agent-to-agent-communication/
- Can Claude Code sessions talk to each other? Three routes: /blog/claude-code-sessions-talk-to-each-other/
- How asenq delivers messages: /blog/how-asenq-delivers-messages/
- Run multiple Claude Code agents in parallel: /blog/run-multiple-claude-code-agents-in-parallel/
Sources
- Claude Code subagents (context, invocation, concurrency, resume): https://code.claude.com/docs/en/sub-agents
- Claude Code agent teams (flag, mailbox, task list, limitations, best practices): https://code.claude.com/docs/en/agent-teams
- Claude Code cross-session messaging (versions,
ListAgents/SendMessage, sockets, inbound policy, limits): https://code.claude.com/docs/en/cross-session-messaging - asenq delivery mechanics: https://github.com/parciffal/asenq/blob/main/docs/how-delivery-works.md