(This article has also been published on Lukas Kawerau’s blog.)

If you’re in the orbit of Roam Research and the #roamcult, one term you might have come across more and more is that of an “Algorithm of Thought”. But what actually is that, and how do you use it?

Broadly, algorithms are step-by-step procedures for solving problems or achieving an end [Merriam Webster]. Algorithms of Thought then are procedures for thinking through a problem or situation to solve it.

That’s also what distinguishes Mental Algorithms from Mental Models: Mental Models are descriptive, they help to describe the world and reduce complexity through abstracting from reality. Mental Algorithms on the other hand are procedural – they guide you through a series of steps instead.

I’m going to show you four algorithms of thought and how you can implement them using two tools: a text expansion app like TextExpander and Roam. What makes Roam ideal, compared to other tools, for using algorithms of thought is that you can effortlessly observe your use of specific algorithms and steps within algorithms over time.

In the next sections I’ll describe four algorithms of thought: the “Difference Engine”, “Want, Impediment, Remedy”, “Choice” and “Assumptions X-ray”. After these four algorithms, I’ll show you how tracking them over time can work within Roam, and I’ll conclude with some pointers for how to use them with text expansion tools for so long as Roam does not have templates.

The Difference Engine Algorithm

A very general algorithm of thought is the “Difference Engine”. Marvin Minsky describes a difference engine in his book The Emotion Machine like this:

“At every step, this program compares its descriptions of the present and that future situation, and this produces a list of differences between them. Then it focuses on the most serious difference and applies some technique that has been designed to reduce this particular type of difference. If this succeeds, the program then tries to reduce what now seems to be the most serious difference. However, whenever such a step makes things worse, the system goes back and tries a different technique.” (Minsky 2006, 188)

A very simple concept, but extremely powerful. Here’s a small graphic to help you visualize:

Figure 1: Difference Engine Algorithm

If you were to implement this in Roam, for example, you could do the following:

Figure 2: Difference Engine in Roam

What’s very interesting about this very general form of a mental algorithm is that you can “plug in” other algorithms at certain steps. I’ll show you how that might work further below.

The strength of the Difference Engine algorithm is also its weakness – it’s abstract enough to cover basically everything in some form. To prompt for better guidance and results, it’s useful to experiment with different implementations of this general concept. I’ll show you in the next section.

Want, Impediment, Remedy Algorithm

A more concrete implementation of the Difference Engine concept is something I recently came across on Twitter, where mormo_music shared an algorithm inspired by wording from Michael Ashcroft:

Figure 3: Want, Impediment, Remedy in Roam

Simple Choice Algorithm

What you’ll notice in both examples is that there’s an element of choice at the end. In the Difference Engine example, the “most serious difference” is already selected, in the Want, Impediment, Remedy example there are two action items to choose from.

That points to an important feature of algorithms of thought – you can combine them in infinite ways. The algorithms have brought you to a situation where now you can now employ a different algorithm – one for choosing between alternatives.

Conor White-Sullivan, the co-founder of Roam, shared one implementation of a choice algorithm on Twitter:

If we want to use this in our example, we could do it like this:

Figure 4: Want, Impediment, Remedy in Roam

Assumptions X-ray Algorithm

Conor also points to another step he takes – listing constraints:

If you’re thinking through tough choices, what also helps tremendously is finding the underlying assumptions. From this fantastic resource on Problem Solving Techniques by Robert Harris we can build an algorithm of thought that we can plug into the choice algorithm:

Figure 5: Assumptions X-ray Algorithm in Roam

Running these algorithms together, pluging them into each other, is only constrained by the time and effort you want to invest in doing so. For some problems it will make sense to run the whole Assumptions X-ray, for others less so. Buying a house? Probably a good idea. Getting lunch? Up to you!

Observing Algorithms of Thought over time

What’s particularly great about using these algorithms in Roam is that you can observe your problem solving and the performance of different algorithms over time. All you have to do is click the links in any algorithm and you can step through time using the Linked References section:

Figure 6: Algorithms over time in Roam

Implementation Details

So, how do you set yourself up with these algorithms of thought? Currently, Roam does not have a way to specify templates natively – you’ll have to do it using other apps. The way I currently do it is using text-expansion apps, such as TextExpander. There are many alternatives out there, but TextExpander is what I know and use, so that’s how I’ll show how to set this up.

What you need first is the raw, unformatted text of the template. This should only contain the text and appropriate indentation. Here’s the example for the Choice algorithm, for example:

{{[[TODO]]}} [[Choice]]: 
  - Constraints::
  - Options::
  - Decision::

Then, you create a new “snippet”: you paste the text into TextExpander and then assign it a shortcut. What you see next to “Abbreviation” is the way I invoke the template in Roam. All I have to type in a new bullet is xrdc and it automatically pastes the whole template, appropriately formatted and ready to go.

Figure 7: Implementing the Simple Choice Algorithm using TextExpander

If you want to play with all of the algorithms discussed here, I’ve collected the plain-text templates below. All you have to do is paste them into Roam directly, and/or add them to your text expansion tool of choice. If you want to learn more of these algorithms of thought and how I use Roam to read and think better, you might want to check out Galaxy Brain, my Algorithms of Thought course.

Here are the templates:

Difference Engine Template

- [[Run Difference Engine]]
    - Current Situation::
    - Future Situation::
    - Differences::
    - Most serious difference::

Want, Impediment, Remedy Template

[[I want]] state your want here
  - impediment::
    - remedy::
  - impediment:: 
    - remedy::
  - **action items** (use block references)

Simple Choice Algorithm Template

{{[[TODO]]}} [[Choice]]: 
  - Constraints::
  - Options::
  - Decision::

Assumptions X-ray Template

- Assumptions::
    - General Assumptions::
        - culture binding::
        - information::
    - Assumptions at the crux::
    - Assumptions determining the constraints::
        - time::
        - money::
        - energy::
        - cost/benefit::
        - cooperation::
        - physics::
        - law::