/** * Cortex Detector — Auto-detection & suggestion system * * Monitors sessions and detects patterns that should become: * - Behaviors (repeated work patterns) * - Rules (repeated prohibitions) * - Memory Bits (facts/preferences learned) * - Glossary (new vocabulary used) * - Code Bits (reusable code patterns) * - Personas (client context detected) * - Habits (behavior compliance data) */ export type SuggestionType = 'behavior' | 'rule' | 'memory' | 'glossary' | 'codebit' | 'persona' | 'habit' | 'template' | 'skill'; export interface Suggestion { id: string; type: SuggestionType; name: string; description: string; evidence: string[]; sourceRepo: string; confidence: number; status: 'pending' | 'accepted' | 'rejected' | 'snoozed'; createdAt: string; content?: string; source?: string; targetRepo?: string; targetRepoPath?: string; scope?: 'global' | 'portfolio' | 'repo'; diffusionTargets?: string[]; } export interface DetectionPattern { type: SuggestionType; pattern: RegExp | string; minOccurrences: number; description: string; } export declare function upsertSuggestions(incoming: Suggestion[]): Suggestion[]; /** * Analyze text from a session for potential suggestions */ export declare function analyzeText(text: string, repo: string): Suggestion[]; /** * Analyze a git diff for code-level patterns */ export declare function analyzeDiff(diff: string, repo: string): Suggestion[]; /** * Get all pending suggestions */ export declare function getPendingSuggestions(): Suggestion[]; /** * Get all suggestions */ export declare function getAllSuggestions(): Suggestion[]; /** * Accept a suggestion — apply it to Cortex */ export declare function acceptSuggestion(id: string): { ok: boolean; message: string; }; /** * Reject a suggestion */ export declare function rejectSuggestion(id: string): boolean; /** * Snooze a suggestion (ask later) */ export declare function snoozeSuggestion(id: string): boolean; /** * Get suggestion stats */ export declare function getSuggestionStats(): { total: number; pending: number; accepted: number; rejected: number; byType: Record; };