@zosmaai/pi-llm-wiki 0.12.1 → 0.12.2

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 (48) hide show
  1. package/CHANGELOG.md +1 -0
  2. package/README.md +16 -8
  3. package/dist/extensions/llm-wiki/lib/bootstrap.js +2 -0
  4. package/dist/extensions/llm-wiki/lib/indexing.js +24 -1
  5. package/dist/extensions/llm-wiki/lib/ingest-worker.js +3 -1
  6. package/dist/extensions/llm-wiki/lib/knowledge-links.js +41 -6
  7. package/dist/extensions/llm-wiki/lib/model-command.js +45 -8
  8. package/dist/extensions/llm-wiki/lib/qmd-indexing.js +1024 -0
  9. package/dist/extensions/llm-wiki/lib/qmd-mirror.js +418 -0
  10. package/dist/extensions/llm-wiki/lib/qmd-store.js +112 -0
  11. package/dist/extensions/llm-wiki/lib/recall.js +77 -3
  12. package/dist/extensions/llm-wiki/lib/runtime.js +25 -1
  13. package/dist/extensions/llm-wiki/lib/subagent.js +47 -7
  14. package/dist/extensions/llm-wiki/lib/tools.js +165 -5
  15. package/dist/extensions/llm-wiki/lib/utils.js +16 -2
  16. package/dist/extensions/llm-wiki/lib/wiki-service.js +104 -5
  17. package/dist/mcp/index.js +66 -2
  18. package/dist/mcp/operations.js +26 -2
  19. package/docs/api.md +43 -1
  20. package/docs/architecture.md +28 -0
  21. package/docs/commands.md +1 -0
  22. package/docs/qmd-compatibility.md +47 -0
  23. package/docs/retrieval-benchmark.md +47 -0
  24. package/docs/superpowers/benchmarks/phase-1-current-baseline.json +53 -0
  25. package/docs/superpowers/plans/2026-08-09-qmd-retrieval-phase-2-remediation.md +549 -0
  26. package/docs/superpowers/plans/2026-08-09-qmd-retrieval-phase-2-validated-indexing.md +1493 -0
  27. package/docs/superpowers/plans/2026-08-11-qmd-retrieval-phase-3-retrieval-modes-and-recall-cutover.md +678 -0
  28. package/docs/superpowers/plans/2026-09-05-wikilink-alias-pipe-table-only.md +257 -0
  29. package/extensions/llm-wiki/index.ts +14 -1
  30. package/extensions/llm-wiki/lib/bootstrap.ts +2 -0
  31. package/extensions/llm-wiki/lib/indexing.ts +24 -1
  32. package/extensions/llm-wiki/lib/ingest-worker.ts +10 -2
  33. package/extensions/llm-wiki/lib/knowledge-document.ts +8 -1
  34. package/extensions/llm-wiki/lib/knowledge-links.ts +39 -7
  35. package/extensions/llm-wiki/lib/model-command.ts +57 -12
  36. package/extensions/llm-wiki/lib/qmd-indexing.ts +1304 -0
  37. package/extensions/llm-wiki/lib/qmd-mirror.ts +496 -0
  38. package/extensions/llm-wiki/lib/qmd-store.ts +222 -0
  39. package/extensions/llm-wiki/lib/recall.ts +77 -3
  40. package/extensions/llm-wiki/lib/runtime.ts +57 -5
  41. package/extensions/llm-wiki/lib/subagent.ts +73 -10
  42. package/extensions/llm-wiki/lib/tools.ts +188 -4
  43. package/extensions/llm-wiki/lib/utils.ts +21 -2
  44. package/extensions/llm-wiki/lib/wiki-service.ts +160 -4
  45. package/mcp/index.ts +78 -1
  46. package/mcp/operations.ts +41 -2
  47. package/package.json +9 -6
  48. package/skills/llm-wiki/SKILL.md +7 -1
package/mcp/operations.ts CHANGED
@@ -15,6 +15,7 @@ import {
15
15
  type WikilinkValidationMode,
16
16
  } from "../extensions/llm-wiki/lib/knowledge-links.js";
17
17
  import { type ProjectionResult, rebuildMetadata } from "../extensions/llm-wiki/lib/metadata.js";
