Okf

From akillness/jeo-skills · View interactive version

Okf is an AI agent skill from the GitHub repository akillness/jeo-skills. Create, validate, and consume Google Open Knowledge Format (OKF) v0.1 bundles — YAML-frontmatter Markdown knowledge atoms for portable, interoperable AI-agent sharing. Routes: use `okf-agent-memory` for the separate OKF v0.2 Go CLI/MCP project-memory runtime, `llm-wiki` for raw source capture and va

How to use this skill

Skill file

OKF — Open Knowledge Format

Open Knowledge Format (OKF)

is an open specification proposed by the Google Cloud Data team that formalizes

the LLM-Wiki pattern into a portable, interoperable format. Knowledge is

stored as YAML-frontmatter Markdown files inside a directory (a "bundle").

Any producer can write it, any agent can consume it — no proprietary SDK, no

special runtime, no lock-in.

Core idea: Just markdown. Just files. Just YAML frontmatter.

When to use this skill

table schemas, API specs, metric definitions, runbooks, deprecation notices

vendor catalog dependency)

the same organizational knowledge (join paths, business KPIs, incident guides)

than a parent/child hierarchy allows

filesystem mount

When NOT to use this skill

OKF Structure

The bundle directory

knowledge-bundle/
├── tables/
│   ├── orders.md
│   └── customers.md
├── metrics/
│   └── wau.md
├── runbooks/
│   └── outage-response.md
└── concepts/
    └── revenue-calculation.md

Each file is a knowledge atom — one YAML-frontmatter Markdown document.

The directory itself is the distributable unit (tarball / git / filesystem mount).

Frontmatter schema (OKF v0.1)

---
type: <string>          # (required) kind of atom: "BigQuery Table", "API Endpoint",
                        #   "Concept", "Runbook", "Metric Definition", "Data Source", …
title: <string>         # (required) human-readable name
description: <string>   # (required) one-sentence summary the agent can quote verbatim
resource: <url>         # (optional) URL to the described resource
tags: [<tag>, …]        # (optional) list for filtering / discovery
timestamp: <ISO 8601>   # (optional) last-updated datetime, e.g. 2026-06-21T10:00:00Z
---

Only type, title, and description are strictly required.

Add resource whenever the atom is bound to a live system or URL.

timestamp enables freshness checks for consuming agents.

Markdown body sections

| Section | Purpose |

|---------|---------|

| # Overview | Free-form context — motivation, ownership, caveats |

| # Schema | Structural description of columns / fields / parameters (table format recommended) |

| # Examples | Concrete usage examples, primarily code blocks |

| # Joins / # Relations | Cross-links to related atoms |

| # Citations | External sources backing the document's claims |

Sections are optional; include only those relevant to the atom type.

Instructions

Step 1 — Bootstrap a bundle

# Create the bundle root
mkdir my-knowledge-bundle && cd my-knowledge-bundle

# Scaffold a directory layout
mkdir -p tables metrics runbooks concepts api

For an existing project, place the bundle alongside code or in its own repo:

my-project/
├── src/
├── docs/
└── knowledge/          ← OKF bundle lives here
    ├── tables/
    └── metrics/

Step 2 — Author a knowledge atom

Table atom example
---
type: BigQuery Table
title: Customer Orders
description: One row per completed customer order across all channels.
resource: https://console.cloud.google.com/bigquery?p=acme&d=sales&t=orders
tags: [sales, orders, revenue]
timestamp: 2026-06-21T10:00:00Z
---

# Overview

Primary fact table for order analytics. Owned by the Data Engineering team.
Refreshed hourly from the Kafka `orders` topic.

# Schema

| Column        | Type      | Description                                          |
|---------------|-----------|------------------------------------------------------|
| `order_id`    | STRING    | Globally unique order identifier.                    |
| `customer_id` | STRING    | Foreign key into [customers](/tables/customers.md).  |
| `total_usd`   | NUMERIC   | Order total in US dollars after discounts.           |
| `placed_at`   | TIMESTAMP | When the customer submitted the order (UTC).         |
| `channel`     | STRING    | `web` \| `mobile` \| `api` \| `partner`.             |

# Joins

- Join to [customers](/tables/customers.md) on `customer_id` for user attributes.
- Join to [products](/tables/products.md) via [order_items](/tables/order_items.md).

# Citations

[1] [BigQuery table](https://console.cloud.google.com/bigquery?p=acme&d=sales&t=orders)
Metric definition atom
---
type: Metric Definition
title: Weekly Active Users (WAU)
description: Count of distinct users who triggered at least one qualifying event in the trailing 7-day window.
tags: [kpi, growth, users]
timestamp: 2026-06-21T10:00:00Z
---

# Overview

Owned by the Growth Analytics team. Used in all executive dashboards.

# Definition

SELECT

DATE_TRUNC(event_date, WEEK) AS week_start,

COUNT(DISTINCT user_id) AS wau

FROM events

WHERE event_name IN ('session_start', 'purchase', 'share')

AND event_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 7 DAY)

