← HOME

PROJECT

Bark

ACTIVE

Discord soundbite bot with Claude-powered intelligence

Node.jsTypeScriptDiscord.jsClaude APINSSM

ABOUT

Bark is a Discord soundbite bot with an AI brain. When someone says something that matches a configured trigger phrase, the bot plays a matching audio clip in the voice channel — but with a layer of Claude-powered intelligence deciding whether the moment is right.

Smart Brain is the core differentiator: rather than simple string matching, Bark routes messages through Claude for contextual analysis. It understands intent, not just keywords — reducing false positives and making playback feel earned rather than mechanical.

Two quality-of-life features make it usable in real servers: Better Ears lets you tune the detection sensitivity per trigger (no more false fires on partial matches), and cooldown logic prevents the same clip from playing twice in quick succession. The whole thing runs as a Windows service via NSSM, auto-starting on boot without a terminal window.

FEATURES

SHIPPED

  • Smart Brain — Claude-powered contextual analysis

    Routes messages through Claude before triggering — understands intent, not just keywords

    MAR 2026
  • Better Ears — configurable detection sensitivity

    Per-trigger threshold tuning to reduce false positives

    MAR 2026
  • Cooldown logic — rapid-fire prevention

    Prevents the same clip from playing twice in quick succession

    MAR 2026
  • Windows service — NSSM auto-start on boot

    Runs as a background Windows service, survives reboots without a terminal window

    MAR 2026

CHANGELOG

BARKbugaiaudio

Bug sweep — soundboard spinner, phrase match, error surfacing

Bug Fixes

  • Soundboard "Add to Soundboard" spinner hung forever — root cause: except RuntimeError too narrow, leaving FileNotFoundError (expired temp file) and discord.errors.Forbidden unhandled before followup.send() was called; broadened to except Exception
  • Public channel announcement failure masked as upload failure — upload and announcement now in independent try/except blocks; announcement errors silently ignored
  • "Phrase Not Found — Failed to analyze transcript" on valid matches — Claude was generating retry_suggestions as a second JSON block instead of embedding it in the result object; rewrote prompt to show retry_suggestions inside each schema example
  • max_tokens raised 512 → 1024 in phrase matcher — response truncation was cutting off JSON mid-object on longer explanations

Infrastructure

  • Parse error logging added to matcher fallback path — raw Claude response and exception now printed to service-stdout.log for diagnosis instead of silently swallowing

Lessons

  • Discord deferred interactions require followup.send() to resolve the spinner — any unhandled exception before that call leaves the spinner permanent and silent
  • Claude prompt structure shapes response structure: a "in ALL cases, include X" instruction after the schema produces a second JSON block, not a merged one; shared fields belong inside every schema example
  • service-stdout.log and service-stderr.log carry different signal — stdout gets Python print() output, stderr gets discord.py tracebacks; check both when debugging
BARKSHIPPEDfeatureaiaudio

Bark — AI feature suite shipped

Features

  • Bark ships AI feature suite — Smart Brain, Better Ears, Cooldown, and Windows service all live
  • Smart Brain routes every trigger message through Claude before acting — intent-aware instead of pattern-aware, false positives drop to near zero on busy servers
  • Better Ears adds per-trigger detection thresholds — sensitivity tunable without touching code
  • Cooldown logic prevents rapid-fire repeat plays — same clip won't fire twice in quick succession
  • NSSM service wraps the bot as a Windows background process — survives reboots, no terminal window required

Lessons

  • Async fire-and-forget for Claude calls is the right pattern in real-time audio contexts — blocking on AI response latency kills the moment
  • Graceful fallback (play the sound anyway on Claude timeout) means the AI layer enhances reliability rather than introducing fragility
  • The gap between keyword matching and contextual understanding is where the product lives — Smart Brain makes Bark feel designed rather than scripted
BARKfeatureaiaudio

Better Ears + Smart Brain — Claude-powered audio intelligence

Features

  • Claude integration added to Bark — bot now understands context around sound triggers
  • Smart Brain mode: Claude analyzes recent activity before deciding whether to play a sound
  • Better Ears: audio detection sensitivity tuned with configurable threshold
  • Cooldown logic added to prevent rapid-fire repeat plays after a trigger

Bug Fixes

  • Fixed race condition where two overlapping audio events would both trigger playback
  • Resolved NSSM service restart loop caused by unhandled promise rejection on Claude API timeout

Infrastructure

  • Claude API key stored in .env and loaded via dotenv — not hardcoded
  • NSSM service updated to use new entry point after refactor

Lessons

  • Wrapping AI calls in try/catch with graceful fallback (play sound anyway) prevents service crashes
  • Claude's response latency is noticeable in real-time audio contexts — async fire-and-forget works better than blocking