Hermes Discord Integration and Bot-to-Bot Communication
Summary
This process details the configuration and deployment steps required to enable the Hermes agent to interact with other Discord bots, specifically the “found-family” bot. The integration involves updating the NixOS hermes.nix module, managing environment secrets for user allowlists, and establishing a live feedback loop for automated system diagnostics.
Details
The integration of Hermes with Discord for bot-to-bot communication is a multi-step process involving NixOS configuration, secret management on the physical appliance, and the use of the Claude CLI’s channel plugins. This setup allows the Sokrates environment to be managed and verified through a Discord-based feedback loop where one bot (found-family) can issue commands or queries and the Hermes agent can respond and act upon them.
Configuration Updates
To enable Discord functionality, the hermes.nix module must be configured with specific channel settings. Key parameters include:
- free_response_channels: A list of Discord channel IDs where Hermes will respond to all messages without requiring a direct @mention. This is essential for fluid bot-to-bot interaction.
- require_mention: Set to
truefor general channels to prevent the bot from responding to every message in the guild. - auto_thread: Enabled to ensure that conversations stay organized within Discord threads.
Secret Management and Allowlists
Hermes enforces security by checking inbound messages against an allowlist defined in its environment variables. To allow another bot to interact with Hermes, its Discord Snowflake ID must be added to the DISCORD_ALLOWED_USERS variable within the secrets directory on the NixOS box.
The secrets are typically located at /var/lib/sokrates/secrets/hermes/hermes.env. The following IDs were identified during the integration:
- User ID:
384998015615631361 - Found-Family Bot ID:
1464200053492154546 - Sokrates Bot ID:
1487444794400571392
To update the allowlist, an administrator must SSH into the appliance (e.g., sokrates-dev at 192.168.1.238) and modify the environment file. This can be done idempotently using sed:
sudo sed -i 's/^DISCORD_ALLOWED_USERS=.*/&,1464200053492154546/' /var/lib/sokrates/secrets/hermes/hermes.envIf the variable does not exist, it is appended to the file. After modifying the secrets, the system must be rebuilt and the service restarted:
sudo nixos-rebuild switch --flake /home/hakon/sokrates#sokrates-dev
sudo systemctl restart hermes-agentLive Feedback Loop
The integration utilizes the claude-plugins-official Discord plugin. To establish a live connection where the “found-family” bot can receive inbound messages and respond to Sokrates, the Claude session must be launched with the --channels flag:
claude --channels plugin:discord@claude-plugins-officialWithout this flag, the bot can send messages via tools but cannot “hear” inbound pings from Hermes. Once active, the bots can communicate in designated channels (e.g., channel ID 1466052292967923766), allowing for a scenario where one bot verifies NixOS configuration changes made by the other in real-time.