Skip to main content

okf-cli — Open Knowledge Format tooling

Converts plain markdown into OKF-conformant knowledge bundles. Domain experts write the content, okf bundle generates frontmatter, type, timestamps, and index files.

Also validates bundles, lists concept IDs, reads concepts by ID, and reports version.

Install

uv tool install okf-cli

Dev quickstart

uv sync
uv run okf --help
uv run okf --version

Global options: --version, --help.

Commands

okf bundle — convert plain markdown to OKF bundle

okf bundle <input-dir> [output-dir] [--default-type <name>] [--force] [--strict]
Argument Description
input-dir Directory of plain .md files
output-dir Target directory (default: <input-dir>_knowledge_base)
--default-type Type for root-level files (default: input directory name)
--force, -f Overwrite output directory if it exists
--strict Enforce strict OKF spec output: fail on broken local .md links and skip AGENTS.md generation
okf bundle example --default-type reference          # → example_knowledge_base/
okf bundle example bundled --default-type reference --force --strict

.okfignore: put in input-dir root; one bundle-relative .md path per line. Exact match only (no glob).

Link checking: scans body links to local .md targets. Missing or out-of-bundle links warn by default, fail with --strict.

okf list — list concept IDs in a bundle

okf list <directory>

Prints concept IDs (path without .md). Requires valid OKF bundle.

okf list example_knowledge_base/
# datasets/sales
# tables/orders

okf read — read a concept by ID

okf read <directory> <concept-id>

Prints full concept contents (frontmatter + body). Concept IDs as printed by okf list. Guards against path traversal.

okf validate — check OKF conformance

okf validate <directory>

Checks OKF v0.1 §9 conformance: frontmatter required, type required, reserved filenames follow spec structure, UTF-8 required.

okf validate example_knowledge_base/
# 16 files: 16 ok

Input format

Strict (recommended)

# Title

> Description

Lenient fallback

Files without strict format are bundled best-effort: title omitted if absent, description synthesized from first 80 chars of body.

Rule Why
Folder name = concept type tables/orders.md → type: "tables"
Only .md files processed Non-.md files ignored
index.md, log.md, README.md skipped in bundle Repo artifacts; not OKF concepts. list/read/validate only reserve index.md and log.md.
.okfignore entries skipped Skip selected files without moving them.

Root files use --default-type, defaulting to the input directory name. See example/ for sample structure.

Output

Each concept becomes a markdown file with YAML frontmatter:

---
type: "tables"
title: "Customer Orders"
description: "One row per completed customer order across all channels."
timestamp: "2026-07-04T15:06:51+00:00"
---

Original body preserved as-is.

Every directory gets an index.md listing files and subdirs.

OKF Conformance

Generated bundles conform to OKF v0.1 (§9): frontmatter required, non-empty type, reserved filenames follow spec structure.

Project layout

okf-cli
├── .github/workflows/test.yml  # CI
├── AGENTS.md                   # Contributor context for AI agents
├── OKF_SPEC.md                 # OKF specification
├── README.md                   # This file
├── openwiki/                   # Contributor docs (architecture, workflows, etc.)
├── pyproject.toml              # uv-managed Python project
├── skills/                     # Optional skill definitions
├── uv.lock                     # uv lockfile
├── src/okf/
│   ├── cli.py                  # Typer entrypoint
│   ├── api.py                  # Programmatic Python API
│   ├── core.py                 # Shared parsing/formatting
│   └── commands/               # bundle, list, read, validate
├── tests/                      # pytest suite
└── example/                    # Sample input markdown

For contributor guidance, see AGENTS.md and openwiki/quickstart.md.

Release files for okf-cli 0.5.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for okf-cli 0.5.3
File Size Uploaded
okf_cli-0.5.3.tar.gz 45.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for okf-cli 0.5.3
File Interpreter ABI Platform
okf_cli-0.5.3-py3-none-any.whl Python 3 none any Details

Total release size: 60.8 kB

Release files / okf_cli-0.5.3.tar.gz

Download URL okf_cli-0.5.3.tar.gz
Size 45.8 kB
Tags Source
SHA-256 checksum
How to use checksums
0821eb9e266deb4d8d30204bb62481670992324b08e38b7d3fca5f51850ae3a6
BLAKE2b-256 checksum
How to use checksums
0137d5bd8c14035ce2962699eff46137270cf8379a712a8dd48ed97a63ecc194
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / okf_cli-0.5.3-py3-none-any.whl

Download URL okf_cli-0.5.3-py3-none-any.whl
Size 15.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1407ceb8fdc18e45e58f3648aa658f66514021d0dfb4349a5c0f2447754e9251
BLAKE2b-256 checksum
How to use checksums
d038d96bab0b037c6262a059d181bf4e7b0357937f80074cb6918532e3001717
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

0.6.1

2 release files

0.6.0

2 release files

0.5.5

2 release files

0.5.4

2 release files

This release

0.5.3 This release

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.9

2 release files

0.4.8

2 release files

0.4.7

2 release files

0.4.5

2 release files

0.4.3

2 release files

0.4.1

2 release files

0.3.1

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page