Skip to main content

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.

CI Lint License: MIT Python PyPI - Coming Soon


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


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-wikibase will 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:

  1. Claude reads the full source document
  2. Writes a source summary page to wiki/sources/<slug>.md
  3. Creates or updates 5โ€“15 entity pages in wiki/entities/ (people, concepts, tools, organizations)
  4. Updates wiki/index.md with the new entries
  5. Flags any contradictions with existing pages
  6. Appends a timestamped entry to wiki/log.md

Query Flow

When you run Query:

  1. Claude reads wiki/index.md to find relevant pages
  2. Drills into the most relevant entity and source pages
  3. Synthesizes a cited answer โ€” every fact links back to the wiki page it came from
  4. 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.md and log.md are 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

MIT


Built with Claude by Shrenik Purvant

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

llm_wikibase-0.1.1.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

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

llm_wikibase-0.1.1-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

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

Hashes for llm_wikibase-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8546133f6443503257ca0815c334f55903bb69596b41edc76699e7c7430d8d06
MD5 cc3979c1dea1acded80d62162b07d9d3
BLAKE2b-256 7e95dbb746a85eb246c6f186bc5ad3ac99ba4ab9fa50fa6bf6fd170d51d4f72a

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_wikibase-0.1.1.tar.gz:

Publisher: publish.yml on S7hrenik/llm-wiki

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

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

Hashes for llm_wikibase-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d1ccf8a804eed90dd68ddfd88afeb65cf66cb715fe87ae10ae29b04b5ba2e19e
MD5 b3dd3e728ed4c7e4e2f23c6ef7f81ed0
BLAKE2b-256 042bcaf02691b8afc7835ae031051a873d1ab252040baeb5ade3e24be0783b41

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_wikibase-0.1.1-py3-none-any.whl:

Publisher: publish.yml on S7hrenik/llm-wiki

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