0:09:16 Yeah, I think Automerge is
probably one of the most advanced
0:09:20 CRDT implementations right now.
0:09:22 And as you've mentioned, you
built your first versions, not in
0:09:26 Rust as it is written today, but
there were predecessors to this.
0:09:31 So given that this is now such a.
0:09:33 Such a long journey.
0:09:35 I think it's, if it's fair to say, , that
you've been working on this for 10
0:09:38 years, I'd be very interested in hearing
your reflections on the history and
0:09:44 the process of taking Automerge from
the beginnings to where it is today.
0:09:50 Yeah.
0:09:50 So when I started working on CRDTs, there
was no CRDT for JSON data, for example.
0:09:55 So there were existing data types
for sets and maps and counters and
0:10:00 registers and things like that.
0:10:01 So just these kind of little
atomic data types, but nothing
0:10:05 that really composed them together.
0:10:07 Uh, oh, and lists as well.
0:10:08 I mentioned that there
were data types for lists.
0:10:11 And so in a way, JSON is simple, you
know, it's just, you can put maps
0:10:14 inside lists and maps and lists inside
maps and compose them arbitrarily.
0:10:19 But there's still interesting
questions you have to answer, which
0:10:22 is like, for example, what if one user
deletes an object while another user
0:10:26 makes an update inside that object?
0:10:28 How do you merge those things?
0:10:29 And so one of the first research papers
I wrote was an algorithm for doing
0:10:34 a CRDT for JSON data, which answered
exactly this kind of questions.
0:10:38 And then Automerge started out sort of
conceptually as an implementation of
0:10:43 this paper, although we ended up actually
choosing different behavior for Automerge
0:10:47 than the paper chose, but you know, after
examining a bunch of applications and
0:10:52 what sort of behavior they would want, we
came to the conclusion that a different
0:10:55 behavior was better, but that was
basically the genesis of the whole thing.
0:11:00 So I can't remember which
year that JSON CRDT came.
0:11:03 paper came out, but yeah, I was
working on it like in 2015, 2016 ish.
0:11:08 And then, I think it was about 2017,
Peter van Hardenberg got in touch with me.
0:11:12 So I knew Peter from back in my
startup days because he was running
0:11:17 the Heroku Postgres team at the time.
0:11:20 And our company, which was called
Reportive, was one of the bigger customers
0:11:25 of, uh, Heroku Postgres at the time.
0:11:28 And so We had, like, talked to Peter as
part of, like, just scaling our database.
0:11:33 years later, I hear from Peter again,
because he had read my JSON CRDT paper
0:11:38 and went like, Hey, we want to try
actually building some apps with this.
0:11:41 Have you tried actually
building some apps?
0:11:43 And I went, Oh, no, no, no.
0:11:45 I just do theory.
0:11:46 You know, I just write a paper and I have
this extremely janky Ruby implementation
0:11:51 that actually only does half of what
the, what was says in the paper.
0:11:55 So then, , it got together
with, , Peter and Ink & Switch.
0:11:58 And I think Ink & Switch was
quite new still at the time.
0:12:01 And we did, , this project
together in which we essentially
0:12:05 built a adjacent CRDT.
0:12:07 That actually worked in JavaScript.
0:12:09 In fact, Orion Henry wrote the first
version of that and brought it to me.
0:12:13 And I went like, yeah, nice API, but
no, those algorithms are totally wrong.
0:12:17 And so then we worked together to
make the algorithms right as well.
0:12:21 And it was a great collaboration because
you know, the Ink & Switch folks were.
0:12:25 Just much better, like API design and
also UI design and general app development
0:12:32 than I was, whereas I sort of brought
the like more mathematical style of
0:12:35 thinking of analyzing the algorithms
and making sure that they were correct,
0:12:39 and that was just a great collaboration.
0:12:41 So yeah, we've, we first
wrote this library.
0:12:43 We originally called it Tesseract,
but then there was already a
0:12:46 JavaScript library of that name.
0:12:47 So we renamed it to Automerge
and that name has stuck since.
0:12:51 So yeah, I think Automerge
started around 2017.
0:12:54 And then a few Ink & Switch
projects used it, but it was very
0:12:58 much research quality software.
0:13:00 You know, it was extremely slow.
0:13:02 It had bugs.
0:13:03 The file format was extremely inefficient.
0:13:05 So it was kind of impractical
to use for most things.
0:13:10 As a vehicle for doing
research, it worked quite well.
0:13:13 But then at some point, like
it became clear that, okay, we
0:13:16 actually want to start building
more ambitious software on it.
0:13:19 And it's not really acceptable
if it takes three minutes to
0:13:22 load your document off disk.
0:13:24 So, you know, okay, we have to make the.
0:13:26 figure out a new file format to make
the file smaller and, , figure out new
0:13:31 algorithms to make the whole thing faster.
0:13:34 And then also we decided that the
Rust implementation would be better.
0:13:37 Um, not so much because Rust is
faster than JavaScript, but rather
0:13:40 because it's more cross platform.
0:13:42 And so we can compile Rust to
WebAssembly for the web, but we can
0:13:45 also compile it to native libraries
for iOS and Android, for example.
0:13:49 And so Orion did a lot of
work on the port to Rust.
0:13:53 Uh, again, and a few others
contributed to that, and Alex
0:13:57 Good got involved with that too.
0:13:59 But then at some point, two years
ago or so, we then made the call to
0:14:03 make the Rust implementation, the
primary implementation of Automerge.
0:14:07 So all of that JavaScript, I had, I'd been
maintaining the JavaScript implementation
0:14:10 as this research code over the years, but
we decided to just completely deprecate
0:14:15 that, throw away all of my old code.
0:14:16 And I've done, actually no work on
the Rust code of the implementation.
0:14:20 So that's all been done by Alex
and Orion and other people now.
0:14:24 And I've just moved into more of an
advisory role, which suits me really well.
0:14:28 You know, I'm very happy to be
the one not writing the code.
0:14:32 Other people are much better at writing
the code than I am, but I know I can
0:14:34 think about the algorithms and the
protocols and the data structures.
0:14:38 And that's what I find fun.
0:14:39 And so then, About a year
ago or so, we then declared
0:14:43 Automerge to be production ready.
0:14:44 So at that point, then, you know, the
Rust implementation was mature and fast.
0:14:50 and we got a sponsorship thing going
with GitHub sponsors, which allowed
0:14:56 people who were commercially using, or
companies that were commercially using
0:14:59 Automerge, to sponsor its development.
0:15:01 And that is now supporting the
work of Alex Goods, who's now
0:15:04 professionally maintaining Automerge.
0:15:06 And that is just such
a good arrangement now.
0:15:07 I'm really pleased with how that's
working because it means that we have
0:15:11 high quality software that's being
professionally maintained, but at the
0:15:14 same time, you know, we haven't had to
go out and raise venture capital, which
0:15:18 we feared that that's, you know, might be
at odds with the values of local-first.
0:15:23 And so this way by Essentially
bootstrapping it off of
0:15:26 the sponsorship revenue.
0:15:28 I think that aligns everybody's
interests very well.
0:15:30 And so that has allowed the
project to do very well.
0:15:33 That is an incredible journey.
0:15:35 And I mean, this is for
an open source project.
0:15:38 Particularly, I think most people use
right now, Automerge still in a JavaScript
0:15:43 context for a JavaScript library, where I
think you're thinking more in terms of dog
0:15:49 years, Automerge is really a monumental
project and it has come incredibly far.
0:15:54 So I'm super excited for that.
0:15:57 So where's the project today?
0:15:58 You've mentioned that it's
reached production readiness
0:16:02 around about last year.
0:16:03 Does that mean it's the APIs are
final, the research behind it is
0:16:08 concluded and now it's just performance
optimizations or what is left to do?
0:16:13 And I just, there's so much, so
much we still want to do with it.
0:16:17 So what we mean with production
ready is like, there are no egregious
0:16:20 bugs that we know about and the
performance is good enough that.
0:16:24 You know, it's plausibly usable in
real software, which some of the
0:16:28 research code definitely was not,
but it's got much, much better, but
0:16:31 in terms of features, like it, I
think we've only really just started.
0:16:36 So what Automerge started with is a
basic JSON model, so you can have maps.
0:16:41 Where the keys are strings and the values
can be either nested maps, or they can
0:16:45 be nested lists, or arbitrary recursion
of those things, or primitive values
0:16:50 like strings and numbers and booleans.
0:16:53 And that's it.
0:16:53 Then, okay, we, we added counters
because actually counters are
0:16:56 actually not very useful, but
everyone seems to use them for demos.
0:17:00 So we include the counters so
that we can have the demo as well.
0:17:03 Then, a big thing we added was rich text.
0:17:06 So that's something that a
lot of applications need is.
0:17:10 text with formatting.
0:17:11 And the first version of that is
released and implemented, though the
0:17:16 first version only supported inline
formatting, such as bold and italic
0:17:20 but not block elements like headings
or bullet points or things like that.
0:17:24 And so there's an updated version
of that coming soon, which adds
0:17:28 support for block elements too.
0:17:29 So this is now nice.
0:17:31 You can put rich text
anywhere inside a document.
0:17:33 So.
0:17:33 You know, it's, if you want to make
a Google Docs equivalent thing,
0:17:36 you can do that, but you could
also have, for example, a vector
0:17:39 graphics software that has some rich
text just inside the text boxes.
0:17:42 And the rest is a drawing consisting
of like arrows and lines and
0:17:48 freeform, whatever you want.
0:17:50 And so the JSON type document model
has allowed extension in those
0:17:54 directions very well, but there's
so much more we still want to do.
0:17:58 So.
0:17:58 Like an obvious missing thing is undo in
collaborative software is actually quite
0:18:02 subtle in terms of the behavior you want.
0:18:06 And so in particular, it's not generally
the case that you want to undo the
0:18:09 most recent operation, the most recent
change to the document, because the most
0:18:13 recent change to document might've been
made by somebody else in a part of the
0:18:16 document that you're not looking at.
0:18:17 And so.
0:18:18 Undoing somebody else's change in
a completely different part of the
0:18:20 document is definitely not what you
intended when you hit command Z.
0:18:24 So actually doing undo well requires,
inspecting the editing history of
0:18:30 the document, which we can do because
Automerge keeps the editing history
0:18:33 anyway, but actually surfacing
that and making the right APIs
0:18:37 the right underlying algorithms,
that's still some work in progress.
0:18:40 Another thing that we've long Try
to add as a move operation so that,
0:18:44 for example, you could reorder items
in lists or if you have a, say a
0:18:49 file system tree, you could drag a
directory from one location to another.
0:18:54 That is also quite subtle to
implement because you have to answer
0:18:57 questions like, what happens if
two users can currently move the
0:19:01 same item to two different places?
0:19:03 You don't want to duplicate it.
0:19:04 In that case, you want to just.
0:19:06 pick one of the destinations.
0:19:07 Or you get weird things where like you
have A and B which are siblings and one
0:19:12 user moves A to be a child of B while
concurrently another user moves B to be a
0:19:16 child of A and now if you're not careful
you could end up with a loop between A
0:19:20 and B and That would be a mess as well.
0:19:22 So to move operation very carefully
has to handle those kinds of cases.
0:19:26 You know, we wrote the research
paper about it several years ago, but
0:19:29 actually turning that into the kind
of production quality code as part of
0:19:33 Automerge is still ongoing project.
0:19:35 And so those are kind of the
near term things that we want to.
0:19:39 Features, examples of features
that we want to add to Automerge.
0:19:42 Other stuff we want to do better
are, for example, synchronizing
0:19:45 large collections of documents.
0:19:47 So at the moment, Automerge really
just deals with one document at a time.
0:19:50 But in many apps, you know, you might have
a collection of 100, 000 documents and
0:19:54 most of them don't change most very much.
0:19:57 So we need a protocol for efficiently
figuring out which of those many documents
0:20:00 have changed and then synchronize
only those which have changed and