Skip to main content

Module sync

Module sync 

Source
Expand description

NDJSON-to-SQLite sync library boundary.

Rebuilds the SQLite database from .khive/kg/entities.ndjson and edges.ndjson. Builds atomically into a .tmp file then renames. Also supports remote archive fetch with SHA-256 pin verification via run_sync_remote.

Structs§

RemoteConfig
Configuration for a remote KG archive (maps to one entry in schema.yaml remotes: list).
RemoteName
A validated remote cache name: a single path segment safe to join under .khive/kg/remotes/ without escaping that directory.
RemoteSyncReport
Summary of a completed remote sync run (F201).
SyncReport
Summary of a completed sync run.

Functions§

run_sync
Rebuild db_path from .khive/kg/{entities,edges}.ndjson under repo_root.
run_sync_remote
Fetch a remote KG archive, verify SHA-256, populate .khive/kg/remotes/, write meta.json. Fail-closed on hash mismatch; use repin=true to update the pin.