feat(P4-001): @mosaic/memory — preference + insight stores

Add memory tables to DB schema (preferences, insights with pgvector
embedding column, agent_logs, skills, summarization_jobs). Implement
PreferencesRepo (CRUD + upsert) and InsightsRepo (CRUD + semantic
search + relevance decay). Define VectorStore and EmbeddingProvider
interfaces for future provider abstraction. Wire MemoryModule into
gateway with REST endpoints at /api/memory/*.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-13 08:46:40 -05:00
parent d83ebe65e9
commit 943a797a99
15 changed files with 557 additions and 4 deletions

View File

@@ -0,0 +1,15 @@
import type { Db } from '@mosaic/db';
import { createPreferencesRepo, type PreferencesRepo } from './preferences.js';
import { createInsightsRepo, type InsightsRepo } from './insights.js';
export interface Memory {
preferences: PreferencesRepo;
insights: InsightsRepo;
}
export function createMemory(db: Db): Memory {
return {
preferences: createPreferencesRepo(db),
insights: createInsightsRepo(db),
};
}