sokf
sokf validates knowledge stores in the Superdev Open Knowledge Format (SOKF): directories of Markdown documents with YAML frontmatter, kept in a Git repository and maintained largely by AI agents. It checks every document against its type's schema, resolves every link, keeps generated content current, allocates document ids, prints the store as a graph from any point, and locates a document by id.
- Install
- Usage
- Configuration
- Agent harness
- Output and exit codes
- Specifications
- Project layout
- Development
- Licence
Install
Install the launcher, which brings the prebuilt binary for your machine, or build sokf from crates.io:
Prebuilt binaries cover Linux and macOS on x64 and arm64, and Windows on
x64. The Linux builds are statically linked against musl, so they need no
particular glibc version and run on Alpine too. The crates aren't on crates.io
while the repository is private, so the source install builds from git.
Usage
A store is a directory with a manifest, and sokf init creates one.
--repo-root <DIR> sets the repository root. Without it, sokf uses the Git
repository that contains the current directory.
The cache, under /.sokf/cache/, holds the results of the last run. With the
cache, a run rechecks only the changed files and the files that depend on
them. With --no-cache, sokf reads every file from disk and leaves the cache
unchanged. Both --repo-root and --no-cache are global options.
Configuration
Three files under /.sokf/ configure the tool:
/.sokf/config.tomllists the knowledge roots (default/knowledge), the paths that sokf skips in its walk of the repository, and the declined harness parts./.sokf/formats.yamladds line formats for the whole repository./.sokf/harness.tomlrecords the harness parts that the tool wrote.
Every path that the tool prints is relative to the repository root and starts
with /, as paths in documents do. Only locate prints filesystem paths.
sokf accepts a path argument in either form.
Agent harness
sokf harness install claude makes a repository ready for Claude Code. It
writes the sokf skill, an instructions block, a stop hook, and the
permission to run sokf. The hook runs sokf validate --fix when the agent
ends its turn, and hands the remaining errors back to the agent. The command
touches only the parts that it writes. It keeps a part that you edited unless
you pass --force. To refresh the stale parts after an upgrade, run the
command again.
sokf installs the same integration into every agent harness of
agent-harness-adapter. Name one or
more, or all. A harness that has no place for a part, shown as none in the
following table, reports the part as unsupported:
| Harness | Name | Instructions | Hook | Permission | Skill |
|---|---|---|---|---|---|
| Claude Code | claude |
CLAUDE.md or AGENTS.md |
.claude/settings.json |
.claude/settings.json |
.claude/skills |
| OpenAI Codex | codex |
AGENTS.md |
.codex/hooks.json |
none | .agents/skills |
| Factory Droid | factory |
AGENTS.md |
.factory/hooks.json |
none | .agents/skills |
| Gemini CLI | gemini |
GEMINI.md |
.gemini/settings.json |
.gemini/settings.json |
.agents/skills |
| GitHub Copilot | copilot |
AGENTS.md |
.github/hooks/sokf.json |
none | .agents/skills |
| Cursor | cursor |
AGENTS.md |
.cursor/hooks.json |
.cursor/cli.json |
.agents/skills |
| Pi | pi |
AGENTS.md |
.pi/extensions/sokf.ts |
none | .agents/skills |
| OpenCode | opencode |
AGENTS.md |
.opencode/plugins/sokf.ts |
opencode.json |
.agents/skills |
| Kilo Code | kilo |
AGENTS.md |
.kilo/plugins/sokf.ts |
kilo.json |
.agents/skills |
| Qwen Code | qwen |
AGENTS.md |
.qwen/settings.json |
.qwen/settings.json |
.agents/skills |
| Devin | devin |
AGENTS.md |
.devin/hooks.v1.json |
.devin/config.json |
.agents/skills |
Any AGENTS.md agent |
agents |
AGENTS.md |
none | none | .agents/skills |
A file that several harnesses read, such as AGENTS.md, is written once, and
the report shows it as shared for the others. --scope user installs into
your home directory, for every repository, and --scope local into the
repository's files that stay out of git (Claude Code and GitHub Copilot). Keep
/.sokf/harness.local.toml and /.sokf/config.local.toml out of git too.
Output and exit codes
sokf validate prints one line for each finding,
PATH:LINE: error: MESSAGE, followed by the counts. PATH is the file,
LINE is the line in it, and MESSAGE describes the finding. Each message
ends with the authority for the finding: the key of the broken criterion, or
the schema and its broken rule:
moved /knowledge/issues/open/issue-003-retry.md -> /knowledge/issues/closed/issue-003-retry.md
rewrote /knowledge/architecture.md
/knowledge/architecture.md:41: error: `[sokf:planer]` resolves to no document (SOKF_FORMAT_61)
/README.md: error: section `## Usage` is missing (schema schema-readme, section "Usage")
2 errors, 0 of 1 warnings listed
The last line gives the number of warnings listed out of the total.
--warnings lists them all.
Without a start argument, sokf graph prints the layout of each knowledge
root in the way that tree does, with each store's description and each
document's id:
/knowledge - The example knowledge of the graph design.
├── config
├── core/
│ ├── executor
│ └── planner
└── schemas/
└── subsystem
4 / 4 docs
For a document, sokf graph prints its edges: links, resource,
sources, and includes, and it adds the inverse of every edge. (*) marks a
node whose edges are printed elsewhere, so the output stays finite at any
depth.
For a group of more than 20 entries, the command prints the first 20 and a
line that counts the rest. It folds the includes of one file into one line.
It leaves out the documents that a schema archives, such as closed issues.
--all and --archived show these entries.
The last line gives the number of documents printed out of those in the whole view. When the view reaches an archived document, the line also gives the number of archived documents printed out of their total. The following view reaches none:
planner
├── includes → /crates/app/sokf/src/main.rs#cli
├── depends-on → config
├── depended-on-by → executor
├── references → planer
└── describes → /crates/lib/example-core/src/planner.rs
3 / 3 docs
sokf exits with 0 when it finds no error, with 1 when it finds errors,
and with 2 on a usage or internal error. It reports a usage or internal
error on stderr as error: MESSAGE, where MESSAGE describes the error.
When a downstream pipe closes (sokf info grammar | head), sokf stops
without an error.
Specifications
Three core specifications define the format:
sokf-spec/sokf-format-spec.md,
sokf-spec/sokf-schema-spec.md, and
sokf-spec/sokf-validation-spec.md.
They are documents of sokf-spec, the knowledge store of SOKF itself. The
schemas in knowledge/schemas/ show SOKF in use: they are the schemas of the
knowledge store in which sokf's own development is recorded.
The schema language comes from tramlines,
a Markdown schema engine with its own
specifications and grammars.
SOKF's schema extension,
sokf-spec/sokf.tramlines.yaml, extends the
tramlines-md grammar. The guide to the extension,
sokf-spec/sokf.tramlines.yaml.md, sits
beside the extension.
The agent reference, which describes the format on one page for an AI agent,
is the sokf skill. sokf harness install
writes the skill into a repository.
Project layout
sokf-spec/ the knowledge store of SOKF itself: its specifications, its grammar, and its formats, which sokf validates
harness/ the embedded harness integration: the sokf skill and the instructions block
crates/lib/sokf-core the library: it walks the repository, builds the model, hosts SOKF's schema extension in the tramlines engine, checks and fixes the knowledge, reports the findings, builds the graph, runs queries, and installs the harness
crates/app/sokf the binary: it parses the command line, calls the library, and renders the results as text, JSON, or Mermaid
packages/sokf the npm launcher (a JS shim that spawns the binary)
packages/sokf-OS-CPU the five prebuilt-binary packages it selects from
scripts/ the version and smoke-test scripts that the release runs
.github/workflows/ publish.yml, which builds and publishes each release
In packages/sokf-OS-CPU, OS is linux, darwin, or win32, and CPU is
x64 or arm64.
Development
.mise.toml and rust-toolchain.toml pin the toolchains, which
mise installs.
For the setup, and for how to report a bug or ask for a feature, see the contributing guide.
Licence
sokf is released under the Elastic License 2.0. The licence file states its terms.