channels.tools
Channels for the pi coding agent: connect channel servers that push events into a live session — wake it when idle, queue when busy — and proxy their tools. A client for the claude/channel convention.
Package details
Install channels.tools from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:channels.tools- Package
channels.tools- Version
0.2.0- Published
- Sep 9, 2026
- Downloads
- 1,205/mo · 222/wk
- Author
- schuettc
- License
- MIT
- Types
- extension
- Size
- 57.9 KB
- Dependencies
- 0 dependencies · 0 peers
Pi manifest JSON
{
"extensions": [
"./src/index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
channels.tools
Channels for the pi coding agent. Connect channel servers — small local processes that push events into a live session — and the session becomes reachable by your other tools: a push wakes it when idle and queues, coalesced, when it's mid-turn. Each server's tools are registered so the agent can act on what arrived.
Mail buses, code-review servers, CI and file watchers — anything on your machine that can speak the (simple) protocol below can drive an agent session. Servers are subprocesses the session itself spawns from your config; nothing listens on a network.
Site: channels.tools
Install
pi install npm:channels.tools
Configure
~/.pi/agent/channels.json (global) or <project>/.pi/channels.json
(project wins on name collision). Nothing connects until one of these files
exists:
{ "channelServers": {
"file": { "command": "node", "args": ["examples/file-channel.js", "inbox.txt"] },
"my-bus": { "command": "mybus", "args": ["channel"], "env": {}, "cwd": "." }
} }
Real-world servers: muster (muster channel, a
multi-agent mail bus) and galley (galley channel, document review) both
speak this protocol.
Behavior
- An event arriving while the session is idle starts a turn immediately (delivered as a steer with the server's event payload).
- Events arriving mid-turn are buffered and delivered coalesced once the turn
settles (pi's
agent_settled, notagent_end) — a running turn is never interrupted. - Each server's tools are registered under their own names, so instructions a server hands the agent stay literally true.
AGENT_SESSION_IDis passed into each server's environment at spawn, and never written to the host process's environment; a server reads it at startup to scope itself to the session that spawned it. A retry respawn carries the same id.- Identity for the session's own bash commands is not this package's job: pi sets
PI_SESSION_IDper command, and on this rig pi-quiet copies it toAGENT_SESSION_ID, so a rig without pi-quiet has noAGENT_SESSION_IDin shell commands. - A server that crashes is retried with backoff; its tools re-register on reconnect. A misbehaving or non-conforming process is killed and logged.
The protocol
A channel server is a subprocess speaking newline-delimited JSON-RPC 2.0
over stdio (no Content-Length framing, no network, no ports).
- Handshake — client sends
initialize; the server's result must declarecapabilities.experimental["claude/channel"]and may include aninstructionsstring (injected as guidance) andtools(see below). Servers not declaring the capability are rejected. - Events — the server pushes
notifications/claude/channelwith aparamspayload: freeform text plus optionalmetaattributes (count,thread_id,from, …). Multiple notifications may be coalesced by the client; servers that pre-coalesce should say how many events one push represents inmeta.count. - Tools — servers may expose tools (name, description, JSON-schema
input). The client registers them with pi and proxies invocations via
tools/call. - Shutdown — SIGTERM on session end (SIGKILL after a grace period).
The reference server in examples/file-channel.js
implements the whole convention dependency-free (the server itself is ~60
lines; the rest of the file is the demo): append a line to a watched file and
an idle pi session wakes with it.
node examples/file-channel.js --demo # narrated walkthrough, no pi needed
node examples/file-channel.js --demo --wire # the same exchange as raw wire frames
Test
npm test # unit, no binaries needed
node --test test/live.test.ts # integration; skips servers not installed