Files
Dragan Spiridonov a2f9365ddc feat: implement session reuse with O(1) fingerprint cache for 40-60% token savings (#334)
Imp-15: Session Reuse for Repeated Operations

Adds a SHA-256 fingerprint-based operation cache as layer 0 before HNSW
early exit. Exact-match lookups run in O(1) before O(log n) similarity
search, catching repeated operations instantly.

- SessionOperationCache with TTL, capacity eviction, and kv_store persistence
- Wired into TokenOptimizerService.checkEarlyExit() as first check
- cacheOperationResult() stores results after successful LLM execution
- session_cache_stats MCP tool for monitoring hit rates
- CLI: aqe token-usage --cache-stats for cache performance
- Cross-session persistence via existing kv_store table
- 26 new tests covering fingerprinting, TTL, eviction, stats, degradation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 13:36:35 +00:00
..