khive-pack-knowledge
Knowledge verb pack for khive: a corpus of atoms (documented techniques, one per
concept) grouped into domains, retrieved by TF-IDF search with optional embedding
rerank, and composed into markdown briefings under a token budget.
Features
- TF-IDF corpus search (
knowledge.search) over atom name/tags/content, with score bands (>=0.46reliable,0.42-0.46mixed,<0.42mostly off-target), query decomposition, and RRF fusion against an ANN pass when an embedder is configured - Section-level records (
knowledge.edit) — a closed 10-valuesection_typeenum (overview,core_model,formalism,failure_modes, ...other) per atom, each independently disputable and adjudicable (ADR-051) - Budget-constrained fold (
knowledge.fold) — knapsack selection of caller-scored candidates against a token/size budget - Domain suggestion + compose (
knowledge.suggest,knowledge.compose) — find relevant domains for a query, then assemble a reranked markdown briefing from their member atoms - Concept sugar over the KG (
knowledge.learn,knowledge.cite,knowledge.topic) — register aconceptentity and link it to its introducingdocument/person/orgwithout hand-rollingcreate/linkcalls - Section feedback (
knowledge.feedback) — per-sectionuseful/not_useful/wrongsignals update posterior weights, optionally forwarded to a configured brain profile (ADR-032)
Usage
This crate is not called directly as a Rust library — it registers KnowledgePack
with the runtime's inventory-based pack registry and dispatches its 19 verbs
through the MCP request DSL (or kkernel exec). A caller issues:
request(ops="knowledge.search(query=\"block-max wand posting list pruning\", limit=10)")
The same DSL runs from the shell without an MCP client via kkernel exec:
or, to build a fresh corpus and immediately reference it:
request(ops="[knowledge.upsert_atoms(atoms=[{\"slug\":\"bm25-wand\",\"name\":\"BM25 WAND\",\"content\":\"...\"}]), knowledge.compose(atom_ids=[\"bm25-wand\"], query=\"keyword search pruning strategies\")]")
Programmatic embedding is exposed via a small Rust API for the kkernel reindex
binary, independent of the MCP surface:
use ;
let opts = KnowledgeReindexOptions ;
let report = reindex_knowledge.await?;
Verbs
| Verb | What it does |
|---|---|
knowledge.upsert_atoms / knowledge.upsert_domains |
Bulk insert or update atoms / domains |
knowledge.get / knowledge.list / knowledge.delete_atoms / knowledge.stats |
Corpus CRUD and aggregate counts |
knowledge.index |
Backfill embeddings + FTS for atoms/domains |
knowledge.search / knowledge.suggest / knowledge.compose |
TF-IDF search, domain suggestion, briefing assembly |
knowledge.fold |
Knapsack selection of scored candidates against a budget |
knowledge.edit |
Upsert one atom's sections without wiping the rest |
knowledge.import |
Ingest atlas-format markdown as atoms with parsed sections |
knowledge.challenge / knowledge.adjudicate |
Dispute and resolve a section's content |
knowledge.learn / knowledge.cite / knowledge.topic |
Register/link/browse concept entities |
knowledge.feedback |
Apply per-section signals to posterior weights |
All 19 verbs are Visibility::Verb (exposed on the agent-facing MCP surface).
Where this sits
khive-pack-knowledge sits in the pack tier, above khive-runtime /
khive-storage / khive-score / khive-fusion / khive-vamana /
khive-fold, alongside sibling packs such as
khive-pack-kg (a hard REQUIRES
dependency for the underlying concept/document entity substrate) and
khive-pack-brain (feedback
target). It is one of the eleven packs loaded by default in khive-mcp. Governing
ADRs:
ADR-017 (Pack Standard),
ADR-048 (Knowledge Section Profiles),
ADR-051 (Section-level Embeddings and Hybrid Compose Scoring).
License
Apache-2.0.