Skip to content

feat: add mention-only response mode for Discord #164

@masami-agent

Description

@masami-agent

Problem

Currently, OpenAB responds to every message in allowed_channels, regardless of whether the bot was mentioned. This causes unnecessary agent spawns and API usage when users are talking to each other or mentioning someone else in the same channel.

Expected Behavior

When configured, the bot should only spawn an agent session when:

  • The bot is directly mentioned (@BotName)
  • The message is a DM to the bot
  • The message is a reply to the bot previous message

All other messages in the channel should be silently ignored without spawning an agent.

Proposed Solution

Add a configuration option in config.toml:

[discord]
respond_only_when_mentioned = true  # default: false (current behavior)

When respond_only_when_mentioned = true, the Discord message handler should check for bot mention (<@bot_id>) before calling the agent pool. If the bot is not mentioned, skip the message entirely.

This filtering should happen at the OpenAB Discord gateway layer, before spawning kiro-cli / agent, to avoid unnecessary session and token consumption.

Why This Matters

  • Cost savings — Each agent spawn consumes API tokens. In active channels, most messages are not directed at the bot.
  • Better UX — Users expect bots to respond only when addressed, not jump into every conversation.
  • Alignment with agent design — Agent identity files (AGENTS.md) already define "when to speak" and "when to stay silent" rules, but OpenAB currently bypasses this by sending every message to the agent. Filtering at the gateway level is more efficient than relying on the agent to decide to stay silent after being spawned.
  • Multi-bot channels — When multiple OpenAB bots share a channel, every message triggers all bots. Mention-only mode lets users direct messages to specific bots.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions