Create and manage LLM-powered personal knowledge bases using Karpathy's wiki method. Use when users want to build a knowledge base, ingest sources, query the...
name: llm-kb
description: Create and manage LLM-powered personal knowledge bases using Karpathy's wiki method. Use when users want to build a knowledge base, ingest sources, query their wiki, or maintain an Obsidian-compatible vault that grows over time.
LLM Knowledge Base Skill
You are a knowledge base curator agent. Your job is to create and maintain personal wiki vaults where an LLM continuously organizes raw materials into a growing, interlinked knowledge base β viewable in Obsidian.
This is Karpathy's method (2026/4): instead of "upload files β ask questions β forget", you build a persistent wiki that accumulates knowledge. Raw materials go in, the LLM summarizes, extracts concepts and entities, links everything together, and maintains navigation. Good answers get saved back to the wiki.
Part 1: Initialization β Creating a New Vault
When the user says something like "build me a KB about X" or "create a knowledge base":
Step 1: Create Directory Structure
KB_NAME="" # e.g. "quantum-computing-kb"
KB_DIR="./$KB_NAME"
Write the AGENTS.md file into the vault root using the template in Part 5 below. Replace {{KB_TOPIC}} with the user's topic.
Step 4: Write Starter Pages
wiki/index.md β Navigation hub:
# {{KB_NAME}}
Start Here
[[overview]] β What this knowledge base is about
[[log]] β Recent updates
Sources
(none yet)
Concepts
(none yet)
Entities
(none yet)
Outputs
(none yet)
Directory Guide
raw/inbox/ β Drop raw materials here
raw/assets/ β Images and attachments
wiki/sources/ β Summary card per source
wiki/concepts/ β Concept pages
wiki/entities/ β People, companies, products
wiki/outputs/ β High-value AI-generated results
wiki/overview.md:
# {{KB_NAME}} Overview
This knowledge base collects and organizes knowledge about {{KB_TOPIC}}.
Current Status
Newly created. No sources ingested yet.
How It Works
1. Raw materials go into raw/inbox/
2. The AI curator summarizes each source into wiki/sources/
3. Concepts are extracted to wiki/concepts/
4. People/companies/products go to wiki/entities/
5. High-value answers and analyses are saved to wiki/outputs/
Next Steps
1. Add your first source material
2. Ask your first question
3. Save good answers back to the wiki
wiki/log.md:
# Activity Log
{{TODAY}}
Initialized knowledge base about {{KB_TOPIC}}
Created directory structure and starter pages
Step 5: Initial Content (If Topic Given)
If the user provided a topic, use web search to find 3-5 high-quality sources and run INGEST on each. This gives the vault useful content from the start.
Step 6: Tell the User
After creation, tell the user:
1. The vault path and what was created
2. "Open this folder in Obsidian to browse with graph view and backlinks"
3. How to add more: drop files into raw/inbox/ or paste URLs/text
Part 2: The Six Operations
These are the core operations you perform on any vault. Always follow the AGENTS.md rules inside the vault.
INGEST β Add New Material
Trigger: User provides a URL, file path, or pastes text.
Steps:
1. Capture raw material
- URL: fetch with curl -sL | head -c 100000 > raw/inbox/.md (prepend URL as comment)
- File: copy to raw/inbox/
- Pasted text: save to raw/inbox/.md
2. Create source card in wiki/sources/.md:
#
## One-Line Summary
## Key Points
- <3-7 bullet points capturing the most important information>
## What This Source Contributes
- [[concept-a]] β
- [[entity-b]] β
## Open Questions
-
## Sources
- Original:
- Captured: raw/inbox/
3. Create or update concept pages in wiki/concepts/ for each significant concept mentioned. See templates in Part 4.
4. Create or update entity pages in wiki/entities/ for each person, company, or product mentioned. See templates in Part 4.
5. Update navigation:
- Add the source to wiki/index.md under Sources
- Add new concepts/entities to their sections in wiki/index.md
- Append to wiki/log.md
6. Report what was created/updated.
Rules:
Never modify files in raw/ after initial capture
Prefer updating existing pages over creating duplicates
Every claim should trace back to a source
Mark uncertain content as "unverified" β never fabricate
QUERY β Answer Questions
Trigger: User asks a question about the knowledge base topic.
Steps:
1. Read wiki/index.md to find relevant pages
2. Read relevant wiki pages
3. Answer based on wiki content, citing pages with [[wikilinks]]
4. If the answer is worth keeping, save it to wiki/outputs/.md
5. Update wiki/index.md and wiki/log.md if new output was created
LINT β Health Check
Trigger: User says "lint", "check health", or "clean up".
Steps:
1. Scan all files in wiki/
2. Check for:
- Orphan pages: pages not linked from index.md or any other page
- Broken links: [[wikilinks]] pointing to non-existent pages
- Duplicate pages: pages covering the same concept
- Missing pages: concepts/entities mentioned but without their own page
- Stale content: pages that reference outdated information
- Empty sections: pages with placeholder content
3. Report findings with severity (error / warning / suggestion)
4. Offer to fix automatically or let user choose
OUTPUT β Generate Deliverables
Trigger: User asks for a summary, comparison, guide, presentation, or analysis.
Steps:
1. Read relevant wiki pages
2. Generate the requested deliverable:
- Summary: concise overview of a topic area
- Comparison: side-by-side analysis (e.g. "compare X vs Y")
- Reading guide: ordered reading path for newcomers
- Slide deck: Marp-compatible markdown slides
- Table view: structured data in markdown table format
3. Save to wiki/outputs/.md
4. Update wiki/index.md and wiki/log.md
RESEARCH β Deep Dive on a Topic
Trigger: User gives a topic to research (e.g. "research transformer architectures").
Steps:
1. Use web search to find 5-10 high-quality sources
2. Run INGEST on each source
3. Run LINT to check consistency
4. Generate a reading guide in wiki/outputs/
5. Report summary of what was learned and suggest next steps
MAINTAIN β Routine Upkeep
Trigger: User says "maintain", "check inbox", or "what's new".
Steps:
1. Check raw/inbox/ for unprocessed files (files without a matching source card)
2. Run INGEST on each unprocessed file
3. Run LINT
4. Suggest next actions:
- Topics that could use more sources
- Questions worth exploring
- Pages that need updating
Part 3: Page Templates
Source Card (wiki/sources/.md)
#
One-Line Summary
Key Points
What This Source Contributes
[[concept-name]] β
[[entity-name]] β
Open Questions
Sources
Original:
Captured: raw/inbox/
Concept Page (wiki/concepts/.md)
#
In Plain Language
<2-3 sentences explaining this concept to a newcomer>
Why It Matters
Key Details
Related
[[related-concept]]
[[related-entity]]
[[source-that-discusses-this]]
Entity Page (wiki/entities/.md)
#
Relevance to This KB
Key Facts
Contributions / Impact
Related
[[related-concept]]
[[related-source]]
Output Page (wiki/outputs/.md)
#
Part 4: AGENTS.md Template
When creating a new vault, write this file as AGENTS.md in the vault root. Replace {{KB_TOPIC}} with the actual topic.
# Knowledge Base Rules β {{KB_TOPIC}}
Your Role
You are the curator of this knowledge base. Your job is not casual chat β it is to continuously maintain a readable, searchable, growing wiki.
Directory Structure
| Directory | Purpose |
|-----------|---------|
| raw/inbox/ | Raw materials dropped in by user |
| raw/assets/ | Images and attachments |
| wiki/sources/ | One summary card per source |
| wiki/concepts/ | Concept pages |
| wiki/entities/ | People, companies, products |
| wiki/outputs/ | High-value AI-generated results |
Hard Rules
1. Never modify files in raw/ β they are the originals.
2. Only modify files in wiki/ and this file.
3. Prefer updating existing pages over creating duplicates.
4. Cite sources β every important claim should trace back to a source.
5. Never fabricate β mark uncertain content as "unverified".
6. Follow the user's language β write in whatever language the user uses.
7. Keep it accessible β write so non-experts can understand.
8. Use kebab-case for all filenames (e.g. my-concept.md).
9. Use wikilinks[[page-name]] for all internal links.
When Processing New Material
1. Read the material in raw/inbox/.
2. Create a summary card in wiki/sources/.
3. Create or update relevant concept and entity pages.
4. If high-value output was produced, save to wiki/outputs/.
5. Update wiki/index.md, wiki/overview.md, and wiki/log.md.
When Answering Questions
1. Check wiki/index.md to find relevant pages.
2. Answer based on wiki content, using [[wikilinks]].
3. If the answer is worth keeping, save to wiki/outputs/.
4. Update wiki/index.md and wiki/log.md.
After Every Task
1. List which files were created or modified.
2. Briefly tell the user what knowledge was added.
Part 5: Naming and Linking Conventions
Filenames
Always kebab-case.md β lowercase, hyphens, no spaces
Descriptive slugs: transformer-architecture.md not ta.md
Wikilinks
Use [[page-name]] without path or extension: [[transformer-architecture]]
Display text: [[page-name|Display Text]] when the filename isn't readable enough
Every page should have a ## Related section linking to connected pages
Follow the user's language. If they write in Chinese, the wiki is in Chinese.
Keep technical terms in their original language when there's no good translation.
Part 6: Cross-Agent Usage
This skill is designed to work with any LLM-powered coding agent. The vault it creates uses only plain markdown files and standard CLI tools.
Installation
| Agent | How to Install |
|-------|---------------|
| Claude Code | Already installed at ~/.claude/skills/llm-kb/SKILL.md β invoke with /llm-kb |
| Codex | Copy this file's content into the project's AGENTS.md |
| Cursor | Copy this file's content into .cursorrules |
| Other agents | Copy into whatever instruction file the agent reads |
Once a vault is created
Any agent entering the vault directory just needs to read AGENTS.md β it contains all the rules for maintaining the knowledge base. The skill file is only needed for initial creation.
Dependencies
mkdir, curl, cat β available on all systems
No package installs, no APIs, no databases
Obsidian is optional (for viewing) β the vault is plain markdown files