TypeScript
remember
Storing something worth recalling.
ts
await hm.remember({
content: "We cap production deploys at 3 per month, on Tuesdays",
});Parameters
content | Required. A self-contained statement |
sourceRef | Where this was established, for origin ranking. Omit when nothing meaningful to name |
kind | fact (default), decision, or turn |
metadata | Your own fields, filterable at retrieval time |
customId | Your own identifier, see below |
sourceTool | Which client is writing, for the activity view |
threadId | Join a specific thread |
Result
ts
{
id: string;
threadId: string | null; // the thread it landed in
updated: boolean; // replaced an existing row
duplicate: boolean; // identical content already existed
supersededId: string | null;
supersededIds: string[]; // memories this one retired
supersededReason: "lexical" | "restatement" | "numeric" | "polarity" | null;
}supersededIds is worth surfacing to a user. It means a belief changed, and
telling them which one is more useful than silently adding a contradiction.
Not storing the same thing twice
Give a memory your own identifier and re-sending it becomes cheap:
ts
await hm.remember({ content: readme, customId: "repo-readme" });- Same id, unchanged content → no-op, not billed,
duplicate: true - Same id, changed content → replaces in place,
updated: true - No id, but identical text already exists → recognised as the same fact
This is what makes a long-running loop affordable, and what stops a store filling with twenty copies of one document.
Metadata
ts
await hm.remember({
content: "The billing service runs Postgres 16 in eu-west-1",
metadata: { team: "platform", env: "prod", priority: 9 },
});Then filter on it, see recall.
Many at once
ts
await hm.rememberMany([
{ content: "…" },
{ content: "…", metadata: { team: "platform" } },
]);Up to 25 per call. Partial success is reported per item, so one bad entry does not discard the rest.
Each document is embedded server-side, which takes roughly a second and a half, so a full batch of 25 takes about thirty seconds. If you want progress, send several smaller calls.