@zosmaai/pi-llm-wiki 0.1.6 → 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/.github/workflows/ci.yml +7 -6
- package/.github/workflows/release.yml +3 -3
- package/AGENTS.md +57 -0
- package/CHANGELOG.md +30 -0
- package/CONTRIBUTING.md +43 -0
- package/LICENSE +21 -0
- package/README.md +42 -342
- 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 +7 -2
- package/scripts/release.js +72 -0
- package/skills/llm-wiki/SKILL.md +95 -369
- 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/.github/workflows/ci.yml
CHANGED
|
@@ -33,12 +33,13 @@ jobs:
|
|
|
33
33
|
- name: Lint
|
|
34
34
|
run: npm run lint
|
|
35
35
|
|
|
36
|
-
- name: Run Tests
|
|
37
|
-
run: npm test
|
|
36
|
+
- name: Run Tests with Coverage
|
|
37
|
+
run: npm run test:coverage
|
|
38
38
|
|
|
39
|
-
- name: Upload Coverage
|
|
39
|
+
- name: Upload Coverage to Codecov
|
|
40
40
|
if: ${{ matrix.node-version == 22 && github.event_name == 'push' }}
|
|
41
|
-
uses:
|
|
41
|
+
uses: codecov/codecov-action@v5
|
|
42
42
|
with:
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
files: ./coverage/lcov.info
|
|
44
|
+
fail_ci_if_error: false
|
|
45
|
+
verbose: true
|
|
@@ -59,7 +59,7 @@ jobs:
|
|
|
59
59
|
- name: Create GitHub Release
|
|
60
60
|
uses: softprops/action-gh-release@v2
|
|
61
61
|
with:
|
|
62
|
-
name: "
|
|
62
|
+
name: "v${{ steps.version.outputs.VERSION }}"
|
|
63
63
|
body: |
|
|
64
64
|
## 📦 @zosmaai/pi-llm-wiki v${{ steps.version.outputs.VERSION }}
|
|
65
65
|
|
|
@@ -72,7 +72,7 @@ jobs:
|
|
|
72
72
|
|
|
73
73
|
### What's Included
|
|
74
74
|
- **Skill**: Self-maintaining wiki schema (SKILL.md)
|
|
75
|
-
- **Extension**:
|
|
75
|
+
- **Extension**: 10 TypeScript tools (wiki_bootstrap, wiki_capture_source, wiki_ingest, wiki_ensure_page, wiki_search, wiki_lint, wiki_status, wiki_rebuild_meta, wiki_log_event, wiki_watch)
|
|
76
76
|
- **Prompt Templates**: 8 slash commands (/wiki:init, :ingest, :query, :lint, :discover, :run, :status, :digest)
|
|
77
|
-
- **Templates**: INDEX.md, LOG.md, DASHBOARD.md, config.yaml,
|
|
77
|
+
- **Templates**: INDEX.md, LOG.md, DASHBOARD.md, config.yaml, 5 page templates
|
|
78
78
|
generate_release_notes: false
|
package/AGENTS.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
Instructions for AI agents working on this codebase.
|
|
4
|
+
|
|
5
|
+
## Project
|
|
6
|
+
|
|
7
|
+
`@zosmaai/pi-llm-wiki` — A pi package that implements Andrej Karpathy's LLM Wiki pattern as a self-maintaining knowledge base.
|
|
8
|
+
|
|
9
|
+
## Tech Stack
|
|
10
|
+
|
|
11
|
+
- TypeScript (ES2022, ESM)
|
|
12
|
+
- Vitest for testing
|
|
13
|
+
- Biome for linting/formatting
|
|
14
|
+
- GitHub Actions for CI
|
|
15
|
+
- npm for publishing
|
|
16
|
+
|
|
17
|
+
## File Layout
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
├── extensions/llm-wiki/ # TypeScript extension (10 tools + guardrails)
|
|
21
|
+
│ ├── index.ts # Entry point
|
|
22
|
+
│ └── lib/ # tools.ts, metadata.ts, guardrails.ts, utils.ts, source-packet.ts
|
|
23
|
+
├── skills/llm-wiki/ # SKILL.md + templates
|
|
24
|
+
├── prompts/ # 8 slash command templates
|
|
25
|
+
├── test/ # Vitest tests
|
|
26
|
+
├── docs/ # Documentation
|
|
27
|
+
└── scripts/ # release.js
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Conventions
|
|
31
|
+
|
|
32
|
+
- Use `node:fs/promises` for async file I/O, not sync
|
|
33
|
+
- Prefer small, pure functions in `lib/`
|
|
34
|
+
- Extension tools must have: name, label, description, promptSnippet, promptGuidelines, parameters (TypeBox), execute
|
|
35
|
+
- Guardrails block `raw/**` and `meta/**` edits at the tool_call hook level
|
|
36
|
+
- Metadata auto-rebuilds on `turn_end` after `wiki/**` edits
|
|
37
|
+
- Source IDs: `SRC-YYYY-MM-DD-NNN`
|
|
38
|
+
- Page filenames: `kebab-case.md`
|
|
39
|
+
- Wikilinks: folder-qualified, e.g. `[[concepts/retrieval-augmented-generation]]`
|
|
40
|
+
|
|
41
|
+
## Testing
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npm test # run tests
|
|
45
|
+
npm run test:coverage # run with coverage
|
|
46
|
+
npm run typecheck # TypeScript check
|
|
47
|
+
npm run lint # biome check
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Release
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npm run release:patch # or minor/major
|
|
54
|
+
npm run release:push # push tags
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Never edit `package.json` version manually — use the release script.
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [Unreleased]
|
|
4
|
+
|
|
5
|
+
## [0.2.0] - 2026-04-28
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- **4-layer architecture**: raw/, wiki/, meta/, .wiki/ with explicit ownership rules
|
|
10
|
+
- **Source packets**: Structured capture with manifest.json, original/, extracted.md, attachments/
|
|
11
|
+
- **10 custom tools** (up from 5): wiki_bootstrap, wiki_capture_source, wiki_ingest, wiki_ensure_page, wiki_search, wiki_lint, wiki_status, wiki_rebuild_meta, wiki_log_event, wiki_watch
|
|
12
|
+
- **Auto-generated metadata**: registry.json, backlinks.json, index.md, log.md, events.jsonl
|
|
13
|
+
- **Guardrails**: Extension blocks direct edits to raw/** and meta/** via tool_call hook
|
|
14
|
+
- **Auto-rebuild**: Metadata rebuilds automatically after wiki/\*\* edits via turn_end hook
|
|
15
|
+
- **Batch ingest**: wiki_ingest returns source batches with extracted content previews
|
|
16
|
+
- **Improved lint**: Orphans, missing pages, contradictions, knowledge gaps with auto_fix option
|
|
17
|
+
- **Release scripts**: Automated semver bumping, changelog updates, git tagging
|
|
18
|
+
- **Coverage reporting**: v8 coverage in CI with lcov output
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- Extension moved from single file to modular directory structure (extensions/llm-wiki/)
|
|
23
|
+
- Skill reduced from ~500 lines to ~150 lines — principles over mechanics
|
|
24
|
+
- Metadata is now machine-owned; LLM never edits INDEX.md or LOG.md manually
|
|
25
|
+
- Source IDs use stable format SRC-YYYY-MM-DD-NNN for rename-safe citations
|
|
26
|
+
|
|
27
|
+
### Removed
|
|
28
|
+
|
|
29
|
+
- Manual INDEX.md/LOG.md maintenance from skill workflows
|
|
30
|
+
- Legacy flat raw/articles/ structure (replaced by structured source packets)
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
## Local Setup
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
git clone https://github.com/zosmaai/pi-llm-wiki.git
|
|
7
|
+
cd pi-llm-wiki
|
|
8
|
+
npm install
|
|
9
|
+
pi install ./
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Development
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm run test # run tests
|
|
16
|
+
npm run test:coverage # run tests with coverage report
|
|
17
|
+
npm run typecheck # TypeScript type check
|
|
18
|
+
npm run lint # biome lint check
|
|
19
|
+
npm run lint:fix # auto-fix lint issues
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Release Process
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm run release:patch # bump patch version
|
|
26
|
+
npm run release:minor # bump minor version
|
|
27
|
+
npm run release:major # bump major version
|
|
28
|
+
npm run release:push # push to origin with tags
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The release script:
|
|
32
|
+
|
|
33
|
+
1. Verifies clean git tree and `main` branch
|
|
34
|
+
2. Runs typecheck, lint, and tests
|
|
35
|
+
3. Bumps version in `package.json`
|
|
36
|
+
4. Updates `CHANGELOG.md`
|
|
37
|
+
5. Commits and tags
|
|
38
|
+
|
|
39
|
+
CI handles npm publish on tag push.
|
|
40
|
+
|
|
41
|
+
## License
|
|
42
|
+
|
|
43
|
+
MIT
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 zosmaai
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
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
|
|
11
|
+
## Install
|
|
82
12
|
|
|
83
13
|
```bash
|
|
84
|
-
pi install
|
|
14
|
+
pi install npm:@zosmaai/pi-llm-wiki
|
|
85
15
|
```
|
|
86
16
|
|
|
87
|
-
|
|
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
|
|
111
|
-
|
|
112
|
-
```bash
|
|
113
|
-
pi
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
Then inside pi:
|
|
17
|
+
## Quick Start
|
|
117
18
|
|
|
118
19
|
```
|
|
119
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
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
|
-
```
|
|
45
|
+
## Architecture
|
|
145
46
|
|
|
146
|
-
|
|
47
|
+
Four layers with clear ownership:
|
|
147
48
|
|
|
148
|
-
### 5️⃣ Keep it fresh
|
|
149
|
-
|
|
150
|
-
```bash
|
|
151
|
-
# Auto-update daily at 8 AM
|
|
152
|
-
/wiki-run --schedule daily
|
|
153
|
-
|
|
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/main/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
|
-
|
|
172
|
-
```
|
|
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
|
-
└──────────────────────┴───────────────────────────────────┘
|
|
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
|
|
184
54
|
```
|
|
185
55
|
|
|
186
|
-
|
|
187
|
-
|
|
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/main/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
|