Skip to content

Commit db7cfb2

Browse files
okf: clarify SPEC v0.1 ambiguities and add a trust/safety section
Resolves the §6/§11 contradiction over frontmatter in index.md, and clarifies several under-specified or self-conflicting points without changing the format's intent. Every change clarifies existing behavior; none alters a conformant bundle. - §3.1/§9: common repo and agent meta files (README, LICENSE, CONTRIBUTING, CODE_OF_CONDUCT, SECURITY, CHANGELOG, CLAUDE.md, AGENTS.md) no longer break conformance; rule 1 scoped to concept documents, rule 3 made checkable. - §5.1: note that bundle-root absolute links resolve to the repo root in standard renderers when a bundle is a subdirectory; fix the stale "stable when moved" rationale. - §5.2a (new): define how a link target maps to a Concept ID. - §4.1/§5.3: mark `type` as a hint, not an interop contract; state the path-as-identity trade-off. - §4: declare paths/Concept IDs case-sensitive. - §6/§7: tighten index-entry parsing; git history is authoritative over log.md. - §12 (new): trust & safety — treat bundle contents as untrusted data, no built-in authenticity guarantee.
1 parent 2d0bb3f commit db7cfb2

1 file changed

Lines changed: 95 additions & 18 deletions

File tree

okf/SPEC.md

Lines changed: 95 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,23 @@ A bundle MAY be distributed as:
9797
The following filenames have defined meaning at any level of the
9898
hierarchy and MUST NOT be used for concept documents:
9999

100-
| Filename | Purpose |
101-
|--------------|--------------------------------------------------------|
102-
| `index.md` | Directory listing. See §6. |
103-
| `log.md` | Update history. See §7. |
104-
105-
All other `.md` files are concept documents.
100+
| Filename | Purpose |
101+
|----------------------|----------------------------------------------|
102+
| `index.md` | Directory listing. See §6. |
103+
| `log.md` | Update history. See §7. |
104+
| `README.md` | Human-oriented readme. Ignored by consumers. |
105+
| `LICENSE.md` | License text. Ignored by consumers. |
106+
| `CONTRIBUTING.md` | Contribution guide. Ignored by consumers. |
107+
| `CODE_OF_CONDUCT.md` | Community health file. Ignored by consumers. |
108+
| `SECURITY.md` | Community health file. Ignored by consumers. |
109+
| `CHANGELOG.md` | Changelog. Ignored by consumers. |
110+
| `CLAUDE.md` | Agent instructions. Ignored by consumers. |
111+
| `AGENTS.md` | Agent instructions. Ignored by consumers. |
112+
113+
All other `.md` files are concept documents. Reserved files other than
114+
`index.md` and `log.md` carry no OKF meaning: they are neither required
115+
to have frontmatter nor parsed as concepts, and exist so that an OKF
116+
bundle can coexist with ordinary repository and agent conventions.
106117

107118
Tags themselves remain a first-class concept — see the `tags`
108119
frontmatter field in §4.1. OKF does not specify a separate file format
@@ -119,6 +130,11 @@ Every concept is a UTF-8 markdown file. It has two parts:
119130
the start of the file and a closing `---` on its own line.
120131
2. A **markdown body**, containing free-form content.
121132

133+
Concept IDs and link targets are **case-sensitive**. Producers SHOULD
134+
avoid paths that differ only in case (e.g. `Tables/Users.md` and
135+
`tables/users.md`), since such bundles cannot be represented on
136+
case-insensitive filesystems and will not round-trip across platforms.
137+
122138
### 4.1 Frontmatter
123139

124140
```yaml
@@ -143,7 +159,12 @@ timestamp: <ISO 8601 datetime> # Optional last-modified time
143159
Type values are **not** registered centrally. Producers SHOULD pick
144160
values that are descriptive and self-explanatory; consumers MUST
145161
tolerate unknown types gracefully (typically by treating them as
146-
generic concepts).
162+
generic concepts). `type` is therefore a presentation and routing
163+
**hint**, not an interoperability contract: two producers MAY use
164+
different strings (`BigQuery Table` vs. `bq_table`) for the same kind
165+
of concept, and consumers MUST NOT assume any particular `type` value
166+
is present or machine-recognizable. It is required only so that every
167+
concept is self-labeled with something a human can read.
147168

148169
**Recommended (in priority order):**
149170

@@ -237,14 +258,22 @@ forms are supported:
237258

238259
### 5.1 Absolute (bundle-relative) links
239260

240-
Begin with `/`, interpreted relative to the bundle root.
261+
Begin with `/`, interpreted relative to the **bundle root** — which is
262+
not necessarily the repository root.
241263

242264
```markdown
243265
See the [customers table](/tables/customers.md) for the join key.
244266
```
245267

246-
This is the **recommended** form because it is stable when documents are
247-
moved within their subdirectory.
268+
This form is stable regardless of where the **linking** document is moved
269+
within the bundle, which makes it convenient for generated content. Note
270+
the trade-off: when a bundle is distributed as a subdirectory of a larger
271+
repository (§3), a leading `/` resolves to the *repository* root in
272+
standard markdown renderers (e.g. GitHub, GitLab, Obsidian), not the
273+
bundle root. Producers who need links that render correctly without an
274+
OKF-aware consumer SHOULD prefer relative links (§5.2) in that case.
275+
Consumers that resolve absolute links MUST resolve them against the
276+
bundle root, not the repository root.
248277

249278
### 5.2 Relative links
250279

@@ -254,6 +283,15 @@ Standard markdown relative paths.
254283
See the [neighboring concept](./other.md).
255284
```
256285

