Skip to content

refactor: extract QdrantOps shared helper #298

@bug-ops

Description

@bug-ops

Context

Four crates duplicate Qdrant boilerplate (~200 lines total): client construction, ensure_collection, upsert_points, search_points with cosine similarity.

Crate Store struct Collection
zeph-memory QdrantStore zeph_conversations
zeph-index CodeStore zeph_code_chunks
zeph-skills QdrantSkillMatcher zeph_skills
zeph-mcp McpToolRegistry zeph_mcp_tools

Proposed change

Extract QdrantOps helper into zeph-memory (which already exports ensure_qdrant_collection):

pub struct QdrantOps {
    client: Qdrant,
    collection: String,
}

impl QdrantOps {
    pub fn new(url: &str, collection: &str) -> Result<Self, Box<QdrantError>>;
    pub async fn ensure_collection(&self, vector_size: u64) -> Result<()>;
    pub async fn upsert(&self, points: Vec<PointStruct>) -> Result<()>;
    pub async fn search(&self, vector: Vec<f32>, filter: Option<Filter>, limit: u64) -> Result<Vec<ScoredPoint>>;
    pub async fn delete_by_filter(&self, filter: Filter) -> Result<()>;
    pub fn client(&self) -> &Qdrant;
}

Each domain store keeps its logic but delegates low-level Qdrant calls.

Affected crates

zeph-memory (new module), zeph-index, zeph-skills, zeph-mcp

Complexity

Medium

References

.local/plan/architecture-audit.md — Phase 2, item 2.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions