-
-
Live Patch turns a Twitch stream into a live game studio: chat designs the game, Codex builds it, and you keep playing.
-
One saved build, side by side: the original game, and the version changed by patches pitched in Twitch chat.
-
Codex built the engine, both games and the tests in reviewed phases. Clone the repo and try Practice with no accounts.
-
The streamer can open a Channel Points prediction, and viewers bet from the Twitch app on whether the patch ships.
-
A shipped patch is credited on stream to the viewer who pitched it, in the toast and the Live Patches list.
-
A moderator types !rollback and the latest patch comes out of the game, with confirmation in chat and on the overlay.
-
This stream's first build stopped at the sandbox check. Nothing shipped, the game kept running, and bets were refunded.
-
Codex writes the patch in its own offline Git worktree. The stream shows each step while the game keeps running.
-
A real viewer pitches a mechanic with !idea or the Pitch channel-points reward, and it appears on the stream overlay.
-
Nothing builds until a moderator approves the winner, from the Go Live dashboard or with !approve in chat.
-
Patches stack: Fleeing Coins and Bouncing Coins, both pitched in chat, running together in one game.
-
The three oldest ideas go on a 45-second ballot. Votes typed in chat move the bars on the overlay.
-
Lantern Run, a one-button fox runner, is the second game on the same engine, with its own hooks and actions.
-
Each game is a folder with a manifest. Choose the active game in the Library, and the same pipeline patches it.
-
The full loop: Twitch chat, local server, sandboxed Codex build, gates and smoke test, then into the running game.

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.

For viewers
- Pitch a mechanic with
!idea <mechanic>, or redeem the 1-point Live Patch Pitch Channel Points reward. - Vote with
!vote 1,2or3and 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,!rejectand!rollbackwork 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.
!rollbackremoves 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.

For streamers
- Easy onboarding.
npm run setupchecks 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.jsonmanifest 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.

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:
- It creates a dedicated Git worktree with no network, shell, web search, apps, plugins or MCP access.
- It confirms that writing inside the worktree works and writing to the main repository fails.
- Codex receives the approved idea, the game's API docs and example patches. Viewer text is marked as untrusted data.
- Only one new file is accepted, up to 120 lines and 12 KB, and a source scan rejects banned names such as
fetchanddocument. - 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.
- The file is committed, then moved into the live folder in one atomic step.

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 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.

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
- codex
- codex-sdk
- css3
- esbuild
- git
- html5
- javascript
- node.js
- oauth2
- obs-studio
- phaser.js
- playwright
- twitch
- twitch-eventsub
- typescript
- vite
- vitest
- web-audio-api
- web-workers
- webgl
- websockets
- windows
- zod