Inspiration

I was trying some open source gamedev skills for Codex. They are cool. Codex can make a small browser game in one session. But all the games it made are toys, you play once and close the tab.

Then one day I think of a different thing. When a kid brings back a math test with 2 questions wrong, those 2 questions are the most valuable game content in the world, but only for this kid. Nobody else need that game. That is the idea of Encore.

What it does

A teacher, tutor or parent takes a photo of the test paper. GPT-5.6 reads every question and every answer, and it can tell the difference between "the kid doesn't understand common denominator yet" and "the kid just rushed and made careless mistake". This is the thing tired adults cannot do at night. We tested this on five real papers across math, science, history and language arts. It found all 33 questions and judged all of them right, same as our human answer sheet.

Then it turns the wrong answers into a small hand-drawn storybook adventure. There are seven game types now: cutting pizza for fractions, arranging train cars for ordering, matching cards, sorting on a conveyor, filling bridge gaps, opening treasure chests, putting labels on a diagram. The first question in the game is the kid's own mistake, told again by a dragon called Momo.

The part I care about most: answer wrong in the game, there is no red X. Momo shouts "Encore!" and a new question of the same concept comes in. Try again right now, no shame. And the mistakes of today will come back tomorrow as a review quest.

It speaks four languages (English, Traditional Chinese, Japanese, Korean). Not only the UI, the generated stories and questions come out in the language you pick.

How we built it

Thirty-nine Codex sessions, one session for one feature block, six days from git init to finish (all session IDs are in SESSIONS.md). The most important trick is we wrote AGENTS.md first. It has design rules, architecture rules, "answer keys never enter the iframe", test requirements. So every session start from the same rules, and I only need to write the acceptance criteria.

The architecture is simple on purpose: game templates are fixed and tested code. GPT-5.6 does not write game code at runtime, it only fill a strict content contract with validation. When the output fails validation, the error message is written for the model to read, so it can fix itself in one retry. This saved us many hours.

The answer keys stay on the host side. The game iframe only gets redacted content through a typed postMessage bridge, so even if the model output is weird, the kid can never see the answer inside the game.

Momo and the scene arts are also generated by Codex image gen, through the generate2dsprite community skill. At the end we packaged our "quiz JSON → storybook game" method into a SKILL.md, so other people can reuse it.

Challenges

Three bugs that mock testing will never catch. First, strict structured outputs does not accept oneOf, so our Zod discriminated union had to be changed to normal union. We only found this because we tested with the real API early. Second, if you ask the model to "pick a fun theme", it picks the same theme every time. So we moved the theme choice and number variety to our own code, and give the model constraints instead. Third, when real humans played the games, we found drag and drop bugs that all the synthetic tests missed, like ghost sprites stacking up after retry. Synthetic tests click by coordinates, humans click by what they see.

Every time, we pasted the raw error back to the same Codex session, and it fixed itself and added the regression test.

What we learned

Codex works best when the prompt is like a spec with clear definition of done, not like a wish. The model will converge to the most obvious answer, so the variety must come from your own code. One more thing: AGENTS.md kept 39 sessions consistent without me repeating the rules every time, and that mattered more than the speed of any single session.

What's next

Handwriting-heavy papers, more subjects not only math, a class view for teachers to see which concept the whole class is stuck on, and printing the finished adventures into a real bedtime storybook.

Built With

Share this project:

Updates