MemLibMemLib

Batch, List & Utilities

batchStore(), list(), delete(), and health() methods

batchStore()

Store multiple memories at once. Uses raw store (no LLM inference) for all items.

const result = await mem.batchStore({
  memories: [
    { content: "Likes coffee" },
    { content: "Works remotely", tags: ["work"] },
    { content: "Located in Berlin", metadata: { source: "profile" } },
  ],
});

console.log(result.count);    // 3
console.log(result.memories); // [...Memory[]]

Options

OptionTypeRequiredDescription
namespacestringOverride default namespace
entitystringOverride default entity
memoriesArrayArray of memories to store

Each memory in the array accepts:

FieldTypeRequiredDescription
contentstringText content
tagsstring[]Tags for categorization
metadataRecord<string, unknown>Arbitrary metadata
ttlnumberTime-to-live in seconds

Return Type

interface BatchStoreResult {
  count: number;
  memories: Memory[];
}

Note: Batch store doesn't use smart store — no fact extraction, no conflict resolution. Use it for pre-processed data imports.


list()

List stored memories in a namespace.

// List all memories for the default entity
const all = await mem.list();

// List with filters
const filtered = await mem.list({
  entity: "user-456",
  limit: 20,
});

Options

OptionTypeRequiredDescription
namespacestringOverride default namespace
entitystringOverride default entity
limitnumberMaximum memories to return

Return Type

Returns Memory[]:

interface Memory {
  id: string;
  namespace: string;
  entity: string;
  content: string;
  category: string | null;
  tags: string[] | null;
  metadata: Record<string, unknown> | null;
  importance: number | null;
  source: string | null;
  createdAt: string;
  lastAccessed: string | null;
  expiresAt: string | null;
}

delete()

Delete a memory by its UUID. Requires an API key with Admin permission.

await mem.delete("550e8400-e29b-41d4-a716-446655440000");

Return Type

interface DeleteResult {
  deleted: boolean;
}

health()

Check API connectivity and verify your API key is valid.

const { status } = await mem.health();
console.log(status); // "ok"

Return Type

interface HealthResult {
  status: string;
  [key: string]: unknown;
}

On this page