---
url: 'https://adk.nht.io/api/@nhtio/adk/common/classes/Memory.md'
description: 'An immutable, validated memory entry held by the agent.'
---

# Class: Memory

Defined in: [lib/classes/memory.ts:80](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/classes/memory.ts#L80)

An immutable, validated memory entry held by the agent.

## Remarks

Constructed from a [RawMemory](../interfaces/RawMemory.md) via `rawMemorySchema`. All temporal fields are
normalised to Luxon `DateTime` instances at construction time. The `content` field is
always a [@nhtio/adk!Tokenizable](Tokenizable.md) so callers can estimate token cost without an additional
wrapping step.

## Constructors

### Constructor

```ts
new Memory(raw: RawMemory): Memory;
```

Defined in: [lib/classes/memory.ts:127](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/classes/memory.ts#L127)

#### Parameters

| Parameter | Type                                      | Description                                               |
| --------- | ----------------------------------------- | --------------------------------------------------------- |
| `raw`     | [`RawMemory`](../interfaces/RawMemory.md) | The raw memory input validated against `rawMemorySchema`. |

#### Returns

`Memory`

#### Throws

[@nhtio/adk!E\_INVALID\_INITIAL\_MEMORY\_VALUE](../../exceptions/variables/E_INVALID_INITIAL_MEMORY_VALUE.md) when `raw` does not satisfy the schema.

## Properties

| Property                                      | Modifier   | Type                                                        | Default value     | Description                                                                                                                                                                                                                                    | Defined in                                                                                                  |
| --------------------------------------------- | ---------- | ----------------------------------------------------------- | ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
|  `confidence` | `readonly` | `number`                                                    | `undefined`       | Confidence score in the range `[0, 1]`.                                                                                                                                                                                                        | [lib/classes/memory.ts:108](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/classes/memory.ts#L108) |
|  `content`       | `readonly` | [`Tokenizable`](Tokenizable.md)                             | `undefined`       | The memory content as a [@nhtio/adk!Tokenizable](Tokenizable.md) for inline token estimation.                                                                                                                                                  | [lib/classes/memory.ts:106](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/classes/memory.ts#L106) |
|  `createdAt`   | `readonly` | `DateTime`                                                  | `undefined`       | When this memory was first recorded.                                                                                                                                                                                                           | [lib/classes/memory.ts:112](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/classes/memory.ts#L112) |
|  `id`                 | `readonly` | `string`                                                    | `undefined`       | Stable unique identifier for this memory entry.                                                                                                                                                                                                | [lib/classes/memory.ts:104](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/classes/memory.ts#L104) |
|  `importance` | `readonly` | `number`                                                    | `undefined`       | Importance score in the range `[0, 1]`.                                                                                                                                                                                                        | [lib/classes/memory.ts:110](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/classes/memory.ts#L110) |
|  `updatedAt`   | `readonly` | `DateTime`                                                  | `undefined`       | When this memory was last modified.                                                                                                                                                                                                            | [lib/classes/memory.ts:114](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/classes/memory.ts#L114) |
|  `schema`         | `static`   | `ObjectSchema`<[`RawMemory`](../interfaces/RawMemory.md)> | `rawMemorySchema` | Validator schema that accepts a [RawMemory](../interfaces/RawMemory.md) object. **Remarks** Reusable fragment for any schema that needs to validate or nest a memory entry — for example, a collection schema that holds an array of memories. | [lib/classes/memory.ts:88](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/classes/memory.ts#L88)   |

## Methods

### isMemory()

```ts
static isMemory(value: unknown): value is Memory;
```

Defined in: [lib/classes/memory.ts:100](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/classes/memory.ts#L100)

Returns `true` if `value` is a Memory instance.

#### Parameters

| Parameter | Type      | Description        |
| --------- | --------- | ------------------ |
| `value`   | `unknown` | The value to test. |

#### Returns

`value is Memory`

`true` when `value` is a Memory instance.

#### Remarks

Uses [@nhtio/adk!isInstanceOf](../../guards/functions/isInstanceOf.md) for cross-realm safety — `instanceof` would fail for instances
created in a different module copy or VM context.
