You know that feeling when you walk into a room and immediately forget why you came in? Maybe you were there to fetch your keys. On your way to the room, you were thinking about grabbing your keys. But once you arrive, your keys have completely disappeared from your mind.
This is sometimes known as the doorway effect, since it often strikes when you walk into a new room. Why does it happen? The answer has a lot to do with a faculty called working memory. Information gets stored in working memory when we need it for the tasks that we are engaged in right now (like remembering to grab your keys).