Home Tutorials Categories Skills About
ZH EN JA KO
Configuration

OpenClaw Group Chat Behavior Rules Configuration

· 20 min read

Introduction

In direct message scenarios, it makes sense for the AI assistant to respond to every message. But in group chats, responding to every message would flood the channel and generate a large number of unnecessary API calls. OpenClaw provides fine-grained group chat behavior rules that let you control under what conditions the AI responds, how it responds, and to whom it responds.

Group Rules Overview

OpenClaw's group chat rules are configured in the groupRules section of openclaw.json:

{
  "groupRules": {
    "triggerMode": "mention",
    "mentionName": ["Assistant", "AI", "bot"],
    "commandPrefix": "/",
    "replyToBot": true,
    "ignoreOtherBots": true,
    "cooldown": 0,
    "maxResponseLength": 500,
    "threadMode": "auto"
  }
}

Trigger Modes Explained

triggerMode is the core configuration for group chat behavior, determining under what conditions the AI processes messages.

mention Mode (Default)

{
  "groupRules": {
    "triggerMode": "mention"
  }
}

Responds only when the bot is @mentioned in a message. This is the most commonly used mode, suitable for most group chat scenarios. The @mention mechanism varies by channel:

Channel Mention Method
Telegram @botusername
Discord @BotName or <@botid>
Slack @BotName
WhatsApp @phonenumber
Matrix @bot:server

keyword Mode

{
  "groupRules": {
    "triggerMode": "keyword",
    "mentionName": ["Assistant", "AI helper", "openclaw"]
  }
}

Triggers a response when the message contains any keyword from the mentionName list. Keyword matching is case-insensitive. This mode is suitable for platforms where @mentioning is inconvenient.

command Mode

{
  "groupRules": {
    "triggerMode": "command",
    "commandPrefix": "/"
  }
}

Only processes messages that start with the specified prefix. For example, when a user sends /ask What's the weather today, OpenClaw extracts the content after the prefix as the question.

always Mode

{
  "groupRules": {
    "triggerMode": "always"
  }
}

Responds to every message in the group chat. Typically only used in small, private groups.

mixed Mode

{
  "groupRules": {
    "triggerMode": "mixed",
    "mentionName": ["Assistant"],
    "commandPrefix": "/"
  }
}

Supports @mentions, keywords, and command prefixes simultaneously — responds when any condition is met.

Command Prefix Configuration

Beyond triggering AI responses, command prefixes can also be used to execute specific commands:

{
  "groupRules": {
    "commandPrefix": "/",
    "commands": {
      "help": "Display help information",
      "model": "Switch the current model",
      "clear": "Clear current session history",
      "status": "Display system status"
    }
  }
}

When a user sends /help in a group chat, OpenClaw returns help information instead of passing it to the AI model. Messages like /ask your question or prefix messages that don't match any known command are passed to the AI for processing.

Response Behavior Configuration

Replying to Quoted Messages

{
  "groupRules": {
    "replyToBot": true,
    "replyChainDepth": 3
  }
}

When replyToBot is true, the AI will respond when a user uses the "reply" feature to reply to one of the AI's previous messages, even without an @mention. replyChainDepth controls the maximum reply chain depth — for example, whether the AI should still trigger when a user replies to another user who replied to the AI.

Ignoring Other Bots

{
  "groupRules": {
    "ignoreOtherBots": true
  }
}

Prevents "conversation loops" with other bots in the group. When enabled, OpenClaw ignores messages from other bot accounts.

Cooldown Period

{
  "groupRules": {
    "cooldown": 5
  }
}

Minimum interval (in seconds) between two responses. In highly active group chats, setting a cooldown prevents the AI from responding too frequently. Set to 0 for no cooldown.

Response Length Limit

{
  "groupRules": {
    "maxResponseLength": 500
  }
}

Maximum character count for AI responses in group chats. Content exceeding this limit will be truncated with a "Send a DM for the full response" notice appended. This limit only applies to group chats; DMs are unaffected.

Thread Mode

On platforms that support topics/threads (such as Slack, Discord, and Telegram supergroups), OpenClaw can use the threading feature to organize conversations:

{
  "groupRules": {
    "threadMode": "auto",
    "autoCreateThread": true,
    "threadTitle": "AI Conversation"
  }
}
threadMode Behavior
"auto" If the user @mentions the AI in a thread, reply within the thread; otherwise reply in the main channel
"always" Always reply in a thread, creating one automatically
"never" Always reply in the main channel, never use threads

The benefit of thread mode is concentrating AI conversations in separate threads, avoiding disruption to the group's normal discussions.

Per-Channel Rule Overrides

Different groups may need different rules. OpenClaw supports overriding global group chat rules by channel type or specific group ID:

{
  "groupRules": {
    "triggerMode": "mention",
    "channelOverrides": {
      "telegram": {
        "triggerMode": "mixed",
        "mentionName": ["Assistant"]
      },
      "discord": {
        "triggerMode": "command",
        "commandPrefix": "!"
      }
    },
    "groupOverrides": {
      "-100123456789": {
        "triggerMode": "always",
        "maxResponseLength": 1000
      }
    }
  }
}

Priority order: groupOverrides (specific group) > channelOverrides (channel type) > global groupRules.

Group Chat Context Handling

Context handling in group chats differs from DMs. OpenClaw supports two group chat context strategies:

{
  "groupRules": {
    "contextMode": "mention-thread",
    "includeOtherUsers": false
  }
}
contextMode Behavior
"full" Include all messages in the group chat (including from other users) in the context
"mention-thread" Only include message chains related to the AI in the context
"isolated" Each @mention is treated as an independent conversation with no history retained

includeOtherUsers controls whether messages from other users (not the person asking) are also included in the context. Enabling this in "team discussion" scenarios allows the AI to understand the full discussion background.

Practical Configuration Examples

Technical Support Group

{
  "groupRules": {
    "triggerMode": "mixed",
    "mentionName": ["Assistant"],
    "commandPrefix": "/ask",
    "replyToBot": true,
    "cooldown": 2,
    "maxResponseLength": 800,
    "threadMode": "always",
    "contextMode": "mention-thread"
  }
}

Casual Friends Group

{
  "groupRules": {
    "triggerMode": "keyword",
    "mentionName": ["Assistant", "AI"],
    "cooldown": 10,
    "maxResponseLength": 300,
    "contextMode": "isolated"
  }
}

Workplace Collaboration Group

{
  "groupRules": {
    "triggerMode": "command",
    "commandPrefix": "/",
    "threadMode": "always",
    "contextMode": "full",
    "includeOtherUsers": true,
    "maxResponseLength": 1500
  }
}

Debugging Group Chat Rules

If the AI is not responding as expected in group chats, enable debug logging:

openclaw gateway --log-level debug

Search for group-rules entries in the logs to see the trigger evaluation process for each message:

[DEBUG] group-rules: Message from telegram group -100123456789
[DEBUG] group-rules: triggerMode=mention, @mention detected=false, reply chain=false
[DEBUG] group-rules: Decision: skip

Summary

Group chat behavior rules are the part of OpenClaw's multi-channel management that requires the most fine-tuning. The key is choosing the right trigger mode — in most scenarios, mention mode is the best starting point. From there, gradually adjust cooldown periods, response lengths, and context strategies based on the actual activity level and purpose of each group. Remember to use channelOverrides and groupOverrides to customize rules for different groups, avoiding one-size-fits-all configurations that could negatively impact user experience.

OpenClaw is a free, open-source personal AI assistant that supports WhatsApp, Telegram, Discord, and many more platforms