How to Set World Rules and Lore Your AI Will Not Break
Write a short list of what is possible in your world, what it costs and what can never happen, and have your AI turn that list into rules in a model. A checker then walks every path and shows you the exact scenes where a new item or quest breaks your world.
Why does my AI keep breaking my world's rules?
In your game, every spell burns one candle. Candles are scarce, so villages fight over wax. That idea carries the whole world.
Then you ask for a quick way across a canyon. The AI adds a flying cloak that needs no candle. The quest is fun, but now nobody has a reason to fight over wax. The AI solved the problem in front of it. It reached for the familiar fantasy answer, and "stick to my rules" did not stop it, because the cloak looks fine on its own.
Which facts and rules protect a world?
A good world rule says what is true and where the limit is. It fits on one line, so it fits straight into a model:
- Every spell burns one candle.
- Nobody can fly, neither people nor animals.
- The dead stay dead.
- News travels by boat and takes three days.
Facts are whatever those rules count or track: spells cast, candles burned, who is where, who has heard what.
Rules apply to numbers too. If wax is scarce, a shop should not sell a crate of candles for one coin.
What is the difference between rules and lore?
- Rules change what can happen in the game. Those go into the model.
- Lore is the background: history, names, old stories. Mark each piece as true or as something people believe. Then a character can be wrong without it being a mistake. Only the true pieces become facts.
What does a real check look like?
Here is the candle world as a model. A spell at the village gate burns one candle. Then the player climbs down a rope or uses the flying cloak, and the cloak casts a spell but burns no candle.
We ran this invented story through TLC 2.19 on 2 November 2026. This is TLC's real output. We only left out its housekeeping lines and put each step on one line.
Error: Invariant EverySpellBurnsOneCandle is violated.
State 1: scene = "Start", spellsCast = 0, candlesBurned = 0
State 2: scene = "Village gate", spellsCast = 1, candlesBurned = 1
State 3: scene = "Flying cloak", spellsCast = 2, candlesBurned = 1
On the path Start, Village gate, Flying cloak, two spells were cast and only one candle burned. That path is the proof that the cloak breaks your world. A player who takes the rope never sees it.
The fix: the cloak burns a candle for each flight, like any other spell. We ran TLC again.
Model checking completed. No error has been found.
10 states generated, 8 distinct states found, 0 states left on queue.
TLC looked at all 8 states the story can reach, and the rule held on every path.
Do I have to read any of this?
No. You never have to read the model or the checker's output, because your AI writes it, runs it and tells you the result in plain words. TLA+ is a language for modelling, and TLC is the tool that checks a model. If TLC cannot run on your computer, your AI can get a ready-made checker through our MCP server and run it in your project. Spielerando never looks at your story.
A pass means your rules held on every path in the model. It does not mean your world is good, and it says nothing about rules nobody wrote down.
Paste this to your AI
Do not just tell me my world makes sense. Model its rules and check them with a tool.
1. Read everything in this project. If you cannot see my files, ask me to paste them.
2. Create story-bible.md if it does not exist. Add a section called World rules, one line each: what is possible, what it costs, and what never happens. Add a section called Lore, and mark each entry as "true" or "people believe". For each entry, name the scene or item it comes from.
3. Write a TLA+ model of the story in a folder called story-check.
- Facts, as state: whatever the rules count or track, such as what has been spent, who is where and who has heard what.
- Steps: every scene, item, ability, quest and shop price, with what it needs and what it changes.
- Rules, as invariants: every line under World rules, and every lore entry marked "true".
4. Run the TLC model checker on the model so that it walks every path. If TLC cannot run here, use get_recipe with story-model-check through Spielerando and run that checker in this project. If you can run neither, tell me, and do not claim that anything was checked.
5. For each broken rule, show me the exact path of scenes the checker found, in plain words, and quote the rule and the line or item that breaks it.
6. Do not change my game yet. Suggest one version that fits for each path and wait for me to pick.
7. After each fix, update the model, run the checker again and show me the result.
From now on, run the checker before you add a scene, item, quest, ability or shop price. Never add a new rule or an exception on your own. If no rule covers something, say "I do not know" and ask me. Report only which rules held, how many states were checked and whether the check was cut off. Never tell me the world is good.
Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP
How to check it worked
- Play the path it gave you. Follow those exact scenes in the game. You should be able to break the rule yourself.
- Ask for a rule breaker. Ask for something that bends a rule. The next check should fail and name the path.
- Look through shops and rewards. Does anything make one of your rules pointless? If so, ask for a new rule.
- Ask a new player. After they play, ask them to explain how your world works. Do they say what you hoped? No checker can tell you that.