# Pi to Pi: Two-Way Agent Orchestration with the Pi Coding Agent <!-- ref: @content/youtube/indy-dev-dan/2026-05-18-pi-to-pi-two-way-agent-orchestration version: 3 updated_at: 2026-10-31T18:12:40.137Z --> IndyDevDan (Indy Dev Dan, 2026-05-18): Every mainstream multi-agent pattern — sub-agent delegation, message-queue brokers like Claude Code agent teams, deterministic agent chains — moves information in one direction, top-down, even when results flow back. *Synthesized from IndyDevDan on Indy Dev Dan, 2026-05-18.* IndyDevDan builds and demos a peer-to-peer communication extension for the Pi coding agent harness, letting multiple agents on the same or different machines prompt each other as equals rather than as orchestrator and sub-agent. ## Core Thesis Every mainstream multi-agent pattern — sub-agent delegation, message-queue brokers like Claude Code agent teams, deterministic agent chains — moves information in one direction, top-down, even when results flow back. IndyDevDan argues the missing primitive is a genuine two-way channel where any agent can prompt any other agent and await a reply, producing a flat hierarchy in which the best information wins instead of the agent with the most authority. Combining agents from different labs, each with a narrow context window, yields a system that outperforms any one of them alone. ## Key Insights - The demo runs four Pi coding agents at once with **no orchestrator** — they join and leave a shared pool as peers. Agents are named at launch (`jcoms 2`, then names like `production` and `dev`), and a GLM agent is added mid-session (`jcoms 4`) to show the pool is dynamic. - The flagship use case is a **cross-device production bug repro**: a gatekeeper agent on a Mac Mini production box, a second agent on an M5 MacBook Pro dev box. The dev agent's prompt asks it to bring the affected database slice over **with PII stripped**, so an engineer can reproduce locally. The production agent owns the redaction and never exposes personally identifiable information across the network — the pattern IndyDevDan frames as viable for something like an EU-resident service where data cannot leave the device. - The whole mechanism is **four tools, no magic**: list agents on the network, send a command/prompt, await a response (blocking), and a non-blocking poll to check a message. Sending returns a message ID the caller can await later. - Two implementations ship: a single-device `comms` version, and a `comms-net` version built on a lightweight **bun server** that accepts requests over the network (connect, get messages, list agents, process events). IndyDevDan explicitly calls the networked version a starting point to be hardened, not production security. - The second demo uses the channel to **port a skill across vendors**: an E2B agent inventories the existing `/agent-sandboxes` E2B skill, and an exe.dev agent (running Opus 4.7 in the Pi harness) drives the collaboration to build a feature-parity skill against exe.dev's persistent-VM platform, plus a parity document. The exchange surfaced **10 corrections** to claims the building agent would otherwise have baked in. - Concrete context-window numbers anchor the argument for splitting work: the E2B agent hits **10% of a 1M-token window (100K tokens)** just reloading its own skill's surface area, later ~20%, then 25%. Across both agents there are **2M tokens of context available, split in half**, each half focused on one tool. - IndyDevDan contrasts models by behavior: **GPT 5.5 "chews up tokens"** and keeps going for maximum comprehensiveness, while **Opus 4.7 is more goal-oriented** and converges on the stated objective unless prompted wide enough to capture more scope. - The concrete parity findings the agents traded are preserved as real output: templates versus images is only partially supported, snapshots have no E2B equivalent, `cp` is unique to exe.dev, and the browser tool maps to two primary files. - He is candid that the pattern degrades: cost scales linearly with agent count **plus** communication bounce, sloppy prompts without a defined end state can produce token-burning loops, and past some agent count the everyone-talks-to-everyone topology stops helping. - The motivation behind the whole Pi-harness thread is stated plainly — hedging against Claude Code as the agentic coding market leader by owning the harness rather than renting it. He still uses Claude Code daily; the argument is about which capabilities are reachable at all. ## Actionable Takeaways 1. Model the primitive as four operations, not a framework: `list agents`, `send command` (returns a message ID), `await response` (blocking), and a non-blocking poll. Everything else is prompt design. 2. For sensitive-data work, put the gatekeeper agent **on the machine that holds the data** and make redaction its stated job in the system prompt, then let the requesting agent ask for a slice rather than granting it direct access. 3. Name agents at spawn time (`production`, `dev`, `sandbox`) and open a separate pool per project so unrelated work does not spill between context windows — IndyDevDan verifies afterward that there was no cross-issue contamination. 4. When one agent drives, say so in the prompt: designate the driver, tell it the peer will not initiate, and give it a concrete deliverable (a working skill plus a feature-parity document), not a research comparison. 5. To port a capability from vendor A to vendor B, have the A-agent write a feature inventory file first — inputs, outputs, commands, quirks — then hand that artifact to the B-agent as its parity target and keep A online to answer questions. 6. Always define an end state in the prompt. Two peers with no termination condition can ping-pong indefinitely. 7. Run a validator agent alongside a primary agent: it costs more tokens but checks both that claims are true and that the work claimed to be done was actually done. ## Notable Quotes > "Ideas die in hierarchies." — IndyDevDan > "A focused agent is a performant agent." — IndyDevDan > "It's not just getting all the right things. It's getting just the right things." — IndyDevDan > "Peer-to-peer, not orchestrator to worker, changes things here. Agents are equals. They're not parent and child." — IndyDevDan > "The tool you use limits what you believe is possible." — IndyDevDan --- *You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).* *Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*