LLM Wiki
Bootstrap and operate a persistent, LLM-maintained knowledge base for any domain.
The key idea: instead of re-deriving answers from raw sources every time, the LLM builds and maintains a structured wiki of markdown files. Sources are ingested once, knowledge is compiled into cross-linked pages, and the wiki compounds with every new source and question. You read it; the LLM writes it.
Announce at start: "Using llm-wiki to [set up / operate] your [domain] wiki."
Entry Detection
First, check what situation you're in:
| Signal | Mode |
|---|---|
No CLAUDE.md with wiki schema present in cwd |
Setup — bootstrap a new wiki |
CLAUDE.md exists with wiki schema AND user wants to add a source |
Ingest |
CLAUDE.md exists with wiki schema AND user is asking a question |
Query |
CLAUDE.md exists with wiki schema AND user wants health check |
Lint |
CLAUDE.md exists with wiki schema AND no specific operation given |
Ask: "Ingest a new source, query the wiki, or run a health check?" |
Detect a wiki CLAUDE.md by looking for the ## Wiki Schema marker in the file.
Setup Mode
Bootstrap a new wiki from scratch. Quick interview, then create the structure.
Step 1: Interview (3 questions max, combine if possible)
Ask:
- Domain and purpose — What is this wiki for? (topic, project, use case)
- Location — Where should the wiki live? (default:
~/wikis/<domain-name>/— confirm or let them specify a path) - Sources you already have — Any existing docs/articles/notes to ingest immediately? (optional — can start empty)
If the user's initial message already answers some of these, don't re-ask. Bias toward action.
Step 2: Create directory structure
<wiki-root>/
├── CLAUDE.md ← the wiki schema (LLM operating manual)
├── index.md ← entry-point content catalog (root; updated on every ingest)
├── raw/ ← immutable source documents (user adds, LLM reads only)
│ └── assets/ ← downloaded images and attachments
├── wiki/ ← LLM-generated and LLM-maintained article pages
│ ├── log.md ← append-only operation history
│ ├── overview.md ← evolving synthesis / thesis (created after first ingest)
│ └── sources/ ← one summary page per ingested source
│ └── .gitkeep
└── .gitignore ← ignore nothing by default (wiki is just markdown)
Create these directories and files. The root index.md is the entry point; wiki/ holds the article pages. The wiki/sources/ directory holds one page per ingested source. Additional subdirectories (wiki/entities/, wiki/concepts/, etc.) are created as needed during ingest.
Step 3: Write the wiki CLAUDE.md
Load references/wiki-schema-template.md and fill in the placeholders:
{{WIKI_NAME}}— human-readable wiki name (e.g., "AI Research Wiki"){{DOMAIN}}— brief domain description (e.g., "AI safety research papers and blog posts"){{WIKI_ROOT}}— absolute path to the wiki root directory{{DATE_CREATED}}— today's date (YYYY-MM-DD)
Write the filled template to <wiki-root>/CLAUDE.md.
Step 4: Initialize index.md and log.md
index.md (root entry point):
# Index
> Wiki: {{WIKI_NAME}} | Created: {{DATE}} | Sources: 0 | Pages: 0
## Sources
*(none yet — ingest your first source to begin)*
## Concepts
*(none yet)*
## Entities
*(none yet)*
wiki/log.md:
# Log
Append-only record of wiki operations. Format: `## [YYYY-MM-DD] operation | details`
---
## [{{DATE}}] setup | Wiki initialized
Domain: {{DOMAIN}}
Wiki root: {{WIKI_ROOT}}
Step 5: Confirm and offer first ingest
Tell the user:
"Wiki created at
<path>. Structure:
raw/— drop your source documents herewiki/— I maintain this; you read itCLAUDE.md— the schema that governs how I work in this wikiReady to ingest your first source? Drop a file in
raw/and tell me, or paste a URL/article directly."
If the user mentioned existing sources in step 1, proceed immediately to Ingest Mode.
Ingest Mode
Process a new source into the wiki. This is the core compounding operation.
Read references/operations.md § Ingest for the full workflow. Summary:
- Read the source — the user drops a file in
raw/or provides content directly - Discuss — briefly surface the 2–3 most interesting takeaways; invite the user to guide emphasis
- Write a source summary page to
wiki/sources/<slug>.md - Update or create entity and concept pages — identify named things (people, orgs, tools, papers) and concepts that warrant their own pages; update cross-references
- Update
index.md(root entry point) — add the source entry, update page counts - Append to
wiki/log.md— one entry:## [DATE] ingest | <title> - Update
wiki/overview.md— revise the synthesis to incorporate the new source; note if it confirms, contradicts, or extends prior claims
A single source typically touches 5–15 wiki pages. Work through them systematically.
Query Mode
Answer questions using the wiki as the knowledge base.
Read references/operations.md § Query for the full workflow. Summary:
- Read the root
index.mdfirst to find relevant pages - Read the relevant pages
- Synthesize an answer with wiki citations (link to the wiki pages, not raw sources)
- Offer to file the answer as a new wiki page if it represents valuable synthesis (comparisons, analyses, discovered connections)
Lint Mode
Health-check the wiki and surface improvements.
Read references/operations.md § Lint for the full workflow. Summary:
Check for:
- Contradictions between pages (newer sources superseding old claims)
- Orphan pages (no inbound links from other wiki pages)
- Concepts mentioned but lacking their own page
- Missing cross-references (entity A mentioned on page B but not linked)
- Data gaps (questions the wiki can't answer that a targeted search could fill)
Produce a lint report and offer to fix issues automatically or suggest new sources to investigate.
Working Style
The user reads; the LLM writes. Some principles:
- Never modify files in
raw/— they are the immutable source of truth - Always update the root
index.mdandwiki/log.mdon every ingest — these are how the LLM navigates at scale - Cross-references are the point — a page with no links to other wiki pages is a missed opportunity
- File good answers back — if a query produces a valuable synthesis, create a wiki page for it
- Note contradictions explicitly — when new sources conflict with existing claims, update the relevant pages to flag the tension rather than silently overwriting
When the wiki grows large (100+ pages), suggest adding a search tool like qmd for more efficient navigation.
Reference files
references/wiki-schema-template.md— the CLAUDE.md template written into new wikis; load during Setup Step 3references/operations.md— detailed ingest, query, and lint workflows; load when executing those operations