Skip to content

Instantly share code, notes, and snippets.

@karpathy
Created April 4, 2026 16:25
Show Gist options
  • Select an option

  • Save karpathy/442a6bf555914893e9891c11519de94f to your computer and use it in GitHub Desktop.

Select an option

Save karpathy/442a6bf555914893e9891c11519de94f to your computer and use it in GitHub Desktop.
llm-wiki

LLM Wiki

A pattern for building personal knowledge bases using LLMs.

This is an idea file, it is designed to be copy pasted to your own LLM Agent (e.g. OpenAI Codex, Claude Code, OpenCode / Pi, or etc.). Its goal is to communicate the high level idea, but your agent will build out the specifics in collaboration with you.

The core idea

Most people's experience with LLMs and documents looks like RAG: you upload a collection of files, the LLM retrieves relevant chunks at query time, and generates an answer. This works, but the LLM is rediscovering knowledge from scratch on every question. There's no accumulation. Ask a subtle question that requires synthesizing five documents, and the LLM has to find and piece together the relevant fragments every time. Nothing is built up. NotebookLM, ChatGPT file uploads, and most RAG systems work this way.

The idea here is different. Instead of just retrieving from raw documents at query time, the LLM incrementally builds and maintains a persistent wiki — a structured, interlinked collection of markdown files that sits between you and the raw sources. When you add a new source, the LLM doesn't just index it for later retrieval. It reads it, extracts the key information, and integrates it into the existing wiki — updating entity pages, revising topic summaries, noting where new data contradicts old claims, strengthening or challenging the evolving synthesis. The knowledge is compiled once and then kept current, not re-derived on every query.

This is the key difference: the wiki is a persistent, compounding artifact. The cross-references are already there. The contradictions have already been flagged. The synthesis already reflects everything you've read. The wiki keeps getting richer with every source you add and every question you ask.

You never (or rarely) write the wiki yourself — the LLM writes and maintains all of it. You're in charge of sourcing, exploration, and asking the right questions. The LLM does all the grunt work — the summarizing, cross-referencing, filing, and bookkeeping that makes a knowledge base actually useful over time. In practice, I have the LLM agent open on one side and Obsidian open on the other. The LLM makes edits based on our conversation, and I browse the results in real time — following links, checking the graph view, reading the updated pages. Obsidian is the IDE; the LLM is the programmer; the wiki is the codebase.

This can apply to a lot of different contexts. A few examples:

  • Personal: tracking your own goals, health, psychology, self-improvement — filing journal entries, articles, podcast notes, and building up a structured picture of yourself over time.
  • Research: going deep on a topic over weeks or months — reading papers, articles, reports, and incrementally building a comprehensive wiki with an evolving thesis.
  • Reading a book: filing each chapter as you go, building out pages for characters, themes, plot threads, and how they connect. By the end you have a rich companion wiki. Think of fan wikis like Tolkien Gateway — thousands of interlinked pages covering characters, places, events, languages, built by a community of volunteers over years. You could build something like that personally as you read, with the LLM doing all the cross-referencing and maintenance.
  • Business/team: an internal wiki maintained by LLMs, fed by Slack threads, meeting transcripts, project documents, customer calls. Possibly with humans in the loop reviewing updates. The wiki stays current because the LLM does the maintenance that no one on the team wants to do.
  • Competitive analysis, due diligence, trip planning, course notes, hobby deep-dives — anything where you're accumulating knowledge over time and want it organized rather than scattered.

Architecture

There are three layers:

Raw sources — your curated collection of source documents. Articles, papers, images, data files. These are immutable — the LLM reads from them but never modifies them. This is your source of truth.

The wiki — a directory of LLM-generated markdown files. Summaries, entity pages, concept pages, comparisons, an overview, a synthesis. The LLM owns this layer entirely. It creates pages, updates them when new sources arrive, maintains cross-references, and keeps everything consistent. You read it; the LLM writes it.

The schema — a document (e.g. CLAUDE.md for Claude Code or AGENTS.md for Codex) that tells the LLM how the wiki is structured, what the conventions are, and what workflows to follow when ingesting sources, answering questions, or maintaining the wiki. This is the key configuration file — it's what makes the LLM a disciplined wiki maintainer rather than a generic chatbot. You and the LLM co-evolve this over time as you figure out what works for your domain.

Operations

Ingest. You drop a new source into the raw collection and tell the LLM to process it. An example flow: the LLM reads the source, discusses key takeaways with you, writes a summary page in the wiki, updates the index, updates relevant entity and concept pages across the wiki, and appends an entry to the log. A single source might touch 10-15 wiki pages. Personally I prefer to ingest sources one at a time and stay involved — I read the summaries, check the updates, and guide the LLM on what to emphasize. But you could also batch-ingest many sources at once with less supervision. It's up to you to develop the workflow that fits your style and document it in the schema for future sessions.

Query. You ask questions against the wiki. The LLM searches for relevant pages, reads them, and synthesizes an answer with citations. Answers can take different forms depending on the question — a markdown page, a comparison table, a slide deck (Marp), a chart (matplotlib), a canvas. The important insight: good answers can be filed back into the wiki as new pages. A comparison you asked for, an analysis, a connection you discovered — these are valuable and shouldn't disappear into chat history. This way your explorations compound in the knowledge base just like ingested sources do.

Lint. Periodically, ask the LLM to health-check the wiki. Look for: contradictions between pages, stale claims that newer sources have superseded, orphan pages with no inbound links, important concepts mentioned but lacking their own page, missing cross-references, data gaps that could be filled with a web search. The LLM is good at suggesting new questions to investigate and new sources to look for. This keeps the wiki healthy as it grows.

Indexing and logging

Two special files help the LLM (and you) navigate the wiki as it grows. They serve different purposes:

