Summary
Prerequisite refactors required before graph memory integration (Phase 0).
Parent epic: #1222
Tasks
1. Arc-wrap EmbeddingStore in SemanticMemory
EmbeddingStore wraps Box<dyn VectorStore> and does not implement Clone. Phase 4 of graph memory needs to spawn background tasks that access the embedding store.
Change: Wrap qdrant field in SemanticMemory from Option<EmbeddingStore> to Option<Arc<EmbeddingStore>>. All existing &self.qdrant usages continue to work via Deref. This is an internal refactor with no public API change.
Files: crates/zeph-memory/src/semantic.rs
2. FuturesUnordered context preparation
The current prepare_context in crates/zeph-core/src/agent/context.rs uses tokio::try_join! with cfg-gated branches, creating combinatorial explosion when adding new context sources. Adding graph facts would create a 4-way branching matrix.
Change: Refactor prepare_context to use FuturesUnordered with tagged ContextSlot enum:
enum ContextSlot {
Summaries(Vec<String>),
SemanticRecall(Vec<RecalledMessage>),
CrossSession(Vec<SessionSummaryResult>),
CodeContext(Vec<String>),
#[cfg(feature = "graph-memory")]
GraphFacts(Vec<GraphFact>),
}
Each context source is a fetchers.push() call with its own #[cfg] gate. No more duplicated try_join blocks.
Files: crates/zeph-core/src/agent/context.rs
Acceptance Criteria
Summary
Prerequisite refactors required before graph memory integration (Phase 0).
Parent epic: #1222
Tasks
1. Arc-wrap EmbeddingStore in SemanticMemory
EmbeddingStorewrapsBox<dyn VectorStore>and does not implementClone. Phase 4 of graph memory needs to spawn background tasks that access the embedding store.Change: Wrap
qdrantfield inSemanticMemoryfromOption<EmbeddingStore>toOption<Arc<EmbeddingStore>>. All existing&self.qdrantusages continue to work viaDeref. This is an internal refactor with no public API change.Files:
crates/zeph-memory/src/semantic.rs2. FuturesUnordered context preparation
The current
prepare_contextincrates/zeph-core/src/agent/context.rsusestokio::try_join!with cfg-gated branches, creating combinatorial explosion when adding new context sources. Adding graph facts would create a 4-way branching matrix.Change: Refactor
prepare_contextto useFuturesUnorderedwith taggedContextSlotenum:Each context source is a
fetchers.push()call with its own#[cfg]gate. No more duplicated try_join blocks.Files:
crates/zeph-core/src/agent/context.rsAcceptance Criteria
SemanticMemory.qdrantfield isOption<Arc<EmbeddingStore>>prepare_contextusesFuturesUnorderedpatterntry_join!duplication remainscargo clippy --workspace -- -D warningspasses