Obsidian is a fabulous tool out of the box. The simplicity of linking notes and the resulting beautiful graph view was what sold it to me immediately. This, and the fact that the UI reminded me of my beloved VS Code and I could reuse some of the hotkeys that I am used to. However, after adding the first few notes, playing around with a couple of plugins and installing a first theme, I began to realize that there are three things that I needed to turn Obsidian into an integral part of my work. One was a core feature for me, a must-have so to say. The second one is a quality of life improvement, something that takes away entering the same command over and over again. And the third one was more of an idea, a feature that might alter the way I work and enhance the Obsidian experience even more.

The must have feature is synchronization. I work on different devices, primarily my phone and my laptop, and for any note taking app to function as a second brain for me, it is essential that notes sync between them seamlessly. I do not want to have any additional interaction and close-to-zero waiting time to get notes from one device to another. This is something that Obsidian Sync does for you, but I like to keep my second brain in my own hands. So I’ve set up my devices to use Syncthing to synchronize my Obsidian vaults.

The second feature, the quality of life improvement is - what a coincidence - the second paid service that Obsidian offers: Publishing notes. There are many tools that turn markdown notes into static websites. I decided to give Quartz a try, because it support most of the Obsidian specific features and even gives you the beautiful knowledge graph. So it takes the idea of a non-hierarchical knowledge organisation and turns it into a website! As with the synchronization, my goal was to reduce the effort to publish notes to zero. I want to be able to write a note to my public vault on any of my devices and see [kon.foo] update.

The nice to have feature is a close integration with ChatGPT. Over the last year, my workflow for researching and planning has completely shifted. For certain things Google and Wikipedia get more and more replaced with ChatGPT conversations. While there are several tool that integrate LLMs into Obsidian I was missing a integration of Obsidian into ChatGPT. Why? Existing tools might be great (I haven’t thoroughly tested them yet) for chatting with you notes, uncovering hidden connections between your notes, or even as a Copilot-like writing assistant. But I am used to using ChatGPT to approach a new topic and don’t want to miss some of it’s features like browsing, voice chat and even some custom GPTs that I incorporated into my workflow. I simply want a tool to turn my conversation into Obsidian notes and add them to my vault.

Synchronisation with Syncthing

On my journey to sync my Obsidian vault I was close to loosing my belief in humanity. I naively thought that file synchronization was a solved problem, but it turns out, it can still be a pain. I started my journey with Nextcloud, but belief it or not, the Nextcloud Android app simply does not have two-way-sync. I am sure there are important technical or philosophical reasons for this, but the fact that this has been remarked in issue #19, and runningthe repo has well exceeded 12k issues by now, is incomprehensible to the unfamiliar observer. My second choice was the Android app FolderSync. It supports WebDAV, and since I do already have a private Nextcloud instance set up, it was a natural choice to recycle the existing infrastructure. However, FolderSync did constantly run into synchronization issues and was running super slow. I surrendered and decided to install a new service: Syncthing. Syncthing is a peer-to-peer, real-time, private and secure file synchronization tool. It has integrations for Linux, MacOS, Windows and Android and it is simply a pleasure to work with.

Since it is P2P, I might have gotten away without an always-on server in the center. But since my laptop is not always on and my phone is not always connected to my VPN, I decided to include my VPS as an always-on-and-connected device:

graph LR
   Laptop --- VPS
   VPS --- Phone
   Phone --- Laptop

The setup of Syncthing is rather self-explanatory. On my Ubuntu Laptop and my Android device, I use the native apps. On my VPS, I use a dockerized version, based on the Linuxserver Image. Setting Syncthing up was a breeze and it works flawlessly out of the box. In fact, I’ve began to move away from using Nextcloud for my file synchronization, but that stuff for a different story.

Self-publishing Obsidian Notes

The next enhancement was to automate the build and deployment process of my public vault to this website. As I mentioned, I settled on Quartz as a static-site generator. I haven’t done a detailed comparison of my options, but for now I am quite happy with Quartz. It supports all important Obsidian Features and is easily customizable. There are many deployment and hosting options mentioned in the Quartz documentation. they all have in common that they use a git repository as the source. Since I already have a real-time synchronization set-up, and I do not need version control or any other git features for my vault, I decided to omit git and simply watch the vault on my VPS and re-build every time (+ a debounce period) it changes. The changes are then pushed to my public facing webserver using rsync. Check out this Github repository if you want to copy this approach. Simply mount your vault and a valid SSH Key for your webserver to the docker container and add your rsync target to the .env file and you should be good to go!

ObsidianGPT - Interact with your vault from ChatGPT

Now that the compulsory part was done, I could turn my attention to the freestyle part. My goal: a custom GPT that allows me to interact with my vault through the ChatGPT interface. The brilliant part: Now that OpenAI introduced @ mentions, I do not have to converse with this GPT exclusively. I can chat with any GPT or standard GPT-4 and when I encounter something note-worthy I can simply type:

@ObsidianGPT summarize the key points and add them to my XYZ note.

To accomplish that, two fairly simply components are needed:

  • A simple backend that has access to my vault.
  • A custom GPT that knows how to deal with it.

The Backend

For the backend I went with FastAPI, simply because I know it. Actually, I had the plan to try Litestar for my next API project, but I forgot when I started to code… next time. For now, the backend only has three endpoint to deal with a vault:

  • List Notes
  • Create Note
  • Append to Note. I went with “append” instead of “edit” for now, because I think editing comes with certain risks that need consideration. Read below for more on this. Beside these vault interaction endpoints it comes with a /scheme endpoint that returns a OpenAI compatible OpenAPI scheme that can be used in the Actions definition of a custom GPT. Since this is a proof-of-concept, I went with a super basic authentication approach: You simply set an API Key environment variable that is then required for every API interaction.

Why No Editing Endpoint?

The way custom GPTs interact with an API is that they generate the complete payload for an endpoint in the only way they can: Predicting the next token. So for a GPT to edit a note, It would have to fetch the complete note into its context window and then re-generate the whole this token by token, only changing the necessary parts. While they are quite good at it, I wouldn’t trust it with my precious notes without some kind of backup system. A single note might have thousands of token and while GPT-4 has a context window of 128k token, the maximum output is ~4k tokens. So for an editing endpoint I would want to have A: Some kind of backup mechanism on the backend and B: a way to only push the differences instead of repeating the complete note.

ObsidianGPT

Since the backend is so simple, the ObsidianGPT did not need complicate instructions either. I simply copied the OpenAPI schema from the /schema endpoint, told it how to use them and instructed it to use Obsidian-flavored markdown (using callouts and so on). This is it. It works out of the box! I already went through my past conversations and let ObsidianGPT summarize some of them and add them to my vault.

Setting it up yourself

Since the backend needs access to your vault, and the GPT needs access to your specific backend I can’t simply share the custom GPT. But if you have a copy of your vault on a server that is capable of running docker containers, you can hop over to this Github Repository and follow the instructions.