I have had an experience where cursor has been coding in PHP and then randomly, out of the blue, with no prompt from me, start coding in Ruby, or C, or any other language except the target language. This also goes hand in hand with it responding in a completely different langauge other than mine > english.
I don’t know if the two are related but if this starts happening to you, make certain that your backup of any code is up to date before you allow cursor to make any changes.
Hey, a few things are already built that already avoid this:
- Use git for your projects - makes it easier to discard changes, revert to a previous state
- Use Cursor’s undo feature - whenever cursor makes changes to a project (provided you’re using the IDE, im not sure about the cmdline), it will show you the changes it made and ask you if you want to keep all the changes or undo them. You can use the undo
- Use git worktree
Also could you mention which country are you using the model from, and which model are you using? I’m curious about the language thing as I’ve never seen this before apart from the Deepseek model in the past.
Git is great but there is no security like having backups on a couple external drives. Check out 7-zip to help with backups. 