Commit Graph

6 Commits

Author SHA1 Message Date
Christian Gick
1f499bd926 feat(CF-1314): Content hashing to prevent duplicate embeddings
SHA-256 hash check before embedding API call eliminates ~60-80% of
redundant embedding requests. Consolidates dual INSERT paths to single
INSERT with nullable embedding column.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 08:28:11 +02:00
Christian Gick
2439d4a645 fix(CF-306): Validate session_id in memory_add to prevent FK violations
Added validation to check if session_id exists in sessions table before
inserting memories. Falls back to NULL if session not found, preventing
foreign key constraint violations while preserving memory content.

Logs warning when invalid session_id provided for debugging.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-20 10:17:53 +02:00
Christian Gick
fe2b1a0423 fix: Remove redundant session_id validation in memoryAdd (CF-195)
Problem: session_id validation added extra SELECT query before each
memory insertion, causing session-start delays.

Root cause: Foreign key constraint already enforces referential
integrity (migrations/011_memories.sql:16-19). Validation was redundant.

Solution: Remove validation (lines 50-59 in memories.ts). Let database
handle referential integrity with proper error messages.

Benefits:
- Faster memoryAdd calls (one less query)
- Proper error messages from PostgreSQL on constraint violations
- No silent NULL conversion for invalid session_ids

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-18 10:37:50 +02:00
Christian Gick
2e2f0192d9 fix: Validate session_id exists before memory insert (CF-194)
- Added session existence check before INSERT
- Graceful degradation: sets session_id to null if invalid
- Prevents FK constraint violation
- Memory still stored without session link
2026-01-18 10:33:59 +02:00
Christian Gick
04395e8403 Add session management MCP tools (Phase 3)
Implemented 8 new session management tools:
- session_start: Initialize session with metadata tracking
- session_update: Update session metrics during execution
- session_end: Close session with summary and embedding
- session_list: List sessions with filtering
- session_search: Semantic search across sessions
- session_context: Get complete session context (tasks, commits, builds, memories)
- build_record: Link builds to sessions and versions
- session_commit_link: Link commits to sessions

Enhanced existing tools:
- memory_add: Added session_id and task_id parameters
- Updated all memory queries to use 'memories' table (renamed from session_memories)

Implementation:
- Created src/tools/sessions.ts with all session operations
- Updated src/tools/memories.ts for new schema
- Added 8 session tool definitions to src/tools/index.ts
- Registered all session tools in src/index.ts switch statement
- TypeScript compilation successful

Related: CF-167 (Fix shared session-summary.md file conflict)
2026-01-17 07:45:14 +02:00
Christian Gick
afe2f8bc0b 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>
2026-01-12 08:34:45 +02:00