From 43ac78289267c3eb2ed37df80e1d6c5258a25757 Mon Sep 17 00:00:00 2001 From: Till-JS <101404291+Till-JS@users.noreply.github.com> Date: Sat, 14 Feb 2026 14:05:34 +0100 Subject: [PATCH] docs(matrix-bot-common): document bot-to-bot loop prevention Added documentation for the isBot() method and automatic bot message filtering that prevents infinite loops when multiple bots share a room. Co-Authored-By: Claude Opus 4.5 --- packages/matrix-bot-common/CLAUDE.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/matrix-bot-common/CLAUDE.md b/packages/matrix-bot-common/CLAUDE.md index 47d38cbd2..0a74c7b45 100644 --- a/packages/matrix-bot-common/CLAUDE.md +++ b/packages/matrix-bot-common/CLAUDE.md @@ -67,6 +67,11 @@ export class MyBotService extends BaseMatrixService { - `sendNotice(roomId, message)` - Non-highlighted message - `downloadMedia(mxcUrl)` - Download from Matrix - `uploadMedia(buffer, contentType, filename)` - Upload to Matrix +- `isBot(sender)` - Check if sender is a bot (prevents bot-to-bot loops) + +**Bot-to-Bot Loop Prevention:** + +The base class automatically ignores messages from other bots to prevent infinite message loops when multiple bots are in the same room. A sender is considered a bot if their Matrix ID localpart contains `-bot` or ends with `bot` (e.g., `@mana-bot:server`, `@todobot:server`). ### HealthController