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>
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>
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>
Pi SDK is ESM-only. tsx (esbuild) doesn't emit decorator metadata,
so NestJS constructor injection fails without explicit @Inject().
- Set "type": "module" in gateway package.json
- Switch tsconfig to NodeNext module resolution
- Add @Inject(AgentService) to ChatController and ChatGateway
Tested end-to-end: REST /api/chat → Pi SDK → Anthropic → response OK.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>