Skip to main content

kompend

kompend — compile scattered documents into an interlinked, queryable wiki with any LLM

kompend refuses to pick a side in the LLM-wiki space. Existing tools either demand a frontier-model subscription and lock you into their stack, or insist everything run on an underpowered local model while lecturing you about privacy. kompend is provider-agnostic, adapts to whatever LLM you have — from a local 8B model to a frontier API — and uses structure-preserving parsing so technical content (tables, equations, figures) survives extraction intact. Read the full motivation →

OKF v0.2 compliant — produces Open Knowledge Format bundles by default. ACP agent — implements the Agent Client Protocol for credential-free LLM injection via kompend agent. PydanticAI-native — every LLM call routes through typed agents with failover chains; models.dev catalog resolves any provider.

How it works

kompend 5-tier pipeline: Preprocessing → Chunking → Resolution → Compilation → Output

kompend runs a 5-tier pipeline — each tier independently replaceable, with a clear Base interface:

Tier What it does Needs LLM?
T1 Preprocessing Parse PDF, DOCX, PPTX, EPUB, XLSX, HTML, URLs into a uniform ParsedDocument preserving structure (headings, tables, figures, equations, code). ❌
T2 Chunking Split into a ChunkTree sized to the model's context window (auto-detected). Atomic elements never split; text runs via recursive paragraph→line→sentence→token boundaries. ✅
T3 Resolution Extract entities, resolve cross-references, acronym/definition consistency. Optional VLM enricher for figure captioning. ✅
T4 Compilation Build an interlinked CompiledWiki graph. Two backends: TwoPhaseCompiler (default, extract→generate) and WiCERCompiler (iterative compile→evaluate→refine). ✅
T5 Output Write OKF bundles (default), Markdown, JSON, or Typst. Optionally index for semantic search and synthesize an overview. ❌

kompend ingest stops at T1 — no LLM, no cost. kompend compile runs T2–T5.

Quick start

uv tool install kompend

# 1. Initialize a project
kompend init ./my-wiki && cd ./my-wiki

# 2. Ingest sources (T1 only — no LLM needed)
kompend ingest                              # everything in sources/
kompend ingest paper.pdf notes.docx *.xlsx  # explicit files
kompend ingest --url https://arxiv.org/pdf/2605.07068v1

# 3. Compile the wiki (T2–T5 — needs an LLM)
kompend compile --set compile.llm.default_model=ollama/qwen3

# 4. Query it
kompend query "How does attention scale with sequence length?"

Debugging tip: kompend parse paper.pdf --elements inspects one file's extracted structure before ingesting the full corpus. If parsing looks wrong, fix it first — the pipeline won't recover from bad extraction.

Commands

Command Purpose
kompend init [DIR] Scaffold a wiki project (--bare, --force, --git)
kompend ingest FILES... Parse sources into .kompend/cache/ (T0–1, no LLM)
kompend compile FILES... Full pipeline → interlinked wiki (T2–5, needs LLM)
kompend query "..." Ask a natural-language question against the wiki
kompend organize LLM-categorize sources/ into a hierarchy and move files
kompend parse FILES... Debug: parse documents and print structure (--elements)
kompend doctor Validate dirs, parsers, LLM/VLM connectivity
kompend status Show source/article/word counts and last compile time
kompend config get/set/list/path Inspect and edit configuration (5-layer precedence)
kompend lint run Lint wiki: 8 structural + 4 LLM rules (--fix, --llm)
kompend review list/approve/reject Manage the review queue for compiled pages
kompend capture "..." / learn / distill Capture notes → synthesize into wiki pages
kompend write "TITLE" One-shot wiki page from a title + optional sources
kompend provenance [SLUG] Trace a page to its source files
kompend memory add/search/synthesize Manage query memory and context synthesis
kompend serve Start the web UI (--host, --port, --open)
kompend mcp Start the MCP server (stdio, for AI clients)
kompend agent Start the ACP agent (editor integration)

