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/, .okforge/ (--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
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 .okforge/config.yaml (model, language, entity
types, …) and ~/.config/okforge/global.yaml (KB registry, default
KB). The LLM endpoint is configured litellm-style — any
OpenAI-compatible server works, including a local llama.cpp instance.
Ingesting scans and non-text documents
okforge add accepts Markdown, plain text, and PDF directly. Anything
else — docx, pptx, scanned pages, photo catalogs — needs converting to
Markdown first, by a tool that knows your material. For scanned pages
specifically, okforge-vision-ocr
(pip install okforge-vision-ocr) is built for exactly this: one
vision-LLM call per page produces both a clean Markdown transcription
and extracted photos/figures, plus a sibling <doc>.pages.json page
array that okforge add reads directly for real (p. N) citations in
the compiled summaries — no separate wiring needed.
okforge-vision-ocr scanned.pdf raw/book.md # OCR + photo extraction
okforge add raw/book.md # ingest, with page citations
It works against any OpenAI-compatible vision-language model (tuned against a locally-hosted Qwen3.6-27B-MTP, but not tied to it).
Topic tree (experimental, per-KB opt-in)
For knowledge bases that outgrow a flat concept list: set
topic_tree: true in .okforge/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 okforge tests # lint
uv run --extra dev ruff format okforge 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file okforge-0.8.0.tar.gz.
File metadata
- Download URL: okforge-0.8.0.tar.gz
- Upload date:
- Size: 773.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
30576726c61a52bae05caf6c138dce2c0fb9be0f2424e178d57057aa8ef3d02e
|
|
| MD5 |
a4bb87440f229ed7f88f714526dde38d
|
|
| BLAKE2b-256 |
fa213427dd6d59568c2278b79b9bb99c01a1cb7bd7efb4085157e397a7946765
|
Provenance
The following attestation bundles were made for okforge-0.8.0.tar.gz:
Publisher:
publish.yml on okforge/okforge
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
okforge-0.8.0.tar.gz -
Subject digest:
30576726c61a52bae05caf6c138dce2c0fb9be0f2424e178d57057aa8ef3d02e - Sigstore transparency entry: 2121166552
- Sigstore integration time:
-
Permalink:
okforge/okforge@3643f79a4a43b14a8adc96ac8661133509a9dc68 -
Branch / Tag:
refs/tags/v0.8.0 - Owner: https://github.com/okforge
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3643f79a4a43b14a8adc96ac8661133509a9dc68 -
Trigger Event:
push
-
Statement type:
File details
Details for the file okforge-0.8.0-py3-none-any.whl.
File metadata
- Download URL: okforge-0.8.0-py3-none-any.whl
- Upload date:
- Size: 217.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
657738440ed5b18bb19a5de5d9e6cc4aaf89c204cf34341c2c6b42172bd73f49
|
|
| MD5 |
dee65c3f07161c9c081da9ee153b942b
|
|
| BLAKE2b-256 |
ee8590386e9d97f790095e1ee0fb2c99d43f7a2b2e204acf8c75657a67094a57
|
Provenance
The following attestation bundles were made for okforge-0.8.0-py3-none-any.whl:
Publisher:
publish.yml on okforge/okforge
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
okforge-0.8.0-py3-none-any.whl -
Subject digest:
657738440ed5b18bb19a5de5d9e6cc4aaf89c204cf34341c2c6b42172bd73f49 - Sigstore transparency entry: 2121166684
- Sigstore integration time:
-
Permalink:
okforge/okforge@3643f79a4a43b14a8adc96ac8661133509a9dc68 -
Branch / Tag:
refs/tags/v0.8.0 - Owner: https://github.com/okforge
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3643f79a4a43b14a8adc96ac8661133509a9dc68 -
Trigger Event:
push
-
Statement type: