Skip to main content

Turn any website into a portable, agent-ready Open Knowledge Format (OKF) bundle — build, sync, and chat, no LLM required to start.

Project description

okf-kit

CI PyPI Python versions License: Apache 2.0 OKF spec

Turn any website into a portable, agent-ready knowledge bundle — no LLM required to start.

okf-kit crawls a site into a Google Open Knowledge Format (OKF) bundle: a directory of markdown concept files with YAML frontmatter and per-directory index.md listings that any agent can navigate with plain file reads. Build it, keep it in sync as the site changes, publish it, and chat with it — locally, with your own key, or fully offline via Ollama.

pip install okf-kit
okf build https://docs.example.com -o docs-okf   # crawl → OKF bundle (no key, no browser)
okf chat docs-okf --provider ollama              # chat offline, no key

Or zero-install with uv:

uvx --from okf-kit okf build https://docs.example.com -o docs-okf

Part of the calknowledge ecosystem — okf-kit is the lightweight, open library; calknowledge is the full platform (LLM enrichment, RAG export, retrieval evals, GUI) built on top of it.


Why

Everyone re-crawls and re-indexes the same docs privately and badly. okf-kit makes a website's knowledge a portable artifact:

  • Agents can read an OKF bundle; they can't read your website. The bundle is navigable markdown — no scraping, no SDK, no runtime.
  • Faithful markdown, not text soup. Real extraction (headings, code, tables), boilerplate filtered, JS-rendered when needed.
  • Self-maintaining. okf sync updates only what changed, so a published bundle in git produces small delta commits and never goes stale.
  • Works with any LLM, or none. Chat via OpenAI, Ollama, vLLM, OpenRouter, or Claude — or get a zero-key retrieval answer with citations.

Install

pip install okf-kit                 # core: build / sync / validate / zip / list / get / visualize
pip install "okf-kit[chat]"         # okf chat via OpenAI-compatible providers (OpenAI, Ollama, …)
pip install "okf-kit[anthropic]"    # Claude as a chat provider
pip install "okf-kit[js]"           # crawl JavaScript-rendered sites (pulls a Playwright Chromium)
pip install "okf-kit[mcp]"          # serve bundles to Claude Code / Cursor over MCP
pip install "okf-kit[enrich]"       # okf build --enrich (LLM descriptions + tags)

The default install has no browser and no LLM SDK — it installs in seconds.

Tip: install into a dedicated virtualenv so okf-kit's dependencies don't mix with your other projects:

python3 -m venv ~/okf && ~/okf/bin/pip install okf-kit

This also avoids clashes if an existing environment already pins packages like lxml (e.g. a prior crawl4ai install) — a plain install would otherwise bump them.

Commands

Build

okf build https://docs.example.com -o docs-okf --max-depth 3 --max-pages 200

Domain-restricted BFS crawl → an OKF bundle: pages/ mirror with frontmatter concepts, a .okf-kit/state.json for sync, and an index.md in every directory for agent navigation. Validated on exit. No API key needed. Flags: --js (JS-rendered sites), --no-robots, --enrich (add LLM descriptions/tags — needs [enrich] + OPENAI_API_KEY). If a site looks JavaScript-rendered, build tells you to re-run with --js.

Sync

okf sync docs-okf

Re-crawls the same site and updates only the delta — added pages written, changed pages rewritten, removed pages deleted, unchanged pages left byte-for-byte (stable git diffs). A safety valve aborts on a suspiciously empty re-crawl (--force overrides).

Chat

okf chat docs-okf --provider ollama                 # offline, no key
okf chat docs-okf --provider openai --trace         # any provider, with citations + a navigation trace
okf chat docs-okf                                   # no provider → zero-key retrieval answer
okf chat docs-okf --resume                          # continue the last session (history is local)

The agent navigates the bundle (list_directory / read_concept) to the most specific concept and answers only from what it read, citing the paths.

--provider Endpoint Key
openai OpenAI OPENAI_API_KEY
ollama localhost:11434 (local) none
openrouter OpenRouter OPENROUTER_API_KEY
anthropic Claude ANTHROPIC_API_KEY
custom --base-url as configured

Chat history is stored locally at ~/.okf/chats/<bundle>/.

Visualize

okf visualize docs-okf          # -> docs-okf/graph.html

A self-contained interactive graph (nodes = concepts, edges = internal links); no backend, no CDN — open the HTML from file://.

Serve over MCP

okf serve-mcp docs-okf          # or --all for every downloaded bundle

Exposes list_bundles / list_directory / read_concept / search_bundle over stdio MCP for Claude Code/Desktop, Cursor, and any MCP client.

Registry

okf list --remote               # browse published bundles
okf get backstage-docs          # download, validate, install to ~/.okf/bundles/
okf list                        # your local bundles

Package for hand-off

okf zip docs-okf                # -> docs-okf.zip, ready to publish or share

Publishing

See docs/PUBLISHING.md — build a bundle, ship it as a release zip with a weekly self-sync Action, and add it to the awesome-okf-kit registry. Publish only content you may redistribute.

Bundle layout

docs-okf/
    index.md                 root directory listing (reserved, no frontmatter)
    log.md                   build/sync history
    pages/                   one concept per page (frontmatter + body + citations)
        index.md             directory listing (every directory has one)
        home.md
        docs/…
    .okf-kit/state.json      crawl config, per-page content hashes, link edges

Development

pip install -e ".[dev]", then pytest -q (37 tests, fully offline) and ruff check okf_kit tests. See CONTRIBUTING.md and the CHANGELOG.

License

Apache-2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

okf_kit-0.1.2.tar.gz (45.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

okf_kit-0.1.2-py3-none-any.whl (43.3 kB view details)

Uploaded Python 3

File details

Details for the file okf_kit-0.1.2.tar.gz.

File metadata

  • Download URL: okf_kit-0.1.2.tar.gz
  • Upload date:
  • Size: 45.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for okf_kit-0.1.2.tar.gz
Algorithm Hash digest
SHA256 e056f99c6d1e30bf94c6d3cb4be26d1243a314aa5f0ad71a0534a0761b8371b1
MD5 f8710ad6ae3cbbf97e67be17e5c3944d
BLAKE2b-256 347881256f07b8c969de0b49410c61d1200f10aa19871a93a0a0be6f04eae7b1

See more details on using hashes here.

Provenance

The following attestation bundles were made for okf_kit-0.1.2.tar.gz:

Publisher: release.yml on vinodborole/okf-kit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file okf_kit-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: okf_kit-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 43.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for okf_kit-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1de361656e5456c83493312db79119c0cd50fbdf7d6cef2702ea04495b566a3e
MD5 b79905825bf5a9512f6b02bd7f355b0e
BLAKE2b-256 700592c55c9cd776e134d6319dbbb6b94704d5bd679ac7d678efdb9bf8df9dba

See more details on using hashes here.

Provenance

The following attestation bundles were made for okf_kit-0.1.2-py3-none-any.whl:

Publisher: release.yml on vinodborole/okf-kit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page