Parameter
limitintegerWie viele. Voreinstellungen 200, das ist auch die Obergrenze und das Maximum, das ein Konto halten kann.
Da die Kappe und das Maximum die gleiche Zahl sind, gibt die Voreinstellung alles zurück. Es gibt keine Pagination, weil es nichts zu paginate gibt.
Rückgabewert
[
{
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": "…",
}
]Ein Array, direkt — kein Umschlag. Ein Konto ohne Notizen gibt ein leeres Array.
Der Inhalt kommt damit
Anders als das, was der Agent bekommt – was allein der Index ist – gibt dies alles zurück, Inhalt eingeschlossen. Es ist für eine Person gedacht, die an das, was an sie erinnert wird, schaut.
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']}")Gruppierung nach Typ
| Typ | Bedeutung |
|---|---|
| Präferenz | Wie der Benutzer Dinge tun will. |
| Projekt | Etwas über die Arbeit in der Hand. |
| Tatsache | Etwas Stabiles und Überprüfbares. |
| Berichtigung | Etwas, worüber der Agent falsch lag und von dem er erzählt wurde. |
| Sonstige | Der Standardwert, wenn nichts anderes passt. |
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"])Eine Überprüfung lohnt sich
Gedächtnis verfällt in der Nützlichkeit und nicht in der Größe: Eine Notiz, die über ein Projekt geschrieben wurde, das beendet wurde, wird immer noch in Kontext gelesen.
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']}")Eine Notiz ist über den Kontoinhaber, so dass das Löschen eines in ihrem Namen ist eine Entscheidung, nicht die Haushaltsführung. Zeigt ihnen die Liste ist in der Regel die bessere Bewegung.