Skip to content

Concept

Karpathy LLM Wiki: Build a Source-Backed AI Knowledge Base

The Karpathy LLM Wiki pattern turns trusted sources into maintained AI knowledge-base pages that agents can load on demand.

Qi-Xuan LuUpdated 12 min read
Inspect the real app screens

About this guide

01

Concepts

02

People designing a maintained knowledge layer for Claude Code, Codex, Cursor, and other AI agents

03

12 min read

01

The Karpathy LLM Wiki pattern maintains useful answers instead of treating raw notes, retrieved chunks, or chat logs as finished knowledge.

02

The architecture separates source material, atomic memory, maintained pages, and the index that loads only relevant context.

03

A practical loop needs observable checks and repairs for stale links, contradictions, context bloat, and human edits.

01

The Karpathy LLM Wiki pattern

Andrej Karpathy described an LLM Wiki pattern for turning raw knowledge into curated, interconnected pages that an AI agent can load on demand. This article uses his public note as a maintained source for the pattern; it does not imply that Karpathy endorses Wenlan.

In practical terms, an LLM wiki is a maintained AI knowledge base. It turns source material and durable work context into topic pages with enough provenance and maintenance state for a person to inspect why the current answer exists.

It is not simply a folder of AI-written notes. A useful LLM wiki separates raw evidence from reusable facts and maintained explanations, then gives each layer a different update rule. The result should remain useful even when the reader never installs the product used to build it.

  • Sources preserve documents, conversations, files, and other inspectable evidence.
  • Atomic memories preserve one decision, lesson, correction, preference, or fact learned during work.
  • Maintained pages compile the current answer and cite the support behind it.
  • A routing index finds the relevant page without loading the entire wiki into every prompt.
Try the complete example without installing anything

02

The architecture behind a useful LLM wiki

The smallest dependable design has four planes: source storage, durable memory, maintained pages, and selective retrieval. Keeping them separate prevents a polished page from losing its evidence and prevents a raw event log from masquerading as the current answer.

Maintenance is part of the architecture, not a later cleanup job. When support changes, the system needs to mark the affected page stale, propose or perform a refresh according to ownership, and keep the revision inspectable.

  • Ingest: register source material without rewriting it into a conclusion.
  • Capture: keep one complete, reusable idea with scope and provenance.
  • Distill: compose related support into a maintained topic page.
  • Retrieve: load the smallest useful page or memory set for the current task.
  • Refresh and review: expose stale reasons, contradictions, citations, and revisions.

03

Try a complete example before installing anything

Can your wiki answer a project question, show its evidence, and notice when that answer stops being safe to reuse? Try this small, fictional source packet with your existing AI tool first. These are authored teaching inputs and reference answers, not a Wenlan run, a customer result, or a performance comparison.

Save the three blocks below as separate Markdown files with the displayed filenames in a new, disposable folder. Give your agent read-only access to those files. Keep any generated answer in a separate wiki file; do not let it edit the sources.

Ask: “Using only api-v1.md, decision-07.md, and runbook-v1.md, write a short retry-policy wiki page. Cite the filename for every rule, distinguish retries from total attempts, and list unanswered questions. Do not fill gaps from general knowledge.”

Complete source packet — save these three files

# api-v1.md — fictional API specification, revision 1
GET /reports: after a failed first attempt, allow up to 3 retries.
POST /payments: do not retry automatically.

# decision-07.md — fictional client decision
Use the API's GET retry cap of 3 to limit repeated requests.
Automatic POST retries are disabled because duplicate payments are unsafe.

# runbook-v1.md — fictional operator note
Record the endpoint, attempt number, and final failure in the local test log.
The request timeout has not been decided.

04

Check the answer, then change one source

Compare your result with this reference. The point is not matching the wording: all four claims must have the right support, and the timeout must stay unknown. Open each cited file yourself; a plausible citation is not evidence that it supports the sentence.

Next add api-v2.md using the replacement text below, so it replaces api-v1.md. For the second question, ask: “Using api-v2.md, decision-07.md, and runbook-v1.md as the current sources, with api-v1.md as a historical reference only, compare the prior wiki answer with the current evidence. Identify any stale conclusion, preserve the unresolved 1-versus-3 retry conflict, and do not silently modify decision-07.md or settle the conflict.”

If plain files and your agent already handle this clearly, keep that simpler workflow. Consider Wenlan when maintaining source-linked pages and shared lookup across your AI tools is recurring work. Its source links do not verify meaning, and adding a replacement source is not the same as updating an already linked source: review the actual page state. This exercise does not establish Wenlan's accuracy, time savings, automatic maintenance, or your later reuse.

Reference answer, changed source, and expected review note

