Keeps files beside the store sealed under the store’s current at-rest
keys: after the store’s first encryption, after a store key rotation, and
after a reseal a restart cut short. The search indexes do this on their
drain thread instead, since that thread owns their writer.
Holds seq minting until the wall clock can be trusted. A Pi without an
RTC boots on a saved, older time until NTP syncs, and a restored card
boots at roughly its image time; seqs minted then could repeat.
The daemon’s own view of whether it is capturing and indexing. The
watcher, the outbox drain and the repair loop report what they see; each
report re-assesses the state, so GET /health only clones the result.
The drain thread: applies the index outbox every few seconds and, when
the outbox is quiet and the interval has passed, repairs the store with
the writable indexes it owns. On-demand repairs arrive over a channel so
the same thread services them; two writers never exist.
The one-time compaction after the stored-content redaction pass. The pass
rewrites rows, but SQLite keeps their old bytes in free and split pages
and tantivy keeps deleted terms until a segment merges away; a VACUUM and
a forced merge are what take that plaintext off the disk.
Moves a plaintext store in the data dir to SQLCipher at the first quiet
minute after an upgrade, rotates the store key after a revocation or a
recovery phrase retirement, and keeps store.key.wrapped under the
newest epoch.
Whether second-brain is worth running: how often sessions recall, how
often recall finds something, what agents do with what it found, and
what the store costs in disk, memory and sync lag. Kept in memory over a
rolling window, so a restart starts every window empty and each check
waits for enough events before it judges.
Keeps agent writes off the SQLite writer while store maintenance holds
it. A write that arrives then is saved to the write queue and answered
202; once maintenance ends, writes keep queueing behind the saved ones
until the replayer has sent them all, so none lands out of order.
Replays the writes the MCP server queued under queue/ while this
daemon was unreachable. Each entry is the request the MCP server would
have sent; it goes through this daemon’s own router, so auth, redaction
and every handler apply exactly as for a live call.
Extract the entity names a query refers to, using the same gazetteer
extraction the ingest path applies to transcripts. Matching extractors on
both sides is what lets query entities resolve to stored entity ids, so the
graph term in recall is conditioned on the query rather than raw
connectedness. Shared by the live recall route and the eval harness so both
measure the same ranking.