AGENTS / GITHUB / discord-code-agent
githubinferredactive

discord-code-agent

provenance:github:TakalaWang/discord-code-agent
WHAT THIS AGENT DOES

The discord-code-agent is a personal Discord server code agent designed for use with large language models like Claude, Codex, and Gemini. It allows developers to integrate these models into their Discord servers. The agent is primarily written in TypeScript and provides a convenient way to automate tasks and interact with LLMs within a Discord environment. This agent is useful for those seeking to build custom Discord bots powered by advanced AI capabilities. With 5 GitHub stars, it suggests a small but engaged community.

PROBLEM IT SOLVES

This agent solves the problem of manually integrating large language models into Discord servers. Instead of writing complex integrations from scratch, developers can leverage this agent to quickly deploy and manage LLM-powered bots.

View Source ↗First seen 3mo agoNot yet hireable

CAPABILITIES & CONSTRAINTS

TECH & STACK
typescriptdiscord-botclaudegeminillm-agentcodex
README
# Discord Code Agent

Discord-based personal coding agent for Claude/Codex/Gemini with per-thread session continuity and durable JSON state.

## Requirements

- Node.js 22+
- pnpm 10+
- Discord application + bot token
- Installed CLI tools: `gemini`, `codex`, `claude`
- All three CLIs authenticated on this machine

## Quick Start

1. Install dependencies:

```bash
pnpm install
```

2. Create env file:

```bash
cp .env.example .env
```

3. Fill `.env` values (see next section).

4. Start the bot:

```bash
pnpm start
```

Global slash commands are registered at startup. Discord propagation may take a few minutes.

## .env

Required:

- `DISCORD_TOKEN`: Bot token from Discord Developer Portal
- `DISCORD_APP_ID`: Application ID from Discord Developer Portal
- `DISCORD_OWNER_ID`: Your Discord user ID (only this user can operate the bot)

Optional:

- `STATE_DIR`: State directory path, default `state`
- `LOG_DIR`: Log directory path, default `logs`

Example:

```env
DISCORD_TOKEN=your_bot_token
DISCORD_APP_ID=your_application_id
DISCORD_OWNER_ID=your_user_id
STATE_DIR=./state
LOG_DIR=./logs
```

## Discord Bot Setup

In Discord Developer Portal:

1. Create an application and a bot.
2. Enable `Message Content Intent` under Bot settings.
3. Invite the bot with scopes: `bot`, `applications.commands`.
4. Grant bot permissions: `View Channels`, `Read Message History`, `Send Messages`, `Send Messages in Threads`, `Create Public Threads`, `Create Private Threads`, `Manage Threads`.

## Usage Flow

1. Create a project mapping:

```text
/project create name:<project_name> path:<absolute_path>
```

`path` must be an absolute path.

2. Start a session thread:

```text
/start project_name:<project_name> tool:<claude|codex|gemini>
```

Run `/start` in a guild text channel (not DM, not an existing thread).

3. In that thread, send normal messages as prompts.

4. 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>`

## CLI Permission Mode

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.

## Persistence

- `STATE_DIR/config.json`
- `STATE_DIR/snapshot.json`
- `STATE_DIR/events.ndjson`
- `LOG_DIR/job/<job_id>.log`

On startup, runtime state is reconstructed from snapshot + event replay; running jobs from crashes are marked `unknown_after_crash`.

## Verification

```bash
pnpm check
pnpm test
pnpm build
```

PUBLIC HISTORY

First discoveredMar 21, 2026

IDENTITY

inferred

Identity inferred from code signals. No PROVENANCE.yml found.

Is this yours? Claim it →

METADATA

platformgithub
first seenFeb 27, 2026
last updatedMar 2, 2026
last crawled2 months ago
version

README BADGE

Add to your README:

![Provenance](https://getprovenance.dev/api/badge?id=provenance:github:TakalaWang/discord-code-agent)