Add semantic search and analytics tools for sessions

Phase 7 complete: Advanced session analysis capabilities

New MCP Tools (3):
1. session_semantic_search - Vector similarity search across all sessions
2. session_productivity_analytics - Metrics (avg duration, tasks, commits, tokens)
3. session_pattern_detection - Detect patterns (tool usage, task types)

Features:
- Semantic search with embedding-based similarity
- Fallback to ILIKE text search if embeddings unavailable
- Analytics over configurable time periods (week/month/quarter)
- Pattern detection with frequency analysis

Use Cases:
- Find similar past work: "sessions about WhatsApp integration"
- Track productivity: avg commits/tasks per session
- Identify tool usage patterns: which tools used most often
- Analyze task type distribution

All 7 phases complete! System ready for testing.

Related: CF-257

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Christian Gick
2026-01-19 10:21:47 +02:00
parent 3745a13eaf
commit a868dd40ec
3 changed files with 279 additions and 0 deletions

View File

@@ -939,4 +939,39 @@ export const toolDefinitions = [
required: ['session_id'],
},
},
{
name: 'session_semantic_search',
description: 'Semantic search across all session documentation using vector similarity',
inputSchema: {
type: 'object',
properties: {
query: { type: 'string', description: 'Search query' },
project: { type: 'string', description: 'Filter by project (optional)' },
limit: { type: 'number', description: 'Max results (default: 10)' },
},
required: ['query'],
},
},
{
name: 'session_productivity_analytics',
description: 'Get productivity metrics (avg duration, tasks/commits per session, etc.)',
inputSchema: {
type: 'object',
properties: {
project: { type: 'string', description: 'Filter by project (optional)' },
time_period: { type: 'string', enum: ['week', 'month', 'quarter'], description: 'Time period (default: month)' },
},
},
},
{
name: 'session_pattern_detection',
description: 'Detect patterns across sessions (tool usage, task types)',
inputSchema: {
type: 'object',
properties: {
project: { type: 'string', description: 'Filter by project (optional)' },
pattern_type: { type: 'string', enum: ['tool_usage', 'task_types', 'error_frequency'], description: 'Type of pattern to detect (default: tool_usage)' },
},
},
},
];