Skip to content

Feature: Memory importance scoring with LLM-as-judge #1

@cdzzy

Description

@cdzzy

Problem

Current memory implementations store everything equally. In practice, "the user prefers dark mode" should outlive "the user asked about the weather today." Without importance weighting, memory gets cluttered with low-value entries.

Proposed Solution

const memory = new Engram({
  importanceScorer: async (entry: MemoryEntry) => {
    // Uses a cheap LLM call to score importance 0-1
    return await llmJudge.score(entry.content, {
      criteria: ["long-term relevance", "user preference", "factual importance"]
    })
  },
  decayConfig: {
    baseDecayRate: 0.1,        // per day
    importanceMultiplier: true  // high-importance entries decay slower
  }
})

Decay Formula

effective_decay = base_decay * (1 - importance_score)
# High importance (0.9) → very slow decay
# Low importance (0.1) → fast decay

Use Cases

  • Personal assistant agents: remember preferences forever, forget one-off queries
  • Customer support: remember account issues, forget casual greetings
  • Research agents: preserve key findings, discard intermediate thoughts

Implementation Notes

  • importanceScorer is optional (default: uniform importance)
  • Could use embedding similarity to existing memories as a proxy for importance
  • Batch scoring to minimize LLM API calls

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions