---
title: "Agent-to-agent messaging between coding agents: how it works · Cork"
description: "How coding agents message each other as of October 2026: Claude Code SendMessage, team mailboxes, cross-session sockets, A2A, and what a useful message holds."
canonical: "https://corkcli.com/blog/agent-to-agent-messaging-coding-agents"
last_updated: "2026-10-03"
published: "2026-10-03"
author: "Kevin Vera"
---

# Agent-to-agent messaging between coding agents: how it works

How coding agents message each other as of October 2026: Claude Code SendMessage, team mailboxes, cross-session sockets, A2A, and what a useful message holds.

By Kevin Vera · October 3, 2026 · [Guides](https://corkcli.com/blog/c/guides) · 6 min read

Agent-to-agent messaging lets one coding agent send plain text to another while both are working, so a finding, a warning or a hand-off reaches the agent that needs it without you copying it between terminals. Under the hood it is a mailbox: the sender writes a message to an address (a name, a session, or a role), the receiver's harness delivers it between tool calls or as a new turn, and the receiver treats it as information from another agent, not as an instruction from you. The details differ by tool, and the hard part is less the transport than deciding who should receive what.

## The three shapes of agent messaging

Most setups fall into one of three shapes.

1. **Parent and child.** A main agent spawns workers and gets their results back. Claude Code subagents work this way: each starts with a fresh context and returns a summary. Subagents that Claude named when it spawned them can also message each other.
2. **A team with a shared mailbox.** Several peers, a lead, and a task list. Claude Code's agent teams (experimental, off by default, enabled with `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1`) give each agent a mailbox file at `~/.claude/teams/{team-name}/inboxes/{agent-name}.json`. Teammates message each other by name; to reach everyone, an agent sends one message per recipient.
3. **Independent sessions.** Separate agents that you started yourself, possibly on different machines, that discover each other and exchange messages. Claude Code's cross-session messaging covers this for your own sessions.

Outside coding tools, the Agent2Agent (A2A) protocol, originally developed by Google and now hosted by the Linux Foundation, is an open standard for agents built on different frameworks to communicate. It is aimed at interoperability between agent systems rather than at coding agents sharing one repository.

## How Claude Code delivers a message

As of October 2026, Claude Code's cross-session messaging is on by default in recent versions (v2.1.224 or later on macOS and Linux). Claude finds targets with a `ListAgents` tool and sends with `SendMessage`; you can see what a session can reach with `/list-agents`. You can also name the target yourself by typing `@` and the session's name in your prompt:

```text
Let @api-worker know the schema migration finished
```

A few mechanics are worth knowing:

- **Transport.** Between sessions on the same machine, messages go over a per-session Unix socket (a named pipe on Windows), never through Anthropic's servers. Sessions on your other machines or in the cloud are reached through Remote Control.
- **Timing.** The receiver reads the message between tool calls during an active turn, so a running tool is never interrupted. If the receiver is idle, the message starts a new turn.
- **Trust.** The receiving agent is told the message came from another session, not from you. A message cannot approve a permission prompt, cannot change configuration, and slash commands in it arrive as plain text.
- **Inbound control.** `crossSessionInbound` set to `accept`, `hold` or `refuse` decides what happens to arriving messages.
- **Loop protection.** Repeated messages per sender are rate limited, identical repeats are dropped, and at most 50 accepted messages queue up.
- **Cost.** A delivered message counts toward usage like a prompt you type, and waking an idle session sends its full context.

We did not find an equivalent built-in peer messaging feature in the Codex or Cursor documentation as of October 2026. Teams that mix tools usually route messages through something all agents can reach: a shared MCP server, a file or a chat channel read by a hook, or a coordination service.

## What makes a message useful

A message is only as good as its addressing and content. Patterns that work:

- **Address by the code, not by the agent.** "Whoever is working on `parseInvoice`" survives agents starting and stopping; "agent 3" does not.
- **Lead with the change, then the consequence.** "Renamed `getUser` to `fetchUser` in `users/api.ts`; your call in `billing/sync.ts` will break" is actionable. "I made some changes" is not.
- **Send facts, not orders.** The receiver should decide how to adapt. Messages that read as instructions get treated with suspicion, which is the correct default.
- **Batch.** Ten small messages cost ten turns for an idle receiver. Claude Code refuses rapid bursts to one session and tells the sender to batch.
- **Expect no reply.** Design messages so the receiver can act without answering. A sender that waits for replies stalls.

## When messaging is the wrong tool

Messaging is reactive: it depends on the sender noticing that someone else cares. It does not stop two agents from editing the same function at the same time, and it does not tell an agent about a conflict nobody spotted. For those you need shared state that every agent checks before writing (claims, locks, or a gate), and a way to land work that reruns tests against everyone's latest commits. Use messages for judgment calls and hand-offs; use shared state for the mechanical checks.

## How Cork helps

In Cork, agent messaging is one part of a coordination layer that also does the mechanical checks. Any agent can message the others in the repo, a single agent, or whoever is working on a given function, so the address follows the code rather than a session name. The messages sit next to things that do not depend on anyone remembering to send them: briefings at session start and on each prompt with the signatures, callers and recent changes of the code the agent is about to touch; live awareness, so when a teammate renames a function or changes a signature your agent depends on, it hears on its next step; and a [write gate](https://corkcli.com/blog/write-gate) that holds an edit against code another agent is changing right now until your agent has their version. This works across Claude Code, Codex and Cursor through hooks with no extra model calls, plus an MCP server at https://mcp.corkcli.com.

Cork is the [coordination layer](https://corkcli.com/blog/coordination-layer-ai-coding-agents) for multiplayer coding agents: it keeps Claude Code, Codex and Cursor agents, on one machine or across a team's machines, from overwriting each other on one codebase, and hands each agent what the others already learned.

```bash
curl -fsSL https://corkcli.com/install.sh | sh
```

## Frequently asked questions

### Can Claude Code agents talk to each other?

Yes. Subagents named at spawn time, agent team teammates, and your separate Claude Code sessions can all message each other with `SendMessage`. Cross-session messages arrive as plain text from another session, never as your consent.

### Can a Codex agent message a Claude Code agent?

We found no built-in way in either tool's documentation as of October 2026. You need a shared channel both can reach, such as an MCP server both agents use or a hook that reads a shared inbox.

### Is A2A used for coding agents?

A2A is a general open standard for agent interoperability under the Linux Foundation. It is not specific to coding agents, and we did not find A2A support for peer messaging in the Claude Code, Codex or Cursor docs.

### Do agent messages cost tokens?

Yes. In Claude Code a delivered message counts toward usage like a typed prompt, and a message to an idle session starts a turn that sends that session's context.

## Sources

- <https://code.claude.com/docs/en/cross-session-messaging>
- <https://code.claude.com/docs/en/agent-teams>
- <https://code.claude.com/docs/en/sub-agents>
- <https://a2a-protocol.org/latest/>

## Related reading

- [Claude Code agent teams vs separate sessions on one repo](https://corkcli.com/blog/claude-code-agent-teams-vs-separate-sessions): Claude Code agent teams vs separate sessions on one repo: how each works, token cost, same-file conflicts, worktrees, and when to pick which (October 2026).
- [Cork vs Claude Code agent teams: one session's crew, or every agent on the repo](https://corkcli.com/blog/cork-vs-claude-code-agent-teams): Cork vs Claude Code subagents, agent teams and cross-session messaging: what each coordinates, where agents collide, and when to use both together.
- [Claude Code subagents vs parallel sessions: when to use which](https://corkcli.com/blog/claude-code-subagents-vs-parallel-sessions): Subagents or parallel Claude Code sessions? Compare context, control, file isolation and cost, with a decision checklist and setup for each, as of October 2026.
- [How to share context between Claude Code sessions](https://corkcli.com/blog/share-context-between-claude-code-sessions): Six ways to carry context between Claude Code sessions: CLAUDE.md, auto memory, handoff files, resume and fork, cross-session messaging, SessionStart hooks.

[All articles](https://corkcli.com/blog.md) · [Cork in Markdown](https://corkcli.com/index.md) · [llms.txt](https://corkcli.com/llms.txt)

This page in HTML: https://corkcli.com/blog/agent-to-agent-messaging-coding-agents
