---
name: Live Pipeline Updates in Matrix
---

# Live Pipeline Updates in Matrix

## User Story

As a developer in a Matrix room, I want to see live pipeline activity — agents starting, stories moving stages, failures — posted automatically so that I can monitor progress without asking.

## Background

Story Kit already broadcasts pipeline events internally via `watcher_tx` (work item changes) and `reconciliation_tx` (reconciliation progress). The web UI subscribes to these via WebSocket. This story subscribes the Matrix bot to the same channels and posts formatted updates to the room.

This is the "social coding" feed — you're in a group chat and see things like:
- "coder-opus started on 42_story_dark_mode"
- "42 moved to QA"
- "QA passed on 42, moved to merge"
- "mergemaster merged 42 to master"
- "coder-1 failed on 38 — test suite errors"

## Acceptance Criteria

- [ ] Bot subscribes to `watcher_tx` broadcast channel for pipeline work item events
- [ ] Bot subscribes to agent state change events
- [ ] Story stage transitions (e.g., current → QA → merge → done) are posted to the room
- [ ] Agent assignments (started, completed, failed) are posted to the room
- [ ] Messages are concise and human-readable (not raw JSON dumps)
- [ ] Notification rate is reasonable — batch or debounce rapid successive events to avoid flooding the room
- [ ] Bot only posts updates when Matrix is configured and connected

## Out of Scope
- Filtering which events to post (all events go to the room for now)
- Per-room event subscriptions
- Configurable verbosity levels
- Reconciliation progress events (keep it to pipeline + agent events)

## Technical Notes
- Subscribe to `watcher_tx.subscribe()` in the matrix module's tokio task
- Format `WatcherEvent::WorkItem` and `WatcherEvent::AgentStateChanged` into human-readable strings
- Consider a short debounce (e.g., 2 seconds) to batch rapid events into a single message
- Depends on the Matrix bot story (currently 174, will be renumbered after merge)
