@equationalapplications/expo-llm-wiki 4.7.0 → 4.8.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.
Files changed (2) hide show
  1. package/README.md +25 -2
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -114,6 +114,16 @@ const wiki = createWiki(db, {
114
114
  staleInferredAfterDays: 60, // default: 60 (days before runHeal downgrades inferred facts; null to disable)
115
115
  preFilterLimit: 50, // default: undefined — MiniSearch pre-filter before cosine scan; recommended for >500 facts
116
116
  hybridWeight: 0.7, // default: undefined — blend semantic (1.0) ↔ keyword (0.0); pure semantic when unset
117
+
118
+ // Global prompt overrides — librarianSystemPrompt and healSystemPrompt apply to write() auto-runs;
119
+ // ingestSystemPrompt applies only to explicit ingestDocument() calls.
120
+ // ⚠ Overrides replace the entire default prompt, including the JSON output contract.
121
+ // Your prompt must instruct the LLM to return the required JSON shape — see packages/core/README.md#prompt-management--overrides.
122
+ prompts: {
123
+ ingestSystemPrompt: `Extract core facts from this document: {{documentChunk}}\n\nReturn ONLY valid JSON: { "facts": [{ "title": "string", "body": "string", "tags": ["string"], "confidence": "certain|inferred|tentative" }] }. No markdown.`,
124
+ librarianSystemPrompt: `Synthesize these thoughts into insights:\n{{events}}\n\nReturn ONLY valid JSON: { "facts": [{ "title": "string", "body": "string", "tags": ["string"], "confidence": "certain|inferred|tentative" }], "tasks": [{ "description": "string", "priority": 0 }] }. No markdown.`,
125
+ healSystemPrompt: `Fix the memory graph based on these candidates: {{healCandidates}}\n\nReturn ONLY valid JSON: { "downgraded": ["factId"], "deleted": ["factId"], "newFacts": [{ "title": "string", "body": "string", "tags": ["string"], "confidence": "certain|inferred|tentative" }] }. No markdown.`,
126
+ },
117
127
  },
118
128
  });
119
129
  ```
@@ -168,8 +178,21 @@ const wiki = createWiki(db, {
168
178
  // Initialize tables (call once on app startup)
169
179
  await wiki.setup();
170
180
 
171
- // Use wiki instance
181
+ // Auto-runs: uses config.prompts for background librarian/heal triggers
172
182
  await wiki.write('user-123', { event_type: 'observation', summary: '...' });
183
+
184
+ // Manual executions: runtime promptOverride applies only to this single call.
185
+ // Must include the JSON output contract — overrides replace the entire default prompt.
186
+ await wiki.runLibrarian('user-123', {
187
+ promptOverride: `Strict domain extraction task:\n{{events}}\n\nReturn ONLY valid JSON: { "facts": [{ "title": "string", "body": "string", "tags": ["string"], "confidence": "certain|inferred|tentative" }], "tasks": [{ "description": "string", "priority": 0 }] }. No markdown.`,
188
+ });
189
+
190
+ await wiki.ingestDocument('user-123', {
191
+ sourceRef: 'doc-1',
192
+ sourceHash: sha256(content),
193
+ documentChunk: content,
194
+ promptOverride: `Focus strictly on technical APIs: {{documentChunk}}\n\nReturn ONLY valid JSON: { "facts": [{ "title": "string", "body": "string", "tags": ["string"], "confidence": "certain|inferred|tentative" }] }. No markdown.`,
195
+ });
173
196
  ```
174
197
 
175
198
  ## With React
@@ -289,7 +312,7 @@ const memory = await wiki.read(
289
312
  // tasks capped at min(20 × entityCount, 200); events at min(10 × entityCount, 100)
290
313
  ```
291
314
 
292
- For Librarian prompt utilities (`hydrateLibrarianPrompt`, `validateLibrarianPromptTemplate`, etc.), see [`packages/core/README.md`](https://github.com/equationalapplications/expo-llm-wiki/blob/main/packages/core/README.md#librarian-prompt-override-contract).
315
+ For full details on `{{mustache}}` prompt templating and the strict distinction between global auto-runs and runtime overrides, see [Prompt Management & Overrides](https://github.com/equationalapplications/expo-llm-wiki/blob/main/packages/core/README.md#prompt-management--overrides) in `@equationalapplications/core-llm-wiki`.
293
316
 
294
317
  ## License
295
318
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equationalapplications/expo-llm-wiki",
3
- "version": "4.7.0",
3
+ "version": "4.8.0",
4
4
  "description": "Expo/React Native adapter for @equationalapplications/core-llm-wiki.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -28,8 +28,8 @@
28
28
  "registry": "https://registry.npmjs.org"
29
29
  },
30
30
  "dependencies": {
31
- "@equationalapplications/react-llm-wiki": "4.7.0",
32
- "@equationalapplications/core-llm-wiki": "4.7.0"
31
+ "@equationalapplications/core-llm-wiki": "4.8.0",
32
+ "@equationalapplications/react-llm-wiki": "4.8.0"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "expo-sqlite": "^14.0.0 || ^15.0.0 || ^55.0.0",