vinkura-memory
v0.2.0
Published
Multi-tenant, production-safe memory layer for AI applications
Maintainers
Readme
Vinkura Memory Layer
A multi-tenant, production-grade memory engine for AI applications. Built on PostgreSQL and pgvector to solve the complex problem of data isolation and semantic retrieval in enterprise SaaS environments.
The Problem
Most AI frameworks (LangChain, LlamaIndex) assume a single-tenant environment. In real-world SaaS, enterprise, and government applications, you have:
- Multiple organizations.
- Distinct users with hierarchical roles.
- Strict data residency and isolation requirements.
- The need for full auditability.
Vinkura Memory Layer provides the infrastructure to build secure AI products where multi-tenancy is enforced by architecture, not just developer discipline.
Key Features
- Architectural Isolation: Every query is implicitly scoped to an organization through service-level context.
- Namespacing (v0.2.0): Organize memory within orgs into logical namespaces (e.g., 'staging', 'production', 'project-x').
- pgvector Integration: Native support for high-performance HNSW vector search.
- Strict Integrity: Database-level composite foreign keys prevent cross-tenant writes.
- Granular Visibility: Support for
private,org, andpublicmemory scopes. - Traceable Audit Logs: Full history of who queried what and when.
- Drizzle ORM: Lightweight, type-safe database interactions.
Quick Start
1. Prerequisites
- PostgreSQL with
pgvectorextension. - Node.js v18+.
2. Installation
npm install vinkura-memory3. Usage
import { MemoryService, AccessControl, MockEmbeddingProvider, createDb } from 'vinkura-memory';
const { db } = createDb(process.env.DATABASE_URL);
// 1. Validate the user context (typically from a session/JWT)
const security = new AccessControl(db);
const context = await security.validateContext('user_uuid', 'org_uuid');
// 2. Instantiate the scoped service
const memory = new MemoryService(db, context, new MockEmbeddingProvider());
// 3. Store knowledge in a specific namespace
await memory.store({
content: "The Q3 roadmap focuses on multi-cloud expansion.",
visibility: 'org',
namespace: 'internal-wiki',
metadata: { priority: 'high' }
});
// 4. Semantic Query within a namespace
const results = await memory.query({
text: "What are our roadmap priorities?",
namespace: 'internal-wiki',
limit: 5
});Documentation
Development
To run tests locally, ensure you have a standard Postgres instance with pgvector running:
docker-compose up -d
npm testAuthors
- Akshat Shukla (@binarybardakshat)
- VinkuraAI
License
MIT
