m9k_forget
Remove specific data chunks from the memory index to manage stored information. Use after identifying chunk IDs with search to permanently delete indexed content.
Instructions
Permanently remove a specific chunk from the memory index. Does NOT delete the source JSONL. Use m9k_search() first to find the chunk ID to forget.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chunkId | Yes | Chunk ID to permanently delete from the index |
Implementation Reference
- src/tools/manage.ts:13-68 (handler)The tool 'm9k_forget' is registered and implemented within `registerManageTools` in `src/tools/manage.ts`. It performs a soft-delete of a chunk in the `conv_chunks` database table and hard-deletes associated vectors.
server.registerTool( 'm9k_forget', { description: 'Permanently remove a specific chunk from the memory index. Does NOT delete the source JSONL. Use m9k_search() first to find the chunk ID to forget.', inputSchema: { chunkId: z.string().describe('Chunk ID to permanently delete from the index'), }, annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false, }, }, async ({ chunkId }) => { // Check if chunk exists and is not already deleted const chunk = ctx.db .prepare('SELECT id, session_id FROM conv_chunks WHERE id = ? AND deleted_at IS NULL') .get(chunkId) as { id: string; session_id: string } | undefined; if (!chunk) { return { content: [ { type: 'text' as const, text: JSON.stringify({ error: 'Chunk not found', chunkId }), }, ], isError: true, }; } // Soft-delete the chunk ctx.db .prepare("UPDATE conv_chunks SET deleted_at = datetime('now') WHERE id = ?") .run(chunkId); // Hard-delete associated vectors (no need to keep them) if (ctx.searchContext.vecTextEnabled) { deleteVectorsForChunk(ctx.db, chunkId, '_text'); } if (ctx.searchContext.vecCodeEnabled) { deleteVectorsForChunk(ctx.db, chunkId, '_code'); } return { content: [ { type: 'text' as const, text: JSON.stringify({ forgotten: true, chunkId }), }, ], }; }, );