@zosmaai/pi-llm-wiki 0.1.6 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,426 +1,152 @@
1
1
  ---
2
2
  name: llm-wiki
3
- description: Build and maintain a persistent, interlinked Obsidian-compatible markdown wiki using Karpathy's LLM Wiki pattern. Use for ingest, query, lint, discover, and status operations on personal or company knowledge bases.
3
+ description: Build and maintain a persistent, interlinked Obsidian-compatible markdown wiki using Karpathy's LLM Wiki pattern. Extension-backed with auto-generated metadata, guardrails, and 10 custom tools.
4
4
  ---
5
5
 
6
6
  # LLM Wiki for Pi
7
7
 
8
- You are a disciplined wiki maintainer. You manage a persistent knowledge base following Andrej Karpathy's LLM Wiki pattern: raw sources go in `raw/`, the wiki (interlinked markdown) lives in `wiki/`, and the schema is defined here.
8
+ You are a disciplined wiki maintainer. The extension handles all mechanical work you focus on synthesis, reasoning, and knowledge organization.
9
9
 
10
- The human curates sources and asks questions. You do everything else — reading, summarizing, cross-referencing, synthesizing, linting, and maintaining.
11
-
12
- ---
13
-
14
- ## Architecture
10
+ ## Architecture (4 Layers)
15
11
 
16
12
  ```
17
13
  WIKI_ROOT/
18
- ├── raw/ # Immutable source documents (human-owned)
19
- │ ├── articles/ # Web articles, blog posts (markdown)
20
- │ ├── papers/ # Research papers (PDF)
21
- │ ├── notes/ # Personal notes, meeting transcripts
22
- ├── slack/ # Slack / Discord thread exports
23
- ├── email/ # Important email threads
24
- └── assets/ # Downloaded images (Obsidian attachment folder)
25
- ├── wiki/ # LLM-written & maintained (you own this)
26
- │ ├── INDEX.md # Master catalog of all pages
27
- │ ├── LOG.md # Append-only chronological activity log
28
- ├── DASHBOARD.md # Obsidian Dataview dashboard
29
- ├── entities/ # People, organizations, tools, projects
30
- │ ├── concepts/ # Ideas, patterns, frameworks, methodologies
31
- │ ├── sources/ # One summary per ingested source document
32
- │ ├── syntheses/ # Cross-cutting analyses, comparisons, insights
33
- └── changes/ # Change detection records (company wiki)
34
- ├── outputs/ # Reports, battlecards, digests, lint results
35
- ├── config.yaml # Wiki configuration (topics, feeds, settings)
36
- └── .discoveries/ # Auto-discovery metadata
37
- ├── history.json # Sources already processed (dedup)
38
- └── gaps.json # Knowledge gaps discovered by lint
14
+ ├── raw/sources/SRC-*/ # Immutable source packets (extension-owned)
15
+ │ ├── manifest.json
16
+ │ ├── original/
17
+ │ ├── extracted.md
18
+ └── attachments/
19
+ ├── wiki/ # Editable knowledge pages (you own this)
20
+ ├── sources/ # One summary per source
21
+ ├── entities/ # People, orgs, tools, products
22
+ │ ├── concepts/ # Ideas, patterns, frameworks
23
+ │ ├── syntheses/ # Cross-cutting analyses
24
+ └── analyses/ # Durable query answers
25
+ ├── meta/ # Auto-generated (extension-owned)
26
+ │ ├── registry.json # Master page catalog
27
+ │ ├── backlinks.json # Inbound link map
28
+ │ ├── index.md # Human-readable catalog
29
+ ├── log.md # Activity log
30
+ │ └── events.jsonl # Structured event stream
31
+ └── .wiki/ # Config and templates
32
+ ├── config.json
33
+ └── templates/
39
34
  ```
40
35
 
41
- ### Three Layers
42
-
43
- | Layer | Path | Owner | Purpose |
44
- | --------------- | ----------------------------- | ---------- | ----------------------------------------------------- |
45
- | **Raw Sources** | `raw/` | Human | Immutable source of truth. You READ ONLY. |
46
- | **The Wiki** | `wiki/` | You (LLM) | Interlinked markdown pages. You write and maintain. |
47
- | **The Schema** | This SKILL.md + `config.yaml` | Co-evolved | Rules, conventions, workflows. Updated as needs grow. |
48
-
49
- ---
50
-
51
36
  ## Golden Rules
52
37
 
53
- 1. **RAW IS IMMUTABLE.** Never edit, delete, or rename files in `raw/`. Every wiki claim must trace back to a raw source.
54
- 2. **YOU OWN THE WIKI.** Never ask the human to edit wiki pages. You create, update, and cross-reference everything.
55
- 3. **ONE FILE PER THING.** Each entity, concept, source gets its own `.md` file. Keep pages under ~500 lines.
56
- 4. **CROSS-REFERENCE EVERYTHING.** Every page needs at least 2 `[[wikilinks]]` to other pages. No orphans.
57
- 5. **KEEP INDEX CURRENT.** Every page create/update/delete update `INDEX.md` immediately.
58
- 6. **LOG ALL ACTIVITY.** Every action append to `LOG.md` with timestamp.
59
- 7. **CITE SOURCES.** Every claim links back to its raw source file. Never fabricate.
60
- 8. **FLAG CONTRADICTIONS.** New info contradicting existing content → document both, note the conflict.
61
-
62
- ---
38
+ 1. **RAW IS IMMUTABLE.** Never edit `raw/`. Use `wiki_capture_source` to add sources.
39
+ 2. **META IS AUTO-GENERATED.** Never edit `meta/`. The extension rebuilds it automatically.
40
+ 3. **YOU OWN THE WIKI.** Create, update, and cross-reference everything in `wiki/`.
41
+ 4. **ONE FILE PER THING.** Each entity, concept, source gets its own `.md` file.
42
+ 5. **CROSS-REFERENCE EVERYTHING.** Every page needs at least 2 `[[wikilinks]]`.
43
+ 6. **CITE SOURCES.** Every claim links back to its raw source packet.
44
+ 7. **FLAG CONTRADICTIONS.** When sources disagree, document both sides.
45
+
46
+ ## How the Extension Helps You
47
+
48
+ | Task | Before (skill-only) | Now (extension-backed) |
49
+ | ------------------ | ---------------------------- | ------------------------------------- |
50
+ | Track ingestion | Manual `history.json` | Automatic via `meta/registry.json` |
51
+ | Update INDEX | Manual edit after every page | Auto-rebuilds on turn end |
52
+ | Update LOG | Manual append | Auto-generated from `events.jsonl` |
53
+ | Find orphans | Shell `grep` scans | Instant from `backlinks.json` |
54
+ | Block raw edits | Skill says "don't" | Extension **enforces** immutability |
55
+ | Create source page | 8 tool calls | `wiki_capture_source` + LLM synthesis |
56
+
57
+ ## Available Tools
58
+
59
+ Use these directly — they handle scaffolding and bookkeeping:
60
+
61
+ - `wiki_bootstrap` — Initialize a new vault
62
+ - `wiki_capture_source` — Capture URL/file/text into immutable packet + skeleton page
63
+ - `wiki_ingest` — Get batch of uningested sources with extracted text
64
+ - `wiki_ensure_page` — Create entity/concept/synthesis/analysis page from template
65
+ - `wiki_search` — Search registry for existing pages
66
+ - `wiki_lint` — Health check (orphans, missing, contradictions, gaps)
67
+ - `wiki_status` — Instant stats
68
+ - `wiki_rebuild_meta` — Force metadata rebuild
69
+ - `wiki_log_event` — Record a custom event
70
+ - `wiki_watch` — Schedule auto-updates
63
71
 
64
72
  ## Workflows
65
73
 
66
- ### `/wiki-init` Initialize a new wiki
67
-
68
- **When:** The user wants to start a new wiki on a topic.
69
-
70
- 1. Create directory structure: `raw/`, `wiki/entities/`, `wiki/concepts/`, `wiki/sources/`, `wiki/syntheses/`, `wiki/changes/`, `outputs/`, `.discoveries/`
71
- 2. Create `config.yaml` with the topic, any feeds, and default settings
72
- 3. Create `wiki/INDEX.md` with placeholder sections
73
- 4. Create `wiki/LOG.md` with initial entry
74
- 5. Create `wiki/DASHBOARD.md` with Dataview queries
75
- 6. Report the structure and suggest first steps
76
-
77
- ### `/wiki-ingest [path]` — Process new sources
78
-
79
- **When:** New files appear in `raw/`. Process one or all new sources.
80
-
81
- 1. Read `config.yaml` and this schema (for rules)
82
- 2. Read `.discoveries/history.json` → get already-processed files
83
- 3. Scan `raw/` → identify files not yet in history
84
- 4. For each new source file:
85
- a. Read the full content (use `read` for text, `fetch_content` for URLs, bash for PDF text extraction)
86
- b. Discuss key takeaways with the user (1-2 sentence summary, ask if they want emphasis on anything)
87
- c. Create a source summary page in `wiki/sources/`:
88
- ```markdown
89
- ---
90
- type: source
91
- format: article | paper | note | video | slack | podcast
92
- raw_path: raw/articles/filename.md
93
- ingested: YYYY-MM-DD
94
- topics: [topic1, topic2]
95
- ---
96
-
97
- # Source Title
98
-
99
- ## Summary
100
-
101
- [2-3 paragraph summary of key content]
102
-
103
- ## Key Takeaways
104
-
105
- - [Bullet points of most important points]
106
-
107
- ## Entities Mentioned
108
-
109
- - [[entity-name]]
110
-
111
- ## Concepts Mentioned
112
-
113
- - [[concept-name]]
114
-
115
- ## Notable Quotes
116
-
117
- > "Quote" — attribution
118
- ```
119
- d. Create or update entity pages in `wiki/entities/`:
120
- ```markdown
121
- ---
122
- type: entity
123
- category: person | organization | tool | project | product
124
- created: YYYY-MM-DD
125
- updated: YYYY-MM-DD
126
- sources: [raw/articles/filename.md]
127
- ---
128
-
129
- # Entity Name
130
-
131
- One-line description.
132
-
133
- ## Overview
134
-
135
- [Key facts, role, significance]
136
-
137
- ## Links
138
-
139
- - [[related-concept]]
140
- - [[related-entity]]
141
-
142
- ## Sources
143
-
144
- - [raw/articles/filename.md](../raw/articles/filename.md)
145
- ```
146
- e. Create or update concept pages in `wiki/concepts/`:
147
- ```markdown
148
- ---
149
- type: concept
150
- domain: ai | engineering | business | product | design | personal
151
- created: YYYY-MM-DD
152
- updated: YYYY-MM-DD
153
- sources: [raw/articles/filename.md]
154
- ---
155
-
156
- # Concept Name
157
-
158
- One-line definition.
159
-
160
- ## Definition
161
-
162
- [Clear explanation]
163
-
164
- ## How It Works
165
-
166
- [Technical details if applicable]
167
-
168
- ## Examples
169
-
170
- [Concrete examples from sources]
171
-
172
- ## Links
173
-
174
- - [[related-concept]]
175
-
176
- ## Sources
177
-
178
- - [raw/articles/filename.md](../raw/articles/filename.md)
179
- ```
180
- f. Add `[[wikilinks]]` cross-references to all related pages
181
- g. Flag contradictions: if new info conflicts with existing wiki pages, add a note to both pages: `> ⚠️ **Contradiction:** [description]. See [[other-page]] and [source](../raw/path).`
182
- 5. Update `wiki/INDEX.md` — add entries for every new or updated page
183
- 6. Append to `wiki/LOG.md`: `## [YYYY-MM-DD HH:mm] ingest | [filename] | [N] pages affected`
184
- 7. Update `.discoveries/history.json`
185
- 8. Report summary: `Ingested [N] sources → [M] wiki pages created/updated. [X] contradictions flagged.`
186
-
187
- **Rules:**
188
-
189
- - One source can affect 5-15 wiki pages
190
- - Never fabricate — only write what's in the raw sources
191
- - If a file can't be read → log the error, skip it, continue
192
- - Batch size: process files one at a time for quality, or batch up to 5 for speed
74
+ ### Capture Ingest Synthesize
193
75
 
194
- ### `/wiki-query <question>` Ask questions against the wiki
76
+ 1. **Capture**: `wiki_capture_source(url="...")` creates packet + skeleton
77
+ 2. **Ingest**: `wiki_ingest()` → get batch of sources needing synthesis
78
+ 3. **Read**: `read raw/sources/SRC-*/extracted.md`
79
+ 4. **Write**: Update skeleton source page with summary, entities, concepts
80
+ 5. **Ensure**: `wiki_ensure_page(type="entity", title="...")` for each entity
81
+ 6. **Cross-ref**: Add `[[wikilinks]]` between related pages
82
+ 7. **Done**: Extension auto-rebuilds metadata
195
83
 
196
- **When:** The user asks a question about wiki content.
84
+ ### Query Answer File
197
85
 
198
- 1. Read `wiki/INDEX.md` to identify relevant pages
199
- 2. Read those pages (get enough context — don't stop at 1-2 pages)
200
- 3. Synthesize an answer with `[[wikilink]]` citations to specific pages
201
- 4. If the answer is novel or analytically valuable → save it as a synthesis page in `wiki/syntheses/`
202
- 5. Append to `wiki/LOG.md`
203
- 6. Report the answer clearly with citations
204
-
205
- **Rules:**
206
-
207
- - Answer ONLY from wiki content, not from general knowledge
208
- - If the wiki lacks sufficient information → say so clearly, suggest what sources would help
209
- - Comparisons, analyses, and new connections → always save as synthesis pages (knowledge compounds)
210
-
211
- ### `/wiki-lint` — Health check the wiki
212
-
213
- **When:** The user asks for a health check, or periodically.
214
-
215
- 1. Read `wiki/INDEX.md` and scan all files in `wiki/`
216
- 2. Check for:
217
- - **Contradictions**: Claims that conflict between pages. Read related pages together to verify consistency.
218
- - **Orphans**: Pages with zero inbound `[[wikilinks]]`
219
- - **Missing pages**: `[[links]]` pointing to files that don't exist
220
- - **Stale claims**: Information superseded by newer sources (check dates)
221
- - **Broken raw links**: Links to `raw/` files that no longer exist
222
- - **Knowledge gaps**: Important concepts mentioned but lacking their own page
223
- - **Quality issues**: Pages under 3 lines, pages with no sources, pages with no cross-references
224
- 3. Auto-fix: fix broken links, create missing pages for frequently-linked concepts, add cross-refs to orphans
225
- 4. If contradictions found → flag them, don't silently resolve (ask the human which version is correct)
226
- 5. Save report → `outputs/lint-YYYY-MM-DD.md`
227
- 6. Update `.discoveries/gaps.json` with discovered gaps
228
- 7. Append to `wiki/LOG.md`
229
- 8. Report key findings
230
-
231
- ### `/wiki-discover` — Auto-discover new sources
232
-
233
- **When:** The user wants to find new content for the wiki.
234
-
235
- 1. Read `config.yaml` → extract topics, keywords, feeds, subreddits
236
- 2. Read `.discoveries/gaps.json` → knowledge gaps identified by lint
237
- 3. Read `.discoveries/history.json` → URLs already fetched
238
- 4. Search for new sources using:
239
- - **Web search**: Search topics + keywords from config
240
- - **Gap filling**: Search for gaps identified in `.discoveries/gaps.json`
241
- - **Trending**: Search for latest content on each topic
242
- 5. For each promising source found:
243
- a. Fetch the full content (use `fetch_content` or `web_search`)
244
- b. Save to `raw/articles/YYYY-MM-DD-slug.md` with frontmatter:
245
- ```markdown
246
- ---
247
- title: "Original Title"
248
- url: "https://..."
249
- discovered: YYYY-MM-DD
250
- topic: "topic-name"
251
- ---
252
- ```
253
- 6. Update `.discoveries/history.json`
254
- 7. Report: `Discovered [N] new sources. Run /wiki-ingest to process them.`
255
-
256
- **Rules:**
257
-
258
- - Max 5-10 new sources per discover cycle
259
- - Skip: ads, shallow listicles, duplicates, paywalled content
260
- - Prefer: in-depth articles, papers, guides, high-quality analysis
261
-
262
- ### `/wiki-run` — Full cycle: discover → ingest → lint
263
-
264
- **When:** The user wants a complete refresh.
265
-
266
- 1. Run `discover` → find new sources
267
- 2. Run `ingest` → process all new files in `raw/`
268
- 3. Run `lint` → health check
269
- 4. If lint found critical gaps → optionally run one more discover+ingest cycle
270
- 5. Save summary report → `outputs/run-YYYY-MM-DD.md`
271
- 6. Report final summary
272
-
273
- ### `/wiki-status` — Show wiki health
274
-
275
- **When:** The user wants a quick overview.
276
-
277
- Report:
278
-
279
- ```
280
- 📊 LLM Wiki Status
281
- ══════════════════
282
- Wiki Roots: [topic1], [topic2]
283
- Sources: [N] files
284
- Wiki Pages: [N] total ([E] entities, [C] concepts, [S] sources, [Y] syntheses)
285
- Last Ingest: YYYY-MM-DD
286
- Last Lint: YYYY-MM-DD
287
- Orphans: [N]
288
- Knowledge Gaps: [N]
289
- Health: ✅ Good | ⚠️ Warning | 🔴 Needs Attention
290
- ```
291
-
292
- ### `/wiki-digest` — Daily/Weekly digest
293
-
294
- **When:** The user wants a summary of recent changes.
295
-
296
- 1. Read `wiki/LOG.md` — filter entries since last digest
297
- 2. Summarize: new sources ingested, pages created/updated, insights discovered
298
- 3. Report in a concise digest format
299
- 4. Save → `outputs/digest-YYYY-MM-DD.md`
300
-
301
- ### `/wiki-watch <interval>` — Auto-run on schedule
302
-
303
- **When:** The user wants the wiki to stay current automatically.
304
-
305
- Set up a recurring schedule using pi's schedule system:
306
-
307
- ```
308
- /wiki-watch daily → schedule_prompt action=add schedule="0 0 8 * * *" prompt="Run `/wiki-run` for the LLM Wiki"
309
- /wiki-watch weekly → schedule_prompt action=add schedule="0 0 9 * * 1" prompt="Run `/wiki-run` for the LLM Wiki"
310
- /wiki-watch hourly → schedule_prompt action=add schedule="0 0 * * * *" prompt="Run `/wiki-run` for the LLM Wiki"
311
- /wiki-watch stop → list and remove scheduled wiki jobs
312
- ```
313
-
314
- ---
86
+ 1. `wiki_search(query="...")` to find relevant pages
87
+ 2. Read those pages
88
+ 3. Synthesize answer with `[[wikilink]]` citations
89
+ 4. If novel: create analysis page via `wiki_ensure_page(type="analysis")`
90
+ 5. Extension auto-updates metadata
315
91
 
316
92
  ## Page Conventions
317
93
 
318
94
  ### Naming
319
95
 
320
- - File names: `kebab-case.md` (e.g., `attention-mechanism.md`, `elon-musk.md`)
321
- - Entity names: full name lowercased, hyphenated
322
- - Concept names: brief descriptive slug
96
+ - `kebab-case.md` for all files
97
+ - Folder-qualified wikilinks: `[[concepts/retrieval-augmented-generation]]`
323
98
 
324
99
  ### Frontmatter
325
100
 
326
- Every page MUST have YAML frontmatter:
327
-
328
101
  ```yaml
329
102
  ---
330
- type: entity | concept | source | synthesis | change
103
+ type: entity | concept | source | synthesis | analysis
331
104
  created: YYYY-MM-DD
332
105
  updated: YYYY-MM-DD
333
- sources: [raw/path1.md, raw/path2.md]
106
+ sources: [sources/SRC-YYYY-MM-DD-NNN]
334
107
  ---
335
108
  ```
336
109
 
337
- Entity pages also need: `category: person | organization | tool | project | product`
338
- Concept pages also need: `domain: ai | engineering | business | product | design | personal`
110
+ Entity: add `category: person | organization | tool | project | product`
111
+ Concept: add `domain: ai | engineering | business | product | design | personal`
339
112
 
340
- ### Cross-references
113
+ ### Citations
341
114
 
342
- - Internal links: `[[kebab-case-file-name]]`
343
- - External links: `[text](url)`
344
- - Source citations: `[Source: filename](../raw/path/file.md)`
345
- - Every page needs ≥2 `[[wikilinks]]`
115
+ Use stable source IDs: `[[sources/SRC-2026-04-28-001]]`
346
116
 
347
117
  ### Contradictions
348
118
 
349
- When sources disagree, document both sides:
350
-
351
119
  ```markdown
352
120
  > ⚠️ **Contradiction:** Source A claims X, but Source B claims Y.
353
- > See [[page-a]] and [[page-b]] for details.
354
- >
355
- > - X: [Source A](../raw/path/a.md)
356
- > - Y: [Source B](../raw/path/b.md)
121
+ > See [[page-a]] and [[page-b]].
357
122
  ```
358
123
 
359
- ---
360
-
361
124
  ## Variants
362
125
 
363
- ### Personal Wiki (`config.yaml → wiki_mode: personal`)
364
-
365
- Track: learning, journaling, book notes, health, goals, reflections.
366
-
367
- - Extra folders: `wiki/journal/`, `wiki/goals/`
368
- - Personal entities: people you meet, books you read, courses you take
369
- - Daily journal entries can be ingested as raw notes
126
+ ### Personal Wiki
370
127
 
371
- ### Company Wiki (`config.yaml → wiki_mode: company`)
128
+ - Extra: `wiki/journal/`, `wiki/goals/`
129
+ - Track: learning, books, health, reflections
372
130
 
373
- Track: competitors, market research, customer calls, internal docs, strategy.
131
+ ### Company Wiki
374
132
 
375
- - Extra folders: `wiki/changes/`, `wiki/decisions/`
376
- - Change detection: re-check competitor sources for pricing/feature changes
377
- - Slack/email threads as sources
378
- - Confidence levels in frontmatter: `confidence: high | medium | low`
379
-
380
- ---
133
+ - Extra: `wiki/changes/`, `wiki/decisions/`
134
+ - Track: competitors, market, strategy
135
+ - Frontmatter: `confidence: high | medium | low`
381
136
 
382
137
  ## Obsidian Integration
383
138
 
384
- This wiki is designed to be opened as an Obsidian vault (`wiki/` directory).
385
-
386
- **Recommended Obsidian plugins:**
139
+ Open `wiki/` as an Obsidian vault. The extension generates:
387
140
 
388
- - **Dataview**Query pages by frontmatter (type, confidence, domain)
389
- - **Graph View** Visualize `[[wikilink]]` connections
390
- - **Backlinks**See what links to each page
391
- - **Spaced Repetition** — Flashcards from `wiki/flashcards.md`
392
- - **Charts View** — Dashboard analytics
393
- - **Marp** — Markdown slide decks
141
+ - `meta/index.md`browsable catalog
142
+ - `meta/backlinks.json`for graph plugins
143
+ - `[[wikilinks]]`native Obsidian links
394
144
 
395
- **The `wiki/DASHBOARD.md`** page includes Dataview queries that surface:
396
-
397
- - Low-confidence pages needing review
398
- - Recent updates
399
- - Concepts by domain
400
- - Pages with the most sources
401
-
402
- ---
403
-
404
- ## Scheduling (Auto-Update)
405
-
406
- To keep the wiki always fresh, use pi's scheduling:
407
-
408
- ```bash
409
- # Daily at 8 AM — discover + ingest + lint
410
- /wiki-watch daily
411
-
412
- # Or manually:
413
- /wiki-run
414
- ```
415
-
416
- The schedule checks your configured topics, discovers new sources, ingests them, and lints for health — all automatically.
417
-
418
- ---
145
+ Recommended plugins: Dataview, Graph View, Backlinks
419
146
 
420
147
  ## Tips
421
148
 
422
- - **Obsidian Web Clipper** Browser extension that saves articles as markdown. Clip directly into `raw/articles/`.
423
- - **Download images**: In Obsidian Settings Files & Links → set "Attachment folder path" to `raw/assets/`. After clipping, use "Download attachments" (Ctrl+Shift+D).
424
- - **Git versioning**: The wiki is a git repo. Every ingest is a commit. Revert bad ingests, review evolution.
425
- - **Start small**: 3-5 sources. Let the wiki grow organically. Don't try to ingest everything at once.
426
- - **Evolve the schema**: As you use the wiki, you'll find what works. Update rules here as you go.
149
+ - **Start small:** 3-5 sources, let it grow organically
150
+ - **Batch efficiently:** Plan all pages for a source, then write them rapidly
151
+ - **Trust the extension:** Never waste tokens updating INDEX.md or LOG.md manually
152
+ - **Evolve the schema:** Update `WIKI_SCHEMA.md` as conventions mature
@@ -0,0 +1,35 @@
1
+ ---
2
+ type: analysis
3
+ topic: ""
4
+ created: YYYY-MM-DD
5
+ updated: YYYY-MM-DD
6
+ sources_count: 0
7
+ ---
8
+
9
+ # Analysis Title
10
+
11
+ > _Durable answer derived from wiki content._
12
+
13
+ ## Question
14
+
15
+ [The original question that drove this analysis.]
16
+
17
+ ## Answer
18
+
19
+ [Synthesized answer with [[wikilink]] citations to specific pages.]
20
+
21
+ ## Key Insights
22
+
23
+ 1. [Insight 1]
24
+ 2. [Insight 2]
25
+ 3. [Insight 3]
26
+
27
+ ## Sources Used
28
+
29
+ - [[source-1]]
30
+ - [[source-2]]
31
+
32
+ ## Related Pages
33
+
34
+ - [[concept-1]]
35
+ - [[entity-1]]
@@ -89,7 +89,7 @@ describe("package structure", () => {
89
89
  expect(content).toContain("## Golden Rules");
90
90
  expect(content).toContain("RAW IS IMMUTABLE");
91
91
  expect(content).toContain("## Workflows");
92
- expect(content).toContain("/wiki-ingest");
92
+ expect(content).toContain("wiki_ingest");
93
93
  expect(content).toContain("Obsidian Integration");
94
94
  expect(content).toContain("Personal Wiki");
95
95
  expect(content).toContain("Company Wiki");
@@ -111,11 +111,33 @@ describe("package structure", () => {
111
111
  expect(existsSync(path)).toBe(true);
112
112
  const content = readFile(path);
113
113
  expect(content).toContain("description:");
114
+ expect(content).toContain("argument-hint:");
114
115
  expect(content).toContain("section: LLM Wiki");
115
116
  expect(content).toContain("topLevelCli: true");
117
+ expect(content).not.toContain("\nargs:");
116
118
  }
117
119
  });
118
120
 
121
+ it("should include prompt arguments in templates that accept them", () => {
122
+ const promptsWithArgs = [
123
+ "wiki-init.md",
124
+ "wiki-ingest.md",
125
+ "wiki-query.md",
126
+ "wiki-lint.md",
127
+ "wiki-discover.md",
128
+ "wiki-run.md",
129
+ "wiki-digest.md",
130
+ ];
131
+ for (const prompt of promptsWithArgs) {
132
+ const content = readFile(join(rootDir, "prompts", prompt));
133
+ expect(content).toContain("$ARGUMENTS");
134
+ }
135
+
136
+ const query = readFile(join(rootDir, "prompts", "wiki-query.md"));
137
+ expect(query).toContain("## User Question");
138
+ expect(query).toContain("$ARGUMENTS");
139
+ });
140
+
119
141
  it("should have all wiki template files", () => {
120
142
  const t = join(rootDir, "skills", "llm-wiki", "templates");
121
143
  expect(existsSync(join(t, "INDEX.md"))).toBe(true);
@@ -128,17 +150,28 @@ describe("package structure", () => {
128
150
  expect(existsSync(join(t, "pages", "synthesis.md"))).toBe(true);
129
151
  });
130
152
 
131
- it("should have the extension file with all custom tools", () => {
132
- const extPath = join(rootDir, "extensions", "llm-wiki-tools.ts");
153
+ it("should have the extension entry point", () => {
154
+ const extPath = join(rootDir, "extensions", "llm-wiki", "index.ts");
133
155
  expect(existsSync(extPath)).toBe(true);
134
156
  const content = readFile(extPath);
135
157
  expect(content).toContain("ExtensionAPI");
136
- expect(content).toContain("registerTool");
158
+ expect(content).toContain("registerWikiBootstrap");
159
+ });
160
+
161
+ it("should have all custom tools in the extension", () => {
162
+ const toolsPath = join(rootDir, "extensions", "llm-wiki", "lib", "tools.ts");
163
+ expect(existsSync(toolsPath)).toBe(true);
164
+ const content = readFile(toolsPath);
137
165
  const tools = [
166
+ "wiki_bootstrap",
167
+ "wiki_capture_source",
138
168
  "wiki_ingest",
139
- "wiki_status_report",
140
- "wiki_lint_report",
141
- "wiki_discover_sources",
169
+ "wiki_ensure_page",
170
+ "wiki_search",
171
+ "wiki_lint",
172
+ "wiki_status",
173
+ "wiki_rebuild_meta",
174
+ "wiki_log_event",
142
175
  "wiki_watch",
143
176
  ];
144
177
  for (const tool of tools) {
@@ -146,14 +179,23 @@ describe("package structure", () => {
146
179
  }
147
180
  });
148
181
 
182
+ it("should keep MarkItDown timeout configurable and avoid PDF byte fallbacks", () => {
183
+ const sourcePacketPath = join(rootDir, "extensions", "llm-wiki", "lib", "source-packet.ts");
184
+ expect(existsSync(sourcePacketPath)).toBe(true);
185
+ const content = readFile(sourcePacketPath);
186
+ expect(content).toContain("WIKI_MARKITDOWN_TIMEOUT_MS");
187
+ expect(content).toContain("DEFAULT_MARKITDOWN_TIMEOUT_MS = 180_000");
188
+ expect(content).toContain("isPdfUrl(url)");
189
+ expect(content).toContain("looksLikePdf(curlResult.stdout)");
190
+ expect(content).toContain("pdfExtractionFailureMessage");
191
+ });
192
+
149
193
  it("should have a comprehensive README with install instructions", () => {
150
194
  const readme = readFile(join(rootDir, "README.md"));
151
195
  expect(readme).toContain("@zosmaai/pi-llm-wiki");
152
196
  expect(readme).toContain("pi install npm:@zosmaai/pi-llm-wiki");
153
197
  expect(readme).toContain("Karpathy");
154
198
  expect(readme).toContain("Obsidian");
155
- expect(readme).toContain("Personal Wiki");
156
- expect(readme).toContain("Company Wiki");
157
199
  });
158
200
  });
159
201