June 23, 2026 · 8 min read
"It Was Working Yesterday!": Taming AI Context Degradation
Day 1 the AI is a genius. Day 15 it rewrites your core logic to change a button color. Why context degrades and how to keep an AI codebase maintainable.
By Launched team
On Day 1, the AI was a wizard. Two prompts, full feature. On Day 15, you asked it to change a button color and it rewrote your authentication logic, deleted a route, and renamed three database columns. Nothing about your prompts changed. Something about your codebase did.
Context degradation is a function of size, not time
It feels like the AI got worse. It didn't. Your codebase got bigger than the AI's effective context. Once the model can't fit the relevant files into its working memory, it stops reasoning about your project and starts pattern-matching against everything it's ever seen. That's why "change a button color" becomes "rewrite the file I happened to be looking at."
The symptoms, in order of progression
- Day 1–5: Prompts produce surgical changes. Life is good.
- Day 5–10: Small features start touching files they shouldn't. You don't notice yet.
- Day 10–15: Cosmetic changes regress functional code. You start saying "it was working yesterday."
- Day 15+: Every prompt is a risk. You stop asking for changes. The project freezes.
What keeps an AI codebase maintainable
1. Small files, single responsibility
The agent can hold a 200-line file in mind. It cannot hold a 2,000-line file in mind. Split aggressively. One concern per file. Boring, fundamental, ignored by every cloud builder.
2. Stable, descriptive file paths
The agent uses paths as memory. src/features/billing/checkout.tsx is searchable. src/pages/page-3-v2.tsx is not. Rename early; rename often.
3. A README the agent will actually read
Top-level README with the architecture in five bullets. Folder-level READMEs for non-obvious sections. The agent reads these when you point at them.
4. Tests as context anchors
You don't need TDD. You need a handful of tests that describe what the critical paths do. The agent reads them and stops accidentally breaking them.
5. A human review gate on anything stateful
Database migrations, auth changes, payment logic — never merge an agent diff in these areas without reading it line by line. The agent's confidence is not calibrated to the blast radius.
Where Launched comes in
We do "AI codebase rehab": take a project that's hit the context cliff, refactor it into small files with clear paths and a README the next agent (or human) can actually use, and hand it back maintainable. Book a 20-minute call. Related: Outgrown your platform, Own your build.
