So you forgot how your code worked... hold my beer
I'll go one better
While trying to write some code to interface with a particularly fussy CNC spindle controller, I did what all normal humans do, searched online to see if someone had already solved the problem.
Found a repo that did almost EXACTLY what I was trying to achieve and started copying. Half way through I started to get a vague sense of deja vu and checked the name of the repo, it was my own!
I'd written code to do the same thing about 5 years previously and had completely forgotten.