GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - cwest/okfctl: A CLI for authoring, validating, linting and searching Open Knowledge Format (OKF) bundles.

BranchesTags
Open more actions menu

Latest commit

 

History

217 Commits
217 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
cmd
cmd
 
 
docs
docs
 
 
internal
internal
 
 
scripts
scripts
 
 
site
site
 
 
skills
skills
 
 
testdata
testdata
 
 
.gitignore
.gitignore
 
 
.golangci.yml
.golangci.yml
 
 
.goreleaser.yaml
.goreleaser.yaml
 
 
.pre-commit-config.yaml
.pre-commit-config.yaml
 
 
AGENTS.md
AGENTS.md
 
 
AUTHORS
AUTHORS
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
SECURITY.md
SECURITY.md
 
 
go.mod
go.mod
 
 
go.sum
go.sum
 
 
main.go
main.go
 
 
plugin.json
plugin.json
 
 

Repository files navigation

okfctl

CI Latest release Go Reference License

okfctl is a command-line tool for people who keep a knowledge base in Markdown and want it to stay correct as it grows. It writes and checks Open Knowledge Format (OKF) bundles: folders of Markdown files ("nodes") that link to each other and record where their facts came from in YAML frontmatter. Rename a node and okfctl rewrites every link that pointed at it. Put okfctl lint --strict in CI and a node that names another without linking to it fails the build, as the run below shows.

Website: okfctl.dev  •  Docs: docs/  •  Contributing: CONTRIBUTING.md  •  Security: SECURITY.md  •  Conduct: CODE_OF_CONDUCT.md

See it catch something

Make a bundle with two nodes. Have one of them mention the other without linking to it:

$ okfctl bundle init mykb
Initialized OKF bundle in mykb
$ okfctl node new concepts/tannin.md --type Reference --title "Tannin" --bundle mykb
Created mykb/concepts/tannin.md
$ okfctl node new concepts/oak.md --type Reference --title "Oak" --bundle mykb
Created mykb/concepts/oak.md
$ echo 'Oak barrels add tannin to red wine.' >> mykb/concepts/oak.md
$ okfctl validate mykb
OK: bundle conforms to the OKF spec floor
$ okfctl lint mykb
missing-xref: concepts/oak.md mentions "Tannin" but does not link to concepts/tannin.md
1 lint finding(s)
$ okfctl lint --strict mykb
missing-xref: concepts/oak.md mentions "Tannin" but does not link to concepts/tannin.md
1 lint finding(s)
okfctl: 1 lint finding(s)

validate passes. The bundle meets the spec's floor: all the frontmatter parses, and the reserved index.md and log.md files are well formed (OKF §11.1). lint reads past the floor and finds the oak node talking about tannin with no link. By default it exits 0. With --strict it exits 1, and that is the line you put in CI.

Notice you never ran an index command. node new rebuilt both index.md files and logged each node in log.md as it went, which is why okfctl index check mykb prints OK: index.md is current.

okfctl quickstart: bundle init through validate and bundle info

okfctl is written in pure Go and runs offline. Only connect reaches the network, when it calls git to clone a remote bundle. Try okfctl search "tannin" mykb to find nodes by text and okfctl graph export mykb to dump the link graph as JSON. okfctl analyze mykb shows where the bundle is thin. Each subcommand's --help includes an example you can paste.

Install

Pick one of these three. Each one gets you okfctl and the okfctl-search plugin.

With Homebrew on macOS or Linux:

brew install cwest/tap/okfctl

Or use the install script on macOS or Linux. It grabs the release archive for your OS and CPU and checks it against the release's checksums.txt. If they don't match, it installs nothing:

curl -sSL https://okfctl.dev/install.sh | sh

Or, with Go 1.26 or later, build from source:

go install github.com/cwest/okfctl@latest
go install github.com/cwest/okfctl/cmd/okfctl-search@latest

Run okfctl version to check that it worked. The install guide shows what each method prints. It also has the prebuilt archives, the Debian and RPM packages, how to check a release's signature, and how to build from a checkout.

The spec decides what's valid

The Open Knowledge Format spec decides what a valid bundle is, and okfctl follows it. In the mykb bundle from above, add a node with a made-up type and a frontmatter key okfctl has never seen. Then try to create a node with no type at all:

