Agent-first PDF knowledge base — chunk, embed, cluster, enrich, and serve over MCP. Built on kglite + bge-m3.
Project description
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.
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
- Changelog
License
MIT.
Project details
Release history Release notifications | RSS feed
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 kglite_docs-0.0.6.tar.gz.
File metadata
- Download URL: kglite_docs-0.0.6.tar.gz
- Upload date:
- Size: 111.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86cfe3efa343dce4277faa68f83a82f7b951852892b98b2493cc064e0bf76a10
|
|
| MD5 |
5d9f99d7c2800daff71a036fb393614e
|
|
| BLAKE2b-256 |
577d1370acfbcf1558eea4b762a1799f5c1da4cc8785ed55252f0f09be52e337
|
Provenance
The following attestation bundles were made for kglite_docs-0.0.6.tar.gz:
Publisher:
release.yml on kkollsga/kglite-docs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kglite_docs-0.0.6.tar.gz -
Subject digest:
86cfe3efa343dce4277faa68f83a82f7b951852892b98b2493cc064e0bf76a10 - Sigstore transparency entry: 1672438854
- Sigstore integration time:
-
Permalink:
kkollsga/kglite-docs@fe28f298f666b680d4d30c4a308fbe3c76c05435 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/kkollsga
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@fe28f298f666b680d4d30c4a308fbe3c76c05435 -
Trigger Event:
workflow_run
-
Statement type:
File details
Details for the file kglite_docs-0.0.6-py3-none-any.whl.
File metadata
- Download URL: kglite_docs-0.0.6-py3-none-any.whl
- Upload date:
- Size: 111.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f7c6920ba248499c90e98df46d432e523264c3713f61715ef5551e98de95391
|
|
| MD5 |
d78fa4e83512fabd7d77a6586ebda3c6
|
|
| BLAKE2b-256 |
4054bc17a5e76cd79bb68c4c7c82d4599a3f90ff5f84070306579e6337c125c0
|
Provenance
The following attestation bundles were made for kglite_docs-0.0.6-py3-none-any.whl:
Publisher:
release.yml on kkollsga/kglite-docs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kglite_docs-0.0.6-py3-none-any.whl -
Subject digest:
1f7c6920ba248499c90e98df46d432e523264c3713f61715ef5551e98de95391 - Sigstore transparency entry: 1672438888
- Sigstore integration time:
-
Permalink:
kkollsga/kglite-docs@fe28f298f666b680d4d30c4a308fbe3c76c05435 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/kkollsga
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@fe28f298f666b680d4d30c4a308fbe3c76c05435 -
Trigger Event:
workflow_run
-
Statement type: