What about adding a Smart Context Management Option? When selected, cursor periodically reviews the entire chat context with a prompt like:
“Review our entire chat context and summarize what we’ve done and our current main goal. Then delete from the chat context the parts you summarized or that are irrelevant. Prioritize keeping more recent context, but make sure to keep track of the overall goal we’re working towards in this chat session.”
I basically type this already every so often to keep cursor on track. Otherwise, eventually the context window runs out and our main goal falls out of the back of Cursor’s head, and it starts going nuts and chopping hunks of important code out in it’s suggested changes. You can verify this by occasionally asking it what our main goal for the day is. It goes from “Building validation system for pdf chunk processing” to “Lets fix all the bugs in your schema from these new fields (for that new pdf validation) you added that don’t match our existing code, and then change back your schema”. The worst part currently is that if I forget to have it summarize occasionally, it silently forgets our goal (due to context limits or confusion within long context) and if I’m not watching suggested changes like a hawk, it deletes important code and sometimes even starts devouring it’s own previous changes like a snake eating it’s tail.
This usually happens when I’m 90% done with a major feature implementation or refactor, but I’ve run into bugs towards the end. While attempting to fix those bugs, we hit context limits and it starts destroying our implementation right before it’s finished and I have a chance to test it all out. So brutal.