Karpathy's LLM Wiki: What It Means & How to Build One
By Tonbi's AI Garage
Summary
Topics Covered
- Knowledge Compounds When LLMs Write Your Wiki
- One Source Touches 10 to 15 Wiki Pages
- LLMs Don't Get Bored Maintaining Cross References
- File Over App: Your Data in Universal Formats
Full Transcript
So, I'm sure many of you saw this tweet from Andre Karpathy last week talking about LLM knowledge bases. It caught a lot of interest as kind of a new way to use AI as a research tool. And the core
concept was to use LLMs to build personal knowledge bases for various topics of your research interest.
He breaks down how he did it here. And
there were a couple other follow-up tweets as well as other uh researchers and AI enthusiasts talking about the way that they've done this kind of tooling.
So in today's video, we're going to build this for ourselves. First, I'm
going to kind of break down what the concept is and why it's useful uh compared to other alternatives.
And then we're going to actually build this out together in Claude Code. So
you'll see a good example of how you would actually build this out. So wait,
wait till the end for that. So let's
start with the problem. Right now uh most people's experience with LLMs and documents look like rag ra retrieval automated generation. You upload some
automated generation. You upload some files to chat GBT or notebook LM or whatever tool and when you ask a question it retrieves some chunks and generates an answer.
And that works fine for simple questions. But here's the issue. Nothing
questions. But here's the issue. Nothing
accumulates. Every time you ask a question, the LM is red rediscovering knowledge from scratch. It's reiecing
together fragments every single time. So
if you ask something subtle that requires synthesizing five different documents, it has to find and connect all those pieces on every query. There's
no memory, no cross references, no accumulated understanding. But this LLM
accumulated understanding. But this LLM powered wiki pattern flips this. Instead
of retrieving at query time, the LLM builds a persistent interlink wiki up front. The cross references are already
front. The cross references are already there. Contradictions are already
there. Contradictions are already flagged. The synthesist already reflects
flagged. The synthesist already reflects everything you've already fed it.
Knowledge compounds instead of being thrown away after each conversation.
And this is the key quote from Karpathy when discussing this. The LM
incrementally builds and maintains a persistent wiki structured interlin markdown files sitting between you and your raw sources. And the critical thing is you never write the wiki yourself.
The LLM writes and maintains all of it.
You're in charge of the important stuff, finding the good sources, exploring, asking the right questions. The LLM
handles all the grunt work, the summarizing, the cross referencing, the filing, the bookkeeping, all the stuff that makes knowledge bases useful, but that no one actually wants to do.
So there are many ways we can do this, but the basic architecture has three different layers uh based on what Carpathy was describing, and it's fairly clean. On the left you have raw sources.
clean. On the left you have raw sources.
So articles, papers, images, data sets, whatever you're collecting. You know,
I'm sure most of us who are in this field find interesting articles, find interesting tweets, uh interesting GitHubs, and these are your raw sources
and these are immutable. The LM reads them but never touches them. They're
your source of truth. In the middle here, uh is the wiki itself, directory of markdown files that the LM owns entirely, summaries, entity pages,
concept pages, comparisons. The LM
creates these, updates them when new sources come in and maintains all the cross references, keeps everything consistent.
And on the right is the schema and this is the configuration file basically like a clawed MD. Uh, and this tells your tells the LLM how the wiki is structured, what the conventions are,
what workflows to follow. So you and the LLM co-evolve this over time as you figure out what works for your domain.
Think of it like this. The wiki is a codebase and then obsidian is the IDE and the LLM is the programmer and the schema is the style guide.
So there are three core operations.
First is to ingest. You drop a new source into a raw folder and tell the LLM to process it. It reads the source, writes a summary page, updates the index and cross-links it across all relevant
existing pages. A single source might
existing pages. A single source might touch 10 to 15 wiki pages. The second is query. You ask questions against the
query. You ask questions against the wiki. The LM searches the index, reads
wiki. The LM searches the index, reads the relevant pages, and synthesizes an answer. And here's kind of the clever
answer. And here's kind of the clever part. Good answers can be filed back
part. Good answers can be filed back into the wiki as new pages. So your
explorations compound in the knowledge base just like ingested sources do.
And the third is lint. So this is the maintenance pass. You ask the LM to
maintenance pass. You ask the LM to health check the wiki, find contradictions, stale claims, orphan pages with no links, missing cross references, gaps that could be filled with a web search. So the LM is good at
suggesting new questions to investigate and this keeps the wiki healthy as it grows.
So what happens when you ingest a source, right? Um because this is where
source, right? Um because this is where the real power in this is. So step one, the LM reads the raw source. Step two,
it extracts key information, concepts, entities, claims, data points. Step
three, it writes a summary page in the wiki with metadata and tags. Step four,
it updates all the existing entity and concept pages, integrating the new information into what's already known.
Step five, it flags any contradictions when new data conflicts with existing claims. Step six, it updates the index, the master catalog of everything in the
wiki. And step seven, it appends to the
wiki. And step seven, it appends to the log. Uh a timestamped record of what's
log. Uh a timestamped record of what's changed and when.
And seven, uh so one source drops in and the entire wiki gets a little bit smarter. So
that's the compounding effect. So here's
the division of later labor. Um and it's pretty clean. The human curates
pretty clean. The human curates questions and thinks. You pick the sources, you direct the analysis, you ask the good questions, you decide what actually matters. The LM agent uh just
actually matters. The LM agent uh just summarizes cross references and maintains. It writes all of the wiki
maintains. It writes all of the wiki pages. It keeps cross cross references
pages. It keeps cross cross references up to date. It maintains summaries, flags contradictions. And here's this
flags contradictions. And here's this and here is why this works. Carpathy
puts it well. Humans abandon wiks because the maintenance burden grows faster than the value, right? it becomes
a huge labor just to maintain once these become a certain size. But nicely the uh LLMs don't get bored. They don't forget to update a cross reference. They can
touch 15 files in a single pass. The
cost of maintenance drops to near zero.
So the wiki actually stays maintained properly.
So this is why this approach wins and there are four principles behind it that make it really compelling. First, it's
explicit. The knowledge is all visible in a navigable wiki which most of us are familiar with. You can exact you can see
familiar with. You can exact you can see exactly what the AI knows and what it doesn't know. There's no hidden embing
doesn't know. There's no hidden embing embeddings. There's no opaque memory
embeddings. There's no opaque memory system. Second, it's yours. You can
system. Second, it's yours. You can
customize it yourself. These are all local files on your computer. You're not
locked into any provider's system and uh you keep everything yourself. Third,
it's file over app. Everything is in universal formats marked down in images.
This means it's interoperable with any tool, any CLI, any viewer. The entire
Unix toolkit works with on your data.
And fourth, you can bring your own a AI.
You can plug in claw, GBT, codecs, open source models, whatever you want. You
can even fine-tune a model on your wiki so it knows your data in its weights, not just in its context. And I think that's probably the next step.
So what can you build with this? Right?
This pattern applies to a lot of different domains. Research obviously
different domains. Research obviously going deep on the topic over weeks and months, reading papers, building up a comprehensive wiki with an evolving thesis. Personal, you can track your
thesis. Personal, you can track your goals, health, self-improvement. Uh you
can build a structured picture of yourself over time. Business certainly
um an internal wiki fed by Slack, meetings, customer calls, always current because the LM handles maintenance.
reading um filling each chapter of a book, building out character and theme pages and due diligence obviously. Uh today
we're going to build one with trading strategy strategies which is part of a larger project that I've been working on and you'll probably see a video in the coming weeks uh me breaking down this
project. But I've been doing a lot of
project. But I've been doing a lot of research on advanced trading strategies and that's the wiki we're going to build today.
So this is kind of the breakdown of what it's going to look like the directory structure and it's the same thing that we've said the raw sources the wiki itself and then the schema and workflows
in the clawed file claude because I'm going to be using this in claude code with uh opus 4.6. So what the LLM will
build it will be the strategy pages, the concept pages, the entity pages, cross referencing, links to everything, and then synthesis pages, comparisons,
trade-offs. Uh so it's time to build it.
trade-offs. Uh so it's time to build it.
I know you're all probably sick of sick of my slides. So now we're actually going to go in Claude Code and build this. Before we really get into it, if
this. Before we really get into it, if you enjoy this video or find it useful, please leave a like, please subscribe, or share it with your friends. It helps
a lot to grow the channel. And if you're feeling generous, please leave a tip as a thanks. It helps me keep making these.
a thanks. It helps me keep making these.
And of course, leave a comment. I read
and try to answer all the comments to the best of my ability. I really
appreciate all the kind words everyone said, and there are always a ton of really smart, insightful comments and questions that dig deeper into the content of the video. Now, let's get
back to it. I have given Claude a bunch of the tweets. Uh like I said this is the Karpathy tweet I've given some others uh some of the other users
who have done really well. Farza was one of them. Euchen here as well. Euchen Jin
of them. Euchen here as well. Euchen Jin
um had this really nice uh diagram that broke it down. So I fed this to Claude along with a couple other tweets people talking about how they did this. Okay.
So it's going to start out in plan mode.
Obviously, um, we were talking about this concept earlier, but I said, "Okay, design the plan to build this." So, it entered plan mode. It's exploring the documents I just showed you, and then
it's going to plan the architecture. So,
it finished up its plan here. You can
see it's building this LM wiki pattern.
Um, we're going to be doing it initially. I have eight transcript
initially. I have eight transcript files, longish videos um on trading concepts and then we can start from here and then build it out. Um it has some
concepts you could see here.
So it's going to create the directory structure, copy the transcript files as the raw sources. Um it's going to write the claw MD which is going to be the schema here that it's going to use. Uh
we're going to be using Obsidian style wiki links for everything.
create the wiki logs, seed the concept pages, you can see what uh we're working with right now, how granular it's going to get, market structure and liquidity,
strategy and execution, psychology. Uh
so it goes into like every general concept.
Um and you can decide how granular you want to get with this.
And then it's going to create the wiki index page.
Ingest all the raw. Okay, so it's got everything here. Yep, it looks like a
everything here. Yep, it looks like a good plan.
So it's going to start building for us.
Okay, it's building out the directories and the transcripts were copied. Now
it's writing the schema file seeding the concept pages.
Okay, the scaffolding is complete. You
can see the all the directories. The
next step is to ingest the eight raw transcripts.
Go ahead.
So it's running two agents right now to ingest the raw sources, create the summaries and then update the concept pages.
Okay, the initial ingest is done and now it's pretty much set up the original structure that we need. Just to
visualize it, Carpathy talks about using Obsidian as well as an ID. Uh but you can download this or just ask your agent to download it. It's a very light file.
Uh but this is what we get.
It's probably easier to see. Uh it's
basic file uh structure. You can see all the file here. This is the wiki
file here. This is the wiki has all of the knowledge that you were trying to b build up based on it.
You could see what we do here. Identity
shift protected stops. It has all the links. You can see the links to other
links. You can see the links to other files.
So you have a link to draw on liquidity here if you want to see this. So this is just a really nice clean visualization of this and you could build out a proper front end like this. I know people have
done that but for my purposes this is uh all I need just to kind of see the information.
Okay. So lastly let's try asking it some questions. Right. I asked can you
questions. Right. I asked can you explain drawn liquidity to me? and it
read the files based on it and gave me an answer without having to go do web searches and check everything else. Uh
it goes into the core idea of draw and liquidity, types of draws, qualifying and disqualifying draws, concrete examples, how it connects to everything
else.
So let me ask um how do draws on liquidity actually appear?
So it read as well. This is how it appears on the chart. Failure swings
and unfilled fair value gaps.
And then if I ask a question is there any other ways to identify them? Check
outside the wiki. If I ask any question based on this wiki information that it doesn't have on hand, it can then do a web search and then it will go and automatically backfill the wiki with the
new information that it found. So it
found several other drawing liquidity identification methods. Uh four of them,
identification methods. Uh four of them, five actually. Uh so using these
five actually. Uh so using these resources now it's going to continue to build out the wiki again.
And this is really how you develop the knowledge base. it kind of gets smarter
knowledge base. it kind of gets smarter on its own as you ask it questions and if there's information it can't find from the the wiki itself. It can do quick searches and then back fill it so
that it has all the answers later on.
And instead of just answering questions, you can also set it up to create markdown files, slideshows, uh which is a really useful presentation or mapplot lib images and then you can
all view them in Obsidian like that. So
there's a lot of ways you can customize it visually. So you can see based on the
it visually. So you can see based on the answer it's writing new concepts order blocks breaker blocks equal high lows so that once these concepts and information is inside the wiki you don't have to go
and fetch it every single time you ask about this these concepts again and I'm doing this with claude with opus 4.6 six. But like I said before, you can use
six. But like I said before, you can use any LLM to that does basic research and writing functions or any agent. You can
use open claw to do this or Hermes agent. So as Claude says here, this is
agent. So as Claude says here, this is exactly how the wiki is meant to grow.
You ask a question, I researched beyond the wiki and the new knowledge got filed back as permanent pages. So every future query count now reference order blocks, breaker blocks, equal high lows um along
with the original stuff. So this is how you really build it up and eventually over time you'd have a really massive knowledge base to work on. And now you can see in Obsidian it has breaker
blocks as a concept everything linked together very easy to understand related concepts and links to everything that you need. Right? So that was the
core concept from Karpathy. He talked
about this last week and you just saw us build this together. There's a lot of and the great thing is there's a lot of ways to customize this to exactly what you need and by doing that you can create a
really powerful knowledge base. So I
hope I hope you found this video helpful. We got to break down the
helpful. We got to break down the concept and then you got to see me build one and what didn't take that long. You
could probably do like this basic version in an hour or so and call it code and then customize it however you'd like from there. But that's going to be it for today's video.
Please leave a like, subscribe, leave a comment. Let me know how you're building
comment. Let me know how you're building your own knowledge bases or if you have any hints to do it better than I did here. We have a lot of great videos
here. We have a lot of great videos lined up for this week, so please look forward to that. Thank you for watching.
Loading video analysis...