Compile documents into a living Obsidian wiki. Based on Karpathy's LLM Wiki pattern.
Project description
Turn documents into a living wiki. One command. Any AI agent.
Klore compiles raw sources into a structured, interlinked Obsidian-compatible wiki. Drop PDFs, articles, and URLs into a folder. Get a living knowledge base with concept pages, entity profiles, cross-references, and a continuously updated synthesis.
Based on Andrej Karpathy's LLM Wiki pattern, extended with a three-tier model architecture where a Director model replaces the human editorial role.
Why not RAG?
RAG: query → search chunks → answer → forget
Klore: sources → compile → wiki → query → save → richer wiki → better answers
RAG retrieves fragments at query time. Every question re-discovers the same relationships from scratch. Nothing accumulates.
Klore compiles your sources into a wiki. Concepts get their own pages. Pages link to each other. When you ask a question with --save, the answer becomes a new page. Your knowledge compounds over time.
Before: Read 3,200+ lines of raw files per session. After: Read the index + 2 topic articles (~330 lines). 90% context reduction.
Quick Start
Install
pipx install klore # or: pip install klore
Set up your API key
Klore uses OpenRouter for model access. One key, any model:
export OPENROUTER_API_KEY="sk-or-v1-your-key-here"
Build your first wiki
klore init my-research
cd my-research
klore add ~/papers/attention-is-all-you-need.pdf
klore add https://en.wikipedia.org/wiki/Transformer_(deep_learning_model)
klore compile
Open wiki/ in Obsidian and explore. Or just read the markdown.
Agent Setup
Klore works with any AI coding agent. Run bash setup.sh to auto-configure all detected agents, or set up manually:
| Agent | Setup | How it works |
|---|---|---|
| Claude Code | claude plugin marketplace add ./klore/plugin && claude plugin install klore |
/wiki-init, /wiki-compile, /wiki-ask slash commands + SessionStart hook |
| Cursor | Open project in Cursor | Auto-loads .cursor/rules/klore.mdc |
| Windsurf | Open project in Windsurf | Auto-loads .windsurf/rules/klore.md via Cascade |
| Codex (OpenAI) | Open project with Codex | Auto-loads AGENTS.md |
| Gemini (Google) | Open project with Gemini | Auto-loads GEMINI.md |
| GitHub Copilot | Works automatically | Reads .github/copilot-instructions.md |
After setup, your agent can run klore commands directly. In Claude Code, use /wiki-* slash commands. In other agents, just ask: "compile the wiki" or "ingest this article".
The Claude Code plugin also injects your wiki's index into every session via a SessionStart hook, so your knowledge base becomes ambient context.
Commands
klore init [name] # Create a new knowledge base
klore add <file|url> # Add a source (PDF, HTML, markdown, image, URL)
klore ingest <file|url> # Add a source and compile in one step
klore compile # Compile sources into the wiki (incremental)
klore compile --full # Force full recompilation
klore compile --topic <name> # Recompile a specific concept only
klore ask "question" # Ask a question against the wiki
klore ask --save "question" # Ask and save the answer as a wiki report
klore watch # Watch raw/ for changes and auto-compile
klore lint # Run health checks (contradictions, broken links)
klore diff [--since 2w] # Show wiki changes over time
klore status # Show source/concept counts, compilation state
klore config set <key> <val> # Configure models, API key
How It Works
Klore runs a 7-step director-driven compilation pipeline with three model tiers:
| Tier | Default Model | Role |
|---|---|---|
| Director | Gemini 3 Flash | Editorial judgment, quality review, synthesis |
| Strong | Gemini 3.1 Pro | Concept pages, entity pages, Q&A |
| Fast | Gemini 3 Flash | Source extraction, tag normalization |
The Pipeline
- Extract (fast, concurrent) — convert raw sources to markdown
- Editorial Brief (director) — read each source against wiki state, decide what matters, flag contradictions
- Tag Normalize (fast) — merge synonym tags into canonical forms
- Build (strong, concurrent) — write source summaries, concept articles, entity pages, guided by editorial briefs
- Review (director) — review changes for quality and accuracy
- Index & Log — generate master index with
[[wikilinks]], append to operation log - Overview (director) — update
wiki/overview.md, the living synthesis of the entire knowledge base
The Director model makes the editorial decisions that matter: what's significant, what contradicts existing knowledge, what deserves its own page, and what doesn't. This replaces the human-in-the-loop from Karpathy's original pattern.
Cost
The three-tier architecture keeps costs low. The Director handles editorial judgment. The bulk of work runs on cheaper models.
| Sources | Est. Cost | Per Source |
|---|---|---|
| 5 | ~$0.30 | ~$0.06 |
| 10 | ~$0.60 | ~$0.06 |
| 25 | ~$1.50 | ~$0.06 |
| 50 | ~$3.00 | ~$0.06 |
Real-world example: compiled a 57,000-word book (11 chapters) into 20 concept pages, 2 entity pages, and a full synthesis for ~$0.50 using Gemini Flash 3.0 with thinking mode.
Incremental compiles are cheaper. Adding one source to an existing wiki costs ~$0.05-0.10.
Override models anytime:
klore config set model.director google/gemini-3-flash-preview:thinking
klore config set model.strong google/gemini-3.1-pro-preview
klore config set model.fast google/gemini-3-flash-preview
Architecture
my-research/
├── raw/ # Your source files (never modified by Klore)
│ ├── paper1.pdf
│ ├── article.md
│ └── diagram.png
├── wiki/ # Compiled output (Obsidian-compatible)
│ ├── index.md # Master catalog with [[wikilinks]]
│ ├── log.md # Append-only operation log
│ ├── overview.md # Living synthesis (Director-maintained)
│ ├── sources/ # Per-source summaries
│ ├── concepts/ # Synthesized concept articles
│ ├── entities/ # Named entity pages (people, orgs, tech)
│ └── reports/ # Filed Q&A answers (feed back into wiki)
├── .klore/
│ ├── config.json # Model and API configuration
│ └── agents.md # Wiki schema (editable)
└── .git/ # Auto-initialized, wiki changes tracked
Design Decisions
- Director-driven. A frontier model plays editor, deciding what matters and what contradicts. No human-in-the-loop required.
- No vector database. No embeddings. No RAG. The compiled wiki loads directly into the LLM context window.
- Entity pages. People, organizations, and technologies get their own pages, creating a rich relational graph.
- Living synthesis.
wiki/overview.mdis continuously updated as sources are added. - Reports compound. Q&A answers filed back into the wiki update concept pages. Knowledge compounds.
- Obsidian-native. Plain
.mdfiles with[[wikilinks]]. Graph view, backlinks, and search all work. - Incremental. Only new or changed sources are reprocessed. Prompt changes trigger full recompile.
- Git-tracked. Every compilation auto-commits.
klore diffshows how knowledge evolved. - Model-agnostic. Any OpenRouter model. Swap with one config change.
Inspired By
Andrej Karpathy's LLM Wiki pattern — extended with autonomous editorial judgment via a three-tier model architecture.
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 klore-0.1.1.tar.gz.
File metadata
- Download URL: klore-0.1.1.tar.gz
- Upload date:
- Size: 6.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f878e92946b69e1d7134c28c19f7ee27b896cfaebdfa5889452c83b6424b8730
|
|
| MD5 |
8811d095325df740bfbaabde4fa6cd65
|
|
| BLAKE2b-256 |
a51934cb325e565fd77f4bad5e95f316737b445abd5730ec099cec1d0fe9f94d
|
File details
Details for the file klore-0.1.1-py3-none-any.whl.
File metadata
- Download URL: klore-0.1.1-py3-none-any.whl
- Upload date:
- Size: 59.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1dda751c46afb19f9edf54355750e265d4899ef60eda3b7590cfc7da16fcbc82
|
|
| MD5 |
619796ceb37db3c645cf5e11e04e78f4
|
|
| BLAKE2b-256 |
ad16e62fe14d0b073705edb8b24dc06f73f254c9a58bb0e8fdd6807851e7c150
|