feat(write-OKF): conform OKF contract to Google OKF v0.1 spec

feat(write-OKF): require type frontmatter on every page; okf_version in
index; conformance block + page-type vocabulary in okf-layout.md
feat(write-OKF): rename INDEX.md to reserved lowercase index.md across
templates and cross-referencing skills
feat(blueprint): add type: Blueprint to blueprint-format frontmatter
feat(ferry): add type: Ferry Map / Decision to decision-format
docs(write-OKF): cite Google OKF v0.1 spec alongside Karpathy and
LangChain OpenWiki in the layout contract
This commit is contained in:
Łukasz Boryń 2026-07-20 00:41:43 +02:00
parent 04db0c1503
commit 07afbe8473
14 changed files with 80 additions and 32 deletions

View File

@ -44,7 +44,7 @@ _Avoid_: Client, buyer, account.
**Single context (most repos):** one `OKF/CONTEXT.md`. **Single context (most repos):** one `OKF/CONTEXT.md`.
**Multi-context:** glossaries split into `OKF/context/<subroot>.md` — **Multi-context:** glossaries split into `OKF/context/<subroot>.md` —
one per bounded context — with a Contexts section in `OKF/INDEX.md` one per bounded context — with a Contexts section in `OKF/index.md`
listing them and how they relate: listing them and how they relate:
```md ```md
@ -64,7 +64,7 @@ listing them and how they relate:
``` ```
Decision rule: Decision rule:
- If `OKF/context/` exists → multi-context. Read INDEX.md to find contexts. - If `OKF/context/` exists → multi-context. Read index.md to find contexts.
- Else if `OKF/CONTEXT.md` exists → single-context. - Else if `OKF/CONTEXT.md` exists → single-context.
- Else (neither) → create `OKF/CONTEXT.md` lazily when the first term - Else (neither) → create `OKF/CONTEXT.md` lazily when the first term
is resolved. Switch to multi-context only on observing ≥ 2 obvious is resolved. Switch to multi-context only on observing ≥ 2 obvious

View File

@ -48,7 +48,7 @@ habit any skill can do; that's not this skill.
OKF/ # open-knowledge-format wiki (see write-OKF) OKF/ # open-knowledge-format wiki (see write-OKF)
├── CONTEXT.md # single-context default — THE canonical glossary ├── CONTEXT.md # single-context default — THE canonical glossary
├── context/ # multi-context mode: one <subroot>.md per ├── context/ # multi-context mode: one <subroot>.md per
│ └── <subroot>.md # bounded context, indexed from OKF/INDEX.md │ └── <subroot>.md # bounded context, indexed from OKF/index.md
└── adr/ └── adr/
└── 0001-<slug>.md └── 0001-<slug>.md
``` ```
@ -64,7 +64,7 @@ Default is single-context. Switch to **multi-context mode** only on
observing **≥ 2 obvious sub-roots** (e.g. `R/ingest/`, `R/analysis/`; observing **≥ 2 obvious sub-roots** (e.g. `R/ingest/`, `R/analysis/`;
`src/ordering/`, `src/billing/`) *and* a second resolved term clearly `src/ordering/`, `src/billing/`) *and* a second resolved term clearly
belonging to one of them — then propose `OKF/context/<subroot>.md` files belonging to one of them — then propose `OKF/context/<subroot>.md` files
indexed from `OKF/INDEX.md`. **The split axis is the bounded context indexed from `OKF/index.md`. **The split axis is the bounded context
(stable), never the issue (transient)** — issue-local terms live in their (stable), never the issue (transient)** — issue-local terms live in their
`OKF/blueprints/` entry until they recur, then get promoted here. `OKF/blueprints/` entry until they recur, then get promoted here.

View File

@ -35,7 +35,7 @@ blueprint with justification. The interview happened upstream
done-gate runs exactly this. done-gate runs exactly this.
4. **Show the blueprint**; iterate. On explicit user yes → flip status to 4. **Show the blueprint**; iterate. On explicit user yes → flip status to
`locked`. No yes, no lock. `locked`. No yes, no lock.
5. **Index it** — add `NNN — <title> — <status>` to `OKF/INDEX.md` 5. **Index it** — add `NNN — <title> — <status>` to `OKF/index.md`
Blueprints section. Blueprints section.
6. **Seal** via [commit-atomic-jj](../../productivity/commit-atomic-jj/SKILL.md): 6. **Seal** via [commit-atomic-jj](../../productivity/commit-atomic-jj/SKILL.md):
`docs(blueprint): add NNN <slug>`. `docs(blueprint): add NNN <slug>`.
@ -47,7 +47,7 @@ with a new number instead. The "tracker" is
`grep -r "^status:" OKF/blueprints/`. `grep -r "^status:" OKF/blueprints/`.
## Output / done criteria ## Output / done criteria
- Blueprint exists, matches blueprint-format.md, indexed in INDEX.md. - Blueprint exists, matches blueprint-format.md, indexed in index.md.
- Justification traces to a real source; Verify is runnable. - Justification traces to a real source; Verify is runnable.
- Locked only on explicit user approval. - Locked only on explicit user approval.

View File

@ -2,6 +2,7 @@
```markdown ```markdown
--- ---
type: Blueprint
status: draft | locked | implemented | superseded-by-NNN status: draft | locked | implemented | superseded-by-NNN
traces-to: ROADMAP.md phase N | ferries/<topic>/D-<n> | user request <date> traces-to: ROADMAP.md phase N | ferries/<topic>/D-<n> | user request <date>
--- ---
@ -36,6 +37,8 @@ up in the diff.>
## Rules ## Rules
- Title is imperative — a blueprint names a change, not a state. - Title is imperative — a blueprint names a change, not a state.
- `type: Blueprint` is the OKF-v0.1 conformance field (see
[write-OKF/okf-layout.md](../write-OKF/okf-layout.md)) — always first.
- `traces-to` is mandatory; a blueprint that traces to nothing fails - `traces-to` is mandatory; a blueprint that traces to nothing fails
[sieve](../../engineering/sieve/SKILL.md)'s Real test by definition. [sieve](../../engineering/sieve/SKILL.md)'s Real test by definition.
- Locked blueprint's Contract/Verify sections are immutable — supersede, don't - Locked blueprint's Contract/Verify sections are immutable — supersede, don't

View File

@ -3,6 +3,10 @@
## MAP.md — `OKF/ferries/<topic>/MAP.md` ## MAP.md — `OKF/ferries/<topic>/MAP.md`
```markdown ```markdown
---
type: Ferry Map
---
# ferry — <topic> # ferry — <topic>
Destination: <one sentence — what "the way is clear" means>. Destination: <one sentence — what "the way is clear" means>.
@ -18,6 +22,7 @@ Destination: <one sentence — what "the way is clear" means>.
```markdown ```markdown
--- ---
type: Decision
status: open | resolved | superseded-by-D-<m> status: open | resolved | superseded-by-D-<m>
blocked-by: [D-1, D-2] # empty list if unblocked blocked-by: [D-1, D-2] # empty list if unblocked
--- ---
@ -42,6 +47,8 @@ Append-only — a changed mind is a new decision superseding this one.>
## Rules ## Rules
- One genuine decision per file; a compound question splits. - One genuine decision per file; a compound question splits.
- `type:` frontmatter (`Ferry Map` / `Decision`) is the OKF-v0.1
conformance field — always first.
- `blocked-by` edges must be acyclic — check when adding, not when stuck. - `blocked-by` edges must be acyclic — check when adding, not when stuck.
- Status flips only with a filled Resolution; Resolution never edited - Status flips only with a filled Resolution; Resolution never edited
after — supersede with a new decision instead. after — supersede with a new decision instead.

View File

