kb-ingest
KB Ingest
Take sources into a file-based knowledge base: normalize → register. Stops at sources/index.md and writes nothing to knowledge/, which is kb-integrate's job.
1. Resolve the KB
Resolve which KB to operate on per registry.md. Done when you have its absolute root path.
2. Normalize and register each argument
An argument is either a source (URL, path, pasted text) or an already-registered key, since a caller re-running over what it ingested earlier holds keys rather than URLs. Resolve each against sources/index.md first, by key or by origin. ingestion.md's Idempotency rule governs the three cases:
- Unknown. Convert and register it.
- Known, status
candidateorintegrated. Refresh its metadata only; nothing is re-converted. - Known, status
declined. A reopen, which re-converts. Confirm with the user first, per that rule. A confirmation passed in with the key counts; where no user can answer, skip it and report it as awaiting confirmation.
Run the pipeline in ingestion.md on each new or reopened source: convert, keep the originals, register the key. Done when every ingestible source has a normalized .md and an entry carrying every field the citation contract's registry schema lists, and every source left out is noted with its reason.