feat(runtime): EmbedderRegistry trait + pack-extension hook (#397)#421
Merged
Conversation
- New crates/khive-runtime/src/embedder_registry.rs: EmbedderProvider async trait, EmbedderRegistry struct with register/get/names/get_entry, LatticeEmbedderProvider adapter wrapping lattice_embed::EmbeddingModel - KhiveRuntime refactored: embedder_registry: Arc<RwLock<EmbedderRegistry>> replaces private HashMap; register_embedder() public method; embedder()/resolve_embedding_model()/registered_embedding_model_names() routed through registry; RwLockGuard never held across await - PackRuntime trait gains register_embedders(&self, runtime) default no-op hook for pack-level custom provider registration - 5 new unit tests in embedder_registry.rs: register+get round-trip, duplicate last-wins, names() coverage, UnknownModel on missing, build-once caching - 4 new integration tests in tests/integration.rs (embedder_registry_tests module): MockEmbedderProvider round-trip, registered_names includes custom, dual-embedding regression both lattice models reachable, unknown name returns UnknownModel - ADR-031 amended with pack-extensible EmbedderRegistry addendum documenting the design, API surface, and file changes - Closes #397 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…errors - PackRuntime::register_embedders now actually called during pack registration via VerbRegistry::call_register_embedders, invoked in KhiveMcpServer::with_packs immediately after registry build and before first dispatch - Lattice-specific vector paths refactored in vectors_for_model to handle custom providers: lattice names use the enum-backed path, non-lattice names fall through to a provider-dimension path using sanitize_key — no panic on custom provider names - Provider build() errors propagated as RuntimeResult instead of panic: EmbedderEntry::resolve now uses get/set on OnceCell with explicit error mapping rather than .expect() — build failures return RuntimeError::Internal - 2 new integration tests: pack_register_embedders_hook_makes_provider_reachable proves the hook fires end-to-end; failing_provider_build_returns_err_not_panic proves build() errors return Err, not abort the process Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ohdearquant
added a commit
that referenced
this pull request
May 25, 2026
…c + score normalization (#440) Five Wave-1 fixes from /tmp/v023-usage-audit-consolidated.md UE3 + ADR-A: 1. remember(source_id=...) accepts 8-char short IDs (Critical) — same prefix resolution as get/link/update. Closes recon #291 and the chain create->remember workflow. 2. recall(help=true) + remember(help=true) HandlerDef params updated to include all PR #406/#421 args (top_k, score_floor, fusion_strategy, embedding_model + presentation for verbose breakdown). 3. decay_factor default doc corrected: 0.1 -> 0.01 (10x off). 4. compute_score normalizes RRF-fused scores by (k+1) to comparable range with weighted/union so score_floor is portable across fusion_strategy. 5. presentation="verbose" on recall includes per-component score breakdown without changing agent-mode response shape. Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
P4 of v023-operationalize. Trait-based embedder registry with pack-extension hook. Closes #397.
What's added
New module
crates/khive-runtime/src/embedder_registry.rs:EmbedderRegistrystruct manages providers (register,get,names).LatticeEmbedderProvideradapter wrapslattice_embed::EmbeddingModelso existing dual-embedding behavior continues unchanged.Pack extension hook
New default-no-op method on
PackRuntimetrait:Packs override this to register custom embedders. Default is no-op so existing packs remain unaffected.
Refactor
KhiveRuntime:HashMap<String, EmbedderEntry>withEmbedderRegistryunder the hoodembedder(name),resolve_embedding_model(name),registered_embedding_model_names()) route through the registryregister_embedder(provider)for pack-level registrationKhiveRuntime::new(config)API unchangedTests (9 new)
Unit (5):
register_and_get_provider_round_tripduplicate_name_last_wins(documented choice)names_returns_all_registeredget_service_unknown_name_returns_errorget_service_calls_build_once(lazy init verified)Integration (4):
register_embedder_and_retrieve_via_embedder_methodregistered_names_includes_custom_providerdual_embedding_regression_both_models_registeredembedder_unknown_name_returns_errorAll workspace tests pass.
ADR amendment
docs/adr/ADR-031-multi-engine-retrieval.mdaddendum documents the pack-extension surface.Closes