Open
Conversation
Single narrow contract — one method, one input, one output — that serves RAG, BM25, hybrid search, web search, code search, and long-term memory recall through composition rather than per-variant types. 11 invariants (R1-R11) covering: - Read-only retrieval (R1) - query as the question, messages as context (R2) - Empty results are valid, not errors (R3) - Errors throw — no sentinel values (R4) — intentional asymmetry vs Adapter/Tool - Stable ids across calls (R5) - Optional score: when present, descending sort (R6) - Implementation-defined but consistent score scale (R7) - No implicit per-call options (R10) — config at construction - Composite retrievers must satisfy the contract (R11) Indexing intentionally NOT in the contract — RAG.ingest lives on the RAG type, not Retriever. This keeps Retriever substitutable across indexed and non-indexed backends (web search has no ingest). Unblocks #154 (RAG reranking), #155 (hybrid search), #172 (web search tools), and any composite retriever pattern. Refs #214
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
Fourth ADR of Phase 0 — formalizes the Retriever contract: a single, narrow interface that serves RAG, BM25, hybrid search, web search, code search, and conversational memory recall through composition, not per-variant types.
Builds on #267 (Adapter), #270 (Tool), #271 (Memory).
Highlight invariants
Key decision: indexing is NOT in the contract
RAG.ingestlives on the RAG type, not Retriever. This keeps Retriever substitutable across indexed (RAG over pgvector) and non-indexed (web search API) backends. Forcing aningestmethod would either be a no-op for half the implementations or block them from satisfying the contract.Trade-offs accepted
Unlocks
Test plan
Refs #214 #211