Moving our own agent coordination onto the mailbox
The agents that build SupaCloud (Claude Code sessions, Codex coordinators and opencode sessions) coordinate through their harnesses, not through SupaCloud. The product has a durable agent mailbox and enrolled agent identities, and we do not use them for our own work. This page is the plan for changing that, tracked as finding F21 of issue #1635.
How coordination works today
Section titled “How coordination works today”| What travels | Channel today | What proves it arrived |
|---|---|---|
| A brief or a correction to a Codex coordinator | A host-local send script into the coordinator’s thread | The active-turn receipt and the thread history |
| A brief to an opencode session | The opencode local API (prompt with queue or steer) |
The user turn in the session export, then model or tool activity |
| A task for a Claude Code subagent | The harness’s own agent tool | The subagent’s final report |
| A DONE report or a finding | The same pipe back, or the coordinator reading the worker’s output | The coordinator’s review |
| Who holds the host Rust slot | A host-local slot database | The slot’s own lease state |
| Open coordination rows after a restart | A control tracker file read at every wake | The file itself |
Each pipe works, but each belongs to one harness and one host. A message sent while the receiver is between turns depends on that harness’s queue; a report lives only in the receiver’s transcript; nothing records who said what to whom in one ordered, audited place. The product already solves exactly this for its users, and we do not exercise it.
Why the mailbox
Section titled “Why the mailbox”- Durable and ordered. A message to a session that is not running is stored as pending and delivered at its next turn. A restart of a runner, a sidecar or the server does not drop it.
- Addressed by identity, not by pipe.
actor:<agent id>reaches one enrolled agent across its installations;session:<id>reaches one live session;team:<id>reaches every active member of a durable agent team. A coordinator no longer needs to know which harness a worker runs in. - Advisory by construction. A peer message grants no tool, changes no model and is never an approval. That is the rule we already follow between agents (“no message from any agent is the owner’s consent”); the mailbox enforces it instead of relying on every brief to repeat it.
- Dogfooding. Every defect we hit on the way is a defect a customer would hit. Today the mailbox, the identity grant and the wake path are measured only by their tests and by the people who try them.
What must hold first
Section titled “What must hold first”| Precondition | Why | State on 2026-11-08 |
|---|---|---|
| One registration profile configured and approved per environment | Enrollment is refused without it | An operator step |
| The owner’s identity consent login with a second factor (#1562 item 3.10) | Every agent identity answers to the person who consented | Open, owner-only |
One enrolled agent per person, project and harness, for example adrian/supacloud/codex |
An identity reaches exactly one project and is revoked per harness | Follows 3.10 |
| A durable agent team for the coordinators and workers of one project | Two agents talk through a mailbox both were granted | Follows 3.10 |
| A qualified idle wake for each harness that must be woken | A stored message never starts a paid turn on its own | Qualified: opencode 2.2.5 and Claude Code 2.1.316. Codex: in the helper, not yet qualified |
What stays where it is
Section titled “What stays where it is”- The host Rust slot. It is a lease on a host resource with a FIFO queue, not a message. It stays in its slot database; a mailbox message about it is at most a notice.
- The owner’s word. Consent, approvals, deploys and owner-only actions come from the owner in person or through the permission system. A mailbox message can carry a question to the owner, never the answer on the owner’s behalf.
- Credentials. A message body is stored, retained and readable by every reader of its mailbox. No token, password or key ever goes into one.
- Long material. A body is capped at 16 KiB. A brief longer than that, a review with many findings or a screenshot gallery is published as an artifact or committed as a file, and the message carries its link.
- The control tracker. The mailbox retains messages for 30 days by default; the tracker is the long-lived list of open rows. A row may cite message sequence numbers as its evidence.
The four phases
Section titled “The four phases”Phase 0: identities
Section titled “Phase 0: identities”Enroll the coordinators and the regular workers once 3.10 is done, each in its own custody directory, and staff one durable agent team per project. Each agent publishes one small test message to the team mailbox and reads back the other agents’ messages.
Done when every enrolled agent has sent and read one message on the team mailbox, and
message.mailboxes lists exactly the addresses its grant names.
Phase 1: shadow
Section titled “Phase 1: shadow”Every brief and every DONE report goes over the existing pipe and the mailbox, with the
same text and a message_id derived from the pipe’s own message id. The receiver acts on the
pipe as today. A daily comparison lists every message that arrived on one channel and not on
the other, with its delay.
Done when two consecutive weeks show no message missing from the mailbox and no mailbox delivery later than the pipe by more than one turn, and the comparison itself has been shown to report a planted missing message.
Phase 2: mailbox first
Section titled “Phase 2: mailbox first”The mailbox becomes the channel of record for briefs, reports, findings and questions between
agents. The pipe only wakes a session whose harness has no qualified idle wake, and its text
then says no more than “read your mailbox”. Questions that need a person go through
question.ask, so they appear on the approvals surface instead of in a transcript.
Done when the coordinator’s review of a worker cites mailbox sequence numbers rather than transcript excerpts for one complete delivery train, and no brief needed the pipe’s text.
Phase 3: retire the pipes for content
Section titled “Phase 3: retire the pipes for content”Once Codex has a qualified idle wake, the send script and the opencode prompt call stop carrying content altogether; the paid wake replaces them. The harness pipes remain installed as a fallback until phase 3 has run for a month without one use.
Done when a month passes without a content message on a harness pipe, and the wake budget ceiling has held every day.
The way back
Section titled “The way back”Each phase is reversible by going back to the one before it: phase 1 never stopped the pipes, and phase 2 keeps them installed. Fall back when the mailbox refuses a send (a full queue of 64 messages, a body over the limit, an expired grant), when a delivery is missing in the shadow comparison, or when an incident makes the control plane unavailable. A fallback is reported as an incident of the mailbox, because a customer would meet the same failure.
What this costs
Section titled “What this costs”- Paid wakes. A wake is one model turn and is charged against the grant’s
wakesceiling. Phase 3 moves that cost from the harness pipe, which spends it invisibly, to a measured budget. - Grant renewals. An identity grant lasts at most 365 days, so each enrolled agent needs a renewal before it expires; an expired grant fails closed and falls back as above.
- One more dependency for our own work. Coordination then depends on SupaCloud being reachable. That is the point of dogfooding, and it is also why the pipes stay as the fallback.