Tyler's Site

What is a knowledge base

A knowledge base will generally help people keep track of complex topics and how various bits of information relate to each other. While giving examples of knowledge bases is not too difficult, I could not think of a good definition for one. So I used Wikipedia instead.

A knowledge base (KB) is a set of sentences, each sentence given in a knowledge representation language, with interfaces to tell new sentences and to ask questions about what is known, where either of these interfaces might use inference. [1] It is a technology used to store complex structured data used by a computer system. The initial use of the term was in connection with expert systems, which were the first knowledge-based systems. - Wikipedia page on Knowledge base.

Many people have used a knowledge base at one point or another. Whether that is trying to find an answer for a product they just bought, or for performing a certain task at work, or even to look at something on Wikipedia. Creating a personal one gives the ability to easily keep track of knowledge on a topic that are complex and difficult to keep track of, but is very beneficial if done.

Org-roam: The knowledge base within emacs

Of course emacs has a knowledge base package that is available. I am not really sure why I doubt emacs can really do anything except be a good text editor… and maybe browse the web without issues. There actually seems to be two packages that function as a knowledge base within emacs. There is org-brain and org-roam. I chose org-roam because it has more features at the time of writing such as org-roam-ui.

Setting up org-roam in Spacemacs

According to the Org layer page in the spacemacs documentation, add the following to .Spacemacs.

;; Enabling org-roam and org-roam-ui in spacemacs
(org :variables
      org-enable-roam-support t
      org-enable-roam-ui t)
;; Skipping down to the 'dotspacemacs/user-config' function

;; This line forces org-roam to use v2, which is required
;; to be able to use org-roam-ui
(setq org-roam-v2-ack t)

;; Sets the directory for org-roam, or use the default ${HOME}/Documents/org-roam
(setq org-roam-directory "/pick/a/good/dir/for/you")

;; Automates the database syncing (yes, org-roam is a databsae)
(org-roam-db-autosync-mode 1)

Then restart Spacemacs. Theorectically at this point it should be working, however, I had quite a few issues with this. It kept giving me an error about a database not being avaiable. The resolution that worked for me was to use the ‘Update Packages’ button on the Spacemacs home screen. Following that process, assuming no catastrophic errors, it should being working after it is finished updating adn building all the packages.

Using Org-roam

After getting the packages installed and built we can start using org-roam. The Spacemacs keybinding to create a new ‘node’ (think of this as a note) is SPC a o r i. Emacs will ask you for a name to call the node, then open an org-mode buffer. Org-roam gives all the same power that you would get with standard org-mode, but you can also link nodes together to help simplify complex ideas. Each node can link to other nodes, and interlink between common ideas, building a complex web of information.

Org-roam-ui

Org-roam-ui gives a very nice web visualization of not only each node, but how they connect. Clicking on the node will pull up the information contained within the node, allowing for very easy reading. The web interface is hosted on the local computer, though, hosting it remotely would surely not be too difficult if that is of interest.