Skip to main content

Crate second_brain_api

Crate second_brain_api 

Source

Modules§

alert
Posts each health state change to [alert] webhook_url, retrying a failed post until it lands or a newer state replaces it.
associate
auth
eval
file_modes
health
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.
heap
Allocator residency accounting for /v1/status.
ingest
logging
maintenance
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.
mentions
near_duplicates
progress
repairs
One-off data repairs, each idempotent: a second run finds nothing left to change, so running one again after a partial failure is always safe.
routes
store_compaction
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.
stored_redaction
watcher
write_gate
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.
write_queue
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.

Structs§

AppState

Functions§

app
link_query_entities
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.