@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 +26 -0
- package/README.md +254 -34
- package/extensions/llm-wiki/lib/source-extractors.ts +369 -0
- package/extensions/llm-wiki/lib/source-packet.ts +156 -300
- package/package.json +25 -3
- package/.coderabbit.yaml +0 -43
- package/.github/codeql/codeql-config.yml +0 -12
- package/.github/workflows/ci.yml +0 -45
- package/.github/workflows/codeql.yml +0 -39
- package/.github/workflows/release.yml +0 -86
- package/AGENTS.md +0 -57
- package/CONTRIBUTING.md +0 -43
- package/biome.json +0 -30
- package/scripts/release.js +0 -72
- package/test/llm-wiki.test.ts +0 -654
- package/tsconfig.json +0 -19
- package/vitest.config.ts +0 -16
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
|
[](https://github.com/zosmaai/pi-llm-wiki/actions/workflows/ci.yml)
|
|
4
4
|
[](https://www.npmjs.com/package/@zosmaai/pi-llm-wiki)
|
|
5
|
+
[](https://www.npmjs.com/package/@zosmaai/pi-llm-wiki)
|
|
5
6
|
[](https://codecov.io/gh/zosmaai/pi-llm-wiki)
|
|
6
7
|
[](LICENSE)
|
|
7
8
|
[](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)
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
27
|
-
|
|
97
|
+
|
|
98
|
+
Ask pi:
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
Initialize an llm wiki here for AI research.
|
|
28
102
|
```
|
|
29
103
|
|
|
30
|
-
|
|
104
|
+
This calls `wiki_bootstrap` and creates:
|
|
31
105
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
|
|
114
|
+
### 2) Capture a source
|
|
46
115
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
|
275
|
+
Read [docs/architecture.md](docs/architecture.md) for the full design document.
|
|
276
|
+
|
|
277
|
+
---
|
|
65
278
|
|
|
66
279
|
## Documentation
|
|
67
280
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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
|
|
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
|