Skip to content

mnemo.recall()

Retrieve memories by semantic search. Automatically applies Weibull decay, deduplication, and ranking.

Signature

typescript
mnemo.recall(query: string, options?: {
  limit?: number;
  scopeFilter?: string[];
  category?: MemoryCategory;
}): Promise<Array<{
  text: string;
  score: number;
  category: string;
  importance: number;
  timestamp: number;
}>>

Example

typescript
const results = await mnemo.recall('What are the user preferences?', {
  limit: 5,
  category: 'preference',
});

for (const r of results) {
  console.log(`[${r.score.toFixed(2)}] ${r.text}`);
}

Parameters

FieldTypeDefaultDescription
querystringNatural language query
limitnumber?5Maximum results to return
scopeFilterstring[]?all scopesOnly search these scopes
categoryMemoryCategory?allOnly return this category

Return Value

Array of results, sorted by relevance score (highest first):

FieldTypeDescription
textstringMemory content
scorenumberRelevance score (0.0 – 1.0)
categorystringMemory category
importancenumberImportance score
timestampnumberCreation timestamp (ms since epoch)

Released under the MIT License.