When the AI keeps breaking a working feature
A feature that keeps breaking is a feature whose rules live only in your head. Write them down, ask smaller, and restore instead of patching.

Key takeaways
- Big, mixed requests are the top cause: the agent touches shared code to satisfy the new part and changes behavior you relied on.
- Name what must not change in every risky request, and keep a feature's rules in project knowledge so they persist.
- When a change breaks something, restore or undo to the last good version and re-ask, rather than patching forward.
- Check the diff of each turn and keep a short manual test list for the features you care about.
When an AI builder keeps breaking a feature that used to work, the usual reason is that the request was bigger or vaguer than it looked: to add the new thing, the agent edited shared code (a data shape, a layout, a helper several screens use) and nothing told it which existing behavior had to stay exactly as it was. The fix is practical, not magical: ask for one change at a time, say explicitly what must not change, keep the feature's rules written down where every future turn sees them, and when something breaks, go back to the last good version and ask again instead of stacking fixes on a broken state.
Why working features break
An AI agent sees your request and the parts of the code it reads for it. It does not remember that last Tuesday you spent an hour getting the discount to apply before tax, unless that rule is in the code clearly, in a test, or in its instructions. So most regressions come from a few patterns:
- Mixed requests. "Redesign the checkout, add coupons and fix the mobile menu" touches three areas at once. Each has a chance to disturb something.
- Shared code. A change to how orders are stored, or to a component used on five screens, ripples everywhere that uses it.
- Unwritten rules. Behavior you care about (rounding, ordering, who can see what) exists only as code, so a rewrite that "cleans up" can drop it.
- Patching forward. After a break, three more "fix it" turns pile workarounds on top of the problem, and the original working logic gets lost.
- Vague success criteria. "Make the leaderboard better" invites changes you did not ask for.
Fix 1: ask for one change at a time
Split work so each turn has one goal you can check in under a minute. Startbase's own troubleshooting advice recommends a build order of layout, database, auth, feature logic, then features one at a time. After each turn, test the new thing and the one or two features nearest to it, then move on. It feels slower and is much faster than untangling a turn that changed 14 files.
For anything larger, start in Plan mode, which is read-only by design: the agent reads your files and proposes a plan without editing anything, and you can refine the plan before building (Plan mode docs). Reading the plan is where you catch "I will restructure the cart" before it happens.
Fix 2: name what must not change
The single most useful sentence in a risky request is a list of things that must stay identical. Be concrete: behavior, not vibes.
- Weak: "Don't break anything."
- Strong: "Do not change how totals are calculated: discount applies before tax, tax is 8.25%, totals round to 2 decimals at the end. Do not change the order table columns."
The Startbase debugging guide has a ready pattern for critical areas such as authentication and payments: tell the agent to examine related code first, not touch unrelated components, explain its reasoning if unclear, and verify nothing else breaks (debugging prompts).
Fix 3: write the rules where every turn sees them
Rules you repeat in every message belong in the project's Knowledge, opened from the project menu: everything there is remembered and applied across your project (custom knowledge docs). Keep a short "protected behavior" section with three to ten lines, for example: "Free users can save 3 projects. Leaderboard ties break by earlier time. The booking calendar never shows past slots. Do not rename database columns without asking."
You can also ask the agent to write a small automated test for each protected rule. A failing test is a much louder alarm than you noticing a week later.
Fix 4: restore instead of patching forward
When a turn breaks something, the cleanest move is usually to go back. Startbase saves a version after every build; Versions lets you preview any of them and restore one, and restoring saves your current files as a version first, so nothing is lost. From the chat, Undo on a turn's receipt rolls back that turn, Revert goes back to before a message, and Edit & Revert lets you rewrite the message and send a better prompt from that point. View diff shows exactly what a turn changed (versions docs). Bookmark the version where everything works, so it is easy to find later.
Fix 5: check each turn in two minutes
- 01Read the turn's summary and open View diff. Files you did not expect to change are a red flag.
- 02Test the new change.
- 03Run your short manual list: the three to five flows that must always work (sign in, add to cart, pay, save progress, whatever matters in your app).
- 04If something broke, undo now, while the cause is one turn old.
A typical regression, step by step
A recipe app has working favorites. You ask: "Add folders, make the cards prettier, and let people share recipes." To support folders, the agent changes how a saved recipe is stored, from a list of recipe IDs to a list of objects with a folder field. The new folder screen works. The old favorites screen still expects plain IDs, so it shows nothing. You say "favorites are broken", and the fix converts data on the fly, which then breaks sharing. Three turns later, nobody is sure what the data looks like.
The better path: restore the version before the request. Ask for folders alone, with "keep existing favorites working and migrate saved favorites into a default folder". Check favorites and folders. Then ask for the card redesign as its own turn, with "visual changes only". Then sharing. Three small turns, each checkable, and the storage change happens once, on purpose.
The message to send the agent
After restoring the last good version, re-ask with a fenced scope:
Add a coupon code field to checkout. Scope: only the checkout page and the order total function. Do not change how totals are calculated for orders without a coupon (discount before tax, tax 8.25%, round at the end), the order table columns, or the mobile menu. Before editing, tell me which files you will change and why. After the change, check that an order without a coupon gives the same total as before, and write a test for that. If you need to change anything outside the scope, stop and ask me first.
For a feature that broke repeatedly, add one more line: "List every change we have made to this feature and why it broke each time." That question, also from the debugging guide, often reveals the shared piece that keeps getting rewritten. More techniques live in how to fix bugs with AI and checkpoints and undo.
Frequently asked questions
Why does the AI change things I did not ask it to change?
Usually because the request touched shared code, or was broad enough to invite extra changes. Ask for one change, name what must stay the same, and ask it to list the files it will edit first.
Should I keep asking it to fix the bug it introduced?
One or two tries is fine. After that, restore the last working version and re-ask with a smaller, clearer request. Patching forward tends to bury the original working code.
How do I make the AI remember rules about my app?
Write them down where every turn reads them. In Startbase, project Knowledge is remembered and applied across your project. Automated tests for key rules add a second line of defense.
Will restoring a version lose my recent work?
Not in Startbase. Restoring saves your current files as a version first, so you can return to them. A published site keeps running its version until you republish.

