forget
Delete a memory by ID or fuzzy content match when the user requests forgetting.
Instructions
Delete a memory by ID or content match (fuzzy). Use when the user says to forget something.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | Memory ID (from inspect) | |
| content | No | Fuzzy content match |
Implementation Reference
- index.js:324-346 (handler)The handleForget function is the main handler that deletes a memory by ID (exact match) or content (fuzzy match using bigram similarity). It loads memories, filters based on id or content similarity, saves the filtered set, and returns the count of removed memories.
function handleForget(args) { const { id, content } = args; if (!id && !content) return { error: 'Provide "id" or "content" to forget' }; let memories = loadMemories(); const before = memories.length; if (id) { memories = memories.filter(m => m.id !== id); } else { // Use similarity for fuzzy forget — lower threshold since user intent is clear const c = content.toLowerCase(); memories = memories.filter(m => { if (m.content.toLowerCase().includes(c)) return false; if (similarity(content, m.content) > 0.25) return false; return true; }); } saveMemories(memories); const removed = before - memories.length; return { removed, remaining: memories.length, message: `Forgot ${removed} memor${removed === 1 ? 'y' : 'ies'}.` }; } - index.js:444-454 (registration)The 'forget' tool is registered in the tools/list response with name 'forget', description 'Delete a memory by ID or content match (fuzzy)', and inputSchema accepting optional 'id' (string) and 'content' (string) parameters.
{ name: 'forget', description: 'Delete a memory by ID or content match (fuzzy). Use when the user says to forget something.', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'Memory ID (from inspect)' }, content: { type: 'string', description: 'Fuzzy content match' } } } }, - index.js:512-512 (registration)The 'forget' tool is dispatched in the 'tools/call' handler when the tool name is 'forget', calling handleForget(args).
case 'forget': result = handleForget(args); break; - index.js:322-324 (helper)The handler uses loadMemories(), saveMemories(), and similarity() helper functions (defined elsewhere in the file) to manage memory persistence.
} function handleForget(args) {