Forgetting why you entered a room is called the “Doorway Effect”, and it may reveal as much about the strengths of human memory, as it does the weaknesses, says psychologist Tom Stafford.

We’ve all done it. Run upstairs to get your keys, but forget that it is them you’re looking for once you get to the bedroom. Open the fridge door and reach for the middle shelf only to realise that we can’t remember why we opened the fridge in the first place. Or wait for a moment to interrupt a friend to find that the burning issue that made us want to interrupt has now vanished from our minds just as we come to speak: “What did I want to say again?” we ask a confused audience, who all think “how should we know?!”

Although these errors can be embarrassing, they are also common. It’s known as the “Doorway Effect”, and it reveals some important features of how our minds are organised. Understanding this might help us appreciate those temporary moments of forgetfulness as more than just an annoyance (although they will still be annoying).

These features of our minds are perhaps best illustrated by a story about a woman who meets three builders on their lunch break. “What are you doing today?” she asks the first. “I’m putting brick after sodding brick on top of another,” sighs the first. “What are you doing today?” she asks the second. “I’m building a wall,” is the simple reply. But the third builder swells with pride when asked, and replies: “I’m building a cathedral!”

Maybe you heard that story as encouragement to think of the big picture, but to the psychologist in you the important moral is that any action has to be thought of at multiple levels if you are going to carry it out successfully. The third builder might have the most inspiring view of their day-job, but nobody can build a cathedral without figuring out how to successfully put one brick on top of another like the first builder.

As we move through our days our attention shifts between these levels – from our goals and ambitions, to plans and strategies, and to the lowest levels, our concrete actions. When things are going well, often in familiar situations, we keep our attention on what we want and how we do it seems to take care of itself. If you’re a skilled driver then you manage the gears, indicators and wheel automatically, and your attention is probably caught up in the less routine business of navigating the traffic or talking to your passengers. When things are less routine we have to shift our attention to the details of what we’re doing, taking our minds off the bigger picture for a moment. Hence the pause in conversation as the driver gets to a tricky junction, or the engine starts to make a funny sound.

The way our attention moves up and down the hierarchy of action is what allows us to carry out complex behaviours, stitching together a coherent plan over multiple moments, in multiple places or requiring multiple actions.

The Doorway Effect occurs when our attention moves between levels, and it reflects the reliance of our memories – even memories for what we were about to do – on the environment we’re in.

Imagine that we’re going upstairs to get our keys and forget that it is the keys we came for as soon as we enter the bedroom. Psychologically, what has happened is that the plan (“Keys!”) has been forgotten even in the middle of implementing a necessary part of the strategy (“Go to bedroom!”). Probably the plan itself is part of a larger plan (“Get ready to leave the house!”), which is part of plans on a wider and wider scale (“Go to work!”, “Keep my job!”, “Be a productive and responsible citizen”, or whatever). Each scale requires attention at some point. Somewhere in navigating this complex hierarchy the need for keys popped into mind, and like a circus performer setting plates spinning on poles, your attention focussed on it long enough to construct a plan, but then moved on to the next plate (this time, either walking to the bedroom, or wondering who left their clothes on the stairs again, or what you’re going to do when you get to work or one of a million other things that it takes to build a life).

And sometimes spinning plates fall. Our memories, even for our goals, are embedded in webs of associations. That can be the physical environment in which we form them, which is why revisiting our childhood home can bring back a flood of previously forgotten memories, or it can be the mental environment – the set of things we were just thinking about when that thing popped into mind.

The Doorway Effect occurs because we change both the physical and mental environments, moving to a different room and thinking about different things. That hastily thought up goal, which was probably only one plate among the many we’re trying to spin, gets forgotten when the context changes.

It’s a window into how we manage to coordinate complex actions, matching plans with actions in a way that – most of the time – allows us to put the right bricks in the right place to build the cathedral of our lives.

This is my BBC Future column from Tuesday. The original is here