Skip to content

Quickstart

You’ll need a Memoturn API key and project slug. Get them from memoturn.aiAPI keys in your project.

Terminal window
pnpm add @memoturn/sdk
import { Memoturn } from "@memoturn/sdk";
const mt = new Memoturn({
apiKey: process.env.MEMOTURN_API_KEY!,
projectId: "my-project",
});
await mt.recordTurn({ role: "user", content: "deploying the worker tonight" });
const { hits } = await mt.searchMemory({ query: "deploy", k: 5 });
console.log(hits);

search_memory accepts a mode:

modeuse it for
auto (default)Hybrid recall — dense + lexical + DO-hot fused via RRF.
chunksSame hybrid pipeline, but excludes rolling summaries.
summariesOnly retrieve consolidated session summaries. “What did we figure out?”
entitiesSymbol/file/error-code lookup. Pair with the regular search for full text.
codeHybrid plus a fourth fusion leg that boosts turns matching extracted symbols.
await mt.searchMemory({ query: "auth flow", mode: "summaries" });
for await (const event of mt.subscribe()) {
console.log(event.kind, event.payload);
// turn_recorded · memory_pinned · memory_forgotten · broadcast_set · presence_updated · consolidation_completed
}