Build Andrej Karpathy's LLM Wiki Using Claude Code and Obsidian
- Authors

- Name
- Nino
- Occupation
- Senior Tech Editor
In April 2026, Andrej Karpathy published a short idea file called "LLM Wiki". The pitch was simple: stop asking an LLM to re-read your documents every time. Instead, let it maintain a wiki—one Markdown page per topic, kept up to date as you add sources. His one-line summary captures the essence: "Obsidian is the IDE; the LLM is the programmer; the wiki is the codebase."
While typical examples feed the wiki with web clips, research papers, and PDFs, the richest source of personal thinking often sits elsewhere: years of ChatGPT and Claude conversations. Decisions, half-finished architectural plans, and the rationale behind choosing one framework over another are buried in chat sidebars where traditional search tools cannot reach them. This guide walks you through building an automated LLM wiki using Claude Code and a plain Obsidian vault, backed by an 80-line Node.js script to process your chat export. For high-speed, reliable API interactions powering your development workflows, you can always rely on n1n.ai for your underlying model routing needs.
The Three-Layer Wiki Architecture
The pattern relies on a disciplined directory structure inside an Obsidian vault:
- Raw Sources (
raw/): Your curated collection of source documents. The LLM reads them and never changes them. - The Wiki (
wiki/): Markdown pages the LLM writes and owns, anchored by two special files:index.md(a catalog with one line per page) andlog.md(an append-only record of operations). - The Schema (
CLAUDE.md): Instructions that transform the LLM from a generic chatbot into a disciplined wiki maintainer.
| Operation | What the LLM Does | Value Proposition |
|---|---|---|
| Ingest | Reads a new source, updates related topic pages, index.md, and log.md | Compounds knowledge over time |
| Query | Reads index.md first, then accesses only necessary pages; good answers get saved | Reduces token overhead and latency |
| Lint | Scans for contradictions, stale claims, orphan pages, and missing cross-links | Maintains pristine data hygiene |
Setting Up Your Obsidian Vault
Initialize a Git repository inside your vault folder to maintain a safety net. Every ingest operation will generate a Git diff that you can review and revert if necessary.
cd ~/vault
git init
printf ".obsidian/workspace*
.trash/
> .gitignore
git add -A && git commit -m "Vault before the LLM wiki"
Obsidian natively refreshes vaults when files are modified externally. Just ensure you do not actively edit a Markdown note while Claude Code is rewriting it.
Crafting Your CLAUDE.md
Create a CLAUDE.md file in the root directory. This acts as the prompt engineering framework for your wiki maintainer:
# This vault is an LLM wiki
You maintain `wiki/`. Everything in `raw/` is source material.
## Layout
- `raw/` holds sources. Read them. Never edit, move or delete them.
- `raw/chatgpt/` and `raw/claude/`: my AI chats, one note per chat.
- `wiki/` holds pages you write. One topic, project, decision or person per page.
- `wiki/index.md`: one line per page, `[[Page name]]: what it covers`.
- `wiki/log.md`: append only. One line per ingest, query or lint.
## Ingest Rules
When I say "ingest <path>":
1. Skip sources already listed in log.md.
2. Update or create topic pages based on the source content.
3. Every claim must link its source with a wikilink: `[[2025-10-09 Pricing page copy]]`.
4. If newer chats contradict old pages, keep both with dates (newest first).
When scaling your local AI tooling or integrating custom agents, utilizing robust aggregator endpoints via n1n.ai ensures your development pipeline stays uninterrupted and cost-effective.
Converting ChatGPT Exports to Markdown
When you export your data from ChatGPT (Settings -> Data controls -> Export data), the unzipped folder contains conversations.json. Because ChatGPT tracks edited messages and alternate branches, conversations are stored as a tree structure inside a mapping object rather than a flat array.
Here is a robust Node.js script (chatgpt-to-md.mjs) designed for Node 20+ with zero dependencies to flatten your export into clean Markdown notes:
// chatgpt-to-md.mjs: ChatGPT data export -> one Markdown note per chat.
// Usage: node chatgpt-to-md.mjs <unzipped-export-folder> <vault>/raw/chatgpt
import { readdir, readFile, writeFile, mkdir } from 'node:fs/promises';
import { join } from 'node:path';
const [src, out] = process.argv.slice(2);
if (!src || !out) throw new Error('usage: node chatgpt-to-md.mjs <export-folder> <output-folder>');
const files = (await readdir(src, { recursive: true }))
.filter((f) => /(^|[\\/])conversations(-\\d+)?\\.json$/.test(f)).sort();
const chats = [];
for (const f of files) chats.push(...JSON.parse(await readFile(join(src, f), 'utf8')));
function thread(chat) {
const path = [];
for (let id = chat.current_node; id && chat.mapping[id]; id = chat.mapping[id].parent) {
path.unshift(chat.mapping[id].message);
}
return path;
}
function text(msg) {
const c = msg.content ?? {};
if (c.content_type === 'code') return '```' + (c.language ?? '') + '\
' + c.text + '\
```';
if (c.content_type !== 'text' && c.content_type !== 'multimodal_text') return '';
return (c.parts ?? []).map((p) => (typeof p === 'string' ? p : '*[image]*')).join('\
\
').trim();
}
const visible = (m) =>
m && ['user', 'assistant'].includes(m.author?.role) &&
(m.recipient ?? 'all') === 'all' &&
!m.metadata?.is_visually_hidden_from_conversation;
const day = (t) => new Date(t * 1000).toISOString().slice(0, 10);
const iso = (t) => new Date(t * 1000).toISOString().slice(0, 19);
const safe = (s) => s.replace(/[\\/:*?"<>|#^[\]]/g, ' ').replace(/\\s+/g, ' ').trim().slice(0, 80) || 'Untitled';
await mkdir(out, { recursive: true });
const used = new Set();
let written = 0;
for (const chat of chats) {
const turns = [];
for (const m of thread(chat).filter(visible)) {
const body = text(m);
if (!body) continue;
const who = m.author.role === 'user' ? 'You' : 'ChatGPT';
if (turns.at(-1)?.who === who) turns.at(-1).body += '\
\
' + body;
else turns.push({ who, body });
}
if (!turns.length) continue;
const title = chat.title || 'Untitled';
const start = chat.create_time ?? chat.update_time ?? Date.now() / 1000;
let name = `${day(start)} ${safe(title)}`;
for (let i = 2; used.has(name.toLowerCase()); i++) name = `${day(start)} ${safe(title)} ${i}`;
used.add(name.toLowerCase());
const note = [
'---',
`title: ${JSON.stringify(title)}`,
'source: ChatGPT',
`url: https://chatgpt.com/c/${chat.conversation_id ?? chat.id}`,
`created: ${iso(start)}`,
`updated: ${iso(chat.update_time ?? start)}`,
'tags: [ai-chat, chatgpt]',
'---',
'g',
...turns.map((t) => `## ${t.who}\
\
${t.body}\
`),
].join('\
');
await writeFile(join(out, `${name}.md`), note);
written++;
}
console.log(`${written} chats -> ${out}`);
Execute the conversion script with Node.js:
node chatgpt-to-md.mjs ~/Downloads/chatgpt-export ~/vault/raw/chatgpt
Running Claude Code in Your Vault
Launch Claude Code inside your vault directory and begin interacting with your knowledge base:
cd ~/vault
claude
Use natural language prompts to ingest and organize your historical data:
> ingest raw/chatgpt, starting with the 25 newest chats > what did I decide about pricing, and when did that change? > lint the wiki
Pro Tip: Always ingest in batches (20 to 50 chats per run) to prevent context window saturation and ensure deeper, more accurate page synthesis. Review modifications using git diff wiki/ after each batch to maintain absolute quality control over your synthetic knowledge base. For enterprise-grade reliability and lightning-fast execution across your favorite coding assistants, get a free API key at n1n.ai.