Mneme

Memory System

How Mneme scores, decays, consolidates, and promotes memories.

The memory system is the intelligence layer of Mneme. It transforms raw signals into structured, scored memories that provide context for PR analysis.

Memory Types

Each memory is classified into one of six types:

TypeDescriptionHalf-lifeExample
decisionArchitecture or design choices30 days"Team decided to use event sourcing for the order service"
patternRecurring implementation approaches20 days"Error boundaries are placed at route level in the React app"
conventionTeam standards and naming rules60 days"All API endpoints use camelCase for response fields"
issueBugs, incidents, known problems7 days"Race condition in the payment webhook handler"
preferenceIndividual or team preferences14 days"The team prefers explicit error types over generic Error"
factStable truths about the codebase90 days"The auth service uses JWT with RS256 signing"

Statuses

  • active — the memory is current and used in scoring
  • decaying — confidence is declining but still above archive threshold
  • archived — confidence fell below 0.1 or received too many contradictions
  • contradicted — a newer signal directly contradicts this memory

Scopes

  • repo — applies to a single repository
  • org — promoted to apply across the organization (see Org Promotion)

Confidence Scoring

Bayesian Priors

Initial confidence is derived from the signal source and the LLM's confidence assessment:

Source priors:

SourcePrior
GitHub0.6
Slack0.5
Linear0.55

Confidence level multipliers:

LevelMultiplier
High1.0x
Medium0.7x
Low0.4x

Combined Scoring

When a memory is retrieved for PR context, it is scored using a weighted geometric mean of three factors:

combined = recency^0.3 × relevance^0.5 × importance^0.2

Recency Score

Exponential decay with a 7-day half-life:

recency = e^(-λ × days)

where λ = ln(2) / 7 ≈ 0.099.

A memory updated today scores 1.0; after 7 days it scores 0.5; after 14 days, 0.25.

Relevance Score

Based on cosine similarity between the PR context embedding and the memory embedding, with bonuses for entity and file overlap:

relevance = min(1, cosine_similarity + entity_overlap × 0.05 + file_overlap × 0.1)

Files are weighted 2x compared to entities because file overlap is a stronger signal of relevance.

Importance Score

Combines confidence with a logarithmic corroboration factor:

importance = confidence × (0.5 + 0.5 × ln(corroborations + 1) / ln(11))

This normalizes to approximately 1.0 at 10 corroborations. A memory with no corroborations starts at confidence × 0.5.

Decay

Active memories decay over time using exponential decay:

confidence = confidence × e^(-decay_rate × hours_since_update)

The decay_rate is computed at memory creation from the type-specific half-life:

decay_rate = ln(2) / half_life_hours

Reinforcement Window

Memories that have been corroborated or accessed within the last 48 hours are skipped during decay cycles. This prevents recently-validated memories from losing confidence.

Archive Threshold

When confidence drops below 0.1, the memory is archived. Memories with 2 or more contradictions are also archived.

Consolidation

Periodically, the consolidation process:

  1. Computes embeddings for all active memories
  2. Clusters similar memories (cosine similarity > 0.85)
  3. Uses the LLM to merge redundant memories into a single, refined memory
  4. Updates entity references and keywords

This keeps the memory store clean and prevents duplicate memories from accumulating.

Org Promotion

When a memory appears consistently across multiple repositories, it can be promoted to organization scope:

  • Minimum repos: 3 — the same concept must appear in at least 3 different repos
  • Similarity threshold: 0.9 — cosine similarity must be very high
  • Minimum confidence: 0.7 — each repo-level memory must be confident

Org-level memories are used to enrich PR analyses across all repositories in the organization.

Memory Cap

Each repository is limited to 500 active memories. When the cap is reached, the lowest-scoring memories are archived to make room for new ones.

Feedback Loop

Users can provide feedback on memories surfaced during PR analysis:

  • Positive — the memory was helpful and relevant
  • Negative — the memory was unhelpful, outdated, or wrong

Feedback adjusts memory confidence and is stored as evidence for future reference.

On this page