Repository navigation
Closed
Labels
enhancementNew feature or requestpriority:mediumFix soonscope:coreCore engine workv0.1.0Feature bump
Description
Feature: Smart Memory Decay and Importance Scoring
Problem
Current aging system is simple time-based (hot/warm/cold based on days since last access). It does not differentiate between:
- A memory accessed 50 times vs 1 time
- A memory explicitly pinned by user vs auto-stored
- A memory that is frequently co-recalled with other memories (high connectivity)
Proposed Solution
Replace simple time-based tiers with a composite importance score:
Importance Formula
importance = (access_weight * access_score)
+ (recency_weight * recency_score)
+ (connectivity_weight * connectivity_score)
+ (pin_weight * is_pinned)
+ (explicit_weight * was_explicit)
Where:
- access_score = min(access_count / 10, 1.0) - normalized access frequency
- recency_score = exponential decay from last access (half-life: 30 days)
- connectivity_score = min(relationship_count / 5, 1.0) - depends on graph layer (issue #N)
- is_pinned = 1.0 if user pinned, 0.0 otherwise
- was_explicit = 1.0 if user manually stored, 0.5 if auto-stored
Schema Changes
ALTER TABLE memories ADD COLUMN importance REAL DEFAULT 0.5;
ALTER TABLE memories ADD COLUMN pinned INTEGER DEFAULT 0;New CLI Commands
uteke pin <id> -- pin important memory (never decays)
uteke unpin <id> -- unpin
uteke importance -- recalculate all importance scores
uteke aging --strategy importance -- use importance-based pruning
Integration with Graph Layer
- Connectivity score feeds from memory_edges (issue #N)
- If graph layer not available, connectivity_weight = 0
Effort
Medium (1-2 weeks)
- 3 days: Schema migration + importance calculation
- 2 days: Pin/unpin commands
- 2 days: Integration with aging cleanup
- 1 day: Tests and benchmarks
Validation
- Importance distribution across existing memories (should not be flat)
- Correlation: do high-importance memories match user expectations?
- Aging cleanup now preserves important memories correctly
Update from SurrealDB Research (Jun 2026)
After deep analysis of SurrealDB's multi-model architecture and Uteke's roadmap, the importance formula should include a room activity factor:
importance = (access_weight * access_score)
+ (recency_weight * recrecency_score)
+ (connectivity_weight * connectivity_score)
+ (pin_weight * is_pinned)
+ (explicit_weight * was_explicit)
+ (room_weight * in_active_room) # NEW
Where:
in_active_room= 1.0 if the memory belongs to a room with activity in the last 7 days, 0.0 otherwise- Room-active memories are "hot context" — they represent ongoing collaboration and should resist decay
- This interacts with the Room feature (feat(#134): file permissions and ONNX model checksum verification #278): rooms with recent
remember/recallactivity are considered "active"
Schema Impact
ALTER TABLE memories ADD COLUMN room TEXT;
-- Active rooms can be determined by: SELECT DISTINCT room FROM memories WHERE room IS NOT NULL AND updated_at > datetime('now', '-7 days')Priority: No Change
Room factor is additive — does not change current v0.1.0 scope or timeline.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestpriority:mediumFix soonscope:coreCore engine workv0.1.0Feature bump
Activity
ajianaz commentedon Jun 11, 2026
⭐ Update: Room Participation as Importance Signal (from SurrealDB analysis, #286)
Room Activity as Importance Factor
With the new Room feature (#286), room participation should be a factor in the importance scoring formula:
Updated Importance Formula
Where:
room_score = min(room_participation_count / 5, 1.0)— normalized room activityroom_participation_count= number of rooms this memory is linked torole = "lead") get higher weight than participantRationale
Updated Acceptance Criteria (add to existing)
room_scorecomputed fromroom_memoriesparticipation countuteke importancecommand recalculates room scoresDependency Note
#286 (Room) must be implemented first — room_memories table provides the data for room_score. Order: #249 → #286 → #246 → #248 → THIS (#247).
ferhimedamine commentedon Jun 11, 2026
Good feature design — the composite importance score approach is the right direction. A few patterns from running this in production that might help refine the formula:
Access frequency needs diminishing returns.
Raw
access_countover-weights memories that sit on hot recall paths — e.g., an agent's name or a system prompt fragment that gets recalled 100x per day. Linear access scoring makes these dominate. A log-scale (log2(access_count + 1)) or square-root normalization gives frequently-accessed memories a boost without drowning out everything else.Connectivity weight is the most underrated signal.
Your
connectivity_score(co-recall frequency) captures something that pure access and recency miss: structural importance. A memory that is frequently recalled alongside other memories is a hub in the knowledge graph — removing it degrades multiple recall chains, not just one. In practice, we weight connectivity higher than pure access for long-running agents because it surfaces the "load-bearing" memories that hold context together.User-pinned vs auto-stored needs more than a boolean.
Rather than a binary pin, consider an importance floor: pinned memories get
min_importance = 0.8(they can still rank higher via access/connectivity but never decay below the floor). This avoids the trap where a pinned memory from 6 months ago outranks a critically important recent memory just because it has the pin flag.One missing signal: memory type.
Not all memories decay the same way. Standing facts ("the API uses port 3300") should decay slower than session observations ("user asked about deployment today"). A
memory_typeenum (e.g.,semanticfor facts,episodicfor events,proceduralfor learned patterns) lets you apply different weight profiles per type rather than one formula for all memories.feat(#247): smart memory decay with importance scoring
feat(#247): smart memory decay with importance scoring (#303)
feat(#247): smart memory decay with importance scoring (#303)