OKF (开放知识格式): 适用于 AI 代理的持久、结构化存储。作者、验证、消费和共享。
Site · Docs · Live demo · Claude plugin · Docker image
Your coding agent works out how your system fits together — why the service exists, what the metric actually measures, which line of the schema is load-bearing — and then the session ends and all of it is gone. Next session it works the same things out again, from the same code, and reaches slightly different conclusions.
okf gives that reasoning somewhere to live. Plain Markdown files in your repo, next to the code they explain, written and kept current by the agent itself rather than by you.
It adds nothing to your stack. No database, no service, no new place to keep knowledge — just files, reviewed in the same pull request as the code. If you stop using okf tomorrow, everything it wrote is still Markdown your team can read.
This repository documents itself in OKF, so you can walk a real bundle before installing anything:
gem install okf
git clone https://github.com/serradura/okf && cd okf
okf server .okf # the whole ecosystem as an interactive graphNo Ruby on the machine? The published image runs the same commands — docker.okfgem.com. Or skip the clone entirely and open demo.okfgem.com.
Notes decay because keeping them current is a separate act from doing the work. Here it isn't:
okf validate and okf lint return exit codes,
so a stale or malformed bundle breaks CI the same way a broken test does.okf index reads the map and
okf search pulls the handful of files a task touches, so the knowledge
outgrows the context window instead of filling it.Knowledge already has several homes near an agent, and each holds something different. None of the others is built for curated, durable team knowledge:
| OKF bundle (this) | CLAUDE.md / AGENTS.md |
Agent auto-memory | Wiki / Notion | |
|---|---|---|---|---|
| Holds | curated team knowledge | standing instructions | what one agent picked up | human docs |
| Versioned with the code | ✅ | ✅ | ❌ | ❌ |
| Portable across agents | ✅ plain Markdown + YAML | ⚠️ per-harness conventions | ❌ per-agent store | ⚠️ export needed |
| Typed and queryable | ✅ frontmatter + graph | ❌ prose | ❌ | ⚠️ partially |
| Reviewed in PRs | ✅ | ✅ | ❌ implicit | ⚠️ rarely |
| Scales past one context window | ✅ progressive disclosure | |||
(okf index + search) |
❌ loaded whole | ⚠️ partially | n/a | |
| Checked by tooling | ✅ exit codes for CI | |||
(okf validate + lint) |
❌ | ❌ | ❌ |
The last two rows are this gem's job.
OKF is an open, vendor-neutral format (Google Cloud, 2026). This repository is a complete implementation of it, distributed as four gems, a Docker image, and a Claude Code plugin.
A bundle is just a directory; each concept is one Markdown file whose path is its id. This repo documents itself in OKF, so the tree below is real:
.okf/
├── index.md # progressive-disclosure map (root carries okf_version)
├── log.md # ISO-dated change history, newest first
├── overview.md
├── gems/okf-mcp.md # one concept = one file
├── decisions/monorepo-layout.md
└── format/frontmatter.mdThe only hard requirement is YAML frontmatter with a non-empty type; everything
else is optional and tolerated when missing. A concept reads as below — this is
the real capabilities/graph-server.md from the baseline gem's own bundle,
gems/okf/.okf/, with its body trimmed:
---
type: Capability
title: Interactive graph server (server)
description: A self-contained HTML knowledge graph — served over HTTP as a mountable Rack app, one bundle or many behind a hub, or written to a single static file.
resource: gems/okf/lib/okf/server/app.rb
tags: [server, graph, rack, diagram]
generated:
by: human:maintainer
at: 2026-08-13T12:00:00Z
---
# Overview
`okf server` boots an interactive view of the [graph](../model/graph.md) …The .okf/ above is the ecosystem's map — a concept per gem, per plugin
item, per skill — and each gem carries its own bundle beside its code. Clone the
repo and run okf server .okf to browse the map as an interactive graph, or
okf server gems/okf/.okf for the baseline gem's.
Knowledge written continuously by agents raises questions a static corpus never
had to answer: who wrote this, who checked it, is it still current? OKF v0.2
makes them frontmatter — generated (who produced the content, and when),
verified (who confirmed it, deriving the trust tier every surface shows:
unverified · machine-confirmed · human-reviewed), sources with per-claim
footnote attribution, status, and stale_after — and this gem reads all of
it: as catalog columns and --status/--trust filters,
as the graph page's third visual channel, and as
lint's provenance, attestation and
migration findings. Every family is optional, and a v0.1 bundle keeps reading
forever — two lint findings tell you exactly what a migration would change,
and never fail you for not having done it.
Knowledge an agent writes dies in four places, and a tool that fixes one of them only gets to watch it die in the next. It never gets written, because writing it up is a separate act from doing the work. It rots, and nothing says so until someone acts on a claim that stopped being true. It cannot be found, because the corpus outgrew the person who would have to read it all. And it is stuck in whichever tool wrote it, so the next tool starts over.
The pieces below are one answer per failure. They are separate gems because they install separately, not because they are separate products: every one of them reads the same folder of Markdown, none of them is required by any other, and what you would lose by dropping all of them is tooling, never the knowledge.
One install — gem install okf — carries three pieces:
validate and lint answer with
exit codes CI already knows how to fail on;Three sibling gems extend that same command rather than adding another one:
okf mcp (okf-mcp), so the knowledge is not stuck in whichever terminal wrote it: any MCP host reads it with no shell and nothing pasted into context — fourteen read tools, over stdio or Streamable HTTP;okf tui (okf-tui), so looking around costs a keystroke instead of four commands: six views over one bundle or every registered one, and you can read one while searching all of them;okf pro (okf-pro), so the practice holds on the days nobody is watching: it writes an agent's knowledge repository and then refuses to let it rot, at three doors that each fail closed.gem install okf-pro and you type okf pro. Packaging multiplies; the
interface does not, and a sibling ships no second binary to learn.
Nobody stops at one. The service you documented last month, the team handbook, the gem you maintain on the side — each is its own bundle in its own repository, and that is the right answer rather than a filing problem to clean up later.
So a bundle gets a name. okf registry set ./handbook makes it @handbook,
and anywhere a directory goes a @slug goes: okf lint @handbook, okf render @handbook -o graph.html. Groups collect the ones you think about together, and
@all reaches every one you have registered — so the same four commands hold
your whole corpus at once instead of one bundle of it:
okf search @all "rate limit" # every bundle, ranked together in one list
okf server # all of them behind one hub, in the browser
okf tui # all of them in one terminal UI
okf mcp # all of them, to any MCP hostA project-local .okf.json replaces the machine-wide registry while you stand
inside that repository. That is how this monorepo addresses its own five bundles
as @okf-eco, @okf, @okf-mcp, @okf-tui and @okf-pro without anyone's
~/.okf ever hearing about them.
Everything above the first divider is what one gem install okf gives you.
Everything below it arrives through the same plugin seam, one gem at a time, and
every door is listed in
What is in this repository.
[!TIP] Browse this repository as knowledge, not just docs. This README is the front door; the depth lives in the five OKF bundles it carries. Start at the ecosystem map — the gems, the plugin, the skills, the decisions and the format itself — then open a gem's own bundle for its code:
gems/okf/.okf/. Runokf server .okfto walk the map as an interactive graph, orokf search @allto reach every bundle at once.
It installs on the Ruby your OS already ships — every Ruby since 2.4, three small dependencies, no native extension and no build step — so there is nothing to provision and nothing to keep up to date. The design constraints that hold that line are enforced by tests on every supported Ruby.
Every top-level name is a boundary, and the whole menu is one row each. A
directory under gems/ is a gem, named for the gem it ships; everything else at
the root is named for what it is.
| Door | What lives there |
|---|---|
gems/okf/ |
the okf gem — the agent skill, the CLI and library, ranked search, the graph. Everything above describes this one |
gems/okf-mcp/ |
okf mcp — the MCP server over the same kernel: 14 read tools, any MCP host |
gems/okf-tui/ |
okf tui — the full-screen terminal UI, over one bundle or every registered one |
[gems/okf-pro/](gems/okf-pro/READM |
暂无开放 Issues,或尚未同步最近议题。