OKF4net 0.2.0
This release grows OKF4net from a core library + CLI into an agent- and
tooling-ready stack: three new integration packages, a new MCP tool, and
host-scopeable long-term memory — all built on the same zero-dependency core.
Added
- Scoped memory (V2) for
OkfContextProvider— host-scoped long-term memory
that can be enabled on a multi-user deployment without cross-scope leakage:KnowledgeAccessScope(tenant / user / session; every segment path-safe by
construction), supplied per invocation by a hostScopeAccessordelegate —
never derived from a message.role:"memory"catalog sources with aMemoryTier(session/user/
tenant), a scopedIMemoryStore/FileMemoryStore(user tier
implemented; session/tenant are contract/parse-only for now), and readable
path prefixes viaMemoryPath.For(memory-user/<tenant>/<user>/…), encoded
case-insensitive-safe so distinct scopes never collide on Windows/macOS.- The provider's V2 mode reads knowledge (resolver) ∪ scoped memory under a
split token budget (knowledge + memory floors with spillover) and
captures each exchange deterministically to one tier; it never throws toward
the invocation pipeline and injects only as message data. - RGPD/audit:
IMemoryStore.DeleteScopeAsync/EnumerateAsync. AddMemory(this IServiceCollection)DI facade wiring a store from the
catalog'srole:memorysources.
OKF4net.BundleConceptWriter— the atomic, reparse-guarded, per-path-locked
concept-write primitive, promoted to core soOkfBundleToolsand the memory
store share one write path.OKF4net.Agents— Microsoft Agent Framework integration (new package):OkfBundleToolsexposes nine OKF bundle operations asAIFunctiontools
(okf_read_concept,okf_browse,okf_graph,okf_search,
okf_write_concept,okf_append_log,okf_regenerate_indexes,
okf_validate_bundle,okf_changes_since) for use via
chatClient.AsAIAgent(tools: …). Writes are producer-grade validated,
serialized under a per-bundle-path lock, and guarded against directory
traversal, embedded NUL, and symlink/junction (reparse-point) escapes.OkfContextProvider(anAIContextProvider) auto-injects budget-bounded,
progressive-disclosure bundle context into each invocation as reference
data — never as instructions — and, opt-in, captures each exchange as
deterministic per-day long-term memory (no LLM call) written back through
the same validated, locked, reparse-guarded write path. Memory capture is
off by default:MemoryCaptureMode.Disabledunless explicitly set to
Enabled.
OKF4net.CatalogandOKF4net.Catalog.Hosting— a local knowledge
catalog (two new packages):- A hot-reloadable
catalog.jsonmanifest naming one or more local OKF
bundles as sources, parsed by a strict, never-throw manifest parser
(structuredCatalogDiagnostics, immutable results). FileKnowledgeCatalog: fail-fast on an invalid initial manifest,
errors-as-data on reload, atomic snapshot swap with a monotonic
Generation, and a best-effort debounced file watcher (ReloadAsyncis
the source of truth). Source paths are validated to stay within the
catalog root (OS-appropriate containment, reparse-point rejection).- A multi-source resolver that searches every enabled source and returns
results grouped by source — no cross-source fusion or dedup (V1), plus
anAddKnowledge(…)/AddCatalogFile(…)IServiceCollectionfacade.
OKF4net.Catalog.Hostingis the only project taking a
Microsoft.Extensions.*dependency; the catalog core stays zero-dependency.
- A hot-reloadable
OKF4net.Mcp— a local Model Context Protocol server, shipped as the
okf-mcpdotnet tool, exposing one OKF bundle to Claude Desktop / Claude
Code over stdio (dotnet tool install -g OKF4net.Mcp). Bundle root via
argument orOKF_BUNDLE_ROOT; read-only mode viaOKF_MCP_READONLYdrops
the three write tools. stdout is reserved for JSON-RPC; all logs go to stderr.OKF4net.ConceptSearch— the shared full-text scorer (title ×3,
tags/description ×2, body ×1) and excerpt helper, promoted into the core
library soOKF4net.Agents(okf_search/ context provider) and
OKF4net.Catalogrank results identically by construction.
Changed
- Breaking:
MemoryCaptureMode.SharedBundleis renamed to
MemoryCaptureMode.Enabled(reads correctly in both single-bundle and scoped
modes). role:"memory"catalog sources are excluded fromIKnowledgeResolversearch
(they feedIMemoryStore, never shared knowledge).OkfContextProviderOptions.MemoryDirectoryis deprecated in favour of scoped
role:memorycatalog sources.- The package version is now sourced solely from
Directory.Build.props(one
source of truth across every project). - Public read-only surfaces hardened against downcast-and-mutate:
YamlMapping.Entries,ConceptId.Segments,KnowledgeCatalogSnapshot.Sources,
and all catalog diagnostic lists are now genuine read-only views. - The project website was rebuilt as a Vite + React static site with expanded
developer documentation (getting-started, library, CLI, MCP, and spec pages).
Fixed
IndexGeneratorno longer walks into or lists a symlinked/junctioned
subdirectory as if it were real: reparse-point detection now uses an
lstat-correctFileSystemInfo.LinkTargetfallback on Unix (where
File.GetAttributesresolves through a link), matching the Rust
reference'sfile_type()semantics.Bundle.OkfVersionis computed eagerly atBundle.Loadso it reflects a
true snapshot of the bundle at load time (previously deferred, which could
observe later mutation).
Install
# Libraries (net10.0)
dotnet add package OKF4net --version 0.2.0
dotnet add package OKF4net.Agents --version 0.2.0
dotnet add package OKF4net.Catalog --version 0.2.0
dotnet add package OKF4net.Catalog.Hosting --version 0.2.0
# MCP server (global dotnet tool)
dotnet tool install -g OKF4net.Mcp --version 0.2.0
# okf CLI (Windows, winget)
winget install Coderise.OKF4netNative-AOT okf binaries for win-x64 / win-arm64 are attached below with checksums.txt.
Full changelog: https://github.com/jchable/okf4net/blob/v0.2.0/CHANGELOG.md