18
+ import { reindexQmdVault } from "../extensions/llm-wiki/lib/qmd-indexing.js";
18
19
  import { type RecallResult, searchWikiLayered } from "../extensions/llm-wiki/lib/recall.js";
19
20
  import { saveInsight } from "../extensions/llm-wiki/lib/retro.js";
20
21
  import { captureFile, captureText, captureUrl } from "../extensions/llm-wiki/lib/source-packet.js";
@@ -25,7 +26,11 @@ import {
25
26
  inspectWritableVault,
26
27
  VaultWriteError,
27
28
  } from "../extensions/llm-wiki/lib/vault-format.js";
28
- import { getWikiStatus, searchRegistry } from "../extensions/llm-wiki/lib/wiki-service.js";
29
+ import {
30
+ getWikiStatus,
31
+ reindexWiki,
32
+ searchRegistry,
33
+ } from "../extensions/llm-wiki/lib/wiki-service.js";
29
34
 
30
35
  function projectionOutcome(
31
36
  projection: ProjectionResult,
@@ -38,6 +43,22 @@ function projectionOutcome(
38
43
  };
39
44
  }
40
45
 
46
+ /**
47
+ * Enqueue a post-projection lexical QMD pass. Model-free and repairable; never
48
+ * fails the authoritative write. Goes through the per-vault in-process queue.
49
+ */
50
+ async function scheduleLexicalQmd(paths: VaultPaths): Promise<void> {
51
+ try {
52
+ await reindexQmdVault(paths, {
53
+ scope: "changed",
54
+ components: ["lexical"],
55
+ force: false,
56
+ });
57
+ } catch {
58
+ // Generated QMD state is repairable; an authoritative write must not fail.
59
+ }
60
+ }
61
+
41
62
  /**
42
63
  * Shared bootstrap operation: create (or update) the vault at `paths`.
43
64
  *
@@ -113,6 +134,20 @@ export async function searchOperation(
113
134
  };
114
135
  }
115
136
 
137
+ /** Shared reindex operation: delegates to the shared reindexWiki operation. */
138
+ export async function reindexOperation(
139
+ paths: VaultPaths,
140
+ input: {
141
+ scope?: "changed" | "all";
142
+ components?: Array<"lexical" | "vectors">;
143
+ force?: boolean;
144
+ vault?: "active" | "personal" | "project" | "all";
145
+ signal?: AbortSignal;
146
+ },
147
+ ): Promise<import("../extensions/llm-wiki/lib/wiki-service.js").WikiReindexResult> {
148
+ return reindexWiki(paths, input);
149
+ }
150
+
116
151
  /** Shared status operation: delegates directly to wiki-service. */
117
152
  export async function statusOperation(paths: VaultPaths): Promise<{
118
153
  knowledgeFormat: string;
@@ -120,8 +155,9 @@ export async function statusOperation(paths: VaultPaths): Promise<{
120
155
  byType: Record<string, number>;
121
156
  blockingDiagnostics: Array<{ code: string; message: string }>;
122
157
  lastUpdated: string;
158
+ qmd: import("../extensions/llm-wiki/lib/qmd-indexing.js").QmdGeneratedStatus;
123
159
  }> {
124
- const status = getWikiStatus(paths);
160
+ const status = await getWikiStatus(paths);
125
161
  return {
126
162
  knowledgeFormat: status.knowledgeFormat,
127
163
  totalPages: status.totalPages,
@@ -131,6 +167,7 @@ export async function statusOperation(paths: VaultPaths): Promise<{
131
167
  message: d.message,
132
168
  })),
133
169
  lastUpdated: status.lastUpdated,
170
+ qmd: status.qmd,
134
171
  };
135
172
  }
136
173
 
