Class: MemoryAddTool
Defined in: packages/agentos/src/memory/tools/MemoryAddTool.ts:71
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
Constructor
new MemoryAddTool(
brain):MemoryAddTool
Defined in: packages/agentos/src/memory/tools/MemoryAddTool.ts:130
Parameters
brain
The agent's shared SQLite brain database connection.
Returns
MemoryAddTool
Properties
category
readonlycategory:"memory"='memory'
Defined in: packages/agentos/src/memory/tools/MemoryAddTool.ts:89
Logical category for discovery and grouping.
Implementation of
description
readonlydescription:"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.'
Defined in: packages/agentos/src/memory/tools/MemoryAddTool.ts:85
Description shown to the LLM when deciding which tool to invoke. Must be comprehensive enough for the model to understand when to call this.
Implementation of
displayName
readonlydisplayName:"Add Memory"='Add Memory'
Defined in: packages/agentos/src/memory/tools/MemoryAddTool.ts:79
Human-readable display name for UIs and logs.
Implementation of
hasSideEffects
readonlyhasSideEffects:true=true
Defined in: packages/agentos/src/memory/tools/MemoryAddTool.ts:95
This tool writes to the database.
Callers may request confirmation before execution when hasSideEffects = true.
Implementation of
id
readonlyid:"memory-add-v1"='memory-add-v1'
Defined in: packages/agentos/src/memory/tools/MemoryAddTool.ts:73
Globally unique tool identifier.
Implementation of
inputSchema
readonlyinputSchema:JSONSchemaObject
Defined in: packages/agentos/src/memory/tools/MemoryAddTool.ts:101
JSON schema for input validation and LLM tool-call construction.
All optional fields default gracefully inside execute().
Implementation of
name
readonlyname:"memory_add"='memory_add'
Defined in: packages/agentos/src/memory/tools/MemoryAddTool.ts:76
LLM-facing tool name (snake_case, as the LLM will call it).
Implementation of
Methods
execute()
execute(
args,_context):Promise<ToolExecutionResult<MemoryAddOutput>>
Defined in: packages/agentos/src/memory/tools/MemoryAddTool.ts:152
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
Tool execution context (not used by this tool).
Returns
Promise<ToolExecutionResult<MemoryAddOutput>>
{ traceId } on success, or an error result.