What it does
An AI hero plays a pixel game nonstop. You type any change (a dragon, fire breath, a pistol, flight) and a Game Master AI (Claude Sonnet 5) writes it into the real game in seconds, with new creatures, abilities and sprites. The player isn't told what changed. It has to find out by playing.
How it works
- World model: an LLM (GPT-OSS-120B on Cerebras, ~2 s) keeps an executable world model, a small JavaScript program that predicts what each action will do.
- Reality check: every move, the prediction is compared with what actually happened. Wrong predictions are surprises.
- Action choice: TypeSafe's Jev picks each action through a goal > kind > action hierarchy in one ~0.5 s call, using the world model's preview of every option. New abilities, like a pistol, show up as new tools Jev can pick.
- Learning: when it loses a round, it thinks once about everything that surprised it, rewrites its model, and plays again.
One number on screen, "understands its world", is the share of its last 20 predictions that came true. It crashes when you gaslight it and recovers as it learns (e.g. 90% → 0% → 70% across dragon, fire-breathing dragon, pistol).
How we built it
Node.js server + canvas front end. The Game Master and the player never share context: the player only sees observations, so its world model has to be earned from evidence. The Game Master also checks that every level stays winnable after a change.
Challenges
Keeping levels winnable after arbitrary rule changes, and making the agent adapt fast without calling a big LLM at every step.
Try it
Code and run instructions: https://github.com/Eugene4JD/gaslight-the-ai
Built With
- canvas
- cerebras
- claude
- gpt-oss
- javascript
- jev
- node.js
- openrouter
Log in or sign up for Devpost to join the conversation.