A personal knowledge base with an agent
Point an agent at a folder of notes and let it maintain a linked wiki that you can query. Andrej Karpathy popularized the shape of it.
Words on this page (5)
- agent
- : A model run in a loop that chooses its own tools and steps until the task is done.
- CLAUDE.md
- : A file at a repo root that Claude Code reads at the start of every session. AGENTS.md is the shared equivalent.
- context engineering
- : Deciding what goes into the model's context window, and when.
- attention
- : The mechanism that lets each token weigh all earlier tokens by relevance when computing its next representation.
- tool
- : A function the model can ask your program to run, described by a name, description and argument schema.
What it is
The setup has three parts. A raw folder holds source material such as articles, transcripts and PDFs. A wiki folder holds pages the writes from them, linked to each other. A control file such as tells the agent the rules: how to ingest a source, how to name and link pages, how to answer questions from the wiki. You drop a document into raw, say "ingest this", and the agent updates the relevant pages. Later you ask questions against the wiki instead of starting from an empty context.
Why it works and where it breaks
It is applied to your own notes. The agent compiles knowledge once, so later queries read a small structured wiki instead of the raw pile. The weak spot is drift: a summarizer can introduce errors that then get cited as fact. Keep raw sources, link claims back to them, and spot-check pages. Obsidian is a convenient viewer because it renders the links as a graph, but any folder of markdown works.
A worked example: the folder layout
raw/ holds the originals: pdfs, transcripts, saved pages. wiki/ holds pages the agent writes: one per topic, with links like [[transformers]]. A rules file says: when ingesting, create or update pages, add the source name and date, never delete raw files. Query: "Summarize what we know about , and cite sources."
Keeping it trustworthy
Summaries can drift from their sources. Keep the raw files, require sources on every claim, and open a few pages a week to compare against the originals.
How the compile step works
Think of it like building notes from a pile of readings. When you ingest a source, the agent reads it, finds the topics it covers, and then edits the matching wiki pages or creates new ones. It adds links between related pages and records where each claim came from. Later, a question is answered from the wiki pages, which are short, instead of from the full sources. That saves effort and gives a consistent view across documents.
A second example: when a wiki is the wrong tool
You have three short articles and want an answer about one detail. Building a wiki is overkill. Paste the articles into a chat and ask. The wiki is worth it when the material is large, grows over time, or you will return to it for months. A wiki is also a poor fit for exact lookups, such as the precise wording of a contract clause, because a summary can change the wording. For those, search the raw file.
Trade-offs
Compiling saves reading time but puts a layer between you and the source. Each summary is a chance for error. Updating also costs usage each time you ingest. A looser setup, a folder of raw files that the agent searches when asked, has less upkeep and less drift, but each question is slower and may miss links between documents.
What goes wrong
Look for pages that cite no source, two pages that disagree, and old pages that new material should have changed but did not. A wrong claim can spread, since new pages build on old ones. To check, pick a random page, open the source it names, and compare the claim. Also run a question you know the answer to and see whether the wiki gets it right.
Try it yourself
Make a raw folder with three short articles on one topic, and a rules file.
- Ask the agent to ingest them.
- Open each page and check one claim against its source.
- Ask a question that needs two articles.
Expect good answers, plus at least one small error or missing link to fix.
Common mistake
Trusting the wiki without ever checking it against the raw sources.
You read fifty articles about a topic and forget most of them. Someone set up a folder where each new article is dropped in and an assistant updates a small wiki: a page per concept, linked to the others, with sources noted. A month later they can ask "what do we know about X and where did it come from?" and get a real answer.
Check yourself
Why keep the raw sources next to the wiki?
Not quite. Summaries can drift. Raw sources let you verify what a page claims.
What does the control file do?
Not quite. It is the harness for the system: the rules the agent follows each session.
After a month, a wiki page states a fact that no source supports. What likely happened?
Not quite. Compiled summaries can introduce errors, which is why sources and spot-checks matter.
You got 0 of 3 right.
Go deeper
- ToolObsidianTool
Obsidian · Local-first markdown notes with a graph view, a common front end for this pattern.
- ArticleContext engineeringArticle
Simon Willison · The general principle the wiki pattern applies to personal notes.
- Repo
Mem0 · A memory layer for agents if you want a library instead of plain files.
Spotted a mistake or something unclear? Report it on GitHub.