[FEATURE] Event Subscriptions for Real-Time Agent Communication

Resolved 💬 5 comments Opened Jan 26, 2026 by tyrauber Closed Feb 28, 2026

Summary

Enable Claude Code to subscribe to external events and respond in real-time.

The Problem

We built Chief Wiggum - a WebSocket relay for inter-agent messaging. It works: agents register, messages route, offline agents get queued messages.

But receiving agents never know a message arrived. They sit idle, waiting for user input, while messages pile up. They have to manually poll.

Why It Can't Be Fixed With a Plugin

  1. Synchronous input loop - Main loop blocks on readline(), nothing else runs
  2. No prompt injection - Hooks can't create user messages, only react to them
  3. MCP is request-response only - No notification/push from server to client
  4. Hooks are reactive - No "external event received" hook type

Proposed Solution

Event subscriptions in hooks.json:

{
  "subscriptions": [
    {
      "source": "mcp:chief-wiggum",
      "event": "message_received",
      "prompt": "Message from {{fromName}}: {{payload.content}}"
    }
  ]
}

When an event fires, inject it as a user message with clear attribution.

What This Enables

  • Real-time multi-agent coordination
  • CI/CD event handling
  • File watchers
  • Webhook processing
  • Background monitoring

Reference Implementation

Working plugin (minus real-time): https://github.com/tyrauber/claude-code/tree/feature/chief-wiggum

Happy to help implement this.

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