01Install
Install from npm into your project.
BASH
pnpm add @lov3kaizen/agentsea-memory02Example
TS
import { MemoryManager, InMemoryStore } from '@lov3kaizen/agentsea-memory';
const memory = new MemoryManager({ store: new InMemoryStore({ maxSize: 1000 }) });
await memory.add({ content: 'User prefers dark mode', type: 'preference', importance: 0.8 });
const { entries } = await memory.search({ types: ['preference'], limit: 10 });
console.log(entries.length);03Key API
MemoryManager({ store, embedding?, retrieval? })Combines a store with optional embedding and retrieval providers.
MemoryManager.add / search / update / delete / clearStores, finds, changes and removes memory entries.
TemporalRetrieval / SemanticRetrieval / HybridRetrieval / RetrievalPipelineRetrieval strategies: by time, by meaning, a mix of both, or a pipeline of several steps.
PostgresStore({ connectionString, tableName, vectorDimensions })Stores memory in PostgreSQL. The table name defaults to memories.
AccessControlControls which agents can read and write memory that is shared between them.
04Caveats
- InMemoryStore keeps entries in memory and is meant for development and tests. Its ttl is in milliseconds.
- Each backend needs its driver installed: ioredis, pg or better-sqlite3. A PineconeStoreConfig type is exported, but this version has no Pinecone store class.
- The README Quick Start imports BufferMemoryStore and RecencyRetrieval. This version exports InMemoryStore and TemporalRetrieval instead.
- MemoryManager.retrieve needs an embedding provider set with setEmbedding. Without one it throws. search does not need one.