@@ -179,6 +216,7 @@ export async function retroOperation(
179
216
  const result = saveInsight(paths, slug, title, gateBody, category, { rebuild: false });
180
217
  const projection = projectionOutcome(rebuildMetadata(paths));
181
218
  if (!projection.ok) return projection;
219
+ await scheduleLexicalQmd(paths);
182
220
  return { ok: true, slug: result.slug, sourcePagePath: result.sourcePagePath };
183
221
  } catch (error: unknown) {
184
222
  if (error instanceof VaultWriteError) {
@@ -236,6 +274,7 @@ export async function captureSourceOperation(
236
274
 
237
275
  const projection = projectionOutcome(rebuildMetadata(paths));
238
276
  if (!projection.ok) return projection;
277
+ await scheduleLexicalQmd(paths);
239
278
  return { ok: true, sourceId };
240
279
  } catch (error: unknown) {
241
280
  if (error instanceof VaultWriteError) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zosmaai/pi-llm-wiki",
3
- "version": "0.12.1",
3
+ "version": "0.12.2",
4
4
  "description": "Self-maintaining LLM Wiki for Pi — Karpathy-pattern knowledge base with immutable source capture, automated ingestion, search, linting, and Obsidian-compatible vault. auto-updating personal & company wiki.",
5
5
  "keywords": [
6
6
  "pi",
@@ -78,12 +78,13 @@
78
78
  "@earendil-works/pi-coding-agent": ">=0.78.1"
79
79
  },
80
80
  "engines": {
81
- "node": ">=18"
81
+ "node": ">=22.0.0"
82
82
  },
83
83
  "dependencies": {
84
84
  "@cfworker/json-schema": "^4.1.1",
85
- "@earendil-works/pi-tui": "0.84.4",
85
+ "@earendil-works/pi-tui": "0.85.1",
86
86
  "@modelcontextprotocol/server": "^2.0.0",
87
+ "@tobilu/qmd": "2.5.3",
87
88
  "mdast-util-from-markdown": "^2.0.3",
88
89
  "node-html-markdown": "^2.0.0",
89
90
  "typebox": "^1.1.34",
@@ -93,9 +94,9 @@
93
94
  "devDependencies": {
94
95
  "@astrojs/starlight": "^0.41.10",
95
96
  "@biomejs/biome": "^2.5.11",
96
- "@earendil-works/pi-agent-core": "^0.78.1",
97
- "@earendil-works/pi-ai": "^0.78.1",
98
- "@earendil-works/pi-coding-agent": "^0.78.1",
97
+ "@earendil-works/pi-agent-core": "^0.85.1",
98
+ "@earendil-works/pi-ai": "^0.85.1",
99
+ "@earendil-works/pi-coding-agent": "^0.85.1",
99
100
  "@mermaid-js/mermaid-cli": "^11.12.0",
100
101
  "@types/mdast": "^4.0.4",
101
102
  "@types/node": "^26",
@@ -117,6 +118,8 @@
117
118
  "release:minor": "node scripts/release.js minor",
118
119
  "release:major": "node scripts/release.js major",
119
120
  "release:push": "git push origin main --tags",
121
+ "benchmark:retrieval": "vitest run test/retrieval-benchmark.test.ts --reporter=verbose",
122
+ "benchmark:retrieval:update": "node scripts/update-retrieval-baseline.mjs",
120
123
  "docs:sync": "node scripts/sync-docs.js",
121
124
  "docs:dev": "astro dev",
122
125
  "docs:build": "node scripts/sync-docs.js && astro build"
@@ -37,11 +37,17 @@ WIKI_ROOT/
37
37
  │ ├── backlinks.json # Inbound link map
38
38
  │ ├── index.md # Human-readable catalog
39
39
  │ ├── log.md # Activity log
40
- │ └── events.jsonl # Structured event stream
40
+ │ ├── events.jsonl # Structured event stream
41
+ │ └── qmd/ # Generated QMD search index (mirrors + SQLite)
41
42
  ├── outputs/ # Generated artifacts
42
43
  └── .discoveries/ # Discovery tracking
43
44
  ```
44
45
 
46
+ > `meta/qmd/` is extension-owned, generated, and **rebuildable** with `wiki_reindex`. It never
47
+ > scans `wiki/` directly — it indexes parser-valid mirrors. Do not edit individual SQLite/WAL/SHM
48
+ > files inside `meta/qmd/current/`; restore the whole directory or rebuild. Active recall still uses
49
+ > the legacy heuristic until Phase 3.
50
+
45
51
  ## Golden Rules
46
52
 
47
53
  1. **RAW IS IMMUTABLE.** Never edit `raw/`. Use `wiki_capture_source` to add sources.