Hello eclair: I'm sorry you are struggling with this.

I'm going on 70 years old!

And I want to tell you that I have SO MANY bad memories of things I've done wrong in the past that there's simply no end to them. It's like being stung by a never-ending swarm of bees!
I wish I could tell you that I found a cure for this never-ending onslaught. But I haven't.

The best remedy I have found is the Buddhist practice of compassionate abiding. Here's a nice mental health oriented description of the practice:
https://mindsetdoc.wordpress.com/201...e-abiding-101/
What I find, in my own life, is that the best I can do is to allow those bad memories to be there (they're going to be anyway.)

I then breathe into them, smile to them, perhaps even put my hand over my heart as a sign of compassion for them, & be with them until they fade of their own accord. They come back, of course. But by continuing to abide with them in the way I've described, their power does diminish a bit over time. And, perhaps more importantly, this practice teaches us that it is possible to dwell with this kind of sorrow & still maintain our emotional balance... our equanimity if you will.
Also... here's a link to an article on the subject of intrusive thoughts from the PsychCentral archives. Perhaps something in it may be of some help too:
https://blogs.psychcentral.com/socia...sive-thoughts/
My best wishes to you...