Skip to content

Getting Started

Installation

Set up MetaMemory in your project with the required dependencies and infrastructure.

Prerequisites

MetaMemory is built on TypeScript and requires the following infrastructure:

  • PostgreSQL: structured storage via Prisma ORM
  • Pinecone: 1536-dimensional vector index for semantic embeddings
  • OpenAI API key: embedding generation (text-embedding-ada-002)
  • Redis (optional): pattern-based cache invalidation
  • Neo4j (optional): entity relationship graph for graph-channel retrieval

Install the Package

npm install metamemory

Or with your preferred package manager:

pnpm add metamemory
# or
yarn add metamemory

Generate the Prisma Client

MetaMemory uses Prisma for PostgreSQL access. After installing, generate the client:

npx prisma generate

Environment Variables

Create a .env file at your project root with the following variables:

# Required
DATABASE_URL="postgresql://user:password@localhost:5432/metamemory"
PINECONE_API_KEY="your-pinecone-api-key"
PINECONE_INDEX="metamemory"
OPENAI_API_KEY="your-openai-api-key"

# Optional
REDIS_URL="redis://localhost:6379"
NEO4J_URI="bolt://localhost:7687"
NEO4J_USER="neo4j"
NEO4J_PASSWORD="password"

Run Migrations

Apply the database schema to your PostgreSQL instance:

npx prisma migrate deploy

This creates the tables for memories, episodes, conversations, strategy state, and meta-memory rules.

Verify Installation

Run a quick smoke test to confirm everything is connected:

import { MemoryEngine } from 'metamemory';

const engine = new MemoryEngine();
await engine.initialize();
console.log('MetaMemory is ready');