Skip to content

Wiki LLM Pattern

Chris Sweet edited this page Jun 26, 2026 · 5 revisions

type: concept up: "Home_llm-wiki-memory-template" tags: [foundation, pattern]

Wiki-LLM Pattern

The underlying idea behind this template: give a long-running project a small, LLM-maintained, cross-linked Markdown wiki as durable memory, so the agent's understanding compounds across sessions instead of being thrown away at the end of each conversation.

Three layers

The pattern separates three layers, each with different mutability rules:

  1. Raw sources (immutable). Code, data files, PDFs, external references. The agent reads but never modifies.
  2. The wiki (LLM-owned). A small set of cross-linked Markdown pages with typed frontmatter. The agent freely creates, updates, cross-references, and lints.
  3. The schema. Authoritative conventions reference in SCHEMA_<project>.md. Defines page formats, frontmatter, typed edges, and operations.

Most projects already have layers 1 and 3 implicitly. The pattern's contribution is layer 2: a place where insights live, between the raw material and the conventions that describe how to work with it.

Why this beats naive RAG-over-raw-sources

A RAG pipeline that indexes raw sources rediscovers, re-synthesizes, and re-explains the same things every session. There is no place for an insight to settle. The wiki is that place. Once filed, a finding is referenced by name (e.g. [Lesson-Hook-Type-Matters](Lesson-Hook-Type-Matters)) rather than rediscovered.

Cross-references compound. Every new page that links to a finding makes the finding easier to surface next time. The wiki is also human-readable, version-controlled, and queryable through the Knowledge-Graph-Pipeline. It is not a black box.

What the agent does

The agent's interaction with the wiki is constrained to three operations: see Three-Operations.

The conventions that make those operations interoperable across pages live in Typed-Edges-and-Frontmatter.

Origin

Inspired by the llm-wiki pattern in the Karpathy lineage. This template extends the original with agent overlays, a verification gate, a typed-edge ontology, attribution-aware logging, and a knowledge-graph pipeline (Knowledge-Graph-Pipeline).

See also

Clone this wiki locally