Skip to content

turbomemLocal-first agent memory for TypeScript

No Python. No servers. Just npm install.

turbomem

Why embedded memory?

Many agent-memory setups rely on a separate service, a Python server, hosted platform, or self-managed vector DB. For TypeScript apps that means another process, extra infra, and an HTTP hop on every memory call. turbomem runs entirely in-process as a library you npm install.

Embedded vs server-based

turbomem (embedded)Server-based memory
RuntimeTypeScript, in-processSeparate server / hosted API
Deploymentnpm installRun or host a service
Network hopNone (local)HTTP per call
StoragePGlite (disk or IndexedDB)External vector store
Best forTS apps, browser, edge, in-product embedMulti-language or managed infra

If you need a cross-language managed platform, a dedicated memory service may fit better. If you're shipping a TypeScript app and want memory as a library, that's turbomem.

How it works

messages → Extractor (LLM) → facts → Embeddings → vectors → PGlite
query    → Embeddings → vector search (scoped) → ranked results
  • add(messages, scope): extracts discrete facts from conversation, embeds them, and stores each fact with its vector and scope.
  • addFacts(facts, scope): store explicit fact strings directly, skipping LLM extraction.
  • search(query, scope): embeds the query and returns the closest matching facts, filtered by scope.
  • getAll(scope): list every memory in a scope (newest first). The CLI exposes this as turbomem list.
  • delete(id) / deleteAll(scope): remove one memory or wipe a scope.
  • Scoping: every memory is tagged with optional userId, agentId, and sessionId for multi-tenant isolation.

See Architecture for the pipeline and API reference for the full method list.

When turbomem fits

Quick example

ts
import { TurboMemory } from "turbomem";

const memory = new TurboMemory({
  embeddings: "openai",
  storage: "pglite",
  extraction: { provider: "openai", model: "gpt-4.1-mini" },
  openai: { apiKey: process.env.OPENAI_API_KEY },
});

await memory.init();

await memory.add(
  [{ role: "user", content: "I love hiking and I'm training for a half marathon this fall." }],
  { userId: "user_123" },
);

const results = await memory.search("What outdoor activities is the user into?", {
  userId: "user_123",
  limit: 5,
});

console.log(results.map((r) => r.memory.content));

await memory.close();

Explore the docs

Contact

Questions, feedback, or want to report an issue? See the Contact page or email arneesh@turbomem.dev.