Skip to content

LLM Wiki Pattern

Source: Karpathy's gist Ingested: 2026-04-09


Core Idea

Stop re-deriving. Start compiling.

Traditional RAG makes the LLM rediscover connections from raw docs on every query. The LLM Wiki eliminates this: the LLM builds a structured markdown knowledge base once, then queries are answered from the compiled wiki — not the raw sources.

"The wiki is a persistent, compounding artifact."


Three-Layer Architecture

Raw Sources (immutable, human-curated)
      |
      v  [ingest]
Wiki Pages (LLM-maintained markdown)
      |
      v  [query]
Answers (grounded, with citations)

Layer 1 — Raw Sources Documents, articles, papers. Never modified by LLM. Authoritative source of truth.

Layer 2 — Wiki LLM-generated and maintained markdown files. Summaries, entity pages, concept pages, comparisons. The human reads; the LLM writes.

Layer 3 — Schema Config (SCHEMA.md or CLAUDE.md) defining wiki structure, ingestion rules, conventions.


Three Operations

Ingest

New source added → LLM reads it, extracts key info, integrates into existing pages (may touch 10-15 files), updates index, logs activity.

Query

User asks → LLM reads index first, finds relevant pages, synthesizes answer with citations. Optionally saves valuable explorations as new pages.

Lint

Periodic health check: contradictions, stale claims, orphaned pages, missing cross-references, conceptual gaps.


index.md — content catalog. LLM reads this first during queries to locate relevant pages.

log.md — append-only chronological record of all operations.


Why it beats RAG

RAG LLM Wiki
Re-derives on every query Compiled once, queried fast
Context window filled with raw chunks Context filled with synthesized knowledge
No accumulation Compounds over time
Hard to synthesize across many docs Cross-references pre-built

v2 Extensions (rohitg00)

  • Memory lifecycle: confidence scoring, supersession, gradual forgetting
  • Knowledge graph: typed entities (people, projects, libs) + relationships (uses, depends-on, contradicts)
  • Automation: event-driven hooks, auto-ingest, scheduled consolidation
  • Consolidation tiers: working memory → episodic → semantic → procedural

Implementation in this Wiki

This wiki IS the implementation. Hosted at wiki.mukhayyar.my.id.

To ingest new content: tell Ductor "wiki ingest [URL or content]" — it will create/update pages and update log.md.