npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

pi-intercom

v0.3.0

Published

<p> <img src="banner.png" alt="pi-intercom" width="1100"> </p>

Readme

Pi Intercom

Direct 1:1 messaging between pi sessions on the same machine. Send context, findings, or requests from one session to another — whether you're driving the conversation or letting agents coordinate.

User flow: press Alt+M or run /intercom to pick a session and send a message

Why

Sometimes you're running multiple pi sessions — one researching, one executing, one reviewing. Pi-intercom lets you:

  • User-driven orchestration — Send context or findings from your research session to your execution session
  • Agent collaboration — An agent can reach out to another session when it needs help or wants to share results
  • Session awareness — See what other pi sessions are running and their current status

Unlike pi-messenger (a shared chat room for multi-agent swarms), pi-intercom is for targeted 1:1 communication where you pick the recipient.

Pi-intercom also integrates well with pi-subagents: use pi-subagents to spin up delegated workers, then use intercom for direct, session-to-session handoffs and clarifications.

In One Minute

Each pi session that has pi-intercom loaded and enabled connects to a tiny local broker over a local IPC transport. The broker keeps track of connected sessions and routes direct messages to the one you target by name or session ID. The extension gives you both a tool (intercom) and a small overlay UI (/intercom or Alt+M). Incoming messages are rendered inline inside the recipient session, can trigger a turn immediately, and are also stored in Pi session history as extension entries.

Install

pi install npm:pi-intercom

Then restart Pi. The extension auto-connects to the broker on startup and registers the bundled pi-intercom skill for common coordination patterns.

Recommended: Add this snippet to your project's AGENTS.md to help agents understand when to coordinate across sessions:

<pi-intercom>
Coordinate with other local pi sessions on related codebases. Use `/skill:pi-intercom` for patterns.

**When:** Same codebase (parallel work), reference codebase (consulting patterns), related repos (shared libraries).

**Not when:** Unrelated codebases, trivial questions, or when you can proceed independently.

**Principle:** Prefer `send` for notifications; `ask` only when blocked waiting for input.
</pi-intercom>

A session becomes intercom-connected when all of these are true:

  • the pi-intercom extension is installed and loaded in that session
  • enabled is not set to false in ~/.pi/agent/intercom/config.json
  • the session has started or reloaded after the extension was installed
  • the local broker is running or can be auto-started

The session list only shows intercom-connected sessions, not every open Pi process on the machine.

If a session is unnamed, pi-intercom now exposes a runtime-only fallback alias like subagent-chat-1a2b3c4d so other sessions can still target it. That alias is not persisted as the Pi session title, so pi --resume can keep showing the transcript snippet instead of a generic session-... name.

Quick Start

From the Keyboard

Press Alt+M or type /intercom to open the session list overlay:

  1. Select a session — Use arrow keys to pick a target session
  2. Compose message — Write your message in the compose overlay
  3. Send — Press Enter to send, Escape to cancel

From the Agent

The agent can list sessions and send messages using the intercom tool. For common patterns like planner-worker delegation, the bundled pi-intercom skill provides copy-paste ready examples:

// List active sessions
intercom({ action: "list" })
// → • research — ~/projects/api (claude-sonnet-4) [researching]
// → • executor — ~/projects/api (claude-sonnet-4) [idle]

// Send a message
intercom({ action: "send", to: "research", message: "Check if UserService.validate() handles null" })
// → Message sent to research

// Check connection status
intercom({ action: "status" })
// → Connected: Yes, Session ID: abc123, Active sessions: 3

// Send with attachments (code snippets, files, or context)
intercom({
  action: "send",
  to: "worker",
  message: "Here's the fix:",
  attachments: [{
    type: "snippet",
    name: "auth.ts",
    language: "typescript",
    content: "function validate(user: User) { ... }"
  }]
})

Receiving Messages

When a message arrives, it appears inline in your chat with the sender's info and a reply hint:

**📨 From research** (~/projects/api)

To reply, use the intercom tool: intercom({ action: "reply", message: "..." })

Found the issue — UserService.validate() doesn't check for null input.
See auth.ts:142-156.

The reply hint (enabled by default) now points to intercom({ action: "reply", ... }), which resolves to the exact sender and original message ID under the hood. Threading is still exact — replies still go out as a normal send with the right replyTo value so the waiting caller can match the response. The message triggers a new turn, so the agent can respond or act on it immediately. If the message includes attachments, their content is also included in the agent-visible message body. Messages are rendered inline in the chat and also written to Pi session history as extension entries.

Workflow: Planner-Worker Coordination

The most natural use of pi-intercom is splitting a task between two sessions — one holds the big picture, the other does the hands-on work. When the worker hits an ambiguity ("should I optimize for readability or performance here?"), they ask without losing context.

Setup

Open two terminals and start pi in each. Name them so they can find each other:

# Terminal 1                    # Terminal 2
/name planner                   /name worker

Verify they see each other from either session:

