A few years back I was pairing with a developer who passed on a really good habit of jotting down thoughts as we paired. We'd always have a stack of post-it notes by our side and as we'd navigate through the code base focused on our current task and test, we'd take note of things that needed to be cleaned.
The interesting thing I noticed about this - sometimes these notes would give us the breadcrumb trail we needed to get right back on track.
Every developer worth their salt should try and live by the boyscout rule. In a big forest of a codebase, it's easy to start tidying up far from the original spot we initially want to start cleaning.
Before you know it, you're in some strange part of the codebase you've never been before and you may ask yourself... how did I get here.
The post-its and scratch pads always kept us from getting lost. They always gave us a way back. We'd jot down our original intent as a marker in the wilderness as we pressed on cleaning. When we felt comfortable, we'd pop these items off our stack one by one, sometimes adding a few more on only to take them off again as we cleaned. Ultimately this trail lead us back to our original destination.
I still do this. I'm not sure if there's a name for it but I call it Hansel and Gretel programming. It helps :)