@ -18,7 +18,7 @@ superpowers' subagent-driven-development, jj-native.
## Preconditions (check, don't assume) ## Preconditions (check, don't assume)
- The blueprint exists and `status: locked` — `draft` → back to blueprint for - The blueprint exists and `status: locked` — `draft` → back to blueprint for
the user's lock; none named → list locked blueprints, ask which. the user's lock; none named → list locked blueprints, ask which.
- `OKF/INDEX.md` read; the OKF pages the blueprint references read. - `OKF/index.md` read; the OKF pages the blueprint references read.
## Process ## Process
1. **Frame** — restate the blueprint's Contract section in one sentence; list its 1. **Frame** — restate the blueprint's Contract section in one sentence; list its
@ -40,7 +40,7 @@ superpowers' subagent-driven-development, jj-native.
message body cites `blueprint NNN`. Fix + regression test in the same message body cites `blueprint NNN`. Fix + regression test in the same
change. change.
6. **Close the loop** — flip blueprint status to `implemented`; update its 6. **Close the loop** — flip blueprint status to `implemented`; update its
INDEX.md line; tick the roadmap item via index.md line; tick the roadmap item via
[architect](../architect/SKILL.md) revise mode; wiki-worthy learnings [architect](../architect/SKILL.md) revise mode; wiki-worthy learnings
→ `OKF/LEARNINGS.md` ([write-OKF](../write-OKF/SKILL.md) refresh if → `OKF/LEARNINGS.md` ([write-OKF](../write-OKF/SKILL.md) refresh if
pages went stale). pages went stale).

View File

@ -8,7 +8,8 @@ disable-model-invocation: true
The OKF is a Karpathy-LLM-wiki-style knowledge substrate: dense synthesis, The OKF is a Karpathy-LLM-wiki-style knowledge substrate: dense synthesis,
not raw dumps; agents read it *before* code; every page inspectable, not raw dumps; agents read it *before* code; every page inspectable,
versioned, agent-maintained. Layout contract: [okf-layout.md](okf-layout.md). versioned, agent-maintained. Layout and Google-OKF-v0.1 conformance
contract: [okf-layout.md](okf-layout.md).
## When to use ## When to use
- User says "scribe OKF", "/write-OKF", "set up the knowledge folder", - User says "scribe OKF", "/write-OKF", "set up the knowledge folder",
@ -26,9 +27,10 @@ versioned, agent-maintained. Layout contract: [okf-layout.md](okf-layout.md).
## Scaffold mode ## Scaffold mode
1. **Confirm the first write** — creating `OKF/` in a repo is a new 1. **Confirm the first write** — creating `OKF/` in a repo is a new
convention; get a yes before writing anything. convention; get a yes before writing anything.
2. Materialise the skeleton from [templates/](templates/) — headers and 2. Materialise the skeleton from [templates/](templates/) — headers,
`TODO(scribe)` markers only. **Never invent facts**: an empty section `type` frontmatter, and `TODO(scribe)` markers only. **Never invent
with a TODO beats a fabricated architecture claim. facts**: an empty section with a TODO beats a fabricated architecture
claim.
3. Fill only what is *derivable from disk right now*: SUMMARY from an 3. Fill only what is *derivable from disk right now*: SUMMARY from an
existing README, ARCHITECTURE bones from the directory tree and existing README, ARCHITECTURE bones from the directory tree and
manifests, ROADMAP/CONTEXT stay TODO until manifests, ROADMAP/CONTEXT stay TODO until
@ -49,13 +51,13 @@ versioned, agent-maintained. Layout contract: [okf-layout.md](okf-layout.md).
[architect/revise.md](../architect/revise.md) discipline. [architect/revise.md](../architect/revise.md) discipline.
4. Every ARCHITECTURE.md claim must be **traceable to a file** — cite 4. Every ARCHITECTURE.md claim must be **traceable to a file** — cite
`path` (or `path:line`) inline. A claim you can't cite doesn't go in. `path` (or `path:line`) inline. A claim you can't cite doesn't go in.
5. Keep `INDEX.md` complete: every page and every `blueprints/` entry 5. Keep `index.md` complete: every page and every `blueprints/` entry
listed, one line each (`NNN — title — status`); every ferry one line listed, one line each (`NNN — title — status`); every ferry one line
(`<topic> — n/m resolved → MAP.md`) — decisions stay in MAP.md only. (`<topic> — n/m resolved → MAP.md`) — decisions stay in MAP.md only.
## Output / done criteria ## Output / done criteria
- `OKF/` matches [okf-layout.md](okf-layout.md); `INDEX.md` links every - `OKF/` matches [okf-layout.md](okf-layout.md) including its
page that exists. conformance block; `index.md` links every page that exists.
- `AGENTS.md` carries the hook block. - `AGENTS.md` carries the hook block.
- Scaffold: no fabricated content — unfillable sections carry - Scaffold: no fabricated content — unfillable sections carry
`TODO(scribe)`. `TODO(scribe)`.

