Expand description
SQL builders for memory recall / listing. The queries run server-side
(where KymaTable + the cosine_distance UDF live) against the columnar
memory tables. Each query first dedups to the latest version per node id
(row_number() ... ORDER BY updated_at DESC), matching the append-only
“latest-wins” model.
Functions§
- keyword_
recall_ sql - Keyword recall: rank latest memories by how many query tokens appear in
content/title/tags. EachLIKEtriggers the extent token-set pruning (ContainsTokens) so this is index-accelerated. Excludes rows with no hit. - latest_
node_ sql - Fetch the full latest version of a single node (for read-then-append mutations like status/importance updates).
- list_
sql - Non-semantic listing with filters, newest first.
- neighbors_
sql - One-hop neighbour edges for a set of seed node ids (both directions), used
to graph-expand a contextual subgraph. Returns edge rows; the orchestrator
derives the far endpoint per seed and follows
target_namespacefor cross-graph (catalog resource / trace) links. Caller must pass ≥1 seed. - nodes_
by_ id_ sql - Fetch the latest versions of specific (currently-valid) memory node ids — used to materialize graph-pulled neighbour memories. Caller must pass ≥1 id.
- recall_
sql - Semantic recall: dedup → cosine distance → blended re-rank
(
relevance*0.7 + importance*0.3) → toplimit. - sql_str
- Quote + escape a string literal for inline SQL.
- tokenize_
query - Tokenize a free-text query the same way the columnar writer tokenizes stored text (lowercase, split on non-alphanumeric, drop tokens < 2 chars), so query tokens line up with the per-extent token index used for pruning.