Creating an LLM Wiki Locally
The Problem with RAG
Most AI-powered knowledge systems rely on Retrieval-Augmented Generation (RAG): drop documents in, embed them, and retrieve fragments at query time. It works, but the LLM only ever sees scattered pieces — it never builds a coherent picture. Every query starts from scratch.
Andrej Karpathy described a better pattern in a public gist: instead of retrieving fragments, have the LLM read sources once, extract the key ideas, and integrate them into a persistent wiki. The wiki compounds over time. Cross-references are already there. The LLM never has to re-read raw sources to answer questions.
The LLM Wiki Pattern
The system has three layers:
- Raw Sources — articles, papers, PDFs, notes. The LLM reads these but never modifies them.
- The Wiki — a directory of LLM-generated markdown files: summaries, entity pages, concept pages, comparisons. The LLM owns this layer entirely.
- The Schema — a config file (e.g.,
CLAUDE.mdorAGENTS.md) that defines the wiki's structure, conventions, and workflows.
The key insight: humans abandon wikis because the maintenance burden grows faster than the value. LLMs don't get bored.
Core Operations
Ingest
Drop a new source into your raw collection. The LLM reads it, discusses key takeaways with you, writes a summary page, updates the index, and touches 10–15 related entity or concept pages to add cross-references. It also appends a timestamped entry to an append-only log.md.
Query
Ask a question. The LLM reads the index first, navigates to relevant pages, and synthesizes an answer with citations. Good answers automatically become new wiki pages — compounding your knowledge base.
Lint / Maintenance
Periodically audit for contradictions between pages, stale claims superseded by newer sources, orphan pages with no inbound links, and missing cross-references.
Special Files
- index.md — Content-oriented catalog organized by category (entities, concepts, sources). One-line summary per page. The LLM reads this first on every query.
- log.md — Append-only chronological record. Format:
## [DATE] operation | description. Parseable with standard unix tools.
Setup: One Prompt to Rule Them All
The entire system can be bootstrapped by giving your AI agent this prompt:
install this agent skill for opencode https://github.com/kepano/obsidian-skills
https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f
Fetch the URL and follow the instructions to setup a complete LLM Wiki system for me.
Move the processed raw documents to "archives"
That's it. Your agent fetches the Karpathy gist, reads the full specification, installs the Obsidian skills, sets up the wiki directory structure, creates index.md, log.md, and the schema file, then moves any already-processed raw documents into an archives/ folder.
Step 1: Install Obsidian Skills for OpenCode
The obsidian-skills repository by Kepano teaches your AI agent to work natively with Obsidian's formats — wikilinks, Bases, JSON Canvas — and to interface with Obsidian vaults via CLI.
For OpenCode, clone the repository directly into the skills directory:
git clone https://github.com/kepano/obsidian-skills ~/.opencode/skills/obsidian-skills
Skills are auto-discovered after restart. The package includes five capabilities:
- obsidian-markdown — creates and edits Obsidian Flavored Markdown with wikilinks
- obsidian-bases — works with Obsidian Bases files and formulas
- json-canvas — handles JSON Canvas nodes and connections
- obsidian-cli — interfaces with vaults through the command line
- defuddle — extracts clean markdown from web pages
For Claude Code users, install via the marketplace:
/plugin install obsidian@obsidian-skills
Step 2: Set Up the Wiki Directory Structure
Create the following layout inside your Obsidian vault (or any local directory):
wiki/
├── index.md # Content catalog — LLM reads this first
├── log.md # Append-only operation log
├── AGENTS.md # Schema: structure, conventions, workflows
├── entities/ # Named entities: people, projects, companies
├── concepts/ # Technical and domain concepts
├── sources/ # Summaries of ingested raw documents
└── archives/ # Processed raw source documents (moved here after ingest)
Step 3: Define the Schema (AGENTS.md)
The schema file is where you configure the LLM's behavior. A minimal starting point:
# Wiki Schema
## Structure
- entities/ — one page per named entity (person, project, company, tool)
- concepts/ — one page per technical or domain concept
- sources/ — one summary page per ingested raw document
## Ingest Workflow
1. Read the raw source fully
2. Write a summary page in sources/
3. Update index.md with a one-line entry
4. Update 10-15 related entity and concept pages
5. Append to log.md: ## [DATE] ingest | [source title]
6. Move the raw source file to archives/
## Query Workflow
1. Read index.md first
2. Navigate to relevant pages
3. Synthesize answer with citations
4. If the answer is substantial, create a new wiki page
## Conventions
- Use wikilinks [[Page Name]] for cross-references
- Never copy moving values (timestamps, version numbers) into prose — use frontmatter
- Keep index.md entries to one line per page
Step 4: Ingest Your First Document
Drop a source file into your raw collection and tell the agent:
Ingest this document following the wiki schema: raw/my-article.md
The agent reads it, generates a summary, updates all relevant pages, and moves the raw file to archives/. Your wiki grows.
Optional Tooling
- qmd — local markdown search engine with BM25/vector hybrid search and LLM reranking. Available as CLI or MCP server.
- Obsidian Web Clipper — browser extension that converts web articles to markdown, ready for ingestion.
- Obsidian Graph View — visualize wiki connectivity, spot hubs and orphan pages.
- Dataview Plugin — query over page frontmatter metadata.
- Marp — generate slide decks from wiki content.
Advanced Patterns
Union-Based Recall
Combine index-based navigation (lexical, predictable) with full-text BM25 search. The union approach ensures recall never worsens as more pages are added.
Human Corrections as Pins
When you correct the LLM's output, store the correction as a "pin" — a record of the intended claim, not a text diff. After any page regeneration, verify pins are still satisfied, or flag contradictions. Never let source retirement purge human-added knowledge.
Concurrent Ingestion
If running multiple ingestion sessions in parallel, use placeholder index entries with a status lifecycle (planned → active → done) and track which session owns each slot. This prevents duplicate page creation.
Audience-Specific Wikis
Don't filter by labels at query time. Create entirely separate wiki directories for different audiences or security contexts. This guarantees no accidental exposure of sensitive content.
Why It Works
The LLM Wiki pattern is conceptually related to Vannevar Bush's 1945 Memex vision — a personal, curated knowledge store with associative connections between documents. The key insight is that the connections between documents are as valuable as the documents themselves.
In practice: you curate sources and direct analysis. The LLM handles the bookkeeping — updating cross-references, maintaining consistency across dozens of pages, noting contradictions. The maintenance burden that kills human-managed wikis is exactly what LLMs are good at.