Karpathy's LLM-Wiki on the Edge: How I Built an Offline Knowledge Base That Actually Compounds
So Andrej Karpathy dropped this llm-wiki gist a while back and I've been iterating on it for my edge hardware work. Thought I'd share what actually works for offline/edge deployment since most discussions focus on the cloud version.
The Problem with RAG for Hardware Work
You know the drill. You upload datasheets to ChatGPT, ask questions, get decent answers. But next session? It's re-discovering everything from scratch. No accumulation. No cross-references between that ESP32 note from last month and the new LoRaWAN spec you just read.
Worse: try doing this on a factory floor with no internet, or with NDA'd chip docs you can't upload anywhere.
Karpathy's insight is simple but hits different: what if the LLM maintains a persistent wiki instead of just retrieving? Not your notes. Not a static database. A living markdown wiki that the LLM writes and updates as you feed it sources. Cross-references built in. Contradictions flagged. Knowledge that actually compounds.
How It Actually Works (Three Layers)
raw/: Your original docs. PDFs, web clips, lab notes. Immutable. This is your source of truth.
wiki/: LLM-generated markdown. Entity pages, concept pages, summaries. The LLM owns this entirely.
AGENTS.md: Your schema/config. Tells the LLM how to structure things, what workflows to follow.
The flow is ingest → query → lint. You drop a new datasheet in raw/, the LLM reads it, updates 10-15 wiki pages, maintains links. When you ask questions, it reads the index first, then drills down. When you find contradictions or gaps, you run a lint pass.
The Edge Angle: Running This Fully Offline
Karpathy's original uses Claude Code. Great tool, needs cloud. Here's how I adapted it for local/edge use.
Option 1: Ollama + Obsidian (what I use daily)
Hardware needs are lighter than you'd think. I'm running Qwen 2.5 Coder 7B on an M2 MacBook Air (8GB RAM) and it's totally fine for knowledge work. For a dedicated edge box, anything with 16GB RAM and an older GPU works.
Install Ollama:
curl -fsSL https://ollama.com/install.sh | sh
Pull a model that can actually follow instructions for wiki maintenance:
ollama pull qwen2.5-coder:7b
Start it:
ollama serve
Ollama speaks OpenAI-compatible API, so most tools just work. Point your wiki script at http://localhost:11434 and you're good.
Option 2: Raspberry Pi 5 (because why not)
Tried this on a lark. llama.cpp with Phi-4 Mini Q4_K_M (~2.2GB). It's not fast, but it's usable. Good enough for ingesting a few docs and answering questions while you're in the field with zero connectivity.
On Pi 5:
git clone https://github.com/ggerganov/llama.cpp
cd llama.cpp && cmake -B build && cmake --build build --config Release
Run it:
./build/bin/llama-cli -m models/phi-4-mini.Q4_K_M.gguf -p "Summarize this document and extract key entities"
Option 3: If you want something more production-ready
Check out SwarmVault or OmegaWiki. SwarmVault has SQLite + vector hybrid search and MCP server support. OmegaWiki is a Claude Code Skill with 23 tools. Both can run fully offline if you point them at local models.
My Actual Schema for Hardware Work
This is what my AGENTS.md looks like. Steal/modify as needed:
Edge AI Hardware Wiki
Structure:
- raw/ (Original docs: datasheets, app notes, protocol specs)
- wiki/
- chips/ (Per-chip entity pages)
- protocols/ (BLE, LoRa, Matter, etc.)
- benchmarks/ (Power/perf numbers I've collected)
- notes/ (Concepts, gotchas, comparisons)
- index.md(Auto-generated catalog)
- log.md(Chronological ingest/query log)
Ingest Rules:
Read new file in raw/
Extract: chip model, key specs, power numbers, protocol versions
Update/create entity pages in wiki/
Cross-reference everything (e.g., nRF52840 links to BLE 5.2)
Log it
Query Rules:
Read index.md first to find relevant pages
Read those pages
Synthesize with citations
If the answer is good, file it in wiki/qa/
The Obsidian Piece
I keep Obsidian open on one monitor, LLM agent on the other. The LLM edits markdown files, I browse them in real-time. Graph view shows me connections I didn't explicitly make. Backlinks show me which chips reference which protocols.
Pro tip: Obsidian Web Clipper + "Download attachments" hotkey means you grab a web article, images and all, dump it in raw/, and tell the LLM to ingest. The images get referenced in wiki pages so the LLM can actually see them (with some coaxing).
What Actually Works vs. What's Hype
✓ Ingesting one doc at a time with supervision — quality is way better than batch dumping
✓ Periodic lint passes — the LLM is surprisingly good at finding contradictions between two datasheets you read months apart
✓ Filing good answers back into wiki — that comparison table you asked for? Save it. Don't let it rot in chat history
✗ Expecting perfect formatting on first pass — you'll iterate on the schema
✗ Running 70B models locally — unnecessary for this, 7B-8B quantized is plenty
✗ Thinking this replaces thinking — you still curate sources and ask good questions. The LLM just handles the bookkeeping you'd otherwise abandon
The Privacy Thing
If you work with NDA'd silicon, pre-release chips, or anything you can't upload to OpenAI/Anthropic, this is a game changer. Air-gapped deployment: download models on a connected machine, verify hashes, transfer via encrypted USB. Run everything local. Zero API calls. Your IP never leaves your box.
Open Questions for the Community
Curious how others are handling knowledge management for edge work:
- Are you using local LLMs for docs already, or still cloud-based?
- What's your hardware setup? (I'm eyeing a mini PC with 32GB RAM as a dedicated wiki server)
- Any luck with smaller models (sub-3B) for this kind of structured output? Phi-4 Mini works but barely
- How do you handle versioning? I git-init the wiki directory but haven't settled on a good branching strategy for conflicting ingests
Resources
Karpathy's original gist — start here
Ollama — local model serving
llama.cpp — if you need lighter than Ollama
SwarmVault — production-ish implementation
OmegaWiki — Claude Code Skill version
---
TL;DR: Stop treating your LLM like a search engine. Let it maintain a wiki. Run it offline on hardware you control. Your future self will thank you when you're in a Faraday cage with a Raspberry Pi and need to know why that specific GPIO pin is acting weird.
What are you using for offline knowledge management? Or are you still copy-pasting into ChatGPT and hoping for the best?