Skip to main content

klode

A klode — a rich vein — of grounded, verifiable knowledge, with the machinery to encode it and to supervise work against it. Every claim is anchored to a verbatim source and checked by a fail-closed linter, so a citation can't quietly rot: cite, don't recall.

That guarantee is referential, not semantic — it proves the quoted text is still there, in a current source, in exactly one place. It does not prove the quote supports the claim built on it. Green klode check means "no citation rot," never "this is true."

Zero runtime dependencies — Python 3.11+, standard library only.

The two loops

  • Loop A — encode expertise (klode.lib): turn sources into cited, retrievable knowledge. Every card claim carries a verbatim (grep: …) anchor; klode check fails if any citation stops resolving.
  • Loop B — supervise work (klode.gate): submit a draft, score it against a CriterionSpec — an authored, corpus-pinned, human-approved rubric with stable ids and behaviorally anchored levels — and return Go / Recycle. Each cited defect is grounded through klode.lib.verify, so the judge's citations are un-fakeable, and every authored field declares whether it is the source's words, a paraphrase, an inference, or not stated at all. The boundary is enforced: klode.gate consumes only the klode.lib public API, never its internals. See dev-docs/SPEC-criterion.md.

Install

pip install klode
# or from a source checkout:
pipx install -e .              # provides the `klode` and `klode-mcp` commands

Three surfaces over one engine

A knowledge base is a library.toml plus a corpus of cited cards. Point klode at one with -c, or register several in a manifest and address them by id (--kb <id> / --registry).

CLI — klode:

klode -c path/to/library.toml check                 # citation-rot linter (exit 1 on any broken citation)
klode -c path/to/library.toml search pacing         # retrieval over the cards
klode -c path/to/library.toml consult brevity       # read a craft lens
klode -c path/to/library.toml verify brevity "the exact quote"   # prove a quote against its source
klode ingest paper.pdf --shelf papers               # ingest a source -> clean, grep-ready text
klode kbs                                            # list the KBs in a registry

Add --json to any read verb for machine-readable output (the same structured result the MCP renders).

MCP server — klode-mcp (stdio): exposes the read/verify surface to an agent — list_kbs, search_sources, consult_dimension, consult_framework, zoom_card, verify_quote, diagnose, list_lenses. Serves one KB (-c) or many (--registry), and every grounded result names its KB.

Library — import klode.lib: the stable public-API facade — verify, search, consult, resolve, diagnose, Config. Cheap to import; pulls in no frontends or optional backends.

Ingestion — any format to grep-ready text

klode ingest detects the format by content signature (not the extension) and converges every source on one clean-text pipeline: PDF, EPUB, DOCX, HTML/XHTML, TXT. EPUB/DOCX/HTML/TXT are pure stdlib; only PDF's OCR tiers are optional. For table-heavy or scanned PDFs, point $KLODE_DOCLING_URL at a docling-serve endpoint (the GPU runs server-side — klode stays dependency-free) and pass --tier docling.

Architecture

One operations registry projects a single core to both surfaces (CLI + MCP), so they can differ in formatting but never in behaviour. Every grounded result carries structured provenance (which KB, which source, which policy). See dev-docs/ for the design record and SPEC-operations.md for the machine-readable operation table.

Status

0.3.0 — beta. The engine (klode.lib) is solid: 600 tests, a stable public-API facade, an AST layering guard, a content-sniffing multi-format ingester, and an MCP server, all with zero runtime dependencies. klode.gate (Loop B) is now a fail-closed supervising gate — freshness/review-aware grounding (verify_evidence), a bounded evidence-context op (verify_context), a fail-closed verified-context bundle (build_context_bundle), a shared structured anchor contract (parse_markers/Marker, regex/context/#n), and CriterionSpec v1 as its sole rubric input (field-level epistemics, behaviorally anchored levels, a computed corpus fingerprint, and a human-approval admission gate) are in place, and the rubric judge is real (LLMJudge: G-Eval two-step form-filling, position-bias-debiased by balanced permutation, transport-injectable, stdlib-only). What is not done is calibration: no rubric has yet been measured against human scores, so Verdict.calibrated is False and every verdict is marked non-production — by mechanism, not by convention. The optional entailment check (klode check --entail) pulls a small NLI model behind klode[entail] and is advisory, warn-only.

License

MIT — see LICENSE.

Metadata

Release files for klode 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for klode 0.3.0
File Size Uploaded
klode-0.3.0.tar.gz 199.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for klode 0.3.0
File Interpreter ABI Platform
klode-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 336.6 kB

Release files / klode-0.3.0.tar.gz

Download URL klode-0.3.0.tar.gz
Size 199.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f3548515582528ebfc0f35d92e20eca64d20e3edb9b9d68152d07db5037e1959
BLAKE2b-256 checksum
How to use checksums
3c648f2a76a76fc6f8b76b54d53fc19e639d5f18ce3ab7211f18b98db40d4b81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 11, 2026.

Transparency log

Release files / klode-0.3.0-py3-none-any.whl

Download URL klode-0.3.0-py3-none-any.whl
Size 136.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6ed3c1af705309dc3afb391ca0b9b5000565506eddd814eaabdd31bb907eaaf4
BLAKE2b-256 checksum
How to use checksums
be37b7273f116409047e609332259960df4cfe807a1a3bb91b1529c04842595a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 11, 2026.

Transparency log

Release history Release notifications | RSS feed

0.5.0

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

This release

0.3.0 This release

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page