Skip to content

[4a] Org-scoped pgvector similarity search #12

@andrmaz

Description

@andrmaz

What to build

Implement the retrieval query path: embed the incoming user query, run a pgvector similarity search against indexed Chunks, and filter results strictly by the authenticated user's Organization. Return a ranked top-k chunk list ready for Context Bundle assembly.

Acceptance criteria

  • Query embedding is generated and similarity search runs against the Chunk table.
  • Results are filtered by Organization FK — chunks from other orgs are never returned.
  • Top-k ranked results are returned in a structured format (chunk id, content, score, source ref).
  • Integration test verifies org isolation: two orgs with identical content return only their own chunks.

Blocked by

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestmvpCortex MVP scope

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions