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
- The sokf pack
- Output and exit codes
- Specifications
- Project layout
- Development
- License
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.
Usage
A store is a directory with a manifest, and sokf init creates one.
# a document from its schema's template, at its derived path
# keep the sequence number 42 that the work already has
# write the document, and print its id, path, and text as JSON
--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 and two folders 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 skips a path only outside the knowledge roots, sosokf validatewarns at each glob ofrepository.excludethat lies under a root./.sokf/formats.yamladds line formats for the whole repository./.sokf/roots.d/and/.sokf/formats.d/hold the files that another tool, such as pakf, ships for sokf, at any depth: each file*.tomlofroots.dlists further knowledge roots, and each file*.yamlofformats.dadds line formats, where/.sokf/formats.yamldecides a format or a type that two of them declare differently./.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, and the permission to run
sokf. A hook is off by default: with with = ["hooks"] under
[harness.claude] in /.sokf/config.toml, the command also writes a hook that
runs sokf validate when the user submits a prompt, and tells the agent how
many errors remain, without blocking it. The instructions block holds only
sokf's own instructions. 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.
The sokf pack
The sokf pack, in packs/sokf/, is a method for a project's
knowledge: the schemas of an architecture, stories, contracts, designs,
issues, and other documents, the line formats that they share, documentation
standards, recipes, and instructions for the agent. It is a pack of
pakf, the tool that shares project files
through packs, and each release of sokf tags it. Its
README says how to take it.
sokf itself has no packs. It refuses a [[pack]] entry in
/.sokf/config.toml with exit code 2, and sokf validate warns at a
/.sokf/packs.lock or a /.sokf/packs/ that an older sokf wrote, until you
delete them. sokf reads the files that a pack ships for it as it reads any
other file, such as a file of formats in /.sokf/formats.d/.
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.
Without --warnings, only the warnings at a stale or an absent part of an
installed harness are listed; --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
sokf pack shows SOKF in use, and sokf's own development
records its knowledge with it.
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
packs/sokf/ the sokf pack, the method of a project's knowledge, which a project takes with pakf
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/cli 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
.config/mise/ the tasks and scripts that build, test, version, and publish the project
.github/workflows/ publish.yml and build.yml, which build and publish each release
In packages/sokf-OS-CPU, OS is linux, darwin, or win32, and CPU is
x64 or arm64.
Development
rust-toolchain.toml and the files in .config/mise/conf.d/ pin the
toolchains, which mise installs, and mise tasks ls
lists the project's tasks.
For the setup, and for how to report a bug or ask for a feature, see the contributing guide.
License
sokf is released under the Elastic License 2.0. The license file states its terms.