@equationalapplications/expo-llm-wiki 4.7.0 → 4.9.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 +26 -5
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -3,9 +3,7 @@
3
3
  Expo/React Native adapter for @equationalapplications/core-llm-wiki, powered by `expo-sqlite`.
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/%40equationalapplications%2Fexpo-llm-wiki?label=npm)](https://www.npmjs.com/package/@equationalapplications/expo-llm-wiki)
6
- [![npm downloads](https://img.shields.io/npm/dm/%40equationalapplications%2Fexpo-llm-wiki?label=downloads)](https://www.npmjs.com/package/@equationalapplications/expo-llm-wiki)
7
- [![bundlephobia](https://img.shields.io/bundlephobia/minzip/%40equationalapplications%2Fexpo-llm-wiki?label=gzip)](https://bundlephobia.com/package/@equationalapplications/expo-llm-wiki)
8
- [![TypeScript](https://img.shields.io/badge/TypeScript-5.x-3178C6?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
6
+ [![npm downloads](https://img.shields.io/npm/dm/%40equationalapplications%2Fexpo-llm-wiki?label=downloads)](https://www.npmjs.com/package/@equationalapplications/expo-llm-wiki) [![TypeScript](https://img.shields.io/badge/TypeScript-5.x-3178C6?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
9
7
  [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
10
8
 
11
9
  > Inspired by [Andrej Karpathy's LLM Wiki memory spec](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f).
@@ -114,6 +112,16 @@ const wiki = createWiki(db, {
114
112
  staleInferredAfterDays: 60, // default: 60 (days before runHeal downgrades inferred facts; null to disable)
115
113
  preFilterLimit: 50, // default: undefined — MiniSearch pre-filter before cosine scan; recommended for >500 facts
116
114
  hybridWeight: 0.7, // default: undefined — blend semantic (1.0) ↔ keyword (0.0); pure semantic when unset
115
+
116
+ // Global prompt overrides — librarianSystemPrompt and healSystemPrompt apply to write() auto-runs;
117
+ // ingestSystemPrompt applies only to explicit ingestDocument() calls.
118
+ // ⚠ Overrides replace the entire default prompt, including the JSON output contract.
119
+ // Your prompt must instruct the LLM to return the required JSON shape — see packages/core/README.md#prompt-management--overrides.
120
+ prompts: {
121
+ 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.`,
122
+ 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.`,
123
+ 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.`,
124
+ },
117
125
  },
118
126
  });
119
127
  ```
@@ -168,8 +176,21 @@ const wiki = createWiki(db, {
168
176
  // Initialize tables (call once on app startup)
169
177
  await wiki.setup();
170
178
 
171
- // Use wiki instance
179
+ // Auto-runs: uses config.prompts for background librarian/heal triggers
172
180
  await wiki.write('user-123', { event_type: 'observation', summary: '...' });
181
+
182
+ // Manual executions: runtime promptOverride applies only to this single call.
183
+ // Must include the JSON output contract — overrides replace the entire default prompt.
184
+ await wiki.runLibrarian('user-123', {
185
+ 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.`,
186
+ });
187
+
188
+ await wiki.ingestDocument('user-123', {
189
+ sourceRef: 'doc-1',
190
+ sourceHash: sha256(content),
191
+ documentChunk: content,
192
+ 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.`,
193
+ });
173
194
  ```
174
195
 
175
196
  ## With React
@@ -289,7 +310,7 @@ const memory = await wiki.read(
289
310
  // tasks capped at min(20 × entityCount, 200); events at min(10 × entityCount, 100)
290
311
  ```
291
312
 
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).
313
+ 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
314
 
294
315
  ## License
295
316
 
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.9.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.9.0",
32
+ "@equationalapplications/react-llm-wiki": "4.9.0"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "expo-sqlite": "^14.0.0 || ^15.0.0 || ^55.0.0",