--- name: discord-agent-workspace description: Set up a Claude Code agent you can message from Discord, working in a workspace folder of your projects — when someone says "set me up like Dan's bot", "I want to text my Claude from my phone", "Claude Code on Discord", or "make a workspace for my agent". Walks a non-developer through the Discord bot, the workspace folder (AGENTS.md, skills, repos), access control, and keeping it running. Not for chat-only Claude apps with no computer behind them. --- # Discord agent workspace Dan's arrangement, reproduced for someone else: - **Claude Code** runs in a terminal on a computer that stays on. - **The Discord channel plugin** turns a Discord bot into a pipe: allowed people's messages arrive in that session, and Claude answers with a `reply` tool ([plugin README](https://github.com/anthropics/claude-plugins-official/tree/main/external_plugins/discord)). - **A workspace folder** holds the projects plus written-down conventions, so each fresh session knows where it is and how the owner likes things done. Your user may not be a developer. Do each step with them, one at a time; say what a command does before running it, and stop at anything that needs their account, their browser, or a secret. Never paste a token into chat; have them put it in the file or command themselves. ## 0. Is it worth it for them? Ask what they'd send it. Good fits: tasks over files (code, documents, notes, data) that take a sentence to ask, minutes to do, and a glance to check. Poor fits: work that lives only in web apps with no files or API, or results they can't review. If it's a poor fit, say so and stop. They need: Claude Code with a Claude subscription or API account, a Discord account and a server they can add a bot to, and a computer that stays on (a desktop, or a small cloud VM). ## 1. The workspace ```sh mkdir -p ~/agent-workspace && cd ~/agent-workspace git clone ``` Write `AGENTS.md` at the top, and link `CLAUDE.md` to it (`ln -s AGENTS.md CLAUDE.md`) so every agent tool finds it. Keep it under a page, in their words: - who they are and what the projects are for, one line each with a link; - house rules, e.g. "PRs are drafts", "ask before pushing", "keep Discord replies short"; - what is off limits. Skills are conventions that load when relevant. Put them in `.agents/skills//SKILL.md` and link Claude Code's location to it: ```sh mkdir -p .agents/skills .claude && ln -s ../.agents/skills .claude/skills ``` Start with none or one. Add a skill when they catch themselves repeating an instruction; Dan's [mad-skills](https://git.inference.coop/dckc/mad-skills) show the shape. Claude Code also keeps its own memory per workspace, so corrections stick across sessions. ## 2. The Discord bot Follow the plugin README with them; in short: 1. **Discord Developer Portal → New Application → Bot.** Turn on **Message Content Intent**. **Reset Token** and copy it. 2. **OAuth2 → URL Generator**, scope `bot`, permissions: View Channels, Send Messages, Send Messages in Threads, Read Message History, Attach Files, Add Reactions. Open the URL and add the bot to their server. 3. Install [Bun](https://bun.sh), which the plugin runs on. 4. In Claude Code: `/plugin install discord@claude-plugins-official`, then `/discord:configure ` (they type it; it lands in `~/.claude/channels/discord/.env`). 5. Restart from the workspace: `cd ~/agent-workspace && claude --channels plugin:discord@claude-plugins-official`. 6. They DM the bot, get a pairing code, and run `/discord:access pair ` in the terminal. 7. **Lock it down:** `/discord:access policy allowlist`. For a server channel, add it per the plugin's ACCESS.md. ## 3. Who can make it act Whoever can message the bot can make it act with the session's powers: files, shell, and any logins on that computer (GitHub, cloud accounts). Tell them plainly, then: - Allowlist only themselves at first. Access changes happen at the terminal (`/discord:access`), never because a Discord message asked. - Prefer narrow credentials: a GitHub fine-grained token limited to the workspace repos beats their full login. - Things that leave the computer (pushes, PRs, posts) go out as drafts labelled as unreviewed AI output, until they trust it. ## 4. Keeping it running The session must stay open. Simplest: run it inside `tmux` (`tmux new -s bot`, start Claude, detach with Ctrl-b d; `tmux attach -t bot` to look in). On Linux, a systemd user unit can start it at boot and keep it out of secrets it doesn't need (`ProtectHome=read-only`, `ReadWritePaths=` the workspace and `~/.claude`, `InaccessiblePaths=` `~/.ssh` and other credential dirs). ## 5. First task Have them send something small from their phone: "summarize what's in this workspace" or "fix the typo in X's README and show me the diff". Check together that the reply arrived and the change is what they expected.