Skip to main content

Function: updateOnRetrieval()

updateOnRetrieval(trace, now): RetrievalUpdateResult

Defined in: packages/agentos/src/memory/decay/DecayModel.ts:68

Update a trace's decay parameters after a successful retrieval.

Implements the desirable difficulty effect: memories that were harder to retrieve (lower current strength) receive a larger stability boost, making the next retrieval easier and longer-lasting.

Stability growth also accounts for:

  • Diminishing returns on repeated retrievals (logarithmic saturation)
  • Emotional intensity bonus (emotional memories consolidate faster)

Parameters

trace

MemoryTrace

now

number

Returns

RetrievalUpdateResult