okfsmith GitHub

Messy documents in. Knowledge bundles out.

Ingests PDFs, Markdown, Office files, Notion exports and wiki dumps, and emits OKF v0.2 bundles your agents can verify.

pip install okfsmith

Offline-first ingest. No API key required. Python 3.10 or newer.

kb/courses/cs101.md OKF v0.2 concept
---
type: Course
title: "CS 101: Introduction to Programming"
sources:
  - id: python-tutorial
    resource: https://docs.python.org/3/tutorial/
generated:
  by: okfsmith/manual
verified:
  - by: human:bilal
status: stable
---
A concept file from the example bundle. The whole bundle is plain markdown and YAML, readable in any editor, with or without okfsmith.

The ore: PDFs, Markdown, DOCX, PPTX, XLSX, Notion exports, wiki dumps, plain text. If it holds knowledge, the forge takes it in.

From raw ore to a finished bundle, in seven heats.

Clean markdown already has good tooling. The messy middle is where knowledge actually lives: 200-page PDFs with broken reading order, sprawling Notion exports, wiki dumps. That is what okfsmith ingests first.

  1. 1Parselocal, keyless parsers
  2. 2Sectionsplit into concepts
  3. 3Extractdraft and critic, cited
  4. 4Linkbuild the graph
  5. 5EmitOKF v0.2 markdown
  6. 6Validatesection 11 conformance
  7. 7ServeMCP, chat, dashboard

A forge for knowledge, not a black box.

Every concept okfsmith emits carries its sources, a trust tier, and lifecycle metadata, and every bundle passes the built-in validator. Here is what ships today.

FOR YOUR AGENTS

One-command MCP server
okfsmith mcp serves any bundle over stdio, SSE, or streamable HTTP, with index, search, get, and neighbors tools, plus traverse and diff.
Grounded chat
okfsmith chat is a REPL over your bundle that answers with concept citations. No relevant concepts, no invented answer. It shows you what it found instead.
Web dashboard
okfsmith dashboard opens a local, token-secured UI: drag-and-drop ingest with live progress, an interactive knowledge graph, grounded chat, validation, and eval.

TRUST, CHECKED IN

Provenance and trust tiers
Every concept carries sources[] citations and a generated or verified tier. Answers trace back to the exact document they came from.
Section 11 validator
The spec's hard conformance rules, E001 to E004, run on every bundle, with advisory lints for dead links, orphans, and stubs. Broken links are warnings, never errors.
Temporal model
Validity and supersession are first-class: concepts expire and get replaced, and --as-of lets you query the bundle as it looked on any date.

KEPT CURRENT

Incremental sync
okfsmith sync processes only new, changed, renamed, or deleted sources, with --watch, --dry-run, and text or JSON output. Re-ingest without the wait.
Similarity deduplication
The extraction pipeline merges near-duplicate entities with stemmed-token Jaccard similarity. Dependency-free, offline, and deterministic.
Eval and CI gating
okfsmith eval runs golden-set question answering with RAG Triad scores and a retrieval-versus-generation diagnosis, and a --fail-under gate for CI pipelines.
Governed write-back
MCP write tools are trust-tier gated: agents can update the bundle through preview, write, and audit flows that respect the same tiers reading does.

Sixty seconds to a bundle.

Install, scaffold a bundle, ingest offline, validate, and draw the graph. Then point any MCP-capable agent at it.

TERMINAL
$ pip install okfsmith

$ okfsmith init ./kb

$ okfsmith ingest ./kb notes/ report.pdf --no-llm
  # offline first pass

$ okfsmith validate ./kb

$ okfsmith graph ./kb --format html
  # writes ./kb/viz.html, open it in a browser
  1. Init

    Scaffold a bundle with index.md and log.md. One command, no config files.

  2. Ingest

    Parse PDFs, Markdown, Office docs, or whole folders. --no-llm gives a fast, offline, deterministic first pass.

  3. Validate

    Check section 11 conformance: hard rules E001 to E004 plus advisory lints for dead links, orphans, and stubs.

  4. Serve

    One MCP command exposes the bundle to any capable agent, every answer traced to sources[].

Not just markdown. Markdown with a memory.

A folder of markdown cannot tell you where a claim came from, whether a human checked it, or when it expires. An OKF bundle can, in plain YAML that any tool can read. Only type is required by the OKF spec. okfsmith adds the metadata that makes a bundle safe to act on:

