OKF4net 0.3.0
OKF4net now targets OKF specification v0.2. The core library and okf CLI
implement v0.2's provenance, trust, and lifecycle model, with the two
v0.2-sanctioned legacy fallbacks so v0.1 bundles keep loading unchanged.
OKF4net.Catalog gains fully-implemented session/tenant memory tiers and
three selectable knowledge-resolver ranking strategies.
Added
- Provenance / trust / lifecycle frontmatter (§5) — typed, order-preserving
accessors onFrontmatter, each projected lazily and never throwing on
malformed input (permissive loading, §3):sourceswith per-entry credibility signals (author,usage_count,
last_modified) and theusage_windowsibling (Source,UsageWindow).generated/verifiedstamps and the derived trust tier (Stamp,
TrustTier: unverified / machine-confirmed / human-reviewed).status(draft|stable|deprecated) andstale_after(Lifecycle,
ConceptStatus), with staleness computed against an injectableIOkfClock.- The §7 actor convention (
Actor:human:/process:/<producer>/<version>). StalePolicy(Use / Tolerate / Strict) for consumers.
OkfDocument.Sources()— v0.2 provenance with the §13.1 legacy fallback:
the frontmattersourcesfield, or the legacy# Citationsbody list when it
is absent.Frontmatter.LastChangedAtfalls backgenerated.at ?? timestamp.- v0.2 conformance fixture (
tests/fixtures/okf_v02) and its byte-exact golden. - Consumer-layer v0.2 wiring — the provenance/trust/lifecycle model is now
surfaced throughOKF4net.AgentsandOKF4net.Catalog:okf_write_conceptauto-stamps ageneratedblock (§5.2) —
{by: okf4net/<version>, at: <UTC>}— when the frontmatter has none (opt-in
per tool; the scoped-memory write path is deliberately never auto-stamped).okf_read_conceptprints astatus | trust | stalemeta line, and
okf_searchmarks hits[deprecated]/[stale], when those differ from
the defaults.OkfContextProvider,GroupedKnowledgeResolver, andKnowledgeQueryhonor
aStalePolicy(defaultUse— surface everything, never silently drop)
when admitting concepts, with staleness resolved against an injectable clock.KnowledgePassagecarries the matching concept'sTrustTierand full
Lifecycle, so a resolver or host can filter and render provenance without
reparsing frontmatter.
- Session and tenant memory tiers are now fully implemented and tested.
v0.2.0 shipped only the user tier working end-to-end (session/tenant were
contract/parse-only). The underlying mechanism (FileMemoryStore, manifest
parsing, DI wiring,OkfContextProviderOptions.CaptureTier) turned out to
already be generic across all three tiers, so this release is primarily the
test coverage, one path-nesting fix (see Fixed), and doc corrections that
make the existing generic mechanism trustworthy for session/tenant, not new
surface area. - Selectable resolver ranking strategies.
IKnowledgeResolversearches
can now be ranked three ways:GroupedBySource(each source's results
concatenated in priority order — the previous and still-default
behaviour),Merged(one cross-source ranking by descending score, with
source priority as a tie-break only), andPriorityWeighted(source
priority first, score only within a priority tier). Choose one per host
viaKnowledgeOptions.DefaultResolverStrategy, or per call via
KnowledgeQuery.ResolverStrategy.AddKnowledgenow registers
KnowledgeResolverRouteras theIKnowledgeResolver, so existing
consumers gain per-query selection without any code change, and result
ordering is unchanged until a host opts in. - Fairness interleaving for fused strategies. An optional
FairnessQuota(host-levelKnowledgeOptions.DefaultFairnessQuotaor
per-queryKnowledgeQuery.FairnessQuota) caps how many consecutive
passages one source may contribute before another source's next-best
passage is pulled ahead. It reorders only — no passage is ever dropped —
so it affects consumers that truncate early, such as an agent context
provider spending a token budget top-down. - Same-directory source dedup. The merged strategies collapse two
enabled manifest entries that resolve to the same directory, searching
that bundle once instead of twice. Two different directories that
happen to share a concept id are never merged: a concept id is relative
to its own bundle root and is not a globally stable identity. OkfContextProviderOptions.KnowledgeQueryFairnessQuota— attaches a
fairness quota to the knowledge query the context provider issues. The
provider is the archetypal early-truncating consumer (it renders
passages top-down until its token budget is spent), so this is what lets
a budget-bounded agent see several sources instead of one prolific
source's entire run.
Changed
OkfSpec.Versionis now"0.2"—okf validateand-Vreport OKF v0.2.
Conformance (§11) still requires only a non-emptytype, a parseable
frontmatter block, and well-formed reserved files; every new
provenance/trust/lifecycle/actor check is a Warning or Info, never an Error.BundleValidatoremits the v0.2 soft-guidance diagnostics and takes an
optionalIOkfClockfor deterministic staleness.- The producer-side
OkfDocument.Validate()now requirestype/title/
description(no longertimestamp). - Breaking:
DefaultKnowledgeResolveris renamedGroupedKnowledgeResolver
(behaviour identical). Code that resolvesIKnowledgeResolverfrom DI is
unaffected; only direct references to the concrete type name need
updating. - A non-positive
FairnessQuotais rejected with anArgumentException
by every strategy — includingGroupedBySource, which ignores the quota
otherwise — so the same malformed query fails the same way whichever
strategy runs it. A non-positive resolver constructor default throws
ArgumentOutOfRangeExceptionat construction.nullremains the way to
disable fairness reordering.
Fixed
- YAML flow-style plain scalars now keep bare colons inside values, so v0.2
frontmatter written in flow style (generated: { by: human:ada, at: … },
URLs, ISO timestamps) parses correctly. MemoryPath.For's session-tier path now nests under tenant and user
(memory-session/<tenant>/<user>/<session>, matching how the user tier
already nests under tenant), closing an isolation gap where two different
tenants sharing the same session id would have collided on
memory-session/<session>. Any deployment that had already enabled the
session tier (undocumented and untested before this release) will need to
re-capture session memory under the new path -- existing session-tier
content at the old path is orphaned, not migrated.
dotnet add package OKF4net --version 0.3.0Full changelog: https://github.com/jchable/okf4net/blob/main/CHANGELOG.md#030---2026-07-29