Memory is the storage layer that keeps the context you have approved.
Memory acts as the database for your provider. It stores:
- Your approved context (the facts you accept or edit).
- The evidence chains showing which apps suggested what data and when.
- The age and decay status of each fact.
- Your review history (what you accepted, modified, or rejected).
- Secure Persistence: Holds approved statements securely.
- Index & Retrieval: Fast indexing to retrieve only relevant approved statements when queried by authorized apps.
For production environments, Memact Memory provides a PostgreSQL adapter aligned with the V1 Supabase architecture.
- Run the database migration script located at
database/migration_v1.sqlto create the requiredmemact_memory_entriesandmemact_app_permissionstables. - Initialize the adapter in your server code:
import pg from 'pg';
import { createMemoryRepository } from 'memact-memory/storage';
import { createPostgresMemoryAdapter } from 'memact-memory/adapters/postgresql';
const pool = new pg.Pool({ connectionString: process.env.DATABASE_URL });
const memoryStore = createMemoryRepository(
createPostgresMemoryAdapter({ pool, userId: 'user-uuid-here' })
);You can export approved memory entries to an AES-256-GCM encrypted JSON backup and restore them later. Only approved states (active, accepted, approved, edited, user_verified) are included. Pending, deleted, or forgotten entries are skipped.
The encryption key is read from these environment variables:
MEMACT_MEMORY_ENCRYPTION_KEY: 32-byte key as base64 or 64-char hex (required).MEMACT_MEMORY_ENCRYPTION_KEY_ID: key identifier recorded in the envelope (optional, defaults toprimary).
# Back up a memory store to an encrypted file
node ./scripts/memory-backup.mjs backup --store memory.json --out backup.json
# Restrict the export to specific states
node ./scripts/memory-backup.mjs backup --store memory.json --out backup.json --states approved,user_verified
# Restore a memory store from an encrypted backup
node ./scripts/memory-backup.mjs restore --in backup.json --out restored.jsonThese operations are also available programmatically through backup-restore.mjs.
To install and run tests:
npm install
npm testMemory is open source under the Apache 2.0 license.