LLM Wiki
Build a durable markdown knowledge base that compounds over time. Separate raw
sources from synthesized pages, rely on [[wikilinks]] for navigation, and
treat the wiki as the main research artifact whenever the user wants persistent
memory instead of one-off chat answers.
Resolve the wiki path
Choose the wiki directory in this order:
- Use the path the user gave you.
- Else use an existing directory that already contains
SCHEMA.mdorindex.md. - Else use
~/wiki.
Avoid splitting one wiki across multiple roots.
Maintain this layout
wiki/
├── SCHEMA.md
├── index.md
├── log.md
├── raw/
│ ├── articles/
│ ├── papers/
│ ├── transcripts/
│ └── assets/
├── entities/
├── concepts/
├── comparisons/
└── queries/
Use these rules:
- Keep
raw/immutable. Save source material there, but do not rewrite it in place. - Write synthesized knowledge into
entities/,concepts/,comparisons/, andqueries/. - Let
SCHEMA.mddefine naming rules, frontmatter, tag taxonomy, and page thresholds. - Add every new page to
index.md. - Append every meaningful action to
log.md.
Orient before making changes
Before ingesting, querying, or linting an existing wiki:
- Read
SCHEMA.md. - Read
index.md. - Read the last 20-30 entries of
log.md. - Search the current topic across the wiki before creating new pages.
On large wikis, use terminal tools first:
WIKI=~/wiki
rg -n "transformer|attention" "$WIKI"
find "$WIKI" -name '*.md' | sort
tail -n 30 "$WIKI/log.md"
Do not skip orientation. Missing it causes duplicates, broken cross-links, and schema drift.
Initialize a new wiki
When the user asks to start a wiki:
- Create the directory tree.
- Ask or infer the domain.
- Write
SCHEMA.mdfor that domain. - Write
index.mdwith section headers and one-line summaries. - Write
log.mdwith a creation entry. - Suggest the first sources to ingest.
Use a schema like this and customize it to the domain:
# Wiki Schema
## Domain
AI research
## Conventions
- Use lowercase, hyphenated filenames.
- Put YAML frontmatter on every synthesized page.
- Use `[[wikilinks]]` between related pages.
- Bump `updated` whenever you modify a page.
- Add each new page to `index.md`.
- Append each material action to `log.md`.
## Frontmatter
---
title: Page Title
created: YYYY-MM-DD
updated: YYYY-MM-DD
type: entity | concept | comparison | query | summary
tags: [tag-a, tag-b]
sources: [raw/articles/source-name.md]
---
## Tag Taxonomy
- model
- architecture
- benchmark
- company
- person
## Page Thresholds
- Create a page when the topic is central to one source or appears in multiple sources.
- Extend an existing page when the topic is already covered.
- Split a page when it grows past roughly 200 lines.
- Record contradictions explicitly instead of silently overwriting them.
Ingest sources
When the user provides a source:
- Save the raw source under
raw/with a descriptive filename. - Treat URLs and pasted articles as
raw/articles/. - Treat papers and PDFs as
raw/papers/. - Treat pasted interviews, transcripts, and meeting notes as
raw/transcripts/. - Search the existing wiki before creating new pages.
- Update existing pages when the topic already exists.
- Create new pages only when the schema thresholds are met.
- Add at least 2 outbound
[[wikilinks]]on every new or materially expanded page. - Keep tags inside the schema taxonomy.
- Update
index.mdonce per ingest batch. - Append one
log.mdentry listing the source and the files you created or changed. - Summarize changed files in chat instead of pasting the entire research output.
A single source may update many pages. That is normal and desirable.
Answer questions from the wiki
When the user asks a question about the wiki's domain:
- Read
index.mdto find the right pages. - Search the wiki for topic-specific filenames and mentions.
- Read only the pages you need.
- Synthesize the answer from the compiled wiki, citing page filenames or wikilinks.
- File only durable answers back into
queries/orcomparisons/. - Log substantive filed answers, but skip trivial lookups.
Prefer compact answers in chat. Put the lasting substance into the wiki itself.
Lint and health-check
Prefer terminal tools over repetitive one-file-at-a-time reads on large wikis. Check at least:
- Broken wikilinks.
- Orphan pages with no inbound links.
- Pages missing from
index.md. - Missing required frontmatter fields.
- Tags used outside the schema taxonomy.
- Pages over roughly 200 lines.
- Stale content that lags behind newer cited material.
- Contradictory pages on the same subject.
log.mdsize; rotate when it exceeds roughly 500 entries.
Useful shell patterns:
cd "$WIKI"
find entities concepts comparisons queries -name '*.md' \
| sed 's|.*/||;s|\.md||' | sort -u > /tmp/wiki-pages.txt
rg -o '\[\[[^]|]+' entities concepts comparisons queries \
| sed 's/\[\[//' | sort -u > /tmp/wiki-links.txt
echo "Broken links:"
comm -23 /tmp/wiki-links.txt /tmp/wiki-pages.txt
echo "Orphans:"
while read -r page; do
count=$(rg -l "\\[\\[$page(\\]\\]|\\|)" entities concepts comparisons queries | rg -v "/$page\\.md$" | wc -l | tr -d ' ')
[ "$count" = "0" ] && echo "$page"
done < /tmp/wiki-pages.txt
Report findings by severity, then fix obvious structural issues if the user asked for repairs rather than report-only auditing.
Migrate existing notes
When the user has an Obsidian vault, loose markdown notes, or an older wiki:
- Discover files with terminal
find, not a truncated search UI. - Read and classify the corpus before rewriting anything.
- Normalize filenames and add frontmatter to synthesized pages.
- Preserve immutable originals in place or under
raw/, depending on the user's migration goal. - Repair wikilinks and then fix orphans after the main migration pass.
- Update
index.mdandlog.mdonce at the end. - Pause and confirm before large, destructive, or mass-rewrite migrations.
Batch large migrations instead of editing hundreds of files blindly.
Archive superseded content
When content is fully superseded:
- Move the page into
_archive/while preserving its type subdirectory if useful. - Remove the page from
index.md. - Replace important backlinks with plain text plus
(archived)where appropriate. - Record the archive action in
log.md.
Do not silently delete historical pages that still matter for provenance.
Obsidian compatibility
Treat the wiki directory as an Obsidian vault by default:
[[wikilinks]]remain clickable.- YAML frontmatter works with Dataview and search.
raw/assets/is a good default attachment location.
If the user already keeps the wiki in Obsidian, edit that same directory instead of creating a parallel vault.
Working rules
- Put lasting research output in the wiki, not in a long chat transcript.
- Verify key factual claims against primary sources before writing them as facts.
- Use a real browser when a site is JavaScript-rendered and plain fetch output is empty.
- Never modify files in
raw/. - Do not create pages for passing mentions or trivial details.
- Ask before any ingest or migration that would touch 10 or more existing pages.
- Keep pages scannable; split them once they become hard to read in one pass.
- Handle contradictions explicitly with dates and sources instead of overwriting them.