kglite-docs
Agent-first knowledge base for documents. Ingest PDFs, Office files, Markdown, HTML, or images; chunk + embed them with BAAI/bge-m3; cluster, tag, summarise, fact-check, translate, and review them — and serve the whole thing to AI agents over MCP.
Built on kglite (storage + vector search + clustering) and mcp-methods (MCP framework).
Why this and not generic RAG?
Most "RAG libraries" hand the agent search(query) → list[chunk] and stop. kglite-docs treats the corpus as a living knowledge graph that records who did what — and gives the agent typed tools to act on it.
- 📄 Multi-format ingest — PDF, DOCX, PPTX, MD, HTML, TXT, images. All flow into the same
Document → Page → Chunkshape. - 🤝 Agents are first-class nodes — their views, tags, summaries, verifications, and reviews are all queryable.
- ✅ Cross-checked summaries — one agent writes, a different agent verifies. Self-verification is rejected server-side.
- 📋 Review kanban — chunks move through
new → in_review → reviewedwith an immutable audit trail. - 🛡️ Grounding checks — score how well an agent's summary aligns with its sources. Catch hallucinations before they ship.
- 🌍 Translations — per-chunk, multi-translator, with author/reviewer provenance.
- 🖼️ Agent-driven OCR — scanned pages handed back as rendered PNGs; agent transcribes and the graph absorbs the result.
- 🔒 Local & private — parsing, embedding, and analysis all run on your machine against a local
.kglfile. The only network call is a one-time bge-m3 model download; your documents never leave the host. See Confidentiality.
Install
pip install kglite-docs
30 seconds of Python
from kglite_docs import Corpus
with Corpus.create("kb.kgl") as corpus: # auto-saves on exit
corpus.ingest_dir("./papers") # PDF / DOCX / PPTX / MD / HTML / images
hits = corpus.search("transformer attention", top_k=5, agent_id="me")
ctx = corpus.compose_context("transformer attention", max_tokens=3000)
# ctx["items"] is a ranked, token-budgeted bundle ready for your LLM prompt
30 seconds of agent loop
Cross-checked enrichment in five lines:
sid = corpus.add_summary(
target_id=hits[0]["id"], text="DPR uses a dual BERT encoder…",
agent_id="writer", model="opus-4.7",
)
# A different agent verifies — self-verification is rejected
corpus.verify_summary(sid, verdict="verified",
verifier_agent_id="reviewer", notes="checked p.5")
# Score how grounded the summary is in its source chunks
print(corpus.check_grounding(sid)["supported_fraction"]) # → 1.0
Run it as an MCP server
kglite-docs-mcp --db kb.kgl
Register with Claude Code:
claude mcp add kglite-docs -- kglite-docs-mcp --db /abs/path/kb.kgl
The agent now sees ~30 typed tools (search, compose_context, add_summary, verify_summary, tag_chunk, cluster_chunks, claim_next_review, …) plus cypher_query as an escape hatch.
Read the docs
📖 Full documentation at kglite-docs.readthedocs.io
- Getting started — 10 minutes from
pip installto a running agent - Agent workflows — research, comparison, fact-checking, OCR loops, hallucination guards
- Architecture — graph model, design rationale, the 30+ typed MCP tools
- API reference — every method, every argument, IDE-friendly type stubs
- Troubleshooting — common failure modes
- Confidentiality — everything runs local; what the one network call is (and isn't)
- Changelog
License
MIT.
Metadata
Release files for kglite-docs 0.0.15
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| kglite_docs-0.0.15.tar.gz | 212.4 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| kglite_docs-0.0.15-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 403.4 kB
Release files / kglite_docs-0.0.15.tar.gz
| Download URL | kglite_docs-0.0.15.tar.gz |
|---|---|
| Size | 212.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2c9847d2e84d4cc858f7b300b84d36e240ffdc00d690220620fe85542847eedc
|
|
BLAKE2b-256 checksum How to use checksums |
828d14bc0b3f92d88e97e588ff726cb0d945ba73277db1d171f49b0774f79d6a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 30, 2026.
Transparency logRelease files / kglite_docs-0.0.15-py3-none-any.whl
| Download URL | kglite_docs-0.0.15-py3-none-any.whl |
|---|---|
| Size | 190.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5c2db44b8a88cca985f2b7ed1c7916475f3b671171d205f5d751f50138c85f87
|
|
BLAKE2b-256 checksum How to use checksums |
82b501846b808b06f1065368172611435027e334c468bf84812a3f62f751d81c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 30, 2026.
Transparency logSecurity for kglite-docs 0.0.15
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for kglite_docs-0.0.15.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 30, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.