feat: Add session memory system with pgvector

- Add session_memories table for persistent learnings
- Add memory_add, memory_search, memory_list, memory_context tools
- Supports semantic search via embeddings
- Categories: pattern, fix, preference, gotcha, architecture

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Christian Gick
2026-01-12 08:34:45 +02:00
parent d474c1c368
commit afe2f8bc0b
5 changed files with 353 additions and 9 deletions

View File

@@ -36,6 +36,7 @@ import {
impactLearn,
componentGraph,
} from './tools/impact.js';
import { memoryAdd, memorySearch, memoryList, memoryContext } from './tools/memories.js';
// Create MCP server
const server = new Server(
@@ -320,6 +321,35 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
result = JSON.stringify(await componentGraph(a.component_id), null, 2);
break;
// Memories
case 'memory_add':
result = await memoryAdd({
category: a.category,
title: a.title,
content: a.content,
context: a.context,
project: a.project,
});
break;
case 'memory_search':
result = await memorySearch({
query: a.query,
project: a.project,
category: a.category,
limit: a.limit,
});
break;
case 'memory_list':
result = await memoryList({
project: a.project,
category: a.category,
limit: a.limit,
});
break;
case 'memory_context':
result = await memoryContext(a.project, a.task_description);
break;
default:
throw new Error(`Unknown tool: ${name}`);
}