Sometimes when driving or doing something monotonous, a great thought will pop into my head. However, two minutes later, when I reach for my phone, I forget the thought.
Another scenario is when meditating. Sometimes an amazing idea pops into my head, but I forget right after the meditation session is over.
My question is - How can I remember these thoughts long enough to write them down? Also, what is the basis for this kind of intelligence - working memory, short term memory, etc.?