/** * Brain Consolidator — contradiction detection for the CLEO BRAIN memory system. * * Implements heuristic contradiction detection based on keyword polarity flip. * No LLM required — uses negation markers to identify entries that assert * opposing claims about the same subject. * * When a contradiction is detected: * 1. A 'contradicts' edge is created in brain_page_edges (both directions). * 2. The lower-quality entry's qualityScore is reduced by 0.15. * * All operations are BEST-EFFORT — failures never crash the consolidator. * * @task T549 Wave 3-C * @epic T549 */ /** A detected contradiction between two memory entries. */ export interface ContradictionResult { /** ID of the first entry in the contradiction pair. */ entryAId: string; /** ID of the second entry in the contradiction pair. */ entryBId: string; /** Which entry was considered the "contradicted" one (lower quality). */ contradictedId: string; /** Table name where the entries live. */ table: string; /** Shared keywords that connected the two entries. */ sharedKeywords: string[]; /** Negation markers found in one of the entries. */ negationMarkers: string[]; } /** * Detect contradiction pairs across all verified memory entries. * * For each verified entry: * 1. Find entries with >= MIN_SHARED_KEYWORDS shared keywords. * 2. Check for negation markers in one but not the other. * 3. If contradiction detected: create 'contradicts' graph edges. * 4. Lower quality score of the contradicted (lower quality) entry by 0.15. * * Only considers entries where invalid_at IS NULL (currently valid). * Short-circuits after 50 contradiction pairs to limit consolidation cost. * * @param projectRoot - Project root directory for brain.db resolution * @returns List of contradiction pairs found */ export declare function detectContradictions(projectRoot: string): Promise; /** * Collapse near-duplicate brain_patterns rows in a single consolidation pass. * * Two rows are considered near-duplicates when: * - `normalize(pattern)` is identical * - `peer_id` is the same * - `created_at` values fall within a configurable time window (default: 3600s / 1hr) * * The oldest row (earliest `created_at`) is kept. All others are deleted after * their `occurrence_count` is merged into the survivor and `last_seen_at` is * updated to the most-recent duplicate's timestamp. * * All operations run inside a single SQLite transaction — either everything * succeeds or nothing changes. * * @param projectRoot - Project root directory for brain.db resolution * @param windowSeconds - Max seconds between rows to consider them duplicates (default 3600) * @returns Number of rows removed * * @task T1896 */ export declare function dedupePatterns(projectRoot: string, windowSeconds?: number): Promise; //# sourceMappingURL=brain-consolidator.d.ts.map