> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cognee.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Memory API

> The high-level memory operations in @cognee/cognee-ts: remember, recall, improve, forget, and rememberEntry.

Use these operations first. They are the high-level memory API in the TypeScript
SDK. For explicit staged control over the underlying pipeline, see
[Legacy Pipeline Operations](/typescript/legacy-operations).

## remember

Store content as permanent graph memory, or as session memory when you pass
`sessionId`.

```ts theme={null}
// Permanent graph memory: ingest, extract, and enrich in one call.
await c.remember({ type: "text", text: "…" }, "my-dataset", {
  selfImprovement: true,
});

// Session memory: fast short-term memory for a conversation or agent run.
await c.remember({ type: "text", text: "…" }, "my-dataset", {
  sessionId: "session-id",
  selfImprovement: true,
});
```

## recall

Retrieve from session and graph memory. With `scope: "auto"`, session memory is
checked before graph memory.

```ts theme={null}
const result = await c.recall("What did we discuss?", {
  sessionId: "session-uuid",
  scope: "auto",   // "graph" | "session" | "trace" | "graph_context" | "all"
});
```

## improve

Run the session-to-graph bridge and graph enrichment pipeline.

```ts theme={null}
await c.improve({
  datasetName: "my-dataset",
  sessionIds: ["session-uuid"],
});
```

## forget

Remove permanent memory by item, dataset, or everything.

```ts theme={null}
// Forget a single item
await c.forget({ kind: "item", dataId: "uuid", dataset: { name: "my-dataset" } });

// Forget an entire dataset
await c.forget({ kind: "dataset", dataset: { name: "my-dataset" } });

// Forget everything
await c.forget({ kind: "all" });
```

## rememberEntry

Store a typed memory entry (`"qa"`, `"trace"`, or `"feedback"`) in a session.

```ts theme={null}
const result = await c.rememberEntry(
  { type: "qa", question: "…", answer: "…" },
  "my-dataset",
  "session-uuid",
  { tenant: "tenant-id" }, // optional
);
```
