remember()
Store a semantic memory with embedding, optional metadata, optional dedupe, and RememberResult.action.
Signature
remember(options: RememberOptions): Promise<RememberResult>
rememberBatch(items: RememberOptions[]): Promise<RememberResult[]>
interface RememberOptions {
agent: string;
content: { text: string };
metadata?: Record<string, unknown>;
/** Per-call dedupe override; undefined uses constructor `memory.dedupe`. */
dedupe?: boolean | MemoryDedupeConfig;
}
interface RememberResult extends MemoryRecord {
action: "created" | "updated";
}Example
const result = await ctx.remember({
agent: "research",
content: { text: "Acme raised Series B at $50M." },
metadata: { company: "Acme", year: 2024 },
});
console.log(result.id, result.action);Dedupe (0.4)
Dedupe is off by default. Enable via constructor memory.dedupe or per call:
await ctx.remember({
agent: "assistant",
content: { text: "User prefers dark mode" },
dedupe: { strategy: "exact-or-near", nearThreshold: 0.92 },
});When an existing active memory matches, action is "updated" and the row id is reused. Full guide: Memory upsert.