The same game side by side: the original, and the version changed by patches pitched in Twitch chat

Watch the 2:21 demo video · Get the code on GitHub · See all 15 images

Inspiration

In 2014, Twitch Plays Pokémon got about 1.1 million people typing commands into a single game. Chat could press the buttons, but the rules never changed. We wanted to see what happens when chat can change the rules while the game is running.

We also wanted to give 2D games a better shot at attention. Huge titles lead Twitch's viewing: GTA V and League of Legends were among the most-watched categories of 2025, and Counter-Strike drew over 372 million hours as an esport. A small 2D game can't match that on budget or spectacle. It can win on mechanics, which is how Balatro passed 5 million sales with a solo developer and Hollow Knight: Silksong reached 7 million in three months. Mechanics are also what a live audience can invent, and a new rule in a 2D game is easy to see the moment it lands.

So we built for four groups: viewers, streamers, moderators and game developers.

What it does

Live Patch turns a Twitch stream into a live game studio. Viewers pitch a mechanic, chat votes, a moderator approves the winner, and Codex writes it as a small patch that loads into the running game. The streamer keeps playing. Nothing reloads.

The whole system as one loop: viewers, Twitch, the local server, the Codex sandbox, the running game, and back to viewers on stream

For viewers

  • Pitch a mechanic with !idea <mechanic>, or redeem the 1-point Live Patch Pitch Channel Points reward.
  • Vote with !vote 1, 2 or 3 and watch the bars move on the overlay. The three oldest ideas go on each ballot, and the rest stay queued.
  • Bet Channel Points on a Twitch Prediction: will this patch ship or fail?
  • Get credit on stream and in the patch notes when your idea ships.
  • Ask for a rollback with !rollbackvote. Three votes alert the moderators.

For moderators

An open chat that can change a live game needs a human in charge, so moderators are part of the core loop.

  • Nothing builds until a moderator or the broadcaster approves it. Approval has no timer.
  • !approve, !reject and !rollback work from chat, so a moderator doesn't need access to the streamer's PC. The app checks each person's Twitch role and silently ignores everyone else.
  • Rollback is instant. !rollback removes the latest patch from the running game, and the bot confirms it in chat.
  • Less noise to manage. Unsafe requests are rejected automatically and exact duplicates are merged, with every contributor kept. A 200-character limit and a three-minute cooldown slow down spam.

A moderator approving the winning idea from the Go Live dashboard

For streamers

  • Easy onboarding. npm run setup checks your machine, and a welcome screen offers Try it now. The six-step Setup wizard then connects Twitch, Codex and OBS, and can create the Pitch reward for you.
  • Practice mode. Rehearse a full round with simulated viewers and no accounts. Nothing is sent to Twitch.
  • Go Live dashboard. See the game mirrored under the overlay, with the ballot, recent chat, an activity feed and each Codex step. Quick actions include Pause round, Next stage, Open prediction, Save build, Roll back latest and Cancel build.
  • AI triage preview. Codex can suggest clearer wording, merges and rejections during the pitch window. Nothing changes until the streamer applies the preview, and it can be discarded.
  • Predictions. A shipped patch resolves Ships, and a patch rejected by its checks resolves Fails. If a build stops for a setup reason, such as a sandbox problem, the prediction is cancelled and Twitch returns the points.
  • OBS overlay. Add one Browser Source for the ballot, Codex progress, live patches and a pitch ticker. Drag and resize widgets in the editor, with a saved layout for each game.
  • Save and compare. Save build keeps a playable snapshot with patch notes that credit viewers. Compare with original opens the original and evolved games side by side.
  • Comfort settings. Adjust round timing, sound, effects intensity and HUD size, and reduce flashing and shake.

For game developers

Live Patch is a platform, and it gives you a real audience to test ideas with.

  • One folder per game. A live-patch.json manifest declares the game's actions, hooks, patch folder, test command, API docs, controls, overlay zones and sample pitches. The engine contains no game-specific code.
  • Two games ship today. Arena Survivor is a top-down survival game, and Lantern Run is a one-button fox runner. Both use the same pipeline.
  • Quick to start. npm run new-game -- "My Game" or Library → Add your game creates a starter or imports a folder. An imported game is validated, then smoke-tested after you confirm.
  • Playtest mechanics live. Each shipped patch is one small JavaScript file with its own Git commit. Keep what works, roll back what doesn't, and save the build as a record of what your community designed.

The Library, where the streamer chooses the active game

How we built it

Codex has two jobs in this project.

Codex built the project. It wrote the engine, both games and the tests across eight tagged phases, working from a written spec for each phase and the rules in AGENTS.md. Claude Code acted as a separate reviewer. It didn't edit project code, and it ran each phase and recorded its findings in 29 review rounds. Codex fixed the findings, and we decided when each phase was done.

