feat: ingest Brevier reading copies and phone notes (#48)
Brevier keeps a copy of every page read and exports notes from the phone, and none of it reached knox. This adds a source for both. Archive copies are Markdown with title/source/read front matter, written as <archive>/<host>/<date>-<slug>.md.lz4 or .md depending on the reader's setting. Both forms are read: the setting only changes how new copies are written, and the older ones stay compressed. Entries are keyed by the source URL, so a page read on several days updates one entry and the content hash carries the version, instead of the archive's one-file-per-day turning into duplicate entries. The phone is a different problem. Its archive is app-private and never leaves the device (upstream leaves bulk export undecided), so what can arrive is the notes export and per-page saves. Those are dropped into an inbox directory and read in both shapes Brevier produces: one file with front matter, a zip with one page per file, and a single file with '## [title](url)' sections. A saved article carries no address, so it is keyed by its content; re-saving an unchanged page dedupes. Also checks the Flatpak sandbox path for the archive, since that is where a desktop install actually writes.
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
# knox
|
||||
|
||||
Knowledge index and long-term memory for agents: it ingests opencode sessions,
|
||||
logs, git/Gitea activity, browser history, Obsidian notes, Karakeep bookmarks
|
||||
and BookOrbit reading highlights into a SQLite index with FTS5 search, and
|
||||
exposes it over MCP.
|
||||
logs, git/Gitea activity, browser history, Obsidian notes, Karakeep bookmarks,
|
||||
BookOrbit reading highlights and Brevier reading copies into a SQLite index with
|
||||
FTS5 search, and exposes it over MCP.
|
||||
|
||||
Materialized state is derived from an append-only observation log, so nodes
|
||||
converge by exchanging that log and reconciling — no consensus, no shared
|
||||
@@ -42,19 +42,31 @@ Ports: `8931` gossip/REST, `8932` metrics, `8930` MCP HTTP.
|
||||
|
||||
### Reading sources
|
||||
|
||||
Both are pull-only and read their configuration from the environment (the
|
||||
systemd unit loads them from `~/.config/knox/*.env`):
|
||||
All three are pull-only and read their configuration from the environment
|
||||
(the systemd unit loads them from `~/.config/knox/*.env`):
|
||||
|
||||
| Source | Variables | What becomes an entry |
|
||||
|---|---|---|
|
||||
| Karakeep | `KARAKEEP_URL`, `KARAKEEP_API_KEY` | one entry per bookmark, with its crawled page text |
|
||||
| BookOrbit | `BOOKORBIT_URL`, `BOOKORBIT_USERNAME`, `BOOKORBIT_PASSWORD` | one entry per book chapter, with its highlights and notes |
|
||||
| Brevier | `BREVIER_ARCHIVE`, `BREVIER_INBOX` | one entry per page read (a new version when the text changes), plus notes exported from the phone |
|
||||
|
||||
BookOrbit entries fingerprint by book and chapter and hash their rendered body,
|
||||
so a new highlight updates the chapter and appends a log version instead of
|
||||
creating a second entry. `knox bookorbit` forces a sweep; the watcher runs one
|
||||
every 30 minutes on nodes with local sources enabled.
|
||||
|
||||
Brevier's archive lives at `~/.local/share/brevier/archive` (or inside the
|
||||
Flatpak's sandbox, which is checked too). Entries are keyed by the page's URL,
|
||||
so a page read on several days updates one entry rather than adding copies.
|
||||
|
||||
The phone is different: Brevier's archive there is app-private and never leaves
|
||||
the device. What can leave is the notes export (menu → **Your notes** → share)
|
||||
and per-page **Save**. Drop either into `BREVIER_INBOX` — the default is
|
||||
`~/.local/share/knox/inbox/brevier`, which a Syncthing folder can mirror — and
|
||||
`knox brevier` picks them up. A saved article carries no address, so it is
|
||||
keyed by its content instead.
|
||||
|
||||
Seeding a new replica: start it empty and pull, rather than copying `index.db` —
|
||||
a copied database carries the origin's `node_id`, which breaks ownership and
|
||||
echo suppression.
|
||||
|
||||
Reference in New Issue
Block a user