/llm-wiki-compiler:wiki-compilerfrom llm-wiki-compiler
Compiles source files from configured directories into topic-based wiki articles. Supports knowledge mode (markdown) and codebase mode (code repos). Used by /wiki-compile command.
Ships in llm-wiki-compiler. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
This skill contains the 5-phase algorithm for compiling source files into a topic-based wiki.
Safety rule: NEVER modify any file outside the configured output directory. Source files are read-only.
In Codex, use this skill through natural-language workflow prompts instead of Claude slash commands. The preferred capture UX is intentionally simple: paste a link and say "capture this in my wiki."
| Codex prompt | Claude command equivalent |
|---|---|
| "Initialize a wiki for this repo" | /wiki-init |
| "Set up my global wiki" | /wiki-global-init |
| "Capture this in my wiki: {url}. Context: {why it matters}" | /wiki-capture {url} --context "{why it matters}" |
| "{url} — capture this in my wiki" | /wiki-capture {url} |
| "Compile changed sources into the wiki" | /wiki-compile |
| "Search the compiled wiki for architecture decisions" | /wiki-search architecture decisions |
| "Answer this from the compiled wiki: {question}" | /wiki-query {question} |
| "Launch the wiki knowledge graph" | /wiki-visualize |
The command markdown files in commands/ remain the canonical workflow specs. When those files mention ${CLAUDE_PLUGIN_ROOT}, Codex should resolve the same paths relative to the installed plugin root.
For session-start context in Codex, read hooks/wiki-session-context as the shared helper. It prints the same wiki guidance that Claude receives through the SessionStart wrapper, but no Codex hook is registered until a supported hook schema is available.
Before running, read .wiki-compiler.json from the project root to get:
mode — "knowledge" (default, markdown files) or "codebase" (code repository)sources[] — directories to scan (with optional exclude patterns)output — where to write wiki articlesname — project/domain name for the wikitopic_hints[] — optional seed topics from the userlink_style — "obsidian" (default) or "markdown"Global wiki default: "my wiki" means the global wiki at ~/Knowledge unless LLM_WIKI_GLOBAL_DIR is set. Local/project wikis still live wherever a repo or folder has its own .wiki-compiler.json. A user can paste a URL and say "capture this in my wiki" to save one link plus context into the global wiki by default; "capture this in this project wiki" targets the local wiki.
Note: Sources don't have to live alongside the project. Captures are stored under wiki-sources/captures/ in the target wiki. /fetch-bookmarks <source> can pull batches from external services (X bookmarks today; Readwise, Pocket, GitHub stars planned) into a local directory that appears in sources[] alongside everything else.
Codebase mode additional config:
service_discovery — "auto" (detect monorepo vs single project) or "manual"knowledge_files[] — glob patterns for priority documentation files (README.md, CLAUDE.md, etc.)deep_scan — false (default) or true (also read key source files for richer articles)code_extensions[] — file extensions to consider as source code (e.g., .ts, .py, .go)sources[], list all .md files using Globexclude patterns (e.g., the wiki/ output directory itself).compile-state.json from the output directorysources[], scan for knowledge files matching knowledge_files[] patterns:
README.md, CLAUDE.md, AGENTS.md, ARCHITECTURE.md, CONTRIBUTING.md*.proto, *.graphql, openapi.yaml, openapi.jsonADR-*.md, docs/adr/*.mddocker-compose.yml, Dockerfile, k8s/*.yamldocs/runbooks/*.md, CHANGELOG.md, .env.exampledeep_scan is true, also scan for key source files per topic area:
index.ts, main.py, main.go, lib.rs, App.swift, etc.types.ts, models.py, schema.prisma, *.protopackage.json, tsconfig.json, pyproject.toml, go.mod, Cargo.tomlnode_modules/, dist/, .git/, vendor/, __pycache__/, .build/, target/, and configured exclude patterns.compile-state.json and compare to identify new or changed files# heading)posted_at / date / last_updated > filename date pattern (e.g., 2026-04-15-standup.md) > file mtime. Parse to YYYY-MM-DD. Track alongside the file path — every source should have a date, or be explicitly marked undated.topic_hints from config as seed topics when available.compile-state.json — avoid creating near-duplicatesd1-retention, push-notifications)inspiration-*, or any topic drawing ≥50% of its sources from external bookmark directories.Topic detection guidance:
retention/ likely belong to a retention topic)Topic discovery uses a 3-pass approach: structure → knowledge → optional deep scan.
Pass 1 — Structure scan (automatic topic discovery):
Detect project type by looking for manifest files in the root:
package.json → Node.js/JavaScript/TypeScriptgo.mod → GoCargo.toml → Rustpyproject.toml / requirements.txt / setup.py → PythonGemfile → Ruby*.sln / *.csproj → .NETPackage.swift → Swiftpom.xml / build.gradle → Java/KotlinDetect monorepo vs single project:
services/auth/package.json, services/billing/package.json). Each service directory = a topic.src/auth/, src/api/, src/models/ each become topics).Auto-create cross-cutting topics when relevant files exist:
infrastructure — if docker-compose.yml, Dockerfile, k8s/, .github/workflows/ existtesting — if tests/, __tests__/, spec/, test/ directories existdeployment — if CI/CD configs, Dockerfile, deployment scripts existPass 2 — Knowledge file scan (primary sources):
For each topic area discovered in Pass 1:
knowledge_files[] config) within that topic's directoryREADME.md touches all topics)./README.md, ./CLAUDE.md, ./ARCHITECTURE.md) contribute to ALL topics or get their own project-overview topicPass 3 — Deep scan (optional, when deep_scan: true):
For each topic area, also read key source files to enrich understanding:
index.ts, main.py, main.go, lib.rs, App.swift, app.pytypes.ts, models.py, schema.prisma, *.proto, types.goroutes.ts, api.py, handlers.go, controller.tspackage.json (dependencies), tsconfig.json, language-specific configClassification output is identical to knowledge mode: topic slug → list of source files. The rest of the pipeline (Phases 3-5) runs unchanged.
Topic slug conventions for codebases:
auth-service, billing-service, notification-serviceauth, api-routes, data-layer, ui-componentsinfrastructure, testing, deployment, shared-utilsArticle template: When mode is codebase, use ${CLAUDE_PLUGIN_ROOT}/templates/codebase-article-template.md as the fallback template (instead of the default knowledge template). If article_sections is set in config, use those sections (same as knowledge mode).
For EACH topic that has new or changed source files:
Read ALL source files classified under that topic (need full context, not just changed files)
Write the topic article to {output}/topics/{topic-slug}.md
Determine article structure:
.wiki-compiler.json has an article_sections array: use those sections in order. Each section's description field tells you what content belongs there.article_sections is absent (legacy configs without this field): fall back to the default template at ${CLAUDE_PLUGIN_ROOT}/templates/article-template.mdFill every section with specific, factual content -- no placeholders
Summary should be a standalone briefing: someone reading just this section should understand the current state
Sources must list every source file that contributed, using the configured link style
Coverage indicators -- each section heading must include a coverage tag:
[coverage: high -- N sources] -- 5+ sources contributed to this section, detailed synthesis. Reader can trust this section without checking raw files.[coverage: medium -- N sources] -- 2-4 sources, decent but may miss detail. Reader should check raw sources for granular or recent questions.[coverage: low -- N sources] -- 0-1 sources or sparse data. Reader should read the raw sources directly.Calculate coverage per section, not per article. An article might have high coverage on Summary but low coverage on Experiments. This tells the reader (human or AI agent) exactly when to trust the wiki vs when to fall back to raw files.
Time-decay annotations — apply these rules so readers can calibrate claims against when they were captured. Use the source_date collected in Phase 2.
Define the staleness threshold:
Apply these conventions:
⚠️ [YYYY-MM, may be stale] so the reader can skim past them.[as of YYYY-MM] tag: when a section rests primarily on aging sources (older than the topic's aging threshold), add [as of YYYY-MM] next to the coverage tag, where YYYY-MM is the median source date."YYYY-MM: {earlier framing} → {new framing}". Attribute both to their source files.~/.ft-bookmarks/md/bookmarks/): always annotate bullets with inline dates, and mention the dominant date range in Summary. Tweets are snapshots of a moment — never present them as timeless.Do NOT delete stale content. Flag, re-order, or annotate. The wiki is a time-series artifact; old entries have historical value even when no longer current.
Link style:
obsidian: Use [[relative/path/to/file]] (without .md extension)markdown: Use [filename](relative/path/to/file.md)Relative paths should be from the topics/ directory to the source file.
Parallel compilation: When possible, compile multiple topic articles in parallel using subagents. Each subagent gets one topic + its source files. This significantly speeds up first-run compilation.
IMPORTANT — Sequencing: Parallel dispatch is ONLY for Phase 3 (topic article compilation). After ALL parallel agents have returned and all topic articles are written, the PARENT process MUST continue to Phase 3.5 (concept discovery). Do NOT end the compilation after Phase 3. The remaining phases (3.5, 3.7, 4, 5) run sequentially in the parent process after parallel compilation completes.
This phase MUST run after Phase 3 completes. Read the topic articles that were just compiled and look for cross-cutting patterns. These become concept articles -- stored in {output}/concepts/.
How to discover concepts:
schema.md for existing concepts -- prefer updating existing concept articles over creating new onesConcept article format:
Write to {output}/concepts/{concept-slug}.md:
---
concept: {Concept Name}
last_compiled: {YYYY-MM-DD}
topics_connected: [{topic1}, {topic2}, {topic3}]
status: active
---
# {Concept Name}
## Pattern
{1-2 paragraphs describing the cross-cutting pattern. What keeps recurring and why.}
## Instances
{Each time this pattern appeared, with dates and context}
- **{date}** in [[../topics/{topic}]]: {what happened}
- **{date}** in [[../topics/{topic}]]: {what happened}
## What This Means
{Synthesis -- what the pattern tells you about your work, decisions, or blind spots.
This is the "so what" that Farzapedia calls the writer's job.}
## Sources
- [[../topics/{topic1}]]
- [[../topics/{topic2}]]
Important: Concept articles are interpretive, not just factual. They answer "what does this pattern mean?" not just "what happened?" This is what makes them useful for strategic and creative thinking.
Create the concepts/ directory if it doesn't exist.
If {output}/schema.md does not exist (first run):
${CLAUDE_PLUGIN_ROOT}/templates/schema-template.mdIf {output}/schema.md already exists:
The schema is the source of truth for wiki structure. The human can edit it between compiles to rename topics, merge them, or change conventions. The compiler respects those changes.
Write to {output}/INDEX.md:
# {name} Knowledge Base
Last compiled: {today's date}
Total topics: {count} | Total sources: {unique file count}
## Topics
| Topic | Also Known As | Sources | Last Updated | Status |
|-------|--------------|---------|-------------|--------|
| [[topics/{slug}]] | {keyword aliases} | {count} | {date} | active |
## Concepts
| Concept | Connects | Last Updated |
|---------|----------|-------------|
| [[concepts/{slug}]] | {topic1}, {topic2}, {topic3} | {date} |
## Recent Changes
- {date}: {what changed in this compilation run}
Keyword aliases: For each topic, include alternate names, abbreviations, and related terms that someone might search for. For example, a topic called side-quest-ideas might have aliases "FitOS, Growth OS, Paperclip, ClawShip". These help /wiki-search and Claude find the right topic even when the user uses different terminology.
Concepts section: List all concept articles with the topics they connect. If no concepts exist yet, omit this section.
Always regenerate INDEX.md, even if no topics changed (it's cheap).
{output}/log.md:## {today's date}
**Topics updated:** {list}
**New topics:** {list or "none"}
**Sources scanned:** {count}
**Sources changed:** {count}
{output}/.compile-state.json:{
"last_compiled": "{today's date}",
"topics": ["{slug1}", "{slug2}", ...],
"source_locations": ["{path1}", "{path2}", ...],
"total_sources_scanned": {count}
}
On the first compile (no prior .compile-state.json), generate {output}/CONTEXT.md:
# Codebase Wiki — Navigation Guide
This project has a compiled knowledge wiki. Use it instead of scanning raw files.
## How to use this wiki
1. Start at INDEX.md — scan the topic table to find relevant modules
2. Read 1-3 topic articles relevant to your current task
3. Check coverage tags:
- [coverage: high] — trust this section, skip raw files
- [coverage: medium] — good overview, check raw sources for implementation details
- [coverage: low] — read the raw source files listed in Sources
4. Check concepts/ for cross-cutting patterns (auth strategy, error handling, etc.)
5. Only read raw source files when you need code-level detail
## When NOT to use the wiki
- Writing new code (read the actual source files for exact syntax/types)
- Debugging a specific function (go to the file directly)
- The wiki article says [coverage: low] for what you need
## Stats
Compiled: {date} | Topics: {N} | Sources: {M} | Auto-updates on session start
On subsequent compiles, update the Stats line in CONTEXT.md.
After generating CONTEXT.md, ask the user (don't auto-modify): "Want me to add a reference to wiki/CONTEXT.md in your CLAUDE.md? This helps the agent discover the wiki automatically."
After compilation, show a summary to the user:
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub ussumant/llm-wiki-compiler --plugin llm-wiki-compilerOther plugins' skills for the same job