Expand description
Importance scoring for memory chunks.
Importance is a real in [0,1] assigned at write time. It drives eviction
priority — chunks with lower importance are evicted first when storage caps
or aging sweeps run.
The scorer is a pure function over the new chunk’s metadata
(kind, source, content length, explicit caller hint). It produces
a default score when NewMemoryChunk::importance is None; if
the caller supplies a value, that value is honored verbatim (after
clamping). The provider calls score at write time and stores the
result in memory_chunks.importance.
Heuristic weights (signals that nudge importance up or down):
| Signal | Δ |
|---|---|
kind = Correction | +0.4 |
kind = Fire and metadata says require_confirmation | +0.2 |
kind = Action and metadata says decision = denied | +0.2 |
kind = JobSummary | +0.2 |
metadata "user_ack": true | +0.3 |
metadata "pinned_entity": true | +0.1 |
kind = Observation and metadata "stability": "transient" | −0.2 |
kind = Context and metadata "duration_ms" small (<2000) | −0.1 |
Baseline: 0.5.
Floor: 0.1 for Chat and Action chunks regardless of score —
the user’s own words and the agent’s own actions are never evicted
purely because their importance number is low.
Use-cite bumps (+0.05 per cite, capped at +0.2) are applied via
crate::MemoryProvider::record_access later, not at write time.
Functions§
- score
- Compute the initial importance score for a new chunk.