Skip to main content
Version: main

Memory Scoring

Memory scoring controls which memories are injected into session context. When more memories exist than the injection limit allows, scoring ensures the most relevant ones are included.

How It Works

Each memory receives a deterministic score in the range [0.0, 1.0] computed from four weighted components:

score = category * 0.50 + recency * 0.25 + provenance * 0.15 + access * 0.10

Memories are sorted by score (highest first) before injection. When scores are equal, ULID order (chronological) is the tiebreaker.

Components

Category (50%)

Base importance by memory category. Higher-priority categories surface first.

CategoryScoreDescription
User prefs1.00learning + scope:global tag
abandoned0.90Failed approaches to avoid
blocker0.85Blockers encountered
issue0.80Issues found
gotcha0.75Pitfalls to watch for
discovery0.70New findings
decision0.65Architectural choices
learning0.60General learnings
pattern0.60Reusable patterns
session0.40Session context

Unknown categories receive a default score of 0.50.

Recency (25%)

Exponential decay with a 30-day half-life. A memory created today scores 1.0; a memory created 30 days ago scores 0.5; 60 days ago scores 0.25, and so on.

recency = 2^(-age_days / 30)

Provenance (15%)

Additive boosts from provenance tags. Multiple boosts stack (clamped to 1.0).

TagBoostMeaning
source:user+0.20User explicitly stated this
verified:true+0.10Verified against codebase
source:discovered+0.05Agent discovered by examining code

Access (10%)

Log-scaled based on how many times the memory has been retrieved via memory_search. More-accessed memories score higher.

access = log10(1 + access_count) / log10(10)

Manual Override

If a memory's Priority field is set to a non-zero value, it replaces the computed score entirely. This allows manual pinning of important memories.

Environment Variables

VariableEffect
AIDE_MEMORY_SCORING_DISABLED=1Disable scoring entirely; use chronological ULID order
AIDE_MEMORY_DECAY_DISABLED=1Scoring is active but recency factor is always 1.0

These are useful for debugging or when you prefer time-ordered injection.

Injection Limits

ScopeLimitDescription
Global memories100Memories tagged scope:global
Project memories30Memories tagged project:<name>
Recent sessions2Most recent session groups
DecisionsAllLatest decision per topic (always injected)

When project memories exceed the limit, the highest-scoring ones are kept and an overflow flag is set.