Building an LLM Wiki for Your Project — a step-by-step guide (agent-maintained knowledge base: schema, ingest/query/lint workflows, qmd search, lint script) A developer has published a step-by-step guide for building an 'LLM Wiki'—a persistent, interlinked markdown knowledge base that an AI agent (such as Claude Code or Codex) maintains incrementally. The approach, based on Andrej Karpathy's pattern, compiles knowledge once and keeps it current, contrasting with typical RAG systems that re-derive answers on each query. The guide details a three-layer structure (raw sources, wiki pages, and a schema file) and includes optional search and linting workflows. This guide shows you how to set up an LLM Wiki in your own project: a persistent, interlinked markdown knowledge base that an LLM agent Claude Code, Codex, etc. builds and maintains for you. It is based on Andrej Karpathy's "LLM Wiki" pattern https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f . You can go from nothing to a working wiki in ~15 minutes Parts 1 . Search and linting Parts 2–3 are optional add-ons. Part 4 and the Use Cases show how to actually drive it day to day. Most people use LLMs with documents via RAG : upload files, the model retrieves chunks at query time, answers, and forgets. Nothing accumulates — every question rediscovers knowledge from scratch. An LLM Wiki is different. Instead of re-deriving on every query, the LLM incrementally builds and maintains a wiki — a folder of cross-linked markdown pages that sits between you and your raw sources. Add a source, and the agent reads it, updates the relevant pages, flags contradictions, and files it. The knowledge is compiled once and kept current . Three layers: | Layer | What it is | Who owns it | |---|---|---| Raw sources raw/ | Immutable inputs — articles, transcripts, screenshots, page dumps, exported docs. Read-only. | You curate | The wiki wiki/ | LLM-generated, cross-linked markdown pages. | The agent writes & maintains | The schema WIKI.md | Conventions + the ingest/query/lint workflows the agent follows. | You + agent co-evolve | Plus two navigation files: index.md a catalog and log.md an append-only history . Division of labor: you do sourcing, exploration, and asking good questions. The agent does the grunt work — summarizing, cross-referencing, filing, and bookkeeping. You almost never write the wiki by hand. git — the wiki is just a folder of markdown; version it. A coding agent — Claude Code, Codex CLI, OpenCode, etc. This is the "engine." Optional Node.js ≥ 22 — only if you want the lint script Part 3 . Optional — a local, on-device search engine for markdown Part 2 . Install with qmd https://github.com/tobi/qmd npm install -g @tobilu/qmd . Not needed until your wiki grows past a few hundred pages — index.md alone works well at small/medium scale. Where to put the wiki.A dedicated top-level folder e.g. llm-wiki/ with itsown git repois the cleanest choice, especially if your project root is not itself a repo, or if you don't want wiki churn mixed into your product's history. mkdir -p llm-wiki/raw \ llm-wiki/wiki/domains \ llm-wiki/wiki/screens \ llm-wiki/wiki/entities \ llm-wiki/wiki/concepts \ llm-wiki/scripts cd llm-wiki Adjust the wiki/ subfolders to your domain. Common choices: domains/ — top-level areas of your subject the main axis . entities/ — the "nouns" people, objects, records, components . concepts/ — cross-cutting ideas. screens/ for apps / modules/ for codebases / sources/ for research . This is the most important file. It turns a generic chatbot into a disciplined wiki maintainer. Every agent session reads it first. Copy this template and adapt the bracketed parts: WIKI.md — Schema & Workflows Read this file FIRST before ingesting, querying, or linting. It defines how this wiki is structured and the workflows to follow. 1. Three layers - raw/ — immutable sources, read-only. Never edit after saving. - wiki/ — LLM-generated pages. The agent owns these. - WIKI.md + index.md + log.md — schema, catalog, history. Roles: the human curates sources and asks questions; the LLM does all summarizing, cross-referencing, filing, and bookkeeping. 2. Navigation: index-first When answering, read index.md FIRST to find relevant pages, then read them. index.md is enough at moderate scale. Optional: use qmd for semantic search when the wiki grows large — it augments, never replaces, index.md . 3. Page organization - wiki/overview.md — the map of the whole wiki. - wiki/domains/