LLM Wiki — Personal Knowledge Base Builder
The @llm-wiki/sdk TypeScript SDK handles document parsing, search, indexing, and validation. This Skill reads parsed content, synthesizes wiki pages, maintains cross-references, and answers questions on top of the deterministic SDK operations. The human curates sources and asks questions.
Prerequisites
# Install the SDK (one-time)
cd ~/.agents/skills/llm-wiki/sdk && npm install && npm run build
Commands
/llm-wiki init [path] # Scaffold a new wiki project
/llm-wiki ingest [source-path] # Parse source + LLM synthesis into wiki
/llm-wiki query <question> # Research and answer from the wiki
/llm-wiki lint # Health-check the wiki
/llm-wiki status # Wiki statistics and overview
Architecture
User drops file ──▶ SDK (parse/index) ──▶ clean .md ──▶ Skill (LLM) ──▶ wiki pages
deterministic in sources/ non-deterministic in concepts/
Three wiki layers:
sources/ — parsed source documents (SDK writes, LLM reads, never modifies)
concepts/ — LLM-generated pages (entities, concepts, references, queries)
references/ — external links and citations
SDK Operations (deterministic — use the SDK via Node.js)
import { createKnowledgeBase, OpenAIProvider } from "@llm-wiki/sdk";
const kb = await createKnowledgeBase({ root: "<wiki-root>" });
await kb.ingest({ path: "<file>" });
await kb.search("<query>");
await kb.validate();
await kb.status();
Skill Operations (LLM intelligence — this file defines these)
All Skill operations use mcp__node_repl_js to execute SDK calls, then apply LLM intelligence on top.
| Skill Operation |
Uses SDK |
Then LLM does |
| init |
createKnowledgeBase() |
Ask user about wiki domain, customize scope |
| ingest |
kb.ingest() + kb.reindex() |
Synthesize wiki pages, update cross-references |
| query |
kb.search() |
Read pages, synthesize answer with citations |
| lint |
kb.validate() + kb.status() |
Find contradictions, suggest improvements |
| status |
kb.status() |
Present human-friendly summary |
Init (/llm-wiki init)
Process
- Scaffold via SDK:
Run through
mcp__node_repl_js:const kb = await createKnowledgeBase({ root: "<path>" });
- Ask user: What is this wiki about? What domain? Key topics?
- Customize scope: Write a summary of domain context, key entities, and scope to the wiki root
- Git init if not already a repo
Ingest (/llm-wiki ingest)
The primary operation. A single source may touch 10-15 wiki pages.
Process
Parse via SDK (deterministic):
const result = await kb.ingest({ path: "<source-file>" });
This converts PDF/DOCX/HTML/etc → markdown in sources/ with YAML frontmatter.
Read parsed content: Read the .md file from sources/ that the SDK created.
Discuss with user (interactive mode):
- Present 3-5 key takeaways from the source
- Ask: "Anything to emphasize? Connections to existing wiki content?"
- Skip if user said "just process it" or batch mode
LLM synthesis (create/update wiki pages):
a. Source summary → concepts/{slug}.md with frontmatter, summary, key claims
b. Entity pages → create or update for each significant entity
c. Concept pages → create or update for abstract ideas
d. Overview → update overview if the source changes the big picture
e. Cross-references → add links between related pages
Rebuild index via SDK:
await kb.reindex();
Append to log:
## [YYYY-MM-DD] ingest | {Source Title}
- Source: sources/{filename}
- Created: {list of new pages}
- Updated: {list of updated pages}
- Key additions: {1-2 sentence summary}
Report: pages created/updated, new entities/concepts, suggested follow-ups.
Batch Ingest
Process multiple files through steps 1-6. Skip interactive discussion.
Query (/llm-wiki query)
Process
Search via SDK to find relevant pages:
const results = await kb.search("<query>", { limit: 10 });
Read relevant pages: Follow the paths from search results, read full content.
Synthesize answer: Write answer with citations to wiki pages and original sources.
Choose output format:
- Simple factual → text response
- Comparison → markdown table
- Deep analysis → offer to file in
concepts/queries/
File if valuable: Save substantial answers, then:
await kb.reindex();
Log → append to log.md
Lint (/llm-wiki lint)
Process
Structural check via SDK:
const report = await kb.validate();
Parse errors (dead links, missing frontmatter, missing dirs).
Get wiki status via SDK:
const status = await kb.status();
LLM semantic checks (read pages, apply judgment):
- Contradictions — scan for conflicting claims across pages
- Stale content — newer sources may supersede older claims
- Orphan pages — pages with no inbound links
- Missing pages — entities/concepts mentioned but lacking their own page
- Missing cross-references — opportunities for links between related pages
- Data gaps — topics with thin coverage
Report as prioritized list (Critical / Important / Suggestions / Stats)
Offer fixes: "Want me to fix any of these?"
Status (/llm-wiki status)
const status = await kb.status();
Present a human-friendly summary:
## {Wiki Name} — Status
Sources: {N} documents in sources/
Wiki pages: {N} total ({concepts} concepts, ...)
Search: {available/not built}
Recent activity (from log.md):
- ...
Page Format Convention
Every wiki page has YAML frontmatter:
---
title: Page Title
type: entity|concept|source|comparison|query|overview
created: YYYY-MM-DD
updated: YYYY-MM-DD
sources:
- sources/paper1.md
- sources/article2.md
tags:
- topic1
- topic2
---
Linking
- Standard markdown:
[Page Title](concepts/page-name.md)
- Cite sources: "claim [source-name]"
- Cross-reference liberally
Supported Source Formats
Via the SDK's composite parser (jsdom, Readability, mammoth, pdf-parse, node-pptx-parser, turndown):
- Documents: PDF, DOCX, PPTX
- Web: HTML, HTM
- Text: TXT, CSV, JSON, XML, MD
- Buffers: in-memory content with metadata
Principles
- SDK does grunt work; LLM does thinking. Parsing, searching, indexing, validating are deterministic — SDK handles them. Synthesis, cross-referencing, answering are intelligent — Skill handles them.
- The wiki is a persistent, compounding artifact. Every source and every query makes it richer.
- The LLM writes; the human curates. Source, explore, ask. The LLM does the bookkeeping.
- File valuable outputs back into the wiki. Good answers shouldn't disappear into chat history.
- Cross-references are as valuable as content. Link liberally.
- The wiki is just a git repo. Version history, branching, diffing for free.
1---2name: llm-wiki3description: Build and maintain LLM-powered personal knowledge bases using the @llm-wiki/sdk TypeScript SDK. Deterministic operations (document parsing, full-text search, validation, indexing) run through the SDK; LLM synthesis and cross-referencing are orchestrated by this Skill. Use when user wants to create a knowledge base, build a wiki, organize research, compile notes, ingest documents, or says 'llm-wiki'.4---56# LLM Wiki — Personal Knowledge Base Builder78The `@llm-wiki/sdk` TypeScript SDK handles document parsing, search, indexing, and validation. This Skill reads parsed content, synthesizes wiki pages, maintains cross-references, and answers questions on top of the deterministic SDK operations. The human curates sources and asks questions.910## Prerequisites1112```bash13# Install the SDK (one-time)14cd ~/.agents/skills/llm-wiki/sdk && npm install && npm run build15```1617## Commands1819```20/llm-wiki init [path] # Scaffold a new wiki project21/llm-wiki ingest [source-path] # Parse source + LLM synthesis into wiki22/llm-wiki query <question> # Research and answer from the wiki23/llm-wiki lint # Health-check the wiki24/llm-wiki status # Wiki statistics and overview25```2627---2829## Architecture3031```32User drops file ──▶ SDK (parse/index) ──▶ clean .md ──▶ Skill (LLM) ──▶ wiki pages33 deterministic in sources/ non-deterministic in concepts/34```3536Three wiki layers:3738- **`sources/`** — parsed source documents (SDK writes, LLM reads, never modifies)39- **`concepts/`** — LLM-generated pages (entities, concepts, references, queries)40- **`references/`** — external links and citations4142### SDK Operations (deterministic — use the SDK via Node.js)4344```js45import { createKnowledgeBase, OpenAIProvider } from "@llm-wiki/sdk";4647const kb = await createKnowledgeBase({ root: "<wiki-root>" });48await kb.ingest({ path: "<file>" });49await kb.search("<query>");50await kb.validate();51await kb.status();52```5354### Skill Operations (LLM intelligence — this file defines these)5556All Skill operations use `mcp__node_repl_js` to execute SDK calls, then apply LLM intelligence on top.5758| Skill Operation | Uses SDK | Then LLM does |59| --------------- | ------------------------------- | ---------------------------------------------- |60| **init** | `createKnowledgeBase()` | Ask user about wiki domain, customize scope |61| **ingest** | `kb.ingest()` + `kb.reindex()` | Synthesize wiki pages, update cross-references |62| **query** | `kb.search()` | Read pages, synthesize answer with citations |63| **lint** | `kb.validate()` + `kb.status()` | Find contradictions, suggest improvements |64| **status** | `kb.status()` | Present human-friendly summary |6566---6768## Init (`/llm-wiki init`)6970### Process71721. **Scaffold via SDK**:73 Run through `mcp__node_repl_js`:74 ```js75 const kb = await createKnowledgeBase({ root: "<path>" });76 ```772. **Ask user**: What is this wiki about? What domain? Key topics?783. **Customize scope**: Write a summary of domain context, key entities, and scope to the wiki root794. Git init if not already a repo8081---8283## Ingest (`/llm-wiki ingest`)8485The primary operation. A single source may touch 10-15 wiki pages.8687### Process88891. **Parse via SDK** (deterministic):9091 ```js92 const result = await kb.ingest({ path: "<source-file>" });93 ```9495 This converts PDF/DOCX/HTML/etc → markdown in `sources/` with YAML frontmatter.96972. **Read parsed content**: Read the `.md` file from `sources/` that the SDK created.98993. **Discuss with user** (interactive mode):100 - Present 3-5 key takeaways from the source101 - Ask: "Anything to emphasize? Connections to existing wiki content?"102 - Skip if user said "just process it" or batch mode1031044. **LLM synthesis** (create/update wiki pages):105 a. **Source summary** → `concepts/{slug}.md` with frontmatter, summary, key claims106 b. **Entity pages** → create or update for each significant entity107 c. **Concept pages** → create or update for abstract ideas108 d. **Overview** → update overview if the source changes the big picture109 e. **Cross-references** → add links between related pages1101115. **Rebuild index via SDK**:112113 ```js114 await kb.reindex();115 ```1161176. **Append to log**:118119 ```120 ## [YYYY-MM-DD] ingest | {Source Title}121 - Source: sources/{filename}122 - Created: {list of new pages}123 - Updated: {list of updated pages}124 - Key additions: {1-2 sentence summary}125 ```1261277. **Report**: pages created/updated, new entities/concepts, suggested follow-ups.128129### Batch Ingest130131Process multiple files through steps 1-6. Skip interactive discussion.132133---134135## Query (`/llm-wiki query`)136137### Process1381391. **Search via SDK** to find relevant pages:140141 ```js142 const results = await kb.search("<query>", { limit: 10 });143 ```1441452. **Read relevant pages**: Follow the paths from search results, read full content.1461473. **Synthesize answer**: Write answer with citations to wiki pages and original sources.1481494. **Choose output format**:150 - Simple factual → text response151 - Comparison → markdown table152 - Deep analysis → offer to file in `concepts/queries/`1531545. **File if valuable**: Save substantial answers, then:155156 ```js157 await kb.reindex();158 ```1591606. **Log** → append to `log.md`161162---163164## Lint (`/llm-wiki lint`)165166### Process1671681. **Structural check via SDK**:169170 ```js171 const report = await kb.validate();172 ```173174 Parse errors (dead links, missing frontmatter, missing dirs).1751762. **Get wiki status via SDK**:177178 ```js179 const status = await kb.status();180 ```1811823. **LLM semantic checks** (read pages, apply judgment):183 - **Contradictions** — scan for conflicting claims across pages184 - **Stale content** — newer sources may supersede older claims185 - **Orphan pages** — pages with no inbound links186 - **Missing pages** — entities/concepts mentioned but lacking their own page187 - **Missing cross-references** — opportunities for links between related pages188 - **Data gaps** — topics with thin coverage1891904. **Report** as prioritized list (Critical / Important / Suggestions / Stats)1911925. **Offer fixes**: "Want me to fix any of these?"193194---195196## Status (`/llm-wiki status`)197198```js199const status = await kb.status();200```201202Present a human-friendly summary:203204```205## {Wiki Name} — Status206207Sources: {N} documents in sources/208Wiki pages: {N} total ({concepts} concepts, ...)209Search: {available/not built}210211Recent activity (from log.md):212- ...213```214215---216217## Page Format Convention218219Every wiki page has YAML frontmatter:220221```yaml222---223title: Page Title224type: entity|concept|source|comparison|query|overview225created: YYYY-MM-DD226updated: YYYY-MM-DD227sources:228 - sources/paper1.md229 - sources/article2.md230tags:231 - topic1232 - topic2233---234```235236### Linking237238- Standard markdown: `[Page Title](concepts/page-name.md)`239- Cite sources: "claim [source-name]"240- Cross-reference liberally241242---243244## Supported Source Formats245246Via the SDK's composite parser (jsdom, Readability, mammoth, pdf-parse, node-pptx-parser, turndown):247248- **Documents**: PDF, DOCX, PPTX249- **Web**: HTML, HTM250- **Text**: TXT, CSV, JSON, XML, MD251- **Buffers**: in-memory content with metadata252253---254255## Principles2562571. **SDK does grunt work; LLM does thinking.** Parsing, searching, indexing, validating are deterministic — SDK handles them. Synthesis, cross-referencing, answering are intelligent — Skill handles them.2582. **The wiki is a persistent, compounding artifact.** Every source and every query makes it richer.2593. **The LLM writes; the human curates.** Source, explore, ask. The LLM does the bookkeeping.2604. **File valuable outputs back into the wiki.** Good answers shouldn't disappear into chat history.2615. **Cross-references are as valuable as content.** Link liberally.2626. **The wiki is just a git repo.** Version history, branching, diffing for free.