@realchendahuang: 谷歌开源了一个开放知识格式,叫 OKF。它是用来给 AI 整理和交换业务知识的。 写代码、做客服时,退款政策、业务口径这些规则都散落在文档和聊天记录里,OKF 把它们统一打包成标准文件,让人和不同的 AI 工具都能直接读懂。 它的原理就是…
摘要
谷歌开源了 Open Knowledge Format(OKF),一种用带 YAML frontmatter 的普通 Markdown 目录来组织业务知识的开放标准,供人和各类 AI 工具统一读取与交换知识,支持版本控制、来源可信度与过期标注,并可绑定脚本执行固定指标计算。
查看缓存全文
缓存时间: 2026/11/23 13:03
谷歌开源了一个开放知识格式,叫 OKF。它是用来给 AI 整理和交换业务知识的。
写代码、做客服时,退款政策、业务口径这些规则都散落在文档和聊天记录里,OKF 把它们统一打包成标准文件,让人和不同的 AI 工具都能直接读懂。
它的原理就是普通的 Markdown 文件夹。每篇文档开头加几行标签,标清楚类型、来源、谁审过、什么时候过期;每个目录放一个 index.md 做索引,文档之间用链接串起来。
AI 查资料时先看目录,需要哪块再一层层往下翻,不用一次把所有文档都塞进上下文。算毛利、退款率这类指标,还可以直接绑上固定脚本,不让 AI 自己乱写 SQL。
有了统一格式,团队写一份知识库,编码 Agent、客服 Agent 和搜索引擎都能直接用,换工具也不用重新适配。
github:
open-knowledge-format/open-knowledge-format
Source: https://github.com/open-knowledge-format/open-knowledge-format
Open Knowledge Format (OKF)
📖 Read the Open Knowledge Format v0.3 specification → SPEC.md
This repository is primarily about the Open Knowledge Format (OKF).
OKF is a universal, vendor-neutral format for representing knowledge as plain markdown files with YAML frontmatter. It is not tied to any particular agent, framework, model provider, or serving system. The goal is simple:
- Anyone can produce OKF — humans authoring by hand, agents built on any framework (Google ADK, LangChain, custom), export pipelines from existing catalogs (Dataplex, Unity Catalog, Collibra, …), or scripts walking a database.
- Anyone can serve and consume OKF — a static file server, a knowledge-management UI (Obsidian, Notion, MkDocs), an LLM loading files into context, a search index, or a graph viewer like the one bundled in this repo.
The agent below is a proof of concept demonstrating one way to produce OKF bundles automatically. The format itself is the contribution; this agent and the visualizer exist to make the format tangible at both ends — production and consumption.
See OKF in practice — ready-to-browse bundles checked into
bundles/. The first three were produced by this agent; Acme Retail is hand-written and shows attested computations:
bundles/ga4/— GA4 e-commerce dataset (viz.html)bundles/stackoverflow/— Stack Overflow public dataset (viz.html)bundles/crypto_bitcoin/— Bitcoin blocks/transactions (viz.html)bundles/acme_retail/— Acme Retail finance metrics with attested computations (viz.html)Use OKF with other standards — use cases show how OKF pairs with an existing standard. See Use cases.
Why OKF?
OKF represents catalog knowledge as plain markdown files with YAML frontmatter, organized in a directory hierarchy. That choice unlocks a few properties that are hard to get from a service-owned metadata store:
- Human- and agent-readable. No SDK or query language stands between a
reader and the content. An engineer can
cata concept; an LLM can ingest it verbatim into context. - Version-controllable out of the box. Bundles live in git. Pull requests, line-by-line diffs, blame, and review workflows just work — knowledge curation becomes a normal software-engineering activity.
- Portable and lock-in free. A bundle is a directory. Ship it as a tarball, host it in any repo, mount it from any filesystem, or sync it to any system that speaks files. No proprietary API stands between you and your metadata.
- Mixes structured and unstructured data deliberately. Use frontmatter
for the few fields you want to query, filter, or index on (
type,resource,tags,generated,status); use the markdown body for the prose, schemas, and example queries that LLMs and humans actually read. - Trust, provenance, and freshness are first-class. OKF puts queryable
signals in frontmatter — where a concept came from (
sourceswith per-source credibility signals), who produced and confirmed it (generated,verified, from which consumers derive a trust tier), and whether it is still current (status,stale_after) — so an agent-maintained corpus stays trustable without any bespoke runtime. - Numbers can be attested. An
Attested Computationconcept carries the sanctioned computation, its typed parameters, and a deterministic attester, so a consumer can check that an agent ran the approved query rather than one it wrote itself. - Minimally opinionated, freely extensible. A small set of required keys ensures interoperability, but bundles can carry arbitrary extra frontmatter keys and arbitrary body sections without breaking consumers.
- Composes with existing tooling. Many knowledge tools — Notion, Obsidian, MkDocs, Hugo, Jekyll — already speak markdown plus YAML frontmatter, so bundles can be browsed, edited, or rendered without custom UI.
- Progressive disclosure built in. Auto-generated
index.mdfiles let an agent or human navigate the hierarchy one level at a time instead of loading the entire bundle into context. - Graph-shaped, not just tree-shaped. Concepts link to each other via normal markdown links, expressing relationships richer than the parent/child implied by the directory layout.
The net effect is that reference agents, consumption agents, and humans collaborate on the same artifacts in the same way they already collaborate on source code.
Use cases
OKF is deliberately minimal. It refers to domain standards such as Avro, Protobuf, or OpenAPI rather than absorbing them. When your organization already has an artifact in another standard — a schema, a contract, a semantic model — a use case shows what the OKF concept next to it should say, and how an agent should use the two together. Each one explains:
- Where the boundary sits: what belongs in the other standard and what belongs in OKF.
- How to link the two: which frontmatter and link conventions point from a concept into the other artifact.
- What an agent should do with the combination.
- A complete worked example you can copy.
Use cases are layered on the core spec, not part of it. A bundle that ignores them is still a conformant OKF bundle. When a convention proves itself across several use cases, it can be proposed for the core spec.
Each use case has its own folder, named usecases/<usecase>/. The guide
is a .md file in that folder, and any sample bundles or artifacts sit
next to it.
Propose a use case. If you pair OKF with a standard, open a pull
request that adds a folder under usecases/ with a .md file in it. A
rough first draft is welcome; we’ll refine it together in review.
Install
python3.13 -m venv .venv
.venv/bin/pip install --index-url https://pypi.org/simple/ -e .[dev]
Credentials
- BigQuery:
gcloud auth application-default loginplus a project for billing (gcloud config set project <id>). Public datasets are readable, but the caller’s project is billed for query bytes. - Gemini: set
GEMINI_API_KEY(AI Studio) or use Vertex AI by settingGOOGLE_GENAI_USE_VERTEXAI=true,GOOGLE_CLOUD_PROJECT=<id>, andGOOGLE_CLOUD_LOCATION=<region>.
How the reference agent works
The reference agent runs in two passes. The BQ pass writes one OKF
doc per concept the source advertises, using BigQuery metadata alone.
The web pass then runs the LLM as its own crawler: it receives a
list of seed URLs (provided via --web-seed or --web-seed-file),
fetches the seeds via the fetch_url tool, and decides which outbound
links are worth following based on whether they look like authoritative
documentation for the existing concepts. For each page it fetches, the
agent chooses to (a) enrich one or more existing concept docs, (b) mint
a standalone references/<slug> doc, or (c) skip. A hard
--web-max-pages cap and a same-domain allowed-hosts filter
(configurable via --web-allowed-host) are enforced inside the tool,
so the agent cannot overrun. Use --no-web to skip the web pass.
Run
Minimum invocation — point at a BigQuery dataset and a bundle output
directory. Seeds for the web pass are explicit; omit them (or pass
--no-web) to run BQ-only:
.venv/bin/python -m reference_agent enrich \
--source bq \
--dataset <project>.<dataset> \
--web-seed-file <path/to/seeds.txt> \
--out ./bundles/<name>
Iterate on a single concept by adding --concept <type>/<name> (e.g.
--concept tables/events_); repeatable.
Samples
Each sample pairs a recipe (samples/<name>/, with the seed URLs and
exact enrich command) with the produced bundle (bundles/<name>/)
that the recipe generated. Open the recipe to reproduce; open the bundle
to browse the result directly.
- GA4 Google Merchandise Store — public e-commerce dataset, seeded with canonical GA4 BigQuery Export documentation URLs. · recipe · bundle · viz.html
- Stack Overflow — public dataset (mirror of the Stack Exchange Data Dump), seeded with the community’s canonical schema references. Exercises multi-concept enrichment from cross-cutting docs pages. · recipe · bundle · viz.html
- Bitcoin (crypto) — public dataset (blocks, transactions, inputs,
outputs) from the
bitcoin-etlpipeline. Exercises cross-table foreign-key relationships in prose. · recipe · bundle · viz.html
Visualize
The visualize subcommand renders any OKF bundle as a self-contained
interactive HTML file — one file, no backend, no install on the
viewing side. Open it in any modern browser, share it as an artifact,
host it on a static file server, or commit it next to the bundle (as
this repo does).
The viewer is itself a proof-of-concept consumer of OKF, mirroring the way the reference agent is a proof-of-concept producer. OKF bundles can be consumed by anything that reads markdown; this is just one shape.
What it shows
- A force-directed graph of every concept in the bundle, with colored nodes by type (datasets, tables, references, …) and directed edges drawn from each cross-link in the markdown bodies.
- A detail panel for the selected concept showing its frontmatter
(description, resource link, tags) and its rendered markdown body —
with internal links (relative, or
/-rooted at the bundle root) rewired to navigate within the viewer instead of following the path. - A “Cited by” backlinks list under each concept (computed from the reverse of the link graph).
- A search box (matches title, concept id, and tags), a type filter, and switchable graph layouts (cose / concentric / breadth-first / circle / grid).
Generate
.venv/bin/python -m reference_agent visualize --bundle ./bundles/<name>
That writes bundles/<name>/viz.html. Flags:
| Flag | Default | Description |
|---|---|---|
--bundle | (required) | Bundle root directory. |
--out | <bundle>/viz.html | Output HTML path. |
--name | bundle directory name | Display name shown in the viewer header. |
Example, writing the output somewhere else and overriding the header:
.venv/bin/python -m reference_agent visualize \
--bundle ./bundles/crypto_bitcoin \
--out /tmp/btc.html \
--name "Bitcoin OKF"
How it’s built
The HTML embeds the bundle as a JSON blob and uses Cytoscape.js for the graph and marked for in-browser markdown rendering, both loaded from a CDN. No data leaves the page; the bundle is parsed once at generation time and serialized into the file.
Agent skills
The skills/ directory holds two Agent Skills
that teach coding agents to work with OKF:
okf-generatewrites, updates, or migrates an OKF bundle from sources that the agent can read, and validates the result withscripts/validate.py.okf-consumeanswers questions from a bundle and reports the trust tier, freshness, and attestation status of each concept that the answer uses.
Install the skills as a plugin in Claude Code, Codex, or Antigravity:
| Tool | Install |
|---|---|
| Claude Code | /plugin marketplace add open-knowledge-format/open-knowledge-format, then /plugin install okf@open-knowledge-format |
| Codex CLI | codex plugin marketplace add open-knowledge-format/open-knowledge-format, then codex plugin add okf@open-knowledge-format |
| Antigravity CLI 1.3.2 or later | agy plugin install https://github.com/open-knowledge-format/open-knowledge-format |
A tool without plugin support can load a skill from its skills directory. Copy
a folder from skills/ to ~/.agents/skills/ for the Codex IDE extension, or
to ~/.gemini/config/skills/ for the Antigravity app and IDE.
Tests
.venv/bin/pytest
相似文章
@wey_gu: Google Cloud 的 Open Knowledge Format 非常棒,标准化了受 LLM-Wiki 启发的分层级、有关系的文本知识的结构,我非常喜欢这个标准
Google Cloud 推出了 Open Knowledge Format (OKF),这是一个开放规范,用于标准化 LLM-Wiki 模式,以便在 Markdown 中使用 YAML 前置元数据表示结构化知识,旨在改善 AI 代理的数据共享和互操作性。
Introducing the Open Knowledge Format(9分钟阅读)
谷歌云推出开放知识格式(Open Knowledge Format,OKF),这是一种用于在Markdown文件中表示元数据和精选知识的开放规范,以改善数据共享并为AI代理提供上下文。该格式旨在使来自碎片化内部系统的知识具有可移植性和互操作性。
@Saboo_Shubham_: Google刚刚推出了Open Knowledge Format。一个基于Karpathy的LLM w…为AI代理提供上下文的开放标准。
Google宣布了Open Knowledge Format,这是一个基于Karpathy的LLM wiki概念的开放标准,旨在通过简单的Markdown文件为AI代理提供上下文。
@midudev:谷歌刚刚推出了 Open Knowledge Format。一个在人类与AI代理之间共享知识的开放标准,…
谷歌发布了 Open Knowledge Format,这是一个基于 Markdown 的开放标准,用于在人类和 AI 代理之间共享知识,充当一个活的企业 wiki。
@AlphaSignalAI: LLM 知识库 最近我发现非常有用的东西:使用 LLM 为各种研究兴趣主题构建个人知识库...
Google 的开放知识格式(OKF)提出了一种可移植的组织知识标准,帮助 AI 代理检索正确的上下文,解决了数据目录、维基和代码之间的碎片化问题。