Class MemMachineMemory
The MemMachineMemory class is the primary interface for interacting with the MemMachine memory engine. It allows you to store natural language “episodes” and retrieve them later using semantic search.
The recommended way to access this class is via an existing project instance:
| Name | Type | Description |
|---|---|---|
memoryContext | MemoryContext | Optional scope settings to filter or categorize these memories. |
Methods
add()
Adds a new memory to the MemMachine server.
| Name | Type | Description |
|---|---|---|
content | string | The text or data to be remembered. |
options | AddMemoryOptions | Configuration like episode_type or producer role. |
Promise<AddMemoryResult>— The result containing the uniqueidof the new memory.
search()
Performs a semantic search to find relevant memories based on a natural language query.
| Name | Type | Description |
|---|---|---|
query | string | The question or phrase to search for. |
options | SearchMemoryOptions | Limits, filters, or minimum similarity scores. |
Promise<SearchMemoryResult>— A list of relevant EpisodicMemory objects.
delete()
Permanently removes a specific memory from the system.
| Name | Type | Description |
|---|---|---|
id | string | The unique ID of the memory (returned during add or search). |
type | MemoryType | Specify either episodic or semantic. |
getContext()
Returns the combined Project and Memory configuration currently in use by this instance.
ProjectContext & MemoryContext— The active scope for this memory instance.

