Semantic reranking

Lexical retrieval runs first. Semantic scoring then reranks a bounded lexical candidate set. It does not replace lexical grounding, and no external vector database is required. Semantic data must exist on the pack, and the caller must supply a valid query embedding.

Examplets
import { hasSemantic, query } from '@knolo/core';

if (!hasSemantic(pack) || !queryEmbedding) {
  // Fall back to lexical retrieval; semantic data and a valid embedding are required.
}
const hits = query(pack, question, { topK: 8, semantic: {
  enabled: hasSemantic(pack), mode: 'rerank', topN: 50,
  minLexConfidence: 0.35,
  blend: { enabled: true, wLex: 0.75, wSem: 0.25 }, queryEmbedding,
} });
PatternBest fit
Lexical onlyExact language, policies, code, names, IDs
Lexical plus semantic rerankParaphrases and conceptually related language
Lexical plus small-model selectorComplex relevance judgments and evidence pruning

Semantic reranking and selection can be combined. Measure whether the added latency is justified on your corpus. @knolo/semantic-ollama@6.2.0 is an optional local embedding provider for this layer. It is not required, and it is not a model inside @knolo/core.

Semantic sidecars target V4 packs. The CLI rejects them for V5 images with a contract-specific message. Knolo Cortex leaves semantic rerank off unless allowSemanticRerank is true and you pass an embedding for vectors already on the pack.