Class: MemoryUpdateTool
Defined in: packages/agentos/src/cognition/memory/io/tools/MemoryUpdateTool.ts:76
ITool implementation that applies partial updates to an existing memory trace stored in the agent's SQLite brain database.
Usage:
const tool = new MemoryUpdateTool(brain);
const result = await tool.execute(
{ traceId: 'mt_3f2b8c1e-5d4a-4e6f-9b7c-2a1d0e8f6c5b', content: 'Updated content here.' },
context,
);
// result.output.updated → true
Implements
ITool<MemoryUpdateInput,MemoryUpdateOutput>
Constructors
Constructor
new MemoryUpdateTool(
brain,writeBack?):MemoryUpdateTool
Defined in: packages/agentos/src/cognition/memory/io/tools/MemoryUpdateTool.ts:123
Parameters
brain
The agent's shared SQLite brain database connection.
writeBack?
MemoryToolWriteBack
The facade that made the tool (Memory.createTools()), through which a write a learning layer
does not keep is taken back. Without it the tool restores the row itself.
Returns
MemoryUpdateTool
Properties
category
readonlycategory:"memory"='memory'
Defined in: packages/agentos/src/cognition/memory/io/tools/MemoryUpdateTool.ts:92
Logical category for discovery and grouping.
Implementation of
description
readonlydescription:string
Defined in: packages/agentos/src/cognition/memory/io/tools/MemoryUpdateTool.ts:87
LLM-facing description.
Implementation of
displayName
readonlydisplayName:"Update Memory"='Update Memory'
Defined in: packages/agentos/src/cognition/memory/io/tools/MemoryUpdateTool.ts:84
Human-readable display name.
Implementation of
hasSideEffects
readonlyhasSideEffects:true=true
Defined in: packages/agentos/src/cognition/memory/io/tools/MemoryUpdateTool.ts:95
This tool writes to the database.
Implementation of
id
readonlyid:"memory-update-v1"='memory-update-v1'
Defined in: packages/agentos/src/cognition/memory/io/tools/MemoryUpdateTool.ts:78
Globally unique tool identifier.
Implementation of
inputSchema
readonlyinputSchema:JSONSchemaObject
Defined in: packages/agentos/src/cognition/memory/io/tools/MemoryUpdateTool.ts:98
JSON schema for input validation and LLM tool-call construction.
Implementation of
name
readonlyname:"memory_update"='memory_update'
Defined in: packages/agentos/src/cognition/memory/io/tools/MemoryUpdateTool.ts:81
LLM-facing tool name.
Implementation of
Methods
execute()
execute(
args,context):Promise<ToolExecutionResult<MemoryUpdateOutput>>
Defined in: packages/agentos/src/cognition/memory/io/tools/MemoryUpdateTool.ts:172
Update a memory trace identified by traceId.
The method builds a dynamic SET clause based on which optional fields are provided:
contentprovided → setcontent = ?, also setembedding = NULLto signal that the cached vector is stale.tagsprovided → serialise array as JSON and settags = ?.
If neither content nor tags is specified, the method returns
{ updated: false } immediately without touching the database.
A trace that does not exist or has deleted = 1 returns { updated: false }.
Parameters
args
MemoryUpdateInput
Update input (traceId, optional content/tags).
context
Tool execution context; where it carries the turn's scope ids, the call reaches only a live trace
of the turn's own scopes that the turn's own user filed (another scope's reads as not found, another user's is
refused, other_user), and the write runs through the learner session's recorder, writing only while the trace
holds what was read (conflict otherwise). Only a freeze stops a write, with a layer or without one (frozen).
Returns
Promise<ToolExecutionResult<MemoryUpdateOutput>>
{ updated } status, or an error result.
Implementation of
refusalBeforeApproval()
refusalBeforeApproval(
args,context):ToolExecutionResult<MemoryUpdateOutput> |undefined
Defined in: packages/agentos/src/cognition/memory/io/tools/MemoryUpdateTool.ts:142
The refusal an update meets whatever a human would answer, read before the tool orchestrator's approval gate
(ITool.refusalBeforeApproval), so no one is asked to approve a write that cannot act: a freeze, and, with the
turn's scope ids on the call, a session that records no writes. A refusal that reads the trace (other_user,
conflict) is given when the call runs. execute refuses the same call itself, in the same order.
Parameters
args
Record<string, any>
The call's arguments, before the input schema is checked.
context
The call's context.
Returns
ToolExecutionResult<MemoryUpdateOutput> | undefined
The refusal, or undefined when the call may run.