aim_memory_remove_facts
Delete specific observations from a memory entity without removing the entity itself. Use to correct or update stored information.
Instructions
Remove specific facts from a memory. Keeps the memory but removes selected observations.
DATABASE SELECTION: Observations are deleted from entities within the specified database's knowledge graph.
LOCATION OVERRIDE: Use the 'location' parameter to force deletion from 'project' (.aim directory) or 'global' (configured directory). Leave blank for auto-detection.
EXAMPLES:
Master database (default): aim_memory_remove_facts({deletions: [{entityName: "John", observations: ["Outdated info"]}]})
Work database: aim_memory_remove_facts({context: "work", deletions: [{entityName: "Project", observations: ["Old deadline"]}]})
Master database in global location: aim_memory_remove_facts({location: "global", deletions: [{entityName: "John", observations: ["Outdated info"]}]})
Health database in project location: aim_memory_remove_facts({context: "health", location: "project", deletions: [{entityName: "Exercise", observations: ["Injured knee"]}]})
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| context | No | Optional memory context. Observations will be deleted from entities in the specified context's knowledge graph. | |
| location | No | Optional storage location override. 'project' forces project-local .aim directory, 'global' forces global directory. If not specified, uses automatic detection. | |
| deletions | Yes |
Implementation Reference
- index.ts:592-621 (schema)Input schema for aim_memory_remove_facts tool: accepts 'context' (string), 'location' (enum: project/global), and 'deletions' (array of {entityName, observations[]}) with 'deletions' required.
inputSchema: { type: "object", properties: { context: { type: "string", description: "Optional memory context. Observations will be deleted from entities in the specified context's knowledge graph." }, location: { type: "string", enum: ["project", "global"], description: "Optional storage location override. 'project' forces project-local .aim directory, 'global' forces global directory. If not specified, uses automatic detection." }, deletions: { type: "array", items: { type: "object", properties: { entityName: { type: "string", description: "The name of the entity containing the observations" }, observations: { type: "array", items: { type: "string" }, description: "An array of observations to delete" }, }, required: ["entityName", "observations"], }, }, }, required: ["deletions"], }, - index.ts:825-827 (handler)Handler case for 'aim_memory_remove_facts' in the CallToolRequestSchema switch statement. Calls knowledgeGraphManager.deleteObservations with args.deletions, context, and location.
case "aim_memory_remove_facts": await knowledgeGraphManager.deleteObservations(args.deletions as { entityName: string; observations: string[] }[], args.context as string, args.location as 'project' | 'global'); return { content: [{ type: "text", text: "Observations deleted successfully" }] }; - index.ts:579-622 (registration)Tool registration in ListToolsRequestSchema handler. Defines name 'aim_memory_remove_facts', description with examples, and inputSchema for the tool definition exposed to AI models.
{ name: "aim_memory_remove_facts", description: `Remove specific facts from a memory. Keeps the memory but removes selected observations. DATABASE SELECTION: Observations are deleted from entities within the specified database's knowledge graph. LOCATION OVERRIDE: Use the 'location' parameter to force deletion from 'project' (.aim directory) or 'global' (configured directory). Leave blank for auto-detection. EXAMPLES: - Master database (default): aim_memory_remove_facts({deletions: [{entityName: "John", observations: ["Outdated info"]}]}) - Work database: aim_memory_remove_facts({context: "work", deletions: [{entityName: "Project", observations: ["Old deadline"]}]}) - Master database in global location: aim_memory_remove_facts({location: "global", deletions: [{entityName: "John", observations: ["Outdated info"]}]}) - Health database in project location: aim_memory_remove_facts({context: "health", location: "project", deletions: [{entityName: "Exercise", observations: ["Injured knee"]}]})`, inputSchema: { type: "object", properties: { context: { type: "string", description: "Optional memory context. Observations will be deleted from entities in the specified context's knowledge graph." }, location: { type: "string", enum: ["project", "global"], description: "Optional storage location override. 'project' forces project-local .aim directory, 'global' forces global directory. If not specified, uses automatic detection." }, deletions: { type: "array", items: { type: "object", properties: { entityName: { type: "string", description: "The name of the entity containing the observations" }, observations: { type: "array", items: { type: "string" }, description: "An array of observations to delete" }, }, required: ["entityName", "observations"], }, }, }, required: ["deletions"], }, }, - index.ts:261-270 (helper)KnowledgeGraphManager.deleteObservations method - the actual implementation logic. Loads the graph, filters out specified observations from matching entities, and saves the graph back.
async deleteObservations(deletions: { entityName: string; observations: string[] }[], context?: string, location?: 'project' | 'global'): Promise<void> { const graph = await this.loadGraph(context, location); deletions.forEach(d => { const entity = graph.entities.find(e => e.name === d.entityName); if (entity) { entity.observations = entity.observations.filter(o => !d.observations.includes(o)); } }); await this.saveGraph(graph, context, location); }