@zosmaai/pi-llm-wiki 0.11.4 → 0.11.6

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.
Files changed (62) hide show
  1. package/README.de.md +8 -0
  2. package/README.es.md +8 -0
  3. package/README.fr.md +8 -0
  4. package/README.hi.md +8 -0
  5. package/README.ja.md +8 -0
  6. package/README.ko.md +8 -0
  7. package/README.md +8 -0
  8. package/README.pt.md +8 -0
  9. package/README.ru.md +8 -0
  10. package/README.zh.md +8 -0
  11. package/assets/wiki-dashboard.png +0 -0
  12. package/commands/wiki-ingest.md +1 -0
  13. package/commands/wiki-req.md +1 -0
  14. package/commands/wiki-retro.md +1 -0
  15. package/dist/extensions/llm-wiki/lib/dashboard-command.js +86 -0
  16. package/dist/extensions/llm-wiki/lib/dashboard.js +175 -0
  17. package/dist/extensions/llm-wiki/lib/guardrails.js +30 -1
  18. package/dist/extensions/llm-wiki/lib/host.js +21 -1
  19. package/dist/extensions/llm-wiki/lib/ingest-worker.js +44 -20
  20. package/dist/extensions/llm-wiki/lib/knowledge-document.js +20 -2
  21. package/dist/extensions/llm-wiki/lib/knowledge-links.js +133 -27
  22. package/dist/extensions/llm-wiki/lib/metadata.js +6 -6
  23. package/dist/extensions/llm-wiki/lib/observation.js +22 -3
  24. package/dist/extensions/llm-wiki/lib/retro.js +38 -4
  25. package/dist/extensions/llm-wiki/lib/runtime.js +2 -2
  26. package/dist/extensions/llm-wiki/lib/settings-command.js +377 -0
  27. package/dist/extensions/llm-wiki/lib/task-config.js +100 -1
  28. package/dist/extensions/llm-wiki/lib/tools.js +47 -8
  29. package/dist/mcp/index.js +2 -1
  30. package/dist/mcp/operations.js +21 -2
  31. package/docs/api.md +24 -1
  32. package/docs/commands.md +6 -1
  33. package/docs/configuration.md +11 -0
  34. package/docs/obsidian.md +6 -6
  35. package/docs/superpowers/plans/2026-08-09-qmd-retrieval-phase-1-quality-baseline-and-compatibility.md +1520 -0
  36. package/docs/superpowers/plans/2026-08-27-wikilink-resolver-normalization.md +735 -0
  37. package/docs/superpowers/plans/2026-08-29-wikilink-gate-ensure-page-retro.md +642 -0
  38. package/docs/superpowers/plans/2026-08-29-wikilink-write-validation.md +695 -0
  39. package/docs/superpowers/roadmaps/2026-08-09-qmd-retrieval-roadmap.md +448 -0
  40. package/docs/superpowers/specs/2026-08-08-qmd-retrieval-design.md +806 -0
  41. package/extensions/llm-wiki/index.ts +4 -0
  42. package/extensions/llm-wiki/lib/dashboard-command.ts +106 -0
  43. package/extensions/llm-wiki/lib/dashboard.ts +210 -0
  44. package/extensions/llm-wiki/lib/guardrails.ts +26 -1
  45. package/extensions/llm-wiki/lib/host.ts +21 -1
  46. package/extensions/llm-wiki/lib/ingest-worker.ts +64 -27
  47. package/extensions/llm-wiki/lib/knowledge-document.ts +21 -2
  48. package/extensions/llm-wiki/lib/knowledge-links.ts +208 -35
  49. package/extensions/llm-wiki/lib/metadata.ts +10 -6
  50. package/extensions/llm-wiki/lib/observation.ts +23 -3
  51. package/extensions/llm-wiki/lib/retro.ts +48 -4
  52. package/extensions/llm-wiki/lib/runtime.ts +2 -2
  53. package/extensions/llm-wiki/lib/settings-command.ts +483 -0
  54. package/extensions/llm-wiki/lib/task-config.ts +138 -0
  55. package/extensions/llm-wiki/lib/tools.ts +62 -8
  56. package/mcp/index.ts +12 -1
  57. package/mcp/operations.ts +32 -2
  58. package/package.json +4 -4
  59. package/prompts/wiki-ingest.md +1 -0
  60. package/prompts/wiki-req.md +1 -0
  61. package/prompts/wiki-retro.md +1 -0
  62. package/skills/llm-wiki/SKILL.md +11 -1
