A multi-domain, cross-referenced LLM knowledge base framework based on the Karpathy llm-wiki pattern.
Instead of RAG (re-retrieving raw docs on every query), this pattern has the LLM compile raw sources into a persistent, cross-linked Markdown wiki. It adds a multi-wiki federation layer so you can split large knowledge domains into independent wikis (e.g., procurement, construction, property management) while maintaining lightweight cross-references between them.
The original llm-wiki-skill is designed for a single-topic wiki. multi-llm-wiki extends it with:
| Feature | Original llm-wiki | multi-llm-wiki |
|---|---|---|
| Single wiki | ✅ | ✅ |
| Multi-wiki federation | ❌ | ✅ |
Cross-wiki reference index (cross-index.md) |
❌ | ✅ |
Cross-wiki link detection script (cross-link.py) |
❌ | ✅ |
| CLAUDE.md cross-wiki routing table | ❌ | ✅ |
| Lint cross-index health check (Pass 8) | ❌ | ✅ |
| Chinese documentation | ❌ | ✅ |
If your working directory contains llm-wiki/, OpenCode auto-discovers the skill — no copy needed.
Just open the project directory and start using the operations: compile, ingest, query, lint, audit.
cp -r llm-wiki/ ~/.claude/skills/multi-llm-wiki/cp -r llm-wiki/ ~/.codex/skills/multi-llm-wiki/Alternatively, paste llm-wiki/SKILL.md directly into your agent context.
# 1. Scaffold a new wiki
python3 llm-wiki/scripts/scaffold.py ~/my-wiki "My Research Topic"
# 2. Add raw sources
cp my-article.md ~/my-wiki/raw/articles/
# 3. Tell your agent: "ingest raw/articles/my-article.md"
# 4. Ask questions: "what does the wiki say about X?"
# 5. Run lint periodically
python3 llm-wiki/scripts/lint_wiki.py ~/my-wikiWhen your knowledge domain is too large for a single wiki, split into multiple independent wikis with cross-wiki references.
<project-root>/
├── caigou/ ← Each wiki is a standalone folder
│ ├── CLAUDE.md ← Schema + cross-wiki routing table
│ ├── wiki/
│ │ ├── index.md
│ │ ├── concepts/
│ │ ├── cross-index.md ← Cross-wiki reference index
│ │ └── ...
│ └── ...
├── gongcheng/ ← Another standalone wiki
│ ├── CLAUDE.md
│ ├── wiki/cross-index.md
│ └── ...
└── ...
Step 1: Create the project directory and scaffold wikis
mkdir my-project
python3 llm-wiki/scripts/scaffold.py my-project/caigou "采购知识库"
python3 llm-wiki/scripts/scaffold.py my-project/gongcheng "工程建设知识库"Each scaffold creates a complete wiki with wiki/cross-index.md and a CLAUDE.md with a cross-wiki routing table section.
Step 2: Build each wiki independently
Build each wiki's content one at a time — ingest raw files, compile concept pages. Each wiki should be internally complete first.
Step 3: Add cross-wiki annotations in concept pages
> **跨 wiki**:工程建设类资质见 [[../gongcheng/wiki/concepts/施工单位资质|施工单位资质]]。Step 4: Run cross-link.py to detect relationships
# Scan mode: shows all cross-wiki links detected
python3 llm-wiki/scripts/cross-link.py my-project
# Suggest mode: also writes 🟡 entries to cross-index.md
python3 llm-wiki/scripts/cross-link.py my-project --suggestStep 5: Review and confirm entries
Run compile on each wiki. The LLM will present 🟡 entries for human confirmation.
- Confirmed → 🟢, update
CLAUDE.mdrouting table - Rejected → 🔴 or remove
Step 6: Verify with lint
python3 llm-wiki/scripts/lint_wiki.py my-project/caigou
python3 llm-wiki/scripts/lint_wiki.py my-project/gongcheng
# Pass 8 checks cross-index.md health| File | Purpose | Maintained by |
|---|---|---|
CLAUDE.md routing table |
Quick keyword→wiki lookup during query | Semi-automatic (compile) |
wiki/cross-index.md |
Detailed concept-to-concept index | Semi-automatic (ingest + cross-link.py + compile) |
In-page [[../wiki/...]] annotations |
Explicit cross-wiki references | LLM during ingest/compile |
When a question in wiki A requires knowledge from wiki B:
- LLM reads
CLAUDE.mdrouting table → keyword match - LLM reads
wiki/cross-index.md→ detailed relationship - LLM outputs: "This information is in
../wiki-b/wiki/concepts/page.md. Please switch to that wiki." - Stops and waits. No cross-wiki hallucination.
multi-llm-wiki/
├── llm-wiki/ ← The skill
│ ├── SKILL.md ← Main skill file
│ ├── references/
│ │ ├── schema-guide.md ← CLAUDE.md schema template
│ │ ├── article-guide.md ← Article writing conventions
│ │ ├── log-guide.md ← log/ folder convention
│ │ ├── audit-guide.md ← audit file format + workflow
│ │ └── tooling-tips.md ← Obsidian, qmd, plugin + web
│ └── scripts/
│ ├── cross-link.py ← Multi-wiki cross-reference detection
│ ├── scaffold.py ← Bootstrap new wiki directory
│ ├── lint_wiki.py ← 8-pass health check (incl. cross-index)
│ └── audit_review.py ← Group open/resolved audits by target
├── audit-shared/ ← Shared TypeScript library
├── plugins/obsidian-audit/ ← Obsidian plugin
└── web/ ← Local Node.js preview + feedback server
cd audit-shared && npm install && npm run build && cd ..
cd web && npm install && npm run build && cd ..
cd web && npm start -- --wiki "/path/to/wiki-root" --port 4175- Research deep-dive — reading papers on a topic over weeks
- Multi-domain knowledge bases — procurement + construction + property management
- Team knowledge base — fed by Slack threads, meeting notes, docs
- Reading companion — building a rich companion wiki as you read a book
This project is forked and extended from llm-wiki-skill by Lewis Liu, which was inspired by Andrej Karpathy's llm-wiki Gist.
Key extensions in multi-llm-wiki:
- Multi-wiki federation with
cross-index.mdandcross-link.py - Cross-wiki routing table in
CLAUDE.md - Lint Pass 8 for cross-index health
- Chinese language support throughout
- Karpathy's original Gist
- llm-wiki-skill — the original single-wiki skill
- pedronauck/skills karpathy-kb
- qmd — semantic search for Markdown wikis
MIT