When Your AI Forgets the Story: Keep the Facts in a File

The demo is playing itself. Press a key or a button to take over.
A jar moves its village 10 up and the rival 5 down. A tier rises at its border but drops only 5 below it, so a flag does not flicker. A season here is 90 days in a moment, and each day pulls every standing 1 point back toward zero.
Try it: Send jars only east: the west flag turns orange, then red, and its doors shut. Bring the west up to friendly, then send one jar east: its needle dips past the border and the flag stays green; one more and it drops. Let a season pass and watch both needles slide back toward the middle.
← a jar to the west → a jar to the east X let a season pass
A story that lives in the chat is a story nobody can check, and each new scene can quietly contradict an old one. This lesson keeps the facts in one file your AI reads first, with a check for every line, on the game above: two villages that remember everything the beekeeper did, although not one scene in them remembers anything.
Also in this lesson 5 things to read up on 3 questions to check yourself
The idea
This is the last lesson of the course. Every lesson before it turned one part of a story into facts with a check, and this one keeps them all in one place, so that they still hold in the third month of a project and not only in the first week.
The game above shows the shape. Its villages remember what you did, but no house in them remembers anything: each village's standing is kept in one place, and the doors, the flags, the prices and the waving all read it.
A story built with an AI needs the same shape: the facts and the rules of its world in one file that every chat reads before it writes a line, and a check for every line that runs after every change. Then it no longer matters what your AI remembers from last week. An engineering article in the reading list describes the same habit for AI agents: notes written to a file outside the conversation and read back in later.
How it works
Play it, and watch where the memory is. Send jars only to the east, until a heart shows over the east village. Now look west: its flag has turned orange. Keep going, and the flag turns red and the doors shut. Nobody wrote a scene for that. One rule, written once, does it: what helps one village sets the other back by half as much. Then let a season pass. Both needles slide back toward the middle, and the west's grudge fades to nothing, never into a liking.
Write the file this little world needs. Before your AI writes one scene about these villages, the facts go down as short, numbered lines:
- There are two villages, west and east, and each has a standing with the beekeeper.
- They are rivals: a jar for one raises it, and sets the other back by half as much.
- A standing is read as one of five moods: hostile, wary, neutral, friendly, allied.
- A hostile village shuts its doors and pays nothing for a jar.
- A mood rises at its border, and drops only 5 points below it.
- A season pulls every standing back toward zero, and never past it.
"The west is proud and a little old-fashioned" may be true of your story too, but no check can try it, so it belongs in a note on tone. A line that no check can try is a wish, not a fact.
Give every line its check. Next to each line goes a test that fails when the game breaks it. For line 2: send one jar east, and the west must go down by half of what the east went up. For line 6: let a season pass for a village that is cross with her, and its number must stop at zero. The blueprint behind the game has such a test for each of its rules. This course is kept the same way: every number a lesson states about a blueprint is listed with where it comes from, and a test fails when the blueprint's code says otherwise.
A scene names the lines it rests on. When your AI writes a new scene, it writes above it which lines the scene needs: "The elder of the west thanks her: needs the west at friendly or better (line 3)." Now a check can walk the orders in which a player can play, and look for one in which the scene comes while its line says otherwise. For numbers like these, that walk is a test your AI writes. For facts such as who is alive or who holds what, the checker on this site walks them in your browser.
What goes wrong
The shortcut is to let the story live in the chat. In the first week you and your AI agree that the villages are rivals, and that decision lives in one message. In the third week you open a new chat and ask for a warm scene: once the east is her ally, the elder of the west comes to the stall to thank her for the honey. Nothing crashes, and every test of the code passes, because no test knows about the rivalry.
Picture that scene in the game above. Every jar goes east, the heart shows over the east village, the west's flag is orange, and then the elder of the west walks up to thank her. The player who chose the east notices at once. You, who wrote the two parts weeks apart, may never.
You do not need to know how your AI keeps things to see why this happens. A study in the reading list found that language models often used a piece of information worse when it stood in the middle of a long input than near its beginning or end. A decision made weeks ago sits somewhere in the middle of a long chat, if it is in the chat at all. And whatever your AI keeps, you cannot read it or run a test on it. A file you can.
With the file and its checks, the new scene fails on the day it is written. Its header says it needs the west at friendly or better, and the check prints an order of play in which it comes while the west is wary: every jar to the east. Without the file, nothing fails, and a player finds it for you.
Tell your AI
My story must not depend on what you remember between chats. We keep it in a file and check it.
1. Read [the files of my game] and this chat. Write story-facts.md: every fact and rule of my story as one short, numbered line. Next to each, say where you found it: a file and line, or a message of mine, quoted. Mark anything you are not sure of with "ask me".
2. For every line, write a check that fails when the game breaks it: a test per move, or a walk through every order of play with [the checker you use, for example the story-model-check recipe from spielerando.com]. A line that no check can try goes into a list of wishes at the end, not among the facts.
3. Above every scene, write the numbers of the lines it rests on.
4. Run all checks and show me their output, not your summary of it.
From now on:
- At the start of every session, read story-facts.md and run the checks before you write anything. Show me the output.
- When we decide something, add its line and its check at once, not at the end of the session.
- After every change, run the checks again. If one fails, show me the order of play it printed and the line it breaks, and wait for my choice.
- If something is not in the file, say "I do not know". Do not answer from what you think you remember.
Try it
- In the game above, send jars only east until the heart shows, and look at the west's flag. Write the one line of the file that explains it. If no check could try your line, rewrite it until one could.
- Let a season pass while the west's flag is red. Its number stops at zero, and line 6 held. Now a new chat writes that after the winter the west calls her a friend. Which line does that break, and which order of play would the check print?
- In your own game, open a new chat, give it only your facts file, and ask about a decision you made weeks ago. If it cannot quote a line, the decision is not in the file yet.
Read up
Where to go deeper: the pages of ours this lesson builds on, and what others have written about its point.
Why Does My AI Keep Forgetting My Story and Characters?
How to make the tool you use read the file at the start of every session, and a small model that shows why a decision must go into the file at once and not at the end of the day.
What Is a Story Bible, and How Does Your AI Use It?
Every section a whole story file needs, from characters and world rules to open questions, and a check that all the ages and years in its timeline can be true at once.
AI Forgets Context? Keep Game Decisions Across Chats
A short handover note for what is not story: the rules of play you decided, what is half done, and the features you removed, so that no new chat brings them back.
Lost in the Middle: How Language Models Use Long Contexts
A study of how language models use a long input: in its tests, a piece of information in the middle was often used worse than the same piece near the beginning or the end.
Effective context engineering for AI agents
An engineering article on AI agents that keep notes in a file outside the conversation and read them back later, and on why recall gets worse the more text the model has in front of it.
Check yourself: three questions
Each answer is checked and explained at once. The questions are part of the quiz, so they count for your Game Coder IQ like any other.
In the village game of this lesson, you send jars only to the east. Nobody wrote a scene in which the west turns against you, yet its flag turns orange and later its doors shut. Why?
How useful was this page?
Nobody has rated this page yet.