A one-command installer for Andrej Karpathy's LLM-Powered Personal Knowledge Base workflow, adapted for Claude Code.
This repo creates a scaffolded directory tree + templated CLAUDE.md compile/lint rules + example wiki notes that together form a functioning Karpathy-style research knowledge base. You use it with Claude Code as the agent runtime and Obsidian as the viewer/frontend. There is no daemon, no server, no fancy UI — just a folder structure, a rule file, and an agent that knows how to read them.
The design is a minimal implementation of Karpathy (2026) — LLM Knowledge Bases. See examples/literature_note.md for the full 8-stage pipeline and UPGRADING.md for how to evolve the rules as your workflow matures.
bash(macOS / Linux — Windows via WSL)sed,awk,find,mkdir(standard on any Unix system)- Strongly recommended: Obsidian (the viewer), Claude Code (the agent)
- Optional for PDF ingest: uv + pymupdf (see setup step below)
git clone https://github.com/YOU/phd_kb_starter.git # or download the zip
cd phd_kb_starter
chmod +x install.sh
./install.sh # interactive, defaults to ~/knowledge_baseOr non-interactive:
./install.sh ~/Desktop/my_research_kbThe installer asks for:
- target directory
- vault name (used in Obsidian and
MAP.mdheader) - your name and role (used for
CLAUDE.mdcontext) - primary research language(s) — English, Chinese, or both
- primary research focus (optional, free text)
It then creates the directory tree, writes CLAUDE.md and MAP.md with your parameters substituted, copies example notes (disable with --no-examples), and prints a checklist of manual setup steps.
<target>/
├── CLAUDE.md # Compile/lint rules (the agent's "constitution")
├── MAP.md # Hand-written root index
├── 00_inbox/ # Raw material (never edit, only append)
│ ├── README.md
│ ├── papers/
│ ├── articles/
│ ├── clipper/
│ ├── repos/
│ ├── datasets/
│ ├── images/
│ └── quick_notes/
├── 01_literature_notes/ # Atomic notes, one per source
│ ├── papers/ # Academic (citable in formal writing)
│ ├── tweets/ # X/Twitter threads (context)
│ ├── news/ # Tech media, blog posts
│ └── social/ # LinkedIn, Reddit, HN
├── 02_topics/ # Survey-style topic aggregations
├── 03_methods/ # Econometric / ML methods
├── 04_variables/ # Constructs and their measurements
├── 05_mechanisms/ # Causal / theoretical mechanisms
├── 06_writing_templates/ # Output: paper drafts, slides, figures
├── 07_advisor_feedback/ # Comments + responses
├── 08_projects/ # Active research projects
├── 09_weekly_review/ # Lint reports
└── .tool_templates/ # Hidden: Zotero/Clipper templates, not in graph view
With --no-examples omitted, the installer also seeds:
01_literature_notes/tweets/Karpathy2026_llm-knowledge-bases.md— the canonical Karpathy tweet thread, as a complete example of what a well-written literature note looks like02_topics/llm_knowledge_base_workflow.md— a topic node linked to the example note
You can delete these once your own content arrives, or keep them as a permanent design reference.
The installer prints these as a checklist. Detailed instructions for each step are in docs/:
-
Open as Obsidian vault — docs/setup_obsidian.md
-
Configure Web Clipper — docs/setup_webclipper.md
-
Set Graph view filter — covered in Obsidian doc above
-
Configure Zotero for paper ingest — docs/setup_zotero.md
-
Install pymupdf for PDF extraction:
# if you have uv: uv tool install pymupdf # or with pip: pip install pymupdf
-
First compile: open the vault in Claude Code and say
compile inbox.
- See something interesting? Web-clip it (
⌥⇧O), drag a PDF in, or jot a quick_note. Zero evaluation, just capture.
- Tell Claude Code
compile inbox— it processes everything new since last run - Tell Claude Code
lint wiki— it generates a health report in09_weekly_review/ - Read the lint report (5 min) — note stubs to expand, gaps to ingest next week
- Open Obsidian Graph view (1 min) — visual check on structure
- Re-read
My synthesissections of your literature notes — has your thinking changed? - Update project READMEs in
08_projects/ - Ask Claude a "wiki audit" question: "wiki 现在的形状反映了我的研究焦点吗?"
- Before starting: ask wiki "what do I know about X?" — Claude answers from notes
- During writing: ask wiki to draft a section using specific literature nodes
- After: file the drafts into
06_writing_templates/; Karpathy's "self-improving loop"
These are in CLAUDE.md but worth repeating here since they shape everything:
- LLM writes the wiki, human reads it. You don't edit wiki files manually — you edit the rules (
CLAUDE.md), and the next compile applies them. MAP.mdis the retrieval layer, not RAG. The hand-curated index keeps the LLM oriented without vector search. Works up to ~100 articles on current context windows.- Never delete from
00_inbox/. Raw material is the source of truth. Downstream wiki notes can be rewritten freely, but source files are permanent. - Bidirectional backlinks. Every wiki link is mirrored in the target's
backlinks:frontmatter field. Lint catches missed pairs. - Citation-safe structure. Only
01_literature_notes/papers/contents are ever cited in formal academic writing. Tweets, news, and social are context.
- If you just want a full-featured research assistant, use Feynman — it's a proper CLI agent with built-in paper search, peer review simulation, and experiment replication. This starter is deliberately minimal and relies on you driving Claude Code manually.
- If you need real-time collaboration, this is single-user. Multiple contributors would need to coordinate edits out-of-band.
- If your workflow is already in Notion / Roam / Logseq and working, don't switch. The value here is the agent-writable markdown + CLAUDE.md rule layer, not the file format.
The workflow design is entirely Karpathy's (April 2026 X thread + llm-wiki gist). This starter is a minimal Claude-Code-shaped implementation of his description, with the addition of:
- Explicit sub-directory structure for source-type separation in
01_literature_notes/ - Hard citation-safety rule
- Auto-routing of clipper files by URL domain during compile
- Structured frontmatter schema with bidirectional backlinks enforced by lint
MIT. See LICENSE.