okf
okf manages knowledge bundles in Open Knowledge Format (OKF) v0.2. You run commands through vulcan okf <command>. Run it at the project root: it reads .configs/vulcan.config.mts of the current folder, and without that file okf stops with the error okf: no project config.
| Command | What it does | Exit codes |
|---|---|---|
vulcan okf check | Validate the bundle against OKF v0.2 conformance rules | 0 (pass), 1 (conformance error) |
vulcan okf check --strict | Check OKF v0.2 conformance and project house rules | 0 (pass), 1 (rule violation) |
vulcan okf gen | Regenerate source-derived pages, regions, and contents lists | 0 (success), 1 (generation failure) |
vulcan okf coverage [--min <n>] | Report source coverage and evaluate coverage threshold gates | 0 (pass), 1 (gate failure, project error, bad frontmatter), 2 (invalid --min) |
Running an invalid command or omitting the command prints usage and exits with code 2.
To run the basic conformance check:
$ bun node_modules/.bin/vulcan okf check
check: OK - OKF v0.2 - 2 files, 1 conceptsTo run conformance checks with house rules:
$ bun node_modules/.bin/vulcan okf check --strict
check: OK - OKF v0.2 + house rules - 2 files, 1 conceptsThe bundle
The knowledge bundle lives in the directory configured by knowledge.bundle in .configs/vulcan.config.mts. By default, the bundle lives at .agents/knowledge.
index.md
The root index.md file defines the entry point of the bundle. It may carry frontmatter containing only okf_version (a root index with no frontmatter passes):
---
okf_version: "0.2"
---
# demo-app knowledge
Facts about demo-app, in the Open Knowledge Format. Rules live in `../rules.md`.The scaffold comment line is not shown in the index sample. Nested index.md files in subdirectories must not carry frontmatter.
Concept files
Every other markdown file in the bundle represents a concept. A concept file requires a top-level type property in its YAML frontmatter. It can also include title and description:
---
type: Concept
title: A
description: about a
---
A.Reserved files index.md and log.md do not count as concepts.
check
Run vulcan okf check to validate the knowledge bundle against OKF v0.2 conformance rules. Guidance warnings print to standard error.
The check validates concepts, root and nested index files, log headings, and trust metadata:
| Rule | Failure message |
|---|---|
§11.1 | no YAML frontmatter block |
§11.1 | unparseable frontmatter - <reason> |
§11.2 | missing or empty top-level type |
§8 | a nested index.md carries no frontmatter |
§8 | unparseable frontmatter - <reason> |
§8 | the root index may carry only okf_version - remove: <keys> |
§9 | date heading is not YYYY-MM-DD: "## <heading>" |
§9 | entries must be newest first: <date> follows <previous> |
§5 (warning) | <field> must be an ISO 8601 datetime with an offset, e.g. 2026-06-30T14:00:00Z (got <value>) |
§5.1 (warning) | sources[<index>] needs a resource |
§5.4 (warning) | status must be draft, stable or deprecated (got <status>) |
§7 (warning) | <field> must be <producer>/<version>, human:<id> or process:<id> (got <value>) |
§12 (warning) | declares okf_version <version>; the latest is 0.2 (read best-effort) |
When check finds problems or warnings, messages print to standard error:
check: N problem(s):
- <path>: <rule> <message>check: N warning(s):
- <path>: <rule> <message>check --strict
To enforce house rules on top of OKF conformance, pass --strict. House style rules run over every markdown file in the bundle, index and log included.
check --strict enforces eight groups of house rules:
Broken links: Every markdown link target in concept prose must resolve to an existing concept in the bundle:
<file>: broken link -> <target>.md
When concepts fail to load, link checking is skipped and prints to standard error:
textcheck: links skipped - <reason>Style rules: Prose outside code spans must use hyphens and proper brand casing:
<file>: use a hyphen, not an em-dash or en-dash (found "<match>")<file>: the brand is always written <brand> (found "<match>")
The brand rule fires only when the brand is all capitals of 2+ letters (for example VULCAN). It rejects the title-case spelling. The brand comes from
knowledge.okf.brand(default: root package name unscoped and upper-cased).Structural coverage: Every directory matched by a coverage axis must have a concept or resource mapping:
coverage: <section>/<name> has no concept (<section>/<name>.md)coverage: axis '<name>' (<path>) matches no directorycoverage: axis '<name>' (<path>) has no directory left after exclude/denylist
Managed regions: Content between generated region markers must match renderer output:
freshness: region '<id>' host file missing (<file>)freshness: <error>
When a managed region is out of date:
textfreshness: region '<id>' is stale - run `vulcan okf gen`Generated reference pages: Whole generated pages must match current renderer output:
textfreshness: <path> is stale - run `vulcan okf gen`Contents lists: Long agent-read files must have fresh contents lists:
textcontents: <file> has no fresh contents list - run `vulcan okf gen`The check covers every bundle
.mdfile exceptlog.md, generated files, and renderer-owned pages. It also checks entries inknowledge.okf.contents.files. The check fails only for files over 100 lines that need a contents list.Changelog declarations: Dated changelog entries (
YYYY-MM-DD-*.md) underknowledge.changelogsmust satisfy package rules:changelog: <path>: the frontmatter is not valid YAML (<error>)changelog: <path> names '<name>', not a declared package's npm namechangelog: <path>: release '<release>' is not '<declared npm name>@<version>'changelog: <path>: release '<release>' names no tag (<expected>)
When a changelog entry declares no packages:
textchangelog: <path> declares no packages - add `packages: [<npm name>, ...]` to its frontmatter (`packages: []` for an entry about no package)The check runs only when
knowledge.changelogsis set. Arelease:override lists the tags withgit tag --list, sogitmust be on thePATHand the tags must be in the clone.Code in the wiki: The fenced
ts,tsx,js,jsx,mtsandmjsblocks of every page underknowledge.wiki, changelogs excluded, follow the code rules, because a reader copies them:docs-code: <file>:<line>: an explicit cast (<as ...>) - parse or narrow the value instead (V-C-10)docs-code: <file>:<line>: any or AnyType as a type - type it, or take unknown and narrow itdocs-code: <file>:<line>: a conditional spread - build the object, then assign the optional keydocs-code: <file>:<line>: a string-literal union - a const class and its value type (V-C-08)
as const,import { A as B },export { A as B }andimport * as nsare not casts. Strings, template literals and comments are taken out before the rules run, so anasin a SQL template, a JSDoc comment or prose is not read, and neither is anything outside a fence. The check scans the code rather than parsing it, because an example is often a fragment; code inside a${}of a template is still code.Two kinds of content are left out: a page that carries the note a generator writes (a blockquote that starts
Generatedand endsdo not edit., asvulcan atlas api genwrites), and everything between<!-- okf:generated:<id> start -->andendmarkers. For a signature a page quotes from the source, wrap it in<!-- docs-code: off -->and<!-- docs-code: on -->. The marker is for a quoted source signature, never an example: the check prints every page that uses it with a count (check: docs-code off - 3 region(s) in 2 page(s): <page> (2), ...), and warns about an off region that holds a function body, a call or a statement (docs-code: <file>:<line>: a docs-code off region holds a function body - off is for a quoted source signature, never an example).The same run prints warnings, which never fail it, about the shape of the tables of the wiki:
docs-table: <file>:<line>: a cell of <n> characters (over 120) - a heading and a short table, or a listdocs-table: <file>:<line>: a continuation row with an empty first cell - one row for one item
gen
Run vulcan okf gen to regenerate source-derived content across the knowledge bundle. Whole files and managed regions render in memory first. Contents lists are written last. If a renderer fails, gen stops before writing any files.
$ bun node_modules/.bin/vulcan okf gen
gen: wrote .agents/knowledge/reference/makefile-targets.mdgen performs three tasks:
- Whole files: Writes pages registered in
knowledge.okf.renderers(by default underreference/). - Managed regions: Replaces content between
<!-- okf:generated:<id> start -->and<!-- okf:generated:<id> end -->registered inknowledge.okf.regions. - Contents lists: Inserts contents lists into files over 100 lines that need one (
knowledge.okf.contents.files).
As files are written or skipped, gen reports its actions:
gen: wrote region '<id>' (<file>)
gen: wrote the contents list of <file>
gen: skipped region '<id>' - <file> does not exist yetWith a renderer configured but already current, gen prints:
gen: up to dateWhen knowledge.okf.renderers and knowledge.okf.regions are empty and no contents list was written, gen prints:
gen: nothing configured - knowledge.okf.renderers and knowledge.okf.regions are empty; add a renderer to knowledge.okf.renderers in the vulcan config (built in: source-map, makefile-targets, binding-keys, packages-table)Contents lists default to AGENTS.md and .agents/rules.md. To configure built-in or custom renderers, see okf renderers.
coverage
Run vulcan okf coverage to report bundle documentation coverage against project source code.
$ bun node_modules/.bin/vulcan okf coverage
COVERAGE - 2 curated concepts
STRUCTURAL (target 100% - one curated concept each)
REFERENCE (advisory - generated)
make targets 14 generated
KNOWLEDGE TYPES (Diátaxis / arc42)
Reference:1 Concept:1
how-to (Playbook) 0 (target >= 1) <- gap
tutorial 0 (target 1) <- gap
glossary 0 (target 1) <- gap
structural: 0/0 100%The report provides four sections:
- Structural coverage: Evaluates curated concept coverage against source directory axes.
- Reference coverage: Advisory table of facts and generation status reported by configured renderers.
- Knowledge types: Distribution of concepts across Diataxis types, flagging gaps below targets.
- Structural summary: Overall percentage of covered structural directories.
Threshold gates
To fail CI when structural coverage drops below a target percentage, pass --min <n>. When structural coverage falls below <n>, the command exits with code 1:
coverage gate FAILED: structural 80% < 90%Code 1 also indicates a coverage axis matching no directory (a project error), or bad bundle frontmatter. When <n> is missing or not a finite number, the command exits with code 2:
coverage: --min needs a number, got (nothing)For an invalid value, the message shows got "<value>".
Coverage axes
You define structural coverage axes under knowledge.okf.coverage in .configs/vulcan.config.mts. Each axis globs directories under the repository root:
| Option | Type | Default | Meaning |
|---|---|---|---|
name | string | none | Section name and concept directory prefix |
path | string | none | Directory glob pattern relative to repository root |
exclude | string[] | [] | Globs from repository root excluded from this axis |
denylist | string[] | [] | Directory names excluded from this axis |
The global knowledge.okf.denylist lists directory names excluded across every axis. An axis item is covered when a concept exists at /<name>/<directory>.md. An item is also covered when a concept declares a matching resource: value. The covering resource: value is the directory path from the repository root. To configure renderer coverage rows, see okf renderers.
make targets
The shared Makefile at packages/cli/base/make/vulcan.mk defines four okf-* targets:
| Target | Description |
|---|---|
make okf-check | Check the knowledge bundle against OKF v0.2 |
make okf-check-strict | okf-check plus the house rules: links, style, coverage, freshness |
make okf-gen | Regenerate the generated pages and regions of the knowledge bundle |
make okf-coverage | Report how much of the code the knowledge bundle covers |