Expose the raw storage adapter for advanced usage.
Primarily used by SqliteExporter (VACUUM INTO) and SqliteImporter (which needs direct adapter access for the target brain).
Platform-aware feature bundle (dialect, FTS, BLOB codec, exporter). Consumers use this to generate cross-platform SQL instead of hardcoding SQLite-specific syntax.
Static openCreate or open the agent's brain database at dbPath.
Async factory that replaces the previous synchronous constructor.
Initialization sequence:
CREATE TABLE IF NOT EXISTS).brain_meta with schema_version and created_at if absent.Absolute path to the .sqlite file. The file is created
if it does not exist; parent directories must already exist.
A fully initialised SqliteBrain instance.
Execute a mutation statement (INSERT, UPDATE, DELETE).
SQL statement with ? positional placeholders.
Optional params: StorageParametersParameter array matching the placeholders.
Metadata about affected rows.
Check whether a given embedding dimension is compatible with this brain.
On first call (no stored embedding_dimensions), returns true and stores
the provided dimension for future compatibility checks.
Subsequent calls compare dimensions against the stored value.
Mismatches indicate that a different embedding model was used to encode
memories — mixing dimensions would corrupt vector similarity searches.
The embedding vector length to check (e.g. 1536 for OpenAI ada-002).
true if compatible (or no prior value), false on mismatch.
Unified cross-platform connection manager for a single agent's persistent brain.
Uses the
StorageAdapterinterface from@framers/sql-storage-adapterto support multiple backends (better-sqlite3, sql.js, IndexedDB, Postgres, etc.) transparently. All methods are async.Usage:
Subsystems (KnowledgeGraph, MemoryGraph, ConsolidationLoop, etc.) receive the
SqliteBraininstance and call its async proxy methods (run,get,all,exec,transaction) for all database operations.