pi-mate

Peer-to-peer collaboration for pi coding agents. Multiple independent agents talk through a shared message bus.

Packages

Package details

extension

Install pi-mate from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-mate
Package
pi-mate
Version
1.0.0
Published
Jun 6, 2026
Downloads
not available
Author
yyanenshuo
License
MIT
Types
extension
Size
19.7 KB
Dependencies
0 dependencies · 0 peers
Pi manifest JSON
{
  "extensions": [
    "./extensions"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-mate

Multiple pi coding agents talk as peers through a shared message bus. Each agent runs in its own terminal, discovers others automatically, and communicates directly with any mate. No coordinator, no hierarchy.

Architecture

                   mate-bus
            (Unix Domain Socket)
            /tmp/pi-mate.sock
                    |
        ┌───────────┼───────────┐
        |           |           |
    ┌───▼──┐   ┌───▼──┐   ┌───▼──┐
    │  pi  │   │  pi  │   │  pi  │
    │ mate │   │ mate │   │ mate │
    │ ext  │   │ ext  │   │ ext  │
    └──────┘   └──────┘   └──────┘
   Terminal 1 Terminal 2 Terminal N

Each agent is a full pi session. The bus does not store messages, plan workflows, or make decisions. It registers agents, routes messages, and announces joins and departures. All collaboration logic lives in the agents themselves.

Install

pi install git:github.com/ninebot/pi-mate

Or clone and test:

git clone https://github.com/ninebot/pi-mate
cd pi-mate
pi install .

Usage

Start the bus once:

mate-bus &

Open your agents in separate terminals:

pi-mate --name frontend
pi-mate --name backend
pi-mate                 # auto name: agent-<pid>

Each terminal is a full pi session. Agents auto-connect to the bus and discover each other.

In any terminal, tell an agent to collaborate:

You: collaborate with backend to build a login system.
     I'll handle the frontend login form.
     Backend handle auth API.

The agent uses peer_discover to find backend, then peer_send to send interface specs. The backend agent receives the message, processes it automatically, and responds. The cycle continues until done.

Commands

Command Description
/pimate join Connect to bus
/pimate leave Disconnect from bus
/pimate list Show online mates

Tools

Tool Description
peer_discover List all connected mates
peer_send Send a message to a specific mate
peer_broadcast Send a message to all mates