Of Notes
Knowledge Mirror
Table of Contents
This knowledge base as an offline reader on the reMarkable 2. It is an app
inside the tablet's own interface. It keeps a read-only copy of the published
notes, with maths and figures pre-rendered. Links, backlinks and search all
work without a network. The copy refreshes every hour from the site, or over
USB from the laptop. The reMarkable cloud plays no part. The code lives in
remarkable/ in the repo, and its README has the full detail.
How it fits together
- Export:
web/scripts/rm-snapshot.mjsruns as part of the site build (npm run build). It turns every published note into simple rich-text blocks. Maths becomes SVG through MathJax, TikZ figures are kept as SVG, and links, backlinks and search text are collected. The result isweb/dist/rm-snapshot/. It holds a manifest plus objects named by their sha256 (about 3000 objects, 15 MB). - Serve: the site route
/api/rm/v1/serves that snapshot. It hands out a manifest signed with Ed25519, then the objects. Every request needs a per-device bearer token. - Sync: the tablet runs a small C++/Qt program,
backend/entry, from a systemd timer every hour. It checks the signature against a pinned public key and checks each object's hash. It downloads only what changed, then swaps to the new snapshot atomically. The previous snapshot stays until the new one is complete. - Read: the screens are written in QML and launched through AppLoad, which runs inside xochitl (the tablet's interface) by way of xovi. They are Home, Library, Reader, Search and Practice. Problem notes fold their solutions until revealed. Reading positions, bookmarks and solved marks are kept on the tablet only.
Setup
- Launcher: install xovi and AppLoad on the tablet with Vellum
(
vellum add appload). Then runxovi/rebuild_hashtableonce, unlocking the tablet when it asks. After that,xovi/startloads xovi. - App: run
make rm.mirror.installfrom the KB root, with the tablet on USB. It cross-compiles in Docker, then copies the app, the device config and the sync timer to the tablet. - Server: run
node remarkable/tools/keys.mjs env. Add the two lines it prints (RM_SIGNING_KEYandRM_DEVICE_TOKENS) to the site app's environment in Dokploy, then redeploy. - Check:
make rm.mirror.statusshows the last sync.make rm.mirror.pushsyncs over USB straight away, with no server involved.
The secrets live in ~/.config/knowledge-mirror/: the signing key and the
device tokens. The server only keeps hashes of the tokens, so removing a
device's entry from RM_DEVICE_TOKENS revokes that device.
Gotchas
- Reboots:
xovi/startdoes not survive a reboot. Run it again over SSH after the tablet restarts. - Firmware updates: an update resets
/etcand the system partition. Runmake rm.mirror.installagain, and repeat the Vellum steps if AppLoad is gone. - USB push: it uses an SSH reverse tunnel on port 47831. The laptop's firewall blocks inbound connections from the tablet, and the tablet's own port 8787 is already taken.
- Sharp figures: Qt draws an SVG at the size written inside the file, then stretches the bitmap. So the exporter writes the on-screen pixel size into each SVG. A size in points comes out blurry.
- Error messages: "sync failed: Host requires authentication" means the server rejected the token. Usually the Dokploy variables are missing or out of date.
Edges
- part of
- Knowledge Base Site