Installation
Install vault-memory with SQLite or Postgres, migrations, and vector backends.
Requirements
- Node.js 18+ or Bun 1.2+
- OpenAI API key (or custom
embed/llmfunctions) - Drizzle-compatible database driver
npm
npm install vault-memory drizzle-orm better-sqlite3Bun
If Bun blocks the faiss-node native postinstall:
bun pm trust faiss-node
bun installSchema and migrations
Import tables from the package schema:
import { claims, agentAuthority, disputes } from "vault-memory/schema";Generate migrations with Drizzle Kit:
npx drizzle-kit generate
npx drizzle-kit push| Table | Purpose |
|---|---|
claims | Facts with status, embeddings, attribution |
agent_authority | Per-entity trust weights for multi-agent resolution |
disputes | Audit trail when authority cannot pick a winner |
entities | Canonical entity taxonomy (optional, for useEntityRegistry) |
Full column reference: Schema.
Vector store
Default: FaissVectorStore via faiss-node — local index, SQL rows as source of truth.
Opt out (e.g. CI without native bindings):
import { Memory, MemoryVectorStore } from "vault-memory";
const memory = new Memory("agent-a", {
db,
vectorStore: new MemoryVectorStore(),
apiKey: process.env.OPENAI_API_KEY,
});Postgres: use PgVectorStore from vault-memory/pg when you want the index in the database.
See Vector store for backends, multi-process rebuild, and index lifecycle.
Environment variables
OPENAI_API_KEY=sk-...Override models via MemoryConfig:
const memory = new Memory("agent-a", {
db,
apiKey: process.env.OPENAI_API_KEY,
model: "gpt-4o-mini",
embeddingModel: "text-embedding-3-small",
});