Development instance — data may be reset at any time

oai

How it works

oai is a platform for vibe-coding and sharing turn-based games. You describe a game, a coding agent writes it, and the platform runs it.

Games run on a custom runtime. Backend code runs in a sandbox on our servers, and an SDK gives every game AI agents, image generation and more. Every turn is recorded, so any session can be rewound to an earlier turn, with state, agent conversations and clock all restored together. Published games can be played, remixed and built on by anyone.

01

From prompt to game

You tell the platform's coding agent what game you want, and the platform builds and runs it for you.

The coding agent on a phone: a prompt asking for a character to chat with, whose portrait changes with their mood; the agent’s plan; a “Built your game” card; and a Play button for “The Margin — Chat with Juniper”.
Coding agent
The finished game on a phone: a generated portrait of Juniper Vale, a mood badge reading Curious, and a short chat in which her mood changes from Content to Curious.
Generated game

The runtime

Every game runs on the platform. Its backend runs in a sandbox on our servers, both halves are written against the platform’s SDK, and every turn is recorded so it can be rewound.

02

What a game is made of

Follow one player input from the screen to the sandboxed backend and back. Press Next to step through it.

Turn on JavaScript to step through the walkthrough.

Game architecture, revealed step by stepA game has state. Every play session keeps a state: what is true right now, as any JSON value the game code chooses. This game stores the character’s mood and the id of their current portrait image.SHARED SESSION DATAPERSISTED BY THE PLATFORMStatemood: "calm"portrait: "m_4c19a7"secondsWaiting: 12Game historyThe sequence of events.YOUR BROWSERFrontend · ReactMood: calmCHATWho are you?Just a traveller, resting my feet.Nobody stops here.Mind if I sit?Not at all. Company at last!Type a message…PLATFORM SERVERBackend · Sandboxedasync onEvent()Process one input at a time.onTick()Update on the game clock.IOAgents · Images · Notify · RandomSchedulerinvokes onTickrender staterender eventsinput eventawait IOupdateemit outputupdateemit input
01 / 15

A game has state.

Every play session keeps a state: what is true right now, as any JSON value the game code chooses. This game stores the character’s mood and the id of their current portrait image.

SESSION DATAStateSTORED BY THE PLATFORM · NOT GAME CODE
{  "mood": "calm",  "portrait": "m_4c19a7"}
03

History and rewind

A session’s history is a chain of turns, each one an input event and everything it caused. The built-in Chat shows the chain, and any turn on it can be rewound to or edited.

A branching session timelineA timeline runs from left to right. An arrow rewinds from its old endpoint to an earlier point, where a new path branches off and continues into the future.rewind

↶ Rewind

Back to any turn.

Rewinding restores the game to an earlier turn. Game state, the agents’ conversations and the game clock all go back together, and play continues from there.

✎ Edit

Fix what a character said.

If an agent’s reply was wrong, open that turn and edit the reply, or have it regenerated. The turn runs again with your version and play continues from there.

The Juniper game on a phone with a turn’s menu open and the rest of the screen dimmed: the turn’s number, time and cost, then Edit block, Rewind to end of block and Open raw data.
A turn’s menu
The turn editor on a phone: the input event as JSON, the message Juniper was sent, her JSON reply with its text, mood and expression, a Recalculate button, and the turn as it appears in the chat.
Editing a turn
04

Agents

An agent is a named conversation with a model, declared in the backend with its own system prompt, model, tools, and compaction and topic settings. Game code decides when it speaks and what it is told.

Send and add

agent.send posts new messages and asks for a reply, keeping both. agent.addMessages appends to the conversation without calling the model. A send with no messages makes the agent respond to what it already has, which is how a scene with several characters takes turns. An agent configured with a responseFormat schema replies with validated data instead of text.

Tools

A tool is a description, a schema and an execute function. An agent lists the tools it may call, and execute writes game state itself, so a character offering a quest is code changing the world.

Compaction

Compaction is on by default: when an agent’s history outgrows its token budget, the older part is summarised in a separate call. With topics configured, that summary is divided into topics, described in the next section.

Transient sends

A transient send keeps nothing, neither what it posted nor the reply. The reply is itself a message, tool calls and topic openings included, and addMessages accepts it as is. So a game can pass a one-off instruction, or draft a reply and check it, then keep only what should stand.

05

Agent memory

Normally, when an agent’s context window fills up, compaction summarises the history so far, and the new context window starts with that summary.

With topics configured, the summary is divided into topics, each with a name. A topic is usually something the game cares about, such as a character, a place or an item, and holds a short description and a summary of everything that has happened involving it.

One agent’s context window, divided into topicsTime runs left to right, from one compaction to the next. Captain Morrow and Sheriff Dawson start in the context window. The agent opens The Lighthouse, then The Rusty Anchor, and inside the context their colours mix with the conversation. At the compaction the colours separate again: Sheriff Dawson and The Lighthouse move out of the context, and Captain Morrow and The Rusty Anchor stay in. The Mayor is never opened.previous compactioncompactionopen_topicThe Lighthouseopen_topicThe Rusty AnchorCONTEXT WINDOWThe LighthouseSheriff DawsonCaptain MorrowThe Rusty AnchorThe Mayorturns

At each compaction, the summariser updates the topics that were open, and can also close topics that no longer matter. This is where the power lies. A closed topic’s summary is left out of the new context window, but its name and description stay listed, and the agent can bring it back at any time by calling open_topic, which returns the summary.

Topics are configured through prompts. The compaction prompt says what counts as a topic, what keeps one open, and what its summary should hold. The agent’s prompt can say when to open one. A game can also seed the topics an agent starts with.

Fast and efficient

An agent never spends a tool call keeping its topics up to date, so there are no extra round trips to the model. Summaries are rewritten during the compaction that runs anyway. In our tests, this cut the agent’s output tokens by about 40% compared with having it write its own notes.

KV-cache optimised

Cached input tokens cost up to 20 times less than fresh ones, so topics are designed never to invalidate the cache between compactions. Opening a topic adds a message to the end of the conversation, and the summary at the start changes only when compaction runs.

Rewind-compatible

Topics are recorded with every turn, so they rewind with the game, along with its state and clock. Editing an earlier turn takes them back to that point too.

Easy for agents

We tested several memory designs against each other on the same game. Topics came out ahead on every measure: the agent had the right topics in view more often, missed fewer that it needed, and cost 20–28% less to run.

06

Image generation

A game can generate images while it is played. It calls generateImage with a prompt and gets back a media id at once; the picture is drawn in the background and appears the moment it is ready, so the turn never waits on it.

Juniper, a bookbinder in round brass glasses and an indigo cardigan, smiling gently over a mug of tea in her rain-lit workshop
Reference
The same portrait of Juniper, now grinning with one hand open in delight
Excited
The same portrait of Juniper, now with a furrowed brow and one palm turned up in worry
Concerned

Fast and cheap

A 1024×1024 image with no references is back in as little as three seconds on a warm server, and typically within six. It costs one credit, which is between 0.4¢ and 1¢ depending on the plan. Asking for the same image again returns it at no charge.

Consistent characters

A prompt can carry up to ten reference images from the game. They fix a character’s face, outfit and style, so the prompt states only the change: here The Margin draws Juniper’s new mood from her one reference portrait each time it shifts. Several references compose into one frame, so two characters can share a scene.

07

Time

A game reads the date and time from state.now, and runs in one of two modes. In wall time the clock is the player’s real one. In game time it is the fiction’s own clock, which opens at a moment the game chooses and advances only while the game runs.

Wall timeGame time
Follows the player’s real clock–
Pauses while the game is suspended–
Rewinds with a rewound turn–
Supports fast-forward–
Use it forCompanions, pets, care loopsRPGs, board games, suspendable stories
08

Across devices, and while you’re away

Each playthrough is a session that runs on our servers. Your screens are windows into it, so it carries on when you switch devices, or close them all.

One session, across your devices

Open the same session on your phone, laptop or another browser tab, and each screen receives the same game state and history as they change. Start on one device and continue on another, or keep several screens open together.

