Expand description
NDJSON-to-SQLite sync library boundary (ADR-010/ADR-020, finding F106).
Reads <repo>/.khive/kg/entities.ndjson and <repo>/.khive/kg/edges.ndjson,
parses each record per the ADR-020 §2 canonical schema, and writes them into
a fresh SQLite database using the runtime’s upsert APIs. The resulting DB
has the full khive schema (entities + graph_edges + FTS5 indexes + vector
tables) — the same schema the MCP server uses.
§Atomicity
Builds into <target>.tmp then renames over <target>. A crash mid-build
leaves the previous DB intact.
§Consumers
kkernel sync is the primary consumer. It calls run_sync and prints the
resulting SyncReport as JSON. Other callers (e.g. git post-checkout hooks)
can use this library directly.
Structs§
- Sync
Report - Summary of a completed sync run.
Functions§
- run_
sync - Rebuild
db_pathfrom.khive/kg/{entities,edges}.ndjsonunderrepo_root.