Foundation: corpus-source substrate, persistence, retrieval (3 corpora live) - #14
Merged
Merged
Conversation
Implements the core of ir as an agentic IR substrate composed on ef + vd: - config: XDG dirs (config/data/cache), env-overridable. - base: Artifact / Surface / IndexPlan / Record / SearchHit data model; the filter-fields vs embeddable-surfaces split. - store: dol-backed CorpusStore (meta JSON / vectors numpy / ledger / config) + in-memory store; brute-force normalized matrix. - embed: decent-local default (all-MiniLM-L6-v2 via ef ST adapter, USE_TF=0, CachedEmbedder) + light hashing fallback. - strategy: IndexingStrategy seam with WholeText / Chunked / Skill / Package; paragraph-packing chunker. - sources: CorpusSource (scope + change-signal + strategy + embedder) with from_mapping/from_files/from_md_reports/from_skills/from_packages. - index: incremental content-hash CRUD build + full-refresh prune. - retrieve: hard metadata filter (vd) + dense brute force + per-artifact dedupe; hybrid/rerank left as seams. Validated end-to-end with MiniLM on three corpora (skills 157, packages 1508 surfaces, md-reports 16836 chunks); top-1 retrieval correct on sample intents. 22 hermetic tests pass (light embedder). Closes #2 Closes #3 Closes #4 Closes #5 Closes #6 Closes #7 Closes #8 Closes #9 Closes #10 Refs #1 Refs #11 Refs #12 Refs #13
This was referenced Jun 5, 2026
Apply confirmed findings from the adversarial review workflow: - index: ledger now records a strategy_id; the change-skip condition requires version + embedder_id + strategy_id to match, so rebuilding a corpus under a different IndexingStrategy on unchanged content correctly re-decomposes instead of silently skipping. (+regression test) - embed: USE_TF set by assignment (not setdefault) so a shell USE_TF=1 can't re-enable the TF import that crashes on this numpy ABI. - retrieve: guard against a query/index embedding-dim mismatch with a clear error instead of a cryptic shape crash. - sources.from_skills: injectable `fetcher` for testability (DI). (+test) - base.best_per_artifact: docstring corrected (re-sorts by score). Rejected as non-issues after inspection: the "fewer surfaces" leak (prev.record_ids already covers deletion), the skills/packages whole- mapping hash (keeps filter fields fresh; re-embeds are cache hits), and several ef-internal / intended-behavior / doc-nit findings. 24 tests pass. Refs #1 #3 #6 #7
Member
Author
Adversarial review passRan a 5-dimension code-review workflow (incremental-maintenance · embedding/cache · retrieval math · persistence · API-reuse), each finding verified by an independent skeptic. 15 findings surfaced; triaged against the actual code and applied 5, rejected the rest as verifier over-reach: Applied (commit ee0c34c):
Rejected after inspection: the "fewer-surfaces leak" (the delete loop uses 24 tests pass. |
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.
What this lands
The foundation of
iras an agentic information-retrieval substrate composed onef+vd— and three of the target corpora working end-to-end. Implements the plan in #1.Architecture (compose, don't reinvent)
ef→ embedders (HashingEmbedder,sentence_transformers_embedder,CachedEmbedder),content_hash.vd→ Mongo-style metadatamatches_filter(hard filters), RRF (reserved for hybrid).dol→ the key-value persistence layer (repository pattern).iradds the genuinely-new band: theIndexingStrategyseam, source adapters, retrieval/dedupe.Modules
configbaseArtifact/Surface/IndexPlan/Record/SearchHit; filter-fields vs surfaces splitstoreCorpusStore(meta/vectors/ledger/config) + in-memory; brute-force matrixembedstrategyIndexingStrategy:WholeText/Chunked/Skill/Package; paragraph-packing chunkersourcesCorpusSource= scope + change-signal + strategy + embedder;from_*constructorsindexretrieveDefining a corpus source (the core ask)
A source is an abstract strategy + parameters with smart defaults:
Embedding
Default = local
all-MiniLM-L6-v2(384-d,USE_TF=0to dodge a TF/numpy ABI crash), wrapped in a disk cache keyed by(model, content_hash).embedder="light"→ numpy-only hashing for fast tests.Persistence
Repository pattern over
dolMutableMappings under XDG dirs; swap the store to change where/how data persists. Default = local files; brute-force cosine (exact, instant at these sizes).Validation
MiniLM end-to-end, top-1 correct on sample intents:
acquire-references; "deploy web app" →tw-deploy.vd; name-filter →dol.ir_0xqueries resolve correctly.22 hermetic tests pass (light embedder; source-adapter tests skip without
priv/$PP).Deferred (tracked)
Hybrid BM25+RRF and reranking seams (#7), selection stage (#11), eval harness (#12), CLI + named-corpus registry (#13). AI-authored synopsis / problem-class surfaces for packages are a documented
Package-strategy extension.Design rationale:
misc/docs/ir_04. Closes #2–#10; refs #1, #11, #12, #13.