AI Query Layer
The AI Query Layer lets an AI retrieve compact, exact semantic context without loading an entire Kristal or relying only on prose/chunk retrieval.
Preferred flow
natural-language request
↓ approximate discovery (optional)
candidate semantic IDs
↓ deterministic identity resolution
exact graph / assertion / evidence query
↓ typed KQP plan
semantic result / continuation
↓ context compiler
bounded AI context bundle
Approximate discovery can use lexical search, embeddings or ranking. Discovery remains distinguishable from exact semantic query.
Standard query families
identity_lookupneighborhoodsemantic_traversalevidence_closureauthority_resolutiontemporaldiffcapabilityconstraintscross_kristallexicalunknownssemantic_slice
Implementations may add namespaced custom modes but must expose their normalized plan and capability support.
Progressive disclosure
Large evidence/source payloads should use a claim-check style: return semantic/evidence references, digests and compact metadata first, then expand only when needed.
Exactness boundary
After identity resolution, traversal uses declared semantic IDs and canonical source references. Similarity scores, embedding distance and model confidence are never factual assertions.
Planner boundary
An AI model may propose a KQP request. The query engine validates and normalizes it deterministically. The model does not gain authority by requesting a wider scope, more budget, privileged shards or mutation rights.
See Query-Algebra-and-Planning, AI-Context-Compiler and Security-and-Trust-Boundaries.