English · 繁體中文
claude-discord-daemon
A 24/7 headless Discord ⇄ Claude Code bridge (Windows). A standalone process owns the Discord gateway around the clock and spawns a fresh headless claude -p for every allowlisted DM, so your bot's presence no longer depends on a live Claude Code terminal being open.
Windows 11 · Bun · discord.js v14 · MIT
Distributed both as an npm package (bunx claude-discord-daemon / cdd) and as a Claude Code plugin (the /claude-discord-daemon:discord command).
What it is / why it exists
The official Discord channel plugin binds the Discord gateway to an MCP stdio pipe that dies the moment the terminal closes, so the bot is only online while you have Claude Code open (security considerations). claude-discord-daemon runs bot.ts as its own long-lived process that holds the gateway connection itself. Each DM from an allowlisted user spawns a headless claude -p loaded with your full global config (MCP servers, plugins, CLAUDE.md), and that process posts the reply back. A Windows logon-task daemon keeps it alive across terminal close, crashes, and reboots.
Features
- Live named-tool status card. While a run is in flight, a single embed status card is edited in place and names the exact tool / skill / MCP / agent / command currently running instead of a vague "thinking":
🔌 MCP matlab·evaluate · 🖥️ Bash · 🔍 Read · 📝 Edit · 🌐 WebFetch · 🤖 agent code-reviewer · 📚 skill xlsx · ⌨️ /commit · 🔧 tool.
- Status card overwritten into the reply. On success the status card is edited in place into the final reply, with a faint Discord
-# stat footer appended (⚙️ elapsed · per-kind ×count). The chat keeps a single message - no duplicate "done" card plus a separate reply. File / long / multi-chunk replies fall back to fresh messages (edits can't attach files), collapsing the status card to just the footer.
- Rich output directives (each on its own line in the reply):
[[embed: {json}]] renders a colored embed card. The JSON may span multiple lines.
[[file: /absolute/path]] attaches a produced file (verified for existence and size before sending).
- a trailing
[[buttons: A | B]] line renders 2-5 real Discord choice buttons; the clicked label is fed back into the same session as the next message.
- 50 MB inbound attachment download. Attachments the user uploads (≤ 50 MB) are downloaded to a shared inbox and their local paths are appended to the prompt for
claude to Read.
- Permission relay. A headless run's permission prompts are routed through
perm-mcp.ts → a loopback endpoint → a Discord Allow / Deny button card; the owner clicks to decide. Users are never told to approve anything in a terminal.
- Idle watchdog (no wall-clock cap). By default there is no total time limit. A run is killed only when its event stream goes silent past
BOT_IDLE_TIMEOUT_MS (a wedged process), never for merely taking a long time, so long jobs are fine.
- Natural-language "new conversation" reset. A message that is one of a small set of reset phrases (whole message, case-insensitive) drops the stored session so the next message starts fresh. See New-conversation reset.
- Per-chat session continuity. Each chat's session UUID is stored in
sessions.json and later messages --resume it, so context carries across DMs.
- 24/7 Windows daemon. An
AtLogOn scheduled task (ClaudeDiscordBridge) plus launch.vbs (detached) + supervise.cmd (restart on crash) + a single-instance loopback lock keeps the bridge running across terminal close, crashes, and reboots.
- Portable - no hardcoded paths. The working directory defaults to the engine directory and every path is overridable via env vars.
Simple test demonstration

Full-quality demo.mp4
Requirements
| Item | Detail |
|---|
| OS | Windows 11 (the scheduled-task / VBS / cmd supervision chain is Windows-specific) |
| Runtime | Bun ≥ 1.1.0, with bun on PATH |
| Claude Code | An installed, logged-in Claude Code CLI (the bridge spawns claude -p) |
| Discord | Your own Discord bot token, with the bot sharing a server with you (Discord requires a shared server before it will let you DM a bot) |
Install
Two paths; pick one.
(a) As an npm package
# no-install, one-shot start
bunx claude-discord-daemon up
# or install globally and use the short alias cdd
npm i -g claude-discord-daemon
cdd up
CLI commands:
cdd up # register the logon task + start detached
cdd status # logon task / processes / log tail
cdd logs # last 40 log lines
cdd down # stop supervisor + engine
Bin names are claude-discord-daemon and cdd (identical).
(b) As a Claude Code plugin