UNPKG

@versatil/sdlc-framework

Version:

🚀 AI-Native SDLC framework with 11-MCP ecosystem, RAG memory, OPERA orchestration, and 6 specialized agents achieving ZERO CONTEXT LOSS. Features complete CI/CD pipeline with 7 GitHub workflows (MCP testing, security scanning, performance benchmarking),

90 lines (89 loc) • 4.01 kB
/** * VERSATIL SDLC Framework - RAG-Enabled Agent Base Class * * Extends BaseAgent with direct RAG capabilities, allowing each agent to: * - Retrieve domain-specific context from vector memory * - Store successful patterns for future learning * - Generate context-aware prompts with historical knowledge */ import { BaseAgent, AgentResponse, AgentActivationContext } from './base-agent.js'; import { EnhancedVectorMemoryStore, MemoryDocument } from '../rag/enhanced-vector-memory-store.js'; import { AnalysisResult } from '../intelligence/pattern-analyzer.js'; export interface RAGConfig { maxExamples: number; similarityThreshold: number; agentDomain: string; enableLearning: boolean; } export interface AgentRAGContext { similarCode: MemoryDocument[]; previousSolutions: { [issueType: string]: MemoryDocument[]; }; projectStandards: MemoryDocument[]; agentExpertise: MemoryDocument[]; metadata?: { [key: string]: any; }; } export declare abstract class RAGEnabledAgent extends BaseAgent { protected vectorStore?: EnhancedVectorMemoryStore; protected ragConfig: RAGConfig; constructor(vectorStore?: EnhancedVectorMemoryStore); /** * Override this in each agent to define domain-specific RAG configuration */ protected abstract getDefaultRAGConfig(): RAGConfig; /** * Main analysis method with RAG enhancement */ activate(context: AgentActivationContext): Promise<AgentResponse>; /** * Run domain-specific pattern analysis - to be implemented by each agent */ protected abstract runPatternAnalysis(context: AgentActivationContext): Promise<AnalysisResult>; /** * Retrieve relevant context from vector memory */ protected retrieveRelevantContext(context: AgentActivationContext, analysis: AnalysisResult): Promise<AgentRAGContext>; /** * Retrieve similar code patterns based on content and domain */ protected retrieveSimilarCodePatterns(context: AgentActivationContext): Promise<MemoryDocument[]>; /** * Retrieve previous solutions for similar issues */ protected retrievePreviousSolutions(analysis: AnalysisResult): Promise<{ [issueType: string]: MemoryDocument[]; }>; /** * Retrieve project standards specific to this agent's domain */ protected retrieveProjectStandards(context: AgentActivationContext): Promise<MemoryDocument[]>; /** * Retrieve agent-specific expertise and insights */ protected retrieveAgentExpertise(context: AgentActivationContext): Promise<MemoryDocument[]>; /** * Generate enhanced response with RAG context */ protected generateRAGEnhancedResponse(context: AgentActivationContext, analysis: AnalysisResult, ragContext?: AgentRAGContext): Promise<AgentResponse>; /** * Generate RAG-enhanced prompt with retrieved context */ protected generateRAGEnhancedPrompt(context: AgentActivationContext, analysis: AnalysisResult, ragContext?: AgentRAGContext): string; /** * Store successful patterns for future learning */ protected storeNewPatterns(context: AgentActivationContext, analysis: AnalysisResult, response: AgentResponse): Promise<void>; protected getEmptyRAGContext(): AgentRAGContext; protected createSemanticQuery(content: string, filePath: string): string; protected detectLanguage(filePath: string): string; protected detectFramework(content: string): string; protected enhanceSuggestionsWithRAG(suggestions: any[], ragContext: AgentRAGContext): void; protected generateEnhancedMessage(analysis: AnalysisResult, ragContext?: AgentRAGContext): string; protected summarizeRAGInsights(ragContext: AgentRAGContext): any; protected calculatePriorityWithRAG(analysis: AnalysisResult, ragContext?: AgentRAGContext): string; protected abstract getBasePromptTemplate(): string; protected abstract generateDomainHandoffs(analysis: AnalysisResult): string[]; }