Query refinement

A small application-provided model adapter can resolve pronouns, remove filler, expand internal abbreviations, split searchable terminology, or add an exact required phrase. The rewriter is not built into Knolo.

Examplets
type QueryRewrite = { query: string; requiredPhrases: string[]; namespaces: string[] };
const rewrite = await queryRewriteModel.rewrite(question);
if (!rewrite.query.trim()) return 'Please clarify your question.';
const hits = query(pack, rewrite.query.slice(0, 240), {
  topK: 15,
  requirePhrases: rewrite.requiredPhrases.slice(0, 5),
  namespace: rewrite.namespaces.slice(0, 5),
});

Pre-retrieval rewriting can help ambiguous language. High-recall retrieval followed by selection is safer where rewriting might erase meaning. Combining both adds latency.

Compound questions

For “What is the refund window, and does the enterprise plan require annual billing?”, an application can split the question and merge hits by block id. Decomposition is not a Knolo API.

Examplets
const decomposition = { subqueries: [
  'refund request window',
  'enterprise plan annual billing requirement',
] };
const merged = new Map<number, ReturnType<typeof query>[number]>();
for (const subquery of decomposition.subqueries) {
  for (const hit of query(pack, subquery, { topK: 10 })) merged.set(hit.blockId, hit);
}
const evidence = [...merged.values()].slice(0, 10);
if (!evidence.length) return 'The pack does not contain enough evidence.';
const context = makeContextPatch(evidence, { budget: 'small' });

Original hits keep their source data. This pattern can help multi-part compliance questions, product comparisons, investigation timelines, and policies spread across namespaces. Knolo Cortex compare_sources and coverage_review are the runtime's own bounded versions of multi-part evidence collection. They still abstain when the evidence is missing.