llm-wiki
Maintain a wiki the LLM owns and the human curates. Three layers, three operations.
| Layer |
Who owns it |
Rule |
| Raw sources |
human |
read-only, never edited or moved by this skill |
| Wiki |
this skill |
interlinked Markdown pages + MEMORY.md-style index |
| Schema |
this skill |
WIKI.md in the wiki root — conventions, written on init |
Human curates sources, directs analysis, asks questions. Skill does the bookkeeping.
Quick start
/llm-wiki ingest <path-to-source> # file a document into the wiki
/llm-wiki query <question> # answer from the wiki, with citations
/llm-wiki lint # contradictions, stale claims, broken links
Path resolution
Resolve before any read or write:
- Check memory for a
reference entry naming the wiki root (name/description containing llm-wiki or wiki root).
- If found, use it.
- If not, ask: "Where should the wiki live? (absolute path to a folder — I'll create it if missing.)" Offer the three common answers: a fresh folder, this repo's
docs/, or the existing memory directory.
- Save a
reference memory entry so future runs don't re-prompt, and add its one-line pointer to MEMORY.md.
- If the folder has no
WIKI.md, this is a fresh wiki — write the schema (see below) before anything else. Never create silently.
Page format
One idea per page. Match an existing wiki's conventions if pages are already there; otherwise:
---
name: <kebab-case-slug> # must equal the filename without .md
description: <one line, <1024 chars — used for retrieval>
type: entity | concept | source-summary | analysis
sources: [<source-file-or-url>, ...]
updated: YYYY-MM-DD
---
<body — link related pages with [[slug]]>
Links use [[slug]] where slug is the filename without .md. A link to a page that
doesn't exist yet is fine — it marks work to do. Every page gets one index line.
Operations
ingest <source>
- Read the source in full. Never edit, move, or rewrite it.
- Report takeaways and say which pages you intend to touch. Wait for confirmation.
- Write a
source-summary page for the source itself, then create or amend every entity/concept page it affects. One source commonly touches 5–15 pages — that fan-out is the point.
- When new material contradicts an existing page, do not silently overwrite: keep both claims, mark the older one superseded with its date, and say so in the report.
- Add index lines for new pages. Append one line to
LOG.md: date, source, pages touched.
query <question>
- Search page descriptions first, then bodies. Read whole pages, not fragments.
- Answer with citations to page slugs. Say plainly when the wiki doesn't cover it — never fill the gap from general knowledge without labelling it as outside the wiki.
- If the answer was worth assembling, offer to file it back as an
analysis page. That is how the wiki compounds.
lint
- Run
scripts/lint.mjs <wiki-root> for the deterministic checks (broken links, orphans, index drift, frontmatter gaps, oversized descriptions, stale pages).
- Then do the part a script can't: read the pages and hunt contradictions — two pages asserting different values for the same fact, superseded numbers still stated as current, claims whose source has since changed.
- Report findings ranked by whether they would produce a wrong answer. Propose fixes; apply only on confirmation.
Contradictions are the payload. Link hygiene is housekeeping — report it, don't lead with it.
Schema file
On init, write WIKI.md to the wiki root recording: the page format above, the link
convention, the index file name, and what counts as a raw source for this wiki. Read it
on every subsequent run and follow it over the defaults here — the wiki's own conventions win.
Rules
- Never edit raw sources. Ever.
- Never write without showing the plan first.
- Prefer amending an existing page to creating a near-duplicate; check the index before creating.
- No time-sensitive claims without a date attached.
1---2name: llm-wiki3description: Build and maintain an LLM-maintained wiki — a persistent, interlinked Markdown knowledge base distilled from curated raw sources (Karpathy's LLM Wiki pattern). Three operations: ingest (read a source, write and update pages, log it), query (answer from the wiki with citations, file good answers back), lint (contradictions, stale claims, broken links, orphans). Path-agnostic: the user picks where the wiki lives, the skill remembers it. Works on a fresh directory, a repo's docs/, or an existing memory directory. Use when the user wants to file a document or incident writeup into their knowledge base, asks what their notes say about a topic, wants the wiki checked for contradictions or staleness, mentions an LLM wiki, Memex, or second brain, or runs /llm-wiki.4---56# llm-wiki78Maintain a wiki the LLM owns and the human curates. Three layers, three operations.910| Layer | Who owns it | Rule |11|---|---|---|12| **Raw sources** | human | read-only, **never** edited or moved by this skill |13| **Wiki** | this skill | interlinked Markdown pages + `MEMORY.md`-style index |14| **Schema** | this skill | `WIKI.md` in the wiki root — conventions, written on init |1516Human curates sources, directs analysis, asks questions. Skill does the bookkeeping.1718## Quick start1920```21/llm-wiki ingest <path-to-source> # file a document into the wiki22/llm-wiki query <question> # answer from the wiki, with citations23/llm-wiki lint # contradictions, stale claims, broken links24```2526## Path resolution2728Resolve before any read or write:29301. **Check memory** for a `reference` entry naming the wiki root (name/description containing `llm-wiki` or `wiki root`).312. If found, use it.323. **If not, ask:** *"Where should the wiki live? (absolute path to a folder — I'll create it if missing.)"* Offer the three common answers: a fresh folder, this repo's `docs/`, or the existing memory directory.334. Save a `reference` memory entry so future runs don't re-prompt, and add its one-line pointer to `MEMORY.md`.345. If the folder has no `WIKI.md`, this is a fresh wiki — write the schema (see below) before anything else. Never create silently.3536## Page format3738One idea per page. Match an existing wiki's conventions if pages are already there; otherwise:3940```markdown41---42name: <kebab-case-slug> # must equal the filename without .md43description: <one line, <1024 chars — used for retrieval>44type: entity | concept | source-summary | analysis45sources: [<source-file-or-url>, ...]46updated: YYYY-MM-DD47---4849<body — link related pages with [[slug]]>50```5152Links use `[[slug]]` where slug is the **filename** without `.md`. A link to a page that53doesn't exist yet is fine — it marks work to do. Every page gets one index line.5455## Operations5657### ingest `<source>`58591. Read the source **in full**. Never edit, move, or rewrite it.602. Report takeaways and say which pages you intend to touch. **Wait for confirmation.**613. Write a `source-summary` page for the source itself, then create or amend every entity/concept page it affects. One source commonly touches 5–15 pages — that fan-out is the point.624. When new material contradicts an existing page, **do not silently overwrite**: keep both claims, mark the older one superseded with its date, and say so in the report.635. Add index lines for new pages. Append one line to `LOG.md`: date, source, pages touched.6465### query `<question>`66671. Search page descriptions first, then bodies. Read whole pages, not fragments.682. Answer with citations to page slugs. Say plainly when the wiki doesn't cover it — never fill the gap from general knowledge without labelling it as outside the wiki.693. If the answer was worth assembling, offer to file it back as an `analysis` page. That is how the wiki compounds.7071### lint72731. Run `scripts/lint.mjs <wiki-root>` for the deterministic checks (broken links, orphans, index drift, frontmatter gaps, oversized descriptions, stale pages).742. Then do the part a script can't: read the pages and hunt **contradictions** — two pages asserting different values for the same fact, superseded numbers still stated as current, claims whose source has since changed.753. Report findings ranked by whether they would produce a wrong answer. Propose fixes; apply only on confirmation.7677Contradictions are the payload. Link hygiene is housekeeping — report it, don't lead with it.7879## Schema file8081On init, write `WIKI.md` to the wiki root recording: the page format above, the link82convention, the index file name, and what counts as a raw source for *this* wiki. Read it83on every subsequent run and follow it over the defaults here — the wiki's own conventions win.8485## Rules8687- Never edit raw sources. Ever.88- Never write without showing the plan first.89- Prefer amending an existing page to creating a near-duplicate; check the index before creating.90- No time-sensitive claims without a date attached.