Bot loop protection
Bot loop protection
Section titled “Bot loop protection”OpenClaw can accept messages written by other bots on channels that support allowBots.
When that path is enabled, pair loop protection prevents two bot identities from
replying to each other indefinitely.
The guard is enforced by the core 渠道-turn kernel. Each supporting 渠道 maps its own inbound event into generic facts: account or scope, conversation id, sender bot id, and receiver bot id. Core then tracks the participant pair in both directions, applies a sliding-window budget, and suppresses the pair during a cooldown after the budget is exceeded.
Defaults
Section titled “Defaults”Pair loop protection is active when a 渠道 lets bot-authored messages reach dispatch. Built-in defaults are:
maxEventsPerWindow: 20- a bot pair can exchange 20 events within the windowwindowSeconds: 60- sliding window lengthcooldownSeconds: 60- suppression time after the pair exceeds the budget
The guard does not affect normal human-authored messages, single-bot deployments, self-message filtering, or one-shot bot replies that stay under the budget.
Configure shared defaults
Section titled “Configure shared defaults”Set channels.defaults.botLoopProtection once to give every supporting 渠道
the same baseline. Channel and account overrides can still tune individual
surfaces.
{ channels: { defaults: { botLoopProtection: { maxEventsPerWindow: 20, windowSeconds: 60, cooldownSeconds: 60, }, }, },}Set enabled: false only when your 渠道 policy intentionally allows
bot-to-bot conversations without automatic suppression.
Override per 渠道 or account
Section titled “Override per 渠道 or account”Supporting channels layer their own config over the shared default. Precedence is:
channels.<channel>.<room-or-space>.botLoopProtection, when the 渠道 supports per-conversation overrideschannels.<channel>.accounts.<account>.botLoopProtection, when the 渠道 supports accountschannels.<channel>.botLoopProtection, when the 渠道 supports top-level defaultschannels.defaults.botLoopProtection- built-in defaults
{ channels: { defaults: { botLoopProtection: { maxEventsPerWindow: 20, }, }, discord: { botLoopProtection: { maxEventsPerWindow: 8, }, accounts: { molty: { allowBots: "mentions", botLoopProtection: { maxEventsPerWindow: 5, cooldownSeconds: 90, }, }, }, }, slack: { allowBots: "mentions", botLoopProtection: { maxEventsPerWindow: 8, }, }, matrix: { allowBots: "mentions", groups: { "!roomid:example.org": { botLoopProtection: { maxEventsPerWindow: 5, }, }, }, }, googlechat: { allowBots: true, groups: { "spaces/AAAA": { botLoopProtection: { maxEventsPerWindow: 5, }, }, }, }, },}Channel support
Section titled “Channel support”- Discord:原生 Discord
author.botDiscord 事实,按 Discord 账户、渠道和机器人对进行键控。 - Slack:针对已接受的机器人编写消息的原生 Slack
bot_idSlack 事实,按 Slack 账户、渠道和机器人对进行键控。 - Matrix:已配置的 Matrix 机器人账户,按 Matrix 账户、房间和已配置的机器人对进行键控。
- Google Chat:针对已接受的机器人编写消息的原生 Google Chat
sender.type=BOT事实,按账户、空间和机器人对进行键控。
那些无法提供可靠入站机器人身份的渠道将继续使用其正常的自消息和访问策略过滤器。在它们能够识别机器人对中的两个参与者之前,不应选择启用此防护。
有关插件实现的详细信息,请参阅 SDK 运行时。