ITool implementation that stores a new memory trace in the agent's SQLite brain database.

Usage:

const tool = new MemoryAddTool(brain);
const result = await tool.execute(
{ content: 'User prefers dark mode.', tags: ['preference', 'ui'] },
context,
);
// result.output.traceId → 'mt_1711234567890_0'

Implements

  • ITool<MemoryAddInput, MemoryAddOutput>

Constructors

Methods

  • Insert a new memory trace row into memory_traces.

    Defaults applied when optional fields are absent:

    • type'episodic'
    • scope'user'
    • tags[]

    The trace is created with strength = 1.0 (maximum encoding strength) and deleted = 0 (active). No embedding is computed here — the background EmbeddingEncoder will embed it asynchronously.

    Parameters

    • args: MemoryAddInput

      Memory add input (content, optional type/scope/tags).

    • context: ToolExecutionContext

      Tool execution context used to resolve the scope ID.

    Returns Promise<ToolExecutionResult<MemoryAddOutput>>

    { traceId } on success, or an error result.

Properties

id: "memory-add-v1" = 'memory-add-v1'

Globally unique tool identifier.

name: "memory_add" = 'memory_add'

LLM-facing tool name (snake_case, as the LLM will call it).

displayName: "Add Memory" = 'Add Memory'

Human-readable display name for UIs and logs.

description: "Store a new memory trace. The agent calls this to remember important facts, decisions, or observations." = 'Store a new memory trace. The agent calls this to remember important facts, decisions, or observations.'

Description shown to the LLM when deciding which tool to invoke. Must be comprehensive enough for the model to understand when to call this.

category: "memory" = 'memory'

Logical category for discovery and grouping.

hasSideEffects: true = true

This tool writes to the database. Callers may request confirmation before execution when hasSideEffects = true.

inputSchema: JSONSchemaObject = ...

JSON schema for input validation and LLM tool-call construction. All optional fields default gracefully inside execute().