This is the recipe I actually used to build this repo, github.com/stroops/stroops-wiki.
It is not theory. Every step here is something I ran with an AI coding CLI (Claude Code) while
building this from an empty folder.
The whole thing rests on one bet: the expensive part of a knowledge base was never the reading or the thinking. It is the bookkeeping. Summaries, back-links, an index that stays accurate, a changelog. That is the work that makes people abandon their notes. Handing it to the agent makes it cheap enough that you might actually keep doing it. It does not maintain itself; you still have to keep running the loop.
Three layers, with hard boundaries between them:
raw/is immutable. The sources you feed it. The agent reads these and never edits them.wiki/is agent-owned. Everything generated: source summaries, entity pages, concept pages, overviews. You read here; the agent writes here.AGENTS.mdis the schema. The rules the agent follows.CLAUDE.mdandGEMINI.mdare thin pointers to it, so every tool loads the same context.
Two flat files at the root do the navigation: index.md (the map) and log.md (append-only
history). A future session with zero memory of this one re-orients from those two files quickly.
The structure comes from Karpathy's LLM Wiki gist. Do not copy it by hand. Have Claude read it and lay down the skeleton.
mkdir my-wiki && cd my-wiki
claudeRead Andrej Karpathy's LLM Wiki pattern from this gist:
https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f. Scaffold the full directory structure with anindex.md, alog.md, and page templates. Two modifications: name the templates folder_templates(leading underscore so it sorts to the top), and put the generated wiki pages under awiki/folder with subfolderssources,entities,concepts,overviews, andprojects. For the rulebook, write anAGENTS.mdas the single, tool-agnostic source of truth, plus thinCLAUDE.mdandGEMINI.mdpointers that just import it.
AGENTS.md is the canonical rulebook from minute one. CLAUDE.md and GEMINI.md shrink to three
lines that import it, and the tools that read AGENTS.md natively (Codex, Cursor's agent, Copilot,
Antigravity) need no file at all. Write context once, deliver it everywhere.
Why _templates and not templates: the underscore sorts it above content and reads as "meta, not
a topic." A small thing that you will appreciate once the vault has 50 pages.
git init && git add -A && git commit -m "feat: Initialize second-brain wiki"
git remote add origin git@github.com:you/your-wiki.git
git push -u origin mainEvery ingest from here on is a normal commit. One gotcha worth calling out: if your repo enforces a commit-message convention (a hook requiring Conventional Commit subjects, no stray trailers), the agent's default messages may get rejected. Do not fight the hook. Tell the agent the format once and move on.
This is the operation you will run most. Point the agent at a source and let it fan out.
Ingest
<path-or-URL>. Read it fully, tell me the key takeaways first, then file it: write a source summary underwiki/sources/, create or update the entity and concept pages for anything notable (wikilinks both directions), then updateindex.mdand append an entry tolog.md.
Under the hood the agent runs a fixed checklist: read, summarize, refresh entities and concepts, link both ways, update the index, append to the log. One source can produce a whole set of linked files at once (see the concrete count in the next section). That fan-out is the whole point: it is the bookkeeping you are not doing by hand.
For real-world sources (an article, a doc, a thread you want to keep), the cleanest capture is the
Obsidian Web Clipper browser extension: it saves the page as clean
markdown straight into raw/, and then you run the ingest prompt on the saved file. Anything durable
is worth clipping; skip the volatile stuff.
This is the case this repo was built for: you already have a project, and you want a durable mental model of it that does not go stale on every commit. The trap is trying to make the wiki mirror the code. Split by rate of change instead:
- The code is the source of truth for how it works right now. Read it on demand. Never copy it into the wiki.
- The wiki holds what changes per decision, not per commit: the architecture, the domain model, the key decisions and their rationale, the glossary.
- Ingest docs, specs, and design decisions, not source files. Skip volatile backlogs.
- Re-ingest on drift, not on a schedule. When a decision changes, update the affected page, bump
updated:, append to the log.
Ingest the docs and specs from my repo at
<path>. Read them, then file the durable knowledge: architecture, the domain model, and the key decisions with their rationale. Do not mirror the source code; treat the codebase as read-on-demand and just link to the relevant paths.
The [[sloop]] pages in this repo were built exactly this way, from its README, docs/, and design
notes: six source summaries, seven concept pages, an entity page for tmux, and the hub, all
cross-linked, with the repo itself left as the source of truth for current behavior.
When a newer, more authoritative source disagrees with something already in the wiki, do not silently replace it. Recording what changed and why is a first-class job of the wiki.
This newer doc contradicts what we filed earlier. Rewrite the affected pages to the authoritative version, and leave a short reconciliation note on each: what the old claim was, what is correct now, and which source superseded it.
This is what keeps the wiki trustworthy over months instead of quietly accumulating stale claims.
Run this every so often. It is the immune system.
Lint the wiki: find contradictions, stale claims, orphan pages (no inbound links), broken links and unfilled stubs, coverage gaps, and structured data that should become a table. Also flag any secret or credential pasted into a page, and any personal or local machine path that should not be committed. Fix what is safe and append a lint entry to the log.
The secret-and-credential check is the one you never want to skip. Everything else is hygiene; that one is safety.
Scaffold the three layers, then ingest sources (summary plus concepts plus links plus index plus log), then lint now and then. Keep all context in one
AGENTS.mdthat every tool reads, and re-ingest on drift, never on a schedule.
No single prompt is the trick. What makes it work is that the agent absorbs the bookkeeping cost on every operation, so keeping the wiki current is cheap enough to be realistic. It still only stays current if you keep running the loop.
- Do not over-model frontmatter on day one.
type,title, and dates are enough. Add fields when a query actually needs them. - Do not ingest volatile docs (sprint plans, TODO dumps). They age badly and drown the signal.
- Do not reach for vector search early. A plain
index.mdhas been fine for me at this size; I have not pushed it far enough to know where it breaks, so I would not add search infrastructure until you actually feel the pain.