Parameters
limitintegerHow many. Defaults to 200, which is also the cap and the maximum a account can hold.
Since the cap and the maximum are the same number, the default returns everything. There is no pagination because there is nothing to paginate.
Returns
[
{
id: "…",
name: "tone-of-voice",
description: "How this user wants to be written to",
content: "Prefers short, direct answers in French.",
type: "preference",
source: "user",
createdAt: "…",
updatedAt: "…"
}
][
{
"id": "…",
"name": "tone-of-voice",
"description": "How this user wants to be written to",
"content": "Prefers short, direct answers in French.",
"type": "preference",
"source": "user",
"createdAt": "…",
"updatedAt": "…",
}
]An array, directly — not an envelope. An account with no notes gives an empty array.
The content comes with it
Unlike what the agent gets — which is the index alone — this returns everything, content included. It is meant for a person looking at what is remembered about them.
const notes = await api.memory.list();
for (const n of notes) {
console.log(`${n.name} · ${n.type} · by ${n.source}`);
console.log(` ${n.description}`);
console.log(` ${n.content}`);
}notes = api.memory.list()
for n in notes:
print(f"{n['name']} · {n['type']} · by {n['source']}")
print(f" {n['description']}")
print(f" {n['content']}")Grouping by type
| type | Means |
|---|---|
| preference | How the user wants things done. |
| project | Something about the work in hand. |
| fact | Something stable and verifiable. |
| correction | Something the agent got wrong and was told about. |
| other | The default when nothing else fits. |
const byType = new Map();
for (const n of await api.memory.list()) {
byType.set(n.type, [...(byType.get(n.type) || []), n]);
}
// Corrections are the ones worth reviewing: each is something that went wrong once.
byType.get("correction")?.forEach((n) => console.log(n.name, "·", n.content));from collections import defaultdict
by_type = defaultdict(list)
for n in api.memory.list():
by_type[n["type"]].append(n)
# Corrections are the ones worth reviewing: each is something that went wrong once.
for n in by_type["correction"]:
print(n["name"], "·", n["content"])A review worth running
Memory decays in usefulness rather than in size: a note written about a project that ended is still read into context every time. Looking at what has not changed in a long while is the cheap version of pruning.
const notes = await api.memory.list();
const quarter = Date.now() - 90 * 24 * 60 * 60 * 1000;
const old = notes.filter((n) => Date.parse(n.updatedAt) < quarter && n.type === "project");
for (const n of old) {
console.log(`still remembered, last touched ${n.updatedAt}: ${n.name} — ${n.description}`);
}from datetime import datetime, timedelta, timezone
notes = api.memory.list()
quarter = datetime.now(timezone.utc) - timedelta(days=90)
old = [n for n in notes
if n["type"] == "project" and datetime.fromisoformat(n["updatedAt"].replace("Z", "+00:00")) < quarter]
for n in old:
print(f"still remembered, last touched {n['updatedAt']}: {n['name']} — {n['description']}")A note is about the account holder, so deleting one on their behalf is a decision, not housekeeping. Showing them the list is usually the better move.