/discord/.
For token setup, see Discord Setup.
Config
Filesystem Layout
/ is replaced with ∕
(U+2215) so it cannot collide with a directory boundary. The Discord
snowflake ID is appended after __ (double underscore) on guild,
channel, member, and attachment names so resource specific commands can
extract it without an extra lookup, and so two same named entities never
collide. Quote names containing spaces in shell commands. stat also
exposes the ID in the extra dict (see Finding IDs).
Guilds
The root lists one directory per guild the bot has access to.Channels
/discord/<guild>/channels/ lists text channels (types 0, 5, 15).
Each channel directory contains day-partitioned directories for the
30 days leading up to the channel’s last message. Each day directory
holds:
chat.jsonl, the day’s messages (one JSON object per line).files/, attachments posted on that day. Each blob is named<stem>__<attachment-id>.<ext>, where the stem keeps the original filename’s spelling (only/is replaced). The ID suffix keeps the filename collision-free.cat’ing a blob downloads it from the Discord CDN.
last_message_id on the channel object,
so inactive channels show dates around their last activity, not today.
Soft errors (403 missing permissions, 404 unknown channel, 429 rate
limit) on a single day are swallowed so listings, find, and grep
keep working across the rest of the tree.
Members
/discord/<guild>/members/ lists one .json file per member.
Reading a member file returns the full member payload from the
Discord API.
Smart Commands
grep / rg at different scopes
Whengrep or rg target a channel or guild directory (not a specific file),
they use the Discord search API instead of downloading every .jsonl file:
mirage/core/discord/scope.py.
head / tail
head and tail on file-level paths use the Discord messages API directly
(GET /channels/{id}/messages) instead of downloading the full day’s history.
Cache
The Discord resource usesIndexCacheStore (same as RAM/S3/disk/GitHub).
Index entries store guild IDs, channel IDs, and last_message_id for
date range computation. There is no separate content cache - file content
caching is handled by the workspace IOResult mechanism.
Example
examples/python/discord/discord.py for the full working example.
Finding IDs
Resource-specific commands require Discord snowflake IDs (channel_id, guild_id, message_id). These can be extracted
from the filesystem:
Working with Large Channels
Tips for efficient access on busy channels:grep/rg at channel or guild level uses the Discord search
API instead of downloading every .jsonl file, making it efficient
even for large channels.
Shell Commands
Standard commands available on the mounted Discord tree:| Command | Notes |
|---|---|
ls | List guilds, channels, members, dates, attachments |
cat | Read chat.jsonl, member .json, or download an attachment |
head / tail | Smart: uses messages API for file scope |
grep / rg | Smart: uses search API for channel/guild scope (with fallback) |
jq | Query JSON; use .[] prefix for JSONL files |
wc | Line/word/byte counts |
stat | File metadata (name, size, type, ID via extra) |
find | Recursive search with -name, -maxdepth |
tree | Directory tree view |
discord-send-message
Post a message to a channel, optionally as a reply.
| Option | Required | Description |
|---|---|---|
--channel_id | yes | Discord channel snowflake ID |
--text | yes | Message text to send |
--message_id | no | Message ID to reply to |
/discord/<guild>/channels/ or via stat. Returns the
posted message JSON.
discord-add-reaction
Add an emoji reaction to a message.
| Option | Required | Description |
|---|---|---|
--channel_id | yes | Discord channel snowflake ID |
--message_id | yes | Message snowflake ID |
--reaction | yes | Emoji (unicode or name) |
discord-list-members
Search guild members by name.
| Option | Required | Description |
|---|---|---|
--guild_id | yes | Discord guild snowflake |
--query | yes | Username search query |
discord-get-server-info
Get full guild metadata from the Discord API.
| Option | Required | Description |
|---|---|---|
--guild_id | yes | Discord guild snowflake |