Skip to main content

Class: AgentMemory

Defined in: packages/agentos/src/memory/AgentMemory.ts:81

High-level memory facade for AI agents.

Wraps ICognitiveMemoryManager with a simple API that hides PAD mood models, HEXACO traits, and internal architecture.

Constructors

Constructor

new AgentMemory(manager?): AgentMemory

Defined in: packages/agentos/src/memory/AgentMemory.ts:85

Parameters

manager?

ICognitiveMemoryManager

Returns

AgentMemory

Accessors

isInitialized

Get Signature

get isInitialized(): boolean

Defined in: packages/agentos/src/memory/AgentMemory.ts:241

Returns

boolean


raw

Get Signature

get raw(): ICognitiveMemoryManager

Defined in: packages/agentos/src/memory/AgentMemory.ts:246

Access the underlying manager for advanced usage.

Returns

ICognitiveMemoryManager

Methods

consolidate()

consolidate(): Promise<void>

Defined in: packages/agentos/src/memory/AgentMemory.ts:223

Run consolidation cycle.

Returns

Promise<void>


getContext()

getContext(query, options?): Promise<AssembledMemoryContext>

Defined in: packages/agentos/src/memory/AgentMemory.ts:196

Get assembled memory context for prompt injection within a token budget.

Parameters

query

string

options?
tokenBudget?

number

Returns

Promise<AssembledMemoryContext>


health()

health(): Promise<MemoryHealthReport>

Defined in: packages/agentos/src/memory/AgentMemory.ts:229

Memory health diagnostics.

Returns

Promise<MemoryHealthReport>


initialize()

initialize(config): Promise<void>

Defined in: packages/agentos/src/memory/AgentMemory.ts:103

Initialize with full config. Only needed when constructing standalone (not via AgentMemory.wrap()).

Parameters

config

CognitiveMemoryConfig

Returns

Promise<void>


observe()

observe(role, content): Promise<ObservationNote[] | null>

Defined in: packages/agentos/src/memory/AgentMemory.ts:185

Feed a conversation turn to the observational memory system. The Observer creates dense notes when the token threshold is reached.

Parameters

role

"user" | "tool" | "system" | "assistant"

content

string

Returns

Promise<ObservationNote[] | null>

Example

await memory.observe('user', "Can you help me debug this?");
await memory.observe('assistant', "Sure! The issue is in your useEffect...");

recall()

recall(query, options?): Promise<RecallResult>

Defined in: packages/agentos/src/memory/AgentMemory.ts:154

Recall memories relevant to a query.

Parameters

query

string

options?

SearchOptions

Returns

Promise<RecallResult>

Example

const results = await memory.recall("what does the user prefer?");
for (const m of results.memories) {
console.log(m.content, m.retrievalScore);
}

remember()

remember(content, options?): Promise<RememberResult>

Defined in: packages/agentos/src/memory/AgentMemory.ts:116

Store information in long-term memory.

Parameters

content

string

options?
entities?

string[]

importance?

number

scope?

MemoryScope

scopeId?

string

sourceType?

MemorySourceType

tags?

string[]

type?

MemoryType

Returns

Promise<RememberResult>

Example

await memory.remember("User prefers dark mode");
await memory.remember("Deploy by Friday", { type: 'prospective', tags: ['deadline'] });

remind()

remind(input): Promise<ProspectiveMemoryItem | null>

Defined in: packages/agentos/src/memory/AgentMemory.ts:207

Register a prospective memory (reminder/intention).

Parameters

input

Omit<ProspectiveMemoryItem, "id" | "createdAt" | "triggered" | "cueEmbedding"> & object

Returns

Promise<ProspectiveMemoryItem | null>


reminders()

reminders(): Promise<ProspectiveMemoryItem[]>

Defined in: packages/agentos/src/memory/AgentMemory.ts:217

List active reminders.

Returns

Promise<ProspectiveMemoryItem[]>


search(query, options?): Promise<ScoredMemoryTrace[]>

Defined in: packages/agentos/src/memory/AgentMemory.ts:172

Search memories (alias for recall with simpler return).

Parameters

query

string

options?

SearchOptions

Returns

Promise<ScoredMemoryTrace[]>


shutdown()

shutdown(): Promise<void>

Defined in: packages/agentos/src/memory/AgentMemory.ts:235

Shutdown and release resources.

Returns

Promise<void>


wrap()

static wrap(manager): AgentMemory

Defined in: packages/agentos/src/memory/AgentMemory.ts:93

Create an AgentMemory wrapping an existing CognitiveMemoryManager. Use this in wunderland where the manager is already constructed.

Parameters

manager

ICognitiveMemoryManager

Returns

AgentMemory