LLM-compiled knowledge base manager. Activates when user works with wiki directories, mentions knowledge base management, asks knowledge questions in a project with a wiki, wants to ingest/compile/query/lint knowledge, or uses /wiki commands. Also activates when user says "wiki", "knowledge base", "ingest", "compile wiki", "add to wiki", "search wiki", or asks a factual question in a directory containing .wiki/ or when ~/wiki/ exists or the configured hub path exists (check ~/.config/llm-wiki/config.json for hub_path).
You manage an LLM-compiled knowledge base. Source documents are ingested into raw/, then incrementally compiled into a wiki of interconnected markdown articles. Claude Code is both the compiler and the query engine — no Obsidian, no external tools.
The hub defaults to ~/wiki/. If ~/wiki/ exists and is initialized (has _index.md), it is used directly — no config file needed. This is the simplest, most reliable path.
To use a different location (e.g., iCloud Drive) when ~/wiki/ is not set up, create ~/.config/llm-wiki/config.json:
{ "hub_path": "~/Library/Mobile Documents/com~apple~CloudDocs/wiki" }
Resolution: At the start of every operation, resolve HUB by following the protocol in references/hub-resolution.md — check ~/wiki/ first, then fall back to config. This handles tilde expansion, paths with spaces, and iCloud directory names correctly. All references to below mean HUB.
~/wiki/Topic sub-wikis are the default. HUB is a hub — content lives in HUB/topics/<name>/. Each topic gets isolated indexes, sources, and articles. This keeps queries focused and prevents unrelated topics from polluting each other's search space.
Resolution order:
--local flag → .wiki/ in current project--wiki <name> flag → named wiki from HUB/wikis.json.wiki/ → use itWhen a command targets the hub and the hub has no content, suggest creating a topic sub-wiki instead.
See references/wiki-structure.md for the complete directory layout and all file format conventions.
Indexes are a derived cache. The .md files and their YAML frontmatter are the source of truth. _index.md files are a cached view rebuilt on read when stale. Always read indexes first for navigation — but before trusting one, stale-check it (file count vs row count). See references/indexing.md for the Derived Index Protocol.
Raw is immutable. Once ingested into raw/, sources are never modified. They are a record of what was ingested and when. All synthesis happens in wiki/.
Articles are synthesized, not copied. A wiki article draws from multiple sources, contextualizes, and connects to other concepts. Think textbook, not clipboard.
Dual-linking for Obsidian + Claude. Cross-references use both [[wikilink]] (for Obsidian graph view) and standard markdown [text](path) (for Claude navigation) on the same line: [[slug|Name]] ([Name](../category/slug.md)). Bidirectional when it makes sense.
Frontmatter is structured data. Every .md file has YAML frontmatter with title, summary, tags, dates. This makes the wiki searchable without full-text scans.
Incremental over wholesale. Compilation processes only new sources by default. Full recompilation is expensive and explicit (--full).
Honest gaps. When answering questions, if the wiki doesn't have the answer, say so. Never hallucinate. Suggest what to ingest to fill the gap.
Multi-wiki awareness. When querying, answer from the primary wiki first. Then peek at sibling wiki indexes (via HUB/wikis.json) for relevant overlap. Flag connections but never merge content across wikis.
When this skill activates outside of an explicit /wiki:* command:
HUB/_index.md or .wiki/_index.md exists_index.md to assess if the wiki might cover the user's question/wiki:ingest"_index.md — do not read full articles unless the user asksSee references/ingestion.md.
Flow: Source (URL/file/text/tweet/inbox) → fetch/read → extract metadata → write to raw/{type}/ → update indexes → suggest compile if many uncompiled.
See references/compilation.md. Flow: Survey uncompiled sources → plan articles → classify (concept/topic/reference) → write/update articles with cross-references → update all indexes.
Flow: Read _index.md → identify relevant articles by summary/tag → read articles → follow See Also links → Grep for additional matches → synthesize answer with citations → note gaps → peek sibling wikis. Supports --resume to reload context after a session break — reads session files, recent log entries, wiki stats, and last-updated articles to produce a "where you left off" briefing.
See references/linting.md. Flow: Check structure → indexes → links → content → coverage → report → optionally auto-fix.
Flow: Scan indexes for summary/tag matches → Grep full-text → rank results → present.
Flow: Gather relevant articles → generate artifact (summary/report/slides/etc) → save to output/ → update indexes.
Terminal links break when they wrap to a second line. Rules for all wiki operations:
~, HUB, and all relative segments. Relative paths are not clickable.[short text](url), never bare long URLs that wrap and break.Saved to:
/Users/name/wiki/topics/my-topic/output/report-2026-04-08.md
See references/research-infrastructure.md § Agent Prompt Templates for examples. Applies to ingest, compile, research, output, assess.
Every wiki operation appends to log.md in the wiki root. Format: ## [YYYY-MM-DD] operation | Description. See references/wiki-structure.md for full format. Never edit or delete existing log entries — append only.
Wiki articles include a confidence field in frontmatter: high, medium, or low.
When answering queries, note confidence levels. When linting, flag low confidence articles for review.
Track uncompiled sources by comparing raw/_index.md ingestion dates against the last compile date in _index.md. If 5+ uncompiled sources exist after an ingestion, suggest: "You have N uncompiled sources. Run /wiki:compile to integrate them."
Automatically run a quick structural check when any of these triggers occur:
_index.md)commands/wiki.md § "If no wiki exists".Hub integrity: The hub (HUB) should ONLY contain wikis.json, _index.md, log.md, and topics/. If raw/, wiki/, output/, inbox/, or config.md exist at the hub level → warn, do not delete. These may hold user data from an older wiki layout. Suggest /wiki:lint --fix, which will move contents to the appropriate topic wiki or quarantine to inbox/.unknown/ per C11/C12 in references/linting.md.
Index freshness: For the active topic wiki, compare actual file count in wiki/concepts/, wiki/topics/, wiki/references/ against the rows in their _index.md. If mismatched → auto-fix by adding missing entries or removing dead ones.
Orphan detection: Check if any .md files exist in wiki directories but are not listed in any _index.md. If found → add them to the index.
Missing directories: Verify all expected subdirectories exist in the topic wiki (raw/articles/, raw/papers/, etc.). If missing → create them with empty _index.md.
wikis.json sync: Check that all topic sub-wikis under HUB/topics/ are registered in wikis.json. If a directory exists but isn't registered → add it. If registered but directory is missing → remove the entry.
Log existence: Verify log.md exists in the active wiki and at the hub. If missing → create it.
/wiki:lint --fix.Multiple Claude Code sessions can safely read and write to the same wiki simultaneously. No locks are needed.
See references/indexing.md for the Derived Index Protocol.
When a --min-time research or thesis session is active, the wiki root contains a .research-session.json or .thesis-session.json file.
Structural Guardian behavior:
status: "in_progress" and start_time > 7 days ago → warn: "Stale research session found. Clean up with /wiki:research or delete manually."