Skip to content

Commit 97b7324

Browse files
duyetduyetbot
andauthored
feat(okf): add Open Knowledge Format plugin with author and refactor skills (#77)
Add the `okf` plugin for the Open Knowledge Format (OKF) v0.1 — a vendor-neutral format representing knowledge as markdown files with YAML frontmatter. - skills/okf: author, init, and validate OKF bundles; bundles the OKF v0.1 SPEC.md as an offline reference and a stdlib-only validate_okf.py. - skills/okf-refactor: convert existing notes/docs/catalog exports into a conformant, cross-linked OKF bundle. - Register in Claude and Codex marketplace manifests. Co-authored-by: duyetbot <duyetbot@users.noreply.github.com>
1 parent 0e08ae2 commit 97b7324

10 files changed

Lines changed: 698 additions & 0 deletions

File tree

.agents/plugins/marketplace.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,18 @@
267267
"authentication": "ON_INSTALL"
268268
},
269269
"category": "Productivity"
270+
},
271+
{
272+
"name": "okf",
273+
"source": {
274+
"source": "local",
275+
"path": "./okf"
276+
},
277+
"policy": {
278+
"installation": "AVAILABLE",
279+
"authentication": "ON_INSTALL"
280+
},
281+
"category": "Productivity"
270282
}
271283
]
272284
}

.claude-plugin/marketplace.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@
108108
"name": "kb",
109109
"source": "./kb",
110110
"description": "Knowledge base maintenance skills. Consolidate, dedupe, prune, refresh, and forget notes in a markdown KB."
111+
},
112+
{
113+
"name": "okf",
114+
"source": "./okf",
115+
"description": "Open Knowledge Format (OKF) tooling. Author, initialize, validate, and refactor knowledge into vendor-neutral OKF v0.1 bundles: markdown files with YAML frontmatter."
111116
}
112117
]
113118
}

marketplace.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,14 @@
186186
"version": "1.0.0",
187187
"type": "skill",
188188
"category": "productivity"
189+
},
190+
{
191+
"name": "okf",
192+
"id": "okf@duyet-claude-plugins",
193+
"description": "Open Knowledge Format (OKF) tooling. Author, initialize, validate, and refactor knowledge into vendor-neutral OKF v0.1 bundles: markdown files with YAML frontmatter.",
194+
"version": "1.0.0",
195+
"type": "skill",
196+
"category": "productivity"
189197
}
190198
],
191199
"metadata": {

okf/.claude-plugin/plugin.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"name": "okf",
3+
"version": "1.0.0",
4+
"description": "Open Knowledge Format (OKF) tooling. Author, initialize, validate, and refactor knowledge into vendor-neutral OKF v0.1 bundles: markdown files with YAML frontmatter.",
5+
"author": {
6+
"name": "duyet",
7+
"url": "https://github.com/duyet"
8+
},
9+
"homepage": "https://github.com/duyet/codex-claude-plugins",
10+
"repository": "https://github.com/duyet/codex-claude-plugins",
11+
"license": "MIT"
12+
}

okf/.codex-plugin/plugin.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "okf",
3+
"version": "1.0.0",
4+
"description": "Open Knowledge Format (OKF) tooling. Author, initialize, validate, and refactor knowledge into vendor-neutral OKF v0.1 bundles: markdown files with YAML frontmatter.",
5+
"author": {
6+
"name": "duyet"
7+
},
8+
"skills": "./skills/",
9+
"interface": {
10+
"displayName": "Open Knowledge Format",
11+
"shortDescription": "Author, validate, and refactor knowledge into OKF v0.1 bundles (markdown + YAML frontmatter).",
12+
"developerName": "duyet",
13+
"category": "productivity",
14+
"capabilities": ["Skill"],
15+
"links": {
16+
"homepage": "https://github.com/duyet/codex-claude-plugins"
17+
}
18+
}
19+
}

