Skip to content

How okfctl reads a bundle's OKF version

Read this if you have a bundle written for an older version of the Open Knowledge Format. It’s also for a bundle that declares a version okfctl has never heard of. You’ll see how okfctl works out which version a bundle follows. The answer changes two things: how a path in a note’s header resolves, and what okfctl does with a version it doesn’t know. One rule from 0.3 holds no matter what a bundle declares. Sign-offs count only if they’re newer than the content. Bundles made by okfctl bundle init declare 0.3, and for those that rule’s section is the only one you need.

A bundle declares its version with an okf_version key in the header of the index.md in its top folder. Some older bundles put it in a one-line file named .okf in that same folder. okfctl reads index.md first and looks at .okf only when index.md doesn’t say.

The examples build two bundles from scratch. Run them in an empty directory. The first was written for version 0.2 and declares it the old way, in .okf:

$ mkdir -p old/wine
$ printf 'okf_version: 0.2\n' > old/.okf
$ printf -- '---\ntype: Concept\ntitle: Acidity\n---\n\n# Acidity\n' > old/wine/acidity.md
$ printf -- '---\ntype: Concept\ntitle: Tannin\nresource: wine/acidity.md\n---\n\n# Tannin\n' > old/wine/tannin.md
$ okfctl bundle info old
nodes: 2
reserved: 0
okf_version: 0.2 (declared in .okf)

The last line names the version and the file it came from. With no declaration anywhere you’d see undeclared, and okfctl reads that bundle as 0.2.

Paths in the header resolve from the note’s folder

Section titled “Paths in the header resolve from the note’s folder”

Tannin’s header has a resource line, and its value is a path: wine/acidity.md. It’s written from the top of the bundle, the way the 0.2 examples did it. Version 0.3 changed the rule. Now any path with no leading / starts from the folder of the note it’s in. Read that way, tannin’s value means wine/wine/acidity.md, and there’s no such file.

If a bundle declares 0.2 or older (or no version at all), the spec lets a tool fall back to the old reading. okfctl does. You can see it in the graph. While the bundle says 0.2, there’s an arrow from tannin to acidity:

$ okfctl graph export --format dot old
digraph okf {
rankdir=LR;
"wine/acidity.md" [label="Acidity"];
"wine/tannin.md" [label="Tannin", style=dashed];
"wine/tannin.md" -> "wine/acidity.md";
}

Declare 0.3 with the path still unfixed and the arrow is gone:

$ rm old/.okf
$ printf -- '---\nokf_version: "0.3"\n---\n' > old/index.md
$ okfctl bundle info old
nodes: 2
reserved: 1
okf_version: 0.3 (declared in index.md)
$ okfctl graph export --format dot old
digraph okf {
rankdir=LR;
"wine/acidity.md" [label="Acidity", style=dashed];
"wine/tannin.md" [label="Tannin", style=dashed];
}

Each node is dashed now. The export dashes a node when nothing points at it. okfctl lint would report the broken path here and suggest the fix. Put a / in front and the path starts from the bundle top whatever the version:

$ sed 's#^resource: wine/#resource: /wine/#' old/wine/tannin.md > old/tannin.tmp
$ mv old/tannin.tmp old/wine/tannin.md
$ okfctl graph export --format dot old
digraph okf {
rankdir=LR;
"wine/acidity.md" [label="Acidity"];
"wine/tannin.md" [label="Tannin", style=dashed];
"wine/tannin.md" -> "wine/acidity.md";
}

The arrow is back. Hand edits work for one file. On a bundle with hundreds of notes, okfctl migrate finds each such path, rewrites it, and declares 0.3. Until you run it, an old bundle reads the way it always did.

A sign-off counts only if it’s newer than the content

Section titled “A sign-off counts only if it’s newer than the content”

Each note can record two dates in its header. generated says when the content last changed and who changed it. verified says when someone checked it. okfctl compares them to get the note’s trust tier. Checked by a person, the note is human-reviewed. If a program did it, the note is machine-confirmed. No check since the last change means unverified.

Since version 0.3 a check counts only if it happened at or after the last content change. Here a person signed off on November 2. The content dates from November 1:

$ mkdir trust
$ printf -- '---\ntype: Concept\ntitle: Tannin\ngenerated: { by: "human:casey", at: "2026-11-01T09:00:00Z" }\nverified: { by: "human:casey", at: "2026-11-02T09:00:00Z" }\n---\n\n# Tannin\n' > trust/tannin.md
$ okfctl eval sample --sample 1 trust | grep trust_tier
"trust_tier": "human-reviewed",

eval sample prints a worksheet as JSON for people who grade notes by hand. The grep pulls out the tier. Now rewrite the content on November 20 and don’t sign off again:

$ sed 's/2026-11-01T09/2026-11-20T09/' trust/tannin.md > trust/tannin.tmp
$ mv trust/tannin.tmp trust/tannin.md
$ grep -E '^(generated|verified)' trust/tannin.md
generated: { by: "human:casey", at: "2026-11-20T09:00:00Z" }
verified: { by: "human:casey", at: "2026-11-02T09:00:00Z" }
$ okfctl eval sample --sample 1 trust | grep trust_tier
"trust_tier": "unverified",

The November 2 check is still in the file, but the content changed after it. No person has read the November 20 text, and the tier drops to unverified. okfctl applies this rule whatever version the bundle declares. It can lower the tier. It never raises it.

okfctl never refuses a bundle over its version. The spec asks a tool that doesn’t recognize a declared version to read the bundle as best it can:

$ printf -- '---\nokf_version: "7.0"\n---\n' > old/index.md
$ okfctl bundle info old
nodes: 2
reserved: 1
okf_version: 7.0 (declared in index.md)
$ okfctl validate old
OK: bundle conforms to the OKF spec floor

There’s no version 7.0. okfctl reads the bundle anyway and checks it as if it said 0.3.

For the list of what changed in 0.3, see the spec’s breaking changes for version 0.3.

Made by Casey West.