# list()

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

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

كل ملاحظة على الحساب، آخرها تغير أولاً، مع المحتوى. هذه هي الشاشة التي تعرضها للمستخدم.

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

## المعاملات {#parameters}

| Name | Type | Requirement | Description |
| --- | --- | --- | --- |
| `limit` | integer |  | عدد. عدد. `200`وهو أيضاً الغطاء والحد الأقصى الذي يمكن أن يحمله الحساب. |

بما أنّ الغطاء والأقصى هما نفس العدد، فإنّ الإفتراض يعود بكلّ شيء. لا يوجد مائل لأنّه لا يوجد شيء لتمييزه.

## القيمة المُعادة {#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: "…"
  }
]
```

حساب بدون ملاحظات يعطي مصفوفة فارغة .

## الـ المحتوى يأتي معه {#content}

فخلافا لما يحصل عليه العامل — اي المؤشر وحده — يعود كل شيء ، بما فيه المحتوى .

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

## المجموعة حسب نوع النوع {#group}

| نوع | المعنى |
| --- | --- |
| ) | كيف يريد المستخدم أن يتم الأمر |
| مشروع مشروع | شيء ما عن العمل في يد |
| الوقائع | شيء مستقر وقابل للتحقق |
| أولاً- التصحيح | شيء ما أخطأ العميل و أخبر عنه |
| غير | الإفتراض عندما لا شيء آخر يناسب |

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

## A مراجعة تستحق الركض {#review}

انحلال الذاكرة من حيث الفائدة لا من حيث الحجم: مذكرة مكتوبة عن مشروع انتهى لا يزال يقرأ في سياق كل مرة. بالنظر إلى ما لم يتغير في وقت طويل هو النسخة الرخيصة من التقطيع.

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

> **أو دع المستخدم يفعل ذلك**
>
> ملاحظة عن صاحب الحساب، لذا فحذف واحد نيابة عنهم هو قرار وليس تدبير منزلي، وإظهار القائمة لهم هو عادة أفضل خطوة.

- [save()](/ar/sdk/ref/memory/save): كتابة أو استبدال واحدة.
- [delete()](/ar/sdk/ref/memory/delete): إزالة واحدة بالاسم

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