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

@@ -546,4 +546,58 @@ export const toolDefinitions = [
},
},
},
// Memory Tools
{
name: 'memory_add',
description: 'Store a learning/memory for future sessions. Use at session end to persist insights.',
inputSchema: {
type: 'object',
properties: {
category: { type: 'string', enum: ['pattern', 'fix', 'preference', 'gotcha', 'architecture'], description: 'Memory category' },
title: { type: 'string', description: 'Short title for the memory' },
content: { type: 'string', description: 'The learning/insight to remember' },
context: { type: 'string', description: 'When/where this applies (optional)' },
project: { type: 'string', description: 'Project this relates to (optional)' },
},
required: ['category', 'title', 'content'],
},
},
{
name: 'memory_search',
description: 'Search memories semantically. Returns relevant learnings for current context.',
inputSchema: {
type: 'object',
properties: {
query: { type: 'string', description: 'Search query' },
project: { type: 'string', description: 'Filter by project (optional)' },
category: { type: 'string', enum: ['pattern', 'fix', 'preference', 'gotcha', 'architecture'], description: 'Filter by category (optional)' },
limit: { type: 'number', description: 'Max results (default: 5)' },
},
required: ['query'],
},
},
{
name: 'memory_list',
description: 'List stored memories (non-semantic)',
inputSchema: {
type: 'object',
properties: {
project: { type: 'string', description: 'Filter by project (optional)' },
category: { type: 'string', enum: ['pattern', 'fix', 'preference', 'gotcha', 'architecture'], description: 'Filter by category (optional)' },
limit: { type: 'number', description: 'Max results (default: 20)' },
},
},
},
{
name: 'memory_context',
description: 'Get memories relevant to current session context. Use at session start.',
inputSchema: {
type: 'object',
properties: {
project: { type: 'string', description: 'Current project' },
task_description: { type: 'string', description: 'Description of planned work (for semantic matching)' },
},
},
},
];