Open Knowledge Format (OKF) skill
OKF represents knowledge as a directory of markdown files with YAML frontmatter.
It is minimal by design: no schema registry, no runtime, no SDK. Your job is to
produce, maintain, and consume OKF bundles conformant with the spec, not your
memory of it.
Always read the canonical spec before non-trivial work:
reference/SPEC.md. It is the verbatim OKF v0.2 specification
and the source of truth for every rule below.
The one hard rule
A bundle is conformant (§11) iff: every non-reserved
file has a parseable
YAML frontmatter block, and every such block has a
non-empty field.
Everything else is soft guidance. Consumers MUST tolerate missing optional
fields, unknown types, and broken links — never reject a bundle over them.
Conventions to apply
- One concept = one file. The file path (minus ) is the concept ID.
- Frontmatter: is required. Add , , when
they aid consumption; add (a canonical URI) only for concepts bound
to a real asset — omit it for abstract concepts.
- Body: prefer structural markdown (headings, tables, lists, fenced code).
Conventional headings: , , .
- Cross-links: standard markdown links; prefer absolute bundle-relative
form (). A link asserts a relationship; its kind lives
in the surrounding prose, not the link.
- Reserved files: (directory listing, no frontmatter — except the
bundle-root index may carry only ) and (ISO-dated change
history, newest first). Never use these names for concepts.
The v0.2 families (all optional, all worth filling)
- Trust (§5.2): — who produced the current content
and when. — who confirmed it since (a bare mapping is
one entry). Write in the actor convention (§7):
for an agent, for a person, for an automated job.
Use whenever a person authored or signed off — consumers key trust
tiers off that prefix.
- Lifecycle (§5.4–5.5):
status: draft|stable|deprecated
(absent means
stable) and , an absolute date, not a TTL.
- Provenance (§5.1):
sources: [{ id, resource, title, author, usage_count, last_modified }]
— the materials the concept derives from.
is required per entry and may be a URL, a bundle path, or a scope
descriptor. Attribute a specific claim with a markdown footnote whose label is
the source's : …sharded daily.[^ga4-schema]
plus a
definition. The label is the join key — it must match a .
- Attestation (§10): a sanctioned computation is its own concept,
type: Attested Computation
, carrying (required), ,
, , and the computation itself under (or a
path). Concepts that need the value link to it. Never inline a
number's SQL into the concept that narrates it.
Reading a v0.1 bundle? Two constructs were superseded (§13.1):
is now
, and a body
list is now
. Read both,
write v0.2 — and when you touch a legacy concept in
maintain mode, migrate
its frontmatter as part of the edit. The validator warns on both.
Templates to copy: concept, index,
log.
Default bundle location
Use
at the repository root unless the project already uses another
location. Commit it alongside the code it describes — knowledge as code.
Modes
produce — create or extend a bundle
Starting a brand-new bundle? Use the init fast-path instead of hand-writing
the first files — it scaffolds a conformant
,
, and a
concept with full recommended frontmatter in one shot:
bash
uv run "${CLAUDE_SKILL_DIR}/scripts/okf_init.py" <target-dir> [--title "..."]
It refuses to touch a directory that already has
files unless
is given. Then extend it:
- Read reference/SPEC.md.
- Pick the source(s): code (derive concepts from source, READMEs,
docstrings, config), docs/wiki (distill pages into concepts, record the
originals in ), manual (decisions, playbooks, metrics).
- Choose a directory layout by domain (e.g. , ,
). One concept per file.
- Write each concept from templates/concept.md: set a
descriptive , fill recommended fields, record and the
you actually read, cross-link related concepts.
- Add/refresh per directory (and in the root
index). Append a dated entry to .
- Validate (see below). Fix every error before finishing.
maintain — keep a bundle in sync with reality
- Identify which concepts the change affects (search by , path, or
topic). This bookkeeping is exactly what agents are good at — touch every
affected file in one pass.
- Update the body and (with your own actor in );
fix or add cross-links; create new concepts for new assets; mark removed
assets and note the deprecation in rather than
silently deleting context. Facing a whole v0.1 bundle rather than a stray
field? Do not hand-edit it — run the validator's once.
- Update the relevant files and append a dated entry
describing what changed.
- Validate.
consume — use a bundle as context
- Read the bundle-root first for progressive disclosure, then follow
links only into the concepts relevant to the task.
- Weigh what you read: /, a already
past, or no entry all mean "check before relying on this". Treat
broken links as not-yet-written knowledge, not errors.
- Need a number an covers? Run its computation with
values bound to the declared — never write your own query.
- If you learn something durable while working, switch to maintain and
write it back.
Validation (do this before declaring done)
Never eyeball conformance — run the deterministic checker. Invoke the companion
skill (
/okf:validate <bundle-dir> --strict
), which ships the
checker. If that skill is not installed, run it directly:
bash
uv run "${CLAUDE_SKILL_DIR}/../validate/scripts/okf_validate.py" <bundle-dir> --strict
Resolve every
(hard §11 failures). Warnings are soft; fix them when cheap,
but they never block.