Expand description
Agent-facing type & multi-model knowledge reference — generated from the engine’s own type-system authorities (ADR 0061, “Agent-Facing Knowledge & MCP Surface”).
Where crate::knowledge’s sibling in reddb-io-rql emits the RQL grammar
surface, this module emits the value-type catalog and the multi-model
map. The volatile facts come straight from the source of truth so the
reference cannot drift from the engine:
- the value types come from the three type-system authorities in this crate
— [
function_catalog::FUNCTION_CATALOG], [operator_catalog::OPERATOR_CATALOG], and [cast_catalog::CAST_CATALOG] (every concrete type they reference), and - the operators and casts are likewise read live from those tables.
Layered over that per-model type catalog is the multi-model map: the
paradigms RedDB stores (documents, key-value, queues, graph nodes/edges,
vault secrets, config, and RQL-tabular collections). The map is the
conceptual narrative — hand-authored because it is judgment, not extractable
— but it points into the generated type catalog by TypeCategory, so the
two layers stay coupled.
Nothing here hand-maintains which value types exist — that is read from
the catalogs above. The same generated content is served two ways from this
one source: as the reddb://knowledge/types MCP resource and as the type
section of the generated docs/llms.txt. The anti-drift tests at the bottom
pin the “generated, exhaustive, in-sync” contract.
Structs§
- Model
Paradigm - One paradigm in RedDB’s multi-model surface. The narrative (
summary) is hand-authored judgment;categoriespoints into the generated value-type catalog so the map is layered over — not duplicated from — the type system.
Constants§
- LLMS_
BEGIN_ MARKER - Markers delimiting the generated type block inside
docs/llms.txt. Thedocs/llms.txtsync test reads the text between these markers and asserts it equalstype_reference_markdown, so the file is generated, not hand-maintained. - LLMS_
END_ MARKER - Closing marker for the generated type block in
docs/llms.txt. - MULTI_
MODEL_ MAP - The multi-model map: the paradigms RedDB stores, layered over the value-type
catalog. Hand-authored narrative (ADR 0061 §3), but each entry references the
generated
TypeCategoryfamilies it predominantly holds. - RESOURCE_
DESCRIPTION - One-line description of the type knowledge resource.
- RESOURCE_
TITLE - Short human title for the type knowledge resource.
- RESOURCE_
URI - Canonical URI for the type & multi-model knowledge resource served over MCP.
Functions§
- casts_
from - Every cast out of
tyregistered inCAST_CATALOG, in catalog order. Each tuple is(target, context, lossy)read straight from the catalog row. - catalogued_
value_ types - Every concrete value type referenced by the type-system authorities (function / operator / cast catalogs), sorted by discriminant and deduplicated.
- implicit_
casts - The implicit (always-allowed, lossless) casts the engine inserts silently,
sorted by
(src, target)discriminant. These are the widenings an agent can rely on without writingCAST(...). - infer_
literal_ type - Infer the
DataTypeof a bare JSON literal as the engine would type it on the wire:null → NULLABLE, booleans →BOOLEAN, integral numbers →INTEGER, fractional numbers →FLOAT, strings →TEXT, arrays →ARRAY, objects →JSON. - operator_
symbols - Distinct operator symbols, sorted, taken from the engine’s static
OPERATOR_CATALOG. The catalog carries one row per overload, so a symbol (e.g.-, which is both infix and prefix) can appear several times — this collapses them. - operators_
for - Every operator overload in
OPERATOR_CATALOGthat acceptstyas one of its operands, in catalog order. TheNullableleft-operand marker on prefix operators is treated as “no left operand”, so a prefix-matches only whentyis its (right) operand, never via the marker. - resolve_
type_ name - Resolve a type name (canonical reddb spelling or a common SQL alias, both
case-insensitive — e.g.
INTEGER,int,string) to itsDataType. - type_
facts_ json - Build the structured
reddb_type_ofanswer for a resolvedDataType: its canonical name + category, the casts available out of it, and the operator overloads that accept it — all read live from the catalogs. - type_
llms_ section - The type block as embedded in
docs/llms.txt: the generated reference fenced by the begin/end markers. Emitting the markers here keepsdocs/llms.txtand the MCP resource fed by one source. - type_
of_ json - Answer a
reddb_type_ofquery. Exactly one oftype_nameorvalueshould carry the lookup subject: a type name (resolved withresolve_type_name) or a JSON literal whose structural type is inferred withinfer_literal_type. Returns the structured facts fromtype_facts_jsonwrapped with the resolved canonical type, orNonewhen a supplied type name is unknown to the engine. - type_
reference_ markdown - Generate the canonical type & multi-model reference as Markdown, sourced
entirely from the engine’s type-system authorities (for the type catalog)
plus the hand-authored multi-model narrative. This single string is what the
MCP
reddb://knowledge/typesresource serves and whatdocs/llms.txtembeds.