# Request retry policy — reference answer, revision 1
GET: at most 3 retries after the first attempt (4 attempts total).
Source: api-v1.md; decision-07.md.
POST: no automatic retry.
Source: api-v1.md; decision-07.md.
Log: endpoint, attempt number, final failure.
Source: runbook-v1.md.
Timeout: not specified. Ask the owner; do not invent a value.
Source: runbook-v1.md.

# api-v2.md — fictional replacement for api-v1.md
GET /reports: after a failed first attempt, allow at most 1 retry.
POST /payments: do not retry automatically.

# Review note — before accepting a revised answer
The old GET answer is stale: api-v2.md now allows only 1 retry.
decision-07.md still says 3. Preserve and flag this conflict.
Do not report the old 3-retry policy as settled current guidance.
POST, logging, and the unknown timeout are unchanged.
Ask the decision owner to reconcile decision-07.md with api-v2.md.
Check Wenlan's source and review boundaries

05

The LLM-wiki workflow in Wenlan

Start only after Wenlan is installed and connected to the AI client. Use one harmless topic first. The protocol below exercises session startup, targeted retrieval, one durable write, a session boundary, page distillation, and human-readable output.

The commands are separate on purpose: recall should not silently write, capture should not rewrite a whole page, and distillation should not overwrite human-owned content without a review path.

Wenlan workflow — requires an installed, connected client

/brief <topic>
/recall <question>
/capture <decision + why>
/handoff
/distill <topic>
/pages <topic>
Use the complete daily workflow

06

A minimum LLM-wiki starter schema

Keep the always-loaded contract small. A CLAUDE.md or AGENTS.md should describe what the wiki is for, what never changes silently, and which procedures the agent should load on demand. It should not contain the whole wiki or a long copy of every maintenance instruction.

This is a vendor-neutral information and maintenance contract, not a required folder layout or product database. Adapt the names to your tools while keeping every boundary observable.

  • Purpose and scope: which decisions or questions belong in this wiki, and which do not.
  • Immutable source boundary: where raw evidence lives and which files automation must never rewrite.
  • Page ownership: which pages are machine-maintained, human-owned, or changed only through review.
  • Naming and linking rules: stable topics, aliases, page links, and the smallest routing index.
  • Citation requirement: important claims point back to an inspectable source.
  • Ingest, query, lint, and maintenance log: separate on-demand procedures plus an append-only record of changes.
  • Stale and review behavior: what happens when a source changes, support conflicts, or a person owns the prose.

Compact client contract

# LLM Wiki
Purpose: <the repeated decisions this wiki maintains>
Sources: <immutable evidence locations>
Pages: <ownership, naming, links, citations>
Index: <small topic router; load pages on demand>
Procedures: ingest | query | lint | review
Log: <append-only maintenance record>
Stale rule: <source change -> stale or review>

07

A small acceptance test before real use

A template is not proven when the files merely exist. Test one harmless topic end to end, including a source change, before importing private or business-critical material.

This test works for a folder-and-prompts setup, an Obsidian workflow, or a dedicated LLM-wiki product. The expected result is evidence you can inspect, not just a fluent answer.

  • Ingest one harmless source and confirm the original remains unchanged.
  • Answer one question and cite the source for the important claim.
  • Run lint and confirm missing citations, broken links, or duplicates are visible.
  • Change the source, then repeat the same question.
  • Confirm the old answer becomes stale or reviewable instead of being silently overwritten.

08

How to verify the loop

Do not stop at a successful command. Verify the artifacts and the next retrieval. A trustworthy setup proves that the agent can recover the intended context later and that a person can inspect the maintained result outside the chat.

If any check fails, keep the test capture harmless, diagnose the connection or source boundary, and repeat the same topic before adding real project knowledge.

  • The capture returns or exposes a durable record you can find again with the same topic.
  • The handoff records what changed and what the next session should do.
  • The page opens as readable Markdown and shows source IDs or citations for important claims.
  • A later recall or brief loads the relevant page or memory without pasting the full archive.
  • A changed source produces an inspectable stale reason, refresh, or reviewable revision instead of a silent overwrite.
Review the trust and repair workflow

09

Example: from source to maintained answer

Suppose a release document establishes which platforms are actually supported. The source document remains inspectable, an atomic memory preserves the release decision and why it matters, and a maintained page compiles the current install answer. When the release document changes, the page should become stale or receive a reviewable revision.

This evidence trail is more useful than a detached summary because each layer has a clear owner and failure mode.

Expected evidence trail

source document
  -> atomic memory: decision + why + source_id
  -> maintained page: current answer + citations

source changes
  -> stale reason or reviewable revision
  -> refreshed page

10

Failure modes and repairs

The hard part is not generating the first page. It is keeping the wiki small enough to retrieve, current enough to trust, and explicit enough that people can repair it.

