feat(memory): embedded vector search, token estimation, context scrubbing#751
Merged
feat(memory): embedded vector search, token estimation, context scrubbing#751
Conversation
…dd context scrubbing - Implement SqliteVectorStore as zero-dependency VectorStore backend storing f32 embeddings as BLOBs with Rust-side cosine similarity (#741) - Replace bytes/3 token estimation with chars/4 for better multi-byte text accuracy (#742) - Add scrub_content() credential redaction in LLM context pipeline before model calls (#743)
- Update memory concept, semantic memory guide, configuration reference - Add vector backend comparison (SQLite vs Qdrant) and setup instructions - Document credential scrubbing in security reference - Add token estimation section in architecture docs - Update root README with embedded vector search feature
- Add 17 tests covering prepare_context scrubbing, SqliteVectorStore edge cases, config round-trips, scrub_content proptests - Fix token_safety_margin: wire from config to RuntimeConfig, apply in should_compact as token count multiplier - Add SemanticMemory + SqliteVectorStore e2e round-trip test
Replace has_qdrant() which only checked if a client object existed with is_vector_store_connected() that performs an actual health check (Qdrant gRPC ping or SQLite query). Diagnostics now report true connection status instead of assuming connectivity from config. Add health_check() to VectorStore trait with implementations for QdrantOps, SqliteVectorStore, and InMemoryVectorStore. Retain has_vector_store() for cheap sync checks where connectivity is not required.
Replace hardcoded "Qdrant" labels in TUI with actual vector_backend name from config. When the backend is not connected, hide it from the status bar entirely. Memory panel shows "Vector: qdrant (connected)" or "Vector: sqlite (connected)" when healthy, "(offline)" when unreachable, and omits the line completely when no backend is configured. Builder no longer sets qdrant_available=true optimistically — the real health check in main.rs determines the actual status.
- Add SemanticMemory::with_sqlite_backend() constructor - Bootstrap now selects constructor based on vector_backend config - Add ZEPH_MEMORY_VECTOR_BACKEND env override (sqlite|qdrant) - SQLite backend now actually used when configured instead of always creating Qdrant client
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
P0 improvements to memory and context management (epic #740):
SqliteVectorStore— zero-dependency embedded vector search backend using SQLite BLOB storage with Rust-side cosine similarity. Configurable viavector_backend: sqlite|qdrantbytes/3tochars/4for accurate budget allocation on multi-byte text (Cyrillic, CJK)scrub_content()credential redaction in LLM context pipeline — reuses existingredact_secrets+sanitize_paths, applied after context assembly before model calls. Configurable viaredact_credentials: boolCloses #741, closes #742, closes #743
Test plan
vector_backend = "sqlite"works end-to-end with semantic memoryredact_credentials = falsedisables scrubbing