MemoGrafterAgent
recall()
Retrieve semantically relevant memories from the current session.
What it does
Retrieve semantically relevant memories from the current session.
When to use it
Use when the application owns prompt construction or needs to inspect retrieved evidence without calling the chat model.
Signature
TypeScript
recall(query: string, options?: RetrieverConfig): Promise<RetrievalResult>Parameters
query (string) — Natural-language intent used to rank relevant memory.options? (RetrieverConfig) — A typed options object. The applicable fields and defaults are documented below.RetrieverConfig fields
limit? (number) — Maximum number of ranked memory facts to return.minSimilarity? (number) — Minimum semantic similarity required for a match.tokenBudget? (number) — Maximum token budget for assembled prompt context.tags?, tagMode?, scope?, sessionIds? — Control tag matching and authorized session scope.scoring? — Blend semantic similarity and stored confidence; defaults are 0.7 and 0.3 respectively.cache.ttlSeconds? — Override the retrieval-cache lifetime for this operation.RetrievalResult fields
facts contains ranked memory objects augmented with a semantic similarity score.nodes contains the parent topics represented by the returned facts.systemPrompt is prompt-ready memory context; tokenCount reports its size against optional tokenBudget.Result
A retrieval result containing ranked facts, matched topics, generated prompt context, and token counts.
Behavior
Embeds the query, searches active structured memories, filters lifecycle-ineligible rows, ranks matches by similarity and confidence, and assembles prompt-ready context within the token budget.
Results are facts rather than full conversation transcripts.
Side effects and completion
Read-only, apart from optional retrieval-cache writes.
Errors and empty results
Rejects embedding-provider, storage, or cache failures. No matches resolve successfully with empty
facts and nodes.Example
example.ts
const result = await agent.recall("deployment preferences", { limit: 5 });More examples
Inspect evidence
const result = await agent.recall("deployment preferences", { limit: 5 });
for (const fact of result.facts) {
console.log(fact.value, fact.similarity, fact.confidence);
}
console.log(result.systemPrompt);