name: wiki
description: "Knowledge base builder and maintainer for persistent markdown wikis. Use when ingesting sources into structured wiki pages, querying existing knowledge bases, creating new wikis, maintaining wiki quality, or navigating wiki content. Covers 6 domain templates (research, project, personal, business, reading, general), anti-hallucination citations, index-first queries, and lint protocols. Also trigger on: knowledge base, wiki, compile notes, persistent notes, second brain, Zettelkasten, Obsidian vault content. Parent skill for the wiki skill family."
disambiguation: Building and maintaining knowledge-base CONTENT — ingestion, structure, citations, linting — editor-agnostic. Configuring the Obsidian app is obsidian.
Wiki — Persistent Knowledge Base Skill Family
Parent skill for building and maintaining file-based markdown knowledge bases. Routes operational work to reference files.
This is a slim parent — detailed protocols live in reference files. Read this file to understand WHAT wikis are and WHICH reference file handles WHICH operation. Read the reference files for HOW.
Runnable commands (#35)
The protocol files describe the contract; these perform the parts of it that are pure
mechanism, so they are not re-derived by a model on every run:
W=~/.claude/skills/wiki/scripts/wiki_lint.py
python3 $W create --path ~/wikis/trading --name "Trading Research" --domain "systematic equity"
python3 $W lint --wiki ~/wikis/trading # exit 2 if anything fails or warns
create writes the skeleton and a WIKI.md carrying all 11 required sections, leaving
sections 1 and 10 as deliberate placeholders — a wiki whose purpose and domain behaviour are
unstated drifts into a folder of notes.
lint enforces the §3 frontmatter contract: required fields, closed enums, kebab-case slugs
matching filenames, dates in order, and every source entry citable (a path plus one of
pages/lines/anchor). A wikilink that resolves to nothing is an ERROR, because a wiki
asserting connections it does not have is worse than no wiki. Staleness and a deprecated page
with no successor are warnings, not errors — conflating the two teaches people to ignore the
output.
ingest.py is deliberately absent. Reading a source and deciding what a page should SAY
is comprehension, not mechanism, and a script pretending otherwise would produce confident,
shallow pages. ingest.md remains the protocol the model follows.
- Snapshot before: capture
sha256sum, wc -l, stat -c '%Y %s' of the target file. Record the hash explicitly in the conversation/log.
- Backup:
cp -p <file> <file>.bak.YYYYMMDDTHHMMSSZ with a UTC-style timestamp suffix. Backups stay in-place under the wiki root — they survive cp -r and are git-trackable.
- Compose edits in memory — Read the file, plan the modifications, but DO NOT write yet.
- Re-check hash immediately before write:
sha256sum again and compare against the snapshot. If different → abort the write, alert the caller with the divergent hashes, do NOT silently overwrite. The backup remains for forensics; the new state may contain useful work that must not be lost.
- Apply edits atomically: prefer the harness's Edit tool (which does atomic replace) over
cat > file. For larger rewrites, write to a sibling <file>.new, fsync, then mv to the final name.
- Post-write confirmation: capture the new
sha256sum + line count and log it. This creates an audit trail.
The protocol survives the "other session edited it without acquiring our lock" failure mode. The price is one extra sha256sum per write — negligible vs the cost of a silently-overwritten index.
What a Wiki Is
A wiki is a self-contained directory with three layers:
<wiki-root>/
WIKI.md # Schema/conventions for THIS wiki
index.md # Master content catalog
log.md # Chronological operations log
raw/ # IMMUTABLE source files (date-prefixed)
wiki/ # LLM-owned content layer (categorized pages)
_templates/ # Per-wiki instance templates (customizable copy)
_maintenance/ # Agent operational state (link-index, lint-history, tags)
.wiki-meta.yaml # Local registry backup
.wiki.lock # Single-writer lock (when present)
Layer ownership:
raw/ — IMMUTABLE. Once deposited, never modified.
wiki/ — LLM-owned. Agent writes; humans read. Human edits flagged on lint.
WIKI.md + schema — CO-EVOLVED. Agent proposes, user approves.
Registry: ~/.wiki-registry.yaml (user home, not in ~/.claude/ — wikis are cross-tool).
Routing Table — Which Reference File For Which Task
| User Intent | Reference File |
|---|
| "Create a new wiki" / "set up wiki for X" | ~/.claude/skills/wiki/schema.md (bootstrap section) |
| "Ingest this source" / "add X to my wiki" | ~/.claude/skills/wiki/ingest.md |
| "What does my wiki say about X" / "find Y in wiki" | ~/.claude/skills/wiki/query.md |
| "Lint wiki" / "check wiki health" / "find broken links" | ~/.claude/skills/wiki/lint.md |
| "Update schema" / "add new page type" / "evolve WIKI.md" | ~/.claude/skills/wiki/schema.md (evolution section) |
| Pick a domain template | ~/.claude/skills/wiki/templates/{research,project,personal,business,reading,general}.md |
Delegating to a reference file means: read that file into context, then follow its protocol. Do not re-derive logic here.
Domain Templates (6)
| Template | For | Master File |
|---|
| research | Papers, concepts, experiments, comparisons | ~/.claude/skills/wiki/templates/research.md |
| project | Architecture, ADRs, API contracts, runbooks | ~/.claude/skills/wiki/templates/project.md |
| personal | Goals, habits, journal, self-model | ~/.claude/skills/wiki/templates/personal.md |
| business | Companies, markets, products, customer segments | ~/.claude/skills/wiki/templates/business.md |
| reading | Books, characters, themes, quotes | ~/.claude/skills/wiki/templates/reading.md |
| general | Minimal fallback when no domain fits | ~/.claude/skills/wiki/templates/general.md |
Two template locations — do not conflate:
- Master (this skill family):
~/.claude/skills/wiki/templates/<name>.md — canonical, updated by alf
- Per-wiki instance:
<wiki-root>/_templates/<type>.md — copied at wiki creation, customizable per wiki
When NOT to Use This Skill
- Architecture mapping for AI consumption → use
project-documentation (PROJECT.md, COMPONENT.md)
- Session operational log → use
history.md (recent) + history/INDEX.md (archived) in the project root
- Personal user memory → use MEMORY.md auto-memory
- Live web search / RAG → wikis are compiled knowledge, not live search
- Small one-off notes → just use a markdown file, don't bootstrap a wiki
The wiki is for persistent domain knowledge that compounds across sources. Everything else has a better home.
Anti-Patterns
| Anti-Pattern | Why It Fails | Correct Approach |
|---|
| Writing content inline here instead of reference files | SKILL.md exceeds 120-line slim-parent cap, ecosystem conventions broken | Keep routing + hard rules here; detail in ingest.md/query.md/lint.md/schema.md |
| Reading the full wiki to answer a query | Context explodes, costs unbounded, answers degrade | Index-first: read index.md, grep, targeted page reads |
| Claiming facts without source citations | Wiki becomes unreliable, undetectable hallucination contamination | Every claim cites [Source: raw/<file>, p.<page>] — lint check #3 enforces |
Treating raw/ as mutable | Breaks provenance, citations stop resolving | Immutable raw layer — new versions get numeric suffixes |
| Skipping lint after batch ingest | Broken links and contradictions accumulate silently | Mandatory lint after batch ops (see lint.md mandatory triggers) |
Bypassing the .wiki.lock | Concurrent writes corrupt index.md and link graph | Check → acquire → write → release pattern |