Frontmatter5 fields
type- Feature Documentation
title- Go API
description- Embed the read-only Open Knowledge parser, validation, retrieval, and graph core.
tagstimestamp
Go API
Import the supported read-only facade used by the CLI:
import "github.com/openknowledge-sh/openknowledge/packages/cli/okf"
Example
report, err := okf.ValidateWithVersion("./Wiki", "0.1")
if err != nil {
return err
}
if err := okf.RequireValidBundle(report); err != nil {
return err
}
packet, err := okf.ResolveContextWithVersion(
"./Wiki",
"0.1",
okf.ContextOptions{Query: "release workflow", Budget: 1200, Limit: 8},
)
Surface
The package exposes these functions and models:
- AST and normalized bundle parsing
- validation policies, known rules, and the valid-bundle gate
- inventory and bundle metadata
- deterministic search, bounded context, and caller-supplied RRF federation
- source and retrieval graphs
- strict frontmatter and portable-manifest decoding
- supported spec discovery and the embedded spec
- bounded registry inventory, key or path resolution, and authoring capability
Returned types alias the core models. Therefore, Go results, CLI JSON, MCP structured content, and published schemas use the same field definitions. Retrieval results include corpus revisions and content-addressed locators. Use these values to detect stale evidence.
Functions without a version use LatestSpecVersion. For persistent integrations, prefer WithVersion functions. Store SpecVersion, SchemaVersion, the retrieval revision, and the selected locators. See Machine-readable contracts for more information.
The API is read-only. It does not connect sources, refresh sources, or change the registry. It does not extract archives, render HTML, or manage processes. Registry reads do not migrate or rewrite local storage.