Skip to content

⭐ Feature: Smart memory decay and importance scoring #247

Closed

Description

@ajianaz

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/recall activity 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.

Activity

  1. added
    scope:core
    type:feature
    v0.1.0
    enhancement
    and removed
    type:feature
    on Jun 9, 2026
  2. added this to the milestone on Jun 11, 2026
  3. ajianaz commented on Jun 11, 2026

    @ajianaz
    CollaboratorAuthor

    ⭐ 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

    importance = (access_weight * access_score)
               + (recency_weight * recency_score)
               + (connectivity_weight * connectivity_score)
               + (pin_weight * is_pinned)
               + (explicit_weight * was_explicit)
               + (room_weight * room_score)         ← NEW
    

    Where:

    • room_score = min(room_participation_count / 5, 1.0) — normalized room activity
    • room_participation_count = number of rooms this memory is linked to
    • Memories in active rooms (recent activity) get a recency boost
    • Room lead contributions (role = "lead") get higher weight than participant

    Rationale

    • Multi-agent discussion = high importance: If CTO, Zeko, and BadSector all discussed a topic, that memory is more important than a solitary note.
    • Cross-agent validation: Memories referenced in multiple rooms are likely more reliable/important.
    • Active vs dormant rooms: Recent room activity signals ongoing relevance.

    Updated Acceptance Criteria (add to existing)

    • room_score computed from room_memories participation count
    • Room activity recency boost (memories in recently active rooms score higher)
    • Role-weighted importance (lead > participant > observer)
    • uteke importance command recalculates room scores
    • Importance breakdown includes room contribution in JSON output

    Dependency Note

    #286 (Room) must be implemented first — room_memories table provides the data for room_score. Order: #249 → #286 → #246 → #248 → THIS (#247).

  4. ferhimedamine commented on Jun 11, 2026

    @ferhimedamine

    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_count over-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_type enum (e.g., semantic for facts, episodic for events, procedural for learned patterns) lets you apply different weight profiles per type rather than one formula for all memories.

  5. added 2 commits that reference this issue on Jun 12, 2026
  6. added a commit that references this issue on Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementpriority:mediumscope:corev0.1.0

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions