A pi extension that decomposes work into IRC-coordinated subagents. A lead agent spawns worker agents that communicate and coordinate over IRC channels in real time.
This is more of a silly experiment rather than something serious. I think there's a lot of promise, and I'm enjoying getting to use IRC again, but I make no guarantees that this is "good" or even a remotely reasonable idea. Please don't subject any public IRC servers to your bots.
I have started using this as just an interface with Pi, even without the subagent stuff, by just chatting with the lead agent in IRC. My setup is that I run the IRC server + Pi session on a small NUC in my basement, then connect to IRC via Tailscale from other devices so I can continue sessions on the go. That part, at the very least, is pretty neat.
The easiest way to get started is with Ergo via Docker:
docker run -d \
--name ergo \
-p 6667:6667 \
-p 6697:6697 \
-v ergo-data:/ircd \
ghcr.io/ergochat/ergo:stableThis gives you a local IRC server on port 6667 (plaintext) and 6697 (TLS) with Ergo's defaults (which are more than likely totally fine for a local usecase).
pi install git:github.com/mmcc/pirc-extensionor clone the repo and hack away
# From your project directory
pnpm add /path/to/pirc-extensionThen add it to your project's package.json:
{
"pi": {
"extensions": ["pirc-extension"]
}
}Or load it directly when running pi:
# Via github
pi -e git:github.com/mmcc/pirc-extension
# Via a local clone
pi -e /path/to/pirc-extensionConfiguration is via CLI flags (preferred) or environment variables (fallback). Flags take precedence over env vars.
pi -e /path/to/pirc-extension \
--pirc-server localhost \
--pirc-port 6667 \
--pirc-nick myproject-lead \
--pirc-channels "#myproject,#myproject-tasks,#myproject-status"export PIRC_SERVER=localhost
export PIRC_PORT=6667
export PIRC_NICK=myproject-lead
export PIRC_CHANNELS="#myproject,#myproject-tasks,#myproject-status"| Flag | Env Var | Default | Description |
|---|---|---|---|
--pirc-nick |
PIRC_NICK |
<project>-lead |
IRC nickname for the lead agent |
--pirc-server |
PIRC_SERVER |
localhost |
IRC server hostname |
--pirc-port |
PIRC_PORT |
6667 |
IRC server port |
--pirc-channels |
PIRC_CHANNELS |
auto | Comma-separated list of channels to join |
| — | PIRC_WATCH_CHANNELS |
same as channels | Channels that trigger notifications to the lead agent |
The <project> name is derived from your current working directory name. When no nick is specified, it defaults to <project>-lead. When no channels are specified, they default to #<project>, #<project>-tasks, and #<project>-status.
| Command | Description |
|---|---|
/pirc-plan <description> |
Describe what you want built and the lead agent will decompose it into subagents |
/pirc-agents |
Show running agents and IRC channel status |
/pirc-killall |
Kill all running subagents |
The extension registers these tools, available to both the lead agent and all subagents:
irc_send— Send a message to an IRC channel (supports reply threading viareplyTo)irc_read— Read recent message history from a channelirc_channels— List joined channels and buffered message countsspawn_agent— Spawn a new pi subagent with a role and instructions. Optionally acceptsproviderandmodelto override the defaults for that agent.list_agents— List all running subagents and their statuskill_agent— Stop a subagent by nicknamemessage_agent— Send a direct RPC prompt to a subagent (bypasses IRC)
The extension supports IRCv3 draft/multiline for sending and receiving multi-line messages as a single batch. If your IRC server supports it (e.g. Ergo does out of the box), messages with newlines (code blocks, structured output, etc.) are sent as one atomic batch rather than being split into separate lines. On the receiving end, batched messages are automatically reassembled into a single message.
This is negotiated automatically via capability negotiation; no configuration needed. If the server doesn't support draft/multiline, messages fall back to normal single-line sends.
- The lead pi agent connects to IRC and joins the project channels.
- When you run
/pirc-plan, the lead agent breaks the work into roles and spawns subagents. - Each subagent is a separate
pi --mode rpcprocess that also connects to IRC with the pirc extension loaded. I experimented with using Pi's Agent SDK and spawning workers, but the juice didn't seem to be worth the squeeze. - Agents coordinate by posting messages to shared IRC channels — task claims go to
#<project>-tasks, progress updates to#<project>-status, and general discussion to#<project>. - IRC messages from watched channels are delivered to agents automatically as they arrive.
# Start pi in your project with the extension loaded
pi -e /path/to/pirc-extension --pirc-server localhost --pirc-port 6667
# Then in pi:
/pirc-plan Build a REST API with user auth and a test suiteThe lead agent will spawn workers like myproject-api-builder, myproject-auth, myproject-tester, each with specific instructions, and they'll coordinate over IRC to build it out.