forget
Permanently delete specific AI memories by UUID to remove outdated facts before storing corrections. Prevents contradictory data in recall results. Requires exact memory ID from previous queries. Irreversible single-record operation.
Instructions
Permanently delete a memory by ID. This is a destructive, irreversible operation that soft-deletes the memory record (it will no longer appear in recall or context results). Use forget before storing a corrected version of a fact, to prevent contradictory memories from coexisting. Do not use for bulk cleanup (delete one at a time). Do not use if you are unsure whether the memory is outdated, as deletion cannot be undone. Requires the exact memory ID (UUID), which is returned by recall and context. Costs 1 operation. Returns confirmation on success, or an error if the ID does not exist.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| memory_id | Yes | UUID of the memory to delete. Get this from recall or context results (the 'id' field). Must be an exact match. |
Implementation Reference
- packages/mcp-server/src/index.ts:191-209 (handler)MCP server handler for 'forget' tool. Makes DELETE API call to /memories/{memory_id} endpoint. Returns confirmation text on success.
// Tool 3: forget server.tool( "forget", `Permanently delete a memory by ID. This is a destructive, irreversible operation that soft-deletes the memory record (it will no longer appear in recall or context results). Use forget before storing a corrected version of a fact, to prevent contradictory memories from coexisting. Do not use for bulk cleanup (delete one at a time). Do not use if you are unsure whether the memory is outdated, as deletion cannot be undone. Requires the exact memory ID (UUID), which is returned by recall and context. Costs 1 operation. Returns confirmation on success, or an error if the ID does not exist.`, { memory_id: z.string().describe("UUID of the memory to delete. Get this from recall or context results (the 'id' field). Must be an exact match."), }, async ({ memory_id }) => { await apiCall(`/memories/${memory_id}`, "DELETE"); return { content: [ { type: "text" as const, text: `Memory ${memory_id} has been deleted.`, }, ], }; }, ); - packages/local/src/index.ts:216-241 (handler)Local server handler for 'forget' tool. Calls softDelete() helper to perform soft delete in SQLite database. Returns JSON with deleted status and memory_id, or error message.
// --- forget --- server.tool( "forget", "Delete a memory that is outdated, incorrect, or superseded. Call this when you store an updated version of a fact — delete the old one to prevent contradictions.", { memory_id: z.string().describe("ID of the memory to delete"), }, async ({ memory_id }) => { try { const deleted = softDelete(memory_id); return { content: [ { type: "text" as const, text: JSON.stringify({ deleted, memory_id }), }, ], }; } catch (err: any) { return { content: [{ type: "text" as const, text: `Error forgetting: ${err.message}` }], isError: true, }; } } ); - packages/local/src/db.ts:151-158 (helper)softDelete helper function that performs the actual database operation. Updates memories table setting deleted_at timestamp for soft-delete behavior.
export function softDelete(memoryId: string): boolean { const db = getDb(); const result = db.prepare(` UPDATE memories SET deleted_at = datetime('now') WHERE id = ? AND deleted_at IS NULL `).run(memoryId); return result.changes > 0; } - packages/api/src/index.ts:222-230 (schema)API schema definition for 'forget' tool. Defines tool name, description, endpoints, and input parameters (agent_id, memory_id).
name: "forget", description: "Delete a memory by ID. Keep knowledge accurate by removing outdated information.", endpoint: "POST /memories/forget", x402_endpoint: "POST /x402/forget", input: { agent_id: { type: "string", required: true }, memory_id: { type: "string", required: true }, }, },