@mention the bot in Discord or send a DM — the agent edits files, runs tests, commits, and streams progress live. Push always requires your approval.
A conversational coding agent that lives in your Discord — just chat with it. Security, streaming, and collaboration built in.
Edits files, runs tests, and creates commits — no hand-holding required. Powered by GitHub Copilot SDK.
Output streams in real-time into per-task Discord threads. Throttled and chunked for smooth updates.
git push and PR actions always require human approval via Discord buttons. 10 min timeout.
@mention the bot in a channel or DM it directly. Reply in threads for follow-ups. 12 admin slash commands for control.
Each channel or DM gets its own isolated workspace and session. Configure access with ALLOWED_DM_USERS.
Agent can ask clarifying questions via Discord and wait for your answer. 5 minute timeout.
Outside-workspace access is automatically blocked. The user gets a notification with the denied path and uses /grant to allow access temporarily.
Auto-redacts 11 token patterns (GitHub PAT, AWS, Slack, OpenAI, …) before posting to Discord.
Sessions, grants, and task history survive bot restarts. Backed by SQLite in WAL mode.
Each user / channel gets its own git worktree. Complete isolation between sessions.
The bot knows its own capabilities and can explain them when asked. Ask "what can you do?" and it answers.
Checks for new releases on GitHub, downloads the update, waits for idle, and restarts automatically.
Switch repos per channel with /repo. Clones on demand, each channel can work on a different project.
Set a custom base branch per channel with /branch. New worktrees fork from the configured branch.
Four simple steps — the agent handles the rest.
@mention the bot in a channel or send a DM. A session and git worktree are auto-provisioned.
Copilot agent works autonomously. Every tool call passes through the deny-by-default policy engine.
Output streams in real-time. Secrets are redacted before posting. Reply in the thread for follow-ups.
git push triggers a button prompt. Outside-workspace access is blocked with a notification to use /grant.
@mention the bot or DM it to submit work. Reply in threads for follow-ups. Admin slash commands for control.
| Method | Description |
|---|---|
@mention | Primary way to submit work — @mention the bot in any allowed channel. |
| DM | Admin and allowed users can DM the bot directly — every message becomes a task. |
| Thread reply | Reply in an agent thread to continue the conversation with follow-ups. |
| Command | Description |
|---|---|
/stop | Abort running task (optionally clear queue) † |
/reset | Reset the agent session and workspace † |
/model [current|list|set] | View or change the AI model † |
/config | View current bot configuration † |
/grant path mode ttl | Grant access to a path outside workspace † |
/revoke path | Revoke a previously granted path † |
/update [check|apply] | Check for and apply bot updates † |
/pause | Pause queue processing † |
/resume | Resume queue processing † |
/responders [add|remove|list] | Manage who can answer agent questions † |
/repo [set|current|reset] | Switch repo for this channel † |
/branch [set|current|reset] | Set base branch for new worktrees † |
† Requires Manage Guild permission
Prerequisites: Git, Node.js ≥ 18, npm, and Copilot CLI (authenticated).
curl -fsSL https://github.com/epantke/discord-autopilot/releases/latest/download/agent.sh -o agent.sh && bash agent.sh
irm https://github.com/epantke/discord-autopilot/releases/latest/download/agent.ps1 -OutFile agent.ps1; .\agent.ps1
Just paste and run — the script guides you through setup interactively (tokens, repo URL, optional config) and offers to save everything to a .env file.
Set via .env file or export directly. Only one is required.
| Variable | Description |
|---|---|
DISCORD_TOKEN | Your Discord bot token |
REPO_URL | Repository URL to clone (or set interactively) |
| Variable | Default | Description |
|---|---|---|
DEFAULT_MODEL | claude-opus-4.6 | AI model (e.g. claude-sonnet-4.6, gpt-4o) |
DEFAULT_BRANCH | — | Base branch for new worktrees (default: remote HEAD) |
| Variable | Default | Description |
|---|---|---|
GITHUB_TOKEN | — | Fine-grained PAT (Contents r/w, Pull requests r/w) |
ADMIN_USER_ID | — | Your Discord user ID — always allowed in DMs |
ALLOWED_DM_USERS | — | Comma-separated user IDs allowed to DM the bot |
ALLOWED_GUILDS | all | Comma-separated guild IDs |
ALLOWED_CHANNELS | all | Comma-separated channel IDs |
ADMIN_ROLE_IDS | all | Comma-separated admin role IDs |
| Variable | Default | Description |
|---|---|---|
STARTUP_CHANNEL_ID | — | Channel for online/offline/reconnect notifications |
| Variable | Default | Description |
|---|---|---|
MAX_QUEUE_SIZE | 50 | Maximum queued tasks per session |
MAX_PROMPT_LENGTH | 4000 | Maximum prompt length in characters |
TASK_TIMEOUT_MS | 1800000 | Task timeout (default: 30 min) |
DISCORD_EDIT_THROTTLE_MS | 1500 | Discord message edit throttle interval |
RATE_LIMIT_WINDOW_MS | 60000 | Rate limit window per user |
RATE_LIMIT_MAX | 10 | Max messages per window (admins exempt) |
AUTO_APPROVE_PUSH | false | Auto-approve git push without Discord confirmation |
AUTO_RETRY_ON_CRASH | false | Re-enqueue tasks aborted by a crash/restart |
SESSION_KEEPALIVE_MS | 0 | Keepalive interval for Copilot sessions (0 = disabled) |
PAUSE_GRACE_MS | 3600000 | Grace period before paused sessions are swept (1h) |
| Variable | Default | Description |
|---|---|---|
BASE_ROOT | ~/.local/share/discord-agent | Base directory for all data |
WORKSPACES_ROOT | $BASE_ROOT/workspaces | Worktree directory |
LOG_LEVEL | info | debug / info / warn / error |
Multiple layers of protection — from filesystem isolation to secret redaction.
fs.realpathSync() prevents symlink traversal attacks
All file and shell ops outside workspace blocked without explicit grant
Detects git push in &&, ||, ;, pipes, sh -c, eval
Blocks shell cd into paths outside the workspace directory
git push, gh pr create/merge require Discord button approval
Redacts 11 token patterns before any output reaches Discord
Temporary grants with automatic expiration and cleanup
Each channel gets its own git worktree — no cross-contamination
Admin roles for privileged commands, per-user rate limiting
Only [\w./-] allowed, max 100 characters
Grants and sessions restored from SQLite on restart
SIGINT/SIGTERM handlers, DB cleanup, shutdown notifications
Five steps to get your bot running in a Discord server.
Go to the Discord Developer Portal → New Application → Bot → copy the token.
Under Bot settings, enable the Message Content Intent toggle.
Send Messages, Embed Links, Attach Files, Read Message History, Use Slash Commands, Create Public Threads, Send Messages in Threads
OAuth2 → URL Generator → scopes: bot, applications.commands → invite to your server.
Set DISCORD_TOKEN and run ./agent.sh (Linux/macOS) or .\agent.ps1 (Windows).