/**
 * Memory Consolidation System
 *
 * Like sleep consolidation in human brains, this system:
 * - Moves worthy short-term memories to long-term storage
 * - Strengthens frequently accessed memories
 * - Cleans up decayed/irrelevant memories
 * - Merges similar memories to reduce redundancy
 */
import { Memory, MemoryConfig, ConsolidationResult, ContextSummary } from './types.js';
/**
 * Run full consolidation process
 * This is like the brain's sleep consolidation - should be run periodically
 */
export declare function consolidate(config?: MemoryConfig): ConsolidationResult;
export interface DuplicateMemoryPair {
    memoryA: Memory;
    memoryB: Memory;
    recommendedKeepId: number;
    similarity: string;
    titleSimilarity: number;
    contentOverlap: number;
    sharedWords: number;
}
export declare function findDuplicateMemoryPairs(options?: {
    project?: string;
    limit?: number;
}): DuplicateMemoryPair[];
/**
 * Find memories with very similar titles/content and merge them.
 * Keeps the newer one, appends unique content from the older one.
 */
export declare function deduplicateMemories(options?: {
    dryRun?: boolean;
}): {
    merged: number;
    pairs: Array<{
        kept: number;
        removed: number;
        similarity: string;
    }>;
};
/**
 * Group memories by topic and create summary memories for large clusters.
 */
export declare function clusterAndSummarise(options?: {
    minClusterSize?: number;
}): {
    clusters: number;
    summariesCreated: number;
};
/**
 * Enforce maximum memory limits
 * Removes lowest-priority memories when limits are exceeded
 */
export declare function enforceMemoryLimits(config?: MemoryConfig): number;
/**
 * Find and merge similar short-term memories into coherent long-term entries.
 * Groups memories by project|category, then clusters by Jaccard similarity
 * on content (0.6 weight) + title (0.4 weight).
 * Returns count of deleted (merged) memories.
 */
export declare function mergeSimilarMemories(project?: string, similarityThreshold?: number): number;
/**
 * Generate a context summary for session start
 * Provides a high-level view of relevant memories
 */
export declare function generateContextSummary(project?: string, config?: MemoryConfig): Promise<ContextSummary>;
/**
 * Format context summary as a readable string
 */
export declare function formatContextSummary(summary: ContextSummary): string;
/**
 * Start a new session
 * Creates a session record and returns relevant context
 */
export declare function startSession(project?: string): Promise<{
    sessionId: number;
    context: ContextSummary;
}>;
/**
 * End a session
 * Updates session record with summary
 */
export declare function endSession(sessionId: number, summary?: string): void;
/**
 * Get suggested context for the current query
 * Returns memories that might be relevant to what the user is working on
 */
export declare function getSuggestedContext(currentContext: string, project?: string, limit?: number): Promise<Memory[]>;
/**
 * Export memories as JSON (for backup/transfer)
 */
export declare function exportMemories(project?: string): string;
/**
 * Import memories from JSON
 */
export declare function importMemories(json: string): number;
/**
 * Vacuum database to reclaim space after deletions
 * Run periodically or after major cleanup operations
 */
export declare function vacuumDatabase(): {
    success: boolean;
    message: string;
};
/**
 * Preview what consolidation would do without actually doing it
 * Useful for dry-run mode
 */
export declare function previewConsolidation(config?: MemoryConfig): {
    toPromote: Memory[];
    toDelete: Memory[];
    totalShortTerm: number;
    totalLongTerm: number;
};
/**
 * Check if consolidation should be triggered based on memory state
 * Returns true if consolidation is recommended
 */
export declare function shouldTriggerConsolidation(config?: MemoryConfig): {
    shouldRun: boolean;
    reason: string;
};
/**
 * Full cleanup: consolidate + vacuum
 * Best run periodically to keep database healthy
 */
export declare function fullCleanup(config?: MemoryConfig): {
    consolidation: ConsolidationResult;
    vacuumed: boolean;
    merged: number;
    quarantineExpired: number;
};
export interface DreamModeResult {
    nearDuplicatesMerged: number;
    archivalCandidates: number;
    contradictionsDetected: number;
    totalProcessed: number;
}
/**
 * "Dream Mode" — comprehensive memory consolidation.
 *
 * 1. Find near-duplicates by embedding similarity >0.9, merge them
 * 2. Flag memories >30 days old with no access as archival candidates
 * 3. Detect and flag contradictions
 */
export declare function consolidateMemories(): DreamModeResult;
