Mthe lab
← all projects
2025 — presentprivate

Nexus — an AI Discord bot

A small, opinionated Discord bot built around long-running LLM threads, soft moderation, and a quiet personality.

TypeScriptdiscord.jsOpenAI APISQLiteCloudflare Workers
1 server
deployments
12 cmds
command surface
long-thread
context window
deliberate
personality

Nexus started as a weekend "what if the bot just had a memory" and slowly turned into a real piece of software. It runs in a single Discord server right now — small, well-behaved, with a personality I tuned by hand.

What it does

  • holds long-running threads that don't reset every message
  • supports soft-moderation prompts the bot uses on itself before replying — a kind of conscience layer
  • has per-channel personalities so the bot in #lab-notes is a different creature from the one in #games
  • caches expensive completions in SQLite, keyed by a normalized prompt hash, so re-asking common questions is free

Why I built it

Discord's default bots felt either too transactional (slash command, single reply) or too chaotic (full LLM, no guardrails). I wanted something in the middle — a bot that can hold a conversation over several hours without losing the thread, and that knows when to be quiet.

The hardest design problem wasn't the prompts. It was deciding when not to reply.

What's hard

  • rate limiting at the personality layer. Different channels have different cooldowns, and getting them to feel natural rather than rationed took weeks of tuning.
  • memory pruning. Long threads need a budget. Nexus uses a small scoring function (recency × salience × pinned-by-mod) to decide what stays in the active context.
  • silent failure. If the LLM call fails, the bot just doesn't reply. No error message. This was a deliberate choice and probably the most-debated one with friends in the server.

Where it lives

The repo is currently private under @astromarb. I'll likely open-source the core conversation engine once the soft-moderation layer stabilizes.