Plan: retriever rewrite in three stages - #181
Merged
Merged
Conversation
Stages the work so a structural change and a behaviour change are never in the
same commit:
1 BaseRetriever with vendored RRF. Query expansion and SelfQuery both stay.
This changes how the code is arranged, not what it returns, so the exit
criterion is that retrieval_baseline shows ZERO difference.
2 D1: plain semantic search replaces SelfQuery. Retrieval drops to one LLM
call per message. Differences must be confined to the vector side.
3 D2/D3: the budget and the bundle become arguments, which removes the B008
suppression and the four retrievers.*.rag mypy baseline entries.
Each stage ends by answering a real question through the full chain via both
invoke and ainvoke -- not by testing the retriever in isolation, which is the
failure mode that recurred most this week and is Article I of the constitution.
Deliberately not generated: research.md, data-model.md, contracts/. There are no
unresolved unknowns (D1-D4 are settled with evidence in the spec) and the feature
introduces no data model or external contract, so the scaffolding would be
ceremony. The constitution says Spec Kit is for decisions, not paperwork.
Complexity tracking records four rejected simplifications and why, including
keeping metadata_info.py: it is not dead, because the evaluator and the baseline
harness still construct SelfQuery, and deleting it would break the tool that
measures stage 2.
Every factual claim was checked against the code: userguide is already a plain
BaseRetriever, the four collections hold 121,291 documents, RRF is
weight/(rank+60) counting from 1 and de-duplicating on page_content, and there
are four mypy baseline entries rather than three.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Implementation plan for spec 001. No code yet.
The staging, and why
A structural change and a behaviour change are never in the same commit:
BaseRetrieverwith vendored RRF; expansion and SelfQuery both stayretrieval_baseline compareshows zero differenceStage 1 producing identical output is the point. If it does not, the refactor changed something it should not have, and that is far easier to find before Stage 2 moves the results deliberately.
Each stage ends by answering a real question through the full chain, via both
invokeandainvoke— not by testing the retriever in isolation. That is the failure mode that recurred most this week and is Article I of the constitution.What is deliberately not generated
No
research.md,data-model.mdorcontracts/.D1–D4 are settled with measured evidence in the spec, so there is nothing to research. The feature introduces no data model and no external contract. Generating that scaffolding would be exactly the ceremony the constitution says to avoid — Spec Kit is for decisions, not paperwork.
Complexity tracking
Four simplifications considered and rejected, with reasons — notably keeping
metadata_info.py. It looks like 339 dead lines after D1, butevaluator.pyandbin/retrieval_baselinestill construct SelfQuery, so deleting it would break the tool that measures Stage 2.Verification
Every factual claim was checked against the code rather than written from memory:
🤖 Generated with Claude Code