okf/README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# okf
2+
3+
Tooling for the **Open Knowledge Format (OKF)** — a vendor-neutral way to represent
4+
knowledge as plain markdown files with YAML frontmatter, organized in a directory
5+
hierarchy. A bundle is just a directory: version-controllable, portable, lock-in
6+
free, and readable by humans, LLMs, and any tool that speaks markdown (Obsidian,
7+
Notion, MkDocs, a static file server, a search index, a graph viewer).
8+
9+
Spec: [OKF v0.1](https://github.com/GoogleCloudPlatform/knowledge-catalog/blob/main/okf/SPEC.md)
10+
— bundled verbatim at `skills/okf/reference/SPEC.md` so the agent is grounded
11+
offline.
12+
13+
## Skills
14+
15+
- **okf** — author, initialize, and validate OKF bundles. Scaffolds the correct
16+
layout, writes concept docs with proper frontmatter, generates `index.md` /
17+
`log.md`, and ships `validate_okf.py` for OKF v0.1 conformance checks.
18+
- **okf-refactor** — convert existing knowledge (loose notes, wikis, README/docs,
19+
a catalog/metadata export, a database schema) into a conformant OKF bundle:
20+
one concept per file, cross-linked into a knowledge graph, with generated indexes.
21+
22+
## Install
23+
24+
```bash
25+
/plugin marketplace add duyet/codex-claude-plugins
26+
/plugin install okf@duyet-claude-plugins
27+
```
28+
29+
Alternative ([skills.sh](https://skills.sh)):
30+
31+
```bash
32+
npx skills add duyet/codex-claude-plugins
33+
```
34+
35+
## Usage
36+
37+
```text
38+
# Initialize a fresh bundle
39+
okf init an OKF bundle at ./bundles/my_catalog
40+
41+
# Author a concept
42+
okf add a BigQuery Table concept for the orders table
43+
44+
# Validate conformance
45+
python3 skills/okf/scripts/validate_okf.py ./bundles/my_catalog
46+
47+
# Refactor existing knowledge into OKF
48+
okf-refactor convert ./notes into an OKF bundle at ./bundles/notes
49+
```
50+
51+
## What conformance means (OKF v0.1)
52+
53+
1. Every non-reserved `.md` file has parseable YAML frontmatter.
54+
2. Every frontmatter block has a non-empty `type`.
55+
3. Reserved files (`index.md`, `log.md`) follow their structure and carry no
56+
frontmatter — except the bundle-root `index.md`, which may declare
57+
`okf_version: "0.1"`.
58+
59+
Consumers are required to tolerate unknown types, unknown keys, broken links, and
60+
missing indexes — so producing OKF is forgiving, and these skills aim to produce
61+
the disciplined, well-linked end of that spectrum.

okf/skills/okf-refactor/SKILL.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
---
2+
name: okf-refactor
3+
description: Refactor existing knowledge into an Open Knowledge Format (OKF) bundle — convert loose notes, docs, READMEs, wikis, or a catalog/metadata export into markdown concept files with YAML frontmatter, index.md, and a knowledge graph. Use when migrating existing knowledge to OKF, normalizing a notes folder, or exporting a catalog to OKF.
4+
---
5+
6+
# okf-refactor — convert existing knowledge into an OKF bundle
7+
8+
## Goal
9+
10+
Take knowledge that already exists in some other shape — a folder of loose
11+
markdown notes, a wiki, README/docs, a data-catalog export, a database schema, a
12+
JSON/CSV metadata dump — and emit a conformant **OKF v0.1** bundle: a directory of
13+
one-concept-per-file markdown docs with YAML frontmatter, navigable `index.md`
14+
files, and a cross-linked knowledge graph.
15+
16+
This skill depends on the **okf** skill for the format itself. Read
17+
`../okf/reference/SPEC.md` (the bundled OKF v0.1 spec) before refactoring — it is
18+
the source of truth. Use `../okf/scripts/validate_okf.py` to check the result.
19+
20+
## Inputs and outputs
21+
22+
- **Input** (`<src>`): a directory, file set, or export to read FROM. Treat it as
23+
immutable ground truth — never edit the source in place.
24+
- **Output** (`<out>`): the bundle directory to write TO. New, separate from `<src>`.
25+
26+
Confirm both paths before writing. If `<out>` is omitted, default to
27+
`./bundles/<name>` and state the choice.
28+
29+
## The refactor pass (run in order; plan before writing)
30+
31+
1. **Survey the source.** Inventory every item of knowledge and its natural
32+
boundaries. Identify what each "thing" is (a table, an endpoint, a concept, a
33+
runbook) — that becomes a concept's `type`. Note relationships between things
34+
(foreign keys, "see also", parent/child) — those become cross-links.
35+
36+
2. **Design the taxonomy = the directory layout.** Group concepts into top-level
37+
directories by `type` or domain (`tables/`, `datasets/`, `references/`,
38+
`concepts/`, `playbooks/`…). Start flat; nest only when a level earns it.
39+
Directories are the coarse taxonomy; frontmatter `tags` carry cross-cutting
40+
facets.
41+
42+
3. **Map each source item to one concept doc.** Atomic — one concept per file,
43+
`<group>/<slug>.md`, kebab-case stable slug. Never pack two concepts into one
44+
file; split multi-topic source notes.
45+
46+
4. **Write frontmatter for each concept.** Always set a non-empty `type`. Derive
47+
`title` and `description` (one line — this is what indexes show). Set
48+
`resource` to the canonical URI when the item has one. Map source metadata to
49+
`tags` and `timestamp`. Preserve any source-specific metadata as extra
50+
frontmatter keys (consumers tolerate unknown keys) rather than dropping it.
51+
52+
5. **Write the body.** Move structured fields under `# Schema` (prefer a table),
53+
runnable usage under `# Examples`, and sources under `# Citations`. Keep prose
54+
tight; favor structural markdown. Do not invent facts not present in the source.
55+
56+
6. **Wire the graph.** Convert every relationship into an inline markdown link
57+
using **absolute bundle-relative** paths (`[orders](/tables/orders.md)`).
58+
Ensure no concept is fully orphaned — each should link, or be linked by, at
59+
least one other where a real relationship exists.
60+
61+
7. **Mint reference docs.** External authoritative sources cited by many concepts
62+
become standalone `references/<slug>.md` concept docs (with their own `type`,
63+
e.g. `Reference`), linked from `# Citations`.
64+
65+
8. **Generate indexes.** Write an `index.md` per navigable directory (no
66+
frontmatter; group under `#` sections; copy each bullet's description from the
67+
linked concept). Write the bundle-root `index.md` with `okf_version: "0.1"`
68+
frontmatter linking the top-level groups.
69+
70+
9. **Seed `log.md`.** At the root, record an `## <YYYY-MM-DD>` entry noting the
71+
`* **Initialization**: Refactored from <source>.` Use the real current date.
72+
73+
10. **Validate.** Run `validate_okf.py <out>`. Fix every error. Broken
74+
cross-links are warnings (the spec tolerates them) — resolve the ones you can,
75+
report the rest.
76+
77+
## Fidelity rules
78+
79+
- **Lossless of meaning.** Restructuring may drop redundant words, never facts.
80+
If the source has metadata with no obvious home, keep it as a custom frontmatter
81+
key rather than discarding it.
82+
- **No invention.** Don't fabricate descriptions, schemas, or links the source
83+
doesn't support. Mark genuine gaps plainly instead of guessing.
84+
- **Source stays immutable.** All writes land in `<out>`; `<src>` is read-only.
85+
- **Idempotent-ish.** Re-running against the same source should converge on the
86+
same bundle, not accumulate duplicates.
87+
88+
## Report
89+
90+
After the pass, summarize: number of concepts emitted (by `type`/group), index and
91+
reference docs created, cross-links wired, and any unresolved gaps or broken links
92+
the source left dangling. Then show the bundle tree.
93+
94+
## Checklist
95+
96+
- [ ] Confirmed `<src>` (read-only) and `<out>` (new) paths.
97+
- [ ] Read ../okf/reference/SPEC.md before refactoring.
98+
- [ ] One concept per file; multi-topic notes split; stable kebab-case slugs.
99+
- [ ] Every concept has a non-empty `type`, plus `title` + `description`.
100+
- [ ] Relationships wired as absolute bundle-relative links; no true orphans.
101+
- [ ] Root index.md has `okf_version: "0.1"`; per-directory indexes generated.
102+
- [ ] log.md seeded with the initialization entry (real date).
103+
- [ ] validate_okf.py run; errors fixed; remaining broken links reported.
104+
- [ ] No facts invented; source-specific metadata preserved as custom keys.

0 commit comments

Comments
 (0)