@superflippy @inthehands it depends on what you are starting from. Sometimes it can be a lot easier to understand the problem that it's trying to solve and approximately how its solving it, and then just rewriting that from scratch.
I'm afraid that AI slop code is going to strongly trend towards this "reverse engineer business requirements, then rewrite" end of the spectrum.
I know the feeling you are talking about: I've cleaned up code both professionally and for personal satisfaction. Unfortunately (unless you have a _very_ understanding client) spending the time to properly disentangle commercial code is often a dicey proposition, it's more like you sneak in obvious improvements when you can, and hopefully things are stable enough over time that things eventually get better. (lol)
But the stuff done for personal satisfaction, those have often been puzzles I've occasionally thought about over years before a way forward occurs to me.