HeapPlay

Why does a game built with an AI assistant break as it grows?

Each change is made with a partial view and nothing checks the rest. Stop adding features, write down the rules, add checks, then go one task at a time.

It breaks because every change is made with a partial view of the game, and nothing checks the parts the change did not look at. Each fix is sensible where it lands; together they drift. You get control back by stopping new features, saving the last version that works, writing down the rules the game must keep, adding one check for each rule, and then going on one small task at a time, each in a fresh session.

Why does it work at first and then start breaking?

A small game fits in view. When the whole thing is two files, the assistant reads all of it, every change sees every rule, and you can play everything in a minute. As the game grows, both of those stop being true.

The assistant reads part of the code for each task: what the task names and what it finds while searching. A rule kept somewhere it did not read, such as "restart sets the score back to zero", is invisible to that change. The change is correct for what it saw and wrong for the game.

A longer conversation does not fix this. Chroma's report on context rot (14 July 2025) tested 18 language models and found that they became less reliable as the input grew longer, even on simple tasks. The best-practices page for Claude Code says, as read on 4 November 2026, that running out of context is now rare, and still recommends clearing between tasks because a focused context gets better answers.

The other half is you. Once the game is too big to play through after every change, a broken rule waits until someone happens to notice it, often several changes later, when it is hard to say which change did it.

What are the signs that a game is getting out of control?

What you seeWhat it usually means
Fixing one bug brings back an old oneNothing checks the old fix
The same job is done in two places, such as two score countersCode was written again instead of reused, and the copies drifted apart
Each session starts by rediscovering the same factsThe game's rules live only in old conversations
Small requests produce large changesThe parts of the game depend on each other in ways nobody wrote down
"Try again" gives a different result each timeThe task does not say what "done" looks like
You no longer know which version last workedChanges were not saved as separate commits

One of these now and then is normal. Several at once mean the next feature will cost more than the last one, and it is time to stop and take stock.

What should you do first?

Stop adding features. Then find the last version that works, play it, and mark it, so that every step from here can go back to it. If you keep the game in Git, that is a commit or a tag; version control from day one shows how to find and mark it.

If no version works, commit what you have anyway and write a short list of what is broken. That list is the start of the next section.

How do you write down what the game must keep doing?

In a short file kept with the game, which you or the assistant read at the start of every session. Claude Code reads one called CLAUDE.md by itself; other assistants have their own name for it, and a README works for any of them. Write the rules in the player's words, and add how to check them:

Rules the game keeps
- Restart sets the score to 0 and lives to 3.
- Every key has a touch button.
- Saves made in version 0.3 still load.
- All text the player sees is in text.js.

How to check
- Open tests.html: every line must be green.
- Play the route in route.md.

This is an example, not a template: your rules are the ones your game has broken or must never break. Keep the file short. The Claude Code page advises writing down only what the assistant cannot work out from the code, the exact commands that check the work, and anything you have had to correct twice. A long file buries the lines that matter.

How do you add checks without a test team?

One check for each rule, starting with the rules that have already broken. A check is anything that answers pass or fail: a small test that calls the game's code and compares the result, a page that runs those tests in the browser, or a short route you play the same way every time, as in reviewing an AI change.

The Claude Code page puts the reason plainly: without a check, the assistant stops when the work looks done, and you become the test suite. With one, it can run the check, read the failure and try again before it reports.

For a bug, ask for the check first: "write a test that fails because restart keeps the old score; do not fix anything yet". Run it and see it fail. Then, in the next task, ask for the fix and see the same test pass. Read any change to a test file with care; a test changed in the same task as the fix may no longer test anything.

How do you clean up the parts that drifted?

With separate tidying tasks that change no behaviour, one at a time, with the checks run before and after each one.

Start with a task that only reads: "list every place where the score is changed, and every job that is done in more than one place; change nothing". Then pick one item from the list, ask for it to be merged into one place, run the checks, play the route and commit. Then the next. Never mix tidying with a new feature: if something breaks, you will not know which half did it.

How do you keep it under control from now on?

By making every change the same short loop, and keeping the game small enough for the loop to stay short.

A loop of five steps: the rules file, one small task, a fresh session, the checks, a commit, then back to the next task; a failed check goes back to the task
One task per turn of the loop. A failed check goes back to the task, not forward.
  • One task per session. Start a fresh session, or clear the old one, between unrelated tasks, so that old attempts do not crowd the new one.
  • A task that says what done looks like: where the change goes, what must not change, and which check proves it. Writing such a task is the step that saves the most time later.
  • Two failed corrections, then start over. The Claude Code page advises this: a third correction mostly adds another failed attempt for the assistant to read. Start a fresh session with one better task that includes what you learned.
  • A new line in the rules file whenever you correct the same thing twice.
  • A commit for every change that passes.

When is starting again the right answer?

When there is no working version to return to and the list of broken rules keeps growing, or when the game's core idea has changed so much that most of the code serves a game you no longer want. For a small game, starting again can be quicker than repair.

Take the rules file and the checks with you. A new start with the same habits grows the same problems; a new start with written rules and checks from the first day is a different project. Keep it small enough to finish.

Common questions

Will a newer model or a bigger context window solve this? It may make each change better. It does not tell anyone when a rule you never wrote down has broken; only a check does that.

Do I need to learn to program? Not to start. You need to read the list of changed files, run the checks and play the route. Learning the names of your game's main parts makes tasks shorter and answers easier to judge.

How long should the rules file be? Short enough to read in a minute. If it grows long, remove what the assistant can see in the code, and keep the rules and the check commands.

Should the game be split into more files? Files that each do one job make it easier for the assistant to find the right place. Ask for such a split as its own tidying task, with the checks before and after.

When can other people play it? When the checks pass, the route plays through on a fresh page, and a stranger can finish without your help. Then you can submit it to HeapPlay.

ai-assistants workflow testing

Building a game? Submit it to HeapPlay and see what developers get.