In an OpenClaw group chat, what does `requireMention` change about when the agent answers, and what counts as a mention?
answer
- on by default in groups
- unmentioned messages become context
- native, regex, derived, implicit
- agent-level patterns win
- not an access control
basics
~20 srequireMention, on by default, makes an allowed group message trigger the agent only when it mentions the bot; other messages are kept as context. Native mentions, configured or name-derived mentionPatterns, and channel-specific replies or quotes of the bot count.
solid answer
~40 sGroup messages require a mention by default; `requireMention` is set per group, for example under `channels.whatsapp.groups` with `"*"` for all groups. With it on, an allowed member's unmentioned message does not start a turn but is kept as context. A mention can be a native platform mention, a regex in `mentionPatterns` (agent-level `agents.entries.<id>.groupChat.mentionPatterns` overrides `messages.groupChat.mentionPatterns`), patterns derived from the agent's `identity.name` and `identity.emoji` when none are set, or an implicit fact such as a reply to the bot on Telegram or Slack. On Telegram, WhatsApp and a few others, a command owner can flip a group with `/activation always`. Mention gating runs after the allowlists, so it never admits a stranger.
code
json · 17 lines{
"channels": {
"whatsapp": {
"groups": {
"*": { "requireMention": true },
"[email protected]": { "requireMention": false }
}
}
},
"agents": {
"entries": {
"main": {
"groupChat": { "mentionPatterns": ["@pip", "\\bpip\\b"] }
}
}
}
}go deeper
Remember that groups need a mention by default and that requireMention is the per-group switch.
Explain the mention sources (native, configured regex, identity-derived, implicit replies or quotes) and that unmentioned messages are kept as context.
Diagnose silence and noise: platform delivery settings, the order allowlists then mentions, pattern precedence, and scoping patterns per conversation.
Decide per room whether always-on chatter is worth its token cost and noise, and keep requireMention as the default for rooms you do not fully trust.
## What `requireMention` does In an OpenClaw group chat, admission and activation are two different steps. First the Gateway decides whether the group and the sender are allowed at all (`groupPolicy` and the group allowlists). Only then does **mention gating** decide whether an allowed message should start an agent turn. `requireMention` is that gate. Group messages **require a mention by default**, and the setting is overridden per group. For WhatsApp, Telegram and iMessage it lives under `channels.<channel>.groups`, with `"*"` as the default for every group and a group ID for one room; Discord uses `channels.discord.guilds` and Slack uses `channels.slack.channels`. With `requireMention: true`, an allowed member's message that does not mention the bot: - does **not** start an agent turn; - is **kept as context**, so when someone does mention the bot later, the agent can see what was said in between. With `requireMention: false`, every message from an allowed sender is treated as a request. That suits a small trusted room that wants a conversational bot; it is costly and noisy in a busy one. Two details are easy to miss: 1. Allowlisting a group or a sender does **not** turn mention gating off; only `requireMention: false` does. 2. Setting `groups` with specific IDs also makes it a group allowlist, so use `"*"` when you want defaults for all groups. ## What counts as a mention OpenClaw combines several signals: - **Native mentions** — when the platform can prove the message tagged the bot (Discord, Slack, Telegram, Matrix, Signal and others), it counts, even where regex patterns are switched off for that room. - **Configured `mentionPatterns`** — case-insensitive regex fallbacks for platforms without a native bot mention, or for plain text like `openclaw:`. Invalid or unsafe patterns are ignored with a warning. - **Derived patterns** — when no patterns are configured at any level, OpenClaw derives them from the routed agent's `identity.name` and `identity.emoji`. An explicit empty list `mentionPatterns: []` switches that derivation off. - **Implicit mentions** — channel-specific facts that count as a mention. | Implicit fact | Channels that produce it | | --- | --- | | Reply to the bot | Discord, Microsoft Teams, QQBot, Slack, Telegram | | Quote of the bot | LINE, WhatsApp, Zalo personal | | Bot joined the thread | Mattermost, Slack, Tlon | Some channels (LINE, Mattermost, Slack, Tlon) read an `implicitMentions` flag that can stop a fact from counting; on the others the fact always counts. ## Where patterns are configured, and which wins - `agents.entries.<id>.groupChat.mentionPatterns` — per agent, useful when several agents share a room; - `messages.groupChat.mentionPatterns` — the global list. The agent-level list overrides the global one. Separately, `channels.<channel>.mentionPatterns` does not hold patterns: it scopes **where** regex patterns apply, with `mode: "allow"` plus `denyIn`, or `mode: "deny"` plus `allowIn`, by conversation ID. ## Switching the mode from chat A command owner (a sender in `commands.ownerAllowFrom`) can send `/activation mention` or `/activation always` in a group. The stored mode overrides that group's `requireMention` on channels that consult it — Google Chat, QQBot, Telegram and WhatsApp. ## Choosing a setting per room Mention gating is a per-room decision, and the defaults are tuned for caution: - **Busy or semi-public rooms** — keep `requireMention: true`. The agent stays quiet unless addressed, costs nothing for chatter, and still has the recent conversation as context when someone does ask. - **A small trusted room** that wants a conversational assistant — set that room's `requireMention: false`, or let an owner send `/activation always` where the channel supports it. - **Rooms where the agent should follow along but rarely speak** — turn mention gating off for that room and set `messages.groupChat.unmentionedInbound: "room_event"`, which submits unmentioned chatter as quiet room context instead of user requests (supported today on Discord guild channels, Slack channels and Telegram groups); mentions, commands and DMs stay requests. - **Several agents in one room** — give each its own `agents.entries.<id>.groupChat.mentionPatterns` so a name wakes only the agent it belongs to. Group history kept for context is bounded: `messages.groupChat.historyLimit` sets the default and `channels.<channel>.historyLimit` overrides it, with `0` disabling it. ## What mention gating is not Mention gating is about **when** an allowed sender's message triggers the agent. It is not an access control: a mention from someone the group allowlist rejects never triggers the bot, and a reply to the bot does not bypass `groupAllowFrom`. Some platforms also have to deliver unmentioned messages for any of this to apply — Telegram needs privacy mode off or admin status, and Discord needs the Message Content Intent.
- Your bot never reacts to mentions in a Telegram group even though requireMention is set correctly; what do you check?Whether Telegram delivers the messages at all: a bot in a group needs privacy mode disabled via BotFather or group-admin status to see ordinary messages. Then check the sender passes the group allowlist, because mention gating only runs on admitted messages, and that `groupAllowFrom` uses numeric user IDs.
- How do you stop a broad mention pattern from waking the agent in one noisy Slack channel?Scope it with `channels.slack.mentionPatterns`: keep the default `mode: "allow"` and add that channel's ID to `denyIn`, or use `mode: "deny"` with `allowIn` for the few rooms that should use regex patterns. Native Slack mentions of the bot still trigger regardless.
Mention gating is a receptionist who notes everything said in the waiting room but only calls the doctor when someone asks for her by name; who is allowed into the waiting room is decided at the front door, not by her.
- Adding a group to the allowlist turns mention gating off for it.
- Without mentionPatterns configured, the bot can never be mentioned.
- Unmentioned group messages are discarded and the agent never sees them.
- A mention from anyone in the room triggers the bot, whatever the allowlists say.
- Channel-level mentionPatterns replace the agent's own pattern list.