Simplified API
TheMemoryManager exposes three high-level methods — remember, recall, and forget — that act as a facade over all enabled memory stores. Use them when you want quick, store-agnostic memory operations without reaching into individual stores.
remember
Store a piece of information. The method dispatches to the appropriate store based on the options you provide:| Condition | Target Store |
|---|---|
userId provided and userFacts enabled | UserFacts.addFacts |
| learnings enabled (no userId or userFacts disabled) | LearnedKnowledge.saveLearning |
| entities enabled (fallback) | EntityMemory.addFact |
Signature
Parameters
| Parameter | Type | Description |
|---|---|---|
content | string | The information to store |
opts.userId | string | Routes to user-scoped facts when provided |
opts.scope | string | Namespace or context label (used as namespace for learnings) |
opts.importance | number | 0–1 importance weight, affects recall ranking |
Examples
recall
Search across all enabled stores, apply composite scoring, and return ranked results.Signature
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
query | string | — | Natural-language search query |
opts.userId | string | — | Include user-scoped facts in the search |
opts.topK | number | 10 | Maximum results returned |
opts.scope | string | — | Reserved for future scope filtering |
Return type
How recall dispatches
recall fans out to every enabled store in parallel, collects candidates, scores each one, then returns the top-K results sorted by score.
| Store | What it searches | Semantic signal |
|---|---|---|
| UserFacts | Active facts for the given userId | Substring match → 0.8, else 0.2 |
| EntityMemory | All entities by name match | Name hit → 0.9, miss → skipped |
| LearnedKnowledge | Vector similarity search | Embedding distance → 0.7 baseline |
| GraphMemory | Graph node search | Node relevance → 0.75 baseline |
computeCompositeScore, which blends:
| Factor | Default Weight | Description |
|---|---|---|
| Semantic similarity | 0.4 | How well the content matches the query |
| Recency | 0.3 | Exponential decay with a 30-day half-life |
| Importance | 0.3 | The importance value stored with the item |
Examples
forget
Remove memories matching the given criteria. Returns the count of stores cleared.Signature
Parameters
| Parameter | Type | Description |
|---|---|---|
opts.userId | string | Target user for fact/profile deletion |
opts.factId | string | Remove a specific fact (requires userId) |
opts.entityId | string | Remove a specific entity |
opts.scope | string | Reserved for future scope-based deletion |
Deletion behaviour
| Input | What happens |
|---|---|
userId + factId | Removes that single fact from UserFacts |
entityId | Removes that entity from EntityMemory |
userId alone (no factId/entityId) | Clears all facts and profile data for the user |
Examples
Full Example
Cross-References
- Memory Overview — How the full memory system works
- Memory Stores — Deep dive into each store type
- Memory Curator — Pruning, dedup, and maintenance