Connect Discord
Connect Discord and configure shared threads for governed edit review.
Connect Maia to Discord with a bot application. A working setup requires the correct gateway intents, install permissions, and stable user or role IDs for admission.
Before you start
- You need permission to install a bot in the target Discord server.
- Decide which Discord user ID will be Maia's first administrator.
- Store the bot token only in Maia's secret-aware dashboard field or
<MAIA_HOME>/.env. Never commit it.
Create the Discord bot
- Open the Discord Developer Portal, select New Application, name it, and create it.
- Open Bot, create or reset the bot token, and copy it immediately.
- Enable Message Content Intent. Enable Server Members Intent when Maia must resolve members or use role-based admission. Save the changes.
- Under Installation, configure a Guild Install, or use the OAuth2 URL generator with the
botandapplications.commandsscopes. - Grant at least View Channels, Send Messages, Read Message History, Attach Files, Create Public Threads, and Send Messages in Threads. Add Embed Links and Add Reactions for Maia's full response experience.
- Open the generated install link, choose your server, and authorize the bot.
- In Discord, enable User Settings > Advanced > Developer Mode. Copy your user ID and any role or channel IDs you intend to use.
Configure Discord in the dashboard
- Run
maiaormaia dashboardand open Gateway in the dashboard menu. - Select Discord and enter the bot token in the secret-aware field.
- Add at least one allowed user ID. Add an allowed role only when every intended member of that role will receive Maia governance. Optionally set a home channel.
- Select Save Discord, then use Start or Restart on the Gateway page.
- Send the bot a direct message. In a server channel,
@mentionMaia unless you deliberately configured that channel for free response.
Configure Discord from the CLI
- Run
maia setup gatewayand select Discord. - Enter the bot token and at least one allowed user ID when prompted.
- Start Maia in the foreground for the first test:
maia gateway run
Manual Discord configuration
# <MAIA_HOME>/.env
DISCORD_BOT_TOKEN=...
DISCORD_ALLOWED_USERS=284102345871466496,198765432109876543
DISCORD_ALLOWED_ROLES=123456789012345678
DISCORD_HOME_CHANNEL=234567890123456789
# Optional behavior controls
DISCORD_REQUIRE_MENTION=true
DISCORD_FREE_RESPONSE_CHANNELS=234567890123456789
DISCORD_IGNORED_CHANNELS=345678901234567890
DISCORD_AUTO_THREAD=true
DISCORD_ALLOWED_USERS and DISCORD_ALLOWED_ROLES let identities reach the gateway. Except for the first bootstrap administrator, each identity remains Pending Governance until an administrator assigns at least one role in Governance → People.
Use Discord for governed edit review
A Discord edit review works when gateway admission, Governance permissions, and conversation scope all match:
- Admit both the employee and the reviewer through
DISCORD_ALLOWED_USERSor an intentionally allowed role, then register their stable Discord user IDs in Governance → People. Role admission alone does not grant file access. - Give the employee Write after approval on the target file or folder and select at least one named governed manager or administrator. The selected manager receives the path access needed to inspect and execute the reviewed edit; administrators already have global file access.
- In a server channel Maia can access, have the employee
@mentionMaia with the edit request. Maia's review response uses the selected Discord user's native<@USER_ID>markup, and the employee may also tag that reviewer. WithDISCORD_AUTO_THREAD=true(the default), Maia creates a thread for the response. Keep the employee, reviewer, and Maia in that same thread. - Replies in a thread created by Maia do not require another mention. Maia receives each reply as a new turn owned by the authenticated Discord user ID that sent it.
- Let the reviewer answer naturally. No word such as “approve” or “OK” has special authority: the reviewer may accept, reject, ask a question, or request a different edit. Every file-tool call is authorized again for the person who sent the current message.
Keep automatic Discord threads and shared thread sessions enabled:
# <MAIA_HOME>/.env
DISCORD_AUTO_THREAD=true
# <MAIA_HOME>/config.yaml
gateway:
thread_sessions_per_user: false
An employee's DM and a reviewer's DM are isolated sessions. Use one shared server thread for the request and review. If automatic threads are disabled, create and use a Discord thread manually; do not set thread_sessions_per_user: true for this workflow.
For the matching file policy and the full authorization behavior, see Handle write confirmation.
The bot appears online after the gateway starts, replies to the allowed administrator in a direct message, and answers an @mention in a server channel it can view. If it is online but silent, verify Message Content Intent first.