Skip to content

Getting Started

Quick Start

Store your first memory and run an adaptive search in under 5 minutes.

Store a Memory

Create a memory entry. MetaMemory automatically generates multi-vector embeddings across all four encoding spaces (semantic, emotional, process, context):

import { MemoryEngine } from 'metamemory';

const engine = new MemoryEngine();
await engine.initialize();

const memory = await engine.create({
  content: 'The deployment failed because the Redis connection pool was exhausted under load.',
  userId: 'agent-1',
  metadata: {
    domain: 'infrastructure',
    taskType: 'debugging',
  },
  emotions: [{ label: 'frustration', intensity: 0.7 }],
});

console.log(memory.id);

Search Memories

Search returns ranked results via weighted Reciprocal Rank Fusion across five retrieval channels (semantic, temporal, emotional, keyword, graph):

const results = await engine.search({
  query: 'Redis connection issues',
  userId: 'agent-1',
  limit: 5,
});

for (const result of results) {
  console.log(result.score, result.content);
}

Observe Adaptive Learning

After several searches, MetaMemory's Thompson Sampling layer begins adapting retrieval strategies to your query patterns. You can inspect the current posteriors:

const strategy = await engine.getActiveStrategy('agent-1');
console.log(strategy.posteriors);
// { semantic: Beta(3, 1), temporal: Beta(2, 2), ... }

The system starts with a uniform prior Beta(1,1) for each strategy arm and updates after every retrieval based on implicit feedback signals (click-through, dwell time, reuse).