Skip to main content

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.

PyPI Python Docs License: MIT

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 → Chunk shape.
  • 🤝 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 → reviewed with 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 .kgl file. 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

License

MIT.

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

kglite_docs-0.0.11.tar.gz (145.5 kB view details)

Uploaded Source

Built Distribution

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

kglite_docs-0.0.11-py3-none-any.whl (133.9 kB view details)

Uploaded Python 3

File details

Details for the file kglite_docs-0.0.11.tar.gz.

File metadata

  • Download URL: kglite_docs-0.0.11.tar.gz
  • Upload date:
  • Size: 145.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kglite_docs-0.0.11.tar.gz
Algorithm Hash digest
SHA256 22ea1ca88b087f14e2f2d567e14afd295d5d5f1672d51cc08c3b13eb2f4bbba7
MD5 ddff7ed19d4de75791558463ecf52b2c
BLAKE2b-256 7c8e38b2df19084340f154e496ecaf46936f4fef4f10500ae24e4d89e67be3da

See more details on using hashes here.

Provenance

The following attestation bundles were made for kglite_docs-0.0.11.tar.gz:

Publisher: release.yml on kkollsga/kglite-docs

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

File details

Details for the file kglite_docs-0.0.11-py3-none-any.whl.

File metadata

  • Download URL: kglite_docs-0.0.11-py3-none-any.whl
  • Upload date:
  • Size: 133.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kglite_docs-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 99823e28783aa9acf9f668701acd5187dc875bdb9ca973f327e1240232b1a903
MD5 78348f4d7ba6762c3383896906df3f3f
BLAKE2b-256 8cc0d4472138c27f5e8fb54efa1779aa105dd8178be8df6ac142b1d03b0bf4b0

See more details on using hashes here.

Provenance

The following attestation bundles were made for kglite_docs-0.0.11-py3-none-any.whl:

Publisher: release.yml on kkollsga/kglite-docs

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