khive-pack-template
Reference template for authoring a new khive pack (ADR-023 §8). This crate is not consumed as a dependency — it is a scaffold you copy.
Usage
Then, per docs/design.md in this crate:
- Rename the crate in
Cargo.toml(name,description). - Set
PACK_NAMEinlib.rsto your pack's canonical name (e.g."exp"). - Update
NOTE_KINDS/ENTITY_KINDSinvocab.rs. - Add verbs to the
HandlerDeftable inpack.rs; implement them inhandlers.rs. - Add the crate to the workspace
Cargo.toml. - Force-link it in
khive-mcp/src/pack.rsandkkernel/src/lib.rs(apub usereferencing any public type — this is what makes the linker include the pack'sinventory::submit!factory in the final binary). - Add the crate dependency to
khive-mcp/Cargo.tomlandkkernel/Cargo.toml.
What the scaffold demonstrates
TemplatePack implements khive_types::Pack (NAME = "template", one note kind
"template_note", REQUIRES = ["kg"]) and khive_runtime::pack::PackRuntime,
and registers itself with inventory::submit! { khive_runtime::PackRegistration(&TemplatePackFactory) }
— the same self-registration mechanism every khive pack uses (ADR-027). Its one
handler, template.my_verb, shows the required non-kg-pack verb naming
(<pack>.<verb>) and basic parameter validation:
// handlers::handle_my_verb — rejects a missing/empty "name" field
pub async
Dispatched through the MCP request DSL once loaded:
request(ops="template.my_verb(name=\"example\")")
tests/integration.rs covers the pattern every new pack's tests should follow:
valid input, invalid input, and dispatch of an unknown verb.
Where this sits
khive-pack-template depends on khive-types (Pack, HandlerDef,
Visibility) and khive-runtime (PackRuntime, PackFactory,
KhiveRuntime), REQUIRES khive-pack-kg
like every other pack, and is never force-linked into a shipping binary — it
exists purely as the copy-me reference for
ADR-023 (Pack Verb Surface, Visibility, and Composition)
§8 and
ADR-027 (Dynamic Pack Loading via Self-Registration).
License
Apache-2.0.