816 B
816 B
ADR 5: @mention Detection via Zulip SDK
Date: 2026-04-28
Decision
Use the Zulip SDK's mentioned_users field in message events for @mention detection, with regex fallback for cleaning @mention artifacts from forwarded message text.
Context
The Zulip event API provides mentioned_users — an array of user IDs that were @mentioned in the message. This is the most reliable detection mechanism (handles all @mention formats) and avoids fragile text parsing. Regex is only needed to strip the @**Display Name** markup from the forwarded message body.
Consequences
- Zero false positives for @mention detection
- Handles @all-bots, @everyone, and individual @mentions uniformly
- Stripped message text is clean for agent consumption
- SDK handles reconnection and backoff for the event stream