Log all your key thoughts, realizations, decisions and taken steps on paper. It shouldn’t be long or long-term clear, only clear to today’s you. Gibberish to a bystander. Text, bullets, arrows, acronyms, verbs, marks, anything that works. Lists, trees, graphs, outlines.
It’s your L2 cache. L1 is fast but short and prone to distraction. If you log everything into L2, then returning to the task becomes much easier, because the whole context is right there.
The downside is you have to spend time drawing. The unintuitive upside is that by writing you may make it clear to yourself what maybe wasn’t clear.
IDE may be good at where you were, but it doesn’t know what you thought.