hub-and-spoke architecture — 10+ bots, 1 coordinator, @mention protocol
graph TD
CEO["CEO Bot"]:::ceo
MGR["Manager Bot"]:::bot
MON["Monitor Bot"]:::bot
DEP["Deploy Bot"]:::bot
SEC["Security Bot"]:::bot
LOG["Logger Bot"]:::bot
DB["Database Bot"]:::bot
API["API Bot"]:::bot
ALERT["Alert Bot"]:::bot
SCHED["Scheduler Bot"]:::bot
REPORT["Report Bot"]:::bot
CEO <-->|"@mention"| MGR
CEO <-->|"@mention"| MON
CEO <-->|"@mention"| DEP
CEO <-->|"@mention"| SEC
CEO <-->|"@mention"| LOG
CEO <-->|"@mention"| DB
CEO <-->|"@mention"| API
CEO <-->|"@mention"| ALERT
CEO <-->|"@mention"| SCHED
CEO <-->|"@mention"| REPORT
HUMAN["Human Owner"]:::human
HUMAN <-->|"direct message"| CEO
classDef ceo fill:#1e1b4b,stroke:#5865F2,color:#c4b5fd,stroke-width:3px
classDef bot fill:#1b2e2e,stroke:#00d4aa,color:#a0f0dd
classDef human fill:#1b2e1e,stroke:#43b581,color:#a3d9b1,stroke-width:2px
graph LR
A["Any Bot sends message"]:::bot --> B{"msg.author.bot?"}:::decision
B -->|"true"| C["DROPPED"]:::dropped
H["Human sends message"]:::human --> B
B -->|"false"| D["handleInbound()"]:::processed
classDef bot fill:#1b2e2e,stroke:#00d4aa,color:#a0f0dd
classDef human fill:#1b2e1e,stroke:#43b581,color:#a3d9b1
classDef decision fill:#2e2618,stroke:#faa61a,color:#fdd87a
classDef dropped fill:#2e1818,stroke:#f04747,color:#f8a0a0
classDef processed fill:#1e1b4b,stroke:#5865F2,color:#c4b5fd
Never process your own messages. Prevents self-loops.
Bot messages only processed if they explicitly @mention this bot.
CEO @mentions only one bot at a time. Sequential, not parallel.
Reply without @mention to close the conversation. Natural termination.
Bots don't talk to each other directly. Everything routes through CEO.
graph TD
A["Bot X sends message"]:::bot --> B{"From self?"}:::decision
B -->|"Yes"| C["IGNORED"]:::dropped
B -->|"No"| D{"Author is bot?"}:::decision
D -->|"No — human"| E["handleInbound()"]:::processed
D -->|"Yes"| F{"@mentions me?"}:::decision
F -->|"No"| G["IGNORED — not my concern"]:::ignored
F -->|"Yes"| E
E --> H["Process + Reply"]:::ceo
H --> I{"Need follow-up?"}:::decision
I -->|"Yes — @mention them"| J["Conversation continues"]:::bot
I -->|"No — plain reply"| K["Conversation ends"]:::success
classDef bot fill:#1b2e2e,stroke:#00d4aa,color:#a0f0dd
classDef ceo fill:#1e1b4b,stroke:#5865F2,color:#c4b5fd
classDef decision fill:#2e2618,stroke:#faa61a,color:#fdd87a
classDef dropped fill:#2e1818,stroke:#f04747,color:#f8a0a0
classDef ignored fill:#1e1e2e,stroke:#555570,color:#8888a8
classDef processed fill:#1e1b4b,stroke:#5865F2,color:#c4b5fd
classDef success fill:#1b2e1e,stroke:#43b581,color:#a3d9b1
Replace if (msg.author.bot) return with the 2-line @mention gate. One file change covers all bots.
systemctl restart claude-discord.service and any other bot services to pick up the change.
Have CEO @mention Manager. Manager should see it and @mention CEO back. CEO processes, replies without @mention. Verify conversation ends.
Each new bot just needs a Claude Code instance with the Discord plugin. The @mention protocol works the same regardless of how many bots are in the server.