MemoryStore
Defined in: src/lib/memory/store/types.ts:281
One user’s memories, pitched at what the apps do with them rather than at the storage ops underneath. Two backends are intended: the on-device WatermelonDB vault (createLocalMemoryStore) and, later, an HTTP client for the server-side store.
Every value crossing this interface is plain data — no WatermelonDB Model,
Query or Collection — so a remote backend can serialize it. The one
exception is the DEVICE-LOCAL LLM-call knobs on MemoryRecallOptions
and MemoryRetainOptions, which a remote store uses on the device
rather than forwarding to nearby. Server persistence is authoritative;
content decryption and plaintext-dependent processing remain on the device. Reads are
whole-result rather than per-row so a chat turn costs a handful of calls
(recall, then retain per fact), not one per memory.
Writes resolve null / false for a memory that is missing, deleted or
not owned by this store’s user; they don’t throw for it.
Properties
decay?
readonlyoptionaldecay:MemoryDecay
Defined in: src/lib/memory/store/types.ts:355
Rule-based decay, available without the local-only MemoryMaintenance.
factSource
readonlyfactSource:RecallFactSource
Defined in: src/lib/memory/store/types.ts:338
The fact lane of recall, for callers that fuse it with other lanes such as conversation chunks.
maintenance?
optionalmaintenance:MemoryMaintenance
Defined in: src/lib/memory/store/types.ts:353
TRANSITIONAL — see MemoryMaintenance. Absent on a remote backend.
masksEmbeddingInput
readonlymasksEmbeddingInput:boolean
Defined in: src/lib/memory/store/types.ts:340
True when the store was built with embeddingOptions.maskInput, so every embedding request it makes is masked.
topicMaintenance
readonlytopicMaintenance:MemoryTopicMaintenance
Defined in: src/lib/memory/store/types.ts:357
Topic-extraction upkeep, available on every backend.
Methods
addTopics()
addTopics(
memoryId:string,topics: readonlyEntityInput[],options?:object):Promise<StoredEntity[]>
Defined in: src/lib/memory/store/types.ts:316
Add topics alongside the existing ones (auto-tagging stays on).
Parameters
| Parameter | Type |
|---|---|
|
|
|
|
|
readonly |
|
|
|
|
|
() => |
|
|
|
|
|
|
Returns
Promise<StoredEntity[]>
archive()
archive(
id:string):Promise<boolean>
Defined in: src/lib/memory/store/types.ts:311
Parameters
| Parameter | Type |
|---|---|
|
|
|
Returns
Promise<boolean>
counts()?
optionalcounts():Promise<MemoryCounts>
Defined in: src/lib/memory/store/types.ts:287
Metadata-only counts for the live, archived and quarantined lists.
Returns
Promise<MemoryCounts>
create()
create(
input:MemoryCreate):Promise<StoredVaultMemory>
Defined in: src/lib/memory/store/types.ts:303
Manual save; missing embeddings are filled in the background.
Parameters
| Parameter | Type |
|---|---|
|
|
Returns
Promise<StoredVaultMemory>
createMany()
createMany(
inputs:MemoryCreate[]):Promise<StoredVaultMemory[]>
Defined in: src/lib/memory/store/types.ts:305
One write for a batch of manual saves; migration/restore uses lower-level operations.
Parameters
| Parameter | Type |
|---|---|
|
|
Returns
Promise<StoredVaultMemory[]>
createTopic()?
optionalcreateTopic(name:string):Promise<string|null>
Defined in: src/lib/memory/store/types.ts:283
Creates an account-scoped topic without requiring a memory.
Parameters
| Parameter | Type |
|---|---|
|
|
|
Returns
Promise<string | null>
delete()
delete(
id:string):Promise<boolean>
Defined in: src/lib/memory/store/types.ts:308
Soft delete; also drops the memory’s topic links.
Parameters
| Parameter | Type |
|---|---|
|
|
|
Returns
Promise<boolean>
get()
get(
id:string):Promise<StoredVaultMemory|null>
Defined in: src/lib/memory/store/types.ts:290
Parameters
| Parameter | Type |
|---|---|
|
|
|
Returns
Promise<StoredVaultMemory | null>
importTopics()?
optionalimportTopics(topics: readonlyobject[]):Promise<void>
Defined in: src/lib/memory/store/types.ts:285
Imports local topic metadata without replacing server entries or tombstones.
Parameters
| Parameter | Type |
|---|---|
|
|
readonly |
Returns
Promise<void>
list()
list(
options?:MemoryListOptions):Promise<StoredVaultMemory[]>
Defined in: src/lib/memory/store/types.ts:289
Memories newest-first, decrypted, WITH embedding (Memory Graph edges read it).
Parameters
| Parameter | Type |
|---|---|
|
|
Returns
Promise<StoredVaultMemory[]>
listArchived()
listArchived():
Promise<StoredVaultMemory[]>
Defined in: src/lib/memory/store/types.ts:292
Decay-archived memories (not deleted, quarantined or superseded), most recently archived first.
Returns
Promise<StoredVaultMemory[]>
listProjections()
listProjections(
options?:MemoryListOptions):Promise<VaultMemoryProjection[]>
Defined in: src/lib/memory/store/types.ts:300
The memories MemoryStore.list would return, without decrypting content.
Parameters
| Parameter | Type |
|---|---|
|
|
Returns
Promise<VaultMemoryProjection[]>
listTopics()
listTopics():
Promise<MemoryTopic[]>
Defined in: src/lib/memory/store/types.ts:298
Every topic by canonical name, with its kind and linked-memory count.
Returns
Promise<MemoryTopic[]>
memoriesByTopics()
memoriesByTopics(
names: readonlystring[]):Promise<Map<string,Set<string>>>
Defined in: src/lib/memory/store/types.ts:294
Memory id → which of names it is linked to. Names are matched case-insensitively.
Parameters
| Parameter | Type |
|---|---|
|
|
readonly |
Returns
Promise<Map<string, Set<string>>>
recall()
recall(
query:string,options?:MemoryRecallOptions):Promise<RecallResult>
Defined in: src/lib/memory/store/types.ts:335
Parameters
| Parameter | Type |
|---|---|
|
|
|
|
|
Returns
Promise<RecallResult>
recordRecalls()?
optionalrecordRecalls(memoryIds: readonlystring[]):Promise<void>
Defined in: src/lib/memory/store/types.ts:333
Count one answer for each memory in memoryIds; call it once after the answer finishes, with the pre-retrieved ids plus any the memory tool recalled during it, so stopped and failed answers are not counted.
Parameters
| Parameter | Type |
|---|---|
|
|
readonly |
Returns
Promise<void>
repairEmbeddings()?
optionalrepairEmbeddings(options?:EmbeddingRepairOptions):Promise<EmbeddingRepairResult>
Defined in: src/lib/memory/store/types.ts:350
Re-embeds memories the backend cannot rank with the current model. Absent where recall re-embeds lazily.
Parameters
| Parameter | Type |
|---|---|
|
|
Returns
Promise<EmbeddingRepairResult>
restore()
restore(
id:string):Promise<boolean>
Defined in: src/lib/memory/store/types.ts:312
Parameters
| Parameter | Type |
|---|---|
|
|
|
Returns
Promise<boolean>
retain()
retain(
content:string,options?:MemoryRetainOptions):Promise<RetainResult>
Defined in: src/lib/memory/store/types.ts:336
Parameters
| Parameter | Type |
|---|---|
|
|
|
|
|
Returns
Promise<RetainResult>
setEnabled()?
optionalsetEnabled(id:string,enabled:boolean):Promise<StoredVaultMemory|null>
Defined in: src/lib/memory/store/types.ts:331
Switch a memory on or off for answers; a switched-off memory stays listed but is never recalled.
Parameters
| Parameter | Type |
|---|---|
|
|
|
|
|
|
Returns
Promise<StoredVaultMemory | null>
setTopics()
setTopics(
memoryId:string,topics: readonlyEntityInput[]):Promise<StoredVaultMemory|null>
Defined in: src/lib/memory/store/types.ts:314
Replace the memory’s topics with a user-chosen set and stop auto-tagging it.
Parameters
| Parameter | Type |
|---|---|
|
|
|
|
|
readonly |
Returns
Promise<StoredVaultMemory | null>
setVisibility()
setVisibility(
id:string,visibility:VaultMemoryVisibility,options?:object):Promise<StoredVaultMemory|null>
Defined in: src/lib/memory/store/types.ts:325
Parameters
| Parameter | Type |
|---|---|
|
|
|
|
| |
|
|
|
|
|
|
Returns
Promise<StoredVaultMemory | null>
subscribe()
subscribe(
onChange: () =>void,options?:MemorySubscribeOptions): () =>void
Defined in: src/lib/memory/store/types.ts:347
Call onChange after the store’s memories change; re-read to see what
changed. Does not fire for the state at subscription time — read once
after subscribing. Returns the unsubscribe function.
Parameters
| Parameter | Type |
|---|---|
|
|
() => |
|
|
Returns
():
void
Returns
void
supersede()
supersede(
id:string,supersededById:string):Promise<boolean>
Defined in: src/lib/memory/store/types.ts:310
Retire id behind the newer supersededById (both must be live and owned).
Parameters
| Parameter | Type |
|---|---|
|
|
|
|
|
|
Returns
Promise<boolean>
topicsByMemories()
topicsByMemories(
memoryIds: readonlystring[]):Promise<Map<string,Set<string>>>
Defined in: src/lib/memory/store/types.ts:296
Memory id → its canonical (lowercased) topic names. Unlinked ids are absent.
Parameters
| Parameter | Type |
|---|---|
|
|
readonly |
Returns
Promise<Map<string, Set<string>>>
update()
update(
id:string,patch:MemoryUpdate):Promise<StoredVaultMemory|null>
Defined in: src/lib/memory/store/types.ts:306
Parameters
| Parameter | Type |
|---|---|
|
|
|
|
|
Returns
Promise<StoredVaultMemory | null>