Open Source · MIT License

Autonomous coding,
right from Discord

@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.

@Autopilot
↓ Download ★ View on GitHub

Everything you need for remote AI coding

A conversational coding agent that lives in your Discord — just chat with it. Security, streaming, and collaboration built in.

🤖

Autonomous Agent

Edits files, runs tests, and creates commits — no hand-holding required. Powered by GitHub Copilot SDK.

📡

Live Streaming

Output streams in real-time into per-task Discord threads. Throttled and chunked for smooth updates.

🔒

Push Approval Gate

git push and PR actions always require human approval via Discord buttons. 10 min timeout.

💬

DM & @mention

@mention the bot in a channel or DM it directly. Reply in threads for follow-ups. 12 admin slash commands for control.

👥

Multi-channel

Each channel or DM gets its own isolated workspace and session. Configure access with ALLOWED_DM_USERS.

Ask User

Agent can ask clarifying questions via Discord and wait for your answer. 5 minute timeout.

🔓

Deny-by-Default Grants

Outside-workspace access is automatically blocked. The user gets a notification with the denied path and uses /grant to allow access temporarily.

🔑

Secret Scanner

Auto-redacts 11 token patterns (GitHub PAT, AWS, Slack, OpenAI, …) before posting to Discord.

💾

Session Recovery

Sessions, grants, and task history survive bot restarts. Backed by SQLite in WAL mode.

🏗️

Workspace Isolation

Each user / channel gets its own git worktree. Complete isolation between sessions.

🧠

Self-Aware Agent

The bot knows its own capabilities and can explain them when asked. Ask "what can you do?" and it answers.

🔄

Auto-Updater

Checks for new releases on GitHub, downloads the update, waits for idle, and restarts automatically.

📂

Multi-Repo

Switch repos per channel with /repo. Clones on demand, each channel can work on a different project.

🌿

Branch Overrides

Set a custom base branch per channel with /branch. New worktrees fork from the configured branch.

From message to commit

Four simple steps — the agent handles the rest.

Submit task

@mention the bot in a channel or send a DM. A session and git worktree are auto-provisioned.

Agent works

Copilot agent works autonomously. Every tool call passes through the deny-by-default policy engine.

Live stream

Output streams in real-time. Secrets are redacted before posting. Reply in the thread for follow-ups.

Approval gates

git push triggers a button prompt. Outside-workspace access is blocked with a notification to use /grant.

@mention + DMs + 12 admin commands

@mention the bot or DM it to submit work. Reply in threads for follow-ups. Admin slash commands for control.

💬 How to interact

Method Description
@mentionPrimary way to submit work — @mention the bot in any allowed channel.
DMAdmin and allowed users can DM the bot directly — every message becomes a task.
Thread replyReply in an agent thread to continue the conversation with follow-ups.

🔧 All slash commands

Command Description
/stopAbort running task (optionally clear queue) †
/resetReset the agent session and workspace †
/model [current|list|set]View or change the AI model †
/configView current bot configuration †
/grant path mode ttlGrant access to a path outside workspace †
/revoke pathRevoke a previously granted path †
/update [check|apply]Check for and apply bot updates †
/pausePause queue processing †
/resumeResume 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

Up and running in minutes

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.

Environment variables

Set via .env file or export directly. Only one is required.

Required
VariableDescription
DISCORD_TOKENYour Discord bot token
REPO_URLRepository URL to clone (or set interactively)
Model & Branch
VariableDefaultDescription
DEFAULT_MODELclaude-opus-4.6AI model (e.g. claude-sonnet-4.6, gpt-4o)
DEFAULT_BRANCHBase branch for new worktrees (default: remote HEAD)
Access Control
VariableDefaultDescription
GITHUB_TOKENFine-grained PAT (Contents r/w, Pull requests r/w)
ADMIN_USER_IDYour Discord user ID — always allowed in DMs
ALLOWED_DM_USERSComma-separated user IDs allowed to DM the bot
ALLOWED_GUILDSallComma-separated guild IDs
ALLOWED_CHANNELSallComma-separated channel IDs
ADMIN_ROLE_IDSallComma-separated admin role IDs
Notifications
VariableDefaultDescription
STARTUP_CHANNEL_IDChannel for online/offline/reconnect notifications
Limits & Tuning
VariableDefaultDescription
MAX_QUEUE_SIZE50Maximum queued tasks per session
MAX_PROMPT_LENGTH4000Maximum prompt length in characters
TASK_TIMEOUT_MS1800000Task timeout (default: 30 min)
DISCORD_EDIT_THROTTLE_MS1500Discord message edit throttle interval
RATE_LIMIT_WINDOW_MS60000Rate limit window per user
RATE_LIMIT_MAX10Max messages per window (admins exempt)
AUTO_APPROVE_PUSHfalseAuto-approve git push without Discord confirmation
AUTO_RETRY_ON_CRASHfalseRe-enqueue tasks aborted by a crash/restart
SESSION_KEEPALIVE_MS0Keepalive interval for Copilot sessions (0 = disabled)
PAUSE_GRACE_MS3600000Grace period before paused sessions are swept (1h)
Paths & Logging
VariableDefaultDescription
BASE_ROOT~/.local/share/discord-agentBase directory for all data
WORKSPACES_ROOT$BASE_ROOT/workspacesWorktree directory
LOG_LEVELinfodebug / info / warn / error

Defense in depth

Multiple layers of protection — from filesystem isolation to secret redaction.

Path security

fs.realpathSync() prevents symlink traversal attacks

Deny-by-default

All file and shell ops outside workspace blocked without explicit grant

Compound command scanning

Detects git push in &&, ||, ;, pipes, sh -c, eval

cd target validation

Blocks shell cd into paths outside the workspace directory

Push approval gate

git push, gh pr create/merge require Discord button approval

Secret scanner

Redacts 11 token patterns before any output reaches Discord

Grant TTL & auto-revoke

Temporary grants with automatic expiration and cleanup

Workspace isolation

Each channel gets its own git worktree — no cross-contamination

RBAC

Admin roles for privileged commands, per-user rate limiting

Branch sanitization

Only [\w./-] allowed, max 100 characters

Session recovery

Grants and sessions restored from SQLite on restart

Graceful shutdown

SIGINT/SIGTERM handlers, DB cleanup, shutdown notifications

Create your Discord bot

Five steps to get your bot running in a Discord server.

1

Create application

Go to the Discord Developer Portal → New Application → Bot → copy the token.

2

Enable Message Content Intent

Under Bot settings, enable the Message Content Intent toggle.

3

Set permissions

Send Messages, Embed Links, Attach Files, Read Message History, Use Slash Commands, Create Public Threads, Send Messages in Threads

4

Generate invite URL

OAuth2 → URL Generator → scopes: bot, applications.commands → invite to your server.

5

Run the agent

Set DISCORD_TOKEN and run ./agent.sh (Linux/macOS) or .\agent.ps1 (Windows).