Inspiration
Solo streamers already play "against" their chat: chat dares them, bets on them, and argues about whether a run counted. Race Control turns that into a real game with a referee, a ledger and rules chat can't argue with, run by a team of cooperating AI agents that the streamer stays in charge of.
What it does
Race Control is an AI referee and game master for one streamer against their own chat, shown live through a Twitch chat bot and an OBS overlay.
- Game Master (Codex): the streamer types
!dare; a livecodex execcall writes a dare for the game (title, loadout options, kill target, stakes) in about 6 seconds. Only trusted context goes into the prompt, never chat text. - Commissioner (the streamer): nothing goes live without
!approve;!rerollasks for another dare.!overrulecorrects a result. - Chat votes and predicts: viewers vote with a number, the option's first word, or
!pick N, and predict with!yes/!no. - Watcher: reads the kill counter straight from the game HUD through OBS (obs-websocket screenshots + on-device macOS Vision OCR). Two matching reads per kill; impossible jumps are ignored, so one glitchy frame can't win a dare.
- Referee and Ledger: locks the vote, runs the clock and resolves the dare. Every event goes into an append-only ledger, and all standings are derived by replaying it.
- Rules Compiler + Auditor (Codex): the streamer changes scoring in plain English (
!rule wrong calls lose a point). One Codex model writes the scoring function, a second model independently writes its own, and they must agree on every past prediction plus 2,300+ synthetic cases before the streamer can!adoptit. Adoption re-scores the whole stream.
The overlay shows every agent hand-off (proposed, approved, vote locked, HUD kills, rule written, audit passed, rule adopted) in a HUD-safe layout that keeps the game's minimap, kill count, health and inventory visible.
How we built it
- Node 22 + TypeScript service on the streamer's machine; dependencies are just
wsanddotenv. - Twitch: EventSub over WebSocket (
channel.chat.message) with user tokens; replies through Helix Send Chat Message with the app token so the bot shows the Chat Bot badge. - OBS: a transparent Browser Source overlay fed over a local WebSocket, and obs-websocket v5 for the Watcher's frames.
- Codex at runtime:
codex exec --ephemeral -s read-only --output-schema …, run with no shell and a timeout. JSON is validated strictly, with sample-dare fallbacks. Generated scoring code runs innode:vmwith a null-prototype context, a word ban-list and a 50 ms timeout, and only after the audit passes. - Built with Codex: the whole app was written in one Codex CLI thread over seven tasks (chatbot, ledger and dare loop, overlay, Game Master, Rules Compiler/Auditor, Watcher, polish), with 90 tests. Each task was a written brief with tests and gates; every diff was reviewed and re-tested before committing. Details and commit list are in the README.
Challenges we ran into
- Live testing found real bugs the unit tests missed, each fixed with a test that failed first: a VM sandbox escape through the scoring context's prototype, rule prompts that let models put prose inside code, Vision reading a lone
0as nothing and swapping6and9on OBS frames, and query strings breaking local routes. - OBS Browser Sources stayed blank on macOS until hardware acceleration was turned off and OBS was fully quit.
- Keeping chat out of every prompt while still letting chat drive the game.
Accomplishments that we're proud of
- Two different Codex models, writing differently shaped code from the same plain-English rule, agreeing on every one of 2,306 cases, live, in about 15 seconds.
- Kills counted from the HUD with no
!kill, end to end through OBS.
What we learned
Agents are most useful when each one has a narrow job and another agent (or the streamer) checks its work: the Auditor checks the Compiler, the Watcher needs two matching reads, and the streamer approves everything that goes live.
What's next for Race Control
Real game HUD presets (Fortnite, Valorant, Apex), multi-streamer races with a shared ledger, and channel-point stakes.
Notes for judges
The demo video runs the real system in mock mode: live Codex calls, the real overlay and the real Watcher through OBS, with chat from the built-in crowd simulator and a test HUD page standing in for the game. The same code runs live on Twitch with npm start; setup steps are in the README.
Try it without installing anything: https://race-control-demo.ramy-comm.workers.dev is a browser playground running the real game code (press Auto-play). Codex calls there are replaced by recorded outputs from real Codex runs, and the Auditor's check is computed live in your browser. To run it locally with live Codex: npm install && npm run demo, then open http://127.0.0.1:3000/demo.
Built With
- apple-vision
- eventsub
- node.js
- obs-studio
- openai-codex
- swift
- twitch
- typescript
- websockets
Log in or sign up for Devpost to join the conversation.