286+
### 5.2a Resolving a link to a concept
287+
288+
A link target resolves to a concept by taking the target path (after
289+
applying absolute or relative resolution above), stripping a trailing
290+
`.md`, and matching the result against a Concept ID (§2). A trailing
291+
slash (e.g. `subdir/`) denotes a directory rather than a concept and
292+
resolves to that directory's `index.md` if present. Path matching is
293+
case-sensitive (see §4).
294+
257295
### 5.3 Link semantics
258296

259297
A link from concept A to concept B asserts a *relationship*. The
@@ -262,6 +300,11 @@ depends-on, etc.) is conveyed by the surrounding prose, not by the link
262300
itself. Consumers that build a graph view typically treat all links as
263301
directed edges of an untyped relationship.
264302

303+
Because a concept's identity is its path, moving or renaming a concept
304+
breaks inbound links. OKF deliberately favors path-simplicity over
305+
guaranteed referential integrity; the permissive treatment of broken
306+
links below is a consequence of that choice, not an oversight.
307+
265308
Consumers MUST tolerate broken links — a link whose target does not
266309
exist in the bundle is not malformed; it may simply represent
267310
not-yet-written knowledge.
@@ -275,8 +318,11 @@ root. It enumerates the directory's contents to support **progressive
275318
disclosure** — letting a human or agent see what is available before
276319
opening individual documents.
277320

278-
Index files contain no frontmatter. The body uses one or more sections,
279-
each grouping concepts under a heading:
321+
Index files contain no frontmatter, with one exception: the
322+
bundle-root `index.md` MAY carry a single-key frontmatter block declaring
323+
the OKF version (see §11). No other `index.md`, at any level, may carry
324+
frontmatter. The body uses one or more sections, each grouping concepts
325+
under a heading:
280326

281327
```markdown
282328
# Section / Group Heading
@@ -293,6 +339,12 @@ Entries SHOULD include the description from the linked concept's
293339
frontmatter. Producers MAY generate `index.md` automatically; consumers
294340
MAY synthesize one on the fly when none is present.
295341

342+
Each entry is a list item of the form `* [<title>](<url>) — <description>`.
343+
Consumers parsing entries SHOULD treat the link as authoritative and the
344+
text after the **first** `` (or ` - `) following the link as the
345+
description; the description MAY itself contain hyphens. List items that
346+
do not begin with a markdown link SHOULD be ignored rather than rejected.
347+
296348
---
297349

298350
## 7. Log Files (optional)
@@ -317,6 +369,11 @@ Date headings MUST use ISO 8601 `YYYY-MM-DD` form. Log entries are
317369
prose; the leading bold word (`**Update**`, `**Creation**`,
318370
`**Deprecation**`, etc.) is a convention, not a requirement.
319371

372+
Where a bundle is distributed as a git repository, commit history is the
373+
authoritative record of change; `log.md` is an optional human-curated
374+
summary and MAY be incomplete. Consumers SHOULD NOT assume `log.md` is
375+
exhaustive or in sync with commit history.
376+
320377
---
321378

322379
## 8. Citations
@@ -342,11 +399,13 @@ first-class OKF concepts.
342399

343400
A bundle is **conformant** with OKF v0.1 if:
344401

345-
1. Every non-reserved `.md` file in the tree contains a parseable YAML
346-
frontmatter block.
402+
1. Every concept document (every `.md` file that is not a reserved
403+
filename per §3.1) contains a parseable YAML frontmatter block.
347404
2. Every frontmatter block contains a non-empty `type` field.
348-
3. Every reserved filename (`index.md`, `log.md`) follows the structure
349-
described in §6 and §7 respectively when present.
405+
3. When present, an `index.md` contains no frontmatter except as
406+
permitted in §6, and a `log.md` uses ISO 8601 `YYYY-MM-DD` date
407+
headings as described in §7. The remaining contents of these files
408+
are conventional (SHOULD-level) and do not affect conformance.
350409

351410
Consumers SHOULD treat all other constraints as soft guidance. In
352411
particular, consumers MUST NOT reject a bundle because of:
@@ -390,13 +449,31 @@ versioned in the form `<major>.<minor>`:
390449
fields, changing reserved filenames).
391450

392451
Bundles MAY declare the OKF version they target by including
393-
`okf_version: "0.1"` in a bundle-root `index.md` frontmatter block (the
394-
only place frontmatter is permitted in an `index.md`). Consumers that
452+
`okf_version: "0.1"` in a frontmatter block at the top of the
453+
bundle-root `index.md`. This is the only frontmatter permitted in any
454+
`index.md`, and the only key permitted in it (see §6). Consumers that
395455
do not understand the declared version SHOULD attempt best-effort
396456
consumption rather than refusing the bundle.
397457

398458
---
399459

460+
## 12. Trust and safety
461+
462+
OKF bundles are designed to be exchanged across organizations and
463+
consumed by automated agents. Consumers MUST treat the contents of a
464+
bundle — frontmatter values and concept bodies alike — as untrusted
465+
**data**, never as instructions to execute. In particular, an agent that
466+
incorporates concept bodies into a prompt MUST NOT follow directives
467+
contained in that text (prompt injection); bundle authorship is not
468+
authenticated by the format itself.
469+
470+
OKF provides no built-in authenticity or integrity guarantee.
471+
Distribution as a git repository (§3) gives commit-level provenance and
472+
history, but consumers that require authenticity SHOULD verify it
473+
out-of-band (e.g. signed commits or tags, transport-level trust).
474+
475+
---
476+
400477
## Appendix A — Minimal example bundle
401478

402479
```

0 commit comments

Comments
 (0)