recall
Retrieve memories for a cue — the Single / Many / None answer shape, scope, and the retrieval trace.
recall(input: RecallInput): Promise<RecallResult>recall(request: RecallRequest): Promise<RecallAnswer>
recallFrames(request: RecallRequest): Promise<RecallResponseFrame[]>Parameters
querystringrequiredThe cue. A question, a phrase, or a sentence. On the wire this field is called cueText.
maxResultsintegeroptionalCap on returned memories. The default is the server's; TopKOutOfRange if it exceeds the shard's ceiling.
subjectstringoptionalBias retrieval toward a named subject. Pass the entity's canonical name; it anchors the graph retriever rather than filtering the result.
scope"space" | "namespace"optionalHow wide to read. space — the default — reads the caller's own space. namespace fans out across every space in the caller's namespace and merges the hits. Case-insensitive; any other value is rejected, not quietly narrowed to the default.
includeTracebooleanoptionalReturn Brain's read pipeline alongside the hits. See the warning below for its cost.
Returns
answerKindsingle | many | nonealwaysThe membership verdict. single — one memory answers the cue. many — several do and the caller must choose or summarise. none — Brain has nothing. Branch on this before reading the hits.
memoriesMemoryHit[]alwaysThe hits, ordered best first. Empty when the verdict is none.
memories[].memoryIdstringalwaysThe memory's id.
memories[].textstringalwaysThe stored text, verbatim.
memories[].similarityScorefloatalwaysDistance to the cue, after fusion.
memories[].confidencefloatalwaysConfidence in the memory's content — not in the match.
memories[].saliencefloatalwaysCurrent salience, after decay.
memories[].kindintegeralways0 episodic, 1 semantic, 2 consolidated.
memories[].createdAtUnixNanos64-bit integeralwaysRecord time.
tracestringPresent only when a trace was requested and the server supports it.
Example
const answer = await brain.recall({ query: "where does Priya work now?", maxResults: 5 });
switch (answer.answerKind) {
case "none": return "I don't have anything on that.";
case "single": return answer.memories[0]!.text;
case "many": return summarise(answer.memories);
}recall never fabricates
When Brain holds nothing that answers the cue, the hit list is empty and the
verdict is none. There is no generated fallback and no nearest-miss
padding. A caller that treats "no hits" as a failure will report outages
that are really silences.
The wire AnswerKind is Single / Many / None; the HTTP one is
single / many / none. Code that switches on the string and is moved
between tiers falls through every case silently. The SDK does not normalise
them, because the wire value is what the server sent.
The retrieval trace
A trace returns the read pipeline as text: which retrievers ran, how their results were fused, what the filter chain dropped. It is the tool for "why did I get this answer".
The trace does not scale with maxResults
It reports every candidate each lane considered, so it grows with the size of the space, not with the number of hits you asked for. A three-hit recall over roughly 700 memories measured 121 KB. Leave it off in hot paths; it costs nothing when off.
The wire hit
The wire's MemoryResult carries the retrieval evidence the HTTP tier
flattens away:
contributingRetrieversRetrieverName[]alwaysWhich lanes found this memory — the per-hit answer to "why is this here".
fusedScorefloatalwaysThe score after reciprocal-rank fusion across lanes.
rerankScorefloat | nullalwaysThe cross-encoder's score, or null — which is the normal value, because the reranker ships disabled. See Policies.
edgesEdgeView[] | nullalwaysgraphGraphEnrichment | nullalwaysEntities, statements and relations behind the hit, when requested.
salienceInitial / accessCount / lsn / flags—alwaysoccurredAtUnixNanos / consolidatedAtUnixNanos64-bit integer | nullalwaysEvent time, and when a consolidation absorbed this memory.
edgesOutCount / edgesInCountintegeralwaysFrames
The frame-level form returns the stream unconcatenated, for progressive rendering:
isFinalbooleanalwaystrue on the last frame. Its verdict is the one for the whole read;
earlier frames' is provisional.
cumulativeCountintegeralwaysestimatedRemaininginteger | nullalwaysRecallBuilder
new RecallBuilder(cueText)RecallBuilderrequired.subject(name)thisoptional""..maxResults(n)thisoptional10..confidence(threshold)thisoptional0..salience(floor)thisoptional0..sessions(sessions: bigint[])thisoptional.kinds(kinds: MemoryKindWire[])thisoptional.asOf(recordTimeUnixNanos: bigint)thisoptional.edges(include)thisoptionaltrue..graph(include)thisoptionalfalse..text(include)thisoptionaltrue..trace(enable?)thisoptionalfalse; no argument means true..scope(scope: RecallScopeWire)thisoptional"Space" (default) or "Namespace" — capitalised on the wire..actAs(namespace, space)thisoptional.build()RecallRequestrequiredrequestId.Was this page helpful?