Skip to content

[Feature]: Opt-in DISCORD_THREAD_REQUIRE_MENTION for multi-bot threads #25312

@simpolism

Description

@simpolism

Problem or Use Case

By default, once Hermes has participated in a Discord thread (auto-created on @mention or replied in once), it auto-responds to every subsequent message in that thread without needing further @mentions. This is the right default for one-on-one conversations and most channel threads — keeps the conversation flowing without @ clutter.

But it's an active footgun in multi-bot threads. I run a research Discord with multiple AI agents (Hermes, Codex via Codex CLI, Claude via Claude Code, etc.) in shared threads where I address one bot per turn. The current default means: address Codex → Codex fires (good) → Hermes also fires (bad, because the message wasn't for it) → cross-replies, burned credits, and channel spam.

I've hit this personally in active sessions. It's not hypothetical — every multi-bot thread in require_mention=true mode reproduces it.

The current behavior in production code (gateway/platforms/discord.py's _handle_message):

in_bot_thread = is_thread and thread_id in self._threads

if require_mention and not is_free_channel and not in_bot_thread:
    if self._client.user not in message.mentions and not mention_prefix:
        return  # ← thread shortcut bypasses mention check

in_bot_thread = true whenever Hermes has ever participated in the thread, which short-circuits the require_mention gate. There's no way to ask Hermes to stop doing that without disabling require_mention entirely (which would also stop it from responding in shared channels) or never having Hermes participate in shared threads (which defeats the point of using it in a team Discord).

Proposed Solution

Add a discord.thread_require_mention config key (env: DISCORD_THREAD_REQUIRE_MENTION), default false to preserve existing behavior. When true, the in-thread mention shortcut is disabled — threads gate the same way channels do (require explicit @mention).

# config.yaml
discord:
  require_mention: true
  thread_require_mention: true   # multi-bot setup

Explicit @mentions continue to work as expected — this just turns off the implicit "you're in this thread so everything is for you" assumption.

Alternatives Considered

1. Flip the default to thread_require_mention=true. I considered this — Anthropic's Claude Code Discord MCP plugin does require explicit @mention in every channel/thread (no in-thread shortcut at all), which is the more conservative default for shared spaces. But that would change behavior for every existing Hermes Discord deployment, most of which use Hermes 1:1 where the current default is correct and pleasant. The opt-in knob preserves all existing setups.

2. Detect "multi-bot thread" automatically (e.g. if multiple bots have posted recently, require mentions). This adds heuristic complexity for a use case that's well-served by an explicit user choice. Author preference is "expose the knob, don't infer intent" (matching how require_mention, free_response_channels, no_thread_channels already work in this adapter).

3. Disable require_mention entirely and rely on user discipline. Doesn't scale — users will address bots informally ("hey codex") and not always with structured mentions.

Feature Type

Gateway / messaging improvement

Scope

Small (single file, < 50 lines of production code; +30 lines gateway/platforms/discord.py, +1 line hermes_cli/config.py, +2 lines gateway/config.py)

Contribution

  • I'd like to implement this myself and submit a PR

(PR ready: [#XXX])

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existscomp/gatewayGateway runner, session dispatch, deliveryplatform/discordDiscord bot adaptertype/featureNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions