| name | wiki |
| description | Build and maintain a persistent LLM-powered wiki/knowledge base. Use when the user says "wiki", "knowledge base", "ingest this", "add to wiki", "wiki query", "wiki lint", "wiki init", "wiki search", or wants to build a structured, interlinked collection of markdown files from source documents. Based on Karpathy's LLM Wiki pattern.
|
| argument-hint | <command> [args...] |
| allowed-tools | ["Read","Write","Edit","Glob","Grep","Bash","Agent"] |
LLM Wiki
Build and maintain a persistent, compounding knowledge base as interlinked markdown files.
Instead of re-deriving knowledge on every query (RAG-style), incrementally compile sources
into a structured wiki the LLM maintains. The wiki is the artifact; you curate, the LLM
does the bookkeeping.
Commands
Parse $ARGUMENTS to determine which operation to run:
| Command | Description |
|---|
init [path] | Scaffold a new wiki at path (default: ./wiki) |
ingest <source> | Process a source file/URL and integrate into the wiki |
query <question> | Search the wiki and synthesize an answer |
lint | Health-check the wiki for issues |
search <term> | Full-text search across wiki pages |
status | Show wiki stats (page count, source count, recent activity) |
If no command is recognized, treat the entire argument as a query.
Architecture
The wiki has three layers:
wiki-root/
raw/ # Immutable source documents (user adds, LLM reads only)
pages/ # LLM-generated markdown pages (LLM owns entirely)
index.md # Content catalog with links and one-line summaries
log.md # Append-only chronological record of operations
schema.md # Wiki conventions, structure, domain-specific rules
Init
When init is invoked:
- Create the directory structure above
- Create
schema.md with default conventions (below)
- Create empty
index.md with header and category sections
- Create empty
log.md with header
- Create
raw/ and pages/ directories
- Print the path and next steps
Default schema.md content:
# Wiki Schema
## Conventions
- All wiki pages live in `pages/`
- Use `[[wikilinks]]` for cross-references between pages
- Each page has YAML frontmatter: title, created, updated, tags, sources
- Page filenames are kebab-case: `machine-learning-basics.md`
- One concept/entity per page — split if a page covers multiple topics
## Page Types
- **source**: Summary of a raw source document
- **entity**: A person, place, organization, or specific thing
- **concept**: An idea, theory, method, or topic
- **synthesis**: Cross-cutting analysis combining multiple sources
- **comparison**: Side-by-side analysis of related items
## Index Format
Categories in index.md: Sources, Entities, Concepts, Syntheses, Comparisons
## Log Format
Each entry: `## [YYYY-MM-DD] operation | Title`
Ingest
When ingest <source> is invoked:
- Read the source file (or fetch URL content)
- Create a source summary page in
pages/ with frontmatter
- Identify entities, concepts, and themes mentioned
- For each entity/concept:
- If a page exists: update it with new information, note the new source
- If no page exists: create one
- Add
[[wikilinks]] cross-references in all touched pages
- Update
index.md with new/modified pages
- Append an entry to
log.md
- Copy/save the raw source to
raw/ (if it's a file)
- Print a summary: pages created, pages updated, key takeaways
Guidelines for ingest:
- Preserve nuance — don't flatten complex arguments into bullet points
- Flag contradictions with existing wiki content explicitly
- Link liberally — every mention of a known entity/concept should be a wikilink
- Include citations back to the source:
(Source: [[source-page]])
Query
When query <question> is invoked:
- Read
index.md to identify relevant pages
- Optionally grep for additional keyword matches across
pages/
- Read the relevant pages
- Synthesize an answer with citations to wiki pages
- If the answer is substantial and reusable, offer to save it as a new
synthesis page in the wiki
- Append a query entry to
log.md
Lint
When lint is invoked, check for:
- Contradictions: Pages that make conflicting claims
- Stale content: Claims superseded by newer sources
- Orphan pages: Pages with no inbound links
- Missing pages: Wikilinks that point to non-existent pages
- Thin pages: Pages with very little content that could be expanded
- Missing cross-references: Related pages that should link to each other
- Index gaps: Pages that exist but aren't listed in
index.md
Print a report with findings and suggested fixes. Offer to auto-fix what's safe
(updating index, adding cross-references, creating stub pages for missing links).
Search
When search <term> is invoked:
- Grep across all
pages/*.md files for the term
- Print matching pages with context snippets
- Sort by relevance (title match > heading match > body match)
Status
When status is invoked:
- Count pages by type (from frontmatter)
- Count raw sources
- Show last 5 log entries
- Show total wikilink count and orphan count
- Print a summary
Page Template
Every wiki page follows this structure:
---
title: Page Title
type: source|entity|concept|synthesis|comparison
created: YYYY-MM-DD
updated: YYYY-MM-DD
tags: [tag1, tag2]
sources: [source-filename]
---
# Page Title
Brief overview paragraph.
## Key Points
- ...
## Details
...
## Related
- [[related-page-1]]
- [[related-page-2]]
Tips
- Ingest sources one at a time for better integration quality
- After several ingests, run
lint to catch gaps
- Save good query answers back to the wiki as synthesis pages
- The wiki is just markdown files — use git for version history
- Works great with Obsidian for browsing (graph view, backlinks)