sources[] Provenance. Records exactly which documents each concept came from, deduped by SHA-256.
generated / verified Trust tiers. Separates machine drafts from human-checked knowledge, so agents know what to lean on.
status / stale_after Lifecycle. Concepts carry a status and an expiry, and superseded concepts point at what replaced them. Knowledge expires on purpose, not by accident.
the validator Hard conformance rules E001 to E004, plus advisory lints for dead links, orphans, and stubs. Broken links are warnings, never errors, per spec section 6.

Ask it in the terminal. Or open the dashboard.

The same bundle, the same CLI underneath. okfsmith chat for a grounded REPL, okfsmith dashboard for the full product in your browser.

okfsmith web dashboard: knowledge overview with bundle stats, ingest, graph, chat and validation
The dashboard, served from your own machine.
EXAMPLE EXCHANGE, OKFSMITH CHAT
kb > how do I authenticate?
Use a Bearer token in the Authorization header [api/auth].
Sources: [api/auth]
  • Citations on every answer

    Each reply names its concept and lists its sources.

  • Honest by construction

    No relevant concepts, no invented answer. In extractive mode it shows the keyword-matched concepts themselves.

  • Full slash-command set

    /ingest, /search, /validate, /graph, /doctor and more, without leaving the REPL.

Binds to 127.0.0.1 only
Fresh login token every launch
Zero third-party resources
Works fully offline

One command. Any MCP-capable agent.

The bundle is the product; the MCP server is how agents read it. Every answer traces back to sources[] in the bundle.

  • Read freely. Write carefully.

    Point Claude, Codex, or any MCP client at a bundle and it can search, read, and walk the concept graph. When agents write back, the same trust tiers that govern reading govern writing.

  • Five core tools

    index, list, search, get, neighbors, plus graph traverse and bundle diff.

  • Governed write-back

    Preview, write, and audit flows, gated by trust tier.

  • Skill pack included

    skills/okfsmith-build/SKILL.md teaches agents the init, ingest, validate, serve loop.

TERMINAL
$ pip install "okfsmith[mcp]"

$ okfsmith mcp ./kb

# transports: stdio, SSE, streamable HTTP
# tools: index, list, search, get,
#        neighbors, traverse, diff

Bring your own model, or none

--no-llm ingests fully offline, no key, no network. Add a model only for richer extraction: Ollama locally, or one key for any hosted provider. Keys are never logged, never shown, never written to disk.

openrouter, anthropic, openai, gemini, groq, mistral, deepseek, together, fireworks, deepinfra, anyscale, perplexity, xai, agentrouter, lmstudio, ollama, plus any OpenAI-compatible endpoint via --api-base.

Install it your way.

The base install is offline-first. Extras add Office parsing, the MCP server, or OCR, only if you want them.

$ pip install okfsmith
$ pip install "okfsmith[office]" # DOCX, PPTX, XLSX
$ pip install "okfsmith[mcp]" # MCP server
$ pip install "okfsmith[ocr]" # Docling OCR sidecar
$ pipx install "okfsmith[office,mcp]"
$ okfsmith doctor # verify your setup

Latest release v0.37.1, on PyPI. Python 3.10 or newer, Apache-2.0.

Questions, answered straight.

The Open Knowledge Format (v0.2), Google's spec for portable knowledge bundles: markdown files with YAML frontmatter plus reserved index.md and log.md files. Canonical reference: GoogleCloudPlatform/open-knowledge-format on GitHub.

It enforces the OKF section 11 conformance rules (validate), tracks provenance and trust tiers, dedups sources by SHA-256, links concepts into a graph, and serves the bundle to agents over MCP, while keeping everything as plain markdown you can read without the tool.

No. --no-llm ingests fully offline. An LLM (Ollama or an OpenAI-compatible API) gives richer extraction; it never changes the bundle format.

Not by okfsmith itself. Parsing, validation, and the graph viewer are offline. Only LLM extraction contacts a model endpoint, and Ollama keeps that on your machine too.

3.10 and newer.

Apache-2.0.

Yes, it is markdown and YAML. index.md lists the concepts; each concept is one file. Any markdown reader works.

okfsmith builds a curated, validated, provenance-tracked bundle, not an embedding index. The two complement each other; the MCP search tool does full-text search over the finished bundle.

Your docs are already knowledge. Forge them.

One install. One command per stage. A bundle your agents can check, cite, and trust.

GitHub Source code, issues, and the full documentation set.
PyPI The install package. Latest release v0.37.1.
Documentation Guides, the dashboard tour, and the full command reference.
OKF spec The Open Knowledge Format v0.2 specification that okfsmith conforms to.