Full option reference: kompend <command> --help

Key subsystems

Subsystem Description
RAG / Search HybridRetriever fuses FTS + vector + token-overlap + raw sources via reciprocal rank fusion. Embeddings via litellm: prefix or sentence-transformers.
Memory lifecycle Confidence decay, tier promotion (working → episodic → semantic → procedural), supersession detection.
Review queue Route compiled pages through approve/reject/lock before publishing.
MCP server Stdio server exposing parse_document, compile_wiki, wiki_capture, wiki_learn to Claude Code, Cursor, etc.
ACP agent Agent Client Protocol server: editors inject LLM credentials via providers/set — no API keys in your config.
Configuration 5-layer precedence: CLI > env (KOMP_*) > project (.kompend/config.toml, walks up) > global (~/.config/kompend/) > defaults.

LLM configuration

kompend uses provider/model strings resolved by build_model():

  1. models.dev catalog — custom providers with known API URLs (claudinio/, opencode/, deepseek/) construct OpenAI-compatible models.
  2. pydantic-ai native — standard providers (ollama/, openai/, anthropic/, google/) via infer_model().

API keys come from the env var each provider advertises. No api_key in config:

[compile.llm]
default_model = "ollama/qwen3"
fallback_chain = ["openai/gpt-4o"]   # tried when the primary fails
reasoning_effort = "none"             # tame over-thinking local models

kompend auto-detects each model's context window and sizes every call to fit. Recommended: a model with ≥ 32K context (16K is the functional floor; the generation stage reserves 16K output tokens). See the LLM configuration guide for the full breakdown.

See the LLM configuration guide for the full reference.

Documentation

See docs/index.md for the complete documentation index — architecture deep-dives, tier references, WiCER loop, CLI guides, integrations.

Development

git clone <repo-url> && cd kompend
uv sync                    # install deps
uv run kompend --help         # verify CLI
uv run pytest tests/       # run tests
mise test                  # run all quality checks

Installing kompend as a dependency

Install from PyPI:

uv add kompend
# or
pip install kompend

The published package is kompend (latest release tracks the latest YYYY.M.N tag; current is 2026.10.4). Optional extras for parser backends and LLM providers are declared in the repository's pyproject.toml and resolve as uv add "kompend[<extras>]" or pip install "kompend[<extras>]".

License

MIT. See LICENSE.

Acknowledgments

Metadata

Release files for kompend 2026.10.23

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

Source distribution (sdist)

Source distribution for kompend 2026.10.23
File Size Uploaded Provenance
kompend-2026.10.23.tar.gz 14.0 MB With provenance Details

Built distribution (wheel)

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

Total release size: 14.9 MB

Release files / kompend-2026.10.23.tar.gz

Download URL kompend-2026.10.23.tar.gz
Size 14.0 MB
Tags Source
SHA-256 checksum
How to use checksums
8bdf9937f12cf087d8599f509c60f06c2a1e5903dccc8319b4af1b5f10270cc0
BLAKE2b-256 checksum
How to use checksums
b57ad3052a6d1a161b3e138a058ab0fbba42e93701dddfbd5266da9a223be90b
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 Oct 18, 2026.

Transparency log

Release files / kompend-2026.10.23-py3-none-any.whl

Download URL kompend-2026.10.23-py3-none-any.whl
Size 851.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
565b66e9134ba2fffa0ab51ae1e96cd2754f9466170134a1368903cadec4a28e
BLAKE2b-256 checksum
How to use checksums
ea61e274650691f06a0fce17fbc50079c96fca8a7552ac2a60086bd4778f81bf
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 Oct 18, 2026.

Transparency log

Security for kompend 2026.10.23

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.

Select from 2 files

Attestation for kompend-2026.10.23.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 Oct 18, 2026.

Transparency log

A 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.

Release history Release notifications | RSS feed

This release

2026.10.23 This release

2 release files Full provenance

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