Skip to Content
Anuma SDKReactInternalFunctionsgetMemoriesByEntityNamesOp

getMemoriesByEntityNamesOp

getMemoriesByEntityNamesOp(ctx: EntityOperationsContext, entityNames: readonly string[]): Promise<Map<string, Set<string>>>

Defined in: src/lib/db/entities/operations.ts:222 

W5 graph-lane read: given a set of entity names (e.g. extracted from a query), return the set of memory IDs linked to any of them, with a per-memory count of how many of the queried entities they match.

Caller passes the result to rankByEntityOverlap to score each memory via tanh(0.5 × shared_entity_count) — this op only does the cheap “find candidate memories” step and leaves scoring to the ranker so callers can attach their own kind-weights or alternative scoring strategies later.

Names are normalized (lowercased, trimmed). Empty input returns an empty map. Names that don’t exist as entities contribute nothing.

Multi-user safety: when ctx.userId is set, results are filtered to memory_entity rows whose user_id matches. Without this filter the lane returns IDs from every user who tagged a matching entity.

Parameters

ParameterType

ctx

EntityOperationsContext

entityNames

readonly string[]

Returns

Promise<Map<string, Set<string>>>

Last updated on