# Stop letting Claude Code forget your project overnight
**作者**: shmidt
**日期**: 2026-04-02T20:42:21.000Z
**来源**: [https://x.com/shmidtqq/status/2045885953412149505](https://x.com/shmidtqq/status/2045885953412149505)
---

You open Claude Code in the morning. It doesn't know your project.
It scans files. Re-reads folders. Asks the same questions as yesterday.
5–10 minutes and thousands of tokens, just to remember what it knew 24 hours ago.
Andrej Karpathy (former director of AI at Tesla, OpenAI co-founder) posted the fix. No vector DBs. No RAG. No subscriptions.
One folder. Markdown files. The entire project memory.
The gist hit 5,000+ stars and 4,400+ forks and the comments turned into a real debate about where this breaks.
> Why CLAUDE.md alone doesn't cut it
It's a fridge sticky-note. 10 static lines you update by hand.
In a month you accumulate dozens of decisions, bugs, architectural forks. A sticky-note can't hold that. And if you cram it in, you won't find anything later.
You need a wiki that grows itself.
## Karpathy's idea in 4 steps (compiler analogy)

Raw = source code.
raw/ folder holds the raw material: PDFs, articles, transcripts, notes. Drop it in untouched. This layer is immutable, the LLM reads it but never modifies it. It's your source of truth.
LLM = compiler.
Claude turns raw into wiki: summaries, concepts, backlinks between pages. The part that's easy to miss: when you add a new source, the wiki doesn't just get appended to, it gets recompiled. A single article can touch 10–15 existing pages: updating entity pages, revising concept summaries, flagging contradictions with what came before.
Wiki = executable.
wiki/ folder with index.md as the entry point. The agent reads the index first and navigates the rest like a human follows a table of contents.
Linting = tests.
LLM audits the wiki for broken links, orphans, stale content, unprocessed raw.
The core shift Karpathy is pointing at is RAG vs persistent wiki. In RAG, the model re-discovers knowledge on every query, nothing accumulates. The wiki is a persistent, compounding artifact: cross-references are already there, contradictions are already flagged, the synthesis already reflects everything you've read.
## The folder structure
log.md is not a git-style changelog. It's an append-only record of what the LLM did, ingests, queries, lint passes. Karpathy suggests the format ## [2026-04-17] ingest | Article Title so you can grep the last N entries with one shell command.
No databases. No embeddings. Just folders and .md files.
## Basic setup in 5 minutes
> 1. Download Obsidian from obsidian.md → create a vault for the project
- https://obsidian.md/
> 2. Open the folder in VS Code, launch Claude Code in the terminal.
> 3. Send Claude the Karpathy prompt, it scaffolds raw/, wiki/, index.md, CLAUDE.md in one shot.
- https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f
> 4. Install Obsidian Web Clipper for Chrome. In the template settings, change the save path to raw/.
- https://obsidian.md/clipper

> 5. In Obsidian → Settings → Community Plugins → install Local Images Plus → toggle it ON. Without it the clipper saves image links, not the actual images.

Done. Click "Add to Obsidian" on any article → tell Claude "process raw" → minutes later you have a wiki.
## The killer move: use the wiki from OTHER projects
In any other project's CLAUDE.md, point to this wiki's path. Now every project you own can read the shared knowledge base. Build it once, reuse everywhere.
One gotcha: paths. Use a location that exists for all your projects (e.g. ~/knowledge/wiki/), or a symlink into a shared folder. One line in CLAUDE.md is enough: "Before answering, read index.md from ~/knowledge/wiki/ for shared context".
## Advanced: automate it with hooks
The basic setup has one flaw: you maintain the wiki by hand. Forget to log a decision → it's gone.
- https://github.com/coleam00/claude-memory-compiler
Three hooks do it for you:
> 🟢 session-start: the "remember" hook.
On launch, reads index.md + the latest daily log and injects them into context. Claude opens already briefed.
> 🔴 session-end: the "record" hook.
When you close a session, the hook grabs the last 30 messages → Claude Agent SDK summarizes them → appends to today's daily-log. You don't lift a finger.
> 🟡 pre-compact: the "safety net" hook.
When context fills up, Claude Code auto-compresses history and drops details. This hook captures messages BEFORE compression. Without it, long sessions lose their beginnings forever.
One thing to know about cost:
the hooks use the Claude Agent SDK. Anthropic has clarified that for personal use this is covered under existing Claude Max, Team, or Enterprise subscriptions, no separate API credits needed. If you're on Pro or free, check before installing so you don't get a billing surprise.
To install:
## Three scripts on top of the hooks
> compile: runs in the evening, turns daily-logs into full wiki entries, extracts concepts, updates the index.
> query: ask the wiki straight from the terminal, no Claude Code needed. One command, one answer.
> lint: exactly what Karpathy asked for. Audits wiki health: broken links, orphan pages, logs that never made it to the wiki, stale entries, missing backlinks, empty stubs (<200 words), contradictions between articles.
## Wiki vs RAG: when to use what
This is the question people keep asking in the gist comments, and the answer is more concrete than "solo dev → markdown".
The threshold is around ~2,000 articles. Below that, an LLM reading a structured index.md beats vector similarity on quality, it understands what you're actually asking, while cosine similarity just finds similar-looking words. Above ~2,000, the index stops fitting in the context window and RAG becomes necessary.
Karpathy runs his own setup at ~100 sources and hundreds of pages, he says directly that plain markdown navigates just fine at that scale. Don't pre-optimize. Start with a folder. Hit the ceiling, then move to vectors.
## What actually changes
Without wiki: Claude reads git log, spawns sub-agents, scans the whole project. Slow. With wiki: reads the index, finds the right page, answers. Fast.
I won't quote exact numbers, it depends on your project size and how disciplined you are about feeding raw/. But the order of magnitude is real: you pay tokens for the index once, not for a full project scan every session.
One prompt. One folder. Three hooks if you want it hands-free.
It won't replace RAG in production and it won't fix a messy team setup. But for a personal research flow, it's the kind of thing you don't want to roll back from.
Bookmark this 🔖
If this saved you tokens, repost so fewer people waste them.
tg channel: https://t.me/+JmDeelv5UCwwMTcy
## 相关链接
- [shmidt](https://x.com/shmidtqq)
- [@shmidtqq](https://x.com/shmidtqq)
- [150K](https://x.com/shmidtqq/status/2045885953412149505/analytics)
- [Apr 3](https://x.com/karpathy/status/2039805659525644595)
- [20M](https://x.com/karpathy/status/2039805659525644595/analytics)
- [https://obsidian.md/](https://obsidian.md/)
- [https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f)
- [https://obsidian.md/clipper](https://obsidian.md/clipper)
- [https://github.com/coleam00/claude-memory-compiler](https://github.com/coleam00/claude-memory-compiler)
- [https://t.me/+JmDeelv5UCwwMTcy](https://t.me/+JmDeelv5UCwwMTcy)
- [Upgrade to Premium](https://x.com/i/premium_sign_up)
- [11:23 PM · Apr 19, 2026](https://x.com/shmidtqq/status/2045885953412149505)
- [150.6K Views](https://x.com/shmidtqq/status/2045885953412149505/analytics)
- [View quotes](https://x.com/shmidtqq/status/2045885953412149505/quotes)
---
*导出时间: 2026/4/20 23:33:19*