

















@@ -2,6 +2,7 @@
22summary: "Group chat behavior across surfaces (Discord/iMessage/Matrix/Microsoft Teams/Signal/Slack/Telegram/WhatsApp/Zalo)"
33read_when:
44 - Changing group chat behavior or mention gating
5+ - Scoping mentionPatterns to specific group conversations
56title: "Groups"
67sidebarTitle: "Groups"
78---
@@ -360,10 +361,89 @@ Replying to a bot message counts as an implicit mention when the channel support
360361}
361362```
362363364+## Scope configured mention patterns
365+366+Configured `mentionPatterns` are regex fallback triggers. Use them when the
367+platform does not expose a native bot mention, or when you want plain text such
368+as `openclaw:` to count as a mention. Native platform mentions are separate:
369+when Discord, Slack, Telegram, Matrix, or another channel can prove the message
370+explicitly mentioned the bot, that native mention still triggers even if
371+configured regex patterns are denied.
372+373+By default, configured mention patterns apply everywhere that channel passes
374+provider and conversation facts into mention detection. To keep broad patterns
375+from waking the agent in every group, scope them per channel with
376+`channels.<channel>.mentionPatterns`.
377+378+Use `mode: "deny"` when regex mention patterns should be off by default for a
379+channel, then opt in specific rooms with `allowIn`:
380+381+```json5
382+{
383+ messages: {
384+ groupChat: {
385+ mentionPatterns: ["\\bopenclaw\\b", "\\bops bot\\b"],
386+ },
387+ },
388+ channels: {
389+ slack: {
390+ mentionPatterns: {
391+ mode: "deny",
392+ allowIn: ["C0123OPS"],
393+ },
394+ },
395+ },
396+}
397+```
398+399+Use the default `mode: "allow"` (or omit `mode`) when regex mention patterns
400+should apply broadly, then turn them off in noisy rooms with `denyIn`:
401+402+```json5
403+{
404+ messages: {
405+ groupChat: {
406+ mentionPatterns: ["\\bopenclaw\\b"],
407+ },
408+ },
409+ channels: {
410+ telegram: {
411+ mentionPatterns: {
412+ denyIn: ["-1001234567890", "-1001234567890:topic:42"],
413+ },
414+ },
415+ },
416+}
417+```
418+419+Policy resolution:
420+421+| Field | Effect |
422+| --------------- | --------------------------------------------------------------------------------------------------------------------- |
423+| `mode: "allow"` | Regex mention patterns are enabled unless the conversation ID is in `denyIn`. This is the default. |
424+| `mode: "deny"` | Regex mention patterns are disabled unless the conversation ID is in `allowIn`. |
425+| `allowIn` | Conversation IDs where regex mention patterns are enabled in deny mode. |
426+| `denyIn` | Conversation IDs where regex mention patterns are disabled. `denyIn` wins over `allowIn` if both include the same ID. |
427+428+Supported scoped regex policy today:
429+430+| Channel | IDs used in `allowIn` / `denyIn` |
431+| -------- | ------------------------------------------------------------ |
432+| Discord | Discord channel IDs. |
433+| Matrix | Matrix room IDs. |
434+| Slack | Slack channel IDs. |
435+| Telegram | Group chat IDs, or `chatId:topic:threadId` for forum topics. |
436+| WhatsApp | WhatsApp conversation IDs such as `123@g.us`. |
437+438+Account-level channel configs can set the same policy under
439+`channels.<channel>.accounts.<accountId>.mentionPatterns` when that channel
440+supports multiple accounts. Account policy takes precedence over the top-level
441+channel policy for that account.
442+363443<AccordionGroup>
364444 <Accordion title="Mention gating notes">
365445- `mentionPatterns` are case-insensitive safe regex patterns; invalid patterns and unsafe nested-repetition forms are ignored.
366-- Surfaces that provide explicit mentions still pass; patterns are a fallback.
446+- Surfaces that provide explicit mentions still pass; configured regex patterns are a fallback.
367447- `channels.<channel>.mentionPatterns.mode: "deny"` disables configured mention patterns by default for that channel; opt selected conversations back in with `allowIn`.
368448- `channels.<channel>.mentionPatterns.denyIn` disables configured mention patterns for specific conversation IDs while native platform @mentions still pass.
369449- Per-agent override: `agents.list[].groupChat.mentionPatterns` (useful when multiple agents share a group).
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。