feat(Phase 4): Memory & Intelligence — memory, log, summarization, skills #91

Merged
jason.woltje merged 7 commits from feat/p4-001-memory-stores into main 2026-03-13 13:56:51 +00:00

7 Commits

Author SHA1 Message Date
41b7c662b6 verify(P4-007): Phase 4 memory + log pipeline verified
All baseline gates pass (typecheck 18/18, lint 18/18, format clean),
build succeeds across all packages, 10 tests pass. Phase 4 complete.
Memory + log + skills system fully implemented.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 08:56:14 -05:00
14eb8855e4 feat(P4-006): skill management — catalog, install, config
Add SkillsService with CRUD operations against the skills table,
toggle enable/disable, and findByName lookup. Wire SkillsController
with REST endpoints at /api/skills (list, get, create, update,
toggle, delete). Skills support builtin/community/custom sources
with JSON config storage.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 08:55:10 -05:00
38ae82b370 feat(P4-005): memory integration — inject into agent sessions
Add memory tools (search, get_preferences, save_preference,
save_insight) to agent sessions via Pi SDK custom tools. Agent
sessions now have access to semantic memory search, preference
storage, and insight capture. EmbeddingService injected into
AgentService for embedding generation during tool execution.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 08:54:10 -05:00
1d4916fe97 feat(P4-004): summarization pipeline — LLM + cron scheduling
Add SummarizationService that reads hot agent logs (>24h), groups by
session, calls a cheap LLM (gpt-4o-mini default, configurable via
SUMMARIZATION_MODEL) to extract key insights, stores them with
embeddings in the insights table, and transitions processed logs to
warm tier. Add CronService with node-cron for scheduled execution
(summarization every 6h, tier management daily at 3am). Tier
management promotes warm→cold (30d) and purges cold logs (90d).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 08:52:52 -05:00
666d2bc36d feat(P4-003): @mosaic/log — log ingest, parsing, tiered storage
Implement AgentLogsRepo with structured log ingest (single + batch),
flexible query builder (filter by session, level, category, tier,
date range), and tiered storage management (hot→warm→cold→purge).
Add getLogsForSummarization() for the summarization pipeline.
Wire LogModule into gateway with REST endpoints at /api/logs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 08:51:10 -05:00
fb3c308efd feat(P4-002): semantic search — pgvector embeddings + search API
Add EmbeddingService using OpenAI-compatible embeddings API (supports
text-embedding-3-small, configurable via EMBEDDING_MODEL and
EMBEDDING_API_URL env vars). Wire embedding generation into insight
creation and semantic search endpoint. POST /api/memory/search now
generates a query embedding and performs cosine distance search via
pgvector when OPENAI_API_KEY is configured.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 08:49:19 -05:00
943a797a99 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>
2026-03-13 08:46:40 -05:00