Skip to content

Using okfctl from an AI agent

Install okfctl’s plugin in an agent client and the agent learns to run okfctl the way these docs do. It renames a node with node mv and the links follow. It reads lint --json in place of scraping text. If migrate returns a judgment item, it stops there and doesn’t make up a source. The plugin holds four skills. Each skill is one Markdown file telling an agent what command to run, what output to look for, and which mistakes to avoid. This page lists the four, shows how a client installs them, and runs one of them on a bundle.

None of this comes from the OKF v0.3 spec. The spec says how a bundle is laid out and how to read one. It says nothing about packaging instructions for an agent. Where it mentions a Skill at all, as one thing that can sit behind a computation’s resource, it calls the choice “a packaging decision” and leaves it open. It does name SKILL.md among the files a bundle can hold. Readers skip any Markdown file with no type. These four skills and their packaging are okfctl’s own. Each follows the Agent Skills format, and the four are packaged as one Agent Plugins 1.0.0 plugin.

Each skill is a folder under skills/ in the okfctl repository, holding one SKILL.md:

Skill Use it when Commands it covers
okf-authoring you’re starting a bundle or adding, renaming, or removing nodes bundle init, the node commands, template list, index build, index check, log append
okf-curation-health you need to know whether a bundle is ready to merge validate (with --templates), lint (with --strict and --json), index check
okf-migrate-plan a bundle is on OKF v0.1 or v0.2 and you want v0.3 migrate with --plan, --generated-by, --resolve, --dry-run, and --apply
okf-semantic-search you want the nodes that say the same thing and don’t link each other okfctl-search index build, okfctl-search --semantic, okfctl-search related, lint --semantic

Each SKILL.md opens with a worked run on a bundle of two or three nodes. After that come a When to Use section, the commands one by one, Common Pitfalls, and a Verification Checklist the agent ticks off last. The skills send work to each other, too. okf-authoring points broken links at okf-curation-health, and the two of them point similarity at okf-semantic-search.

At startup an agent reads only each skill’s name and description. The Agent Skills format has clients read the rest of the file after a task matches. Tell yours to rename tannin.md to tannins.md and okf-authoring is the skill whose description matches.

CI runs the skills’ commands. The doc test behind this page’s examples also replays the command blocks in skills/, using okfctl compiled from that commit. Another job installs the latest release, checks each subcommand the skills name with --help, and runs the main job of each skill end to end. Rename a command or flag and forget the skills, and CI fails on the stale line.

The repository root is the plugin. Its plugin.json, trimmed here to the keys this section uses, names the package, the Agent Plugins version it targets, and the four skills:

{
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
"name": "okfctl",
"extensions": {
"dev.okfctl": {
"skills": [
"okf-authoring",
"okf-curation-health",
"okf-migrate-plan",
"okf-semantic-search"
],
"requires": {
"cli": "okfctl",
"install": "brew install cwest/tap/okfctl"
}
}
}
}

An Agent Plugins client loads plugin.json, then finds the skills on its own: each folder one level under skills/ with a SKILL.md in it counts as one. The skills list under dev.okfctl exists for okfctl’s own tests, and they fail if it ever names a different set of folders. Each client decides how you hand it a repository, and the Agent Plugins spec leaves installing to them. The project publishes a list of compatible clients with instructions for each. Point yours at https://github.com/cwest/okfctl.

Install okfctl first. The skills shell out to okfctl, and okf-semantic-search to okfctl-search as well. No plugin client installs either one:

Terminal window
brew install cwest/tap/okfctl

The install guide has the other methods, and each one puts okfctl-search next to okfctl. The manifest’s requires block holds that same Homebrew line for people to read. Agent Plugins tells a client to ignore any extensions entry it doesn’t implement, and dev.okfctl belongs to okfctl, not to any client.

plugin.json has no version field. The release tag is okfctl’s version, and okfctl version prints it.

Don’t confuse this with okfctl plugin, the command that finds programs named okfctl-<name> on your PATH and runs them as okfctl subcommands (see the plugins guide). An Agent Plugin is a package of skills for an AI agent. The two have nothing in common but the word.

Example: an agent checks a bundle before a merge

Section titled “Example: an agent checks a bundle before a merge”

Say you want mykb checked ahead of a merge and tell your agent so. okf-curation-health describes this job, and the commands below are the ones it has the agent run. Start with the bundle, where one node names another in its text and never links to it:

$ okfctl bundle init mykb
Initialized OKF bundle in mykb
$ okfctl node new wine/tannin.md --type Concept --title Tannin --bundle mykb
Created mykb/wine/tannin.md
$ okfctl node new wine/oak.md --type Concept --title Oak --bundle mykb
Created mykb/wine/oak.md
$ echo 'Oak barrels add tannin to red wine.' >> mykb/wine/oak.md

The skill starts with the spec floor, then the curation findings:

$ okfctl validate mykb
OK: bundle conforms to the OKF spec floor
$ okfctl lint --json mykb
[
{
"check": "missing-xref",
"path": "wine/oak.md",
"message": "missing-xref: wine/oak.md mentions \"Tannin\" but does not link to wine/tannin.md"
}
]

validate passed, meaning the bundle is valid OKF. lint found a problem and still exited 0, because plain lint only advises. The skill warns about this case, and the agent goes by the findings and not the exit code. It reads --json output because there each finding carries its own check and path. For missing-xref the skill’s table of findings says to link the mention.

The agent edits oak.md and runs the skill’s checklist:

$ tail -1 mykb/wine/oak.md
Oak barrels add [tannin](tannin.md) to red wine.
$ okfctl validate mykb
OK: bundle conforms to the OKF spec floor
$ okfctl lint --strict mykb
OK: no lint findings
$ okfctl index check mykb
OK: index.md is current

All three exit 0. Had a finding been left, the --strict run would have exited

  1. The skill tells the agent to put that line in CI. This bundle has no type templates, and the agent skipped validate --templates. On a bundle with templates the checklist adds that run.

Keep your own agent instructions in a bundle

Section titled “Keep your own agent instructions in a bundle”

OKF skips a Markdown file with no type. A bundle can therefore carry skills of its own. Write down how agents should work on this bundle and save it at mykb/skills/house-rules/SKILL.md:

---
name: house-rules
description: Use when adding a wine node to this bundle.
---
# House rules
Every wine node links the grape it comes from.
$ okfctl validate mykb
warning skills/house-rules/SKILL.md: not a concept (frontmatter has no non-empty type); skipped, does not affect conformance (OKF spec, "Concepts, assets, and other files")
OK: bundle conforms to the OKF spec floor
$ okfctl bundle info mykb
nodes: 2
reserved: 3
okf_version: 0.3 (declared in index.md)
$ okfctl index check mykb
OK: index.md is current

validate names the file and passes. The node count stays at 2 and the index is still current: okfctl never treats the skill as a node. It stays out of lint and search as well. How an agent finds that skill is up to the agent. okfctl’s plugin doesn’t load it.

Each skill has a guide for people that goes deeper on the same ground:

Made by Casey West.