index.md is content-oriented. It's a catalog of everything in the wiki — each page listed with a link, a one-line summary, and optionally metadata like date or source count. Organized by category (entities, concepts, sources, etc.). The LLM updates it on every ingest. When answering a query, the LLM reads the index first to find relevant pages, then drills into them. This works surprisingly well at moderate scale (~100 sources, ~hundreds of pages) and avoids the need for embedding-based RAG infrastructure.

log.md is chronological. It's an append-only record of what happened and when — ingests, queries, lint passes. A useful tip: if each entry starts with a consistent prefix (e.g. ## [2026-04-02] ingest | Article Title), the log becomes parseable with simple unix tools — grep "^## \[" log.md | tail -5 gives you the last 5 entries. The log gives you a timeline of the wiki's evolution and helps the LLM understand what's been done recently.

Optional: CLI tools

At some point you may want to build small tools that help the LLM operate on the wiki more efficiently. A search engine over the wiki pages is the most obvious one — at small scale the index file is enough, but as the wiki grows you want proper search. qmd is a good option: it's a local search engine for markdown files with hybrid BM25/vector search and LLM re-ranking, all on-device. It has both a CLI (so the LLM can shell out to it) and an MCP server (so the LLM can use it as a native tool). You could also build something simpler yourself — the LLM can help you vibe-code a naive search script as the need arises.

Tips and tricks

  • Obsidian Web Clipper is a browser extension that converts web articles to markdown. Very useful for quickly getting sources into your raw collection.
  • Download images locally. In Obsidian Settings → Files and links, set "Attachment folder path" to a fixed directory (e.g. raw/assets/). Then in Settings → Hotkeys, search for "Download" to find "Download attachments for current file" and bind it to a hotkey (e.g. Ctrl+Shift+D). After clipping an article, hit the hotkey and all images get downloaded to local disk. This is optional but useful — it lets the LLM view and reference images directly instead of relying on URLs that may break. Note that LLMs can't natively read markdown with inline images in one pass — the workaround is to have the LLM read the text first, then view some or all of the referenced images separately to gain additional context. It's a bit clunky but works well enough.
  • Obsidian's graph view is the best way to see the shape of your wiki — what's connected to what, which pages are hubs, which are orphans.
  • Marp is a markdown-based slide deck format. Obsidian has a plugin for it. Useful for generating presentations directly from wiki content.
  • Dataview is an Obsidian plugin that runs queries over page frontmatter. If your LLM adds YAML frontmatter to wiki pages (tags, dates, source counts), Dataview can generate dynamic tables and lists.
  • The wiki is just a git repo of markdown files. You get version history, branching, and collaboration for free.

Why this works

The tedious part of maintaining a knowledge base is not the reading or the thinking — it's the bookkeeping. Updating cross-references, keeping summaries current, noting when new data contradicts old claims, maintaining consistency across dozens of pages. Humans abandon wikis because the maintenance burden grows faster than the value. LLMs don't get bored, don't forget to update a cross-reference, and can touch 15 files in one pass. The wiki stays maintained because the cost of maintenance is near zero.

The human's job is to curate sources, direct the analysis, ask good questions, and think about what it all means. The LLM's job is everything else.

The idea is related in spirit to Vannevar Bush's Memex (1945) — a personal, curated knowledge store with associative trails between documents. Bush's vision was closer to this than to what the web became: private, actively curated, with the connections between documents as valuable as the documents themselves. The part he couldn't solve was who does the maintenance. The LLM handles that.

Note

This document is intentionally abstract. It describes the idea, not a specific implementation. The exact directory structure, the schema conventions, the page formats, the tooling — all of that will depend on your domain, your preferences, and your LLM of choice. Everything mentioned above is optional and modular — pick what's useful, ignore what isn't. For example: your sources might be text-only, so you don't need image handling at all. Your wiki might be small enough that the index file is all you need, no search engine required. You might not care about slide decks and just want markdown pages. You might want a completely different set of output formats. The right way to use this is to share it with your LLM agent and work together to instantiate a version that fits your needs. The document's only job is to communicate the pattern. Your LLM can figure out the rest.

@XBlueSky

XBlueSky commented Jul 7, 2026

Copy link
Copy Markdown

This idea really resonated with me.

While using Claude Code, I ran into a similar problem: conversations are valuable, but most of the content is not worth keeping forever.

Simply storing every conversation quickly becomes noisy:

  • temporary debugging attempts
  • abandoned approaches
  • outdated assumptions

I ended up building a workflow around this idea: instead of automatically turning conversations into memory, Claude and the user collaboratively distill important knowledge into a curated Markdown knowledge base.

The knowledge stays human-readable, versionable, and can be explored through Obsidian.

I called it Cortexes:
https://cortexes.pages.dev/

The interesting question for me is not "how do we store more memory?", but "how do we maintain high-quality knowledge over time?"

@TLiu2014

TLiu2014 commented Jul 7, 2026

Copy link
Copy Markdown

LLM is like CPU and docs/files are like disk. This LLM Wiki is exactly the memory!

@mas213

mas213 commented Jul 7, 2026

Copy link
Copy Markdown

Love it. a little late to the party but was headsdown to built something similar.

Applied this pattern to a different domain: behavioral verification of code changes.

The overlap is direct. Same three layers:

Raw sources = PRs, specs, test cases, production incidents (immutable, never modified)
Wiki = a behavioral knowledge graph. Not how the code is structured, how the system is supposed to behave. Concern pages, flow maps, state transitions, cross-references between what the spec promises and what the tests cover.
Schema = a concern taxonomy (auth flows, data integrity, state transitions, error propagation, integration contracts, observability) that tells the system what to look for when a PR comes in.

Same three operations:

Ingest = parse a PR with tree-sitter, extract behavioral changes, update the graph. A single PR might touch 5-10 concern pages.
Query = "what concerns does this change touch? what can break from a user's perspective?"
Lint = verify the PR against the behavioral graph before merge. Flag drift between what the system promises and what the code actually does.