intercom({ action: "list" })
// → • worker — ~/projects/api (claude-sonnet-4) [idle]

The Conversation

Here's how a typical exchange looks. The planner delegates with send (fire-and-forget). The worker uses ask for anything that needs a response — questions, discoveries, completion reports. ask sends the message and blocks until the planner replies, so the worker gets the answer as a tool result and continues in the same turn.

Planner sends a task:

intercom({
  action: "send",
  to: "worker",
  message: "Task-3: Add retry logic to API client. Key files: src/api/client.ts, src/api/types.ts. Ask if anything's unclear."
})

Worker hits an ambiguity — asks and waits:

intercom({
  action: "ask",
  to: "planner",
  message: "Should retry apply to all endpoints or just idempotent ones? Also, max retry count and backoff strategy?"
})
// → Reply from planner: Only GET/PUT/DELETE — never POST. Max 3 retries, exponential backoff starting at 100ms.
// Worker continues implementing with the answer, same turn, full context.

Worker finds something unexpected — escalates and waits:

intercom({
  action: "ask",
  to: "planner",
  message: "Found: fetchWithTimeout swallows network errors. Fixing this changes the error shape. OK to proceed?"
})
// → Reply from planner: Yes, surface the error types. The current behavior is a bug.

Worker reports completion:

intercom({
  action: "ask",
  to: "planner",
  message: "Task-3 done. Added RetryPolicy type, applied to GET/PUT/DELETE, surfaced NetworkError, 4 tests passing."
})
// → Reply from planner: Looks good. Move on to task-4.

Communication Patterns

| Pattern | Action | Why | |---------|--------|-----| | Task Delegation | Planner uses send | Fire-and-forget. Planner doesn't need to wait for an ack. | | Clarification Request | Worker uses ask | Worker needs the answer to proceed. Blocks until reply. | | Discovery Escalation | Worker uses ask | Worker needs approval before changing course. | | Completion Report | Worker uses ask | Planner might have follow-up instructions or the next task. |

Reply Hints

When replyHint is enabled (the default), incoming messages include the exact intercom() call to respond:

**📨 From planner** (~/projects/api)

To reply, use the intercom tool: intercom({ action: "reply", message: "..." })

Only GET/PUT/DELETE — never POST. Max 3 retries with exponential backoff starting at 100ms.

This matters because the agent receiving the message doesn't need to reconstruct raw to and replyTo IDs — the hint is right there. Combined with triggerTurn (which wakes the recipient agent on delivery), it enables real back-and-forth conversation without any complex protocol machinery. If the reply happens later instead of in the triggered turn, intercom({ action: "reply" }) falls back to the single unresolved inbound ask, and intercom({ action: "pending" }) shows who is still waiting.

send vs ask

send is fire-and-forget — the tool returns immediately after delivery. By default, it sends immediately even in interactive sessions. If you want an approval dialog before non-reply sends, set confirmSend: true in config. Replies that include replyTo still skip confirmation so reply-hint flows can continue without an extra approval step.

ask sends the message and blocks until the recipient responds (10-minute timeout). The reply comes back as the tool result, so the agent continues in the same turn with full context. No confirmation dialog — if you're asking and waiting, the intent is clear.

reply is receiver-side sugar for replying to an inbound ask. In the turn triggered by an incoming intercom ask, intercom({ action: "reply", message: "..." }) targets that exact sender and message automatically. If you reply later, it falls back to the single unresolved inbound ask. If multiple asks are pending, use intercom({ action: "pending" }) to inspect them and then call reply with to to disambiguate.

The planner typically uses send. If you prefer manual approval for outgoing non-reply messages, turn on confirmSend: true. The worker uses ask for everything (no confirmation needed, gets answers inline), so it can operate autonomously either way.

Tool Reference

intercom

| Parameter | Type | Description | |-----------|------|-------------| | action | string | "list", "send", "ask", "reply", "pending", or "status" | | to | string | Target session name or ID (for send/ask, or to disambiguate reply) | | message | string | Message text (for send/ask/reply) | | attachments | array | Optional file, snippet, or context attachments | | replyTo | string | Optional message ID for threading or replying to an ask |

Actions

list — Returns all active intercom-connected sessions (excluding self) with name, working directory, model, and status.

send — Sends a message to the specified session. By default it sends immediately, including in interactive sessions. Set confirmSend: true in config if you want a confirmation dialog for non-reply sends. Replies that include replyTo skip confirmation. Returns delivery confirmation.

ask — Sends a message and waits for the recipient to reply (10-minute timeout). The reply is returned as the tool result. No confirmation dialog. Only one pending ask is allowed per session at a time. Use this when the agent needs the answer to continue working.

reply — Replies to the current intercom-triggered message if there is one. Otherwise it falls back to the single unresolved inbound ask. If multiple asks are pending, pass to or inspect them with pending first. Under the hood this is still a normal send with the exact replyTo value.

