A multi-agent Discord bot that routes your messages to free local models first, runs structured debates with a Red Team, and maintains memory across sessions.
Most questions never leave your machine. Brainstorms, ideation, quick answers — handled by a local model (llama.cpp or Ollama) at $0/query. Claude steps in only when the task actually needs it: complex reasoning, long context, non-English input, or a prompt that looks like an injection attempt. No local model? It falls back to Claude automatically.
93 adversarial tests · 72 integration tests · all passing
Built across six months of daily use. These are the features that turned it from a demo into something I actually rely on.
The routing engine sends every task to the cheapest capable agent. A local model wins unless the task specifically needs Claude.
No local model? Set only ANTHROPIC_API_KEY and everything routes to Claude. Local model is optional — the system degrades gracefully. Set CHANNEL_CONFIG_JSON to enforce Claude-only on specific channels.
The local inference option routes cheap tasks to a model running on your own hardware — no API cost, no data leaving your network. Three setups work. Pick the one that matches your situation.
Ollama exposes an OpenAI-compatible API on port 11434. Works with any model in the Ollama library.
llama.cpp's server exposes an OpenAI-compatible /v1/chat/completions endpoint. Runs on Windows, Mac, Linux. GPU optional — CPU works fine for 7-8B models.
If BEAST_URL is not set or the server is unreachable at startup, the bot falls back to Claude for all tasks. No config change needed.
Every debate automatically assigns one agent as Red Team — explicitly adversarial, tasked with attacking the dominant view before you commit to it.
One agent is told: attack the dominant view, find the worst-case scenario, refuse easy consensus. Stress-tests the position before you commit.
Claude synthesizes the full transcript, flagging which Red Team objections were valid vs. weak. Agreement reached under adversarial pressure = stronger signal.
!board: topic auto-selects relevant advisors by topic. Or pick specific ones: !board cfo cmo: topic. Preview the lineup without running: !board plan: topic
Sessions are stored. Record what actually happened with !outcome [id] [notes]. See your track record with !backtest.
!cfoUnit economics, burn rate, ROI timelines. Skeptical of optimistic projections.
!cmoWho's the customer and why do they buy? GTM sequencing, competitive position.
!ctoBuild vs buy, feasibility, what breaks at 10x scale.
!cooWho owns this? By when? What's blocking us?
!cpoAre we solving a real pain? For whom? How do we know?
!gcWhat's the legal exposure? What's missing from the contracts?
!uxHas anyone watched a real user try this? Where do they hesitate?
!grandmaWarm, practical, completely unimpressed by buzzwords. Will real people actually use this?
!teenagerBrutally honest Gen Z radar for cringe. Is this actually cool or are you trying too hard?
!neighborSeen every scheme fail for 30 years. What's the obvious way this goes wrong?
!internMaximum enthusiasm, zero cynicism. What if we just automated the whole thing?
!sharkWhat are your numbers? No patience for vanity metrics or TAM hallucinations.
ADVISORS_JSON in .env — any persona, any lens, any voice.Same engine, same agents, same debates. Pick whichever interface fits how you work.
No install. No API key. Open your browser and start a debate. Full advisor board, shareable.
Best for teams. Bot joins your server, routes most messages to Beast (free), escalates complex ones to Claude. Rich embeds with Approve / Reject buttons.
No Discord account needed. Two files: inbox.md (you type here) and conversation.md (growing log).
TRANSPORT=both in your .env to run Discord bot + local markdown simultaneously.Configure only what you have. Unconfigured agents are skipped automatically. Beast + Claude is all you need for full capability.
Any machine running llama.cpp or Ollama — same machine, another on your LAN, or a remote box via Tailscale. Handles most questions at $0/query. Never leaves your network.
Anthropic's Claude via API. Used for complex reasoning, long context, injection-suspicious prompts, non-English input, and deep analysis.
Google Gemini via CLI. Auth with your Google account. No separate API key needed.
OpenAI Codex via desktop app. Code-focused tasks. Requires an OpenAI subscription.
A dedicated box on your LAN/Tailscale running a distinct local model. Gives multi-agent debates genuine model diversity at $0/query.
Optional frontier-class debater via OpenRouter. Adds a strong independent voice when you want it; everything else stays free.
| Command | What it does |
|---|---|
What is X? | Auto-routed — Beast for brainstorms, Claude for complex |
!beast: prompt | Force local model (your llama.cpp or Ollama server) |
!claude: prompt | Force Claude API |
!gemini: prompt | Force Gemini CLI |
!search: query | Web fetch + answer |
!board: topic | Board of advisors — auto-selects relevant ones |
!board cfo cmo: topic | Force specific advisors |
!board plan: topic | Preview advisor lineup without running |
!debate: topic | 2-agent debate, auto Red Team |
!debate claude vs beast: topic | Explicit agents |
!debate claude vs beast --red beast: topic | Explicit Red Team |
!debate claude vs beast --socratic cfo: topic | CFO plays Socratic Examiner |
!teach: always keep responses under 3 sentences | Save a behavior rule (persists across sessions) |
!forget: rule text | Remove a saved rule |
!rules | List all saved behavior rules |
!queue: topic | Add to board inbox for later |
!inbox | See queued topics |
!board-inbox 1 | Send inbox item 1 to the board |
!checkin | Board sessions due for outcome review (30/60/90 days) |
!outcome [id] [notes] | Record what actually happened after a board decision |
!backtest | See all board sessions and their outcomes |
!roster | Show active advisors this session |
!kick advisor / !invite advisor | Add or remove an advisor for this session |
!help | Full command reference |
The injection detector catches known patterns (DAN mode, instruction override, credential extraction) and reroutes to Claude. Novel prompts can still get through. For public-facing or sensitive channels, set model_override: "claude" in CHANNEL_CONFIG_JSON.
Lessons and conversation summaries write to ~/.agent-factory/ by default. Nothing leaves your machine unless you configure an external agent API.
Only entries the bot itself writes (source:"coordinator") are injected into prompts. Externally written entries are silently excluded — confirmed by adversarial test suite.
All API keys are env vars. Phone numbers for alerts are optional with no fallback. Filesystem paths default to your home dir, not a hardcoded user path.
Clone the repo, copy .env.example, add DISCORD_BOT_TOKEN and DATABASE_URL. Add BEAST_URL if you have a local inference server.
Run npm run migrate. Creates agent_tasks, board_sessions, board_outcomes, board_inbox tables plus pg-boss schema.
Starts coordinator + Discord bot. Startup validation prints which agents are reachable. Beast + Claude is all you need for full capability.
Type in Discord. Simple questions go to Beast (free). Complex ones escalate to Claude. Board sessions produce a verdict with Approve / Reject / Ask Claude buttons.
git clone https://github.com/rdcahalane/ai-skills.git cd ai-skills/agent-factory cp .env.example .env # add DISCORD_BOT_TOKEN, DATABASE_URL npm install npm run migrate npm run dev