my_bundle/okf4net.md
---type: Librarytitle: OKF4netdescription: Zero-dependency .NET implementation of OKF v0.2tags: [dotnet, knowledge, markdown]--- # OKF4net Knowledge is a directory of markdown files.This is its .NET toolchain — parse, validate, indexand graph [bundles](./what-okf-is.md) of concepts, on nothingbut the .NET base class library. If you can `cat` a file, you can read OKF.
typeLibrary
titleOKF4net
descriptionZero-dependency .NET implementation of OKF v0.2

Knowledge is a directory of markdown files.

OKF4net is its .NET toolchain — a zero-dependency C# library and a Native AOT okf CLI to parse, validate, index and graph bundles of concepts.

conformant with OKF v0.2 · 839/839 tests
##

What OKF is

§2–§3 — terminology, bundle structure
If you can cat a file, you can read OKF; if you can git clone a repo, you can ship it.

The Open Knowledge Format represents knowledge as a directory of UTF-8 markdown files with YAML frontmatter. No database, no binary format, no runtime — files that humans, git, and agents already understand.

bundle

A directory tree of markdown files — the unit of distribution.

concept

One document: YAML frontmatter delimited by ---, then a markdown body.

concept id

The file's path with .md removed: tables/users.mdtables/users.

cross-links

Ordinary markdown links between concepts — absolute or relative; backlinks derived.

The only hard conformance requirement (§11): a non-empty type on every concept. Everything else — unknown types, unknown keys, broken links — must be tolerated by consumers.

what-okf-is.md — reserved files, conformance, and the section-by-section spec mapping

##

The Library

§4, §6 — documents, cross-linking

Load a bundle, check conformance, walk the cross-link graph. Bundle.Load never aborts on a bad file — parse failures land in ParseErrors, broken links stay in the graph as edges to missing concepts.

using OKF4net;

var bundle = Bundle.Load("./my_bundle");
Console.WriteLine($"{bundle.Count} concepts");

// Conformance check (§11).
var report = BundleValidator.Validate(bundle);

// Traverse the cross-link graph.
var id = ConceptId.Parse("tables/orders");
foreach (var b in bundle.Backlinks(id))
    Console.WriteLine($"cited by {b}");

Frontmatter keeps the full ordered mapping with typed getters on top — producer-defined keys survive round-trips byte for byte. Two validation levels: ValidateConformance() enforces only what §11 requires; Validate() matches the stricter producer-side check.

library.md — install, examples, design choices · docs/library.md — every member, signature by signature

##

The CLI

§8–§11 — indexes, logs, conformance

Published as a self-contained Native AOT single-file binary — no .NET runtime on the target machine. okf validate exits non-zero on a non-conformant bundle, so it drops straight into CI.

CommandDoes
okf validate <bundle>Conformance check (§11), non-zero exit on failure
okf info <bundle>Concepts, types, links, version
okf index <bundle>(Re)generate every index.md (§8)
okf graph <bundle>Cross-link graph, --dot for Graphviz
okf parse <file>One document's structure
okf fmt <file>Normalize by parse + re-serialize (-w writes)
$ okf validate ./bundles/ga4

42 concept(s); 0 error(s), 0 warning(s), 0 info.
✓ conformant with OKF v0.2
$ okf graph ./bundles/ga4 --dot | dot -Tsvg > graph.svg

cli.md — building the binary, session transcripts, CI recipes · docs/cli.md — every flag and exit code

##

The Agent tools

Microsoft Agent Framework — ten tools + bounded context

OKF4net.Agents turns a bundle into ten AIFunction tools (read, search, write, validate, log, §10 attested computation, …) — an eleventh, okf_run_computation, when an attestation orchestrator is wired in — plus OkfContextProvider, which injects budget-bounded reference data automatically — never as instructions — and, opt-in, captures exchanges as deterministic memory, single-bundle or scoped across tenants, users, and sessions.

docs/agents.md — the tools, the context provider, and scoped memory capture

##

Local catalog

catalog.json — search many bundles, host multi-tenant memory

OKF4net.Catalog names one or more local bundles as sources in a hot-reloadable catalog.json manifest and searches every enabled one, ranked by a selectable resolver strategy — grouped by source, merged by score, or priority-weighted, with an optional fairness quota — and with trust and staleness carried on every result. Per-caller source visibility restricts which sources a given caller may search, by a host-precomputed set or a per-source policy function. A role: "memory" source, backed by FileMemoryStore, gives an agent deployment host-scoped, layered memory — session, user, and tenant — without cross-scope leakage.

docs/catalog.md — the manifest, the resolver, and scoped memory

##

MCP — In Claude & your editor

MCP — the bundle as tools

Run okf-mcp, point it at a bundle, and its ten operations become tools inside Claude Desktop, Claude Code, and Cursor — read, search, and write concepts from a conversation, over the Model Context Protocol. Same engine as the library and the CLI, exposed to any MCP client.

On Claude Code, skip the manual config: the OKF plugin installs okf-mcp, an okf skill, and guided /okf-init / /okf-validate slash commands in one step — /plugin marketplace add jchable/okf4net-claude-plugin, then /plugin install okf@okf4net.

docs/mcp.md — install okf-mcp and connect each client, step by step

##

Contributing

PR — the suite is the contract

One prerequisite: the .NET SDK. Zero third-party runtime dependencies is a design rule — contributions keep it that way. Behavioural changes cite their spec section (§) in the PR; the test suite is the contract.

contributing.md — setup, golden fixtures, code style, and how to submit

Ship knowledge as files.

Star the repo, open an issue, or pick a good first one. The spec is short, the codebase is dependency-free, and the test suite tells you immediately whether you're right.