pending — Lists unresolved inbound asks with sender, message ID, elapsed time, and a short preview. Useful when replying after the original triggered turn.

status — Shows connection status, session ID, and total count of active sessions (including the current session).

Keyboard Shortcuts

| Key | Action | |-----|--------| | Alt+M | Open session list overlay | | ↑/↓ | Navigate session list | | Enter | Select session / Send message | | Escape | Cancel / Close overlay |

Config

Create ~/.pi/agent/intercom/config.json:

{
  "confirmSend": false,
  "enabled": true,
  "replyHint": true,
  "status": "researching"
}

| Setting | Default | Description | |---------|---------|-------------| | confirmSend | false | Show a confirmation dialog before non-reply sends from an interactive session with UI | | enabled | true | Enable/disable intercom entirely | | replyHint | true | Include reply instruction in incoming messages | | status | — | Custom status shown to other sessions |

How It Works

graph TB
    subgraph A["Pi Session A"]
        A1[Intercom Client]
        A2[intercom tool]
        A3[UI overlays]
    end

    subgraph Broker["Intercom Broker"]
        B1[Session Registry]
        B2[Message Router]
    end

    subgraph B["Pi Session B"]
        B3[Intercom Client]
        B4[intercom tool]
        B5[UI overlays]
    end

    A1 <-->|Local Socket/Pipe| B1
    B1 --- B2
    B2 <-->|Local Socket/Pipe| B3

The broker is a standalone TypeScript process that manages session registration and message routing. It auto-spawns when the first intercom-enabled session needs it and exits after 5 seconds when the last connected session disconnects. Clients now reconnect automatically if the broker disappears and later comes back.

Messages use length-prefixed JSON over a local socket/pipe transport (4-byte length + JSON payload) to handle fragmentation properly. The protocol includes request correlation for session listing, explicit delivery failures, and validation for malformed or out-of-order messages.

Runtime files live at ~/.pi/agent/intercom/:

  • broker.sock — Unix domain socket for communication (macOS/Linux only; Windows uses a named pipe instead)
  • broker-launch.vbs — Windows helper script used to launch the broker without a console window
  • broker.pid — Broker process ID
  • config.json — User configuration

Design Decisions

Local IPC instead of TCP. Same-machine only by design. pi-intercom uses Unix sockets on macOS/Linux and a named pipe on Windows, which keeps setup simple and avoids port management.

Auto-spawn with file lock. The broker starts on first connection and exits after 5 seconds idle. There is no daemon to manage. A spawn lock file, keyed by PID and timestamp, prevents duplicate brokers when multiple sessions start at once.

ask stays client-side. The broker still routes plain messages; it does not have a special request/response mode for ask. The client waits for a matching reply before it triggers a new turn, then returns that reply as the tool result. Reply hints make that flow practical by showing the recipient the exact send call to use. Separately, list / sessions now carry a requestId so a delayed session-list reply cannot be mistaken for a newer one.

pi-intercom vs pi-messenger

| Aspect | pi-intercom | pi-messenger | |--------|-------------|--------------| | Model | Direct 1:1 messaging | Shared chat room | | Primary use | User orchestrating sessions | Autonomous agent coordination | | Discovery | Broker-based (real-time) | File-based registry | | Messages | Private, session-to-session | Broadcast to all agents | | Persistence | In Pi session history | Shared coordination files |

Use pi-messenger for multi-agent swarms working on a shared task. Use pi-intercom when you want to manually coordinate your own sessions or have one agent reach out to another specific session.

File Structure

~/.pi/agent/extensions/pi-intercom/
├── package.json
├── index.ts              # Extension entry point
├── types.ts              # SessionInfo, Message, protocol types
├── config.ts             # Config loading
├── broker/
│   ├── broker.ts         # Broker process
│   ├── client.ts         # IntercomClient class
│   ├── framing.ts        # Length-prefixed JSON protocol
│   ├── paths.ts          # Platform-specific socket/pipe paths
│   ├── spawn.ts          # Auto-spawn logic with lock file
│   ├── spawn.test.ts     # Broker spawn tests
│   └── paths.test.ts     # Path resolution tests
├── ui/
│   ├── session-list.ts   # Session selection overlay
│   ├── compose.ts        # Message composition overlay
│   └── inline-message.ts # Received message display
└── skills/
    └── pi-intercom/
        └── SKILL.md      # Bundled skill for common patterns

Limitations

  • Same machine only — Uses local sockets/pipes, no network support
  • No dedicated intercom log — Messages are kept in Pi session history, but there is no separate intercom transcript or inbox
  • No attachments UIfile, snippet, and context attachments are supported in the protocol, but not in the compose overlay
  • Only connected sessions appear — The list shows Pi sessions that have loaded pi-intercom and successfully registered with the broker, not every open Pi process on the machine
  • Broker lifecycle — The broker auto-spawns on first use and exits when idle; sessions reconnect automatically if the broker restarts