Skip to content

Getting Started

Configuration

Tune similarity thresholds, decay rates, channel weights, and learning parameters.

Similarity Threshold

Controls the minimum cosine similarity score for a memory to be included in search results. The default is 0.55. Adjust based on your use case:

  • Exploratory queries: 0.45 for broader recall, more diverse results
  • Specific lookups: 0.65 for higher precision, fewer results
const engine = new MemoryEngine({
  similarityThreshold: 0.55,
});

Recency Decay

The temporal channel applies exponential decay to memory scores based on age. The decay parameter γ (gamma) sets the half-life in days. Default is 365 days:

const engine = new MemoryEngine({
  recencyDecayDays: 365,
});

Channel Weights

The five retrieval channels are fused via weighted Reciprocal Rank Fusion. Default weights:

ChannelDefault Weight
Semantic1.0
Keyword0.9
Temporal0.8
Graph0.7
Emotional0.6
const engine = new MemoryEngine({
  channelWeights: {
    semantic: 1.0,
    keyword: 0.9,
    temporal: 0.8,
    graph: 0.7,
    emotional: 0.6,
  },
});

Thompson Sampling Prior

The multi-armed bandit starts with a Beta(1,1) uniform prior for each strategy arm. You can set an informative prior if you have domain knowledge:

const engine = new MemoryEngine({
  thompsonPrior: { alpha: 1, beta: 1 },
});

Gradient Boosting

After 100+ retrieval samples, the gradient boosting layer activates with 50 decision stumps and a learning rate of η=0.1:

const engine = new MemoryEngine({
  gradientBoosting: {
    stumps: 50,
    learningRate: 0.1,
  },
});

Meta-Memory Rules

LLM-discovered meta-memory rules require a minimum confidence threshold of 0.6 before being applied. Rules below this threshold are still stored but not used in retrieval:

const engine = new MemoryEngine({
  ruleConfidenceThreshold: 0.6,
});