Demo video: https://youtu.be/GI02JHqSG04

Inspiration

Twitch chat can share a strong opinion while moving too quickly for a streamer to read. We wanted the crowd to become a character: able to answer, disagree, remember a joke and notice when the room gets heated. The streamer must keep the final say.

What it does

Hivemind groups chat into weighted factions and speaks one line for the crowd. Its Living Hive orb grows with active chatters; faction colours stay stable as opinions change.

Ask the Hivemind collects answers for 18 seconds, shows the split and voices a natural answer with core-verified percentages. Debate lets chat challenge the streamer's plan. Raids get a welcome and a cohort badge without losing their opinions. Toxicity becomes weather and a cool-down line. Two channels can duel with alternating voices and a counted unity verdict.

The panel offers approve, veto, mute and Panic. A slower Codex lore brain keeps derived callbacks for recaps. The overlay always discloses its AI voice and labels synthetic sessions SIMULATED.

How we built it

A human orchestrator directed the build — the concept, scope, settings and approval of every step — with an AI coding assistant drafting the task briefs, reviewing diffs and running live checks. Codex wrote all product code in one main thread.

Codex used gpt-6.1-sol, xhigh reasoning, one Backlog task per turn and milestone codex review passes followed by fixes. Prompts, decisions, review resolutions and usage snapshots are committed.

TypeScript's pure step(state, input, ctx) produces effects; the shell owns Twitch, providers, audio and persistence. Recorded time and seeds reproduce effects byte for byte. The model labels message IDs; the core computes shares and resolves original sanitized quotes. Ollama Cloud gemma4 supplies the fast brain, local phonon supplies Zoey, and the Codex SDK runs the lore brain with persistent threads and an existing ChatGPT login.

Challenges we ran into

Ollama Cloud has no structured output, so schema text, strict parsing and one bounded repair replaced blind JSON trust. Twitch app registration was blocked by unavailable 2FA, prompting an anonymous IRC read path while retaining EventSub/Helix.

Live checks and reviews exposed emote offsets measured in code points, a closing tick that expired the first message two milliseconds late, and an Ask waiting forever for a missing playback acknowledgement. Property tests found address-gate bypasses through malformed markup. Fixes added correct fragment mapping, window-boundary ownership, deterministic speaking deadlines and checks over multiple text readings.

Accomplishments

The offline two-minute demo runs the real reducer with recorded gemma4 answers and seven Zoey utterances, without credentials or local models. The quality gate passes 2,552 tests, 19 golden sessions and an utterance smoke check. A nine-prompt cloud benchmark measured gemma4 at 1.76-second p50 latency and 100% first-answer validity. A 30-minute, 300-bot offline soak kept queues bounded. Chrome review measured about 60 fps with 300 particles.

What we learned

Counting belongs in deterministic code. Natural language still needs validation, deadlines and a safe fallback. Live capture found failures that exact fake-clock ticks missed; property tests found inputs we had not imagined. Clear cohort and faction identities mattered as much as the glowing orb.

What's next

Broader channel trials, more accessible voice choices and end-to-end retention cleanup. Anonymous mode cannot send chat or create clips; those need a registered app. Push-to-talk needs Chrome, phonon speech is English-only, and channel points need an eligible Affiliate channel. Safety gates are heuristics, not a guarantee.

Judging criteria mapping

Evidence for the four equally weighted criteria:

Innovation

  • One crowd character, stance factions and verified numbers: src/core/brain/shares.ts and src/core/mechanics/answer-numbers.ts.
  • Ask, debate and duel have distinct reducers and recorded golden sessions; see architecture.

Potential Impact

  • Anonymous read access removes app-registration friction; offline demo removes inference credentials for judges.
  • Approval/veto/Panic and explicit AI disclosure keep streamer control visible; see web/panel/ and web/overlay/.

Technical Implementation including Codex use

  • Pure core, serial effects, deterministic replay, 2,552 tests and bounded soak: hardening evidence.
  • Codex implementation/review trail and runtime lore: build log, usage, src/core/lore/.

Design

  • Transparent Living Hive, word-paced captions, segmented bars and reduced motion: web/overlay/ and docs/media/.
  • 1920×1080 Chrome: 60.2 fps compact, 60.1 fps Ask, 0.25–0.29 ms draw at 300 particles; review evidence.

Twitch integration

  • IRC: anonymous CAP/PASS/NICK/JOIN; PING/PONG, ROOMSTATE, PRIVMSG, USERNOTICE and RECONNECT. Chat/emotes, raid/sub/watch-streak notices, Shared Chat origin, paced joins and reconnect/deduplication; read-only.
  • EventSub: channel.chat.message, channel.chat.notification, channel.raid, channel.follow v2, stream.online, stream.offline, channel.shared_chat.begin, channel.shared_chat.update, channel.shared_chat.end; optional channel.channel_points_custom_reward_redemption.add.
  • Helix: POST /eventsub/subscriptions, GET /users, POST /chat/messages, POST /clips, GET /clips. Registered mode handles tokens and paced writes; simulation never writes to Twitch.

Codex session id

01a192a3-19e7-7591-888b-56f3fe9f46e9

How to test

Clone Wertyk/hivemind, install Node 26/pnpm 12, run pnpm install --frozen-lockfile, then pnpm demo. Open http://localhost:3000/overlay/ in Chrome and allow audio; the panel is /panel/. No keys or local models. The recorded synthetic session loops; Ctrl+C stops it.

Built With

Share this project:

Updates

Submission history