Class: MemoryDeleteTool
Defined in: packages/agentos/src/cognition/memory/io/tools/MemoryDeleteTool.ts:74
ITool implementation that soft-deletes a memory trace from the agent's SQLite brain database.
Usage:
const tool = new MemoryDeleteTool(brain);
const result = await tool.execute(
{ traceId: 'mt_3f2b8c1e-5d4a-4e6f-9b7c-2a1d0e8f6c5b', reason: 'Information is outdated.' },
context,
);
// result.output.deleted → true
Implements
ITool<MemoryDeleteInput,MemoryDeleteOutput>
Constructors
Constructor
new MemoryDeleteTool(
brain,writeBack?):MemoryDeleteTool
Defined in: packages/agentos/src/cognition/memory/io/tools/MemoryDeleteTool.ts:118
Parameters
brain
The agent's shared SQLite brain database connection.
writeBack?
MemoryToolWriteBack
The facade that made the tool (Memory.createTools()): a deleted trace's knowledge-graph copy
is deleted through it, and a delete a learning layer does not keep is taken back through it. Without it the tool
restores the row itself.
Returns
MemoryDeleteTool
Properties
category
readonlycategory:"memory"='memory'
Defined in: packages/agentos/src/cognition/memory/io/tools/MemoryDeleteTool.ts:91
Logical category for discovery and grouping.
Implementation of
description
readonlydescription:string
Defined in: packages/agentos/src/cognition/memory/io/tools/MemoryDeleteTool.ts:85
LLM-facing description.
Implementation of
displayName
readonlydisplayName:"Delete Memory"='Delete Memory'
Defined in: packages/agentos/src/cognition/memory/io/tools/MemoryDeleteTool.ts:82
Human-readable display name.
Implementation of
hasSideEffects
readonlyhasSideEffects:true=true
Defined in: packages/agentos/src/cognition/memory/io/tools/MemoryDeleteTool.ts:94
This tool writes to the database.
Implementation of
id
readonlyid:"memory-delete-v1"='memory-delete-v1'
Defined in: packages/agentos/src/cognition/memory/io/tools/MemoryDeleteTool.ts:76
Globally unique tool identifier.
Implementation of
inputSchema
readonlyinputSchema:JSONSchemaObject
Defined in: packages/agentos/src/cognition/memory/io/tools/MemoryDeleteTool.ts:97
JSON schema for input validation and LLM tool-call construction.
Implementation of
name
readonlyname:"memory_delete"='memory_delete'
Defined in: packages/agentos/src/cognition/memory/io/tools/MemoryDeleteTool.ts:79
LLM-facing tool name.
Implementation of
Methods
execute()
execute(
args,context):Promise<ToolExecutionResult<MemoryDeleteOutput>>
Defined in: packages/agentos/src/cognition/memory/io/tools/MemoryDeleteTool.ts:162
Set deleted = 1 on the memory trace matching traceId.
The WHERE clause filters to deleted = 0 so that attempting to
delete an already-deleted trace returns { deleted: false } rather
than silently succeeding — this gives callers accurate feedback.
The trace's knowledge-graph copy (the episodic record a memory manager on the same Brain writes of each trace it stores) is deleted with it, through the facade that made the tool.
Parameters
args
MemoryDeleteInput
Delete input (traceId, optional reason).
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 delete runs through the learner session's recorder, deleting only while the
trace holds what was read (conflict otherwise). Only a freeze stops a delete, with a layer or without one
(frozen).
Returns
Promise<ToolExecutionResult<MemoryDeleteOutput>>
{ deleted } status, or an error result.
Implementation of
refusalBeforeApproval()
refusalBeforeApproval(
_args,context):ToolExecutionResult<MemoryDeleteOutput> |undefined
Defined in: packages/agentos/src/cognition/memory/io/tools/MemoryDeleteTool.ts:137
The refusal a delete 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<MemoryDeleteOutput> | undefined
The refusal, or undefined when the call may run.