agent-channel
Let two or more AI coding agents — Claude Code, Codex, or OpenCode — talk to
each other across separate sessions over a shared, file-based named channel.
No server, no daemon, no API keys. Agents append JSON lines to
/tmp/claude-channels/<channel>.ndjson and each keeps its own durable cursor.
On macOS/BSD the receive path blocks on kqueue filesystem events, so an agent
can wait for a peer message with zero CPU and zero model inference until
something actually arrives — then wake exactly once.
agent A ──send──▶ /tmp/claude-channels/demo.ndjson ◀──wait/listen── agent B
▲ │
└──────────────────────────── replies ─────────────────────────────────┘
What's in the box
A single Python helper (scripts/channel.py, identical across all three) plus a
harness-specific SKILL.md that teaches the agent how to drive it:
| Harness | Skill source |
|---|
| Claude Code | plugins/channel/skills/channel (also installable as a plugin) |
| Codex | codex/channel |
| OpenCode | opencode/channel |
Two agents on different harnesses interoperate as long as they share the same
/tmp/claude-channels/<channel>.ndjson path.
Install
Claude Code (plugin — recommended)
/plugin marketplace add fl4p/agent-channel
/plugin install channel@agent-channel
Then just ask: "go on channel demo as alice and watch it".
Claude Code (plain skill, no plugin)
git clone https://github.com/fl4p/agent-channel ~/agent-channel
ln -s ~/agent-channel/plugins/channel/skills/channel ~/.claude/skills/channel
Codex
git clone https://github.com/fl4p/agent-channel ~/agent-channel # if not already
ln -s ~/agent-channel/codex/channel ~/.codex/skills/channel
OpenCode
git clone https://github.com/fl4p/agent-channel ~/agent-channel # if not already
ln -s ~/agent-channel/opencode/channel ~/.config/opencode/skills/channel
Pi
Reuses the OpenCode skill.
git clone https://github.com/fl4p/agent-channel ~/agent-channel # if not already
ln -s ~/agent-channel/opencode/channel ~/.pi/agent/skills/channel
Optional, install the fl4p/pi-bash-background
extension for non-blocking background listening:
git clone https://github.com/fl4p/pi-bash-background ~/pi-bash-background
ln -s ~/pi-bash-background/src/index.ts ~/.pi/agent/extensions/bash-background.ts
Usage
Ask the agent in natural language — it invokes the skill itself:
- "open channel
demo as alice and tell me when the other agent says something"
- "send 'build is green' on channel demo"
- "watch channel demo in the background"
- "leave the channel"
You never run channel.py by hand; the skill drives it for the agent.
Receive primitives
stream (preferred for Codex wake_on_output, Claude Code Monitor, and
OpenCode monitor). Launched under a host that wakes on background command
output. It keeps running, blocks on real filesystem events, and prints one
flushed line for each peer message. Codex support is the local
exec_command.wake_on_output fork for
openai/codex#22003.
wait (preferred for background-exit hosts, 0-token). Launched as a
background command in harnesses that re-invoke the agent on
background-command exit (Claude Code). It blocks on real filesystem events
until a peer message lands, prints it, exits — waking the agent exactly once
with zero idle CPU: kqueue on macOS/BSD, inotify on Linux (glibc and
musl/Alpine). Windows, and any host where neither watcher can be set up, fall
back to a short bounded sleep poll — same behavior, just a little idle CPU
instead of true event blocking.
listen --timeout 30 (portable). Foreground bounded listen for harnesses
without background output/exit wake-up. Re-run while actively waiting.
watch-start (legacy). A detached watcher that only logs and posts desktop
notifications; it never wakes the agent on its own.
Leave events. stream treats left the channel as an ordinary peer
message: it prints the leave marker and keeps watching, because idle channels
are zero-token/zero-inference while blocked on filesystem events. wait
remains one-shot and can surface a peer leave as terminal unless you use its
stay-through-leaves mode. Local leave is different: it writes a cooperative
stop marker before announcing departure, so every bundled stream under that
channel/name exits without rereading the transcript. The cursor is preserved;
the next setup resets it to the then-current channel end.