DESIGN: Pre-submission optimization pipeline that sits between hybrid search retrieval and the LLM gateway. Search indexes (pgvector + OpenSearch) stay at full fidelity; only the evidence chunks entering the prompt get optimized. 4-STAGE PIPELINE: 1. CacheAligner — move dynamic content (timestamps, UUIDs) to tail, stabilize prefix for LLM provider KV cache hits 2. ContentRouter — auto-detect content type (JSON, code, logs, diffs, text) via structural heuristics, route to best compressor 3. Compressors — per-type compression: - JsonCrusher (70-90%): field variance, boundary items, key preservation - LogCompressor (85-95%): reuses M3.7.7 patterns, keeps errors/traces - CodeCompressor (40-70%): signature preservation, body stripping - DiffCompressor (60-80%): hunk preservation, context dropping - TextCompressor (30-50%): token importance scoring 4. CCR Store — cache originals with hash, inject retrieval hint, model can fetch full content if needed (lossless) REUSES EXISTING CODE: - lesson.rs normalise() for CacheAligner pattern detection - lesson.rs markers() + is_cascade() for LogCompressor - symptom_projection.rs stop words for TextCompressor INTEGRATION POINT: - After hybrid search retrieval, before PromptBuilder - Search quality preserved (full text in pgvector + OpenSearch) - Only LLM input is optimized Inspired by Headroom (https://docs.headroomlabs.ai)