Building a Memex by Andrew Louis

Fractals of memories

While in prison, the protagonist of The Stranger finds himself not unhappy but very bored: “the whole problem was: how to kill time.” He realized he could occupy his mind by making a mental inventory of all the items in his house:

I found that the more I thought, the more details, half-forgotten or malobserved, floated up from my memory. There seemed no end to them.

So I learned that even after a single day’s experience of the outside world a man could easily live a hundred years in prison. He’d have laid up enough memories never to be bored.

As I read that this week, I thought of my own learnings from attempting to store as much of my history in a database as possible. My brain seems to be a fractal of de-referenced memories, available for recall only through navigating by association or triggers.

I think of my Memex as an attempt to provide as much surface area as possible into my brain. I’m driven by the curiosity of seeing what emerges from a system that enables me to easily access anything I’ve encountered before. How does learning change? How will it change the way I interact with others? How will I process emotions, nostalgia, and regret? There are a lot of open-ended questions that will take a long time to play out.

The Memex has many practical problems it solves but I’m most excited about beginning to see the results of this experiment as I and now others start incorporating it into their lives.

(If you want to be a guinea pig and try out the beta, email me!)

Memex and the dimension of time

How exactly do objects extend through time and space? This is a weighty philosophical problem:

Things and people take up time as well as taking up space: you existed yesterday, and, unless reading this article is a real strain, you will exist tomorrow too. Just as you can have different properties at different places (hot up here, cold down there), you can have different properties at different times (yesterday you hadn’t heard of temporal parts, by tomorrow you’ll know plenty about them).

This week, I spent a bit of time grappling with how to technically represent change over time in the Memex database. If you might recall, my Memex is organized around the Event Sourcing pattern which means data is always tied back to activities which represent something I did or experienced at a particular time.

I’ve been doing work on getting my notes to sync from my writing app into Memex. When I detect a document has been updated, I send an edited event into the Memex with latest version of the document. I want to be able to store what exactly was changed and be able to see how a document evolved over time.

Databases that are designed to solve this problem are called Temporal Database and the queries they allow you to do (such as “what was the version of the note 3 days ago?”) are excitingly called “time travel queries.” Specialized databases like Datomic are designed around this problem but as I enter my conservative elder years, I’ve grown reluctant to use weird/proprietary databases in production. My friends Phill and Max came to a similar conclusion after using it.

It turns out that it’s not particularly difficult to implement this functionality on top of Postgres (my database of choice) using the pgxn extension. If we want to store history of the Nodes table, we’ll create a second table that has the same columns with an additional column to represent which time period the record was valid from.

It was fun to learn what’s possible in this space but I decided not to reorganize the schema just yet and stick to what’s been working already which is using the PaperTrail Rails gem to store simple copies of objects over time. It comes with a version_at(timestamp) method for doing simple time travelling and it won’t be too hard to reorganize the data into fancier temporal tables later.

If more of the Memex data was changing frequently, I would prioritize working on this type of schema but the majority of data coming is write-once.

One fun side-effect of saving history on all the objects in my Memex is I get to detect thing like when a twitter user updates their bio. Bret Victor has been quietly updating his bio every few weeks and they’re usually incredible:


Happy 80th birthday, Ted Nelson

Ted Nelson’s life has spanned many fields and topics and his ideas are a frustrating mix of ambition, originality, and stubbornness. His never-ending excitement over the potential of computing has been a huge inspiration and my copy of Computer Lib is one of my most treasured possessions.

He turned 80 a few months ago and posted a video summarizing his life so far:

His major life’s work has been Project Xanadu, a still-not-completed attempt to organize the world’s into a deeply hyperlinked open system. So many of the ideas of hypertext (a term he coined) and the internet came out of these ideas.

It’s a project that’s directly connected to the historical Memex and in the video, Nelson mentions in passing how he spoke to the Memex’s inventor, Vannevar Bush. What he fails to mentions is how that conversation went:

In 1968, Bush received a phone call from a young man called Ted Nelson, who was visiting the area for a conference. Nelson told Bush he had started work on a computer-based system that had a lot in common with Memex. Bush was interested and ‘wanted very much to discuss it’ recalls Nelson, but Nelson decided he didn’t like the sound of Bush’s voice on the phone and didn’t pursue it. ‘He sounded like a sport coach,’ Nelson said. — From Belinda Barnet’s great academic book Memory Machines.

Ted Nelson keeps chugging along at Xanadu. For me, he’s both an incredible source of inspiration and a cautionary tale in the importance of shipping. “Having a working demo is table stakes” is how one hackernews commenter put it and I have to remind myself that I should be spending all my energy into making the Memex app ready for public consumption.