These failure modes repeat across real LLM-wiki, Obsidian, Claude Code, and agent-memory workflows:

  • Context bloat or index truncation: keep the routing index short and load topic pages on demand instead of injecting the full vault.
  • Stale links and contradictions: retain provenance, mark affected pages stale, and review replacements rather than stacking another answer beside the old one.
  • Human-authored pages overwritten by automation: keep machine refreshes reviewable when a person owns the prose.
  • Token-heavy full-vault loading: retrieve the smallest relevant pages, memories, and source excerpts for the current question.
  • Cross-session blank starts: pair a compact brief with a handoff instead of depending on the previous chat window.

11

LLM wiki vs RAG, Obsidian, and agent memory

These tools can work together, but they do not own the same layer. The useful question is not which label wins; it is where evidence, current answers, human writing, and cross-session context should live.

  • RAG retrieves source chunks for a question. An LLM wiki maintains a reusable answer, its support, and its refresh state.
  • Obsidian is a human-owned vault and writing surface. It can host or inspect wiki pages, but vault access alone does not define agent-memory policy or page maintenance.
  • Agent memory preserves reusable context from work. An LLM wiki composes selected memories and sources into a maintained explanation.
  • A plain folder plus prompts can be enough for a small, stable corpus. Add a daemon or MCP layer when several agents need the same retrieval, handoff, provenance, and review rules.
Migrate an Obsidian vault into a source-backed LLM wiki

12

What an LLM wiki does not replace

An LLM wiki does not replace codebase search, repository maps, current source code, test output, or the native documentation for a tool. Those surfaces remain authoritative for what the software does now.

It is also unnecessary for one-off chats or a small set of stable documents that people already maintain well. Use the wiki when repeated work needs a current, inspectable answer across sessions or tools.

See how Wenlan separates the layers

13

How Wenlan maps the architecture

Wenlan implements the pattern with three durable roles: Sources preserve inspectable material, Memories preserve atomic knowledge from work, and Pages compile maintained explanations. The local daemon owns retrieval while readable Markdown keeps pages and session artifacts visible.

The page lifecycle is explicit: distill support, cite it, track dependencies, refresh when needed, and review ownership-sensitive changes. That is the difference between a generated note and a maintained LLM wiki.

Wenlan does not require a user-authored Page schema. Typed Memory fields and built-in Page rules already govern provenance, citations, refresh, ownership, and review; the starter schema above remains a portable evaluation contract for the client and workflow.

Inspect the source-backed page model

Turn memory into an LLM wiki

Wenlan distills repeated captures into source-backed wiki pages your next AI session can actually use.

Inspect a citation and a proposed revision in Wenlan

These are real Wenlan app recordings using Tally, a demonstration invoicing project. Enlarge the screens to follow a source reference and inspect a proposed page revision.

1. Follow the SQLite claim back to its source

The wiki says Tally uses SQLite for a single-user app. The open citation shows the source titled ‘SQLite for Single-User App’, its summary, and an ‘Open memory’ action. Compare the sentence with that source before reusing the decision.

Recorded Wenlan Tally wiki with the SQLite citation open, showing the source summary and Open memory action.

Scroll or swipe to explore the enlarged image.

Open original
Tally demo recording: wiki page and source popover. A source link makes a claim inspectable; you still need to check whether the source supports it.

2. Read the proposed change before approving it

The Project notes revision removes the undecided database wording and proposes a SQLite decision. Added and removed text, an earlier version, and Skip / Approve controls are visible. Check the revised wording and its sources before choosing what to keep.

Recorded Wenlan Project notes revision with added and removed text, an earlier version, and Skip and Approve controls.

Scroll or swipe to explore the enlarged image.

Open original
Tally demo recording: a proposed page revision. This frame does not show an approved result or prove that every changed sentence is correct.

FAQ

What is the Karpathy LLM Wiki idea?+
Andrej Karpathy described a personal LLM wiki made of curated, interconnected pages that an agent can retrieve as needed. The durable idea is to maintain useful pages and their structure instead of repeatedly loading an undifferentiated archive. Citing his note does not imply an endorsement of Wenlan.
What is an LLM wiki?+
An LLM wiki is a maintained knowledge layer that turns inspectable sources and durable work context into topic pages AI agents can load on demand. Useful implementations retain provenance, stale state, and a human review path.
Is an LLM wiki the same as RAG?+
No. RAG retrieves source chunks for a question. An LLM wiki maintains a reusable explanation with citations and refresh state. A wiki can use RAG underneath, but retrieval alone does not maintain the answer.
Can Obsidian be an LLM wiki?+
Obsidian can be the human-owned vault and readable page surface. To behave as an agent LLM wiki, the workflow still needs selective retrieval, provenance, maintenance rules, stale handling, and a safe boundary for automated edits.
Should an LLM wiki replace repository search?+
No. Use current source code, repository search, tests, and tool documentation to verify software behavior. Use the LLM wiki for maintained explanations, decisions, lessons, provenance, and cross-session context.

Share this guide