Persistent structured memory for AI agent systems that keeps a SQLite or Postgres database and context files in sync. Current stable version 1.16.4 (released ~Jan 2025) requires Node >=18 and peer dep better-sqlite3 >=11 <13. Release cadence is monthly with minor features and patches. Key differentiator: schema-agnostic, non-AI-dependent sync loop for agent context, supporting full CRUD, natural keys, soft-delete, FTS5/tsvector full-text search, bring-your-own embeddings for semantic search, token budgeting, and a local browser GUI with multiplayer cloud editing and offline edit queue. Unlike AI-memory-pattern libraries, Lattice leaves schema control entirely to the developer and adds no opinion on agent architecture.
npm install latticesqlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to initialize Lattice with an in-memory SQLite database, define an entity, insert a record, render context, and read the output.
Run lattice migrate --workspace or manually create .lattice directory and run init({ workspace: true }).Install a compatible version: npm install better-sqlite3@'>=11 <13'
Update to new signature: defineWriteback({ table: 'my_table', parser: myParser }).Explicitly set renderFile in Lattice constructor or use lattice.config.yml to define the file path.
Define entity with a string-based primary key or set { autoIncrement: false } when using natural keys.Run: npm install better-sqlite3@'>=11 <13'
Use import syntax or set type: 'module' in package.json.
Use default import: import Lattice from 'latticesql'
Use: const lattice = new Lattice(db, config); then await lattice.init();