Class: Memory
An immutable, validated memory entry held by the agent.
Remarks
Constructed from a RawMemory via rawMemorySchema. All temporal fields are normalised to Luxon DateTime instances at construction time. The content field is always a @nhtio/adk!Tokenizable so callers can estimate token cost without an additional wrapping step.
Constructors
Constructor
ts
new Memory(raw: RawMemory): Memory;Parameters
| Parameter | Type | Description |
|---|---|---|
raw | RawMemory | The raw memory input validated against rawMemorySchema. |
Returns
Memory
Throws
@nhtio/adk!E_INVALID_INITIAL_MEMORY_VALUE when raw does not satisfy the schema.
Properties
| Property | Modifier | Type | Default value | Description |
|---|---|---|---|---|
confidence | readonly | number | undefined | Confidence score in the range [0, 1]. |
content | readonly | Tokenizable | undefined | The memory content as a @nhtio/adk!Tokenizable for inline token estimation. |
createdAt | readonly | DateTime | undefined | When this memory was first recorded. |
id | readonly | string | undefined | Stable unique identifier for this memory entry. |
importance | readonly | number | undefined | Importance score in the range [0, 1]. |
updatedAt | readonly | DateTime | undefined | When this memory was last modified. |
schema | static | ObjectSchema<RawMemory> | rawMemorySchema | Validator schema that accepts a RawMemory 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. |
Methods
isMemory()
ts
static isMemory(value: unknown): value is Memory;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 for cross-realm safety — instanceof would fail for instances created in a different module copy or VM context.