Skip to main content

Class: MemoryReflectTool

Defined in: packages/agentos/src/memory/tools/MemoryReflectTool.ts:54

ITool implementation that triggers one full memory consolidation cycle via ().

Usage:

const tool = new MemoryReflectTool(brain, consolidationLoop);
const result = await tool.execute({}, context);
// result.output → { pruned: 3, merged: 1, derived: 0, compacted: 2, durationMs: 42 }

Implements

Constructors

Constructor

new MemoryReflectTool(brain, consolidation): MemoryReflectTool

Defined in: packages/agentos/src/memory/tools/MemoryReflectTool.ts:101

Parameters

brain

SqliteBrain

The agent's shared SQLite brain database connection. Accepted for symmetry with other memory tools and for future direct consolidation calls.

consolidation

ConsolidationLoop

The ConsolidationLoop instance to invoke.

Returns

MemoryReflectTool

Properties

category

readonly category: "memory" = 'memory'

Defined in: packages/agentos/src/memory/tools/MemoryReflectTool.ts:75

Logical category for discovery and grouping.

Implementation of

ITool.category


description

readonly description: string

Defined in: packages/agentos/src/memory/tools/MemoryReflectTool.ts:68

Description shown to the LLM. The consolidation steps are described explicitly so the model understands what "reflect" means operationally.

Implementation of

ITool.description


displayName

readonly displayName: "Reflect on Memory" = 'Reflect on Memory'

Defined in: packages/agentos/src/memory/tools/MemoryReflectTool.ts:62

Human-readable display name.

Implementation of

ITool.displayName


hasSideEffects

readonly hasSideEffects: true = true

Defined in: packages/agentos/src/memory/tools/MemoryReflectTool.ts:81

Consolidation writes to the database (pruning, merging, inserting insights). Mark as having side effects so callers may request confirmation if needed.

Implementation of

ITool.hasSideEffects


id

readonly id: "memory-reflect-v1" = 'memory-reflect-v1'

Defined in: packages/agentos/src/memory/tools/MemoryReflectTool.ts:56

Globally unique tool identifier.

Implementation of

ITool.id


inputSchema

readonly inputSchema: JSONSchemaObject

Defined in: packages/agentos/src/memory/tools/MemoryReflectTool.ts:84

JSON schema for input validation and LLM tool-call construction.

Implementation of

ITool.inputSchema


name

readonly name: "memory_reflect" = 'memory_reflect'

Defined in: packages/agentos/src/memory/tools/MemoryReflectTool.ts:59

LLM-facing tool name.

Implementation of

ITool.name

Methods

execute()

execute(_args, _context): Promise<ToolExecutionResult<MemoryConsolidationResult>>

Defined in: packages/agentos/src/memory/tools/MemoryReflectTool.ts:121

Run one full consolidation cycle and return the statistics.

If a consolidation cycle is already in progress (mutex guard in ConsolidationLoop), run() returns immediately with zero counts — this is surfaced as a successful result with all-zero statistics.

Parameters

_args

MemoryReflectInput

Reflect input (optional topic hint, currently unused).

_context

ToolExecutionContext

Tool execution context (not used by this tool).

Returns

Promise<ToolExecutionResult<MemoryConsolidationResult>>

ConsolidationResult on success, or an error result.

Implementation of

ITool.execute