The compounding effect is the same. Every PR that flows through makes the graph richer. Every production incident that gets filed teaches it a new failure mode. The graph gets better at catching the next thing because it's seen the last hundred things.

The Lint section of your gist describes exactly what's missing from QA tooling. Most test generation tools produce more scripts without understanding what the system is supposed to do. This is the other direction: build the knowledge first, then verify against it.

Open sourced as an MCP server (Claude Code, Cursor, Codex): https://github.com/OrangeproAI/orangepro-mcp

No API key, no cloud, runs locally. Curious if you've thought about this pattern applied to code specifically.

opro-karpathy-parallel

@LiyuanW21

Copy link
Copy Markdown

Thanks for sharing this — your llm-wiki idea inspired me to package the workflow into a reusable Obsidian + agent skill:

https://github.com/LiyuanW21/obsidian-wiki-system

It supports Codex/OpenCode-style agents, bilingual vault templates, and natural-language install prompts so non-technical users can try the “LLM-maintained personal wiki” pattern more easily.

I credited your gist in the README. Thanks again for the inspiration!

@phoebe22222

Copy link
Copy Markdown

This maps almost 1:1 to a system we have been running in production for ~6 months to manage infrastructure/ops knowledge. A few notes from actually living with the pattern at ~4000+ interlinked concepts:

  • The schema file is everything. Our CLAUDE.md is exactly the "disciplined maintainer vs. generic chatbot" config you describe — it encodes the ingest/query/lint workflows + naming conventions, and it co-evolved into the single most important file in the repo.
  • index.md at scale: the flat index works great to a few hundred pages. Past that we added hybrid search (SQLite FTS5 + on-device embeddings, reciprocal-rank-fused) rather than standing up embedding-RAG infra — same spirit as qmd. We expose it as both a CLI (agent shells out) and an MCP server (native tool). ~1ms keyword, ~350ms hybrid.
  • New page vs. edit (@alinawab): heuristic that works for us — new page when it is a distinct entity/concept you would link to from elsewhere; edit in place when it is an attribute/update of an existing one. The agent gets this right ~90% of the time once the schema enumerates the page types.
  • Team sharing (@geetansharora): the wiki is just a private git repo, auto-synced. Teammates browse in Obsidian or hit the same MCP server. Git history doubles as the log.md audit trail for free.
  • Biggest failure mode (@alinawab): drift — the agent under-updating cross-references on ingest, so pages silently go stale. The lint pass is not optional; we run it on a timer (orphan detection + contradiction flagging + stale-claim checks) and that is what keeps the graph healthy.

The "compounding artifact" framing is exactly right — after a few thousand concepts the wiki answers questions the raw sources never could, because the synthesis already happened. Thanks for writing it up so cleanly.

@distorx — of everyone here your setup maps closest to mine (team-scale, production, git-backed), so I'd value your take; anyone else who's hit this, welcome too.

Mine is packaged as an agent skill, not a personal wiki: the knowledge lives alongside a SKILL.md — the schema/entry file agents load — as a git repo of markdown. Same three layers you'd recognize: an immutable source-of-truth layer (~30 metadata snapshots auto-pulled from our data platform), an LLM/human-maintained wiki layer derived from it (per-dataset field specs, metric formulas, business logic, query cases; ~450 md pages + ~110 python config files), and the SKILL.md schema + lint rules on top. It's distributed to a whole team, and each person's agent (Claude Code / Cursor / etc.) both uses and edits it.

Two things I can't settle:

  1. Size vs. keeping source-of-truth local. The immutable snapshots are the heaviest, churniest part. The gist stresses keeping an immutable raw layer as the foundation, but do you keep raw sources in-repo, or split them out (submodule / LFS / on-demand fetch) to keep the skill light? And does repo size actually hurt agents at query time, or is it purely a human clone/CI cost?

  2. Concurrent team maintenance without rot. With multiple people's agents editing the same skill: do they push directly, or through a review gate (PR) before a page lands? How do you stop two agents fighting over the same page / spawning near-duplicates? Who owns the SKILL.md schema when the whole team co-evolves it? And the lint pass — human-triggered, or on a timer / CI hook? You called drift the #1 failure mode, so I'm most curious what actually enforces it at team scale.

Trying to avoid the failure mode where a shared wiki slowly rots because no single person owns the bookkeeping. Any pointers appreciated.

@bprice1000

bprice1000 commented Jul 8, 2026

Copy link
Copy Markdown

I build a CMMS with this as a primary influence.

It’s transformative. New levers to lean on, fun and powerful things happening when I do.

you didn’t give us the framework for a document system.

you gave us an engine. Build rules whereby everything is defined, every document has a place on a tree. Segment the tasks. Use skills to hard code workflows, define decision making trees, pool, lever markdown every way possible, guild based agent permissions; then suddenly you’ve got the flattest cmms-wiki all time that has no database or license.

Ty.

@davidlfox

davidlfox commented Jul 9, 2026

Copy link
Copy Markdown

for anyone running this locally/offline--what models are you finding reasonable success with? this feels like it could grow quickly into 2k-10k completions at the ~100 sources, hundreds of pages scale. does this need a 35b model? or would something much smaller suffice, since its only really doing classification? multiple models e.g. small for classification, larger for summaries/connections?

@gowtham0992

Copy link
Copy Markdown

Link 1.6.0 is out. Two big changes since 1.5.0:

Memory is now automatic. lnk connect claude-code --hooks (also Codex, Cursor) installs session hooks: a bounded memory brief is injected when a session starts, and proposal-only notes are captured when it ends. The agent no longer has to remember to call its memory — and the review gate still holds, nothing durable is saved without approval. Dogfooding this caught a fun bug worth sharing: the capture pipeline was mining the assistant's prose as if it were my preferences ("you prefer small commits" → saved as my preference). Proposals now come only from the user's own turns.