Codex is the live game developer. Once a moderator approves an idea, the runner uses the Codex TypeScript SDK to build it, step by step on stream:

  1. It creates a dedicated Git worktree with no network, shell, web search, apps, plugins or MCP access.
  2. It confirms that writing inside the worktree works and writing to the main repository fails.
  3. Codex receives the approved idea, the game's API docs and example patches. Viewer text is marked as untrusted data.
  4. Only one new file is accepted, up to 120 lines and 12 KB, and a source scan rejects banned names such as fetch and document.
  5. A 5-second smoke test runs the patch with every active patch in an isolated copy. A failure gets one repair attempt, and the build stops after four minutes by default.
  6. The file is committed, then moved into the live folder in one atomic step.

The build pipeline: every gate runs away from the live game, and only Publish crosses into it

The running game has a second wall. Each patch runs in a Worker inside a sandboxed iframe, with no access to the page, network or storage. It can only send requests over a private channel. The host checks each action against the manifest, clamps numbers, and allows 20 actions per batch and 60 per second. A patch that crashes or stalls is switched off while the game keeps running.

The patch sandbox: a patch can only ask, and the host decides

The stack: TypeScript, Node, a Vite 7 plugin as the local server, Phaser 3.90, and Zod for manifests. Twitch EventSub, the Chat API, Channel Points and Predictions connect the stream, and OBS broadcasts it. In-game art is drawn in code and all sound is synthesized. Vitest and Playwright run more than 200 automated tests. The architecture docs have all five diagrams.

Challenges we ran into

  • Changing a game without restarting it. Each patch needed its own Worker and clear ownership, so removing one takes only its entities and settings. Rollback also had to reverse score and edits, without dropping a crowd of removed enemies back onto the player.
  • Trusting neither viewers nor generated code. A pitch is untrusted input to a coding agent, and its output is untrusted code. That is why the build and the running game each have their own limits.
  • A real failure on the real stream. Our first build on the demo stream stopped at the sandbox check. The game kept running, the idea went back in the queue, and the viewer's bet was refunded. The same idea shipped in the next round.
  • One PC doing everything. Playing, streaming, recording, running Codex and a test browser together makes timing unpredictable. We tuned the deadlines, but a patch still missed one on the demo stream and was switched off. Reopening Play reloaded it, and we list this in the README's known limitations.
  • Twitch's real-world rules. Bot and broadcaster subscriptions needed separate EventSub sockets. Only app-owned rewards can be refunded, and a broadcaster can't redeem their own reward, so we tested with a second account.
  • Proving the platform claim. Building Lantern Run exposed Arena Survivor assumptions in the engine, including Practice pitches, HUD zones and AI triage context. All of them moved into the manifest or game data.

A failed build on the live stream: nothing shipped and the game kept running

Accomplishments that we're proud of

  • The full loop on a real Twitch stream. On 2 November 2026, using our own accounts, ideas went from a phone in the Twitch app through a vote and approval, into the running game with credit, and out again with !rollback.
  • Patches built during the stream. Two patches shipped in 206 and 103 seconds, and one build failed safely. Fleeing Coins and Bouncing Coins, both pitched in chat, then ran together in one game.
  • Two different games on one engine. A top-down survival game and a one-button runner use the same pipeline, overlay and tools.
  • A demo anyone can run. Practice needs no Twitch or Codex account:
git clone https://github.com/Nikhil0075/live-patch.git
cd live-patch
npm run setup
npm run dev

What we learned

  • A small API gets better results than a whole codebase. One file, one API doc and a few examples gave Codex enough to write working mechanics.
  • Safety works best in layers. The worktree, source gates, smoke test and runtime sandbox each catch different problems.
  • A human gate belongs in a live AI feature. Moderators keep the stream safe, and approval gives viewers a moment to wait for.
  • A safe failure doesn't have to stop the show. A visible failed build with refunded bets didn't interrupt the stream.
  • A second game is the real test of a platform. The engine's hidden assumptions only appeared once another game had to fit.
  • Test under real load. Our demo PC found timing problems that quiet test runs missed.

What's next for Live Patch

  • Reliability under load, so a busy PC doesn't switch off a healthy patch.
  • More 2D games and starter templates, so developers can bring a new genre in faster.
  • Better moderator tools, including a dedicated moderator view and access to the AI triage preview.
  • Developer reports showing which mechanics chat pitched, voted for, shipped and rolled back.
  • Shareable saved builds, so viewers can play the version their chat made after the stream.
  • macOS and Linux support for live Codex builds, which currently need Windows.

Built With

Share this project:

Updates

Submission history