2026-08-28 11:46:09 -07:00
|
|
|
# M3.8.4 — Query Path Cleanup (IMPLICIT - COMPLETE)
|
2026-08-28 10:06:14 -07:00
|
|
|
|
|
|
|
|
| Field | Value |
|
|
|
|
|
|---|---|
|
|
|
|
|
| Phase | M3.8 — Context optimization |
|
2026-08-28 11:46:09 -07:00
|
|
|
| Size | S — 0 days (no changes needed) |
|
|
|
|
|
| Status | ✅ COMPLETE |
|
|
|
|
|
| Depends | M3.8.3 |
|
|
|
|
|
| Blocks | M3.8.5 |
|
2026-08-28 10:06:14 -07:00
|
|
|
|
2026-08-28 11:46:09 -07:00
|
|
|
## Summary
|
2026-08-28 10:06:14 -07:00
|
|
|
|
2026-08-28 11:46:09 -07:00
|
|
|
✅ **IMPLICIT COMPLETION**
|
2026-08-28 10:06:14 -07:00
|
|
|
|
2026-08-28 11:46:09 -07:00
|
|
|
When M3.8 architecture was corrected (ingest vs query), the query path was already clean:
|
2026-08-28 10:06:14 -07:00
|
|
|
|
2026-08-28 11:46:09 -07:00
|
|
|
**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
|
2026-08-28 10:06:14 -07:00
|
|
|
|
2026-08-28 11:46:09 -07:00
|
|
|
**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
|
2026-08-28 10:06:14 -07:00
|
|
|
|
2026-08-28 11:46:09 -07:00
|
|
|
**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)
|
2026-08-28 10:06:14 -07:00
|
|
|
|
2026-08-28 11:46:09 -07:00
|
|
|
## Verification
|
2026-08-28 10:06:14 -07:00
|
|
|
|
2026-08-28 11:46:09 -07:00
|
|
|
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
|
2026-08-28 10:06:14 -07:00
|
|
|
```
|
|
|
|
|
|
2026-08-28 11:46:09 -07:00
|
|
|
## Files Verified
|
2026-08-28 10:06:14 -07:00
|
|
|
|
2026-08-28 11:46:09 -07:00
|
|
|
- `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
|
2026-08-28 10:06:14 -07:00
|
|
|
|
2026-08-28 11:46:09 -07:00
|
|
|
## Status
|
2026-08-28 10:06:14 -07:00
|
|
|
|
2026-08-28 11:46:09 -07:00
|
|
|
✅ **Complete**
|
2026-08-28 10:06:14 -07:00
|
|
|
|
2026-08-28 11:46:09 -07:00
|
|
|
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.
|