docs(s31): --semantic-retrieval CLI surface + Embedder/Retriever extension points

This commit is contained in:
Kjell Tore Guttormsen 2026-07-25 06:31:44 +02:00
commit 921a8daf71
3 changed files with 65 additions and 4 deletions

View file

@ -34,6 +34,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
`kost_mot_verdi` placeholder — that cost-vs-value integration is a separate, deferred step. The
`costsim` seam note was reworded from the stale "fylles av S5.4 verdirapport" to a truthful
forward reference so `costsim`'s own output no longer claims the wiring is done.
- Semantic retrieval seam (S3.1): a new MAF-free `semretrieval.py` adds an `Embedder`/`Retriever`
pair and a `HybridRanker` blending brute-force numpy cosine over embedded proposal features with
the existing structural score, exposed as `--semantic-retrieval` (valid in both run modes).
**Off by default and additive**: with no retriever installed the store delegates to
`StructuralRetriever`, which reproduces the pre-seam ranking exactly, so the text-excluded
default and every existing test are unchanged. Turning it on is a deliberate, gated reversal of
that default, since an embedder does see proposal text. Determinism is pinned rather than hoped
for: BLAS threads are fixed before numpy is imported, vectors are C-contiguous float64, and
ranking uses the total order `(-round(score, 9), id)`. Ships an optional, rebuildable
`vectors.npy` + `vectors.jsonl` store (byte-identical regardless of insertion order; fail-fast
on a row/line mismatch; missing loads as `None`). numpy is confined to `semretrieval.py` and
never enters `okf.py`, `retrieval.py` or `shared/`. The real embeddings client remains a
config-only extension point — the shipped `FakeEmbedder` is a deterministic hash projection with
no semantics, so this buys a scaling *seam*, not better retrieval quality.
- Azure/Foundry offline preflight config gate (`preflight.py`, S4.1).
- Offline live-dry-run drill (`--live-dry-run`, S4.2): walks the whole path up to the eager
client build and stops before the first model call — zero chat calls.
@ -44,7 +58,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
`allow_egress` opt-in. Not auto-wired into `run.py`.
- `docs/knowledge-base-recipe.md` (S5.3, D-H item 1): the documented team process (technical +
domain expert) for building a knowledge base, with the honest 12 week expectation.
- Test suite: 431 passing tests (4 skips are live-provider-only), every wired seam covered by a
- Test suite: 488 passing tests (4 skips are live-provider-only), every wired seam covered by a
load-bearing test that goes red when the seam is detached.
### Notes