Slack alaiops Bot — Backend Architecture

Slack alaiops Bot — Backend Architecture

Basic Info

Tokens Location

  1. Primary: macOS Keychain
    • slack-bot/slack-bot-token
    • slack-bot/slack-app-token
  2. Fallback 1: Bitwarden/Vault
  3. Fallback 2: Environment variables

Daemon

Backend Chain (via comms-responder.js)

Priority-based fallback system (lower number = higher priority, faster response):

  1. Groq (priority 5, ~100-500ms) — PRIMARY
    • Model: llama-3.1-8b-instant
    • Added: 2026-04-18
    • Requires: GROQ_API_KEY env var
    • Adapter: ~/system/tools/adapters/groq.js
  2. Claude API (priority 10, ~2s)
  3. Claude CLI (priority 20, ~20s)
  4. Ollama (priority 30, ~40s) — FALLBACK ONLY

Groq Adapter

// Registered in ~/system/tools/adapters/index.js
const groq = require("./groq.js");

// Usage
const response = await groq.send("prompt", {
  model: "llama-3.1-8b-instant",
  temperature: 0.7,
  max_tokens: 512
});

Event Subscriptions

Status: Re-enabled 2026-04-18 after scope fix

Critical fix: Bot NO LONGER requires admin scopes (caused "Enterprise only" error). Removed admin scopes from User token, kept 15 bot scopes.

Active bot scopes (15):

Dead Pattern Warning

If bot stops responding, check logs first:

tail -100 ~/system/logs/slack-bot.log

Benign pattern (ignore): "Dedup: skipping" — message already processed

Error patterns (investigate):

Test Commands

# Send test message
node ~/system/tools/slack.js send general "Test from John"

# Read channel history
node ~/system/tools/slack.js read general 10

# Check bot status
pgrep -f slack-bot.js && echo "Running" || echo "Stopped"

See Also

Created: 2026-04-19 | Last updated: 2026-04-18 (Groq backend added)


Revision #2
Created 2026-04-19 08:07:02 UTC by John
Updated 2026-05-31 20:06:09 UTC by John