LLM-powered markdown knowledge base CLI โ knowledge synthesized at ingest time, not query time.
Project description
๐ง LLM Wiki Agent
An open-source CLI that turns Claude into a self-maintaining knowledge base.
Knowledge is synthesized at ingest time โ not rediscovered on every query.
The Idea
Most RAG systems make the LLM do all the heavy lifting at query time โ searching raw docs and synthesizing answers from scratch on every request.
LLM Wiki flips this: Claude reads and synthesizes your documents when you add them, compiling structured markdown pages. When you ask a question, Claude reads pre-built wiki pages โ not raw source text.
Basic RAG โ question โ search raw docs โ LLM answers from scratch (every time)
LLM Wiki โ ingest doc โ Claude compiles wiki โ question โ Claude reads wiki
The wiki grows smarter with every document added. Contradictions are flagged. Entities are cross-referenced. Knowledge compounds.
Architecture
llm-wiki/
โโโ CLAUDE.md โ Agent instructions: how to maintain the wiki
โโโ agent.py โ CLI entrypoint (interactive TUI)
โ
โโโ raw/ โ Your source documents (immutable, never modified)
โ โโโ assets/ โ Downloaded images
โ
โโโ wiki/ โ LLM-generated knowledge base
โโโ index.md โ Catalog of all pages
โโโ log.md โ Chronological action log
โโโ overview.md โ High-level synthesis across all sources
โโโ sources/ โ One summary page per ingested document
โโโ entities/ โ One page per person, concept, tool, or topic
Three Layers
| Layer | What It Is | Who Owns It |
|---|---|---|
| Raw sources | Documents, articles, text files โ immutable source of truth | You |
| The wiki | Synthesized markdown: summaries, entity pages, index, log | Claude |
| The schema | CLAUDE.md โ instructions for how Claude maintains the wiki |
Both |
Requirements
- Python 3.10+
- An Anthropic API key
Install
Clone and run from source:
git clone https://github.com/S7hrenik/llm-wiki
cd llm-wiki
pip install anthropic rich
Create a .env file in the project root with your API key:
ANTHROPIC_API_KEY=sk-ant-...
PyPI package coming soon โ
pip install llm-wikibasewill be available on the first release.
Quick Start
python agent.py
You'll land in an interactive menu:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ โโโ โโโ โโโโ โโโโ โโโ โโโโโโโโโ โโโโโโ โ
โ โโโ โโโ โโโโโ โโโโโ โโโ โโโโโโโโโ โโโโโโโ โ
โ โโโ โโโ โโโโโโโโโโโ โโโ โโ โโโโโโโโโโโโโ โโโ โ
โ ... โ
โ Knowledge synthesized at ingest time โ not on every query โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
[1] ๐ Init Bootstrap a new wiki
[2] ๐ฅ Ingest Add a document or URL to the wiki
[3] ๐ Query Ask a question, get a cited answer
[4] ๐ง Lint Health-check for gaps & contradictions
[5] ๐ Status Wiki stats at a glance
[0] ๐ Exit
Step-by-step
1. Init โ bootstrap the wiki (run once):
Choose: 1
2. Ingest โ add a document or URL:
Choose: 2
File path or URL: raw/my-paper.md
Claude creates a source summary page, extracts 5โ15 entity pages, updates the index, and logs the action.
3. Query โ ask anything:
Choose: 3
Your question: What are the key contributions of the Transformer architecture?
Claude reads the pre-compiled wiki and responds with citations to specific pages.
4. Lint โ audit the wiki for contradictions, broken links, and gaps:
Choose: 4
5. Status โ quick stats at a glance:
Choose: 5
๐ Source pages 3
๐ท๏ธ Entity pages 27
๐ Last ingest 2026-05-22 20:09
๐ Wiki dir /home/user/my-wiki/wiki
How It Works
Ingest Flow
When you run Ingest on a document:
- Claude reads the full source document
- Writes a source summary page to
wiki/sources/<slug>.md - Creates or updates 5โ15 entity pages in
wiki/entities/(people, concepts, tools, organizations) - Updates
wiki/index.mdwith the new entries - Flags any contradictions with existing pages
- Appends a timestamped entry to
wiki/log.md
Query Flow
When you run Query:
- Claude reads
wiki/index.mdto find relevant pages - Drills into the most relevant entity and source pages
- Synthesizes a cited answer โ every fact links back to the wiki page it came from
- Optionally saves the answer as a new wiki page (explorations compound)
Lint
Audits the entire wiki for:
- Contradictions between pages
- Orphaned pages not referenced in
index.md - Entities mentioned but missing their own page
- Stale or incomplete pages
- Cross-reference gaps
Tech Stack
| Tool | Purpose |
|---|---|
Claude (claude-sonnet-4-6) |
The brain โ reads, writes, synthesizes the wiki |
| Anthropic Python SDK | API wrapper |
| Rich | Terminal UI โ panels, spinners, color |
| Python 3.10+ | CLI orchestration, file I/O |
| Markdown files | The wiki itself โ plain text, git-trackable |
| GitHub Actions | CI/CD: tests, linting, PyPI publish |
CLAUDE.md โ The Schema
CLAUDE.md is the agent's operating manual. It defines:
- Folder layout and file naming conventions
- How
index.mdandlog.mdare structured - Entity page format (front matter, sections, contradiction flags)
- Cross-referencing rules between pages
- Contradiction handling (never silently overwrite โ preserve both versions with citations)
- Token budget hints for query mode (which files to read first)
You can edit CLAUDE.md to customize how the wiki behaves for your domain.
GitHub Actions
| Workflow | Trigger | What It Does |
|---|---|---|
ci.yml |
Every PR and push to main |
Runs pytest on Python 3.10, 3.11, 3.12 |
lint.yml |
Every PR | Runs ruff + black check |
publish.yml |
New GitHub release tag | Auto-builds and publishes to PyPI |
All PRs must pass CI and Lint before merging into main.
Contributing
Pull requests are welcome. For major changes, open an issue first.
git clone https://github.com/S7hrenik/llm-wiki
cd llm-wiki
pip install anthropic rich pytest ruff black
python -m pytest tests/
Make sure ruff check . and black --check . pass before submitting.
All changes go through a branch โ PR โ checks green โ merge workflow.
See CONTRIBUTING.md for full guidelines.
License
Built with Claude by Shrenik Purvant
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 llm_wikibase-0.1.1.tar.gz.
File metadata
- Download URL: llm_wikibase-0.1.1.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8546133f6443503257ca0815c334f55903bb69596b41edc76699e7c7430d8d06
|
|
| MD5 |
cc3979c1dea1acded80d62162b07d9d3
|
|
| BLAKE2b-256 |
7e95dbb746a85eb246c6f186bc5ad3ac99ba4ab9fa50fa6bf6fd170d51d4f72a
|
Provenance
The following attestation bundles were made for llm_wikibase-0.1.1.tar.gz:
Publisher:
publish.yml on S7hrenik/llm-wiki
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
llm_wikibase-0.1.1.tar.gz -
Subject digest:
8546133f6443503257ca0815c334f55903bb69596b41edc76699e7c7430d8d06 - Sigstore transparency entry: 1604625107
- Sigstore integration time:
-
Permalink:
S7hrenik/llm-wiki@21539f09f32ef4110bcd66b41de1d6b79ed60209 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/S7hrenik
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@21539f09f32ef4110bcd66b41de1d6b79ed60209 -
Trigger Event:
release
-
Statement type:
File details
Details for the file llm_wikibase-0.1.1-py3-none-any.whl.
File metadata
- Download URL: llm_wikibase-0.1.1-py3-none-any.whl
- Upload date:
- Size: 12.9 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 |
d1ccf8a804eed90dd68ddfd88afeb65cf66cb715fe87ae10ae29b04b5ba2e19e
|
|
| MD5 |
b3dd3e728ed4c7e4e2f23c6ef7f81ed0
|
|
| BLAKE2b-256 |
042bcaf02691b8afc7835ae031051a873d1ab252040baeb5ade3e24be0783b41
|
Provenance
The following attestation bundles were made for llm_wikibase-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on S7hrenik/llm-wiki
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
llm_wikibase-0.1.1-py3-none-any.whl -
Subject digest:
d1ccf8a804eed90dd68ddfd88afeb65cf66cb715fe87ae10ae29b04b5ba2e19e - Sigstore transparency entry: 1604625204
- Sigstore integration time:
-
Permalink:
S7hrenik/llm-wiki@21539f09f32ef4110bcd66b41de1d6b79ed60209 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/S7hrenik
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@21539f09f32ef4110bcd66b41de1d6b79ed60209 -
Trigger Event:
release
-
Statement type: