@zosmaai/pi-llm-wiki 0.7.3 → 0.7.4

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/README.pt.md ADDED
@@ -0,0 +1,414 @@
1
+ <div align="center">
2
+
3
+ # @zosmaai/pi-llm-wiki
4
+
5
+ <a href="./README.md">English</a> | <a href="./README.zh.md">中文</a> | <a href="./README.es.md">Español</a> | <a href="./README.ja.md">日本語</a> | <a href="./README.de.md">Deutsch</a> | <a href="./README.fr.md">Français</a> | **Português** | <a href="./README.ru.md">Русский</a> | <a href="./README.ko.md">한국어</a> | <a href="./README.hi.md">हिंदी</a>
6
+
7
+ [![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)
8
+ [![npm](https://img.shields.io/npm/v/@zosmaai/pi-llm-wiki)](https://www.npmjs.com/package/@zosmaai/pi-llm-wiki)
9
+ [![npm downloads](https://img.shields.io/npm/dm/@zosmaai/pi-llm-wiki)](https://www.npmjs.com/package/@zosmaai/pi-llm-wiki)
10
+ [![Coverage](https://codecov.io/gh/zosmaai/pi-llm-wiki/branch/main/graph/badge.svg)](https://codecov.io/gh/zosmaai/pi-llm-wiki)
11
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
12
+ [![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)
13
+ [![GitHub Repo Stars](https://img.shields.io/github/stars/zosmaai/pi-llm-wiki?style=social)](https://github.com/zosmaai/pi-llm-wiki/stargazers)
14
+
15
+ </div>
16
+
17
+ <br/>
18
+
19
+ <div align="center">
20
+ <a href="https://github.com/zosmaai/pi-llm-wiki/stargazers">
21
+ <img src="./assets/thank-you-for-the-star.png" alt="Thank you for starring pi-llm-wiki!" width="100%" />
22
+ </a>
23
+ <br/>
24
+ <sub>
25
+ If you find pi-llm-wiki useful,
26
+ <a href="https://github.com/zosmaai/pi-llm-wiki">⭐ star the repo</a> —
27
+ it lets us know we're building something that matters.
28
+ </sub>
29
+ </div>
30
+
31
+ <br/>
32
+
33
+ **Base de conhecimento autogerenciável compatível com Obsidian para [pi](https://pi.dev). Segue o padrão LLM Wiki de Andrej Karpathy.**
34
+ Follows Andrej Karpathy's [LLM Wiki pattern](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f).
35
+
36
+ Transforme fontes brutas (URLs, PDFs, markdown, JSON, XML) em um wiki durável, interligado e mantido por LLM que se acumula ao longo do tempo.
37
+
38
+ ---
39
+
40
+ ## Início Rápido
41
+
42
+ ```bash
43
+ pi install npm:@zosmaai/pi-llm-wiki
44
+ ```
45
+
46
+ The extension will proactively suggest creating a wiki on your first session. Alternatively:
47
+
48
+ ```
49
+ /wiki-init "AI Engineering"
50
+ /wiki-ingest
51
+ /wiki-query What are the key patterns?
52
+ ```
53
+
54
+ ---
55
+
56
+ ## Por que este pacote?
57
+
58
+ A maioria dos fluxos de trabalho LLM baseados em arquivos se comportam como RAG único: o modelo pesquisa documentos brutos toda vez que você faz uma pergunta. A síntese é efêmera.
59
+
60
+ **pi-llm-wiki** cria uma camada intermediária:
61
+
62
+ - **Pacotes de fonte bruta preservam as entradas originais**
63
+ - **Páginas de fonte resumem o que cada fonte diz**
64
+ - **Páginas canônicas do wiki rastreiam o que o wiki atualmente acredita**
65
+ - **Metadados gerados mantêm tudo pesquisável e navegável**
66
+
67
+ O resultado é um wiki que se acumula conforme você captura fontes, faz perguntas e arquiva análises duráveis.
68
+
69
+ ---
70
+
71
+ ## Recursos
72
+
73
+ | Capability | Description |
74
+ |------------|-------------|
75
+ | 🏠 **Personal fallback** | Always-on `~/.llm-wiki/` vault — knowledge compounds across projects even when no project wiki exists |
76
+ | 🔗 **Immutable source capture** | URLs, local files (PDF/md/txt/html/XML/JSON), or pasted text → structured source packets |
77
+ | 🧠 **Automated ingestion** | `wiki_ingest` batch-processes sources into concept, entity, synthesis & analysis pages |
78
+ | 🔍 **Full-text search** | Generated registry with keyword lookup across all pages and sources |
79
+ | 🩺 **Mechanical linting** | Orphans, broken links, duplicate aliases, coverage gaps, stale captures |
80
+ | 📊 **Dashboard** | `wiki_status` — counts, source states, recent activity |
81
+ | 🤖 **Auto-update watch** | `wiki_watch` — schedule periodic discovery + ingest |
82
+ | 🧠 **Layered recall** | Searches both personal (`~/.llm-wiki/`) and project (`.llm-wiki/`) vaults — personal knowledge follows you everywhere |
83
+ | 📝 **Auto-bootstrap** | Extension suggests creating a wiki when none exists in the current directory |
84
+ | 💾 **Lightweight capture** | `wiki_retro` — save atomic insights as a single markdown file; full 4-layer pipeline also available via `wiki_capture_source` |
85
+ | 🌐 **MCP Server** | Use with Claude Code, Cursor, Windsurf via stdio MCP transport |
86
+ | 📝 **Obsidian-friendly** | Folder-qualified wikilinks, stable source-ID citations, compatible vault |
87
+ | 🛡️ **Guardrails** | Blocks direct edits to raw sources and generated metadata |
88
+ | 🔧 **Configurable PDF extraction** | MarkItDown timeout via `WIKI_MARKITDOWN_TIMEOUT_MS` env var |
89
+ | 🧪 **38+ tests, CI, CodeQL** | TypeScript, Vitest, Biome, Codecov |
90
+
91
+ ---
92
+
93
+ ## Ferramentas
94
+
95
+ | Tool | Description |
96
+ |------|-------------|
97
+ | `wiki_bootstrap` | Initialize a new wiki vault with config, templates, schema, and metadata |
98
+ | `wiki_capture_source` | Capture a URL, local file, or pasted text into an immutable source packet |
99
+ | `wiki_recall` | Search wiki for task-relevant pages — searches both personal (`~/.llm-wiki/`) and project (`.llm-wiki/`) vaults, deduplicated |
100
+ | `wiki_retro` | Save atomic insights from completed tasks into the wiki |
101
+ | `wiki_ingest` | Process uningested source packets into wiki pages (batch) |
102
+ | `wiki_ensure_page` | Resolve or safely create entity / concept / synthesis / analysis pages |
103
+ | `wiki_search` | Search the generated wiki registry |
104
+ | `wiki_lint` | Deterministic health checks (orphans, gaps, contradictions, auto-fix) |
105
+ | `wiki_status` | Show counts, source states, and recent activity |
106
+ | `wiki_rebuild_meta` | Force a full metadata rebuild (registry, backlinks, index, log) |
107
+ | `wiki_log_event` | Append a structured event to the wiki activity log |
108
+ | `wiki_watch` | Schedule automatic wiki updates (daily / weekly / hourly) |
109
+
110
+ ### Comandos de Barra
111
+
112
+ | Command | Description |
113
+ |---------|-------------|
114
+ | `/wiki-init <topic>` | Initialize a new LLM Wiki vault |
115
+ | `/wiki-ingest [path]` | Process new source files and update the wiki |
116
+ | `/wiki-query <question>` | Ask questions against the wiki with citations |
117
+ | `/wiki-discover [--topic <topic>]` | Auto-discover new sources from the web |
118
+ | `/wiki-run [--schedule daily\|weekly]` | Full cycle: discover → ingest → lint |
119
+ | `/wiki-lint [--fix]` | Health check (orphans, contradictions, gaps) |
120
+ | `/wiki-status` | Show a concise operational summary |
121
+ | `/wiki-digest [--period daily\|weekly]` | Generate a digest of recent activity |
122
+ | `/wiki-retro` | Save atomic insights from completed tasks |
123
+
124
+ ---
125
+
126
+ ## Arquitetura de Vault em Camadas
127
+
128
+ Knowledge follows you everywhere. pi-llm-wiki uses a layered vault system:
129
+
130
+ | Layer | Location | Purpose |
131
+ |-------|----------|---------|
132
+ | 🏠 **Personal** | `~/.llm-wiki/` | Always active. Zero setup. Knowledge compounds across all your sessions — regardless of which project you're in. |
133
+ | 📁 **Project** | `{project}/.llm-wiki/` | Explicit opt-in. Dedicated wiki per project, sharing personal knowledge when relevant. |
134
+ | 🏢 **Company** (future) | git-tracked | Shared wiki across a team. `wiki_publish` promotes personal/project pages to the company wiki. |
135
+
136
+ **Como funciona:**
137
+
138
+ 1. `resolveVaultRoot()` checks: cwd → walk up for `.llm-wiki/` → `~/.llm-wiki/`
139
+ 2. `wiki_recall` (layered) searches **both** personal and project vaults, merging results with vault labels
140
+ 3. Personal results are shown first in recall output, tagged as "📓 personal"
141
+ 4. `wiki_retro` writes to whichever vault is active (project takes priority)
142
+ 5. Set `WIKI_HOME` env var to override the personal wiki location
143
+
144
+ This means: you can have a project wiki for team documentation **and** a personal wiki for your own notes, and recall searches both simultaneously.
145
+
146
+ ---
147
+
148
+ ## Início Rápido (Detalhado)
149
+
150
+ ### 1) Criar um novo wiki
151
+
152
+ ```bash
153
+ mkdir my-wiki
154
+ cd my-wiki
155
+ pi
156
+ ```
157
+
158
+ Pergunte ao pi:
159
+
160
+ ```
161
+ Initialize an llm wiki here for AI research.
162
+ ```
163
+
164
+ This calls `wiki_bootstrap` and creates:
165
+
166
+ ```
167
+ .llm-wiki/
168
+ ├── config.json
169
+ ├── templates/
170
+ ├── raw/
171
+ ├── wiki/
172
+ ├── meta/
173
+ └── WIKI_SCHEMA.md
174
+ ```
175
+
176
+ ### 2) Capturar uma fonte
177
+
178
+ ```
179
+ Capture this article into the wiki: https://example.com/some-article
180
+ ```
181
+
182
+ ```
183
+ Capture this PDF into the wiki: ./papers/context-windows.pdf
184
+ ```
185
+
186
+ ```
187
+ Capture these notes into the wiki: ...pasted text...
188
+ ```
189
+
190
+ ### 3) Integrar a fonte
191
+
192
+ 1. Capture the source
193
+ 2. Read `.llm-wiki/wiki/sources/SRC-*.md`
194
+ 3. Update that source page
195
+ 4. Search for impacted canonical pages with `wiki_search`
196
+ 5. Create missing pages with `wiki_ensure_page`
197
+ 6. Update concept / entity / synthesis pages with citations
198
+ 7. Mark the integration with `wiki_log_event kind=integrate`
199
+
200
+ ### 4) Consultar o wiki
201
+
202
+ ```
203
+ Based on the wiki, what are the main tradeoffs between long-context models and RAG?
204
+ ```
205
+
206
+ By default, query mode is **read-only**. To file a durable answer:
207
+
208
+ ```
209
+ Answer the question and file the result as an analysis page.
210
+ ```
211
+
212
+ ---
213
+
214
+ ## Layout do Vault
215
+
216
+ ```
217
+ my-wiki/
218
+ └─ .llm-wiki/
219
+ ├─ config.json # Vault config
220
+ ├─ templates/ # Page templates
221
+ ├─ raw/
222
+ │ └─ sources/
223
+ │ └─ SRC-2026-05-11-001/
224
+ │ ├─ manifest.json
225
+ │ ├─ original/ # Original artifact
226
+ │ ├─ extracted.md # Normalized text
227
+ │ └─ attachments/
228
+ ├─ wiki/
229
+ │ ├─ sources/ # Source pages (what each source says)
230
+ │ ├─ concepts/ # Concepts and recurring ideas
231
+ │ ├─ entities/ # People, orgs, products, papers, systems
232
+ │ ├─ syntheses/ # Cross-source theses and tensions
233
+ │ └─ analyses/ # Durable filed answers from queries
234
+ ├─ meta/
235
+ │ ├─ registry.json # Auto-generated search index
236
+ │ ├─ backlinks.json
237
+ │ ├─ index.md
238
+ │ ├─ events.jsonl # Append-only event log
239
+ │ ├─ log.md
240
+ │ └─ lint-report.md
241
+ └─ WIKI_SCHEMA.md # Operating manual
242
+ ```
243
+
244
+ ### Modelo de Propriedade
245
+
246
+ | Path | Owner | Rule |
247
+ |------|-------|------|
248
+ | Path | Owner | Rule |
249
+ |------|-------|------|
250
+ | `.llm-wiki/raw/**` | Extension tools | Immutable after capture |
251
+ | `.llm-wiki/wiki/**` | Model + user | Editable knowledge pages |
252
+ | `.llm-wiki/meta/registry.json` | Extension | Generated |
253
+ | `.llm-wiki/meta/backlinks.json` | Extension | Generated |
254
+ | `.llm-wiki/meta/index.md` | Extension | Generated |
255
+ | `.llm-wiki/meta/events.jsonl` | Extension / tool | Append-only |
256
+ | `.llm-wiki/meta/log.md` | Extension | Generated from events |
257
+ | `.llm-wiki/meta/lint-report.md` | Extension | Generated |
258
+ | `.llm-wiki/WIKI_SCHEMA.md` | Human + explicit request | Operating manual |
259
+
260
+ ---
261
+
262
+ ## Estilo de Links e Citações
263
+
264
+ ### Navegação Interna
265
+
266
+ ```markdown
267
+ [[concepts/retrieval-augmented-generation]]
268
+ [[entities/openai|OpenAI]]
269
+ [[syntheses/long-context-vs-rag]]
270
+ ```
271
+
272
+ ### Citações Factuais
273
+
274
+ ```markdown
275
+ [[sources/SRC-2026-04-04-001|SRC-2026-04-04-001]]
276
+ ```
277
+
278
+ Stable source-page IDs keep provenance stable even if titles change.
279
+
280
+ ---
281
+
282
+ ## Salvaguardas
283
+
284
+ The extension **blocks** direct tool-call edits to:
285
+
286
+ - `.llm-wiki/raw/**` — immutable source artifacts
287
+ - `.llm-wiki/meta/registry.json`
288
+ - `.llm-wiki/meta/backlinks.json`
289
+ - `.llm-wiki/meta/events.jsonl`
290
+ - `.llm-wiki/meta/index.md`
291
+ - `.llm-wiki/meta/log.md`
292
+ - `.llm-wiki/meta/lint-report.md`
293
+
294
+ If the model directly edits `.llm-wiki/wiki/**` using Pi's built-in `write` or `edit` tools, the extension **automatically rebuilds** generated metadata at the end of the agent turn.
295
+
296
+ ---
297
+
298
+ ## Formato de Pacote de Fonte
299
+
300
+ Each captured source is stored as a structured packet:
301
+
302
+ ```
303
+ .llm-wiki/raw/sources/SRC-YYYY-MM-DD-NNN/
304
+ ├─ manifest.json # Capture metadata (title, URL, format, timestamp)
305
+ ├─ original/ # Original artifact (preserved as-is)
306
+ ├─ extracted.md # Normalized text (PDF→md, XML→md, JSON→md, etc.)
307
+ └─ attachments/ # Future attachment downloads
308
+ ```
309
+
310
+ This preserves both the **original artifact** and a **normalized extracted view** for reading.
311
+
312
+ ---
313
+
314
+ ## Servidor MCP
315
+
316
+ Use the wiki from **any MCP-compatible tool** — Claude Code, Cursor, Windsurf, and others.
317
+
318
+ The package ships a standalone MCP server exposing 5 wiki tools over stdio:
319
+
320
+ | Tool | Description |
321
+ |------|-------------|
322
+ | `wiki_recall` | Search wiki for task-relevant pages |
323
+ | `wiki_search` | Full registry search |
324
+ | `wiki_status` | Wiki stats (page counts, type breakdown) |
325
+ | `wiki_retro` | Save atomic insights |
326
+ | `wiki_capture_source` | Capture text as a source packet |
327
+
328
+ ### Uso
329
+
330
+ ```bash
331
+ # Auto-discovered by pi:
332
+ pi install npm:@zosmaai/pi-llm-wiki
333
+
334
+ # Standalone with any MCP client:
335
+ WIKI_ROOT=~/my-wiki node node_modules/@zosmaai/pi-llm-wiki/mcp/index.js
336
+ ```
337
+
338
+ Set `WIKI_ROOT` to your wiki vault directory. If unset, the server auto-detects from the current working directory.
339
+
340
+ ---
341
+
342
+ ## Comportamento da Skill
343
+
344
+ The bundled `llm-wiki` skill teaches the model to:
345
+
346
+ - ❌ Never edit raw sources directly
347
+ - ❌ Never edit generated metadata files
348
+ - ✅ Capture first, integrate second
349
+ - ✅ Search before creating new canonical pages
350
+ - ✅ Cite facts using source-page IDs
351
+ - ✅ Keep query mode read-only by default
352
+ - ✅ Use "Tensions / caveats" and "Open questions" when evidence is mixed
353
+
354
+ ---
355
+
356
+ ## Arquitetura
357
+
358
+ ### Camadas de Vault
359
+
360
+ See the [Layered Vault Architecture](#layered-vault-architecture) section above for the personal/project/company layering.
361
+
362
+ ### Modelo de Página de Quatro Camadas
363
+
364
+ Each wiki vault has four layers with clear ownership:
365
+
366
+ ```
367
+ .llm-wiki/raw/sources/SRC-*/ # Immutable source packets (extension-owned)
368
+ .llm-wiki/wiki/ # Editable knowledge pages (you + LLM)
369
+ .llm-wiki/meta/ # Auto-generated registry, backlinks, index, log
370
+ .llm-wiki/ # Config and templates
371
+ ```
372
+
373
+ Read [docs/architecture.md](docs/architecture.md) for the full design document.
374
+
375
+ ---
376
+
377
+ ## Documentação
378
+
379
+ | Document | What it covers |
380
+ |----------|---------------|
381
+ | [Architecture](docs/architecture.md) | How the four layers work, ownership model |
382
+ | [Commands](docs/commands.md) | All slash commands and tool reference |
383
+ | [Obsidian Integration](docs/obsidian.md) | Vault setup and recommended plugins |
384
+ | [Configuration](docs/configuration.md) | Wiki modes, topics, environment variables |
385
+ | [API](docs/api.md) | Extension tool parameter reference |
386
+
387
+ ---
388
+
389
+ ## Contribuir
390
+
391
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, test patterns, and PR workflow.
392
+
393
+ ---
394
+
395
+ ## Histórico de Estrelas
396
+
397
+ [![Star History Chart](https://api.star-history.com/svg?repos=zosmaai/pi-llm-wiki&type=Date)](https://star-history.com/#zosmaai/pi-llm-wiki&Date)
398
+
399
+ ## Contribuidores
400
+
401
+ <a href="https://github.com/zosmaai/pi-llm-wiki/graphs/contributors">
402
+ <img src="https://contrib.rocks/image?repo=zosmaai/pi-llm-wiki" alt="Contributors" />
403
+ </a>
404
+
405
+ ---
406
+
407
+ <div align="center">
408
+ <sub>Built with ❤️ by <a href="https://github.com/zosmaai">zosmaai</a> · </sub>
409
+ <a href="https://pi.dev">pi.dev</a> · <a href="https://github.com/zosmaai/pi-llm-wiki/issues">Issues</a>
410
+ </div>
411
+
412
+ ## Licença
413
+
414
+ MIT