@open-engram/core
v1.0.1
Published
Core memory architecture for Open-Engram — stores, gates, retrieval, consolidation
Readme
@open-engram/core
Core memory architecture for Open-Engram — a biologically-grounded, four-store memory system for AI agents.
Install
npm install @open-engram/coreOverview
Implements the four-store memory model inspired by Standard Consolidation Theory, Complementary Learning Systems, Baddeley's working memory model, and thalamic gating theory:
- Sensory Buffer — high-throughput ingestion with TTL-based expiry
- Working Memory — capacity-limited active context scored by Recency-Frequency-Relevance (RFR)
- Episodic Store — contextually-indexed event records with vector search
- Semantic Store — long-term structured knowledge with versioning and conflict resolution
Plus subsystems: Attention Gate, Consolidation Engine (7-stage distillation pipeline), and Tiered Retrieval (T0/T1/T2).
Quick Start
import { EngramClient } from '@open-engram/core';
const client = await EngramClient.create({
workingMemory: { tokenBudget: 8192 },
consolidation: { trigger: 'session-end' },
});
// Ingest an event
await client.sense({ content: 'User prefers dark mode', source: 'settings' });
// Run attention gate → promote to working memory
await client.focus();
// Search across stores
const results = await client.recall('user preferences', { limit: 5 });
// Save a fact to semantic memory
await client.remember('User prefers dark mode', { confidence: 0.9 });
// Run consolidation pipeline (episodic → semantic)
await client.consolidate();
// Export full memory state
const snapshot = await client.export();API
| Method | Description |
|---|---|
| sense(event) | Ingest into sensory buffer |
| focus() | Run attention gate, promote to working memory |
| recall(query, opts) | Search across episodic + semantic stores |
| remember(content, opts) | Write directly to semantic store |
| checkpoint(label) | Snapshot working memory to episodic store |
| consolidate() | Run 7-stage distillation pipeline |
| forget(id) | Remove a specific record |
| purge() | Clear all stores |
| pin(id) / unpin(id) | Protect entries from eviction |
| status() | Memory stats and store counts |
| export() / import(data) | Serialize/deserialize full state |
Adapters
The core package uses an in-memory adapter by default. For persistent storage, use:
@open-engram/adapters-storage— SQLite + sqlite-vec@open-engram/adapters-storage-postgres— PostgreSQL + pgvector@open-engram/adapters-storage-powersync— PowerSync bi-directional sync@open-engram/adapters-storage-supabase— Supabase + pgvector RPC
License
Apache-2.0
