CLI reference
Each section gives the invocation and options for one command. Use lokf COMMAND --help to see the help for your installed version. For worked examples, see the toolkit guide.
The package also installs lokf-mcp to run the bundle MCP server and lokf-build to regenerate schema artifacts from a LOKF source checkout with the build extra.
LOKF toolkit — author, convert, query, serve, and automate linked-open knowledge bundles.
Usage: lokf [OPTIONS] COMMAND [ARGS]...| Argument or option | Meaning |
|---|---|
-V, --version |
Show the lokf version and exit. |
--help |
Show this message and exit. |
lokf new
Section titled “lokf new”Scaffold a knowledge-base repo: bundle + Astro site with the graph browser + agent skills.
Usage: lokf new [OPTIONS] {name}| Argument or option | Meaning |
|---|---|
name <str> |
Directory name for the new knowledge base. [required] |
--path <path> |
Where to create it. [default: .] |
--title <str> |
Human-readable title (default: derived from name). |
--base-iri <str> |
Bundle base IRI (default: https://example.org/<name>/). |
--help |
Show this message and exit. |
lokf convert
Section titled “lokf convert”Convert markdown (a concept or whole bundle) to RDF.
Usage: lokf convert [OPTIONS] {source}| Argument or option | Meaning |
|---|---|
source <path> |
A concept .md file or a bundle directory. [required] |
-f, --format <str> |
ttl | nt | jsonld | xml | n3 | trig. [default: ttl] |
-o, --output <path> |
Write to this file instead of stdout. |
-s, --schema <file> |
A domain vocabulary that imports: [lokf], as passed to lokf validate --schema: project its classes and slots under their own IRIs rather than as lokf: terms. Default: the [tool.lokf] schema of the nearest pyproject.toml above the bundle. Needs lokf[build]. |
--help |
Show this message and exit. |
lokf validate
Section titled “lokf validate”Assemble a bundle and validate it against the LOKF schema.
Usage: lokf validate [OPTIONS] [bundle_dir]| Argument or option | Meaning |
|---|---|
bundle_dir <dir> |
A LOKF bundle directory to assemble and validate. [default: knowledge] |
-s, --schema <file> |
Schema file (default: the [tool.lokf] schema of the nearest pyproject.toml above the bundle, else a local lokf.yaml checkout, else the copy packaged with lokf). Pass a domain vocabulary here to validate concepts that go beyond stock LOKF: a LinkML file that imports: [lokf] and adds the bundle’s own types and keys. |
--check-refs |
Also check that every typed-relation target in this bundle’s own namespace (isPartOf, dependsOn, about, relations[].target, …) resolves to a concept in the bundle - something JSON Schema cannot express. External resources are not checked. |
--shacl |
Also validate the projected RDF graph (requires lokf[shacl]). |
--check-resources |
Check local resource paths; never fetch remote identifiers. |
--check-excerpts |
Check that each sources[].excerpt occurs in its local resource; never fetch a URL. |
--root <dir> |
Resource root for –check-resources and –check-excerpts (default: nearest enclosing Git root, else bundle parent). |
--check-ids |
Also check that every concept IRI is declared by one file. Two files with one id - a sync client’s conflict copy, a pasted duplicate - each validate on their own and then merge into one subject in the graph, which neither JSON Schema nor SHACL can see. |
--help |
Show this message and exit. |
lokf tables
Section titled “lokf tables”Project a bundle to linked tables: one per concept type + a relations edge table.
Usage: lokf tables [OPTIONS] {source}| Argument or option | Meaning |
|---|---|
source <path> |
A bundle directory to project to tables. [required] |
-f, --format <str> |
csv | parquet | sqlite | bigquery | athena [default: csv] |
-o, --output <path> |
Output directory (or a .db path for sqlite). [default: lokf-tables] |
--engine <str> |
DataFrame engine: pandas | polars. [default: pandas] |
--location <str> |
Parquet location referenced by the bigquery/athena DDL. [default: gs://your-bucket/lokf] |
--help |
Show this message and exit. |
lokf query
Section titled “lokf query”Run SPARQL over a knowledge base loaded into an in-memory store.
Usage: lokf query [OPTIONS] {source} {sparql}| Argument or option | Meaning |
|---|---|
source <path> |
A bundle directory or concept file to load. [required] |
sparql <str> |
A SPARQL query (schema prefixes preset). [required] |
-f, --format <str> |
table | json | csv | tsv | ttl (CONSTRUCT). [default: table] |
-s, --schema <file> |
A domain vocabulary that imports: [lokf], as passed to lokf validate --schema: project its classes and slots under their own IRIs rather than as lokf: terms. Default: the [tool.lokf] schema of the nearest pyproject.toml above the bundle. Needs lokf[build]. Its prefixes are preset too. |
--help |
Show this message and exit. |
lokf serve
Section titled “lokf serve”Publish a knowledge base locally: SPARQL endpoint + live graph viz.
Usage: lokf serve [OPTIONS] {source}| Argument or option | Meaning |
|---|---|
source <path> |
A bundle directory or concept file to publish. [required] |
--host <str> |
Bind host. [default: 127.0.0.1] |
--port <int> |
Bind port. [default: 8000] |
-s, --schema <file> |
A domain vocabulary that imports: [lokf], as passed to lokf validate --schema: project its classes and slots under their own IRIs rather than as lokf: terms. Default: the [tool.lokf] schema of the nearest pyproject.toml above the bundle. Needs lokf[build]. Its prefixes are preset too. |
--help |
Show this message and exit. |
lokf propose
Section titled “lokf propose”Propose typed relations from markdown links in concept bodies.
Usage: lokf propose [OPTIONS] {bundle_dir}| Argument or option | Meaning |
|---|---|
bundle_dir <dir> |
A LOKF bundle directory. [required] |
--apply |
Write accepted proposals into frontmatter. |
--min-confidence F |
Drop proposals below this. [default: 0.0] |
--json |
Emit JSON instead of a table (composes with –apply). |
--schema <path> |
Override the bundle’s declared schema. |
--help |
Show this message and exit. |
lokf vocab
Section titled “lokf vocab”Show the typed-relation vocabulary; pass –all for the full schema reference.
Usage: lokf vocab [OPTIONS]| Argument or option | Meaning |
|---|---|
--json |
Emit JSON instead of a table. |
-a, --all |
Emit the full vocabulary - classes, slots, and value enums with their descriptions - not just the typed relations. |
--bundle <path> |
Bundle, concept or project path for schema discovery. |
--schema <path> |
Explicit schema; takes precedence over –bundle. |
--include-metadata |
Include schema/import identity; requires –json. |
--help |
Show this message and exit. |
lokf adapt
Section titled “lokf adapt”Copy a published LinkML schema into a LOKF domain vocabulary beside lokf.yaml.
Usage: lokf adapt [OPTIONS] {schema}| Argument or option | Meaning |
|---|---|
schema <file> |
A published LinkML schema: its root file. [required] |
-o, --output PATH |
Where to write the copy: a file, or a directory that gets <stem>_lokf.yaml, with a trailing slash for a new one (default: beside the input). |
--root <list[str]> |
A class to re-root on Concept, as the schema names it; repeatable. Default: every rootless, non-mixin class that carries the schema’s identifier. |
--lokf <file> |
The lokf.yaml the copy must share no name with (default: a local checkout, else the copy packaged with lokf). |
--beside <list[Path]> |
Another domain vocabulary the copy will share a host with; repeatable. Avoid its element and attribute names and verify the combined imports. |
--prefix <str> |
Prefix for renamed elements (default: the schema’s default_prefix). |
--fold SCHEMA_SLOT=LOKF_SLOT |
Fold one of the schema’s slots, or a class attribute as Class.attr, into the LOKF slot it means; repeatable. A slot whose IRI matches one of Concept’s slots folds without this flag. |
--keep SCHEMA_SLOT |
Leave one of the schema’s slots, or a Class.attr attribute, out of the fold by IRI; repeatable. It is renamed, or left as it is, as if no IRI matched. |
--dry-run |
Report the moves; write nothing. |
--check |
Write nothing; exit 1 unless –output already holds exactly this copy and it verifies beside lokf.yaml. For CI, when either schema moves. |
--help |
Show this message and exit. |
lokf skills
Section titled “lokf skills”List, locate, or install the bundled agent skills.
Usage: lokf skills [OPTIONS] [action]| Argument or option | Meaning |
|---|---|
action <str> |
list | path | install [default: list] |
--dest <path> |
Target for install (default: .claude/skills). |
--help |
Show this message and exit. |
lokf export
Section titled “lokf export”Export a bundle’s artifacts for a static site — and a registry — to consume.
Usage: lokf export [OPTIONS] {bundle_dir}| Argument or option | Meaning |
|---|---|
bundle_dir <dir> |
A LOKF bundle directory. [required] |
-d, --out-dir <path> |
Directory to write graph.json, datasets.jsonld, graph.nt, concepts.jsonld. [required] |
--source-base <str> |
URL prefix for a node’s source file (graph meta). |
-s, --schema <file> |
A domain vocabulary that imports: [lokf], as passed to lokf validate --schema: project its classes and slots under their own IRIs rather than as lokf: terms. Default: the [tool.lokf] schema of the nearest pyproject.toml above the bundle. Needs lokf[build]. |
--schema-docs |
Also export the resolved data model as schema.json. |
--views <file> |
Compile a static-site view manifest into views.json alongside the graph. |
--help |
Show this message and exit. |
lokf mcp
Section titled “lokf mcp”Run the LOKF MCP server (stdio) so agents can drive the toolkit.
Usage: lokf mcp [OPTIONS]| Argument or option | Meaning |
|---|---|
--help |
Show this message and exit. |
lokf registry
Section titled “lokf registry”Federate bundles: a registry of LOKF bundles (meta-lokf).
Usage: lokf registry [OPTIONS] COMMAND [ARGS]...| Argument or option | Meaning |
|---|---|
--help |
Show this message and exit. |
lokf registry init
Section titled “lokf registry init”Scaffold an empty registry manifest.
Usage: lokf registry init [OPTIONS]| Argument or option | Meaning |
|---|---|
-r, --registry <path> |
Manifest path to create. [default: lokf-registry.yaml] |
--id <str> |
Registry IRI (dcat:Catalog @id). |
--title <str> |
Registry title. |
--help |
Show this message and exit. |
lokf registry add
Section titled “lokf registry add”Register a bundle: derive its base_iri, VoID index, and id_index.
Usage: lokf registry add [OPTIONS] {source}| Argument or option | Meaning |
|---|---|
source <str> |
A local LOKF bundle directory, a bundle zip, or the URL of one. [required] |
-r, --registry <path> |
Manifest to append to. [default: lokf-registry.yaml] |
--source-base <str> |
URL prefix for source .md files. Without it a directory’s files are found through its path, and a zip’s have no URL. |
--checksum <str> |
Expected sha256 of a zip (sha256:<hex> or bare hex); a mismatch is refused. |
--archive-url <str> |
Where a local zip is published, recorded in place of its local path. |
--allow-foreign-ids |
Index explicit ids that lie outside the bundle’s base_iri instead of refusing. |
--help |
Show this message and exit. |
lokf registry list
Section titled “lokf registry list”Print the routing table: base_iri, title, triples, status.
Usage: lokf registry list [OPTIONS]| Argument or option | Meaning |
|---|---|
-r, --registry <path> |
Manifest to read. [default: lokf-registry.yaml] |
--help |
Show this message and exit. |
lokf registry resolve
Section titled “lokf registry resolve”Resolve an IRI to its owning bundle, Concept ID, and source URL.
Usage: lokf registry resolve [OPTIONS] {iri}| Argument or option | Meaning |
|---|---|
iri <str> |
An absolute concept IRI to resolve. [required] |
-r, --registry <path> |
Manifest to read. [default: lokf-registry.yaml] |
--help |
Show this message and exit. |
lokf registry build
Section titled “lokf registry build”Load each member into a named graph (its base_iri) and write them as N-Quads.
Usage: lokf registry build [OPTIONS]| Argument or option | Meaning |
|---|---|
-r, --registry <path> |
Manifest to read. [default: lokf-registry.yaml] |
-d, --out-dir <path> |
Directory to write federation.nq to. [required] |
--strict |
Exit 1 when a member fails to load or a target does not resolve. |
--clear-member <list[str]> |
Explicitly clear this sensitive member base_iri for this run; repeatable. |
--help |
Show this message and exit. |
lokf registry query
Section titled “lokf registry query”Run SPARQL over every member at once, the default graph being their union.
Usage: lokf registry query [OPTIONS] {sparql}| Argument or option | Meaning |
|---|---|
sparql <str> |
A SPARQL query; GRAPH ?g binds a member’s base_iri. [required] |
-r, --registry <path> |
Manifest to read. [default: lokf-registry.yaml] |
--quads <file> |
Load this federation.nq from lokf registry build instead of fetching members. |
-f, --format <str> |
table | json | csv | tsv | ttl (CONSTRUCT). [default: table] |
--clear-member <list[str]> |
Explicitly clear this sensitive member base_iri for this run; repeatable. |
--help |
Show this message and exit. |
lokf registry serve
Section titled “lokf registry serve”Publish the federation locally: SPARQL endpoint + live graph viz.
Usage: lokf registry serve [OPTIONS]| Argument or option | Meaning |
|---|---|
-r, --registry <path> |
Manifest to read. [default: lokf-registry.yaml] |
--quads <file> |
Load this federation.nq from lokf registry build instead of fetching members. |
--host <str> |
Bind host. [default: 127.0.0.1] |
--port <int> |
Bind port. [default: 8000] |
--clear-member <list[str]> |
Explicitly clear this sensitive member base_iri for this run; repeatable. |
--help |
Show this message and exit. |
lokf registry mcp
Section titled “lokf registry mcp”Run the lokf-registry MCP server (stdio) over the federation (SPEC §11.4).
Usage: lokf registry mcp [OPTIONS]| Argument or option | Meaning |
|---|---|
-r, --registry <path> |
Manifest to read. [default: lokf-registry.yaml] |
--quads <file> |
Load this federation.nq from lokf registry build instead of fetching members. |
--index <file> |
Markdown to serve as the index instead of the one built from the manifest. |
--clear-member <list[str]> |
Explicitly clear this sensitive member base_iri for this run; repeatable. |
--help |
Show this message and exit. |