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>
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>
- 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
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)