@equationalapplications/core-llm-wiki 4.8.0 → 4.10.1

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.md CHANGED
@@ -1,6 +1,12 @@
1
1
  # @equationalapplications/core-llm-wiki
2
2
 
3
- Pure TypeScript business logic for LLM Wiki Memory.
3
+ Platform-agnostic TypeScript engine for hybrid LLM memory. Features episodic fact extraction, semantic vector search, and multi-agent architectures over SQLite. Bring your own adapter.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/%40equationalapplications%2Fcore-llm-wiki?label=core)](https://www.npmjs.com/package/@equationalapplications/core-llm-wiki) [![npm downloads](https://img.shields.io/npm/dm/%40equationalapplications%2Fcore-llm-wiki?label=downloads)](https://www.npmjs.com/package/@equationalapplications/core-llm-wiki)
6
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.x-3178C6?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
7
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/equationalapplications/expo-llm-wiki/blob/main/packages/core/LICENSE)
8
+
9
+ **[GitHub](https://github.com/equationalapplications/expo-llm-wiki)** · **[Playground](https://equationalapplications.github.io/expo-llm-wiki/playground/)** · **[Changelog](https://github.com/equationalapplications/expo-llm-wiki/blob/main/CHANGELOG.md)** · **[Issues](https://github.com/equationalapplications/expo-llm-wiki/issues)**
4
10
 
5
11
  > Inspired by [Andrej Karpathy's LLM Wiki memory spec](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f).
6
12
 
@@ -8,7 +14,7 @@ Pure TypeScript business logic for LLM Wiki Memory.
8
14
 
9
15
  - **Platform-agnostic** — Zero runtime dependencies; works with any SQLite driver via the `SQLiteAdapter` interface
10
16
  - **Semantic search** — Vector embeddings via your LLM's `embed` function, ranked by cosine similarity
11
- - **Keyword fallback** — MiniSearch in-memory index for offline/degraded scenarios when embeddings unavailable
17
+ - **Keyword fallback** — [MiniSearch](https://github.com/lucaong/minisearch) in-memory index for offline/degraded scenarios when embeddings unavailable
12
18
  - **Retrieval tuning** — Per-call overrides for `maxResults`, `preFilterLimit`, `hybridWeight`, `tierWeights`, and `includeZeroWeightEntities`
13
19
  - **Multi-entity reads** — Search across multiple `entity_id` namespaces in one pass with per-entity score multipliers (`tierWeights`); optional `factScores` and `metadata` for explainability
14
20
  - **Immutable vs mutable facts** — Use `WikiFact.source_type` to distinguish document-sourced facts (`immutable_document`) from derived or user-provided facts (`librarian_inferred`, `user_stated`, `user_confirmed`). Immutable document facts are not rewritten by `runLibrarian()` or `runHeal()` and can only be removed by `forget()` or re-ingesting.
@@ -92,6 +98,7 @@ const wikiMemory = new WikiMemory(db, {
92
98
  staleInferredAfterDays: 60, // default: 60 (days before runHeal downgrades inferred facts; null to disable)
93
99
  preFilterLimit: 50, // default: undefined — MiniSearch pre-filter before cosine scan; recommended for >500 facts
94
100
  hybridWeight: 0.7, // default: undefined — blend semantic (1.0) ↔ keyword (0.0); pure semantic when unset
101
+ enableOutbox: false, // default: false — when true, entry/task mutations write to an internal SQLite outbox table for external sync (e.g. via @equationalapplications/prisma-outbox)
95
102
 
96
103
  // Global prompt overrides — librarianSystemPrompt and healSystemPrompt apply to write() auto-runs;
97
104
  // ingestSystemPrompt applies only to explicit ingestDocument() calls.
@@ -235,7 +242,7 @@ When `preFilterLimit: 50` is set with 1000 facts, cosine similarity is computed
235
242
 
236
243
  ## Pluggable Vector Retrieval
237
244
 
238
- When your entity corpus grows, in-process cosine similarity scoring becomes a bottleneck. The optional **`VectorRanker`** interface lets you delegate semantic ranking to **sqlite-vec**, **sqlite-vss**, or an external vector database while `WikiMemory` handles embedding validation, hybrid scoring, and tier-2 row hydration.
245
+ When your entity corpus grows, in-process cosine similarity scoring becomes a bottleneck. The optional **`VectorRanker`** interface lets you delegate semantic ranking to [**sqlite-vec**](https://github.com/asg017/sqlite-vec), [**sqlite-vss**](https://github.com/asg017/sqlite-vss), or an external vector database while `WikiMemory` handles embedding validation, hybrid scoring, and tier-2 row hydration.
239
246
 
240
247
  ### `VectorRanker` purpose
241
248
 
@@ -450,7 +457,7 @@ If implementing a custom `VectorRanker`:
450
457
  - **Credential Scrubbing**: Strip API keys, tokens, connection strings from thrown errors before surfacing to host.
451
458
  - **Resource Limits**: Cap `limit` and `candidateIds.length` to prevent DoS. Do NOT retain `vector` references beyond callback scope — blocks GC.
452
459
 
453
- See [SECURITY.md](../../SECURITY.md) for complete adapter security guidance and code examples.
460
+ See [SECURITY.md](https://github.com/equationalapplications/expo-llm-wiki/blob/main/SECURITY.md) for complete adapter security guidance and code examples.
454
461
 
455
462
  ### Host Application Security
456
463
 
@@ -580,7 +587,7 @@ export interface SQLiteAdapter {
580
587
 
581
588
  `@equationalapplications/expo-llm-wiki` provides a pre-built adapter for Expo/React Native. For web and Node.js, implement the interface yourself — examples below.
582
589
 
583
- **Browser (sql.js):**
590
+ **Browser ([sql.js](https://github.com/sql-js/sql.js)):**
584
591
 
585
592
  ```typescript
586
593
  import initSqlJs from 'sql.js';
@@ -620,7 +627,7 @@ const adapter: SQLiteAdapter = {
620
627
  };
621
628
  ```
622
629
 
623
- **Node.js (better-sqlite3):**
630
+ **Node.js ([better-sqlite3](https://github.com/WiseLibs/better-sqlite3)):**
624
631
 
625
632
  ```typescript
626
633
  import Database from 'better-sqlite3';
@@ -685,6 +692,16 @@ The flowchart shows:
685
692
  5. **Hybrid scoring** to blend semantic and keyword rankings
686
693
  6. **Vector caching** on full scans only; reads with `preFilterLimit` active skip cache population
687
694
 
695
+ ## Monorepo Ecosystem
696
+
697
+ | Package | Description |
698
+ |---------|-------------|
699
+ | **`@equationalapplications/core-llm-wiki`** | Pure TypeScript core — DB-agnostic, bring your own SQLite adapter |
700
+ | [`@equationalapplications/expo-llm-wiki`](https://www.npmjs.com/package/@equationalapplications/expo-llm-wiki) | Expo / React Native adapter with `expo-sqlite` |
701
+ | [`@equationalapplications/react-llm-wiki`](https://www.npmjs.com/package/@equationalapplications/react-llm-wiki) | React hooks + web adapter with `sql.js` |
702
+ | [`@equationalapplications/prisma-outbox`](https://www.npmjs.com/package/@equationalapplications/prisma-outbox) | Sync SQLite outbox events to Prisma in a transaction |
703
+ | [`@equationalapplications/core-llm-tools`](https://www.npmjs.com/package/@equationalapplications/core-llm-tools) | Platform-agnostic Gemini tool schemas + capability scope injector |
704
+
688
705
  ## License
689
706
 
690
707
  MIT
@@ -2543,5 +2543,5 @@ var WriteService = class {
2543
2543
  };
2544
2544
 
2545
2545
  export { EmbeddingService, HOOK_TIMEOUT_MARKER, ImportExportService, IngestionService, JobManager, MaintenanceService, PromptService, PrunePartialFailureError, RetrievalService, SearchService, WikiBusyError, WriteService, __privateAdd, __privateGet, __privateSet, generateId, normalizeSourceHash, normalizeSourceRef, parseEmbedding };
2546
- //# sourceMappingURL=chunk-2FGDZKC2.mjs.map
2547
- //# sourceMappingURL=chunk-2FGDZKC2.mjs.map
2546
+ //# sourceMappingURL=chunk-6FWG2DG4.mjs.map
2547
+ //# sourceMappingURL=chunk-6FWG2DG4.mjs.map