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:
30
src/index.ts
30
src/index.ts
@@ -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}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user