OKF v0.2 contract baseline and migration roadmap

Historical document. This plan is preserved from source revision 61e75e9; it is not current implementation guidance. Original source.

1. Objective

Establish an executable contract for Open Knowledge Format v0.2 support before changing public APIs. This task is the dependency root for the other migration tasks.

Source of truth:

Do not rely solely on the current main: reproducible builds and tests must reference the pinned specification revision.

2. Version contract

Supported versions:

Resolution policy:

  1. An explicit supported okf_version in the root index.md sets the contract.
  2. Without a declaration, the effective version is 0.2, with the legacy fallbacks from §13 permitted.
  3. A v0.2 consumer reads an unknown declaration on a best-effort basis and preserves it as the declared version.
  4. An explicit API/CLI selector is an assertion. A conflict with the declaration must not silently change semantics.

The resolution model must distinguish:

The Go module, CLI binary, and plugin package versions are not okf_version.

3. Conformance matrix

Create a versioned matrix: spec clause → implementation → diagnostics → tests.

Hard [ERROR] diagnostics remain limited to §11:

Optional v0.2 field families do not become hard requirements:

The strict/policy layer checks malformed field families when present; they must not break permissive loading. Unknown keys/types/runtimes remain consumable.

4. Legacy contract

Support two fallbacks without implicit migration:

A legacy representation alone is not a conformance failure. Reading, fmt, index, and graph operations must not rewrite v0.1 documents.

Migration must be a separate preview/apply operation with an explicit actor and source mapping.

5. Ambiguity ledger

Record tooling policy decisions separately from the upstream specification:

Reflect each decision consistently in bundle, validator, CLI, MCP, fixtures, and documentation.

6. Canonical fixtures

Add one shared corpus:

Reuse fixtures in package tests, CLI/MCP E2E tests, and documentation snippets.

7. Deferred ABI

Explicitly exclude:

store.CommitReceipt is unrelated to executor.receipt.

8. Acceptance criteria

9. Dependency graph

Order:

  1. This task.
  2. bundle.
  3. In parallel: validator, graph, mutation engine, store guardrails.
  4. Mutation operations and migration.
  5. CLI and MCP.
  6. Skills/documentation and the final conformance gate across all interfaces.