@zosmaai/pi-llm-wiki 0.1.2 โ 0.2.0
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.
- package/.coderabbit.yaml +43 -0
- package/.github/workflows/ci.yml +9 -8
- package/.github/workflows/codeql.yml +39 -0
- package/.github/workflows/release.yml +6 -4
- package/AGENTS.md +57 -0
- package/CHANGELOG.md +30 -0
- package/CONTRIBUTING.md +43 -0
- package/LICENSE +21 -0
- package/README.md +44 -344
- package/assets/README.md +3 -3
- package/assets/architecture.md +1 -1
- package/biome.json +3 -0
- package/docs/api.md +105 -0
- package/docs/architecture.md +65 -0
- package/docs/commands.md +51 -0
- package/docs/configuration.md +38 -0
- package/docs/obsidian.md +21 -0
- package/extensions/llm-wiki/index.ts +53 -0
- package/extensions/llm-wiki/lib/guardrails.ts +69 -0
- package/extensions/llm-wiki/lib/metadata.ts +218 -0
- package/extensions/llm-wiki/lib/source-packet.ts +292 -0
- package/extensions/llm-wiki/lib/tools.ts +932 -0
- package/extensions/llm-wiki/lib/utils.ts +222 -0
- package/package.json +11 -12
- package/prompts/wiki-digest.md +1 -1
- package/prompts/wiki-discover.md +2 -2
- package/prompts/wiki-ingest.md +2 -2
- package/prompts/wiki-init.md +2 -2
- package/prompts/wiki-lint.md +1 -1
- package/prompts/wiki-query.md +2 -2
- package/prompts/wiki-run.md +6 -6
- package/prompts/wiki-status.md +1 -1
- package/scripts/release.js +72 -0
- package/skills/llm-wiki/SKILL.md +95 -369
- package/skills/llm-wiki/templates/DASHBOARD.md +2 -2
- package/skills/llm-wiki/templates/pages/analysis.md +35 -0
- package/test/llm-wiki.test.ts +18 -9
- package/extensions/llm-wiki-tools.ts +0 -705
package/README.md
CHANGED
|
@@ -1,372 +1,72 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @zosmaai/pi-llm-wiki
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
[](https://github.com/zosmaai/pi-llm-wiki/actions/workflows/ci.yml)
|
|
4
|
+
[](https://www.npmjs.com/package/@zosmaai/pi-llm-wiki)
|
|
5
|
+
[](https://codecov.io/gh/zosmaai/pi-llm-wiki)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
[](https://github.com/zosmaai/pi-llm-wiki/actions/workflows/codeql.yml)
|
|
5
8
|
|
|
6
|
-
[
|
|
7
|
-
[](LICENSE)
|
|
8
|
-
[](https://gist.github.com/karpathy/442a6bf555914893e9891c19de94f)
|
|
9
|
-
[](https://obsidian.md)
|
|
9
|
+
Self-maintaining, Obsidian-compatible knowledge base for [pi](https://pi.dev). Following Andrej Karpathy's LLM Wiki pattern.
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
## โจ Features
|
|
14
|
-
|
|
15
|
-
| Capability | Description |
|
|
16
|
-
| ----------------- | ------------------------------------------------------------------------------------------------------------------ |
|
|
17
|
-
| **๐ฅ Ingest** | Drop any source into `raw/` โ the LLM reads, summarizes, extracts entities & concepts, cross-references everything |
|
|
18
|
-
| **๐ Query** | Ask questions against a persistent, interlinked knowledge base โ not raw chunks |
|
|
19
|
-
| **๐งน Lint** | Health-check the wiki: contradictions, orphans, missing pages, stale claims, knowledge gaps |
|
|
20
|
-
| **๐ Discover** | Auto-find new sources from the web based on your topics and known gaps |
|
|
21
|
-
| **๐ Full Cycle** | `run` = discover โ ingest โ lint. One command to refresh everything |
|
|
22
|
-
| **โฐ Watch** | Schedule automatic updates (daily/weekly/hourly) via pi's cron system |
|
|
23
|
-
| **๐ Status** | Quick dashboard showing wiki size, health, and last activity |
|
|
24
|
-
| **๐ Digest** | Daily/weekly summaries of what changed in the wiki |
|
|
25
|
-
|
|
26
|
-
### Two Modes
|
|
27
|
-
|
|
28
|
-
- **๐ค Personal Wiki** โ Learning, journaling, book notes, health, goals, reflections
|
|
29
|
-
- **๐ข Company Wiki** โ Competitor tracking, market research, customer calls, internal docs, change detection
|
|
30
|
-
|
|
31
|
-
### Obsidian Integration
|
|
32
|
-
|
|
33
|
-
Every `[[wikilink]]` the LLM creates becomes a visible connection in Obsidian's graph view. Includes Dataview dashboard, frontmatter for structured queries, and Marp-ready slide decks.
|
|
34
|
-
|
|
35
|
-
> "The wiki stays maintained because the cost of maintenance is near zero." โ Andrej Karpathy
|
|
36
|
-
|
|
37
|
-
---
|
|
38
|
-
|
|
39
|
-
## ๐ฆ What's Included
|
|
40
|
-
|
|
41
|
-
```
|
|
42
|
-
@zosmaai/pi-llm-wiki/
|
|
43
|
-
โโโ ๐ skills/llm-wiki/SKILL.md โ Core schema: architecture, workflows, conventions
|
|
44
|
-
โ โโโ templates/INDEX.md โ Master catalog template
|
|
45
|
-
โ โโโ templates/LOG.md โ Activity log template
|
|
46
|
-
โ โโโ templates/DASHBOARD.md โ Obsidian Dataview dashboard
|
|
47
|
-
โ โโโ templates/config.yaml โ Default configuration
|
|
48
|
-
โ โโโ templates/pages/ โ Page templates (entity, concept, source, synthesis)
|
|
49
|
-
โโโ ๐ง extensions/llm-wiki-tools.ts โ 5 custom tools for the LLM:
|
|
50
|
-
โ โโโ wiki_ingest Process new sources and update wiki pages
|
|
51
|
-
โ โโโ wiki_status_report Report wiki health and statistics
|
|
52
|
-
โ โโโ wiki_lint_report Scan for contradictions, orphans, gaps
|
|
53
|
-
โ โโโ wiki_discover_sources Find new source material from the web
|
|
54
|
-
โ โโโ wiki_watch Schedule auto-updates
|
|
55
|
-
โโโ ๐ฌ prompts/ โ 8 slash commands:
|
|
56
|
-
โโโ /wiki:init Initialize a new wiki
|
|
57
|
-
โโโ /wiki:ingest Process new sources
|
|
58
|
-
โโโ /wiki:query Ask questions against the wiki
|
|
59
|
-
โโโ /wiki:lint Health check
|
|
60
|
-
โโโ /wiki:discover Auto-discover sources
|
|
61
|
-
โโโ /wiki:run Full cycle (discover โ ingest โ lint)
|
|
62
|
-
โโโ /wiki:status Wiki health overview
|
|
63
|
-
โโโ /wiki:digest Daily/weekly summary
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
---
|
|
67
|
-
|
|
68
|
-
## ๐ Installation
|
|
69
|
-
|
|
70
|
-
### Prerequisites
|
|
71
|
-
|
|
72
|
-
- [pi coding agent](https://pi.dev) installed
|
|
73
|
-
- Node.js 20+
|
|
74
|
-
|
|
75
|
-
### Via npm (recommended)
|
|
76
|
-
|
|
77
|
-
```bash
|
|
78
|
-
pi install npm:@zosmaai/pi-llm-wiki@latest
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
### Via git
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
pi install git:github.com/zosmaai/pi-llm-wiki@v0.1.0
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
### Via local path (development)
|
|
88
|
-
|
|
89
|
-
```bash
|
|
90
|
-
git clone https://github.com/zosmaai/pi-llm-wiki.git
|
|
91
|
-
pi install ./pi-llm-wiki
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
### Verify Installation
|
|
95
|
-
|
|
96
|
-
```bash
|
|
97
|
-
pi list
|
|
98
|
-
# Should show: @zosmaai/pi-llm-wiki
|
|
99
|
-
|
|
100
|
-
# Check loaded resources:
|
|
101
|
-
pi --list-skills | grep llm-wiki
|
|
102
|
-
pi --list-tools | grep wiki
|
|
103
|
-
# Should show: wiki_ingest, wiki_status_report, wiki_lint_report, wiki_discover_sources, wiki_watch
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
---
|
|
107
|
-
|
|
108
|
-
## ๐ฏ Quick Start
|
|
109
|
-
|
|
110
|
-
### 1๏ธโฃ Initialize a new wiki
|
|
11
|
+
## Install
|
|
111
12
|
|
|
112
13
|
```bash
|
|
113
|
-
pi
|
|
14
|
+
pi install npm:@zosmaai/pi-llm-wiki
|
|
114
15
|
```
|
|
115
16
|
|
|
116
|
-
|
|
17
|
+
## Quick Start
|
|
117
18
|
|
|
118
19
|
```
|
|
119
|
-
/wiki
|
|
20
|
+
/wiki-init "AI Engineering"
|
|
120
21
|
```
|
|
121
22
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
### 2๏ธโฃ Add your first sources
|
|
125
|
-
|
|
126
|
-
Drop content into `raw/`:
|
|
127
|
-
|
|
128
|
-
- Use [Obsidian Web Clipper](https://obsidian.md/clipper) to save articles
|
|
129
|
-
- Save meeting notes, transcripts, or research papers
|
|
130
|
-
- Export Slack threads or email threads
|
|
131
|
-
|
|
132
|
-
### 3๏ธโฃ Ingest
|
|
23
|
+
Drop sources into `raw/`, then:
|
|
133
24
|
|
|
134
25
|
```
|
|
135
|
-
/wiki
|
|
26
|
+
/wiki-ingest
|
|
27
|
+
/wiki-query What are the key patterns?
|
|
136
28
|
```
|
|
137
29
|
|
|
138
|
-
|
|
30
|
+
## What It Does
|
|
139
31
|
|
|
140
|
-
|
|
32
|
+
| Tool | Purpose |
|
|
33
|
+
| --------------------- | --------------------------------------------- |
|
|
34
|
+
| `wiki_bootstrap` | Initialize a new wiki vault |
|
|
35
|
+
| `wiki_capture_source` | Capture URL/file/text into immutable packet |
|
|
36
|
+
| `wiki_ingest` | Process sources into wiki pages |
|
|
37
|
+
| `wiki_ensure_page` | Create entity/concept/synthesis/analysis page |
|
|
38
|
+
| `wiki_search` | Search the wiki registry |
|
|
39
|
+
| `wiki_lint` | Health check (orphans, gaps, contradictions) |
|
|
40
|
+
| `wiki_status` | Stats dashboard |
|
|
41
|
+
| `wiki_rebuild_meta` | Force metadata rebuild |
|
|
42
|
+
| `wiki_log_event` | Record custom event |
|
|
43
|
+
| `wiki_watch` | Schedule auto-updates |
|
|
141
44
|
|
|
142
|
-
|
|
143
|
-
/wiki:query What are the key patterns in modern AI engineering?
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
The LLM answers from your wiki, not from general knowledge โ giving you answers grounded in your curated sources.
|
|
45
|
+
## Architecture
|
|
147
46
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
```bash
|
|
151
|
-
# Auto-update daily at 8 AM
|
|
152
|
-
/wiki:run --schedule daily
|
|
47
|
+
Four layers with clear ownership:
|
|
153
48
|
|
|
154
|
-
# Or run manually anytime
|
|
155
|
-
/wiki:run
|
|
156
49
|
```
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
<p align="center">
|
|
163
|
-
<img src="https://raw.githubusercontent.com/zosmaai/pi-llm-wiki/master/assets/screenshot.png" alt="LLM Wiki Architecture" width="90%">
|
|
164
|
-
</p>
|
|
165
|
-
|
|
166
|
-
<p align="center">
|
|
167
|
-
<em>Three-layer architecture: raw sources โ LLM-managed wiki โ Obsidian frontend</em>
|
|
168
|
-
</p>
|
|
169
|
-
|
|
170
|
-
The LLM Wiki follows a three-layer architecture:
|
|
171
|
-
|
|
50
|
+
raw/sources/SRC-*/ # Immutable source packets (extension-owned)
|
|
51
|
+
wiki/ # Editable knowledge pages (you + LLM)
|
|
52
|
+
meta/ # Auto-generated registry, backlinks, index, log
|
|
53
|
+
.wiki/ # Config and templates
|
|
172
54
|
```
|
|
173
|
-
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
174
|
-
โ YOU (curate & ask) โ
|
|
175
|
-
โโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโค
|
|
176
|
-
โ wiki/ โ outputs/ โ Obsidian vault โ
|
|
177
|
-
โ (read only) โ (reports, digests) โ (graph view, UI) โ
|
|
178
|
-
โโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโค
|
|
179
|
-
โ LLM (writes & maintains) โ
|
|
180
|
-
โโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
|
|
181
|
-
โ raw/ โ schema/SKILL.md โ
|
|
182
|
-
โ (immutable sources) โ (rules & conventions) โ
|
|
183
|
-
โโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
### Directory Structure
|
|
187
55
|
|
|
188
|
-
|
|
189
|
-
my-wiki/
|
|
190
|
-
โโโ raw/ โ You add sources here (immutable)
|
|
191
|
-
โ โโโ articles/ Web articles (markdown)
|
|
192
|
-
โ โโโ papers/ Research papers
|
|
193
|
-
โ โโโ notes/ Personal notes
|
|
194
|
-
โ โโโ slack/ Slack thread exports
|
|
195
|
-
โ โโโ assets/ Downloaded images
|
|
196
|
-
โโโ wiki/ โ LLM manages this entirely
|
|
197
|
-
โ โโโ INDEX.md Master catalog
|
|
198
|
-
โ โโโ LOG.md Activity log
|
|
199
|
-
โ โโโ DASHBOARD.md Obsidian Dataview dashboard
|
|
200
|
-
โ โโโ entities/ People, orgs, tools, products
|
|
201
|
-
โ โโโ concepts/ Ideas, patterns, frameworks
|
|
202
|
-
โ โโโ sources/ One summary per source
|
|
203
|
-
โ โโโ syntheses/ Cross-cutting analyses
|
|
204
|
-
โ โโโ changes/ Change detection records
|
|
205
|
-
โโโ outputs/ Reports and digests
|
|
206
|
-
โโโ config.yaml Wiki configuration
|
|
207
|
-
โโโ .discoveries/ Auto-discovery metadata
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
---
|
|
211
|
-
|
|
212
|
-
## ๐ฌ All Commands
|
|
213
|
-
|
|
214
|
-
| Command | Description | Example |
|
|
215
|
-
| ---------------- | ------------------- | ----------------------------------------- |
|
|
216
|
-
| `/wiki:init` | Create a new wiki | `/wiki:init "Rust Programming"` |
|
|
217
|
-
| `/wiki:ingest` | Process new sources | `/wiki:ingest raw/articles/my-article.md` |
|
|
218
|
-
| `/wiki:query` | Ask a question | `/wiki:query "Compare RAG vs LLM Wiki"` |
|
|
219
|
-
| `/wiki:lint` | Health check | `/wiki:lint --fix` |
|
|
220
|
-
| `/wiki:discover` | Find new sources | `/wiki:discover --topic "AI agents"` |
|
|
221
|
-
| `/wiki:run` | Full cycle | `/wiki:run --schedule daily` |
|
|
222
|
-
| `/wiki:status` | Show health | `/wiki:status` |
|
|
223
|
-
| `/wiki:digest` | Daily summary | `/wiki:digest --period weekly` |
|
|
224
|
-
|
|
225
|
-
---
|
|
226
|
-
|
|
227
|
-
## ๐ง Custom Tools (Extension)
|
|
228
|
-
|
|
229
|
-
The included TypeScript extension registers 5 tools the LLM can call directly:
|
|
230
|
-
|
|
231
|
-
| Tool | Purpose |
|
|
232
|
-
| ----------------------- | ----------------------------------------------- |
|
|
233
|
-
| `wiki_ingest` | Prepare and track files for ingestion |
|
|
234
|
-
| `wiki_status_report` | Gather wiki statistics and health metrics |
|
|
235
|
-
| `wiki_lint_report` | Scan for issues (orphans, contradictions, gaps) |
|
|
236
|
-
| `wiki_discover_sources` | Prepare discovery parameters from config |
|
|
237
|
-
| `wiki_watch` | Generate schedule commands |
|
|
238
|
-
|
|
239
|
-
These tools handle the scaffolding and bookkeeping so the LLM can focus on the actual knowledge work โ reading, synthesizing, and writing wiki pages.
|
|
240
|
-
|
|
241
|
-
---
|
|
242
|
-
|
|
243
|
-
## ๐ Using with Obsidian
|
|
244
|
-
|
|
245
|
-
<p align="center">
|
|
246
|
-
<img src="https://raw.githubusercontent.com/zosmaai/pi-llm-wiki/master/assets/knowledge-graph.png" alt="Knowledge Graph" width="90%">
|
|
247
|
-
</p>
|
|
248
|
-
|
|
249
|
-
<p align="center">
|
|
250
|
-
<em>The LLM automatically connects entities, concepts, and sources with [[wikilinks]] โ viewable in Obsidian's graph view</em>
|
|
251
|
-
</p>
|
|
252
|
-
|
|
253
|
-
1. Open the `wiki/` directory as an Obsidian vault
|
|
254
|
-
2. Install these plugins:
|
|
255
|
-
- [Dataview](https://github.com/blacksmithgu/obsidian-dataview) โ Query pages by frontmatter
|
|
256
|
-
- [Graph View](https://obsidian.md) (built-in) โ Visualize [[wikilink]] connections
|
|
257
|
-
- [Spaced Repetition](https://github.com/st3v3nmw/obsidian-spaced-repetition) โ Flashcards
|
|
258
|
-
- [Charts View](https://github.com/caronchen/obsidian-chartsview-plugin) โ Dashboard analytics
|
|
259
|
-
- [Marp](https://marp.app/) โ Markdown slide decks
|
|
260
|
-
3. Browse the graph view to discover connections the LLM found
|
|
261
|
-
4. Use the `DASHBOARD.md` for live analytics
|
|
262
|
-
|
|
263
|
-
### Obsidian Web Clipper
|
|
264
|
-
|
|
265
|
-
Use the [Obsidian Web Clipper](https://obsidian.md/clipper) browser extension to save articles directly into `raw/articles/`. Set attachment folder to `raw/assets/` in Obsidian settings.
|
|
266
|
-
|
|
267
|
-
---
|
|
268
|
-
|
|
269
|
-
## ๐ข Personal vs. Company Wiki
|
|
270
|
-
|
|
271
|
-
### Personal Wiki (`config.yaml: mode: personal`)
|
|
272
|
-
|
|
273
|
-
Best for: Learning, research, journaling, book notes, health tracking, goals.
|
|
274
|
-
|
|
275
|
-
- Extra folders: `wiki/journal/`, `wiki/goals/`
|
|
276
|
-
- Daily journal entries can be ingested as raw sources
|
|
277
|
-
- Track people you meet, books you read, courses you take
|
|
278
|
-
|
|
279
|
-
### Company Wiki (`config.yaml: mode: company`)
|
|
280
|
-
|
|
281
|
-
Best for: Competitive intelligence, market research, customer insights, internal documentation.
|
|
282
|
-
|
|
283
|
-
- Extra folders: `wiki/decisions/`, `wiki/changes/`
|
|
284
|
-
- **Change detection** โ Re-check competitor sources for pricing, feature, and positioning changes
|
|
285
|
-
- Confidence levels in frontmatter: `high | medium | low`
|
|
286
|
-
- Slack/email thread exports as sources
|
|
287
|
-
- Generate battlecards with `/wiki:query "Create a battlecard for Competitor X"`
|
|
288
|
-
|
|
289
|
-
---
|
|
290
|
-
|
|
291
|
-
## โฐ Scheduling (Auto-Update)
|
|
292
|
-
|
|
293
|
-
Keep your wiki current without thinking about it:
|
|
294
|
-
|
|
295
|
-
```bash
|
|
296
|
-
# Inside pi
|
|
297
|
-
/wiki:run --schedule daily # Discover โ ingest โ lint every day at 8 AM
|
|
298
|
-
/wiki:run --schedule weekly # Every Monday at 9 AM
|
|
299
|
-
/wiki:run --schedule hourly # Every hour (for fast-moving topics)
|
|
300
|
-
```
|
|
301
|
-
|
|
302
|
-
The scheduler uses pi's built-in `schedule_prompt` system. All operations run in the background and the wiki stays updated.
|
|
303
|
-
|
|
304
|
-
---
|
|
305
|
-
|
|
306
|
-
## ๐ Examples
|
|
307
|
-
|
|
308
|
-
### Research Wiki
|
|
309
|
-
|
|
310
|
-
```bash
|
|
311
|
-
/wiki:init "LLM Agents"
|
|
312
|
-
# Drop 5 papers into raw/papers/
|
|
313
|
-
/wiki:ingest
|
|
314
|
-
# Creates ~30-50 wiki pages (entities, concepts, cross-refs)
|
|
315
|
-
/wiki:query "What are the main approaches to tool use in LLM agents?"
|
|
316
|
-
/wiki:lint
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
### Book Companion
|
|
320
|
-
|
|
321
|
-
```bash
|
|
322
|
-
/wiki:init "Dune" --mode personal
|
|
323
|
-
# Drop chapter notes into raw/notes/
|
|
324
|
-
/wiki:ingest raw/notes/ch01-opening-test.md
|
|
325
|
-
/wiki:query "Who are the main factions and what do they want?"
|
|
326
|
-
/wiki:query "Create a timeline of events up to Chapter 5"
|
|
327
|
-
```
|
|
328
|
-
|
|
329
|
-
### Competitive Intelligence
|
|
330
|
-
|
|
331
|
-
```bash
|
|
332
|
-
/wiki:init "PM Tool Market" --mode company
|
|
333
|
-
# Drop competitor landing pages, reviews, pricing pages
|
|
334
|
-
/wiki:ingest
|
|
335
|
-
/wiki:query "Create a comparison table of Linear, Notion, and Jira"
|
|
336
|
-
/wiki:run --schedule weekly
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
---
|
|
340
|
-
|
|
341
|
-
## ๐ค Contributing
|
|
342
|
-
|
|
343
|
-
Contributions are welcome! This package is maintained at [zosmaai/pi-llm-wiki](https://github.com/zosmaai/pi-llm-wiki).
|
|
344
|
-
|
|
345
|
-
1. Fork the repo
|
|
346
|
-
2. Create a feature branch
|
|
347
|
-
3. Make your changes
|
|
348
|
-
4. Submit a PR
|
|
349
|
-
|
|
350
|
-
### Development
|
|
351
|
-
|
|
352
|
-
```bash
|
|
353
|
-
git clone https://github.com/zosmaai/pi-llm-wiki.git
|
|
354
|
-
cd pi-llm-wiki
|
|
355
|
-
npm install
|
|
356
|
-
pi install ./
|
|
357
|
-
```
|
|
56
|
+
Read [docs/architecture.md](docs/architecture.md) for details.
|
|
358
57
|
|
|
359
|
-
|
|
58
|
+
## Documentation
|
|
360
59
|
|
|
361
|
-
|
|
60
|
+
- [Architecture](docs/architecture.md) โ How the four layers work
|
|
61
|
+
- [Commands](docs/commands.md) โ All slash commands and tools
|
|
62
|
+
- [Obsidian Integration](docs/obsidian.md) โ Vault setup and recommended plugins
|
|
63
|
+
- [Configuration](docs/configuration.md) โ Wiki modes, topics, settings
|
|
64
|
+
- [API](docs/api.md) โ Extension tool reference
|
|
362
65
|
|
|
363
|
-
|
|
66
|
+
## Contributing
|
|
364
67
|
|
|
365
|
-
|
|
68
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
366
69
|
|
|
367
|
-
##
|
|
70
|
+
## License
|
|
368
71
|
|
|
369
|
-
|
|
370
|
-
- **mduongvandinh** โ For the comprehensive [llm-wiki](https://github.com/mduongvandinh/llm-wiki) reference implementation
|
|
371
|
-
- **tonbistudio** โ For the [clean template](https://github.com/tonbistudio/llm-wiki) this draws from
|
|
372
|
-
- **Vannevar Bush** โ For imagining the Memex in 1945. LLMs finally make it practical.
|
|
72
|
+
MIT
|
package/assets/README.md
CHANGED
|
@@ -4,10 +4,10 @@ Placeholder for gallery screenshots.
|
|
|
4
4
|
|
|
5
5
|
To generate a screenshot:
|
|
6
6
|
|
|
7
|
-
1. Create a wiki using `/wiki
|
|
8
|
-
2. Add a few sources and run `/wiki
|
|
7
|
+
1. Create a wiki using `/wiki-init`
|
|
8
|
+
2. Add a few sources and run `/wiki-ingest`
|
|
9
9
|
3. Open `wiki/` in Obsidian for the graph view screenshot
|
|
10
10
|
4. Save as `assets/screenshot.png`
|
|
11
11
|
|
|
12
12
|
The screenshot URL in package.json should point to:
|
|
13
|
-
`https://raw.githubusercontent.com/zosmaai/pi-llm-wiki/
|
|
13
|
+
`https://raw.githubusercontent.com/zosmaai/pi-llm-wiki/main/assets/screenshot.png`
|
package/assets/architecture.md
CHANGED
|
@@ -71,7 +71,7 @@ flowchart TB
|
|
|
71
71
|
| ---------- | -------------------- | ------------------------------------------------------------------------------------------- |
|
|
72
72
|
| **Ingest** | Add source to `raw/` | LLM reads, creates summary, updates 5-15 wiki pages, cross-references, flags contradictions |
|
|
73
73
|
| **Query** | Ask any question | LLM searches index, reads relevant pages, synthesizes answer with `[[citations]]` |
|
|
74
|
-
| **Lint** | `/wiki
|
|
74
|
+
| **Lint** | `/wiki-lint` | Health check: contradictions, orphans, missing pages, stale claims, knowledge gaps |
|
|
75
75
|
|
|
76
76
|
## Two Modes
|
|
77
77
|
|
package/biome.json
CHANGED
package/docs/api.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# API Reference
|
|
2
|
+
|
|
3
|
+
## Extension Tools
|
|
4
|
+
|
|
5
|
+
### wiki_bootstrap
|
|
6
|
+
|
|
7
|
+
Initialize a new LLM Wiki vault.
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
wiki_bootstrap(topic: string, mode?: "personal" | "company", root?: string)
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### wiki_capture_source
|
|
14
|
+
|
|
15
|
+
Capture a URL, file, or text into an immutable source packet.
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
wiki_capture_source(
|
|
19
|
+
inputType: "url" | "file" | "text",
|
|
20
|
+
value: string,
|
|
21
|
+
title?: string,
|
|
22
|
+
kind?: string,
|
|
23
|
+
tags?: string[],
|
|
24
|
+
createSourcePage?: boolean
|
|
25
|
+
)
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### wiki_ingest
|
|
29
|
+
|
|
30
|
+
Get a batch of sources needing synthesis.
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
wiki_ingest(batch_size?: number)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### wiki_ensure_page
|
|
37
|
+
|
|
38
|
+
Create or resolve a canonical page.
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
wiki_ensure_page(
|
|
42
|
+
type: "concept" | "entity" | "synthesis" | "analysis",
|
|
43
|
+
title: string,
|
|
44
|
+
aliases?: string[],
|
|
45
|
+
tags?: string[],
|
|
46
|
+
summary?: string,
|
|
47
|
+
createIfMissing?: boolean
|
|
48
|
+
)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### wiki_search
|
|
52
|
+
|
|
53
|
+
Search the wiki registry.
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
wiki_search(query: string, type?: string, limit?: number)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### wiki_lint
|
|
60
|
+
|
|
61
|
+
Health check the wiki.
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
wiki_lint(mode?: string, writeReport?: boolean, limit?: number)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### wiki_status
|
|
68
|
+
|
|
69
|
+
Show wiki statistics.
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
wiki_status()
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### wiki_rebuild_meta
|
|
76
|
+
|
|
77
|
+
Force metadata rebuild.
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
wiki_rebuild_meta()
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### wiki_log_event
|
|
84
|
+
|
|
85
|
+
Record a structured event.
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
wiki_log_event(
|
|
89
|
+
kind: string,
|
|
90
|
+
title: string,
|
|
91
|
+
summary?: string,
|
|
92
|
+
sourceIds?: string[],
|
|
93
|
+
pagePaths?: string[],
|
|
94
|
+
notes?: string[],
|
|
95
|
+
actor?: "agent" | "user" | "extension"
|
|
96
|
+
)
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### wiki_watch
|
|
100
|
+
|
|
101
|
+
Schedule auto-updates.
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
wiki_watch(schedule: string, command: string)
|
|
105
|
+
```
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Architecture
|
|
2
|
+
|
|
3
|
+
## Four Layers
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
WIKI_ROOT/
|
|
7
|
+
โโโ raw/sources/SRC-*/ # Immutable source packets (extension-owned)
|
|
8
|
+
โ โโโ manifest.json # Capture metadata
|
|
9
|
+
โ โโโ original/ # Original artifact
|
|
10
|
+
โ โโโ extracted.md # Normalized markdown
|
|
11
|
+
โ โโโ attachments/ # Downloaded images, PDFs
|
|
12
|
+
โโโ wiki/ # Editable knowledge pages (you + LLM)
|
|
13
|
+
โ โโโ sources/ # One summary per source
|
|
14
|
+
โ โโโ entities/ # People, orgs, tools, products
|
|
15
|
+
โ โโโ concepts/ # Ideas, patterns, frameworks
|
|
16
|
+
โ โโโ syntheses/ # Cross-cutting analyses
|
|
17
|
+
โ โโโ analyses/ # Durable query answers
|
|
18
|
+
โโโ meta/ # Auto-generated (extension-owned)
|
|
19
|
+
โ โโโ registry.json # Master page catalog
|
|
20
|
+
โ โโโ backlinks.json # Inbound link map
|
|
21
|
+
โ โโโ index.md # Human-readable catalog
|
|
22
|
+
โ โโโ log.md # Activity log
|
|
23
|
+
โ โโโ events.jsonl # Structured event stream
|
|
24
|
+
โโโ .wiki/ # Config and templates
|
|
25
|
+
โโโ config.json
|
|
26
|
+
โโโ templates/
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Ownership Rules
|
|
30
|
+
|
|
31
|
+
| Path | Owner | Rule |
|
|
32
|
+
| --------- | ------------------------ | ------------------------ |
|
|
33
|
+
| `raw/**` | Extension | Immutable after capture |
|
|
34
|
+
| `wiki/**` | Model + user | Editable knowledge pages |
|
|
35
|
+
| `meta/*` | Extension | Auto-generated |
|
|
36
|
+
| `.wiki/*` | Human + explicit request | Operating rules |
|
|
37
|
+
|
|
38
|
+
## Source Packet Format
|
|
39
|
+
|
|
40
|
+
Each captured source becomes a packet:
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
raw/sources/SRC-YYYY-MM-DD-NNN/
|
|
44
|
+
manifest.json
|
|
45
|
+
original/
|
|
46
|
+
extracted.md
|
|
47
|
+
attachments/
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Page Types
|
|
51
|
+
|
|
52
|
+
- **source** โ what this specific source says
|
|
53
|
+
- **entity** โ people, orgs, tools, products
|
|
54
|
+
- **concept** โ ideas, patterns, frameworks
|
|
55
|
+
- **synthesis** โ cross-source theses and tensions
|
|
56
|
+
- **analysis** โ durable filed answers from queries
|
|
57
|
+
|
|
58
|
+
## Linking Style
|
|
59
|
+
|
|
60
|
+
- Internal: `[[folder/page-name]]`
|
|
61
|
+
- Citation: `[[sources/SRC-YYYY-MM-DD-NNN]]`
|
|
62
|
+
|
|
63
|
+
## Guardrails
|
|
64
|
+
|
|
65
|
+
The extension blocks direct edits to `raw/**` and `meta/**`. Metadata rebuilds automatically after `wiki/**` edits.
|
package/docs/commands.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Commands
|
|
2
|
+
|
|
3
|
+
## Slash Commands
|
|
4
|
+
|
|
5
|
+
| Command | Description |
|
|
6
|
+
| ---------------- | ------------------------------------- |
|
|
7
|
+
| `/wiki-init` | Create a new wiki vault |
|
|
8
|
+
| `/wiki-ingest` | Process new sources |
|
|
9
|
+
| `/wiki-query` | Ask questions against the wiki |
|
|
10
|
+
| `/wiki-lint` | Health check |
|
|
11
|
+
| `/wiki-discover` | Auto-discover sources |
|
|
12
|
+
| `/wiki-run` | Full cycle (discover โ ingest โ lint) |
|
|
13
|
+
| `/wiki-status` | Show wiki health |
|
|
14
|
+
| `/wiki-digest` | Daily/weekly summary |
|
|
15
|
+
|
|
16
|
+
## Extension Tools
|
|
17
|
+
|
|
18
|
+
The extension registers 10 tools the LLM can call directly:
|
|
19
|
+
|
|
20
|
+
| Tool | Purpose |
|
|
21
|
+
| --------------------- | ------------------------------------------- |
|
|
22
|
+
| `wiki_bootstrap` | Initialize a new vault |
|
|
23
|
+
| `wiki_capture_source` | Capture URL/file/text into immutable packet |
|
|
24
|
+
| `wiki_ingest` | Get batch of uningested sources |
|
|
25
|
+
| `wiki_ensure_page` | Create canonical page from template |
|
|
26
|
+
| `wiki_search` | Search the wiki registry |
|
|
27
|
+
| `wiki_lint` | Health check with auto-fix |
|
|
28
|
+
| `wiki_status` | Instant stats |
|
|
29
|
+
| `wiki_rebuild_meta` | Force metadata rebuild |
|
|
30
|
+
| `wiki_log_event` | Record custom event |
|
|
31
|
+
| `wiki_watch` | Schedule auto-updates |
|
|
32
|
+
|
|
33
|
+
## Workflows
|
|
34
|
+
|
|
35
|
+
### Capture โ Ingest โ Synthesize
|
|
36
|
+
|
|
37
|
+
1. `wiki_capture_source(url="...")` โ creates packet + skeleton
|
|
38
|
+
2. `wiki_ingest()` โ get batch of sources needing synthesis
|
|
39
|
+
3. Read `raw/sources/SRC-*/extracted.md`
|
|
40
|
+
4. Update skeleton source page with summary, entities, concepts
|
|
41
|
+
5. `wiki_ensure_page(type="entity", title="...")` for each entity
|
|
42
|
+
6. Add `[[wikilinks]]` between related pages
|
|
43
|
+
7. Extension auto-rebuilds metadata
|
|
44
|
+
|
|
45
|
+
### Query โ Answer โ File
|
|
46
|
+
|
|
47
|
+
1. `wiki_search(query="...")` to find relevant pages
|
|
48
|
+
2. Read those pages
|
|
49
|
+
3. Synthesize answer with `[[wikilink]]` citations
|
|
50
|
+
4. If novel: create analysis page via `wiki_ensure_page(type="analysis")`
|
|
51
|
+
5. Extension auto-updates metadata
|