/**
 * Dynamic Memory Retrieval System for UAP
 *
 * Retrieves relevant memories based on task content, not static context.
 * Implements semantic search with fallback to keyword matching.
 *
 * Features:
 * - Adaptive retrieval depth based on query complexity
 * - Context budget management to prevent overflow
 * - Speculative prefetch for common patterns
 */
import { type TaskClassification } from './task-classifier.js';
import { type ContextDecision, type TaskMetadata } from './adaptive-context.js';
import { type AmbiguityResult } from './ambiguity-detector.js';
/**
 * Query complexity levels for adaptive retrieval. The scorer lives in the
 * dependency-free utils module so non-memory consumers (delivery harness)
 * can classify without loading this module's DB machinery; re-exported here
 * for backward compatibility.
 */
import { measureQueryComplexity } from '../utils/query-complexity.js';
import type { QueryComplexity } from '../utils/query-complexity.js';
export { measureQueryComplexity };
export type { QueryComplexity };
/**
 * Retrieval depth configuration
 */
export interface RetrievalDepthConfig {
    simple: {
        shortTerm: number;
        sessionMem: number;
        longTerm: number;
        patterns: number;
    };
    moderate: {
        shortTerm: number;
        sessionMem: number;
        longTerm: number;
        patterns: number;
    };
    complex: {
        shortTerm: number;
        sessionMem: number;
        longTerm: number;
        patterns: number;
    };
}
/**
 * Get retrieval limits based on query complexity
 */
export declare function getRetrievalDepth(complexity: QueryComplexity, config?: RetrievalDepthConfig): {
    shortTerm: number;
    sessionMem: number;
    longTerm: number;
    patterns: number;
};
export interface RetrievedMemory {
    content: string;
    type: 'lesson' | 'gotcha' | 'pattern' | 'context' | 'example';
    relevance: number;
    source: string;
}
export interface DynamicMemoryContext {
    classification: TaskClassification;
    relevantMemories: RetrievedMemory[];
    patterns: string[];
    gotchas: string[];
    projectContext: string;
    formattedContext: string;
    queryComplexity: QueryComplexity;
    tokenBudget: {
        used: number;
        remaining: number;
        total: number;
    };
    compressionStats?: {
        ratio: number;
        sourceTokens: number;
        compressedTokens: number;
    };
    contextDecision?: ContextDecision;
    ambiguity?: AmbiguityResult;
}
/**
 * Main function to retrieve task-specific memory context
 * Now with adaptive retrieval depth and context budget management
 */
export declare function retrieveDynamicMemoryContext(taskInstruction: string, projectRoot?: string, options?: {
    maxTokens?: number;
    useSemanticCompression?: boolean;
    taskMetadata?: TaskMetadata;
}): Promise<DynamicMemoryContext>;
/**
 * OPTIMIZATION 10: Automatic knowledge bootstrapping feedback loop
 *
 * Call this after each task completes to:
 * 1. Update adaptive context historical data
 * 2. Update model router fingerprints
 * 3. Record knowledge outcomes for domain knowledge improvement
 * 4. Extract and persist new learnings from agent output
 *
 * This closes the feedback loop so each benchmark run improves future accuracy.
 */
export interface TaskOutcome {
    instruction: string;
    success: boolean;
    durationMs: number;
    modelId?: string;
    agentOutput?: string;
    projectRoot?: string;
}
export declare function recordTaskFeedback(outcome: TaskOutcome): void;
//# sourceMappingURL=dynamic-retrieval.d.ts.map