$ printf '%s\n' '---' 'type: Recipe' 'title: Mulled wine' 'x-acme-owner: casey' '---' '' 'Warm red wine with spices.' > mykb/mulled-wine.md
$ okfctl validate mykb
OK: bundle conforms to the OKF spec floor
$ okfctl node new concepts/cork.md --title "Cork" --bundle mykb
okfctl: --type is required: every node needs a non-empty type (OKF spec, "Frontmatter")

validate passed the recipe because the spec tells a tool to accept types and keys it doesn't know (OKF §11.2). node new refused the cork node with exit code 1 since the spec also says each concept has a non-empty type (§4.1).

validate holds each bundle to that floor and no higher. If your team wants a stricter rule, like a servings field on each Recipe, put it in a type template. Templates run only when you call okfctl validate --templates.

Commands

Run okfctl <cmd> --help for the flags. The command reference has the same text in one place.

To build and edit a bundle:

Command What it does
bundle Create a bundle (init) and summarize one (info).
node Work with one node at a time: new, show, list, edit, mv, rm, refresh, and promote.
index Rebuild (build) and check (check) the reserved index.md.
log Add to (append) and print (show) the reserved log.md history.

To check a bundle:

Command What it does
validate Check the bundle against the OKF spec floor, and against your type templates with --templates.
lint Report curation findings such as orphans, broken links, and missing links. --strict makes findings fail CI.
eval Check that each node has a grade and citations (transparency), and draft a spot-check set for accuracy, alignment, and calibration, which a person has to judge (sample).

To explore what you've made:

Command What it does
analyze Report where the bundle is weak: freshness, clusters, gaps, connectivity, structure.
search Find nodes by text, or by how close they sit in the link graph.
graph Export the link graph as JSON or as Graphviz dot; pick one with --format.
serve Browse the bundle as an interactive graph in your browser.

Everything else:

Command What it does
template Print the type templates a bundle declares (list) and one template in full (show).
migrate Move a v0.1 or v0.2 bundle to OKF v0.3: write a plan file of the edits, then apply it.
registry Keep a list of named remote bundles, the way git remote keeps remotes.
connect Clone a remote bundle into a local directory, or fast-forward one you already have.
plugin Find (list) and install (install) okfctl-<name> plugins on your PATH.
config Get, set, and list okfctl settings.
completion Print a shell completion script for bash, zsh, or fish.
version Print the version (okfctl --version does the same).

Semantic search comes in the okfctl-search plugin, installed with okfctl. Out of the box it matches words. To search by meaning, download a Model2Vec model like minishlab/potion-base-8M and tell okfctl where it is. The plugin loads the model itself. okfctl won't download one for you. Run okfctl-search index build first to embed your nodes, then okfctl-search --semantic "query". Skip the build and --semantic exits 1 with a note to run it. The search guide walks you through each step.

Use as an agent plugin

This repo is also an Agent Plugins 1.0.0 package. Any agent client that reads the format can install its four okfctl skills (okf-authoring, okf-curation-health, okf-migrate-plan, and okf-semantic-search) in one step from the root plugin.json. Clients that read repo instructions pick up the same advice from AGENTS.md.

Don't mix this up with okfctl plugin. It looks for executables named okfctl-<name> on your PATH, like okfctl-search. This section is about giving okfctl's skills to an AI agent under a different spec.

The skills call the okfctl binary. The plugin client won't install it for you. Install okfctl first:

brew install cwest/tap/okfctl

The manifest has no version field. The release tag is the version, and okfctl version reports it.

The agent skills guide lists the four, with an example of an agent using one to check a bundle.

Learn more

Start with the concepts page. The docs index then lists a guide for each job, from authoring a bundle to pulling in remote ones. If CI flags drift after a bulk reformat, the freshness guide shows how .okf-drift-ignore-revs tells okfctl to skip that commit.

okfctl <cmd> --help always matches the binary you've got.

okfctl targets OKF v0.3. The v0.3 specification lives upstream. This record lists how each v0.3 change landed here.

To work on okfctl itself, read docs/PRD.md, the architecture decision records, and the dated plans and specs behind each release.

License

Apache-2.0. See LICENSE.

About

A CLI for authoring, validating, linting and searching Open Knowledge Format (OKF) bundles.

okfctl.dev

Topics

cligolangknowledge-graphknowledge-managementokf

Resources

Readme
Apache-2.0 license

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy
Activity

Stars

8 stars

Watchers

0 watching

Forks

3 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.