# list()

Canonical URL: https://developers.iagenify.com/de/sdk/ref/memory/list/
Language: de

`api.memory.list({ limit }) → Promise<Memory[]>`

Jede Notiz auf dem Konto, zuletzt zuerst geändert, mit seinem Inhalt. Dies ist der Bildschirm, den Sie den Benutzer anzeigen.

Status: GET /api/ai/memories · free · an array

## Parameter {#parameters}

| Name | Type | Requirement | Description |
| --- | --- | --- | --- |
| `limit` | integer |  | Wie 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 {#returns}

```javascript
[
  {
    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 {#content}

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.

```javascript
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}`);
}
```

## Gruppierung nach Typ {#group}

| 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. |

```javascript
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));
```

## Eine Überprüfung lohnt sich {#review}

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.

```javascript
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}`);
}
```

> **Beschneiden Sie es von Hand oder lassen Sie es den Benutzer tun**
>
> 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.

- [save()](/de/sdk/ref/memory/save): Schreiben oder ersetzen eines.
- [delete()](/de/sdk/ref/memory/delete): Einen Namen entfernen.

```python
[
    {
        "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": "…",
    }
]
```

```python
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']}")
```

```python
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"])
```

```python
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']}")
```