Opt-in semantic recall, still fully local. pip install "link-mcp[semantic]" adds a small local embedding model so recall matches paraphrases — embeddings live in plain JSON under .link-cache/, no vector DB, model loads offline-only after a one-time fetch. Lexical stays the default. Measured on a 1,176-case benchmark in the repo: hybrid lifts hit@1 0.589 → 0.703; on third-party LoCoMo (1,536 queries, retrieval-only): any-evidence hit@10 0.578 → 0.685. Ablations that didn't survive measurement are documented too.

Everything still plain Markdown on your machine, zero network in the runtime (CI-enforced).

lnk recall matches by meaning, then greets your next session with what it learned

brew upgrade link (or brew install gowtham0992/link/link)

Release notes: https://github.com/gowtham0992/link/releases/tag/v1.6.0

Repo: https://github.com/gowtham0992/link
Site: https://gowtham0992.github.io/link/
PyPI: https://pypi.org/project/link-mcp/
MCP: https://registry.modelcontextprotocol.io/?q=io.github.gowtham0992%2Flink

@turkonthelurk

Copy link
Copy Markdown

Gezz the AI Slop is storing in this one's comment section... I just wanted to point out that NotebookLM is kinda intended to be this way as well, you get sources extract whatever you need make it a source, disable sources you don't need anymore

right - but then you're reliant on google. this setup is model agnostic.

@Drifting12345

Copy link
Copy Markdown

LLMwiki4rolePlay

Incrementally build a novel .txt into an Obsidian knowledge graph, then use it as context to drive AI role-play.

Built on the LLM Wiki methodology, implemented as a self-contained Claude Code Skill — clone it and it just works, no pip install required. The Agent is the brain, the tools are the hands: when to create an entity, when to update it, what to retrieve is entirely the Agent's call; tools only execute.

What it does

Give Claude Code a novel's txt file, and chapter by chapter it will:

  • Identify characters / locations / items / events
  • Write each entity as a .md page (YAML frontmatter + narrative body)
  • Embed [[wikilink]]s in the narrative to naturally form graph edges
  • Incrementally update existing entities by topic section when new information appears

The end result is an Obsidian vault that lets you:

  • Browse the graph in Obsidian, jump between pages, view the graph view
  • Have Claude Code answer questions in character as any character (grounded in the wiki content, never breaking character)

Why it's good

  • Character knowledge isolation: during role-play, entity-context enforces a hard knowledge boundary — entities in the same team (derivative entities under the same main character) are fully readable; characters outside the team only get the paragraphs from the reader's own narrative that mention them. This stops a character from answering with plot information it never actually witnessed just because the Agent happened to read every entity in the book — no breaking character.

  • Two-layer memory: remembers conversations without OOC (out of character): the book wiki vault (read-only, long-term memory of in-universe facts) and the memory vault (read-write, the character's relationship history with the user) are physically separated. The character remembers what you've talked about before and how the relationship has progressed — short-term dialogue is stored in history.txt and automatically consolidated into topic pages in the memory vault once a threshold is hit; past 200 entities, the least-recently-accessed ones are evicted (LRU). But every answer stays grounded in the book wiki's knowledge graph — remembering conversations never means inventing canon that isn't there.

  • Index + graph traversal retrieval, scales to very long texts: search first reads candidate ids from index.md / _index-{parent}.md instead of scanning the whole vault on every call; context lookups follow [[wikilink]]s on demand instead of loading everything at once. Derivative documents split out from an oversized entity are only written into their own team's _index-{parent}.md, never into the global index.md — the deeper the graph gets from splitting, the leaner the global index stays, so lookup speed doesn't degrade as the novel grows. Built for building knowledge graphs out of very long texts.

skill here:
https://github.com/Drifting12345/LLMwiki4rolePlay

@william-Johnason

william-Johnason commented Jul 10, 2026

Copy link
Copy Markdown

We ran a 5-model accuracy vs. cost benchmark on a knowledge base QueryAgent (BM25 retrieval + LLM synthesis) across 15 M&A due diligence questions, three complexity tiers including cross-lingual. Results and per-question breakdown: AquaFlow LLM Evaluation Report

Hope the findings are interesting to you as well!

@pradocabreroalejandro

Copy link
Copy Markdown

phoebe22222

@phoebe22222 — running a similar setup in production: a wiki of business rules
extracted from a legacy ERP under active modernization (over a thousand forms,
PL/SQL, DDL; legacy and new stacks coexisting), multiple human operators,
served company-wide through a read-only MCP server. Your two questions are
exactly the ones that shaped our design, so here is what survived contact:

1. Size / keeping source-of-truth local: don't copy sources at all. Our
sources are living code, so any snapshot layer is stale by construction. A
manifest file declares which repo paths count as documentary sources; the
agent reads them in place, and every citation pins a version:
file@SHA:lines. Git already guarantees every cited version stays
recoverable, so the "immutable raw layer" becomes a property (version-pinned)
instead of a folder (copied). Bonus: git diff <last-synced-SHA>..HEAD -- <manifest paths> IS the re-ingest work list — deterministic, complete, no
judgment. The wiki repo holds only synthesis and stays light.

1b. What the agent reads is not the raw source — it's a distilled version,
and that's a contract, not a convenience.
Raw exports are written for
machines of their era: our form-definition XMLs are mostly layout noise
(coordinates, fonts, visual attributes). A deterministic CI step distills
every source type on every commit — forms XML stripped to triggers/program
units, DDL reduced to logical schema, PL/SQL normalized. On our two largest
forms that's a 4.4MB→975KB and 2.8MB→657KB reduction on disk (haven't
measured tokens rigorously, but the removed content is what the extraction
never needed anyway). Three rules keep it honest: distilled output is
byte-deterministic (or your git-diff work list fills with phantom changes),
every distilled file carries a provenance header (source path, content hash,
distiller version), and changing what a distiller strips is a schema-grade
event — it changes what the model can see, therefore what knowledge can
exist.

