kernl

Class: Memory

Defined in: packages/kernl/src/memory/memory.ts:33

Memory is the primary memory abstraction for agents.

Sits above storage/index layers + owns cognitive policy, eviction/TTL, consolidation.

  • L1 / wmem: active working set exposed to the model
  • L2 / smem: bounded recent context with a TTL
  • L3 / lmem: durable, structured long-term store

Delegates persistence to storage adapters and optional indexes as projections of the primary memory store.

Constructors

Constructor

new Memory(config: MemoryConfig): Memory;

Defined in: packages/kernl/src/memory/memory.ts:40

Parameters

ParameterType
configMemoryConfig

Returns

Memory

Methods

create()

create(memory: NewMemory): Promise<MemoryRecord>;

Defined in: packages/kernl/src/memory/memory.ts:53

Create a new memory record. Writes to primary store first, then indexes if configured.

Parameters

ParameterType
memoryNewMemory

Returns

Promise<MemoryRecord>


list()

list(options?: MemoryListOptions): Promise<MemoryRecord[]>;

Defined in: packages/kernl/src/memory/memory.ts:107

List memories matching the filter.

Parameters

ParameterType
options?MemoryListOptions

Returns

Promise<MemoryRecord[]>


loadShortTermMemory()

loadShortTermMemory(scope: MemoryScope): Promise<ShortTermMemorySnapshot>;

Defined in: packages/kernl/src/memory/memory.ts:143

Load short-term memory (L2) - active smem for the scope.

Parameters

ParameterType
scopeMemoryScope

Returns

Promise<ShortTermMemorySnapshot>


loadWorkingMemory()

loadWorkingMemory(scope: MemoryScope): Promise<WorkingMemorySnapshot>;

Defined in: packages/kernl/src/memory/memory.ts:133

Load working memory (L1) - wmem-pinned memories for the scope.

Parameters

ParameterType
scopeMemoryScope

Returns

Promise<WorkingMemorySnapshot>


reindex()

reindex(params: MemoryReindexParams): Promise<void>;

Defined in: packages/kernl/src/memory/memory.ts:114

Repair indexing for a memory without modifying the DB row.

Parameters

ParameterType
paramsMemoryReindexParams

Returns

Promise<void>


search(q: MemorySearchQuery): Promise<SearchHit<IndexMemoryRecord>[]>;

Defined in: packages/kernl/src/memory/memory.ts:90

Semantic/metadata search across memories.

Sends rich query with both text and vector - the index handle adapts based on backend capabilities (e.g. drops text for pgvector).

Parameters

ParameterType
qMemorySearchQuery

Returns

Promise<SearchHit<IndexMemoryRecord>[]>


update()

update(update: MemoryRecordUpdate): Promise<MemoryRecord>;

Defined in: packages/kernl/src/memory/memory.ts:69

Update an existing memory record. Updates primary store, then re-indexes or patches search index.

Parameters

ParameterType
updateMemoryRecordUpdate

Returns

Promise<MemoryRecord>

On this page