/** * Darwin — Pattern Detector * * Analyzes experiment history to detect performance patterns: * strengths, weaknesses, trends, and anomalies. * * These patterns drive prompt optimization decisions. */ import type { DarwinPattern, MemoryProvider } from '../types.js'; export declare class PatternDetector { private memory; constructor(memory: MemoryProvider); /** * Detect patterns across all experiments for a given agent. * * Groups experiments by taskType, then looks for: * - Strengths: categories where the agent consistently scores high * - Weaknesses: categories where the agent consistently scores low * - Trends: improving or declining performance over time * - Anomalies: individual experiments far from the mean */ detectPatterns(agentName: string): Promise; private detectStrengths; private detectWeaknesses; /** * Detect categories that underperform relative to the agent's overall average. * This catches the "mediocre zone" (4.0-7.5) that absolute thresholds miss. * * Example: Writer has market=6.3, tech=7.1, webdesign=7.1 → overall ~6.8 * Market is 0.5 below average. With RELATIVE_WEAKNESS_GAP=1.0, it wouldn't trigger. * But if we also check against the BEST category, market is 0.8 below tech/webdesign. * * Strategy: flag if category is >RELATIVE_WEAKNESS_GAP below the best category * OR if category is below 7.0 with significant data (improvement opportunity). */ private detectRelativeWeaknesses; /** * Detect improving or declining quality trends across all experiments * (sorted chronologically). */ private detectTrends; /** * Detect outlier experiments within a task category using * standard deviation from the mean quality score. */ private detectAnomalies; private groupByTaskType; private avgQuality; private successRate; /** * Calculate confidence from evidence count. * More data points = higher confidence, capping at 1.0. * Formula: min(count / 10, 1.0) — so 10+ experiments = full confidence. */ private confidenceFromCount; /** * Sample standard deviation (Bessel's correction, n-1). * With small category sizes (MIN_CATEGORY_SIZE=2), population std * would underestimate variance and over-report anomalies. */ private standardDeviation; } //# sourceMappingURL=patterns.d.ts.map