@@ -5,11 +5,15 @@
5
5
  * used by Pi tools. No operation parses YAML, scans files, scores
6
6
  * registry entries, or builds page strings itself.
7
7
  */
8
+ import { join } from "node:path";
8
9
  import { bootstrapVault } from "../extensions/llm-wiki/lib/bootstrap.js";
10
+ import { applyWikilinkGate, buildWikilinkIndex, } from "../extensions/llm-wiki/lib/knowledge-links.js";
9
11
  import { rebuildMetadata } from "../extensions/llm-wiki/lib/metadata.js";
10
12
  import { searchWikiLayered } from "../extensions/llm-wiki/lib/recall.js";
11
13
  import { saveInsight } from "../extensions/llm-wiki/lib/retro.js";
12
14
  import { captureFile, captureText, captureUrl } from "../extensions/llm-wiki/lib/source-packet.js";
15
+ import { resolveWikilinkValidation } from "../extensions/llm-wiki/lib/task-config.js";
16
+ import { readJson } from "../extensions/llm-wiki/lib/utils.js";
13
17
  import { VaultWriteError, inspectVaultFormat, inspectWritableVault, } from "../extensions/llm-wiki/lib/vault-format.js";
14
18
  import { getWikiStatus, searchRegistry } from "../extensions/llm-wiki/lib/wiki-service.js";
15
19
  function projectionOutcome(projection) {
@@ -87,7 +91,7 @@ export async function statusOperation(paths) {
87
91
  };
88
92
  }
89
93
  /** Shared retro operation: validates vault then delegates to saveInsight. */
90
- export async function retroOperation(paths, slug, title, body, category) {
94
+ export async function retroOperation(paths, slug, title, body, category, wikilinkValidation) {
91
95
  const vaultCheck = inspectWritableVault(paths);
92
96
  if (!vaultCheck.ok) {
93
97
  return {
@@ -95,8 +99,23 @@ export async function retroOperation(paths, slug, title, body, category) {
95
99
  diagnostics: vaultCheck.diagnostics.map((d) => ({ code: d.code, message: d.message })),
96
100
  };
97
101
  }
102
+ // Pre-write wikilink gate (#172): validate/normalize caller-supplied body.
103
+ const mode = resolveWikilinkValidation({ wikilinkValidation });
104
+ let gateBody = body;
105
+ if (mode !== "off") {
106
+ const registry = readJson(join(paths.meta, "registry.json"), { pages: {} });
107
+ const gate = applyWikilinkGate(body, buildWikilinkIndex(Object.keys(registry.pages)), `sources/${slug}`, mode);
108
+ if (!gate.ok) {
109
+ return {
110
+ ok: false,
111
+ diagnostics: gate.diagnostics.map((d) => ({ code: "link_validation", message: d.message })),
112
+ };
113
+ }
114
+ if (mode === "normalize")
115
+ gateBody = gate.body;
116
+ }
98
117
  try {
99
- const result = saveInsight(paths, slug, title, body, category, { rebuild: false });
118
+ const result = saveInsight(paths, slug, title, gateBody, category, { rebuild: false });
100
119
  const projection = projectionOutcome(rebuildMetadata(paths));
101
120
  if (!projection.ok)
102
121
  return projection;
package/docs/api.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  All tools registered by the extension. Parameters marked `?` are optional.
4
4
 
5
- 13 tools are always registered. The 3 agent-trajectory tools
5
+ 14 tools are always registered. The 3 agent-trajectory tools
6
6
  (`wiki_capture_trajectory`, `wiki_distill_skills`, `wiki_recall_skill`) are **opt-in,
7
7
  off by default** (issue #80) — they are only registered when `llm-wiki.trajectories`
8
8
  is `true`; enable with `/wiki-trajectories on`.
@@ -458,6 +458,29 @@ Returns empty `matches: []` with a hint to capture work via `wiki_capture_trajec
458
458
 
459
459
  ---
460
460
 
461
+ ## wiki_reindex_embeddings
462
+
463
+ Backfill or refresh semantic embeddings for the vault. Embeds pages that are new or stale
464
+ (content changed); pass `force` to re-embed everything. No-op when no embedding provider is
465
+ configured — set `llm-wiki.embeddingProvider` first (see `docs/configuration.md`).
466
+
467
+ **Parameters**
468
+
469
+ | Name | Type | Required | Description |
470
+ |------|------|----------|-------------|
471
+ | `force` | `boolean` | — | Re-embed every page, ignoring staleness (default: `false`) |
472
+
473
+ **Returns**
474
+
475
+ ```
476
+ details: { enabled: true, model: string, embedded: number, skipped: number, pruned: number }
477
+ ```
478
+
479
+ Fails soft with `details: { enabled: false }` plus a hint to configure `embeddingProvider` when
480
+ no embedding provider is set.
481
+
482
+ ---
483
+
461
484
  ## Error Shape
462
485
 
463
486
  All tools return `isError: true` in their result when a hard error occurs (no vault found, missing
package/docs/commands.md CHANGED
@@ -17,10 +17,13 @@
17
17
  | `/wiki-trajectories` | Enable/disable agent working-memory (`on`/`off`, opt-in) |
18
18
  | `/wiki-record` | Capture the completed task's trajectory (requires trajectories enabled) |
19
19
  | `/wiki-skills` | Search distilled skills + past cases (requires trajectories enabled) |
20
+ | `/wiki-req` | Decompose a concept into atomic requirement pages |
21
+ | `/wiki-settings` | Browse or change all `llm-wiki` settings (project or global scope) |
22
+ | `/wiki-dashboard` | Read-only vault health: pages, freshness, activity, ingest queue, backlinks, embeddings |
20
23
 
21
24
  ## Extension Tools
22
25
 
23
- The extension always registers 13 tools the LLM can call directly. The 3 agent-trajectory
26
+ The extension always registers 14 tools the LLM can call directly. The 3 agent-trajectory
24
27
  tools (`wiki_capture_trajectory`, `wiki_distill_skills`, `wiki_recall_skill`) are **opt-in,
25
28
  off by default** (issue #80) — registered only when `llm-wiki.trajectories` is enabled
26
29
  (`/wiki-trajectories on`).
@@ -36,7 +39,9 @@ off by default** (issue #80) — registered only when `llm-wiki.trajectories` is
36
39
  | `wiki_search` | Search the wiki registry |
37
40
  | `wiki_lint` | Health check with auto-fix |
38
41
  | `wiki_status` | Instant stats |
42
+ | `wiki_observe` | Record a timestamped observation from the current session |
39
43
  | `wiki_rebuild_meta` | Force metadata rebuild |
44
+ | `wiki_reindex_embeddings` | Refresh semantic embeddings (no-op when no embedding provider) |
40
45
  | `wiki_log_event` | Record custom event |
41
46
  | `wiki_watch` | Schedule auto-updates |
42
47
  | `wiki_capture_trajectory` | Capture the completed task's tool-call trajectory |
@@ -53,12 +53,23 @@ config directory already exists (host-native first, created if neither is
53
53
  present). A hand-authored `config.yml` is read but never rewritten.
54
54
 
55
55
  | Setting | Default | Description |
56
+ All of the above are viewable and editable in the `/wiki-settings` TUI (persists to project or global settings).
56
57
  | ---------------------- | ---------- | ------------------------------------------------------------ |
57
58
  | `taskModel` | — | Model for background tasks (`{ provider: "openai", id: "gpt-4o" }`) |
58
59
  | `synthesisLanguage` | — | BCP 47 language tag for ingest synthesis (e.g. `"ru"`, `"fr"`). When unset, synthesis defaults to English. |
60
+ | `synthesisMaxTokens` | 16384 | Max output tokens for ingest/synthesis runs (stored as a plain number) |
61
+ | `wikilinkValidation` | warn | Pre-write wikilink gate for page writes (ingest, `wiki_ensure_page`, `wiki_retro`, MCP `wiki_retro`). `off` ignore, `warn` report, `normalize` rewrite resolvable links, `strict` block writes with unresolved/ambiguous links |
59
62
  | `trajectories` | false | Enable agent-trajectory working-memory |
60
63
  | `notices` | true | Show wiki activity notices in chat |
61
64
  | `ambientPersonalVault` | host-dependent | Let the personal vault act as the ambient vault in projects that have no wiki. `true` under pi, `false` under oh-my-pi — see below. |
65
+ | `semanticWeight` | 0.5 | Weight of the semantic sub-score in hybrid recall (clamped 0–1) |
66
+ | `recallLinksThreshold` | 50 | Page-count gate for two-stage links-first recall (0 = always links-first, issue #68) |
67
+ | `recallSkillInlineMax` | 1600 | Max chars of a skill/case body inlined into recall output (0 = links only) |
68
+ | `embeddingProvider` | — | Embedding provider (e.g. `openai`); embeddings stay off until this is set |
69
+ | `embeddingModel` | — | Embedding model name (provider-specific) |
70
+ | `embeddingBaseUrl` | — | Optional API base URL override for the embedding provider |
71
+ | `embeddingApiKey` | — | API key literal — prefer `embeddingApiKeyEnv` so no secret lands in settings |
72
+ | `embeddingApiKeyEnv` | — | Name of the environment variable holding the embedding API key |
62
73
 
63
74
  Example:
64
75
 
package/docs/obsidian.md CHANGED
@@ -2,20 +2,20 @@
2
2
 
3
3
  ## Setup
4
4
 
5
- 1. Open `.llm-wiki/wiki/` as an Obsidian vault
6
- 2. The extension generates `.llm-wiki/meta/index.md` as a browsable catalog
7
- 3. `.llm-wiki/meta/backlinks.json` is available for graph plugins
5
+ 1. Open `.llm-wiki/` as an Obsidian vault
6
+ 2. Your wiki pages live in `wiki/` — Graph View and Backlinks work on these automatically
7
+ 3. The extension generates `meta/index.md` (browsable catalog) and `meta/backlinks.json` (link map) — both are read-only, regenerated on each rebuild
8
8
 
9
9
  ## Recommended Plugins
10
10
 
11
11
  - [Dataview](https://github.com/blacksmithgu/obsidian-dataview) — Query pages by frontmatter
12
- - [Graph View](https://obsidian.md) (built-in) — Visualize `[[wikilink]]` connections
12
+ - [Graph View](https://obsidian.md) (built-in) — Visualize `[[wikilink]]` connections in `wiki/`
13
13
  - [Backlinks](https://obsidian.md) (built-in) — See inbound links
14
14
 
15
15
  ## Web Clipper
16
16
 
17
- Use [Obsidian Web Clipper](https://obsidian.md/clipper) to save articles directly into `.llm-wiki/raw/articles/`.
17
+ Use [Obsidian Web Clipper](https://obsidian.md/clipper) to save articles directly into `raw/articles/`.
18
18
 
19
19
  ## Dataview Dashboard
20
20
 
21
- The extension creates `.llm-wiki/meta/index.md` with page listings. For custom dashboards, use Dataview queries against frontmatter fields like `type`, `domain`, `category`, `sources`.
21
+ For custom dashboards, use Dataview queries against frontmatter fields like `type`, `domain`, `category`, `sources`. Query the `wiki/` directory for knowledge pages.