Discord
autorag tui --discord lets you ask the librarian questions from a Discord channel while a TUI session is running on your machine. It loads pi-discord-remote (pinned 0.2.4, MIT).
On launch it creates one text channel for the session. A message you send there runs through the same Jev routing and two-phase search as the same text typed in the terminal. When the TUI exits, the channel is deleted.
Requirements
- A running
autorag tui --discordsession. The bridge is an extension of that process: if the TUI exits, the bot stops answering. Discord cannot start a session. - A Discord bot token and a server where the bot may manage channels.
- Outbound HTTPS and WebSocket only. No inbound port is opened.
Setup
Create an application at the Discord developer portal, open Bot, and copy the token.
Under Bot, enable Message Content Intent. Without it, login fails with
disallowed intents.Invite the bot to your server (OAuth2 → URL Generator, scope
bot) with these permissions: View Channels, Send Messages, Add Reactions, and Manage Channels.Turn on Developer Mode (Discord settings → Advanced), then copy your server ID and your user ID from the right-click menu.
Write
~/.pi/agent/pi-discord-remote/config.jsonand restrict it:json{ "token": "<bot token>", "guildId": "<server id>", "allowedUserIds": ["<your user id>"] }bashchmod 600 ~/.pi/agent/pi-discord-remote/config.jsonOr run
/pi-discord-remote setupinside the TUI.DISCORD_TOKENandDISCORD_GUILD_IDcan stand in for the token and server ID;DISCORD_CATEGORY_IDoptionally places the channel in a category.Start the TUI:
bashautorag tui --discord
The channel appears in your server.
Set allowedUserIds. The session has shell access. An empty list lets every member
of the server drive it.
Using it
- Send a question in the session channel. The bot reacts with ⏳ while it works.
- If the search has two phases, the fast answer is posted as soon as verification starts. Each correction verification makes to it is posted as its own message (
✎ Corrected c1 — reason, the original struck out, the replacement in bold). The closing reply follows with a mention of the asker; it is a short note on what changed, not a second answer. A one-phase search posts one reply. - Tool calls are posted as short labels while the search runs.
- When the model needs to ask you something, it asks in the channel and reads your next message as the answer (via
discord_ask_user_question). - A message sent while a search is running gets
Still processing. Steering a running search from Discord is not supported yet. /pi-discord-remote status | stop | startwork in the TUI;open-configedits the config JSON.
The extension also registers discord_send_image, which uploads a local file, URL, or base64 image the model chooses.
Troubleshooting
| Symptom | Cause |
|---|---|
Discord remote: no config | Missing config file, or invalid JSON |
disallowed intents | Message Content Intent is off |
Could not create channel | The bot lacks Manage Channels |
| Channel appears but nothing answers | The bot cannot read the channel, or your user ID is not in allowedUserIds |
Could not post the fast answer | TUI warning only; the final answer still posts |
