The thought that arrives at the wrong time
You sit down to work on something, and a moment later you remember a message you meant to send, or wonder what the capital of somewhere is. Following the thought feels harmless. It is also an easy way to lose the thread of what you were doing.
Pushing the thought away can be tiring in its own way. You might try something gentler: give it somewhere to wait.
A parking space for ideas
Keep a scrap of paper or a sticky note next to you. When a stray thought turns up, write a few words, such as 'reply to Sam' or 'look up that song', and go back to what you were doing.
The note does not have to be tidy. It only has to be a place where the thought is safe, so you do not need to hold it in your head.
Try it for one session
Next time you work on something for twenty or thirty minutes, put the paper beside you first. When the session ends, glance at the note. Some items will matter and some will turn out not to.
Then ask yourself: did the note change how easy it was to stay with the task? If it did not help, that is useful to know too, and you can try another way.

