ADR-0236accepted

Realtime Channel Message Indexing

Context

The channel-message-ingest Inngest function exists and indexes messages to Typesense’s channel_messages collection. The channel-message-classify function follows up with topic/urgency classification. But nobody emits channel/message.received events, so the pipeline never fires.

  • Slack messages enter via the gateway daemon’s bot connection → processed as gateway prompts, never indexed
  • Front emails enter via webhook → front/message.receivedfront-notify.ts → gateway notification, never indexed
  • The slack_messages Typesense collection has 265 docs from a one-time backfill; channel_messages collection doesn’t exist yet
  • The gateway context gathering (ADR-0235) queries these collections but they’re stale/empty

Decision

Wire both realtime feeds to emit channel/message.received Inngest events so messages are indexed as they flow in.

Slack Path

In packages/gateway/src/channels/slack.ts, after processing each message, fire channel/message.received via HTTP POST to the Inngest event API. Includes: channelType=slack, channelId, channelName, userId, userName, text, timestamp.

Front Path

Add a new Inngest function front-message-index that triggers on front/message.received and emits channel/message.received with channelType=email, mapping Front conversation fields to the channel message schema.

What happens downstream

  1. channel-message-ingest creates/ensures the channel_messages collection, upserts the document
  2. channel-message-classify (triggered by channel/message.classify.requested) runs LLM classification for topics/urgency
  3. Gateway context gathering (ADR-0235) queries channel_messages for recent activity

Consequences

  • All Slack messages and Front emails indexed in realtime to Typesense
  • Gateway can answer “what’s important” with actual conversation content
  • Classification pipeline provides topic extraction and urgency tagging
  • Existing slack_messages collection (backfill) continues as-is; channel_messages is the live feed