/** * @module memory/brain-reconciler * * T1147 Wave 7: Reconciler core module. * * Extends `runConsolidation` from brain-lifecycle with a supersession pass that * reports contradiction candidates for the calling agent. Scores do not establish * authority; invalidation requires an explicit sourced replacement. * * This module absorbs the T1139 scope (decision/learning/pattern supersession) * and adds a scheduled `reconciler` trigger type to `brain_consolidation_events`. * * @task T1147 * @epic T1075 */ import type { RunConsolidationResult } from './brain-lifecycle.js'; /** Options for the reconciler pass. */ export interface ReconcilerOptions { /** Edge weight threshold above which a `contradicts` relationship triggers supersession. Default: 0.8 */ contradictionThreshold?: number; /** Session ID to associate with consolidation events. */ sessionId?: string | null; /** Dry-run mode: detect supersession candidates without writing `invalid_at`. */ dryRun?: boolean; } /** Result returned by `runReconciler`. */ export interface ReconcilerResult { /** Number of entries superseded (invalid_at set) during the reconciler pass. */ superseded: number; /** IDs of entries that were superseded, keyed by source table. */ supersededIds: { observations: string[]; learnings: string[]; decisions: string[]; patterns: string[]; }; /** Contradiction candidates requiring sourced resolution; no authority was inferred. */ candidateIds?: ReconcilerResult['supersededIds']; /** Number of dedup/quality/promotion steps from the base consolidation pass. */ consolidationResult: RunConsolidationResult; /** Whether this was a dry run (no writes performed on supersession pass). */ dryRun: boolean; } /** * Assess contradiction candidates for the calling agent without invoking a model. * Returns empty superseded lists: replacement requires explicit sourced evidence. * Optional synthesis remains available through the separate consolidation command. * * @param projectRoot - Absolute project root. * @param options - Candidate threshold, audit session, and dry-run behavior. * @returns Candidates plus legacy zero-valued consolidation counters. * @example * ```ts * const candidates = await runReconciler(projectRoot, { dryRun: true }); * ``` */ export declare function runReconciler(projectRoot: string, options?: ReconcilerOptions): Promise; /** * Counts supersession candidates without applying any changes. * * Equivalent to `runReconciler(projectRoot, { dryRun: true })` but does NOT * run the full consolidation pass — faster for pre-flight checks. * * @param projectRoot - Absolute path to the project root. * @param contradictionThreshold - Edge weight threshold (default 0.8). */ export declare function countSupersessionCandidates(projectRoot: string, contradictionThreshold?: number): Promise; /** * Fire-and-forget wrapper that triggers a reconciler sweep asynchronously. * * Used by the dispatch-time brain health reflex (T1148 W8-8 / T1151) to * schedule a sweep when the corpus is detected as unhealthy during a Tier-2 * propose tick. Returns immediately without waiting for completion. * * Errors are swallowed silently — the proposer must not be disrupted by * maintenance tasks. * * @param projectRoot - Absolute path to the project root. */ export declare function triggerReconcilerSweep(projectRoot: string): Promise; //# sourceMappingURL=brain-reconciler.d.ts.map