Your game sessionRuns on our servers
Your phone
Your laptop
Another tab
Different screens. The same session.

Keep playing while you’re away

Because the session runs on our servers, a game that supports background play can keep going after you close every screen: a pet growing hungry, a garden growing, or characters carrying on a conversation. With your permission, it can run for up to 48 hours after you leave, within your spending limit.

You control whether it runs while you’re away. See background play and spending controls.

Know when something happens

A game can reach out when it needs your attention: your garden needs water, something is ready, or a character has news. Notifications appear in your inbox across games, and you can enable push notifications on your device to hear from the game while you’re away.

The Margin’s settings panel on a phone: Background play and Notifications toggles under Permissions; under Spending, the account balance, a per-game spend limit of 50 credits with 9.6 used, which pauses the game at the limit; and Add to Home Screen, needed for notifications on iPhone.
A game’s settings

Building and sharing

How a game changes after the first prompt, and how it travels once it’s published.

09

The coding agent

Ask for a change whenever you like, and the coding agent makes it. It reads and writes the game’s source, and it can look inside the game you’re playing: the state, what each character said, and recent turns with their logs.

Ask→Read the docs→Change the code→Typecheck→Build→Your game updates

It sees what you saw

Say “Juniper forgot my name” and the agent can open the turn where it happened, read the messages and logs, and fix the cause. You describe what went wrong in your own words; it finds out why.

It reads the manual

The agent sees an index of the platform’s guides and reads the ones it needs as it works, so it follows proven patterns and avoids known pitfalls. They’re the same guides you can read in the docs.

Every change is checked

After a change the platform typechecks, feeds any errors back to the agent to repair, builds, and saves a revision.

Your game updates in place

A revision that keeps the state’s shape hot-swaps into the running session with its state intact. One that changes it leaves the session on the old revision and offers a restart. Updating your copy and publishing an update for others are separate actions.

Bring your own agent

Build with the AI you already use

Connect Claude, or any agent that speaks MCP, and sign in. It gets the same tools as the built-in agent, and a few more: it can start a session and play the game itself, so it tries out its own changes before you do.

https://oai/mcp
10

Playing and remixing

Playing a published game gives you your own copy of it, crediting the original. The coding agent sits beside it, ready when you want to change a rule, a character, or the whole premise.

Find a game→Play your copy→Make it your own→Publish it for others

Mix games together

Name any published games and say what you like about each. The agent copies the code that already works, with the comments that record its pitfalls, instead of rediscovering them from scratch. Every game it draws on is credited under “Inspired by”. It sees their published source only: never anyone’s conversations, sessions or drafts.

Murder on the NightlineA mystery proven consistent before you board
The MarginA portrait that changes with her mood

You ask

“A murder mystery like Murder on the Nightline, where each suspect’s portrait shows how they’re feeling, like Juniper’s in The Margin.”

Inspired by Murder on the Nightline · The Margin

11

Publishing

Publishing puts your game on Explore and your profile, where others can find it, play their own copy, and build on it.

  • Your game

    The MarginJuniper, a bookbinder in a rainy seaside workshop
    • The Lighthouse KeeperA new companion, the same mood portraits
      • Two KeepersA second keeper, and they talk to each other
    • La MargenJuniper in Spanish, for learners
    • Faces on the NightlineSuspects whose portraits show how they feelAlso inspired by Murder on the Nightline
Every game built on yours lists it under “Inspired by”, and your game’s page lists the games it inspired, so players can follow the family both ways.

A snapshot, not a live link

Publishing pins the version you chose. Keep changing your game in private, and choose Update post when you want players to have your latest. Anyone who already has a copy keeps the one they started with.

Your process stays private

Others can play your game and build on its source. Your chats with the coding agent, your sessions and your unpublished changes stay yours.

Sharing costs you nothing

Each player plays their own copy on their own balance, so a popular game never runs up your bill.

Before it goes up, a game needs a title and a category, and it passes a content check.

Coming later: comments, likes & recommendations