From okf-wiki
Scaffolds an Open Knowledge Format (OKF) knowledge base from existing material: creates per-concept markdown files with provenance, a spec, a validator, and session hooks. Use when you want to structure docs as one-concept-per-file or initialize an OKF wiki.
How this skill is triggered — by the user, by Claude, or both
Slash command
/okf-wiki:okf-wikiThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
OKF (Open Knowledge Format) stores knowledge as small markdown files: one concept per
example/README.mdexample/SPEC.mdexample/bundle/hooks/accessibility-check.mdexample/bundle/hooks/ai-slop-detector.mdexample/bundle/hooks/ap-style-check.mdexample/bundle/hooks/archive-reminder.mdexample/bundle/hooks/bug-report-detector.mdexample/bundle/hooks/copywriting-preflight.mdexample/bundle/hooks/data-methodology-check.mdexample/bundle/hooks/deadline-tracker.mdexample/bundle/hooks/enforce-test-first.mdexample/bundle/hooks/index.mdexample/bundle/hooks/legal-review-flag.mdexample/bundle/hooks/no-ai-attribution.mdexample/bundle/hooks/one-way-door-check.mdexample/bundle/hooks/pre-commit-review.mdexample/bundle/hooks/pre-publish-checklist.mdexample/bundle/hooks/source-attribution-check.mdexample/bundle/hooks/source-diversity-check.mdexample/bundle/hooks/verification-reminder.mdOKF (Open Knowledge Format) stores knowledge as small markdown files: one concept per
file, each carrying its own provenance in YAML frontmatter, with directory index.md
files for navigation and a validator that enforces the contract. It is built for
knowledge bases that both people and agents read and edit — newsroom institutional
memory, a research atlas, a team's decision log, an infrastructure map.
This skill scaffolds a conforming OKF project and validates it. The format contract is
in spec/SPEC.md (in this skill's directory) — read it before changing structure.
Before you scaffold anything, settle four things with the user. They shape what gets created and
how it is published, and they are awkward to retrofit once concepts exist. Ask with AskUserQuestion
rather than in prose, in two steps: the first three questions in one call, then the publish question
as a follow-up call only if the audience came back public or both (it does not apply to an
internal-only wiki, and its relevant options depend on that answer, so it cannot share the first
batch). Infer the title from the repo or project and confirm it. Skip any question the user already
answered in their request — do not re-ask what they have told you.
bundle/ is the source of truth.bundle/ is the source of truth with hooks on for agents, plus a
published view for people. Default here when the user is unsure.people, orgs, sources, decisions, beatsconcepts, sources, methods, findingsmachines, services, networks, credentials, processesdecisions, context, events
The chosen title and list feed --title and --sections below; the user can edit the list.AskUserQuestion call, made only after the audience comes back
public or both (skip it entirely for an internal-only wiki):
scripts/gh-wiki-bootstrap.py.Carry the answers into the scaffold command (the title and sections, plus --no-hooks if the user
opts out of the hooks for a public-only wiki) and into the populate step. The audience answer is
also the visibility decision the "Before finishing" section asks you to make deliberately — you are
making it here, up front, where it can steer the rest of the setup.
scripts/scaffold.py writes a project that passes its own validator by construction:
<target>/
SPEC.md the OKF format contract
README.md how to use and validate the bundle
scripts/validate.py the validator
.claude/ Claude Code adapter: session-orientation hooks
settings.json registers the hooks (Claude Code approves them once)
hooks/okf-anchor.py SessionStart: load the index into context
hooks/okf-orient.py PreToolUse: gate the first action on orientation
bundle/ the OKF bundle (the validated tree)
index.md carries okf_version: "0.3"
<section>/
index.md
example-concept.md a starter concept with full frontmatter
Docs and tooling sit at the project root; only bundle/ is validated. Keep them
separate — the validator treats every non-reserved .md inside the bundle as a
concept that needs frontmatter, so a stray SPEC.md inside bundle/ would fail.
The .claude/ hooks sit outside bundle/, so they never trip the concept checks.
${CLAUDE_SKILL_DIR} below is this skill's own directory (the folder holding this
SKILL.md). Claude Code substitutes it with the real absolute path before you run the
command, so it works regardless of the current directory. On Windows, use python instead
of python3 (stock Windows has no python3). The --title and --sections come from the
onboarding answers above, and --no-hooks only if the user opted out. Scaffold into a new
directory; it validates automatically at the end:
python3 "${CLAUDE_SKILL_DIR}/scripts/scaffold.py" ./my-knowledge-base \
--title "Team knowledge base" \
--sections concepts,services,decisions
Default section is concepts. Use --force to write into a non-empty directory,
--no-validate to skip the validation run, and --date YYYY-MM-DD to set the sample
frontmatter date. The session hooks are written by default; --no-hooks skips them and
--hooks-os posix|windows overrides the auto-detected launch command (see below).
Validate any time, from the scaffolded project root (use python on Windows):
python3 scripts/validate.py --bundle bundle # must exit 0
Scaffolding leaves an empty tree with one placeholder concept. The usual next request
— "here are my docs / plans / notes / repo, build the wiki" — has no importer script, and
can't have one: deciding what counts as a single concept, writing its one-line description,
choosing its type, and pointing source at real provenance is judgment work, not a
mechanical transform. So you (Claude) author the concepts directly, in this loop:
## to one file.bundle/<section>/<slug>.md with the full frontmatter
(type, title, description, source, verified, timestamp, tags):
type from the vocab. Infrastructure: Machine, Network, Service, Session, Project,
Repo, Credential, Path, Process. Domain-neutral: Concept, Decision, Event, Person,
Org, Source. Plus Reference (the catch-all). The set is closed; an unlisted type fails.description is one line. source — quote every element — points at where the fact
actually came from (the origin file path, URL, command, or event), not at this skill.timestamp to today. verified is the date the fact was last confirmed true — set it by
how you came to know it, not reflexively to today:
verified correctly reads as "may be
stale, re-check," while today reads as "just confirmed." The frontmatter date is the contract;
a caveat in the body does not undo an overstated value, because the validator and tools read
only the date.index.md, and cross-link related concepts with relative
[text](path.md) links — not [[slug]] wikilinks. [[slug]] is the auto-memory idiom; the
OKF validator rejects it and never resolves it, so a typo'd or deleted reference passes silently.
When you create a new section, also link it from the bundle-root index.md — that root is the
navigation map the session anchor loads, so a section missing from it is invisible to orientation
even though validation still passes.example-concept.md (and
its bullet in the section index.md) once real concepts exist — otherwise the sample ships in
the finished wiki and still passes validation.python3 scripts/validate.py --bundle bundle, fix what it
reports, repeat until it exits 0. Unquoted source elements and missing frontmatter keys are
the common failures. Author in batches and validate between them rather than writing fifty
files and debugging the lot.If the user points you at an existing OKF bundle (e.g. an upstream example: an index.md
carrying okf_version plus concept files with frontmatter), you are adopting it, not importing
it. Copy or clone the tree in, point the validator at the new root, and fix any links that broke
in the move. To keep it as its own area beside other content, give it a uniquely named top
directory, then create one combined-root index.md that carries okf_version and strip the
frontmatter from each adopted bundle's own root index.md, turning it into a normal section index
(the validator allows okf_version on the one combined root only; a nested index.md that still
carries it fails validation). Write cross-links as relative paths and validate the combined root.
Re-authoring an already-conforming bundle into your own concepts is wasted work; only reshape it if
that is the actual goal.
Full contract in spec/SPEC.md. This spec is a strict fork of Google's upstream OKF
v0.1: it requires all seven frontmatter keys, uses a source list in place of upstream's
resource and # Citations, adds verified, closes the type vocab, and enforces link
resolution. spec/SPEC.md ("Relationship to upstream OKF") lists every difference. The
load-bearing rules:
type, title, description, source, verified, timestamp, tags. type is one of: Machine, Network, Service, Session, Project, Repo,
Credential, Path, Process (infrastructure); Concept, Decision, Event, Person, Org, Source
(domain-neutral); or Reference (catch-all).source element — source pointers carry # and : which break YAML
if unquoted. source: ["README.md", "issue #445"].verified is the date the fact was last confirmed true — a re-check against reality, or the
user stating a fact they are the authority for (a decision, a preference); a fact they merely
recall about external state is a source claim, not a re-check. timestamp is when the concept
was authored/updated. Both ISO YYYY-MM-DD. See the authoring loop above for the full date rules.index.md and log.md are reserved — no frontmatter (except the bundle-root
index.md, which carries okf_version only).A scaffolded project ships a .claude/ with two hooks so any Claude session opened in it
starts from the bundle, not from memory:
okf-anchor.py (SessionStart) prints the bundle's root index into the session context.okf-orient.py (PreToolUse, no matcher) blocks the first action of the session once,
until Claude confirms it read the index, then unblocks for the rest of the session. It is
inert outside an OKF bundle and fails open on any error, so it never wedges a session.Both are one cross-platform python3 script. The scripts are identical on every OS; only the
interpreter in .claude/settings.json changes: python3 on macOS/Linux, python on
Windows. scaffold.py auto-detects the OS; --hooks-os posix|windows forces it.
Claude Code treats a checked-in .claude/settings.json as untrusted, so the first time the
project is opened it asks the user to approve the hooks; they run automatically after that.
To turn them off, scaffold with --no-hooks, or delete .claude/ (or set disableAllHooks)
in an existing project.
The portable OKF surface is SPEC.md, requirements.txt, scripts/validate.py, and the
bundle/ tree. The generated README.md documents both that shared surface and any enabled
client adapter. The three generated .claude/ files are a Claude Code adapter, not part of
the OKF format and not shared Codex behavior. Codex does not read them as project configuration,
and this skill must not claim that their SessionStart or PreToolUse lifecycle runs there.
The general onboarding route above still names Claude Code's AskUserQuestion and
${CLAUDE_SKILL_DIR} surfaces. The recorded Codex pilot pre-set every onboarding choice and
used an explicit project-relative installed path; it does not establish that the unadapted
general route is portable.
For a mixed Claude Code and Codex project, keep .claude/ so Claude Code can request trust
and use the hooks; Codex leaves it inert. For a Codex-only project, pass --no-hooks while
scaffolding or delete .claude/ afterward. Either choice leaves the portable bundle and
validator unchanged.
OKF lives best as in-repo files (the validator and relative links work directly). A repo's GitHub wiki is an optional reading surface, and wiring it up is an advanced, manual step — most users should skip it and keep the bundle in-repo.
A wiki with zero pages has no git repo to push to and no API, so the very first page must be
created through the web UI. scripts/gh-wiki-bootstrap.py automates that one step, but it
drives a real logged-in browser, so it needs two things you provide yourself (a GitHub PAT
does not work — wiki pages are a web-UI-only surface):
pip install playwright && playwright install chromium.storageState JSON, captured from a browser
where you have already logged into GitHub. The script reuses that session; it does not log
in for you. Pass its path with --state (default: ~/.cache/gh_state.json).python3 "${CLAUDE_SKILL_DIR}/scripts/gh-wiki-bootstrap.py" owner/repo --state path/to/gh_state.json
# then: git clone https://github.com/owner/repo.wiki.git and push your pages
Note the impedance: GitHub wikis are flatter than an OKF tree and use [[WikiLinks]], so
OKF's nested directories and relative links need adapting for the wiki surface. Treat the
wiki as a published view, not the source of truth. (v0.1 ships the bootstrap step; an
automatic bundle-to-wiki sync is not built yet.)
npx claudepluginhub jamditis/claude-skills-journalism --plugin okf-wikiBootstraps a new personal wiki for any knowledge domain with directory structure, configuration, and helper scripts. Supports Obsidian and plain markdown link styles.