Discord-based personal coding agent for Claude/Codex/Gemini with per-thread session continuity and durable JSON state.
- Node.js 22+
- pnpm 10+
- Discord application + bot token
- Installed CLI tools:
gemini,codex,claude - All three CLIs authenticated on this machine
- Install dependencies:
pnpm install- Create env file:
cp .env.example .env-
Fill
.envvalues (see next section). -
Start the bot:
pnpm startGlobal slash commands are registered at startup. Discord propagation may take a few minutes.
Required:
DISCORD_TOKEN: Bot token from Discord Developer PortalDISCORD_APP_ID: Application ID from Discord Developer PortalDISCORD_OWNER_ID: Your Discord user ID (only this user can operate the bot)
Optional:
STATE_DIR: State directory path, defaultstateLOG_DIR: Log directory path, defaultlogs
Example:
DISCORD_TOKEN=your_bot_token
DISCORD_APP_ID=your_application_id
DISCORD_OWNER_ID=your_user_id
STATE_DIR=./state
LOG_DIR=./logsIn Discord Developer Portal:
- Create an application and a bot.
- Enable
Message Content Intentunder Bot settings. - Invite the bot with scopes:
bot,applications.commands. - Grant bot permissions:
View Channels,Read Message History,Send Messages,Send Messages in Threads,Create Public Threads,Create Private Threads,Manage Threads.
- Create a project mapping:
/project create name:<project_name> path:<absolute_path>
path must be an absolute path.
- Start a session thread:
/start project_name:<project_name> tool:<claude|codex|gemini>
Run /start in a guild text channel (not DM, not an existing thread).
-
In that thread, send normal messages as prompts.
-
Use support commands when needed:
/status(run inside managed thread)/retry job_id:<job_id>/session list [project_name]/session open session_id:<thread_id>/project status project_name:<project_name>
Current implementation starts tool CLIs with auto-approval/full-access flags by default:
- Codex:
--dangerously-bypass-approvals-and-sandbox - Claude:
--dangerously-skip-permissions - Gemini:
--yolo
Use only in trusted local environments.
STATE_DIR/config.jsonSTATE_DIR/snapshot.jsonSTATE_DIR/events.ndjsonLOG_DIR/job/<job_id>.log
On startup, runtime state is reconstructed from snapshot + event replay; running jobs from crashes are marked unknown_after_crash.
pnpm check
pnpm test
pnpm build