@equationalapplications/core-llm-wiki
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.
📖 Docs · GitHub · ScopeLab · WikiDemo · Changelog · Issues
Inspired by Andrej Karpathy's LLM Wiki memory spec.
📖 Documentation: equationalapplications.github.io/expo-llm-wiki/packages/core. Start with the Node.js quickstart, or go straight to the API reference.
Features
- Any SQLite driver. Pure TypeScript with no native code. You pass a small
SQLiteAdapterforbetter-sqlite3,sql.js,expo-sqliteor anything else. - Bring your own inference. One
generateTextfunction, plus an optionalembedfor semantic search. The engine owns prompts, JSON parsing and database writes. - Hybrid retrieval. Vector cosine ranking with a keyword fallback (SQLite FTS5 or in-memory MiniSearch), tunable per call.
- Multi-entity reads. Search several namespaces in one pass with
tierWeightsandtierFloors. - GraphRAG. Per-entity seeded ontologies (Strict, Emergent or Off) and SQL-only graph traversal.
- Maintenance. Librarian, heal, reembed and prune jobs. By default you run them on your own schedule (deferred), or set
maintenance: 'auto'to havewrite()start the librarian and heal (reembed and prune stay on your schedule). - Temporal facts, drafts and grounding for trust and provenance.
- OKF v0.1 and v0.2 import and export.
- Diagnostics. An optional
onDiagnostichook with typed, content-free reports.
Installation
npm install @equationalapplications/core-llm-wiki
npm install better-sqlite3 # Node.js, or sql.js for the browser
Requires Node.js 20 or later. Using Expo or React? Install expo-llm-wiki or react-llm-wiki instead. Both re-export core.
Quick look
import { createWiki, formatContext } from '@equationalapplications/core-llm-wiki';
const wiki = createWiki(adapter, { llmProvider }); // your SQLiteAdapter and LLMProvider
await wiki.setup();
await wiki.write('user-123', { event_type: 'observation', summary: 'Loves hiking on weekends.' });
await wiki.runLibrarian('user-123'); // extract facts from events
const context = formatContext(await wiki.read('user-123', 'weekend plans'));
The Node.js quickstart shows a complete adapter and llmProvider.
Monorepo Ecosystem
| Package | Purpose |
|---|---|
| @equationalapplications/core-llm-wiki | Persistent episodic memory |
| @equationalapplications/expo-llm-wiki | Persistent episodic memory for Expo/React Native |
| @equationalapplications/react-llm-wiki | Persistent episodic memory for Web |
| @equationalapplications/prisma-outbox | Sync SQLite outbox events to Prisma |
| @equationalapplications/core-llm-tools | Gemini tool schemas and capability injector |
| @equationalapplications/core-okf | Zero-dependency Open Knowledge Format (OKF) v0.1 + v0.2 primitives — parse and produce interoperable knowledge bundles. |
| @equationalapplications/schema-org-llm-wiki | Curated schema.org warm-agent ontology manifest |
| @equationalapplications/schema-software-org | Software-organization executive ontology manifest — 17 node types, 40 edges, warm-agent superset, data-only |
| @equationalapplications/mcp-server | MCP server exposing SynapseTree memory tools to coding agents |
License
MIT
Made with ❤️ by Equational Applications LLC. https://equationalapplications.com/