Personal Knowledge Base

Run Demarkus locally as a private markdown wiki: browse with the TUI, publish through the protocol, full version history on every document.

What you’ll have

Setup

1. Install

curl -fsSL https://raw.githubusercontent.com/latebit-io/demarkus/main/install.sh | bash

This installs the server, client tools, and registers the server as a background service. The content directory (~/.demarkus/content by default, or the path you pass with --root) is created automatically.

2. Generate a write token

All writes go through the Mark Protocol. Generate a token to allow publishing:

demarkus-token generate -paths "/*" -ops publish -tokens ~/.demarkus/tokens.toml

Copy the raw token from the output and use it as $TOKEN below.

If you used the full installer, the tokens file path is already configured. The installer saves an initial token to ~/.demarkus/initial-token.txt.

3. Start the server with write access

If running manually (the installer starts the server automatically as a background service):

demarkus-server -root ~/.demarkus/content -tokens ~/.demarkus/tokens.toml

The server uses a built-in self-signed certificate and listens on localhost:6309.

4. Publish your first documents

Everything goes through the protocol, with no writing files directly to disk:

export TOKEN=<your-token>

demarkus --insecure -X PUBLISH -auth $TOKEN \
  -body "# My Wiki

- [Notes](notes.md)
- [Ideas](ideas.md)" \
  mark://localhost:6309/index.md

demarkus --insecure -X PUBLISH -auth $TOKEN \
  -body "# Notes

Start writing here." \
  mark://localhost:6309/notes.md

Each publish creates a new immutable version. Run demarkus -X VERSIONS to see the history:

demarkus --insecure -X VERSIONS mark://localhost:6309/index.md

5. Browse with the TUI

demarkus-tui --insecure mark://localhost:6309/index.md

Keyboard shortcuts:

Key Action
Tab Cycle through links
Enter Follow selected link
[ Back
] Forward
d Document graph view
? Help

6. Read and write documents

Fetch a document to stdout:

demarkus --insecure mark://localhost:6309/notes.md

Publish from a file:

demarkus --insecure -X PUBLISH -auth $TOKEN \
  -body "$(cat notes.md)" \
  mark://localhost:6309/notes.md

7. Edit documents

The edit subcommand opens a document in $EDITOR and publishes on save:

demarkus edit -auth $TOKEN --insecure mark://localhost:6309/notes.md

If the document doesn’t exist yet, it opens an empty editor and creates it on save.

Why publish through the protocol?

Writing files directly to the content directory bypasses version history, so those changes won’t be tracked. Everything published via demarkus -X PUBLISH gets a version number, a hash, and an immutable record. That’s what makes it a knowledge base rather than just a folder of files.

Running on startup (macOS)

If you used the full installer, the server starts automatically via launchd. To start/stop manually:

# macOS 14+
launchctl bootstrap "gui/$(id -u)" ~/Library/LaunchAgents/io.latebit.demarkus.plist
launchctl bootout "gui/$(id -u)" ~/Library/LaunchAgents/io.latebit.demarkus.plist

Running on startup (Linux)

sudo systemctl enable --now demarkus
sudo systemctl status demarkus