/** * OAS (Operator-Aware Selection) memory-consolidation operator picker * (#2763 dream-cycle). * * Findings from the OAS paper referenced in dream-cycle #2763: memory- * consolidation performance improves by +48% when the caller picks the * RIGHT operator for the current budget + workload, instead of always * applying the most-expensive one. Ruflo already has multiple * consolidation operators (merge / summarize / compress / distill), * but has no cost-aware selector — every `memory consolidate` call * uses the same path. * * v1 MVP: rule-based selector. Cost-per-entry estimates are informed * by ruflo's own measured performance targets in v3/@claude-flow/cli/ * CLAUDE.md — no external benchmark call needed. v2 will refine costs * from routing-outcomes trajectories. */ /** The four consolidation operators ruflo can apply. */ export type OperatorId = 'merge' | 'summarize' | 'compress' | 'distill'; export interface OperatorSpec { id: OperatorId; /** Estimated cost per entry, in abstract "operator points" (1 point ≈ 1 Haiku call). */ costPerEntry: number; /** Maximum recommended entry count per invocation (higher counts split). */ maxEntries: number; /** What the operator does — human-readable. */ description: string; /** Best when the entry set has this shape. */ bestWhen: string; } export declare const OPERATORS: Record; export interface OperatorSelection { operator: OperatorId; reason: string; /** Estimated cost = costPerEntry × min(entries, maxEntries). */ estimatedCost: number; /** True if entries > operator.maxEntries and caller should split into multiple invocations. */ needsSplit: boolean; suggestedBatchSize: number; /** All operators considered, in ranked order (best first). */ considered: Array<{ id: OperatorId; cost: number; fits: boolean; }>; } export interface SelectOptions { /** Budget in abstract operator points. */ budget: number; /** Number of entries to consolidate. */ entries: number; /** * Optional hint about entry shape: * 'duplicates' → strongly prefer merge (cheap wins first) * 'verbose' → prefer summarize * 'patterns' → prefer distill (small, high-signal) * 'general' → let cost-fit decide (default) */ hint?: 'duplicates' | 'verbose' | 'patterns' | 'general'; } /** * Select the highest-value operator that fits the budget. * * Selection rule (v1): * 1. If a hint is provided AND the hinted operator fits the budget, * pick it (hint is a strong signal about entry shape). * 2. Else, rank operators by cost ascending; pick the most expensive * operator that still fits budget × 1.0 (no over-spend). Idea: * spend the whole budget on the most-fidelity operator we can afford. * 3. If nothing fits, return merge (guaranteed cheapest) with * needsSplit=true so caller batches. */ export declare function selectOperator(opts: SelectOptions): OperatorSelection; //# sourceMappingURL=oas-operator-selector.d.ts.map