Small files beat big files.
My main file hit eight hundred lines and the model started losing the plot. It would fix the top of the file and break the bottom. It would forget a function it had written twenty lines earlier and write a second one with a different name. It would tell me a feature was done, and the feature was there — in a version of the file from three prompts ago that no longer existed. The code was not hard. The file was just too big for anyone, human or model, to hold in their head at once.
A big file is a junk drawer: everything technically in one place, nothing findable. The model works best when it can see the whole job in one look — one file, one purpose, start to finish. When the file is small, the model reads all of it, remembers all of it, and its edits land where they are supposed to. When the file is huge, it reads the part you pointed at and guesses the rest, and the guesses are where the bugs live.
Now I split before I prompt, not after. The form lives in one file, the save logic in another, the display in a third. Each one small enough to paste whole, each one doing one job. It feels like more files to manage, but it is fewer surprises: when something breaks, I know which file to open, and so does the model. And when I ask it to change one thing, it changes one thing, because there is only one thing in front of it.
If the model keeps forgetting your code, the file is too big. Cut it in half, give each half a clear name, and watch the model get smarter overnight. It was never the model. It was the drawer.