How to minimize the cost of context switching

I’ve come to realize that regardless of my efforts, my workday is consistently interrupted. Despite blocking my calendar, setting my Slack status to DND, and disabling all notifications, there’s always someone with an urgent matter that disrupts my flow (and that’s OK).

It’s part of the job, addressing time-sensitive queries that can influence the outcome of a deal or project, and being paged while on-call to manage incidents, are all urgent and disruptive tasks.

And everytime I get interruped, I have to switch from one context (what I’m working on) to another.

I don’t know about you, but I’ve found this to be quite draining.

Every time I switch contexts and complete the interrupting task, I have to rebuild all the lost momentum, and get my derailed train of thoughts back on track. This process is exhausting and frustrating. Naturally, like any human brain, mine either wants to avoid it or dreads experiencing it.

Since eliminating these interruptions didn’t quite work I started thinking about ways to co-exist with the reality of this situation by minimizing the damage.

A few weeks ago, an idea struck me while reading about how Swapping is done in memory management which I started implementing immediately and it has been a success so far with an incredibly high return on effort!


Whenever I switch contexts from one task to another, I create a .resume file in the current project I’m working on.

In this .resume file, I add 2 main things:

  1. What was I actively engaged in? For instance::
    • Make sure invoiceTotal in bill.go#L81 can not be controlled by user.
    • Add a function to query the database for all users who logged in from a list of suspicious IP addresses: func loginFromBadIPs(users []User, IPs []string, startDate, endDate time.Time) []User
    • Write a page about keeping dependecies updated (Why it’s important, How to do it, where to see what needs updating, FAQ (gather questions from #abc Slack channel and compile them all here)
    • Read more about how operating systems implement swapping
  2. After completing the above, what were the next steps I was thinking about? Corresponding to the previous examples:
    • Make sure there’s a unit test testing for this specific case
      • Write one if there isn’t any
    • Make sure to have proper paging for loginFromBadIPs results
      • Is the query performant for large data sets? Do we need to add a new index?
    • Make sure to add this page to the next internal newsletter to get it to the right teams
    • See if I can find a sample implementation on github

For tasks I’m actively working on (#1), I aim to be be very specific. At times, I include details about prerequisites for the task, such as necessary commands or tabs that need to be opened.

Writing down the next steps brings back the connection between where I was when I got interrupted and where I was headed to, it helps with getting the train of thoughts back into the place like it wasn’t even derailed.


I came up with the file name .resume on the spot, change it to whatever works best for you.

Since most of my tasks are either done in an IDE, terminal, or Obsidian a file based approach works best for me, feel free to adapt it to your needs.

Hope this helps ;)