View File

@ -6,10 +6,10 @@ never overwrite existing prose). `<project>` substituted from SUMMARY.md.
```markdown ```markdown
## Knowledge — read before you code ## Knowledge — read before you code
This project keeps an agent-first wiki at [`OKF/`](OKF/INDEX.md) This project keeps an agent-first wiki at [`OKF/`](OKF/index.md)
(open-knowledge-format). Before extending or modifying <project>: (open-knowledge-format). Before extending or modifying <project>:
1. Read [`OKF/INDEX.md`](OKF/INDEX.md), then the pages it flags for your 1. Read [`OKF/index.md`](OKF/index.md), then the pages it flags for your
task — at minimum `SUMMARY.md`; `ARCHITECTURE.md` before structural task — at minimum `SUMMARY.md`; `ARCHITECTURE.md` before structural
work. work.
2. Use the canonical vocabulary from [`OKF/CONTEXT.md`](OKF/CONTEXT.md) 2. Use the canonical vocabulary from [`OKF/CONTEXT.md`](OKF/CONTEXT.md)

View File

@ -1,18 +1,21 @@
# OKF layout contract # OKF layout contract
OKF = **open-knowledge-format**: a file-based, agent-first project wiki at OKF = **open-knowledge-format**: a file-based, agent-first project wiki at
the repo root. Inspired by Karpathy's LLM-wiki pattern (precomputed the repo root. Conforms to Google's [OKF v0.1
synthesis agents read before code) as implemented by LangChain's OpenWiki — spec](https://github.com/GoogleCloudPlatform/knowledge-catalog/blob/main/okf/SPEC.md)
format-compatible in spirit, dependency-free in practice. (a bundle of markdown concept files with typed frontmatter). Page set and
loop wiring follow Karpathy's LLM-wiki pattern (precomputed synthesis
agents read before code) as implemented by LangChain's OpenWiki —
dependency-free in practice.
``` ```
OKF/ OKF/
├── INDEX.md # map of the wiki — the ONE file AGENTS.md points at ├── index.md # map of the wiki — the ONE file AGENTS.md points at
├── SUMMARY.md # what the project is, for an agent landing cold ├── SUMMARY.md # what the project is, for an agent landing cold
├── ARCHITECTURE.md # modules, seams, main flows — design-codebase vocab ├── ARCHITECTURE.md # modules, seams, main flows — design-codebase vocab
├── CONTEXT.md # canonical domain glossary (model-domain owns content) ├── CONTEXT.md # canonical domain glossary (model-domain owns content)
├── context/ # only in multi-context repos: <subroot>.md per ├── context/ # only in multi-context repos: <subroot>.md per
│ # bounded context, indexed from INDEX.md │ # bounded context, indexed from index.md
├── ROADMAP.md # phased plan — architect owns content ├── ROADMAP.md # phased plan — architect owns content
├── adr/ # 0001-<slug>.md — three-of-three rule (model-domain) ├── adr/ # 0001-<slug>.md — three-of-three rule (model-domain)
├── blueprints/ # NNN-<slug>.md only — flat, grep-able namespace ├── blueprints/ # NNN-<slug>.md only — flat, grep-able namespace
@ -20,9 +23,21 @@ OKF/
└── LEARNINGS.md # debunked claims, gotchas — append-only, sourced └── LEARNINGS.md # debunked claims, gotchas — append-only, sourced
``` ```
## Page contracts (one line each in INDEX.md) ## Conformance (OKF v0.1)
- **INDEX.md** — every existing page + blueprint, one line + hook each. No - Every page except `index.md` opens with YAML frontmatter carrying a
non-empty `type` (extra fields like `status` follow it).
- `index.md` carries **only** `okf_version: "0.1"` in its frontmatter —
the one field the spec permits there. Reserved name, lowercase.
- Page types: `Summary`, `Architecture`, `Glossary` (CONTEXT and
`context/*`), `Roadmap`, `Learnings`, `ADR`, `Blueprint`, `Decision`,
`Ferry Map`. New page kinds coin a new type — types are producer-defined.
- Conformance check: `grep -rL "^type:" OKF/ --include='*.md'` returns
only `index.md`.
## Page contracts (one line each in index.md)
- **index.md** — every existing page + blueprint, one line + hook each. No
content of its own beyond the map. content of its own beyond the map.
- **SUMMARY.md** — ≤1 screen: what it is, who for, how run, where to start - **SUMMARY.md** — ≤1 screen: what it is, who for, how run, where to start
reading. The cold-start page. reading. The cold-start page.
@ -34,11 +49,11 @@ OKF/
- **ROADMAP.md** — architect's skeleton (locked decisions, phases with - **ROADMAP.md** — architect's skeleton (locked decisions, phases with
verify steps, risks, out-of-scope). verify steps, risks, out-of-scope).
- **blueprints/** — blueprint output; status lives in frontmatter, so the - **blueprints/** — blueprint output; status lives in frontmatter, so the
"tracker" is `grep -r "^status:" OKF/blueprints/`. INDEX lists one line "tracker" is `grep -r "^status:" OKF/blueprints/`. index.md lists one
per blueprint: `NNN — title — status`. line per blueprint: `NNN — title — status`.
- **ferries/** — one directory per ferry; MAP.md is the per-ferry index. - **ferries/** — one directory per ferry; MAP.md is the per-ferry index.
INDEX lists one line per ferry: `<topic> — n/m resolved → MAP.md`; index.md lists one line per ferry: `<topic> — n/m resolved → MAP.md`;
decisions are never listed in INDEX (single source: MAP.md). decisions are never listed in index.md (single source: MAP.md).
- **LEARNINGS.md** — what was believed / what is true / source. Never - **LEARNINGS.md** — what was believed / what is true / source. Never
edited retroactively, only appended or superseded. edited retroactively, only appended or superseded.

View File

@ -1,3 +1,7 @@
---
type: Architecture
---
# <project> — architecture # <project> — architecture
<!-- Every claim cites a file path. Vocabulary: module / interface / seam / <!-- Every claim cites a file path. Vocabulary: module / interface / seam /

View File

@ -1,3 +1,7 @@
---
type: Learnings
---
# <project> — learnings # <project> — learnings
<!-- Append-only. Format per entry: what was believed / what is true / <!-- Append-only. Format per entry: what was believed / what is true /

View File

@ -1,3 +1,7 @@
---
type: Summary
---
# <project> — summary # <project> — summary
<!-- ≤1 screen. The cold-start page: an agent that reads only this should <!-- ≤1 screen. The cold-start page: an agent that reads only this should

View File

@ -1,3 +1,7 @@
---
okf_version: "0.1"
---
# <project> — OKF index # <project> — OKF index
Open-knowledge-format wiki. Agents: read this page first, then the pages Open-knowledge-format wiki. Agents: read this page first, then the pages
@ -15,7 +19,12 @@ your task needs. Humans welcome too.
- `adr/` — TODO(scribe): list ADRs here as they land. - `adr/` — TODO(scribe): list ADRs here as they land.
## Specs ## Blueprints
- `specs/` — TODO(scribe): list specs here as blueprint writes them - `blueprints/` — TODO(scribe): list blueprints here as blueprint writes
(`NNN — title — status`). them (`NNN — title — status`).
## Ferries
- `ferries/` — TODO(scribe): one line per ferry
(`<topic> — n/m resolved → MAP.md`).

View File

@ -31,7 +31,7 @@ subagent spawn (the handoff-gate brief —
will focus on and tailor the doc. will focus on and tailor the doc.
## Process ## Process
1. Skim the task list, recent edits, `OKF/INDEX.md`, any active ferry. 1. Skim the task list, recent edits, `OKF/index.md`, any active ferry.
2. Write the doc (template below). File exit: `./HANDOFF.md` unless the 2. Write the doc (template below). File exit: `./HANDOFF.md` unless the
user names a path or asks for the temp dir. Subagent exit: same user names a path or asks for the temp dir. Subagent exit: same
sections as the spawn prompt, plus the gate's verify command. sections as the spawn prompt, plus the gate's verify command.