GROUP BY 1

\```

Relations


#### Runbook atom

type: Runbook

title: Database Connection Pool Exhaustion

description: Steps to diagnose and recover from connection pool exhaustion on the primary Postgres cluster.

tags: [incident, database, postgres, oncall]

timestamp: 2026-06-21T10:00:00Z


Overview

Triggered when pg_stat_activity shows ≥95% pool utilization or FATAL: remaining connection slots are reserved errors appear.

Steps

  1. Check active connections: SELECT count(*) FROM pg_stat_activity;
  2. Identify blocking queries: see slow-query runbook.
  3. Kill idle connections older than 5 min if count > threshold.
  4. Scale pool via connection pooler config.
  5. Page DBA on-call if not resolved in 10 min.

Citations

[1] PgBouncer docs


### Step 3 — Cross-link atoms

Use **absolute bundle-root links** (recommended — stable across moves):

See the customers table for join key details.


Use **relative links** for co-located files:

See related concept.


> **Design rule**: a link asserts a *relationship exists*; the surrounding prose
> (not the link itself) names the relationship type (parent, foreign-key, join,
> depends-on). This keeps the graph type-free and consumer-flexible.

### Step 4 — Validate a bundle

Run a basic structural lint before consuming or distributing:

Check all .md files have required frontmatter fields

python3 -c "

import os, sys

import re

bundle = '.' # path to bundle root

errors = []

for root, dirs, files in os.walk(bundle):

for f in files:

if not f.endswith('.md'):

continue

path = os.path.join(root, f)

text = open(path).read()

if not text.startswith('---'):

continue # skip non-OKF files

fm_end = text.find('---', 3)

if fm_end == -1:

errors.append(f'{path}: unclosed frontmatter')

continue

fm = text[3:fm_end]

for field in ('type:', 'title:', 'description:'):

if field not in fm:

errors.append(f'{path}: missing required field {field!r}')

if errors:

for e in errors: print('ERROR:', e)

sys.exit(1)

else:

print('OK — all OKF files valid')

"


### Step 5 — Distribute a bundle

As a tarball

tar -czf my-knowledge-bundle.tar.gz my-knowledge-bundle/

As a git repo (recommended for versioning + freshness via timestamp)

git init my-knowledge-bundle && cd my-knowledge-bundle

git add . && git commit -m "Initial OKF bundle"

git remote add origin https://github.com/acme/knowledge-bundle.git

git push -u origin main

As a filesystem mount in a Docker container

docker run alpine:3.20 ... (mount $(pwd)/my-knowledge-bundle at /knowledge)


### Step 6 — Consume a bundle from an AI agent

import os, re, yaml

def load_okf_bundle(bundle_path: str) -> list[dict]:

"""Load all OKF atoms from a bundle directory."""

atoms = []

for root, _, files in os.walk(bundle_path):

for f in files:

if not f.endswith('.md'):

continue

path = os.path.join(root, f)

text = open(path).read()

if not text.startswith('---'):

continue

fm_end = text.find('---', 3)

if fm_end == -1:

continue

try:

fm = yaml.safe_load(text[3:fm_end])

body = text[fm_end + 3:].strip()

atoms.append({

'path': os.path.relpath(path, bundle_path),

'frontmatter': fm,

'body': body

})

except Exception:

pass

return atoms

Usage

atoms = load_okf_bundle('./knowledge')

tables = [a for a in atoms if a['frontmatter'].get('type') == 'BigQuery Table']


### Step 7 — Integrate with llm-wiki

OKF bundles are compatible with the repo's `llm-wiki` skill workflow:

After running llm-wiki to capture raw sources, promote to OKF-compliant format:

1. Add required frontmatter (type, title, description) to each wiki/*.md

2. Add resource: field pointing to the source URL

3. Organize into typed subdirectories (tables/, metrics/, concepts/, …)

4. Run the Step 4 validator

Use the llm-wiki skill for:

- Raw source capture and summarization

- Query filing and lint passes

- Obsidian/git vault maintenance

Use OKF for:

- Portable, interoperable distribution to other teams/agents

- Standard frontmatter that consuming agents can parse without a custom schema


### Step 8 — Plugin install

Project install

npx skills@1.9.0 add https://github.com/akillness/jeo-skills --skill okf

Global install

npx skills@1.9.0 add -g https://github.com/akillness/jeo-skills --skill okf

Target specific agents

npx skills@1.9.0 add -g https://github.com/akillness/jeo-skills --skill okf -a claude-code -a codex -y


Also ships [`scripts/install.sh`](scripts/install.sh) — a one-shot helper that
verifies the `pyyaml` dependency and optionally validates an existing bundle.
See [`references/usage.md`](references/usage.md) for the full field and
section reference.

## Output format

When the user asks `okf` for help, return a compact brief:

OKF Routing Brief

Scope

Recommended next move

Why

Route-outs

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.