Skip to content

feat(mattermost): configurable mention behavior — respond without @mention#3664

Merged
teknium1 merged 1 commit intomainfrom
hermes/hermes-b351df6b
Mar 29, 2026
Merged

feat(mattermost): configurable mention behavior — respond without @mention#3664
teknium1 merged 1 commit intomainfrom
hermes/hermes-b351df6b

Conversation

@teknium1
Copy link
Copy Markdown
Contributor

Summary

Adds configurable mention gating for Mattermost channels, matching Discord's existing pattern. Requested by community member neeldhara.

New Environment Variables

Variable Default Description
MATTERMOST_REQUIRE_MENTION true Set to false to respond to all channel messages without @mention
MATTERMOST_FREE_RESPONSE_CHANNELS (none) Comma-separated channel IDs where bot responds without @mention

DMs always work regardless of these settings.

Usage

# Respond to all messages in all channels
MATTERMOST_REQUIRE_MENTION=false

# Or: respond without mention only in specific channels
MATTERMOST_FREE_RESPONSE_CHANNELS=channel_id_1,channel_id_2

Also fixes

@mention is now stripped from the message text before the agent sees it (previously the raw @botname was included in the prompt).

Files Changed

File Change
gateway/platforms/mattermost.py Mention gating logic + mention stripping
hermes_cli/config.py Env var metadata for setup/doctor
tests/gateway/test_mattermost.py 7 new tests + 1 updated test
website/docs/user-guide/messaging/mattermost.md Mention Behavior section + env var examples
website/docs/reference/environment-variables.md New vars in reference table

Tests

46 Mattermost tests pass (7 new).

…ntion

Adds MATTERMOST_REQUIRE_MENTION and MATTERMOST_FREE_RESPONSE_CHANNELS
env vars, matching Discord's existing mention gating pattern.

- MATTERMOST_REQUIRE_MENTION=false: respond to all channel messages
- MATTERMOST_FREE_RESPONSE_CHANNELS=id1,id2: specific channels where
  bot responds without @mention even when require_mention is true
- DMs always respond regardless of mention settings
- @mention is now stripped from message text (clean agent input)

7 new tests for mention gating, free-response channels, DM bypass,
and mention stripping. Updated existing test for mention stripping.

Docs: updated mattermost.md with Mention Behavior section,
environment-variables.md with new vars, config.py with metadata.
@teknium1 teknium1 merged commit 91b881f into main Mar 29, 2026
4 of 5 checks passed
@neeldhara
Copy link
Copy Markdown

This is amazing, thank you so much!

I am not sure if this is the right place to suggest this, but a minor enhancement would be the following: to be able to specify a list of channels where an @-mention is required. In my use case, most channels are with one agent and I would prefer no mentions required, 'but a couple of them are agent groups where mentions make sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants