@zosmaai/pi-llm-wiki 0.3.0 β†’ 0.5.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/CHANGELOG.md CHANGED
@@ -2,6 +2,32 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.5.0] - 2026-05-11
6
+
7
+ ### Added
8
+ - **Overhauled README**: npm downloads badge, slash commands table, guardrails section, skill behavior, vault layout, source packet format, integration flow, linking style guide
9
+ - **Better npm discoverability**: 19 keywords (was 10), expanded description with search terms, `files` field to slim package
10
+ - **GitHub topics**: pi, llm-wiki, knowledge-base, wiki, markdown, obsidian, karpathy, second-brain, pkm, memory
11
+
12
+ ## [0.4.0] - 2026-05-11
13
+
14
+ - JSON file support (PR #15 by jfraser)
15
+ - Extractor strategy pattern refactor
16
+
17
+ ## [0.3.0] - 2026-05-07
18
+
19
+ - Release
20
+
21
+ ## [0.2.2] - 2026-05-03
22
+
23
+ - Fix: CodeQL alerts for safe tag stripping and entity decoding
24
+ - Fix: README contributors via contrib.rocks
25
+ - Added: Features section and env var documentation
26
+
27
+ ## [0.2.1] - 2026-04-29
28
+
29
+ - Minor fixes
30
+
5
31
  ## [0.2.0] - 2026-04-28
6
32
 
7
33
  ### Added
package/README.md CHANGED
@@ -2,53 +2,264 @@
2
2
 
3
3
  [![CI](https://github.com/zosmaai/pi-llm-wiki/actions/workflows/ci.yml/badge.svg)](https://github.com/zosmaai/pi-llm-wiki/actions/workflows/ci.yml)
4
4
  [![npm](https://img.shields.io/npm/v/@zosmaai/pi-llm-wiki)](https://www.npmjs.com/package/@zosmaai/pi-llm-wiki)
5
+ [![npm downloads](https://img.shields.io/npm/dm/@zosmaai/pi-llm-wiki)](https://www.npmjs.com/package/@zosmaai/pi-llm-wiki)
5
6
  [![Coverage](https://codecov.io/gh/zosmaai/pi-llm-wiki/branch/main/graph/badge.svg)](https://codecov.io/gh/zosmaai/pi-llm-wiki)
6
7
  [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
7
8
  [![CodeQL](https://github.com/zosmaai/pi-llm-wiki/actions/workflows/codeql.yml/badge.svg)](https://github.com/zosmaai/pi-llm-wiki/actions/workflows/codeql.yml)
8
9
 
9
- Self-maintaining, Obsidian-compatible knowledge base for [pi](https://pi.dev). Following Andrej Karpathy's LLM Wiki pattern.
10
+ **Self-maintaining, Obsidian-compatible knowledge base for [pi](https://pi.dev).**
11
+ Follows Andrej Karpathy's [LLM Wiki pattern](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f).
10
12
 
11
- ## Install
13
+ Turn raw sources (URLs, PDFs, markdown, JSON, XML) into a durable, interlinked, LLM-maintained wiki that compounds over time.
14
+
15
+ ---
16
+
17
+ ## Quick Start
12
18
 
13
19
  ```bash
14
20
  pi install npm:@zosmaai/pi-llm-wiki
15
21
  ```
16
22
 
17
- ## Quick Start
18
-
19
23
  ```
20
24
  /wiki-init "AI Engineering"
25
+ /wiki-ingest
26
+ /wiki-query What are the key patterns?
21
27
  ```
22
28
 
23
- Drop sources into `raw/`, then:
29
+ ---
30
+
31
+ ## Why This Package?
32
+
33
+ Most file-based LLM workflows behave like one-shot RAG: the model searches raw documents every time you ask a question. Synthesis is ephemeral.
34
+
35
+ **pi-llm-wiki** creates a middle layer:
36
+
37
+ - **Raw source packets** preserve source-of-truth inputs
38
+ - **Source pages** summarize what each source says
39
+ - **Canonical wiki pages** track what the wiki currently believes
40
+ - **Generated metadata** keeps everything searchable and navigable
24
41
 
42
+ The result is a wiki that **compounds** as you capture sources, ask questions, and file durable analyses.
43
+
44
+ ---
45
+
46
+ ## Features
47
+
48
+ | Capability | Description |
49
+ |------------|-------------|
50
+ | πŸ”— **Immutable source capture** | URLs, local files (PDF/md/txt/html/XML/JSON), or pasted text β†’ structured source packets |
51
+ | 🧠 **Automated ingestion** | `wiki_ingest` batch-processes sources into concept, entity, synthesis & analysis pages |
52
+ | πŸ” **Full-text search** | Generated registry with keyword lookup across all pages and sources |
53
+ | 🩺 **Mechanical linting** | Orphans, broken links, duplicate aliases, coverage gaps, stale captures |
54
+ | πŸ“Š **Dashboard** | `wiki_status` β€” counts, source states, recent activity |
55
+ | πŸ€– **Auto-update watch** | `wiki_watch` β€” schedule periodic discovery + ingest |
56
+ | πŸ“ **Obsidian-friendly** | Folder-qualified wikilinks, stable source-ID citations, compatible vault |
57
+ | πŸ›‘οΈ **Guardrails** | Blocks direct edits to raw sources and generated metadata |
58
+ | πŸ”§ **Configurable PDF extraction** | MarkItDown timeout via `WIKI_MARKITDOWN_TIMEOUT_MS` env var |
59
+ | πŸ§ͺ **38+ tests, CI, CodeQL** | TypeScript, Vitest, Biome, Codecov |
60
+
61
+ ---
62
+
63
+ ## Tools
64
+
65
+ | Tool | Description |
66
+ |------|-------------|
67
+ | `wiki_bootstrap` | Initialize a new wiki vault with config, templates, schema, and metadata |
68
+ | `wiki_capture_source` | Capture a URL, local file, or pasted text into an immutable source packet |
69
+ | `wiki_ingest` | Process uningested source packets into wiki pages (batch) |
70
+ | `wiki_ensure_page` | Resolve or safely create entity / concept / synthesis / analysis pages |
71
+ | `wiki_search` | Search the generated wiki registry |
72
+ | `wiki_lint` | Deterministic health checks (orphans, gaps, contradictions, auto-fix) |
73
+ | `wiki_status` | Show counts, source states, and recent activity |
74
+ | `wiki_rebuild_meta` | Force a full metadata rebuild (registry, backlinks, index, log) |
75
+ | `wiki_log_event` | Append a structured event to the wiki activity log |
76
+ | `wiki_watch` | Schedule automatic wiki updates (daily / weekly / hourly) |
77
+
78
+ ### Slash Commands
79
+
80
+ | Command | Description |
81
+ |---------|-------------|
82
+ | `/wiki-status` | Show a concise operational summary |
83
+ | `/wiki-lint [mode]` | Run mechanical lint (`all`, `links`, `orphans`, `frontmatter`, `duplicates`, `coverage`, `staleness`) |
84
+ | `/wiki-rebuild` | Force a full metadata rebuild |
85
+
86
+ ---
87
+
88
+ ## Quick Start (Detailed)
89
+
90
+ ### 1) Create a new wiki
91
+
92
+ ```bash
93
+ mkdir my-wiki
94
+ cd my-wiki
95
+ pi
25
96
  ```
26
- /wiki-ingest
27
- /wiki-query What are the key patterns?
97
+
98
+ Ask pi:
99
+
100
+ ```
101
+ Initialize an llm wiki here for AI research.
28
102
  ```
29
103
 
30
- ## What It Does
104
+ This calls `wiki_bootstrap` and creates:
31
105
 
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 |
106
+ ```
107
+ raw/
108
+ wiki/
109
+ meta/
110
+ .wiki/
111
+ WIKI_SCHEMA.md
112
+ ```
44
113
 
45
- ## Features
114
+ ### 2) Capture a source
46
115
 
47
- - **Configurable PDF extraction** β€” MarkItDown timeout adjustable via `WIKI_MARKITDOWN_TIMEOUT_MS` env var
48
- - **Smart content detection** β€” PDF bytes sniffed even from non-`.pdf` URLs, never written as markdown
49
- - **Original artifacts preserved** β€” URL captures save the fetched payload under `original/source.*`
50
- - **Clickable source links** β€” Captured URLs render as clickable Markdown links in source pages
51
- - **Reliable prompt forwarding** β€” Slash commands properly forward user arguments to the model
116
+ ```
117
+ Capture this article into the wiki: https://example.com/some-article
118
+ ```
119
+
120
+ ```
121
+ Capture this PDF into the wiki: ./papers/context-windows.pdf
122
+ ```
123
+
124
+ ```
125
+ Capture these notes into the wiki: ...pasted text...
126
+ ```
127
+
128
+ ### 3) Integrate the source
129
+
130
+ 1. Capture the source
131
+ 2. Read `wiki/sources/SRC-*.md`
132
+ 3. Update that source page
133
+ 4. Search for impacted canonical pages with `wiki_search`
134
+ 5. Create missing pages with `wiki_ensure_page`
135
+ 6. Update concept / entity / synthesis pages with citations
136
+ 7. Mark the integration with `wiki_log_event kind=integrate`
137
+
138
+ ### 4) Query the wiki
139
+
140
+ ```
141
+ Based on the wiki, what are the main tradeoffs between long-context models and RAG?
142
+ ```
143
+
144
+ By default, query mode is **read-only**. To file a durable answer:
145
+
146
+ ```
147
+ Answer the question and file the result as an analysis page.
148
+ ```
149
+
150
+ ---
151
+
152
+ ## Vault Layout
153
+
154
+ ```
155
+ my-wiki/
156
+ β”œβ”€ raw/
157
+ β”‚ └─ sources/
158
+ β”‚ └─ SRC-2026-05-11-001/
159
+ β”‚ β”œβ”€ manifest.json
160
+ β”‚ β”œβ”€ original/ # Original artifact
161
+ β”‚ β”œβ”€ extracted.md # Normalized text
162
+ β”‚ └─ attachments/
163
+ β”œβ”€ wiki/
164
+ β”‚ β”œβ”€ sources/ # Source pages (what each source says)
165
+ β”‚ β”œβ”€ concepts/ # Concepts and recurring ideas
166
+ β”‚ β”œβ”€ entities/ # People, orgs, products, papers, systems
167
+ β”‚ β”œβ”€ syntheses/ # Cross-source theses and tensions
168
+ β”‚ └─ analyses/ # Durable filed answers from queries
169
+ β”œβ”€ meta/
170
+ β”‚ β”œβ”€ registry.json # Auto-generated search index
171
+ β”‚ β”œβ”€ backlinks.json
172
+ β”‚ β”œβ”€ index.md
173
+ β”‚ β”œβ”€ events.jsonl # Append-only event log
174
+ β”‚ β”œβ”€ log.md
175
+ β”‚ └─ lint-report.md
176
+ β”œβ”€ .wiki/
177
+ β”‚ β”œβ”€ config.json
178
+ β”‚ └─ templates/
179
+ └─ WIKI_SCHEMA.md
180
+ ```
181
+
182
+ ### Ownership Model
183
+
184
+ | Path | Owner | Rule |
185
+ |------|-------|------|
186
+ | `raw/**` | Extension tools | Immutable after capture |
187
+ | `wiki/**` | Model + user | Editable knowledge pages |
188
+ | `meta/registry.json` | Extension | Generated |
189
+ | `meta/backlinks.json` | Extension | Generated |
190
+ | `meta/index.md` | Extension | Generated |
191
+ | `meta/events.jsonl` | Extension / tool | Append-only |
192
+ | `meta/log.md` | Extension | Generated from events |
193
+ | `meta/lint-report.md` | Extension | Generated |
194
+ | `WIKI_SCHEMA.md` | Human + explicit request | Operating manual |
195
+
196
+ ---
197
+
198
+ ## Linking & Citation Style
199
+
200
+ ### Internal Navigation
201
+
202
+ ```markdown
203
+ [[concepts/retrieval-augmented-generation]]
204
+ [[entities/openai|OpenAI]]
205
+ [[syntheses/long-context-vs-rag]]
206
+ ```
207
+
208
+ ### Factual Citations
209
+
210
+ ```markdown
211
+ [[sources/SRC-2026-04-04-001|SRC-2026-04-04-001]]
212
+ ```
213
+
214
+ Stable source-page IDs keep provenance stable even if titles change.
215
+
216
+ ---
217
+
218
+ ## Guardrails
219
+
220
+ The extension **blocks** direct tool-call edits to:
221
+
222
+ - `raw/**` β€” immutable source artifacts
223
+ - `meta/registry.json`
224
+ - `meta/backlinks.json`
225
+ - `meta/events.jsonl`
226
+ - `meta/index.md`
227
+ - `meta/log.md`
228
+ - `meta/lint-report.md`
229
+
230
+ If the model directly edits `wiki/**` using Pi's built-in `write` or `edit` tools, the extension **automatically rebuilds** generated metadata at the end of the agent turn.
231
+
232
+ ---
233
+
234
+ ## Source Packet Format
235
+
236
+ Each captured source is stored as a structured packet:
237
+
238
+ ```
239
+ raw/sources/SRC-YYYY-MM-DD-NNN/
240
+ β”œβ”€ manifest.json # Capture metadata (title, URL, format, timestamp)
241
+ β”œβ”€ original/ # Original artifact (preserved as-is)
242
+ β”œβ”€ extracted.md # Normalized text (PDFβ†’md, XMLβ†’md, JSONβ†’md, etc.)
243
+ └─ attachments/ # Future attachment downloads
244
+ ```
245
+
246
+ This preserves both the **original artifact** and a **normalized extracted view** for reading.
247
+
248
+ ---
249
+
250
+ ## Skill Behavior
251
+
252
+ The bundled `llm-wiki` skill teaches the model to:
253
+
254
+ - ❌ Never edit raw sources directly
255
+ - ❌ Never edit generated metadata files
256
+ - βœ… Capture first, integrate second
257
+ - βœ… Search before creating new canonical pages
258
+ - βœ… Cite facts using source-page IDs
259
+ - βœ… Keep query mode read-only by default
260
+ - βœ… Use "Tensions / caveats" and "Open questions" when evidence is mixed
261
+
262
+ ---
52
263
 
53
264
  ## Architecture
54
265
 
@@ -61,19 +272,27 @@ meta/ # Auto-generated registry, backlinks, index, log
61
272
  .wiki/ # Config and templates
62
273
  ```
63
274
 
64
- Read [docs/architecture.md](docs/architecture.md) for details.
275
+ Read [docs/architecture.md](docs/architecture.md) for the full design document.
276
+
277
+ ---
65
278
 
66
279
  ## Documentation
67
280
 
68
- - [Architecture](docs/architecture.md) β€” How the four layers work
69
- - [Commands](docs/commands.md) β€” All slash commands and tools
70
- - [Obsidian Integration](docs/obsidian.md) β€” Vault setup and recommended plugins
71
- - [Configuration](docs/configuration.md) β€” Wiki modes, topics, settings
72
- - [API](docs/api.md) β€” Extension tool reference
281
+ | Document | What it covers |
282
+ |----------|---------------|
283
+ | [Architecture](docs/architecture.md) | How the four layers work, ownership model |
284
+ | [Commands](docs/commands.md) | All slash commands and tool reference |
285
+ | [Obsidian Integration](docs/obsidian.md) | Vault setup and recommended plugins |
286
+ | [Configuration](docs/configuration.md) | Wiki modes, topics, environment variables |
287
+ | [API](docs/api.md) | Extension tool parameter reference |
288
+
289
+ ---
73
290
 
74
291
  ## Contributing
75
292
 
76
- See [CONTRIBUTING.md](CONTRIBUTING.md).
293
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, test patterns, and PR workflow.
294
+
295
+ ---
77
296
 
78
297
  ## Star History
79
298
 
@@ -88,7 +307,8 @@ See [CONTRIBUTING.md](CONTRIBUTING.md).
88
307
  ---
89
308
 
90
309
  <div align="center">
91
- <sub>Built with ❀️ by <a href="https://github.com/zosmaai">zosmaai</a></sub>
310
+ <sub>Built with ❀️ by <a href="https://github.com/zosmaai">zosmaai</a> · </sub>
311
+ <a href="https://pi.dev">pi.dev</a> Β· <a href="https://github.com/zosmaai/pi-llm-wiki/issues">Issues</a>
92
312
  </div>
93
313
 
94
314
  ## License