How HEBBS Scores Memories, and Why Repeated Patterns Matter More
How memories are ranked, reinforced and decayed, and why insights drawn from larger clusters of evidence now score higher.
Nearest-vector ranking ignores how important a memory was, how recently it was used, whether the agent has relied on it, and how much evidence stands behind a derived insight. We keep three separate scores for three jobs: importance (set once), a composite score computed at query time, and a decay score that decides long-term survival.
composite = 0.5*relevance + 0.2*recency + 0.2*importance + 0.1*reinforcement
recency = max(0, 1 - age / max_age) max_age = 30 days
reinforcement = log2(1 + access_count) / log2(1 + cap) cap = 100
decay_score = importance * 2^(-age / half_life) * (1 + reinforcement)
age = now - last_accessed_at, half_life = 30 days
insight importance = 0.7*mean_source_importance + 0.3*llm_confidence
+ ln(1 + source_count) / 10 clamped to [0, 1]Query-time ranking
Relevance depends on the strategy: 1 minus distance for similarity, rank for temporal, 1 - depth/max_depth for causal, a blend of embedding and structural similarity for analogical. Recency is deliberately linear because it is easy to reason about. Reinforcement is logarithmic: 1 access gives 0.15, 5 give 0.39, 20 give 0.63, 100 give 1.00. Its 10% weight keeps it a tiebreaker, so a frequently used but irrelevant memory does not outrank a relevant one. The weights shown are defaults and can be set per call.
Survival
A new memory starts with decay_score equal to its importance (0.5 if the caller gives none). Each time it appears in a recall result, access_count increments and last_accessed_at is set to now. Decay age is measured from last access, so a memory created six months ago and recalled yesterday is one day old for decay. A background worker recomputes scores hourly in batches of 10,000. An untouched memory with importance 0.5 falls to 0.25 after one month, 0.125 after two, and crosses the auto-forget threshold of 0.01 at around six months. The reinforcement multiplier ranges from 1.0 to about 2.0.
Insights and the frequency boost
Insights are created by the reflect pipeline, so no caller supplies their importance. The base is 70% mean source importance and 30% model confidence. That base alone scored an insight drawn from 30 call transcripts the same as one drawn from 2: with mean importance 0.6 and confidence 0.8, both came to 0.66. The frequency term fixes this. The 30-source insight becomes 0.66 + 0.34 = 1.00 and the 2-source one 0.66 + 0.11 = 0.77. The boost is +0.07 at 1 source, +0.24 at 10, +0.39 at 50 and +0.46 at 100, so going from 50 to 100 sources adds only 0.07 and a large pile of weak signals does not automatically beat a few strong ones.
Using it
Set importance at write time when you know it, since it is immutable and feeds both ranking and decay. Expect anything recalled regularly to persist and anything ignored for months to become a forget candidate. If you consolidate, cluster size now shows up directly in ranking.
