memory_enhanced_recommendation
Enhance project documentation recommendations by applying knowledge graph and memory learning to base suggestions, yielding context-aware results.
Instructions
Get enhanced recommendations using learning and knowledge graph
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectPath | Yes | Path to the project | |
| baseRecommendation | Yes | Base recommendation to enhance | |
| projectFeatures | Yes |
Implementation Reference
- src/memory/integration.ts:514-542 (handler)Main handler function that processes a base recommendation by enriching it with similar projects, success patterns, confidence scoring, and alternative options from memory.
export async function handleMemoryEnhancedRecommendation(args: { projectPath: string; baseRecommendation: any; projectFeatures: any; }): Promise<any> { await initializeMemory(); // Get similar projects with same features const similarProjects = await getSimilarProjects(args.projectFeatures); // Analyze success patterns const successPatterns = await analyzeSuccessPatterns(similarProjects); // Enhanced recommendation with memory insights const enhancedRecommendation = { ...args.baseRecommendation, memoryEnhanced: { similarProjects, successPatterns, confidence: calculateConfidence(args.baseRecommendation, successPatterns), alternativeOptions: await getAlternativeOptions( args.baseRecommendation, successPatterns, ), }, }; return enhancedRecommendation; } - src/memory/index.ts:142-176 (schema)MCP tool registration with inputSchema defining required parameters: projectPath, baseRecommendation, and projectFeatures (with nested fields for language, framework, size, complexity, hasTests, hasCI, hasDocs, isOpenSource).
name: "memory_enhanced_recommendation", description: "Get enhanced recommendations using learning and knowledge graph", inputSchema: { type: "object", properties: { projectPath: { type: "string", description: "Path to the project", }, baseRecommendation: { type: "object", description: "Base recommendation to enhance", }, projectFeatures: { type: "object", properties: { language: { type: "string" }, framework: { type: "string" }, size: { type: "string", enum: ["small", "medium", "large"] }, complexity: { type: "string", enum: ["simple", "moderate", "complex"], }, hasTests: { type: "boolean" }, hasCI: { type: "boolean" }, hasDocs: { type: "boolean" }, isOpenSource: { type: "boolean" }, }, required: ["language"], }, }, required: ["projectPath", "baseRecommendation", "projectFeatures"], }, }, - src/memory/index.ts:142-176 (registration)Tool registration in the memoryTools array, defining the tool name, description, and input validation schema for MCP.
name: "memory_enhanced_recommendation", description: "Get enhanced recommendations using learning and knowledge graph", inputSchema: { type: "object", properties: { projectPath: { type: "string", description: "Path to the project", }, baseRecommendation: { type: "object", description: "Base recommendation to enhance", }, projectFeatures: { type: "object", properties: { language: { type: "string" }, framework: { type: "string" }, size: { type: "string", enum: ["small", "medium", "large"] }, complexity: { type: "string", enum: ["simple", "moderate", "complex"], }, hasTests: { type: "boolean" }, hasCI: { type: "boolean" }, hasDocs: { type: "boolean" }, isOpenSource: { type: "boolean" }, }, required: ["language"], }, }, required: ["projectPath", "baseRecommendation", "projectFeatures"], }, }, - src/memory/integration.ts:593-609 (helper)Analyzes success patterns (SSG counts) from similar projects for use in confidence calculation and alternative options.
async function analyzeSuccessPatterns(similarProjects: any[]): Promise<any> { const patterns = { ssgSuccess: {} as Record<string, number>, deploymentPatterns: [] as string[], commonFeatures: [] as string[], }; // Analyze SSG success rates similarProjects.forEach((project: any) => { const ssg = project.recommendation; if (ssg) { patterns.ssgSuccess[ssg] = (patterns.ssgSuccess[ssg] || 0) + 1; } }); return patterns; } - src/memory/integration.ts:611-624 (helper)Calculates confidence score for the enhanced recommendation based on how often the recommended SSG succeeded in similar projects.
function calculateConfidence( baseRecommendation: any, successPatterns: any, ): number { const recommended = baseRecommendation.recommended; const successCount = successPatterns.ssgSuccess[recommended] || 0; const totalProjects = Object.values( successPatterns.ssgSuccess as Record<string, number>, ).reduce((a: number, b: number) => a + b, 0); if (totalProjects === 0) return 0.5; // Default confidence return Math.min(successCount / totalProjects + 0.3, 1.0); }