/** * Decision Extractor - Identifies and extracts decisions from conversations. * * This extractor analyzes conversation messages and thinking blocks to identify * technical and architectural decisions made during development. It captures: * - What decision was made * - Why it was made (rationale) * - What alternatives were considered * - Why alternatives were rejected * - Context (what the decision was about) * * Uses pattern matching to detect decision indicators like "we decided to", * "using X instead of Y because", and user corrections. * * @example * ```typescript * const extractor = new DecisionExtractor(); * const decisions = extractor.extractDecisions(messages, thinkingBlocks); * console.log(`Found ${decisions.length} decisions`); * decisions.forEach(d => { * console.log(`Decision: ${d.decision_text}`); * console.log(`Rationale: ${d.rationale}`); * }); * ``` */ import type { Message, ThinkingBlock } from "./ConversationParser.js"; /** * Represents a technical or architectural decision made during development. */ export interface Decision { /** Unique decision identifier */ id: string; /** Conversation where this decision was made */ conversation_id: string; /** Message containing the decision */ message_id: string; /** The decision that was made */ decision_text: string; /** Why this decision was made */ rationale?: string; /** Alternative approaches that were considered */ alternatives_considered: string[]; /** Reasons why alternatives were rejected */ rejected_reasons: Record; /** Context/domain of the decision (e.g., 'database', 'authentication') */ context?: string; /** Files affected by this decision */ related_files: string[]; /** Git commits implementing this decision */ related_commits: string[]; /** When the decision was made */ timestamp: number; } /** * Extracts technical and architectural decisions from conversation history. * * Analyzes messages and thinking blocks using pattern matching to identify * decisions, rationale, alternatives, and context. */ export declare class DecisionExtractor { private readonly MIN_QUALITY_SCORE; private readonly NOISE_PATTERNS; private readonly DECISION_PATTERNS; private readonly CORRECTION_PATTERNS; private readonly CONTEXT_KEYWORDS; /** * Extract decisions from messages and thinking blocks. * * Analyzes conversation messages to identify decisions using pattern matching. * Looks for explicit decision statements, user corrections, and thinking blocks * that contain decision-making processes. * * @param messages - Array of conversation messages to analyze * @param thinkingBlocks - Array of thinking blocks (Claude's internal reasoning) * @returns Array of extracted Decision objects * * @example * ```typescript * const extractor = new DecisionExtractor(); * const decisions = extractor.extractDecisions(messages, thinkingBlocks); * * // Find decisions about databases * const dbDecisions = decisions.filter(d => d.context?.includes('database')); * ``` */ extractDecisions(messages: Message[], thinkingBlocks: ThinkingBlock[]): Decision[]; /** * Check if content is noise that should be filtered out */ private isNoiseContent; /** * Extract explicit decisions from assistant messages */ private extractExplicitDecisions; /** * Parse a regex match into a Decision object */ private parseDecisionMatch; /** * Extract structured decisions (e.g., "Decision: ..." format) */ private extractStructuredDecisions; /** * Extract decisions from user corrections */ private extractCorrections; /** * Check if content contains technical keywords suggesting a real decision */ private hasTechnicalKeywords; /** * Extract decision text from matched pattern */ private extractDecisionText; /** * Extract rationale from decision text */ private extractRationale; /** * Extract alternative approaches that were considered */ private extractAlternatives; /** * Extract reasons for rejecting alternatives */ private extractRejectedReasons; /** * Identify what context/area this decision relates to */ private identifyContext; /** * Extract related files from message metadata */ private extractRelatedFiles; /** * Deduplicate similar decisions */ private deduplicateDecisions; /** * Score a decision's importance (for prioritization) */ scoreDecisionImportance(decision: Decision): number; } //# sourceMappingURL=DecisionExtractor.d.ts.map