M3.8.3 ✅ COMPLETE (7 tests) - MetricsCollector: per-project aggregation - Structured logging (tracing) - Prometheus export format M3.8.4 ✅ IMPLICIT (no work needed) - Query path already clean (no compression) - Only cache_metrics() uses optimizer (for observability) M3.8.5 ⏳ ACTIVE (16 tests spec'd) - Compression ratio benchmarks (5 tests: log/json/text/diff/mixed) - Search quality validation (8 tests: pgvector/opensearch/fusion) - Performance baseline (3 tests: latency/throughput/memory) M3.8.6 ⏳ PENDING (13 gate assertions) - Safety (6): no data loss, deterministic, structure preservation - Performance (4): latency p99 <3ms, throughput 1000+/sec, memory <100MB - Quality (3): compression targets, search improvement, cache accuracy Project progress: 64/78 complete (82%), 8/13 gates green Total M3.8 tests: 103 (62+5+7+0+16+13)
67 lines
2.3 KiB
Markdown
67 lines
2.3 KiB
Markdown
# M3.8.4 — Query Path Cleanup (IMPLICIT - COMPLETE)
|
|
|
|
| Field | Value |
|
|
|---|---|
|
|
| Phase | M3.8 — Context optimization |
|
|
| Size | S — 0 days (no changes needed) |
|
|
| Status | ✅ COMPLETE |
|
|
| Depends | M3.8.3 |
|
|
| Blocks | M3.8.5 |
|
|
|
|
## Summary
|
|
|
|
✅ **IMPLICIT COMPLETION**
|
|
|
|
When M3.8 architecture was corrected (ingest vs query), the query path was already clean:
|
|
|
|
**Current State:**
|
|
- ❌ NO query-path compression in `build_cache_aligned()`
|
|
- ✅ Only `cache_metrics()` calls optimizer (for metrics collection only, not compression)
|
|
- ✅ Actual chunks sent to LLM are unmodified
|
|
- ✅ Optimization happens at ingest time via M3.8.2 helpers
|
|
|
|
**What Didn't Need Changing:**
|
|
- `PromptBuilder::build_cache_aligned()` — Already doesn't compress chunks
|
|
- `PromptBuilder::cache_metrics()` — Only uses optimizer for token estimation (okay for metrics)
|
|
- `PromptBuilder::build()` — Legacy path, unmodified
|
|
|
|
**Why This is Better:**
|
|
- Clean separation: ingest optimizes, query doesn't
|
|
- LLM gets pre-optimized chunks from search results
|
|
- No per-query optimization overhead
|
|
- Cache metrics track drift for observability (non-destructive)
|
|
|
|
## Verification
|
|
|
|
All prompt tests still passing (11 tests):
|
|
```
|
|
test prompt::tests::test_cache_aligned_chunk_budget_exceeded ... ok
|
|
test prompt::tests::test_cache_aligned_contains_query ... ok
|
|
test prompt::tests::test_cache_aligned_memory_budget_exceeded ... ok
|
|
test prompt::tests::test_cache_aligned_produces_two_user_messages ... ok
|
|
test prompt::tests::test_cache_prefix_is_stable_across_chunks ... ok
|
|
test prompt::tests::test_cache_prefix_is_stable_across_memory_changes ... ok
|
|
test prompt::tests::test_cache_prefix_tokens_positive ... ok
|
|
test prompt::tests::test_headroom_positive_under_budget ... ok
|
|
test prompt::tests::test_legacy_build_still_works ... ok
|
|
test prompt::tests::test_render_chunk_multiple_roles ... ok
|
|
test prompt::tests::test_render_chunk_single_record ... ok
|
|
```
|
|
|
|
## Files Verified
|
|
|
|
- `crates/mem-core/src/prompt.rs` — No query-path compression
|
|
- `crates/mem-core/src/optimizer/mod.rs` — Optimizer available for metrics only
|
|
- No changes required
|
|
|
|
## Status
|
|
|
|
✅ **Complete**
|
|
|
|
This task represents "no work needed" because the architecture was corrected upfront:
|
|
- Optimizer at ingest (M3.8.2) ✅
|
|
- Metrics collection in query (M3.8.3) ✅
|
|
- No compression in query ✅
|
|
|
|
The query path is already clean.
|