Skip to content

Add web search and compaction feature - #13

Merged
MatthewHsu1 merged 8 commits into
mainfrom
feat/harness
Sep 10, 2026
Merged

MatthewHsu1 merged 8 commits into
mainfrom
feat/harness

Conversation

@MatthewHsu1

Copy link
Copy Markdown
Owner

No description provided.

…alues

The cache was a local of the boot, reachable only by the startup steps it was
passed to. A host that wants the values a vocabulary slot holds — to gate a
knowledge search on the product names the base publishes, say — had no way to
reach the instance the refresh services write into.
…ing scoped by

Two rules assumed a vocabulary: slot exists only to narrow a search, so the domain
and the scope had to name the same facets.

Check 2 refused a vocabulary: slot that scope.fromState did not name. The gate and
the linker are useful on their own — they hold the extractor to values the provider
published — and a host may read the domain for itself. Scoping is what fromState
declares, and it is a separate decision.

The two vocabulary reads then stripped the wildcard sentinel only for facets
wildcard.facets names. The sentinel is stored in the collection, so a read of any
facet path returns it, and it normalises to nothing — which refused the document one
step later. wildcard.facets answers which scope conditions a deployment widens, so it
was the wrong question to ask of a read.
…to find out

Search is the one thing every knowledge store owes. Reading a facet vocabulary is
a capability only some serve, and the two callers that need it found out by
casting — which answers false on a wrapper, because a wrapper does not implement
what it wraps. A cache or a log in front of a store would have cost the document
its vocabulary, silently.

IKnowledgeRetrievalPort.GetService is a default interface method, so no existing
store changes: one that wraps nothing is already whatever it implements. A store
that wraps another overrides it and forwards what it cannot answer.

This is the shape Microsoft.Extensions.AI uses on IChatClient, IEmbeddingGenerator
and six more, each with a Delegating base that forwards it, so a consumer already
knows it from providers.embeddings.
A model year is a keyword, not a meaning. Asking a ranked search for the cards of
the LCR 2023 returns the 2026 ones first, because two adjacent years read as
near-identical to an embedding. A filtered scroll cannot make that mistake.

IKnowledgeFacetReadPort is a capability, not a widening of IKnowledgeRetrievalPort:
a store that cannot filter simply does not implement it, and a caller asks through
GetService. The value is matched exactly and never widened by scope.wildcard — a
caller asking for one model year wants that year, not that year plus every card
shared across all of them.

QdrantKnowledgeStore reached 407 lines with the new method, so the six members that
decide what a KnowledgeScope means against a payload moved to QdrantScopeMatcher.
They were one responsibility already, read two ways that have to agree: Qdrant
applies the filter to a search, and the same rules are applied in process to a card
fetched by a see_also link, which never passes that filter. The store is now 346.
A consumer resolves the one port and asks it for the capability it needs. Each
capability is deliberately not registered beside it: that would hand out a second
service for the same store, and a store serving none would have to be registered
as null anyway.
@MatthewHsu1
MatthewHsu1 merged commit 4216732 into main Sep 10, 2026
1 check passed
@MatthewHsu1
MatthewHsu1 deleted the feat/harness branch September 10, 2026 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant