You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The okf package is an independent implementation of Google OKF 0.2. The package must remain limited to that specification.
The package also needs stable automation interfaces:
Findings need stable IDs and machine-readable reports.
Agents need safe read and write tools.
Bundle writes need prospective validation and atomic commit.
Index and log maintenance must not drift.
Graph consumers need one versioned query interface.
Repositories need a simple CI gate.
Downstream packages can add more checks. They must compose those checks outside okf. The okf validator must not load, register, suppress, or execute downstream rules.
Architecture invariant
For a given bundle, okf must always produce the same OKF Spec report. No caller configuration can change that report.
OkfSpecReport(bundle) is independent of every downstream package.
A downstream package can inspect an OKF-valid candidate before commit. The downstream package cannot replace the OKF Spec gate.
downstream acceptance
= OKF Spec conformance
AND downstream checks
The conjunction belongs to the downstream package. It does not belong to okf.
Solution
1. Closed OKF Spec validation
One module owns OKF Spec validation.
The Spec rule implementations are internal and immutable.
The validator does not accept a rule catalog.
The validator does not accept suppressions.
The validator does not accept downstream parameters.
Stable findings use okf/<code> IDs.
The report contains errors and advisories.
Spec conformance depends only on Spec errors.
Advisory findings do not make a bundle non-conformant.
The package can expose read-only rule descriptors. A descriptor can contain the ID, text, severity, and Spec reference. A descriptor cannot contain a replaceable run function.
2. Stable Finding and Report contracts
One module owns the value types for findings and reports.
A finding has an ID, severity, message, and optional location.
A report has one text projection and one JSON projection.
Load failures merge into the same Spec report.
CLI, MCP, and CI consume the same Spec report.
No adapter can change the Spec conformance result.
An adapter can apply a local exit policy to advisories. The adapter must not report that policy as OKF Spec non-conformance.
3. Prepared bundle changes
The write seam is a prepared candidate.
describe change
→ prepare candidate in memory
→ validate candidate against the OKF Spec
→ expose candidate to the caller
→ commit the prepared change atomically
prepare returns one of these results:
A refusal with the OKF Spec report.
A prepared change with the candidate and its OKF Spec report.
commit accepts only a prepared change that okf created. The commit operation checks that the source bundle did not change after preparation.
The prepared change is opaque. Its candidate view is immutable. It binds the exact bytes or digest that passed Spec validation. commit writes those exact bytes and rejects a forged, changed, or stale prepared value.
The prepared candidate is the composition seam. A downstream package can run extra checks before it calls commit.
4. MCP server
okf mcp exposes a fixed read and write surface over standard input and standard output.
Read tools:
list-concepts
lookup-concept
query-graph
validate
Write tools:
create-concept
update-concept
link-concepts
deprecate-concept
Each write tool translates its arguments into a change set. The tool calls prepare, returns a Spec refusal when necessary, and commits only a prepared change.
The MCP server does not accept external validators. The MCP server does not use a strict write verdict. A candidate with only advisory findings can commit.
Malformed tool input remains a tool error. A candidate with a Spec error produces a report-carrying refusal.
An unresolved link is valid input. The base write path does not require the target concept to exist.
5. Index and log ownership
One model owns the index.md and log.md entry formats.
Rules read entries through this model.
Writers emit entries through this model.
A write updates only affected indexes and their ancestors.
A write preserves unrelated authored indexes.
An idempotent change writes no files.
The package can provide a default index planner. A downstream package can create a different OKF-valid change set. Every candidate still passes the closed Spec gate.
6. CI gate
Releases attach compiled binaries. A thin composite GitHub Action runs base OKF validation.
The action consumes the same Spec report as the CLI and MCP server. The action does not load downstream rules.
7. Graph query interface
okf graph remains the single graph producer. It supports JSON, DOT, and Mermaid output.
One versioned graph-query interface owns all filters. CLI flags and MCP query-graph are adapters over that interface.
Problem statement
The
okfpackage is an independent implementation of Google OKF 0.2. The package must remain limited to that specification.The package also needs stable automation interfaces:
Downstream packages can add more checks. They must compose those checks outside
okf. Theokfvalidator must not load, register, suppress, or execute downstream rules.Architecture invariant
For a given bundle,
okfmust always produce the same OKF Spec report. No caller configuration can change that report.A downstream package can inspect an OKF-valid candidate before commit. The downstream package cannot replace the OKF Spec gate.
The conjunction belongs to the downstream package. It does not belong to
okf.Solution
1. Closed OKF Spec validation
One module owns OKF Spec validation.
okf/<code>IDs.The package can expose read-only rule descriptors. A descriptor can contain the ID, text, severity, and Spec reference. A descriptor cannot contain a replaceable run function.
2. Stable Finding and Report contracts
One module owns the value types for findings and reports.
An adapter can apply a local exit policy to advisories. The adapter must not report that policy as OKF Spec non-conformance.
3. Prepared bundle changes
The write seam is a prepared candidate.
preparereturns one of these results:commitaccepts only a prepared change thatokfcreated. The commit operation checks that the source bundle did not change after preparation.The prepared change is opaque. Its candidate view is immutable. It binds the exact bytes or digest that passed Spec validation.
commitwrites those exact bytes and rejects a forged, changed, or stale prepared value.The prepared candidate is the composition seam. A downstream package can run extra checks before it calls
commit.4. MCP server
okf mcpexposes a fixed read and write surface over standard input and standard output.Read tools:
list-conceptslookup-conceptquery-graphvalidateWrite tools:
create-conceptupdate-conceptlink-conceptsdeprecate-conceptEach write tool translates its arguments into a change set. The tool calls
prepare, returns a Spec refusal when necessary, and commits only a prepared change.The MCP server does not accept external validators. The MCP server does not use a strict write verdict. A candidate with only advisory findings can commit.
Malformed tool input remains a tool error. A candidate with a Spec error produces a report-carrying refusal.
An unresolved link is valid input. The base write path does not require the target concept to exist.
5. Index and log ownership
One model owns the
index.mdandlog.mdentry formats.The package can provide a default index planner. A downstream package can create a different OKF-valid change set. Every candidate still passes the closed Spec gate.
6. CI gate
Releases attach compiled binaries. A thin composite GitHub Action runs base OKF validation.
The action consumes the same Spec report as the CLI and MCP server. The action does not load downstream rules.
7. Graph query interface
okf graphremains the single graph producer. It supports JSON, DOT, and Mermaid output.One versioned graph-query interface owns all filters. CLI flags and MCP
query-graphare adapters over that interface.Architecture
flowchart TB files["OKF bundle files"] subgraph okf["okf — Google OKF 0.2"] load["load bundle"] validate["closed OKF Spec validator"] report["OKF Spec report"] plan["change planners"] prepare["prepare candidate"] commit["atomic commit"] graph["versioned graph query"] load --> validate --> report plan --> prepare --> validate prepare --> commit load --> graph end files --> load commit --> files subgraph surfaces["okf adapters"] cli["CLI"] mcp["MCP"] ci["CI"] end report --> cli report --> mcp report --> ci downstream["downstream package\nextra checks and extra planning"] prepare -->|"inspect candidate"| downstream downstream -->|"commit prepared change"| commitThe
okfpackage has no dependency on the downstream package. Theokfpackage has no downstream rule-registration seam.User stories
okf/...IDs in text and JSON reports.okfmaintainer, I want all downstream behavior outside this package.Implementation decisions
Validation
Writes
prepareowns candidate construction and Spec validation.commitowns transactionality and rollback.Composition
CI and graph
Sub-issues
okf/...IDs and moves Spec rules behind a closed validator.Testing decisions
commitwrites.Out of scope
Further notes
3fcbb9f.okfvalidates Google OKF 0.2 and nothing else.