A toolkit — and Claude Code plugin — for building and maintaining an Open Knowledge Format (OKF) knowledge base: a plain directory of markdown files with YAML frontmatter that a human can read, git can track, and any AI agent can consume without an SDK or server.
okfm gives you a set of commands to create that directory, keep its links and frontmatter consistent, generate concepts from existing sources, and read the whole thing back as a browsable HTML file. The engine is dependency-free stdlib Python 3 with no network access, and every command previews its changes before writing. It runs as a Claude Code plugin (/okfm:* slash-commands) or as a plain okf CLI on any harness or shell.
A bundle is a folder of .md files. Each file (a "concept") has a YAML frontmatter block with at least a type, and a markdown body. Files link to each other with ordinary markdown links. Two filenames are reserved: index.md (a generated table of contents, one per directory) and log.md (a change log). That's the whole format — there's no database and no proprietary store. okfm is a manager for that folder, not a new storage system.
okfm implements the OKF v0.1 spec. It is not affiliated with the upstream OKF project; it targets that spec and links to it above.
- Developers consolidating a repository's scattered knowledge into one agent-readable place.
- Anyone building a markdown "second brain" who wants structure and link-checking without adopting a heavier tool.
If you already keep notes as markdown (including in Obsidian — a folder of markdown is a valid vault), okfm works on that folder in place.
In Claude Code:
/plugin marketplace add RadOrigin-LLC/okf-manager
/plugin install okfm@okf-manager
For any other harness (or a plain shell), there's nothing to install beyond Python 3 — see Using it from any harness.
- Python 3 on your PATH — nothing else to install: no
pippackages, no server, no API keys. (enrichis the exception: it borrows your harness's own web-fetch capability; see Limitations.)
These steps use the okf CLI (see how to invoke it). In Claude Code, you can instead say /okfm:start and let the skill handle the flags conversationally — but the CLI form below is the precise, copy-pasteable version.
1. Create the bundle.
okf new welcome.md --bundle knowledge --init --name "My Knowledge Base" --type Note --title "Welcome"This makes a knowledge/ folder containing index.md, log.md, okf.json, and your first concept.
2. Fill it — use whatever fits what you already have (add --dry-run to preview any of these first):
okf scan ./docs # propose importable files from a folder
okf seed ./api/openapi.json --dest-dir api # bulk concepts from a DB / OpenAPI spec / dir tree
okf add notes/architecture.md knowledge/architecture.md --type Doc --title "Architecture"
okf new knowledge/deploy-gotcha.md --type Note --title "Deploy gotcha" --body "Always run migrations before the deploy, not after."3. Keep it healthy.
okf check knowledge # validate links, frontmatter, staleness, index drift
okf check knowledge --fix --dry-run # preview index/frontmatter repairs; drop --dry-run to apply4. Read it back.
okf find knowledge --tag deploy # ranked keyword/field search
okf map knowledge # writes viz.html — open it in any browser5. Wire it in so agents actually use it — see Making agents use it.
okfm builds and maintains the folder; it does not automatically feed it to an AI. A bundle is a resource you point agents at. Two things make it one: commit the folder, and tell your agents to read it. Paste a block like this into the consuming project's CLAUDE.md / AGENTS.md / GEMINI.md (adjust the path):
## Knowledge base (OKF)
This repo has an OKF knowledge base at `knowledge/`, managed by okfm.
- **Before non-trivial work:** read `knowledge/index.md` and follow links
relevant to the task. Treat concepts as orientation, then verify against the
live code — notes can lag reality.
- **Trust tiers:** `curated_by: human` concepts are reviewed; `curated_by: agent`
are machine-drafted and may be stale — verify before relying on them.
- **When a durable decision changes:** update the relevant concept and add a
`log.md` entry, then run `check`.
- **Links are standard markdown only** (`[text](/path.md)`), not `[[wikilinks]]`.Agents read their instructions file at session start, so that's the reliable place to anchor the pointer. The nested index.md tree lets an agent start at the root and drill down to the relevant concept instead of loading everything into context.
Every command that writes shows you a preview first and asks before changing anything. Shown as Claude Code slash-commands; the okf CLI uses the same names (okf seed …, okf check …).
/okfm:start— guided onboarding: a short interview, an explanation of the capture filter (what's worth keeping), scaffolds a new bundle, and walks you through your first concepts./okfm:new— create one concept with valid frontmatter.--initbootstraps a fresh bundle (index.md,log.md,okf.json).
/okfm:add— import an existing markdown file: fill in only the missing frontmatter, place it, and wire it into the index. Your existing frontmatter and body are left as-is./okfm:convert— turn a single non-markdown file into a concept. Native formats:.txt,.html,.htm,.csv,.json. For PDF/docx, the agent extracts the text and writes it vianew(the engine itself doesn't parse binaries). A# Citationssection records the source./okfm:scan— walk a repo or notes folder and propose what's worth importing and where, applying the capture filter. Proposes only; you confirm before anything is written.
-
/okfm:seed— create many concepts at once from a structured source. Three modes (auto-detected, or pass--mode):- sqlite — one
Tableconcept per table, with a# Schemacolumn listing. - openapi — one
API Endpointper path+method (OpenAPI), or oneSchemaper definition (JSON Schema). - tree — one
Fileconcept per file in a directory, preserving the directory structure; small text files embed their contents.
Seeding is offline and preview-gated. Generated concepts are marked
curated_by: agentand cite the source they came from. - sqlite — one
-
/okfm:enrich— grow a bundle from web pages you point it at. You provide seed URLs and a domain allowlist; for each page the agent decides whether to add a reference (underreferences/, with a citation) or skip it. See the honest note in Limitations about how its guardrails are enforced.
/okfm:check— validate the bundle (details below).--fixregenerates the index and normalizes frontmatter ordering, always behind a preview. It never deletes files and never rewrites your broken links for you./okfm:move— rename or relocate a concept and rewrite every inbound link across the bundle so nothing dangles.
/okfm:find— search by--text,--type,--tag, or--status, ranked, returning matches plus their linked concepts. This is keyword/field matching, not semantic (embedding) search./okfm:map— write a single self-contained HTML file (no dependencies, opens in any browser) that acts as an offline browser for the bundle: a search box, a directory-grouped concept list, a reader panel showing each concept's frontmatter/body/links/backlinks, a "needs attention" lens that surfaces the same findingscheckreports, and an optional graph view.
There is also an always-on okf conventions skill (not a command) that keeps the agent's edits inside a bundle source-preserving and link-safe.
The slash-commands above are the Claude Code surface, but the engine underneath is a plain command-line tool with no Claude dependency. okf <command> below means whichever of these your environment supports:
okf <command> # if the CLI is on your PATH
python okf.pyz <command> # build once: python build-okf-pyz.py
python /path/to/okf-manager/scripts <command> # run the engine directory in place
# Claude Code only:
python "${CLAUDE_PLUGIN_ROOT}/scripts" <command>okf --help lists commands; okf <command> --help shows a command's options. Subcommands: new, add, convert, seed, move, check, map, find, scan.
To use okfm from a non-Claude harness, point its instructions file (AGENTS.md, GEMINI.md, …) at the okf CLI. This repo ships those files already, plus USAGE.md — a self-contained operating manual any agent can follow with no skill system at all. enrich is the one flow that needs the harness's own web-fetch capability, since the engine never goes online.
check reports findings at three levels:
- Errors — a file with no parseable frontmatter, or frontmatter missing a non-empty
type. - Warnings — a markdown link pointing at a concept that doesn't exist (broken link), or a
log.mdwhose dated entries aren't newest-first. - Notes (advisory) — a concept listed in no index (index drift), a concept with no inbound links (orphan), a stale timestamp (older than the configured
stale_days, default 180), a root index missing itsokf_version, and an agent-curated concept with no# Citationssection.
A broken link is treated as "knowledge not yet written," so it's surfaced, never auto-deleted.
- Dependency-free. A stdlib Python 3 engine under
scripts/. Nopip, no server, no SDK. - Never destructive. Every write is previewed first. Hand-authored text, comments, frontmatter key order, and unknown frontmatter keys are preserved; the engine edits only the bytes that change.
- The engine owns two things. The nested
index.mdtree andlog.mdare regenerated/appended by the engine; everything else is yours. - Trust tiers. Machine-drafted concepts carry
curated_by: agent. When you review one, you flip it tocurated_by: human, so AI drafts never silently blend into verified knowledge. - Sync-agnostic. okfm manages the folder; you sync it however you like (git, a cloud-synced folder, Obsidian, Syncthing). It does no syncing of its own.
Do I need to be a developer?
No. /okfm:start is built for non-technical users, and a bundle is just markdown you can read and edit by hand. The structured-source features (seed from a database or API spec) are there if you want them, not required.
Does it work without Claude Code?
Yes. The engine is the okf CLI with no Claude dependency. Claude Code adds the /okfm:* slash-commands and the always-on conventions skill; Codex, Gemini, or a plain shell use the CLI plus USAGE.md / AGENTS.md.
Does it move my existing docs into the knowledge folder, or just point to them?
Content lives in the bundle — okfm doesn't index files in place. You have two honest options: import them (add/convert/seed copy the content in and add frontmatter), or keep your source docs where they are and author lightweight stub concepts that cite them. Pick import when the bundle should be the home; pick stubs when you want a thin, searchable layer over docs that stay put (a second layer to keep in sync, and the pointers aren't link-checked).
Will an agent read my knowledge base automatically?
No. There's no background retrieval or vector index. You point the agent at it with a line in CLAUDE.md/AGENTS.md (see Making agents use it). It's a maintained resource, not automatic RAG.
Is the search semantic?
No — find is ranked keyword/field matching (text, type, tag, status). There are no embeddings.
Does it sync across my devices? No. It manages the folder; you choose how to sync that folder (git, a cloud drive, Syncthing). okfm does no syncing of its own.
Is my data sent anywhere?
No. The engine is stdlib Python with no network calls. enrich is the one flow that fetches anything, and it uses your harness's web tool only on URLs you supply — so nothing leaves your machine unless you run enrich.
Can I use it with Obsidian?
Yes — a folder of markdown is a valid Obsidian vault. Set Obsidian to use Markdown links (not [[wikilinks]]) so check can read them.
What about PDFs or Word docs?
The engine doesn't parse binaries. The agent extracts the text first, then writes it with new/convert.
How is this different from a wiki, Notion, or a RAG pipeline? There's no server, database, or vendor — it's plain files in your repo, versioned with your code. And there's no vector index: okfm gives you a link-checked, indexed, searchable folder you point agents at, rather than automatic retrieval. The trade-off is that you (or an agent) decide what to capture and when to consult it.
How do I keep it from rotting?
Run check — it flags broken links, orphans, stale timestamps, index drift, and AI drafts that lack citations. Trust tiers (curated_by: agent → human) keep machine drafts from quietly passing as verified.
Things it deliberately does not do, so there are no surprises:
- Standard markdown links only.
checkreads[text](path.md)links (absolute-from-root or relative), which is what OKF requires. Obsidian[[wikilink]]syntax is not parsed. If you author in Obsidian, set it to use Markdown links socheckcan see them. enrich's limits are agent-followed, not code-enforced. The required allowlist, the 50-page cap, and the one-citation-per-page rule are instructions theenrichskill follows while it fetches. The Python engine never makes network requests, so these are guardrails on the agent's behavior, not hard limits checked in code.- HTML-to-markdown conversion is best-effort.
converthandles headings, paragraphs, lists, links, and tables with the standard library; complex pages won't round-trip perfectly. - No binary parsing. PDF/docx aren't read by the engine; the agent extracts text first.
findis keyword/field search, not semantic search — there are no embeddings or vector index.--fixis conservative. It regenerates indexes and normalizes frontmatter ordering. It does not retarget broken links or delete anything — those stay manual.- No automatic retrieval. Agents use the base only when their instructions point them at it; okfm won't inject it into a model's context on its own.
The engine has no third-party dependencies, and the tests use the standard-library unittest runner (no pytest):
# from the repo root
for t in tests/test_*.py; do python "$t" || break; doneAt the time of writing this is 143 tests across the tests/ directory. See AGENTS.md for the cross-harness operating and development notes.
Apache-2.0. See LICENSE.