Skip to content

InMemoryMemoryService

In-memory implementation of MemoryService for development and testing.

Uses keyword-based search with term overlap scoring. All data is stored in-process and lost on restart.

new InMemoryMemoryService(): InMemoryMemoryService;

InMemoryMemoryService

addSessionToMemory(session, options?): Promise<void>;

Ingest a session into long-term memory.

Typically called when a session ends or reaches a meaningful checkpoint. Implementations may store raw events, extract facts via LLM, or summarize. A session may be ingested multiple times (implementations must handle idempotency).

Parameter Type Description

session

Session

The session to ingest

options?

MemoryIngestionOptions

Optional ingestion configuration

Promise<void>

MemoryService.addSessionToMemory


deleteMemories(userId): Promise<void>;

Delete all memories for a user. Used for GDPR compliance / data cleanup.

Parameter Type

userId

string

Promise<void>

MemoryService.deleteMemories


searchMemory(request): Promise<SearchMemoryResponse>;

Search long-term memory for relevant context.

Returns memories scoped to a specific user within an application context. Implementations may use keyword matching, semantic search, or hybrid approaches.

Parameter Type Description

request

SearchMemoryRequest

Search parameters (userId, query, optional filters)

Promise<SearchMemoryResponse>

MemoryService.searchMemory