/** * Pattern Memory system for CLEO BRAIN. * * Extracts, stores, and queries workflow/blocker/success/failure/optimization * patterns from completed tasks and epics. * * Storage: SQLite brain_patterns table per ADR-009 Section 3.2. * * @task T4768, T5241 * @epic T4763 */ /** Pattern types from ADR-009. */ export type PatternType = 'workflow' | 'blocker' | 'success' | 'failure' | 'optimization'; /** Impact level. */ export type PatternImpact = 'low' | 'medium' | 'high'; /** Parameters for storing a new pattern. */ export interface StorePatternParams { type: PatternType; pattern: string; context: string; impact?: PatternImpact; antiPattern?: string; mitigation?: string; examples?: string[]; successRate?: number; /** * T549 Wave 1-A: origin of this pattern. * Used to route sourceConfidence at write time. * Values starting with 'auto' map to 'speculative'; otherwise 'agent'. */ source?: string; /** * T992: Internal flag — when true, bypasses the verifyAndStore gate. * Set only by storeVerifiedCandidate in extraction-gate.ts to avoid * infinite recursion (gate → storeVerifiedCandidate → storePattern → gate). * External callers MUST NOT set this flag. */ _skipGate?: boolean; } /** Parameters for searching patterns. */ export interface SearchPatternParams { type?: PatternType; impact?: PatternImpact; query?: string; minFrequency?: number; limit?: number; } /** * Store a new pattern. * If a similar pattern already exists (same type + matching text), increments frequency. * @task T4768, T5241 */ export declare function storePattern(projectRoot: string, params: StorePatternParams): Promise<{ examples: any; frequency: number; id: string; type: "success" | "failure" | "workflow" | "blocker" | "optimization"; updatedAt: string | null; peerId: string; pattern: string; qualityScore: number | null; memoryTier: "short" | "medium" | "long" | null; memoryType: "semantic" | "episodic" | "procedural" | null; verified: boolean; validAt: string; invalidAt: string | null; expiredAt: string | null; network: "world" | "bank" | "opinion" | "observation" | null; sourceConfidence: "owner" | "task-outcome" | "agent" | "speculative" | null; citationCount: number; tierPromotedAt: string | null; tierPromotionReason: string | null; contentHash: string | null; provenanceClass: string | null; peerScope: string; context: string; successRate: number | null; impact: "medium" | "low" | "high" | null; antiPattern: string | null; mitigation: string | null; examplesJson: string | null; extractedAt: string; occurrenceCount: number; lastSeenAt: string | null; pruneCandidateAt?: undefined; pruneCandidate?: undefined; } | { id: string; type: PatternType; pattern: string; context: string; frequency: number; successRate: number | null; impact: PatternImpact | null; antiPattern: string | null; mitigation: string | null; examplesJson: string; examples: never[]; extractedAt: string; qualityScore: number; memoryTier: "medium"; memoryType: "procedural"; sourceConfidence: "agent" | "speculative"; verified: boolean; contentHash: string; tierPromotedAt: null; tierPromotionReason: null; invalidAt: null; pruneCandidateAt: null; citationCount: number; pruneCandidate: boolean; }>; /** * Search patterns by criteria. * @task T4768, T5241 */ export declare function searchPatterns(projectRoot: string, params?: SearchPatternParams): Promise<{ examples: any; frequency: number; id: string; type: "success" | "failure" | "workflow" | "blocker" | "optimization"; updatedAt: string | null; peerId: string; pattern: string; qualityScore: number | null; memoryTier: "short" | "medium" | "long" | null; memoryType: "semantic" | "episodic" | "procedural" | null; verified: boolean; validAt: string; invalidAt: string | null; expiredAt: string | null; network: "world" | "bank" | "opinion" | "observation" | null; sourceConfidence: "owner" | "task-outcome" | "agent" | "speculative" | null; citationCount: number; tierPromotedAt: string | null; tierPromotionReason: string | null; contentHash: string | null; provenanceClass: string | null; peerScope: string; context: string; successRate: number | null; impact: "medium" | "low" | "high" | null; antiPattern: string | null; mitigation: string | null; examplesJson: string | null; extractedAt: string; occurrenceCount: number; lastSeenAt: string | null; }[]>; /** * Get pattern statistics. * @task T4768, T5241 */ export declare function patternStats(projectRoot: string): Promise<{ total: number; byType: Record; byImpact: Record; highestFrequency: { pattern: string; frequency: number; } | null; }>; //# sourceMappingURL=patterns.d.ts.map