/** * Auto-research mining from ingested transcripts (T1002). * * Analyses rows in brain_transcript_events to: * 1. Detect thrash patterns — recurring failure messages across sessions. * 2. Identify golden-path patterns — sequences that consistently precede * successful outcomes. * 3. Flag top-N topics as candidates for observation promotion. * * This module does NOT write to brain_observations or brain_patterns directly. * It returns structured findings for the caller (transcript-ingestor.ts) to * decide what to promote via Lead B's T1001 promotion pattern. * * @task T1002 * @epic T1000 */ import type { DatabaseSync } from 'node:sqlite'; /** A recurring failure pattern detected across sessions. */ export interface ThrashPattern { /** Normalised error message or topic that recurs. */ topic: string; /** Number of sessions in which this topic appeared. */ sessionCount: number; /** Total occurrences across all sessions. */ totalOccurrences: number; } /** A topic that appears frequently and may be worth promoting to brain_observations. */ export interface ResearchCandidate { /** Normalised topic string. */ topic: string; /** How many transcript events reference this topic. */ referenceCount: number; /** Session IDs that contain this topic. */ sessions: string[]; } /** Full result from a mining pass. */ export interface AutoResearchResult { thrashPatterns: ThrashPattern[]; promotionCandidates: ResearchCandidate[]; analyzedEventCount: number; } /** * Mine a set of recently-ingested transcript events for thrash patterns * and promotion candidates. * * @param nativeDb - Open brain.db DatabaseSync connection. * @param sessionIds - Session IDs to analyse (typically the just-ingested batch). * @param topN - How many promotion candidates to return (default 5). * @returns AutoResearchResult with thrash patterns + promotion candidates. */ export declare function mineTranscripts(nativeDb: DatabaseSync, sessionIds: string[], topN?: number): AutoResearchResult; //# sourceMappingURL=auto-research.d.ts.map