Skip to main content

okforge: a local-first LLM knowledge-base engine

Project description

okforge

A local-first LLM knowledge-base engine. Point it at your documents; it builds an interlinked wiki — per-document summaries, cross-document concept and entity pages, extracted images, and real page citations back to source. The wiki is plain Markdown with YAML frontmatter, readable in Obsidian or any editor, and queryable from a CLI, a chat REPL, or any MCP client.

Why

Most retrieval setups hand an LLM a pile of raw chunks and hope. okforge instead compiles your sources into curated pages ahead of time — concepts and entities that already synthesize what's spread across many documents, each claim traceable back to a (p. N) citation in the original source. That matters most for models with limited context, including small models running entirely on your own hardware: they don't have to reconstruct an answer from scratch every query, and what they do say is checkable against a specific page, not just plausible-sounding.

The output follows the Open Knowledge Format (OKF) — typed frontmatter, relative links, a predictable directory layout — so the wiki a KB produces is portable, not locked to okforge itself.

Install

pip install git+https://github.com/okforge/okforge@main

Quick start

mkdir my-kb && cd my-kb
okforge init          # scaffold raw/, wiki/, .openkb/  (--json for scripts)
okforge add paper.md  # ingest (pre-convert non-md/pdf inputs first)
okforge query "What does the paper conclude?"
okforge chat          # interactive REPL over the wiki
okforge list --json   # machine-readable state (also: status, okf-lint)
okforge describe "One line about this project."   # curated description

Non-Markdown, non-PDF inputs (docx, pptx, scans, photo catalogs, …) need converting to Markdown first, by a tool that understands your material — a page-aware OCR script, for example. A sibling <doc>.pages.json page array is what enables real (p. N) citations in the generated summaries.

The query agent reads curated pages first, then drills for detail with a built-in grep_wiki lexical search (locate-then-read) rather than re-embedding everything. okf-lint checks a wiki bundle's OKF conformance.

Configuration lives in .openkb/config.yaml (model, language, entity types, …) and ~/.config/openkb/global.yaml (KB registry, default KB). The LLM endpoint is configured litellm-style — any OpenAI-compatible server works, including a local llama.cpp instance.

Topic tree (experimental, per-KB opt-in)

For knowledge bases that outgrow a flat concept list: set topic_tree: true in .openkb/config.yaml, then run okforge reindex. Existing concepts cluster into named concepts/<topic>/ directories, each with a _topic.md summary node; later ingests place new concepts by tree descent, and queries gain a read_topic navigation tool for browsing top-down instead of scanning a flat list.

Wiki layout

wiki/
  index.md              # document + concept index
  summaries/<doc>.md    # per-document summary (page citations when available)
  concepts/<name>.md    # cross-document concept pages
  entities/<name>.md    # named people/places/organizations/works
  sources/<doc>.md      # ingested source text
  sources/<doc>.json    # per-page text + images (when page-aware)
  sources/images/<doc>/ # extracted images
  log.md                # append-only ingest log

Development

uv run --extra dev python -m pytest tests/   # test suite
uv run --extra dev ruff check openkb tests   # lint
uv run --extra dev ruff format openkb tests  # format

Origins

okforge began as a hard fork of VectifyAI/OpenKB, in the spirit of Karpathy's LLM-wiki idea, and has since diverged deliberately rather than tracking it — local-only by default, its own document-conversion boundary, and OKF conformance as a first-class goal rather than an incidental format.

License

Apache-2.0. Portions originate from the upstream OpenKB project (copyright the original authors); okforge-specific changes are maintained at okforge/okforge.

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

okforge-0.6.3.tar.gz (768.8 kB view details)

Uploaded Source

Built Distribution

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

okforge-0.6.3-py3-none-any.whl (215.1 kB view details)

Uploaded Python 3

File details

Details for the file okforge-0.6.3.tar.gz.

File metadata

  • Download URL: okforge-0.6.3.tar.gz
  • Upload date:
  • Size: 768.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for okforge-0.6.3.tar.gz
Algorithm Hash digest
SHA256 92855a8214cb0f7573c1f8d400a997b6a5dec94ece20271591812ff405f90798
MD5 493e5e739da8327c4a44b00aaa27dc81
BLAKE2b-256 c15005dd74ada6ef04c96c27cbaeb7f39f45fb2d20a30e085ce88f9dab82b0f7

See more details on using hashes here.

Provenance

The following attestation bundles were made for okforge-0.6.3.tar.gz:

Publisher: publish.yml on okforge/okforge

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

File details

Details for the file okforge-0.6.3-py3-none-any.whl.

File metadata

  • Download URL: okforge-0.6.3-py3-none-any.whl
  • Upload date:
  • Size: 215.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for okforge-0.6.3-py3-none-any.whl
Algorithm Hash digest
SHA256 10b7b7199be2f94a385f835a866a9d468619bec1809aadf246d34649bf25e01e
MD5 afe9fba438f82b0ed87220fae9136c22
BLAKE2b-256 98e9665e2812c33021c9d05b2c95357c8a91cdf33db679e2cba24c647678f810

See more details on using hashes here.

Provenance

The following attestation bundles were made for okforge-0.6.3-py3-none-any.whl:

Publisher: publish.yml on okforge/okforge

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