my_bundle/okf4net.md
---type: Librarytitle: OKF4netdescription: Zero-dependency .NET implementation of OKF v0.1tags: [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.1

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.1 · 218/218 tests · 5 byte-exact golden comparisons
##

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 (§9): 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–§5 — 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 (§9).
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 §9 requires; Validate() matches the stricter producer-side check.

library.md — install, examples, design choices, and the full API surface

##

The okf CLI

§6–§9 — 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 (§9), non-zero exit on failure
okf info <bundle>Concepts, types, links, version
okf index <bundle>(Re)generate every index.md (§6)
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.1
$ okf graph ./bundles/ga4 --dot | dot -Tsvg > graph.svg

cli.md — building the binary, session transcripts, CI recipes

##

In Claude & your editor

MCP — the bundle as tools

Run okf-mcp, point it at a bundle, and its nine 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.

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 — including byte-exact golden comparisons — 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.