1c. Structured labels in the sources survive distillation and set the trust
floor.
We annotate sources with a small closed tag vocabulary the agent is
taught to anchor on — two tiers with strictly separate authorship:
machine-generated hints (pipeline-written, confidence-labeled, generated at
scale to give reviewers a starting point) and human annotations
(PR-reviewed, the only tier that counts as verified provenance). When a
human annotation lands, the pipeline prunes the machine hint — scaffolding
comes down. Extraction provenance then travels on every wiki page
(human-annotated > machine-hinted > raw code reading), and since full
curation of a 200-column table will never happen, a quality score per source
feeds a citizenship gradient instead of a binary gate: low-curation entities
stay readable, but everything derived from them carries the caveat.

2. Concurrent maintenance without rot — four mechanisms, all boring:

  • All wiki writes land via PR. The serving layer is strictly read-only;
    consumers physically cannot write. Deploy follows a git ref, so "publish"
    is an operator blessing (a tag fast-forward), not whatever an agent last
    did.
  • One writer per layer. Extraction agents write rule/entity pages; the
    synthesis pass writes composite pages and is forbidden from creating atomic
    ones (it reports findings back down instead). Two agents never contend for
    the same page because no two roles share a page type.
  • The schema has an owner and an amendment regime. Agents propose changes
    with evidence from the operation log, humans approve, and every change
    leaves a log entry + an honest commit message. The schema's git history is
    the experiment's changelog. "Co-evolved by the whole team" without this
    decays into "describes nothing."
  • Lint is CI/timer-enforced, and the bookkeeping backlog writes itself.
    Beyond the usual checks, the serving layer appends every unanswered query
    to a miss log; a reconciliation step folds those into a versioned demand
    ledger. Nobody "owns the bookkeeping" as a chore — the system emits its own
    todo list, ranked by real demand, and operators just work it.

Agreeing hard with @distorx that drift is the failure mode. Our addition:
grade the trust and make it travel — every page carries status + extraction
provenance, and the MCP attaches the caveats to every payload, so a stale or
disputed page degrades honestly instead of silently. Writing up the full
pattern (what the original assumptions didn't survive: frozen sources, single
user, cheap errors); will share when it's cleaned up.

@gserdyuk

gserdyuk commented Jul 13, 2026

Copy link
Copy Markdown

Field report from a different starting point: a research repo (simulation-methodology project, twotakt) that converged on this pattern before reading the gist — same mechanics: INDEX.md as the catalog (one pointer line + a one-line hook, never content), an append-only dated log with greppable tags, CLAUDE.md as the schema file, a findings register as the synthesis layer. Coming from research reproducibility rather than PKM, we ended up with two mechanics I haven't seen in the thread, both aimed at the staleness/drift problem @a-a-k and others raise:

  1. Document passports. Every corpus document opens with a one-line immutable header: > Type: reasoning | register | journal | record — < regime > · born < date >. It tells the reader — human or LLM — how to treat the file: is it append-only, may it contradict newer documents, is it synchronized. Cheap, and it resolves the "is this page current?" ambiguity at read time instead of trying to prevent it at write time.

  2. Corpus/surface split. We stopped fighting staleness for most documents. The corpus (log, findings, reasoning docs) accumulates: dated, append-only, internal contradictions are history and never "fixed"; it gets periodically compacted (reviewed, rewritten as vN, previous version archived) rather than patched in place. Only a deliberately small "surface" (README, the schema file) promises currency and is synchronized. We had three current-state documents die of rot before generalizing the rule: staleness is solved by not promising currency — except where you can actually afford the promise.

Also +1 to @nowissan 's "Level" problem: our synthesis layer is claim-first (numbered one-screen claims, each pointing to its long form; refinements are new claims — "refines/supersedes #N" — never edits), and concept-level docs only graduate out of claim clusters that recur. Level falls out structurally: a concept with ten claims under it is heavyweight, one with a single claim is light — importance is measured by the size of the cluster, not assigned by an author.

The mechanics live in CLAUDE.md / INDEX.md / findings.md / dev-log.md here: https://github.com/gserdyuk/twotakt

@ANT-CYJ

ANT-CYJ commented Jul 13, 2026 via email

Copy link
Copy Markdown

@bluejaeha

bluejaeha commented Jul 14, 2026

Copy link
Copy Markdown

Thank you for sharing this idea — it changed how I work.

I'm not a developer — I'm an accountant in Korea, doing K-IFRS advisory and audits at an accounting firm. English isn't my strong suit either, so this comment was written with AI help (fitting, given the topic). I've been running my own instance for a while: immutable sources/, an agent-maintained wiki/, and a CLAUDE.md schema, covering accounting standards plus IT, physics, math, and philosophy as separate domains in one vault.

llm-wiki/
├── sources/                  # immutable originals — the LLM never edits
│   ├── inbox/                # unclassified intake (incl. inbox/ai/ for chatbot summaries)
│   └── domain/               # accounting, capital-market, it, network, physics, math, philosophy...
│       ├── ai-archive/       # processed AI summaries (still "unverified")
│       ├── reference/        # full-text library for verification lookups
│       └── ...               # classified excerpts (standards, rulings, notes...)
├── wiki/
│   ├── domain/topics/        # agent-maintained pages, each with a verification status
│   ├── index.md              # catalog, updated on every ingest
│   └── open-questions.md     # contradictions and unresolved issues
├── scratch/                  # human-only notepad, excluded from all workflows
└── CLAUDE.md                 # the schema

One thing I added, coming from audit work: a verification status on every page. AI-generated content enters through a quarantined inbox, is marked unverified, and cannot be cited as grounds for any other page until checked against primary sources (accounting standards, paragraph by paragraph). An unverified page citing another unverified page is exactly the circular evidence auditors are trained to reject. Each domain also has its own mandatory citation format — standards paragraph numbers for accounting, RFC numbers for networking, and so on.

Another extension: conversations with external chatbots are a first-class ingest source. I keep a standardized prompt (and an agent skill) that distills a ChatGPT/Claude conversation into atomic notes with fixed frontmatter, tags, and naming conventions — which then enter through the same quarantined inbox as any other unverified material. Reading the comments here, it seems several of us converged on this independently.

Watching scattered knowledge compound into something I can actually trust in client work has been a real joy. If this pattern works for a non-developer like me, it can work for anyone. Thanks again for giving this away so generously.

@HemachandranD

Copy link
Copy Markdown

Built the Notion side of this as a small pull-only bridge: notionwiki

notionwiki treats Notion as one feeder into raw/ — a scheduled job polls, converts pages/database rows to flat markdown (hierarchy kept as frontmatter, not folders, so a Notion move never reshuffles the corpus), and archives-on-change rather than overwriting silently. No write-back, no sync/push — Notion stays where you author, and the actual wiki-building (ingest → synthesize → lint) is exactly the loop described here, run by an assistant against CLAUDE.md as the schema. The part I keep coming back to: without a real push mechanism, the corpus is only ever as fresh as the last poll — so "compounding" ends up bounded by pull cadence, not by how fast the model can actually synthesize.

image image

@Encod3d-Sec

Copy link
Copy Markdown

Fully Working integration of this:

https://github.com/Encod3d-Sec/ClaudeBrain

@DaveMikeP

Copy link
Copy Markdown

First of all, thanks to @karpathy for introducing and describing the LLM-Wiki paradigm: a simple yet brilliant idea that, in my opinion, will revolutionize corporate document management (replacing heavy, complex knowledge bases), help students avoid superficial LLM usage, and serve as a great ally for methodical learning.

I have built a Personal LLM-Wiki prioritizing two fundamental aspects:

  1. Privacy: All components run completely offline.
  2. Efficiency: I focused on creating an executable suitable for modest hardware (with or without a GPU), making it accessible despite current market prices for graphics cards.

The core concept is straightforward: perform non-LLM-specific operations deterministically using standard Python libraries, which consume significantly fewer resources than a giant language model. It feels inefficient to waste LLM tokens on repetitive tasks that only require classic computational power.

While my initial prototype worked, the model's responses were often too generic or limited to brief definitions. To achieve the exhaustive, structured lessons I envisioned, I integrated a few key components to enrich the context:

Key Components

  • Graphify: Maps relationships between Markdown files, SQL schemas, scripts, and PDFs. It improves navigation based on structural relationships rather than just keywords, creating a navigable "map" directly accessible to the AI or via Obsidian. This drastically reduced dependency on compute while improving coherence.
  • ChromaDB: A lightweight vector database used as the pillar for semantic search and document retrieval, executing operations efficiently on the CPU.
  • NetworkX: Manages a dual data structure in memory with a lazy cache: an Undirected Graph ($G$) for generic relationships and a Directed Graph ($DiG$) focused exclusively on formative dependencies. This helps identify correlations and cite diverse sources covering the requested topic.
  • SQLite: An embedded, serverless relational database dedicated to managing the system's transactional state and audit logs.

Operational Flow

[Phase 1 (Optional): Pre-processing (Whisper)] ──> 
──> [Phase 2: Synthesis (Qwen3VL)]
──> [Phase 3: Graph Building (Graphify)]
──> [Phase 4: Indexing (ChromaDB)]
──> [Phase 5: Context Assembly]
──> [Phase 6: Inference (Qwen3.5 9B)]

Advanced features included: Semantic Query Cache, Cross-Encoder Re-Ranker, and Reciprocal Rank Fusion (RRF) for HyDE.

Additional Features

  • Localization & UI: Built a lightweight Flask web page with "on-the-fly" language switching managed via simple .lng files.
  • Secure Telegram Bot: Accessible without exposing ports or reverse proxies (restricted to authorized Telegram IDs). It includes an interactive poll after each response, allowing the user to save the text, export it as a Marp Markdown presentation, or generate an audio podcast.
  • Quiz Mode: Generates multiple-choice questions based on the wiki content with customizable difficulty, evaluating errors and explaining why a specific answer was wrong.

A Critique of the Paradigm: No New Wiki Pages Without Raw Sources

The only critique I have regarding the baseline LLM-Wiki paradigm concerns creating new wiki pages derived from LLM responses.

I don't find it useful to generate additional pages beyond those processed during the Ingest phase. Reprocessing existing concepts in different forms consumes resources and slows down the system (more pages to scan per query) without introducing genuinely new information. Since the LLM should not invent anything (avoiding hallucinations), it doesn't enrich the source base.

In my implementation, the only generated pages allowed are the Markdown files exported for Presentations (Marp syntax)-treated strictly as "output documents" for the user, rather than being re-fed into the pipeline as wiki sources.

I haven't published the repository on GitHub yet, as I am still refining the integration to make it as user-friendly as possible. I hope this architecture can serve as inspiration for anyone looking to customize or optimize their local LLM-Wiki setup!

Below is an example of an answer to the question “Explain me what Kubernetes is.”

Personal LLM-WIKI

Hi Maurizio, I like the way you implemented this. Well done and inspiring for me.
BR, Mike

@serradura

serradura commented Jul 15, 2026

Copy link
Copy Markdown
image

Hi @karpathy, I implemented a complete toolkit to facilitate the OKF adoption (LLM Wiki ideas), which is composed of three cores:

An Agent Skill (the 🧠 ), a CLI/Lib (the 💪 ), and a Server (the 📊 )

The agent knows how to author, curate, and, more importantly, how to consume (CLI tools + Server (for humans)).

It is ​Open source and runs 100% locally! (using Ruby or Docker).

Here is the GitHub repo: https://github.com/serradura/okf-gem (https://demo.okfgem.com)

image

The knowledge graph looks like this:​

image

And you can test it here: https://demo.okfgem.com/

Step by step to experiment with it:

  1. Install the gem: gem install okf
  2. Install the skill: okf skill .claude (or any other agent)
  3. Start an agent session (claude)
  4. Execute /okf produce based on <path-to-my-existent-docs>

Once you have your first bundle, you can do:

Run the command /okf maintain in your agent session to keep it updated. Or, install the Claude Plugin, which will run this for you (after triggering the Stop hook).

You can also run okf server <folder> to render your live graph locally. Or ask the agent to up it for you.

If you want to know more, please check out these other resources:

It is also possible to run it through Docker (no Ruby required):

image

Looking forward to your feedback and critiques.

Thanks!

@simontaurus

Copy link
Copy Markdown

This resonates strongly - and I'd push one layer deeper on why the bookkeeping gets abandoned. In our experience the thing that doesn't scale is unqualified links + free text. A lovingly hand-maintained personal wiki decays into prose and dead links within a couple of years; a team or corporate one gets there faster. What actually compounds is structure - typed entities you can query, not paragraphs you have to re-read.

We took a structured variant of exactly this pattern into production about five years ago, on Semantic MediaWiki. Using MediaWiki's content-slot feature, every article keeps its unstructured body and a structured JSON slot side by side. The JSON slot's shape is defined by the article's category/categories, and each category carries a JSON Schema in its own slot - so one schema drives both auto-generated edit forms for humans and machine editing for everything else.

Putting JSON-LD on top (we specced this as OO-LD: one document that is simultaneously a JSON Schema and a JSON-LD context) turns the whole wiki into an RDF knowledge graph for free - you can run SPARQL across every entry. Your lint step (contradictions, orphans, missing cross-refs) becomes graph queries; query becomes structured retrieval, not just text search.

When LLMs with JSON-Schema-driven structured output arrived, it was a drop-in fit: the exact schemas that render the forms also constrain LLM extraction.

Mapping to your three layers: raw sources (immutable) / the wiki - but as typed, linkable entities rather than markdown / the schema - a JSON Schema per category rather than one prose config.

Where we're putting research effort now is precisely your ingest loop at scale: take an unstructured knowledge chunk -> select the right schema(s)/categories to represent it -> fill them correctly and dedup against entities that already exist. That last "and" - entity resolution against a live graph - is the hard part; it's your lint moved to write-time.

Curious whether others here have pushed on write-time dedup - that's where the pattern either compounds or sprawls.

Reference implementation: OpenSemanticLab (live demo: https://demo.open-semantic-lab.org) · schema approach: OO-LD.

@EricWcr7

Copy link
Copy Markdown

Thanks for sharing this, Andrej. The distinction between retrieving documents and building a persistent knowledge artifact that compounds over time really clicked for me.

I used your LLM Wiki pattern as the foundation for My Second Brain by YFW, a local-first application that turns documents, images, PDFs, and web pages into a connected, searchable, Obsidian-compatible Markdown wiki.

It implements the three layers you described—immutable raw sources, an LLM-maintained wiki, and an inspectable instruction/schema layer—and extends them with a browser interface, CLI workflows, scoped knowledge branches, source provenance, grounded answers with citations, structural review, and optional hybrid search.

One lesson from building it is that retrieval is still useful, but mainly as a navigation layer. The durable object is the maintained Markdown wiki: readable by humans, editable by agents, portable across tools, and improved with every ingest and question.

Thank you for publishing the idea in such an open-ended form. It gave me a clear conceptual foundation while leaving enough room to develop a concrete implementation around my own workflow.

Project: github.com/EricWcr7/My-Second-Brain-by-YFW

@jp-lorenc1o

Copy link
Copy Markdown

Built a desktop app around this idea — Eva. Instead of the CLI-agent + Obsidian workflow, it's a native app that drives Claude Code or Codex to do the ingest/query/health-check loop, with a git-backed review gate (deletions and new lint issues always hold for review before merging) and a live graph you actually navigate, not just Obsidian's graph view. Tested it end to end on a few dozen Berkshire shareholder letters and a full college course — both held up.
Local-first, no account, no cloud DB, MIT licensed. V1 is macOS-only and unsigned (documented why in the README, mostly "$99/year isn't worth it yet for a solo project").
github.com/jp-lorenc1o/Eva-brainjp-lorenc1o.github.io/Eva-brain

@betsalel-williamson

Copy link
Copy Markdown

I absolutely love this idea! I've actually created a skill that works along this exact same approach, based on my experience over the last year working with LLMs—context matters so much!

It's a developer-friendly AI skill called MDCP (MarkDown Context Protocol) that helps keep track of ideas directly in the repo when developing software. The key to the approach is keeping the markdown shards small. The result is human- and machine-readable information that stays durable to the repo, helping you focus on building the software one idea at a time.

There's also a companion CLI to help compile the shards into comprehensive guides and validate links as well.

Thanks for sharing this pattern, it's incredibly validating to see others converging on the same solution!

https://github.com/betsalel-williamson/mdcp

https://www.skills.sh/betsalel-williamson/mdcp/mdcp

@theafh

theafh commented Jul 15, 2026

Copy link
Copy Markdown

For my taste many implementations are at the border of over engineering! To much MCP servers, knowledge graphs, vector storage and third party tools! The power of this idea lies in simplicity, open protocols, ease of use for agents and humans alike. The core is auto discoverability and open standards. My implementation has all that, for wiki and task management. It replaces enterprise Confluence (Wiki) and Jira (tasks) and automates what is possible AI does the heavy lifting while keeping human operators in the loop: https://github.com/theafh/ai-modules

@syahiidkamil

Copy link
Copy Markdown

Thank you for writing this up. It was early to where the whole field seems to be heading now: memory that gets built and maintained instead of stored and queried. HORMA, TencentDB's agent memory pyramid, Anthropic's new Dreams feature all point the same way. Some of that is probably independent convergence, but this gist gave a lot of us the words first, and that is most of why I started building instead of just nodding along. The knowledge tier of mine came straight from here.

The part I keep wondering about, and I would genuinely like your take: what happens when the thing being compiled is the agent itself?

Even active memory leaves one question open. Who decides what is important, and who anchors it? With nothing at the center, every extraction re-decides importance from nowhere and the judgments never add up into anyone, so you land on generic. The bet I am making is not an agent that has a memory, but a self made of memory, which then curates the memory it gets rebuilt from. Two arrows instead of one.

The self part is not hand-waving, it is a structure on disk. Six layers, each allowed to change at a different speed: the fixed things that never move, an identity layer that only changes through a gate, values that can only tighten, and a temporal skin rewritten daily. It also models itself before it answers, and that is the part that makes it a self rather than a profile. Theory of mind is that same self-model pointed outward, since you cannot simulate another mind without one to run it on.

Which is the order evolution used too. A boundary first, before anything was even alive. Then movement, then vision. Brainpower alone was not enough either, Neanderthals had bigger brains and still died out, and what carried us was the social layer, which came last. Most AI memory builds that backwards: a finished assistant, with a profile of you clipped onto the side.

Wrote it up, your gist credited throughout:
https://gist.github.com/syahiidkamil/c6a3836fcfd88843865d87319c81ce37

Running PoC, all plain markdown and git:
https://github.com/syahiidkamil/vibe-ai-partner-entity

Thanks again for giving it away.

@glenr4251-byte

Copy link
Copy Markdown

Most of our current interactions with AI, like using NotebookLM or ChatGPT's file uploads, follow a Retrieval-Augmented Generation (RAG) model. You upload a collection of files, and when you ask a question, the AI searches through them, pulls out the most relevant chunks, and synthesises an answer. The problem? It's starting from scratch every time. The AI is a brilliant researcher who forgets everything as soon as the query is done. Karpathy's idea flips this on its head. Instead of [fridayroll](url just indexing raw documents for retrieval, the LLM incrementally builds a persistent, structured wiki—a collection of interlinked Markdown files. When you add a new source, the LLM doesn't just index it; it reads it, extracts the key information, and integrates it into the existing wiki. It updates entity pages, revises topic summaries, and flags contradictions. The knowledge is compiled once and kept current.

@notfounnd

Copy link
Copy Markdown

@ZeroDot1

Copy link
Copy Markdown

🧠 RAG is Dead. Build a Continuous Local AI Wiki with LLMWikiNG.

Stop rebuilding your knowledge base from scratch on every single prompt. LLMWikiNG (inspired by Andrej Karpathy's LLM-Wiki pattern) is a local, privacy-first platform that compiles your documents once into a structured, cross-linked, OKF-compliant Markdown wiki that grows and refines continuously.

🚀 Deploy in Seconds, Ingest Seamlessly

  • Instant Docker Deployment: Spin up the entire FastAPI backend, Tokyo-Night web UI, and local hybrid search in seconds using docker-compose. Zero-hassle setup, maximum performance.
  • Direct Web Ingest: Push raw data, text snippets, or web URLs straight from your local machine to the server. Use the web interface or automate it via curl with secure API keys.
  • 100% Local & Secure: Powered by Ollama. Your data never leaves your hardware, secured by Argon2 authentication and strict cryptographic controls.

🌐 Get Started

Turn your chaotic data into a self-evolving, strictly governed knowledge ecosystem.

👉 Deploy now on GitHub: https://github.com/ZeroDot1/LLMWikiNG

@mohammadmaso

Copy link
Copy Markdown

This maps closely onto something I built independently: Kherad, an open-source git-backed wiki. One of its bundle modes ("AI-compiled") is this exact ingest -> compile -> review loop: point it at a folder of raw source docs, an LLM pipeline compiles them into a structured, cross-linked wiki, and the compilation lands as a merge request you review before it goes live (screenshot attached). The rest of the tool wraps that in a Notion-style block editor plus a git commit/merge-request layer for the parts people edit by hand.

Repo if useful for comparing implementations: https://github.com/mohammadmaso/kherad
11-compile-panel

@gowtham0992

Copy link
Copy Markdown

Link 1.7.0 is out — the local LLM-wiki memory layer I've been building on this pattern.

This release was about making the automatic loop trustworthy enough to leave running: agents propose memory from sessions, you approve, and now you can see exactly how every capture was made. Each one records a decision trail (what was kept, what was dropped as the agent's own echo, why) and mines only from your own turns, so the assistant's prose can never become your preference.

remember refuses credential-shaped text (a saved password would leak into every agent session by design. Dogfooding caught mine), forget-memory now scrubs the audit log too and re-anchors its hash chain, and one-click accept lands on the actual rule instead of the "I want to set some conventions…" preamble.

Also spent the cycle benchmarking it properly, since plain Markdown files, no LLM in the memory layer invites the recall-quality question: 84.8% on LoCoMo (all 1,540 questions) under mem0's own open harness, vs their platform's 83.2% re-judged by the same judge. The result held up under a second, unrelated judge too. LongMemEval end-to-end we lose (80.6 vs 91.0, answerer-bound; retrieval put the gold evidence in context 99.4% of the time), which is in RESULTS.md next to the ablations that failed.

Still: wiki as the storage layer, every memory a file you can open, nothing durable without review.

brew upgrade link  (or brew install gowtham0992/link/link)

Release notes: https://github.com/gowtham0992/link/releases/tag/v1.7.0

Repo: https://github.com/gowtham0992/link
Site: https://gowtham0992.github.io/link/
PyPI: https://pypi.org/project/link-mcp/
MCP: https://registry.modelcontextprotocol.io/?q=io.github.gowtham0992%2Flink

link-truth image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment